|
| 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 | from typing import Any, Callable, cast, Dict, List, Optional, TYPE_CHECKING, Union
|
2 | 7 |
|
3 | 8 | import requests
|
|
83 | 88 | "ProjectRemoteMirrorManager",
|
84 | 89 | "ProjectStorage",
|
85 | 90 | "ProjectStorageManager",
|
| 91 | + "ProjectCiLint", |
| 92 | + "ProjectCiLintManager", |
86 | 93 | ]
|
87 | 94 |
|
88 | 95 |
|
@@ -144,6 +151,7 @@ class Project(RefreshMixin, SaveMixin, ObjectDeleteMixin, RepositoryMixin, RESTO
|
144 | 151 | badges: ProjectBadgeManager
|
145 | 152 | boards: ProjectBoardManager
|
146 | 153 | branches: ProjectBranchManager
|
| 154 | + ci_lint: "ProjectCiLintManager" |
147 | 155 | clusters: ProjectClusterManager
|
148 | 156 | commits: ProjectCommitManager
|
149 | 157 | customattributes: ProjectCustomAttributeManager
|
@@ -1032,3 +1040,27 @@ def get(
|
1032 | 1040 | self, id: Optional[Union[int, str]] = None, **kwargs: Any
|
1033 | 1041 | ) -> Optional[ProjectStorage]:
|
1034 | 1042 | return cast(Optional[ProjectStorage], super().get(id=id, **kwargs))
|
| 1043 | + |
| 1044 | + |
| 1045 | +class ProjectCiLint(RESTObject): |
| 1046 | + pass |
| 1047 | + |
| 1048 | + |
| 1049 | +class ProjectCiLintManager(GetWithoutIdMixin, RESTManager): |
| 1050 | + _path = "/projects/{project_id}/ci/lint" |
| 1051 | + _obj_cls = ProjectCiLint |
| 1052 | + _from_parent_attrs = {"project_id": "id"} |
| 1053 | + # https://docs.gitlab.com/ee/api/lint.html#validate-a-projects-ci-configuration |
| 1054 | + |
| 1055 | + def get( |
| 1056 | + self, id: Optional[Union[int, str]] = None, **kwargs: Any |
| 1057 | + ) -> Optional[ProjectCiLint]: |
| 1058 | + if id is not None: |
| 1059 | + raise AttributeError("Unsupported attribute: id") |
| 1060 | + |
| 1061 | + if TYPE_CHECKING: |
| 1062 | + assert self.path is not None |
| 1063 | + server_data = self.gitlab.http_get(self.path, **kwargs) |
| 1064 | + if TYPE_CHECKING: |
| 1065 | + assert isinstance(server_data, dict) |
| 1066 | + return self._obj_cls(self, server_data) |
0 commit comments