|
| 1 | +""" |
| 2 | +GitLab API: |
| 3 | +https://docs.gitlab.com/ee/api/projects.html |
| 4 | +https://docs.gitlab.com/ee/api/lint.html#validate-a-projects-ci-configuration |
| 5 | +""" |
1 | 6 | fromtypingimportAny,Callable,cast,Dict,List,Optional,TYPE_CHECKING,Union
|
2 | 7 |
|
3 | 8 | importrequests
|
|
9 | 14 | fromgitlab.mixinsimport (
|
10 | 15 | CreateMixin,
|
11 | 16 | CRUDMixin,
|
| 17 | +GetWithoutIdMixin, |
12 | 18 | ListMixin,
|
13 | 19 | ObjectDeleteMixin,
|
14 | 20 | RefreshMixin,
|
|
80 | 86 | "ProjectForkManager",
|
81 | 87 | "ProjectRemoteMirror",
|
82 | 88 | "ProjectRemoteMirrorManager",
|
| 89 | +"ProjectCiLint", |
| 90 | +"ProjectCiLintManager", |
83 | 91 | ]
|
84 | 92 |
|
85 | 93 |
|
@@ -141,6 +149,7 @@ class Project(RefreshMixin, SaveMixin, ObjectDeleteMixin, RepositoryMixin, RESTO
|
141 | 149 | badges:ProjectBadgeManager
|
142 | 150 | boards:ProjectBoardManager
|
143 | 151 | branches:ProjectBranchManager
|
| 152 | +ci_lint:"ProjectCiLintManager" |
144 | 153 | clusters:ProjectClusterManager
|
145 | 154 | commits:ProjectCommitManager
|
146 | 155 | customattributes:ProjectCustomAttributeManager
|
@@ -1013,3 +1022,27 @@ class ProjectRemoteMirrorManager(ListMixin, CreateMixin, UpdateMixin, RESTManage
|
1013 | 1022 | required=("url",),optional=("enabled","only_protected_branches")
|
1014 | 1023 | )
|
1015 | 1024 | _update_attrs=RequiredOptional(optional=("enabled","only_protected_branches"))
|
| 1025 | + |
| 1026 | + |
| 1027 | +classProjectCiLint(RESTObject): |
| 1028 | +pass |
| 1029 | + |
| 1030 | + |
| 1031 | +classProjectCiLintManager(GetWithoutIdMixin,RESTManager): |
| 1032 | +_path="/projects/{project_id}/ci/lint" |
| 1033 | +_obj_cls=ProjectCiLint |
| 1034 | +_from_parent_attrs= {"project_id":"id"} |
| 1035 | +# https://docs.gitlab.com/ee/api/lint.html#validate-a-projects-ci-configuration |
| 1036 | + |
| 1037 | +defget( |
| 1038 | +self,id:Optional[Union[int,str]]=None,**kwargs:Any |
| 1039 | + )->Optional[ProjectCiLint]: |
| 1040 | +ifidisnotNone: |
| 1041 | +raiseAttributeError("Unsupported attribute: id") |
| 1042 | + |
| 1043 | +ifTYPE_CHECKING: |
| 1044 | +assertself.pathisnotNone |
| 1045 | +server_data=self.gitlab.http_get(self.path,**kwargs) |
| 1046 | +ifTYPE_CHECKING: |
| 1047 | +assertisinstance(server_data,dict) |
| 1048 | +returnself._obj_cls(self,server_data) |