python-gitlab 5.6.0__py3-none-any.whl → 6.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- gitlab/__init__.py +0 -1
- gitlab/_backends/protocol.py +9 -13
- gitlab/_backends/requests_backend.py +12 -12
- gitlab/_version.py +1 -1
- gitlab/base.py +48 -48
- gitlab/cli.py +14 -24
- gitlab/client.py +114 -140
- gitlab/config.py +16 -17
- gitlab/exceptions.py +7 -5
- gitlab/mixins.py +154 -238
- gitlab/types.py +13 -14
- gitlab/utils.py +32 -43
- gitlab/v4/cli.py +50 -53
- gitlab/v4/objects/__init__.py +1 -0
- gitlab/v4/objects/access_requests.py +11 -3
- gitlab/v4/objects/appearance.py +12 -14
- gitlab/v4/objects/applications.py +5 -6
- gitlab/v4/objects/artifacts.py +10 -17
- gitlab/v4/objects/audit_events.py +4 -19
- gitlab/v4/objects/award_emojis.py +13 -57
- gitlab/v4/objects/badges.py +4 -19
- gitlab/v4/objects/boards.py +7 -27
- gitlab/v4/objects/branches.py +3 -15
- gitlab/v4/objects/broadcast_messages.py +3 -13
- gitlab/v4/objects/bulk_imports.py +6 -14
- gitlab/v4/objects/ci_lint.py +7 -13
- gitlab/v4/objects/cluster_agents.py +3 -13
- gitlab/v4/objects/clusters.py +13 -23
- gitlab/v4/objects/commits.py +23 -28
- gitlab/v4/objects/container_registry.py +13 -19
- gitlab/v4/objects/custom_attributes.py +16 -21
- gitlab/v4/objects/deploy_keys.py +22 -19
- gitlab/v4/objects/deploy_tokens.py +14 -32
- gitlab/v4/objects/deployments.py +13 -15
- gitlab/v4/objects/discussions.py +13 -29
- gitlab/v4/objects/draft_notes.py +4 -14
- gitlab/v4/objects/environments.py +13 -21
- gitlab/v4/objects/epics.py +14 -17
- gitlab/v4/objects/events.py +27 -79
- gitlab/v4/objects/export_import.py +7 -19
- gitlab/v4/objects/features.py +11 -12
- gitlab/v4/objects/files.py +23 -38
- gitlab/v4/objects/geo_nodes.py +7 -11
- gitlab/v4/objects/group_access_tokens.py +6 -13
- gitlab/v4/objects/groups.py +40 -37
- gitlab/v4/objects/hooks.py +4 -17
- gitlab/v4/objects/integrations.py +7 -18
- gitlab/v4/objects/invitations.py +12 -23
- gitlab/v4/objects/issues.py +21 -27
- gitlab/v4/objects/iterations.py +4 -8
- gitlab/v4/objects/job_token_scope.py +18 -14
- gitlab/v4/objects/jobs.py +17 -32
- gitlab/v4/objects/keys.py +8 -11
- gitlab/v4/objects/labels.py +19 -30
- gitlab/v4/objects/ldap.py +25 -9
- gitlab/v4/objects/member_roles.py +102 -0
- gitlab/v4/objects/members.py +11 -29
- gitlab/v4/objects/merge_request_approvals.py +31 -44
- gitlab/v4/objects/merge_requests.py +30 -40
- gitlab/v4/objects/merge_trains.py +3 -6
- gitlab/v4/objects/milestones.py +23 -29
- gitlab/v4/objects/namespaces.py +4 -10
- gitlab/v4/objects/notes.py +26 -69
- gitlab/v4/objects/notification_settings.py +5 -14
- gitlab/v4/objects/package_protection_rules.py +8 -8
- gitlab/v4/objects/packages.py +22 -37
- gitlab/v4/objects/pages.py +8 -14
- gitlab/v4/objects/personal_access_tokens.py +7 -10
- gitlab/v4/objects/pipelines.py +38 -47
- gitlab/v4/objects/project_access_tokens.py +6 -13
- gitlab/v4/objects/projects.py +54 -76
- gitlab/v4/objects/push_rules.py +13 -15
- gitlab/v4/objects/registry_protection_repository_rules.py +6 -7
- gitlab/v4/objects/registry_protection_rules.py +7 -11
- gitlab/v4/objects/releases.py +6 -20
- gitlab/v4/objects/repositories.py +25 -34
- gitlab/v4/objects/resource_groups.py +10 -15
- gitlab/v4/objects/reviewers.py +4 -2
- gitlab/v4/objects/runners.py +14 -13
- gitlab/v4/objects/secure_files.py +8 -21
- gitlab/v4/objects/service_accounts.py +7 -5
- gitlab/v4/objects/settings.py +13 -14
- gitlab/v4/objects/sidekiq.py +17 -18
- gitlab/v4/objects/snippets.py +78 -66
- gitlab/v4/objects/statistics.py +8 -23
- gitlab/v4/objects/status_checks.py +6 -3
- gitlab/v4/objects/tags.py +3 -13
- gitlab/v4/objects/templates.py +11 -59
- gitlab/v4/objects/todos.py +3 -6
- gitlab/v4/objects/topics.py +10 -21
- gitlab/v4/objects/triggers.py +3 -13
- gitlab/v4/objects/users.py +87 -93
- gitlab/v4/objects/variables.py +4 -19
- gitlab/v4/objects/wikis.py +4 -19
- {python_gitlab-5.6.0.dist-info → python_gitlab-6.0.0.dist-info}/METADATA +3 -2
- python_gitlab-6.0.0.dist-info/RECORD +107 -0
- {python_gitlab-5.6.0.dist-info → python_gitlab-6.0.0.dist-info}/WHEEL +1 -1
- python_gitlab-5.6.0.dist-info/RECORD +0 -106
- {python_gitlab-5.6.0.dist-info → python_gitlab-6.0.0.dist-info}/entry_points.txt +0 -0
- {python_gitlab-5.6.0.dist-info → python_gitlab-6.0.0.dist-info/licenses}/AUTHORS +0 -0
- {python_gitlab-5.6.0.dist-info → python_gitlab-6.0.0.dist-info/licenses}/COPYING +0 -0
- {python_gitlab-5.6.0.dist-info → python_gitlab-6.0.0.dist-info}/top_level.txt +0 -0
@@ -1,6 +1,8 @@
|
|
1
|
-
from
|
1
|
+
from __future__ import annotations
|
2
2
|
|
3
|
-
from
|
3
|
+
from typing import cast
|
4
|
+
|
5
|
+
from gitlab.base import RESTObject
|
4
6
|
from gitlab.mixins import (
|
5
7
|
CreateMixin,
|
6
8
|
DeleteMixin,
|
@@ -14,28 +16,24 @@ from gitlab.mixins import (
|
|
14
16
|
)
|
15
17
|
from gitlab.types import RequiredOptional
|
16
18
|
|
17
|
-
__all__ = [
|
18
|
-
"ProjectJobTokenScope",
|
19
|
-
"ProjectJobTokenScopeManager",
|
20
|
-
]
|
19
|
+
__all__ = ["ProjectJobTokenScope", "ProjectJobTokenScopeManager"]
|
21
20
|
|
22
21
|
|
23
22
|
class ProjectJobTokenScope(RefreshMixin, SaveMixin, RESTObject):
|
24
23
|
_id_attr = None
|
25
24
|
|
26
|
-
allowlist:
|
27
|
-
groups_allowlist:
|
25
|
+
allowlist: AllowlistProjectManager
|
26
|
+
groups_allowlist: AllowlistGroupManager
|
28
27
|
|
29
28
|
|
30
|
-
class ProjectJobTokenScopeManager(
|
29
|
+
class ProjectJobTokenScopeManager(
|
30
|
+
GetWithoutIdMixin[ProjectJobTokenScope], UpdateMixin[ProjectJobTokenScope]
|
31
|
+
):
|
31
32
|
_path = "/projects/{project_id}/job_token_scope"
|
32
33
|
_obj_cls = ProjectJobTokenScope
|
33
34
|
_from_parent_attrs = {"project_id": "id"}
|
34
35
|
_update_method = UpdateMethod.PATCH
|
35
36
|
|
36
|
-
def get(self, **kwargs: Any) -> ProjectJobTokenScope:
|
37
|
-
return cast(ProjectJobTokenScope, super().get(**kwargs))
|
38
|
-
|
39
37
|
|
40
38
|
class AllowlistProject(ObjectDeleteMixin, RESTObject):
|
41
39
|
_id_attr = "target_project_id" # note: only true for create endpoint
|
@@ -50,7 +48,11 @@ class AllowlistProject(ObjectDeleteMixin, RESTObject):
|
|
50
48
|
return cast(int, self.id)
|
51
49
|
|
52
50
|
|
53
|
-
class AllowlistProjectManager(
|
51
|
+
class AllowlistProjectManager(
|
52
|
+
ListMixin[AllowlistProject],
|
53
|
+
CreateMixin[AllowlistProject],
|
54
|
+
DeleteMixin[AllowlistProject],
|
55
|
+
):
|
54
56
|
_path = "/projects/{project_id}/job_token_scope/allowlist"
|
55
57
|
_obj_cls = AllowlistProject
|
56
58
|
_from_parent_attrs = {"project_id": "project_id"}
|
@@ -70,7 +72,9 @@ class AllowlistGroup(ObjectDeleteMixin, RESTObject):
|
|
70
72
|
return cast(int, self.id)
|
71
73
|
|
72
74
|
|
73
|
-
class AllowlistGroupManager(
|
75
|
+
class AllowlistGroupManager(
|
76
|
+
ListMixin[AllowlistGroup], CreateMixin[AllowlistGroup], DeleteMixin[AllowlistGroup]
|
77
|
+
):
|
74
78
|
_path = "/projects/{project_id}/job_token_scope/groups_allowlist"
|
75
79
|
_obj_cls = AllowlistGroup
|
76
80
|
_from_parent_attrs = {"project_id": "project_id"}
|
gitlab/v4/objects/jobs.py
CHANGED
@@ -1,35 +1,23 @@
|
|
1
|
-
from
|
2
|
-
|
3
|
-
|
4
|
-
cast,
|
5
|
-
Dict,
|
6
|
-
Iterator,
|
7
|
-
Literal,
|
8
|
-
Optional,
|
9
|
-
overload,
|
10
|
-
TYPE_CHECKING,
|
11
|
-
Union,
|
12
|
-
)
|
1
|
+
from __future__ import annotations
|
2
|
+
|
3
|
+
from typing import Any, Callable, Iterator, Literal, overload, TYPE_CHECKING
|
13
4
|
|
14
5
|
import requests
|
15
6
|
|
16
7
|
from gitlab import cli
|
17
8
|
from gitlab import exceptions as exc
|
18
9
|
from gitlab import utils
|
19
|
-
from gitlab.base import
|
10
|
+
from gitlab.base import RESTObject
|
20
11
|
from gitlab.mixins import RefreshMixin, RetrieveMixin
|
21
12
|
from gitlab.types import ArrayAttribute
|
22
13
|
|
23
|
-
__all__ = [
|
24
|
-
"ProjectJob",
|
25
|
-
"ProjectJobManager",
|
26
|
-
]
|
14
|
+
__all__ = ["ProjectJob", "ProjectJobManager"]
|
27
15
|
|
28
16
|
|
29
17
|
class ProjectJob(RefreshMixin, RESTObject):
|
30
18
|
@cli.register_custom_action(cls_names="ProjectJob")
|
31
19
|
@exc.on_http_error(exc.GitlabJobCancelError)
|
32
|
-
def cancel(self, **kwargs: Any) ->
|
20
|
+
def cancel(self, **kwargs: Any) -> dict[str, Any]:
|
33
21
|
"""Cancel the job.
|
34
22
|
|
35
23
|
Args:
|
@@ -47,7 +35,7 @@ class ProjectJob(RefreshMixin, RESTObject):
|
|
47
35
|
|
48
36
|
@cli.register_custom_action(cls_names="ProjectJob")
|
49
37
|
@exc.on_http_error(exc.GitlabJobRetryError)
|
50
|
-
def retry(self, **kwargs: Any) ->
|
38
|
+
def retry(self, **kwargs: Any) -> dict[str, Any]:
|
51
39
|
"""Retry the job.
|
52
40
|
|
53
41
|
Args:
|
@@ -152,7 +140,7 @@ class ProjectJob(RefreshMixin, RESTObject):
|
|
152
140
|
def artifacts(
|
153
141
|
self,
|
154
142
|
streamed: Literal[True] = True,
|
155
|
-
action:
|
143
|
+
action: Callable[[bytes], Any] | None = None,
|
156
144
|
chunk_size: int = 1024,
|
157
145
|
*,
|
158
146
|
iterator: Literal[False] = False,
|
@@ -164,12 +152,12 @@ class ProjectJob(RefreshMixin, RESTObject):
|
|
164
152
|
def artifacts(
|
165
153
|
self,
|
166
154
|
streamed: bool = False,
|
167
|
-
action:
|
155
|
+
action: Callable[..., Any] | None = None,
|
168
156
|
chunk_size: int = 1024,
|
169
157
|
*,
|
170
158
|
iterator: bool = False,
|
171
159
|
**kwargs: Any,
|
172
|
-
) ->
|
160
|
+
) -> bytes | Iterator[Any] | None:
|
173
161
|
"""Get the job artifacts.
|
174
162
|
|
175
163
|
Args:
|
@@ -229,7 +217,7 @@ class ProjectJob(RefreshMixin, RESTObject):
|
|
229
217
|
self,
|
230
218
|
path: str,
|
231
219
|
streamed: Literal[True] = True,
|
232
|
-
action:
|
220
|
+
action: Callable[[bytes], Any] | None = None,
|
233
221
|
chunk_size: int = 1024,
|
234
222
|
*,
|
235
223
|
iterator: Literal[False] = False,
|
@@ -242,12 +230,12 @@ class ProjectJob(RefreshMixin, RESTObject):
|
|
242
230
|
self,
|
243
231
|
path: str,
|
244
232
|
streamed: bool = False,
|
245
|
-
action:
|
233
|
+
action: Callable[..., Any] | None = None,
|
246
234
|
chunk_size: int = 1024,
|
247
235
|
*,
|
248
236
|
iterator: bool = False,
|
249
237
|
**kwargs: Any,
|
250
|
-
) ->
|
238
|
+
) -> bytes | Iterator[Any] | None:
|
251
239
|
"""Get a single artifact file from within the job's artifacts archive.
|
252
240
|
|
253
241
|
Args:
|
@@ -305,7 +293,7 @@ class ProjectJob(RefreshMixin, RESTObject):
|
|
305
293
|
def trace(
|
306
294
|
self,
|
307
295
|
streamed: Literal[True] = True,
|
308
|
-
action:
|
296
|
+
action: Callable[[bytes], Any] | None = None,
|
309
297
|
chunk_size: int = 1024,
|
310
298
|
*,
|
311
299
|
iterator: Literal[False] = False,
|
@@ -317,12 +305,12 @@ class ProjectJob(RefreshMixin, RESTObject):
|
|
317
305
|
def trace(
|
318
306
|
self,
|
319
307
|
streamed: bool = False,
|
320
|
-
action:
|
308
|
+
action: Callable[..., Any] | None = None,
|
321
309
|
chunk_size: int = 1024,
|
322
310
|
*,
|
323
311
|
iterator: bool = False,
|
324
312
|
**kwargs: Any,
|
325
|
-
) ->
|
313
|
+
) -> bytes | Iterator[Any] | None:
|
326
314
|
"""Get the job trace.
|
327
315
|
|
328
316
|
Args:
|
@@ -354,12 +342,9 @@ class ProjectJob(RefreshMixin, RESTObject):
|
|
354
342
|
)
|
355
343
|
|
356
344
|
|
357
|
-
class ProjectJobManager(RetrieveMixin
|
345
|
+
class ProjectJobManager(RetrieveMixin[ProjectJob]):
|
358
346
|
_path = "/projects/{project_id}/jobs"
|
359
347
|
_obj_cls = ProjectJob
|
360
348
|
_from_parent_attrs = {"project_id": "id"}
|
361
349
|
_list_filters = ("scope",)
|
362
350
|
_types = {"scope": ArrayAttribute}
|
363
|
-
|
364
|
-
def get(self, id: Union[str, int], lazy: bool = False, **kwargs: Any) -> ProjectJob:
|
365
|
-
return cast(ProjectJob, super().get(id=id, lazy=lazy, **kwargs))
|
gitlab/v4/objects/keys.py
CHANGED
@@ -1,33 +1,30 @@
|
|
1
|
-
from
|
1
|
+
from __future__ import annotations
|
2
2
|
|
3
|
-
from
|
3
|
+
from typing import Any, TYPE_CHECKING
|
4
|
+
|
5
|
+
from gitlab.base import RESTObject
|
4
6
|
from gitlab.mixins import GetMixin
|
5
7
|
|
6
|
-
__all__ = [
|
7
|
-
"Key",
|
8
|
-
"KeyManager",
|
9
|
-
]
|
8
|
+
__all__ = ["Key", "KeyManager"]
|
10
9
|
|
11
10
|
|
12
11
|
class Key(RESTObject):
|
13
12
|
pass
|
14
13
|
|
15
14
|
|
16
|
-
class KeyManager(GetMixin
|
15
|
+
class KeyManager(GetMixin[Key]):
|
17
16
|
_path = "/keys"
|
18
17
|
_obj_cls = Key
|
19
18
|
|
20
19
|
def get(
|
21
|
-
self, id:
|
20
|
+
self, id: int | str | None = None, lazy: bool = False, **kwargs: Any
|
22
21
|
) -> Key:
|
23
22
|
if id is not None:
|
24
|
-
return
|
23
|
+
return super().get(id, lazy=lazy, **kwargs)
|
25
24
|
|
26
25
|
if "fingerprint" not in kwargs:
|
27
26
|
raise AttributeError("Missing attribute: id or fingerprint")
|
28
27
|
|
29
|
-
if TYPE_CHECKING:
|
30
|
-
assert self.path is not None
|
31
28
|
server_data = self.gitlab.http_get(self.path, **kwargs)
|
32
29
|
if TYPE_CHECKING:
|
33
30
|
assert isinstance(server_data, dict)
|
gitlab/v4/objects/labels.py
CHANGED
@@ -1,7 +1,9 @@
|
|
1
|
-
from
|
1
|
+
from __future__ import annotations
|
2
|
+
|
3
|
+
from typing import Any
|
2
4
|
|
3
5
|
from gitlab import exceptions as exc
|
4
|
-
from gitlab.base import
|
6
|
+
from gitlab.base import RESTObject
|
5
7
|
from gitlab.mixins import (
|
6
8
|
CreateMixin,
|
7
9
|
DeleteMixin,
|
@@ -14,17 +16,12 @@ from gitlab.mixins import (
|
|
14
16
|
)
|
15
17
|
from gitlab.types import RequiredOptional
|
16
18
|
|
17
|
-
__all__ = [
|
18
|
-
"GroupLabel",
|
19
|
-
"GroupLabelManager",
|
20
|
-
"ProjectLabel",
|
21
|
-
"ProjectLabelManager",
|
22
|
-
]
|
19
|
+
__all__ = ["GroupLabel", "GroupLabelManager", "ProjectLabel", "ProjectLabelManager"]
|
23
20
|
|
24
21
|
|
25
22
|
class GroupLabel(SubscribableMixin, SaveMixin, ObjectDeleteMixin, RESTObject):
|
26
23
|
_id_attr = "name"
|
27
|
-
manager:
|
24
|
+
manager: GroupLabelManager
|
28
25
|
|
29
26
|
# Update without ID, but we need an ID to get from list.
|
30
27
|
@exc.on_http_error(exc.GitlabUpdateError)
|
@@ -48,7 +45,10 @@ class GroupLabel(SubscribableMixin, SaveMixin, ObjectDeleteMixin, RESTObject):
|
|
48
45
|
|
49
46
|
|
50
47
|
class GroupLabelManager(
|
51
|
-
RetrieveMixin,
|
48
|
+
RetrieveMixin[GroupLabel],
|
49
|
+
CreateMixin[GroupLabel],
|
50
|
+
UpdateMixin[GroupLabel],
|
51
|
+
DeleteMixin[GroupLabel],
|
52
52
|
):
|
53
53
|
_path = "/groups/{group_id}/labels"
|
54
54
|
_obj_cls = GroupLabel
|
@@ -60,18 +60,12 @@ class GroupLabelManager(
|
|
60
60
|
required=("name",), optional=("new_name", "color", "description", "priority")
|
61
61
|
)
|
62
62
|
|
63
|
-
def get(self, id: Union[str, int], lazy: bool = False, **kwargs: Any) -> GroupLabel:
|
64
|
-
return cast(GroupLabel, super().get(id=id, lazy=lazy, **kwargs))
|
65
|
-
|
66
63
|
# Update without ID.
|
67
64
|
# NOTE(jlvillal): Signature doesn't match UpdateMixin.update() so ignore
|
68
65
|
# type error
|
69
66
|
def update( # type: ignore[override]
|
70
|
-
self,
|
71
|
-
|
72
|
-
new_data: Optional[Dict[str, Any]] = None,
|
73
|
-
**kwargs: Any,
|
74
|
-
) -> Dict[str, Any]:
|
67
|
+
self, name: str | None, new_data: dict[str, Any] | None = None, **kwargs: Any
|
68
|
+
) -> dict[str, Any]:
|
75
69
|
"""Update a Label on the server.
|
76
70
|
|
77
71
|
Args:
|
@@ -88,7 +82,7 @@ class ProjectLabel(
|
|
88
82
|
PromoteMixin, SubscribableMixin, SaveMixin, ObjectDeleteMixin, RESTObject
|
89
83
|
):
|
90
84
|
_id_attr = "name"
|
91
|
-
manager:
|
85
|
+
manager: ProjectLabelManager
|
92
86
|
|
93
87
|
# Update without ID, but we need an ID to get from list.
|
94
88
|
@exc.on_http_error(exc.GitlabUpdateError)
|
@@ -112,7 +106,10 @@ class ProjectLabel(
|
|
112
106
|
|
113
107
|
|
114
108
|
class ProjectLabelManager(
|
115
|
-
RetrieveMixin,
|
109
|
+
RetrieveMixin[ProjectLabel],
|
110
|
+
CreateMixin[ProjectLabel],
|
111
|
+
UpdateMixin[ProjectLabel],
|
112
|
+
DeleteMixin[ProjectLabel],
|
116
113
|
):
|
117
114
|
_path = "/projects/{project_id}/labels"
|
118
115
|
_obj_cls = ProjectLabel
|
@@ -124,20 +121,12 @@ class ProjectLabelManager(
|
|
124
121
|
required=("name",), optional=("new_name", "color", "description", "priority")
|
125
122
|
)
|
126
123
|
|
127
|
-
def get(
|
128
|
-
self, id: Union[str, int], lazy: bool = False, **kwargs: Any
|
129
|
-
) -> ProjectLabel:
|
130
|
-
return cast(ProjectLabel, super().get(id=id, lazy=lazy, **kwargs))
|
131
|
-
|
132
124
|
# Update without ID.
|
133
125
|
# NOTE(jlvillal): Signature doesn't match UpdateMixin.update() so ignore
|
134
126
|
# type error
|
135
127
|
def update( # type: ignore[override]
|
136
|
-
self,
|
137
|
-
|
138
|
-
new_data: Optional[Dict[str, Any]] = None,
|
139
|
-
**kwargs: Any,
|
140
|
-
) -> Dict[str, Any]:
|
128
|
+
self, name: str | None, new_data: dict[str, Any] | None = None, **kwargs: Any
|
129
|
+
) -> dict[str, Any]:
|
141
130
|
"""Update a Label on the server.
|
142
131
|
|
143
132
|
Args:
|
gitlab/v4/objects/ldap.py
CHANGED
@@ -1,29 +1,45 @@
|
|
1
|
-
from
|
1
|
+
from __future__ import annotations
|
2
|
+
|
3
|
+
from typing import Any, Literal, overload
|
2
4
|
|
3
5
|
from gitlab import exceptions as exc
|
4
6
|
from gitlab.base import RESTManager, RESTObject, RESTObjectList
|
5
7
|
|
6
|
-
__all__ = [
|
7
|
-
"LDAPGroup",
|
8
|
-
"LDAPGroupManager",
|
9
|
-
]
|
8
|
+
__all__ = ["LDAPGroup", "LDAPGroupManager"]
|
10
9
|
|
11
10
|
|
12
11
|
class LDAPGroup(RESTObject):
|
13
12
|
_id_attr = None
|
14
13
|
|
15
14
|
|
16
|
-
class LDAPGroupManager(RESTManager):
|
15
|
+
class LDAPGroupManager(RESTManager[LDAPGroup]):
|
17
16
|
_path = "/ldap/groups"
|
18
17
|
_obj_cls = LDAPGroup
|
19
18
|
_list_filters = ("search", "provider")
|
20
19
|
|
20
|
+
@overload
|
21
|
+
def list(
|
22
|
+
self, *, iterator: Literal[False] = False, **kwargs: Any
|
23
|
+
) -> list[LDAPGroup]: ...
|
24
|
+
|
25
|
+
@overload
|
26
|
+
def list(
|
27
|
+
self, *, iterator: Literal[True] = True, **kwargs: Any
|
28
|
+
) -> RESTObjectList[LDAPGroup]: ...
|
29
|
+
|
30
|
+
@overload
|
31
|
+
def list(
|
32
|
+
self, *, iterator: bool = False, **kwargs: Any
|
33
|
+
) -> list[LDAPGroup] | RESTObjectList[LDAPGroup]: ...
|
34
|
+
|
21
35
|
@exc.on_http_error(exc.GitlabListError)
|
22
|
-
def list(
|
36
|
+
def list(
|
37
|
+
self, *, iterator: bool = False, **kwargs: Any
|
38
|
+
) -> list[LDAPGroup] | RESTObjectList[LDAPGroup]:
|
23
39
|
"""Retrieve a list of objects.
|
24
40
|
|
25
41
|
Args:
|
26
|
-
|
42
|
+
get_all: If True, return all the items, without pagination
|
27
43
|
per_page: Number of items to retrieve per request
|
28
44
|
page: ID of the page to return (starts with page 1)
|
29
45
|
iterator: If set to True and no pagination option is
|
@@ -46,7 +62,7 @@ class LDAPGroupManager(RESTManager):
|
|
46
62
|
else:
|
47
63
|
path = self._path
|
48
64
|
|
49
|
-
obj = self.gitlab.http_list(path, **data)
|
65
|
+
obj = self.gitlab.http_list(path, iterator=iterator, **data)
|
50
66
|
if isinstance(obj, list):
|
51
67
|
return [self._obj_cls(self, item) for item in obj]
|
52
68
|
return RESTObjectList(self, self._obj_cls, obj)
|
@@ -0,0 +1,102 @@
|
|
1
|
+
"""
|
2
|
+
GitLab API:
|
3
|
+
https://docs.gitlab.com/ee/api/instance_level_ci_variables.html
|
4
|
+
https://docs.gitlab.com/ee/api/project_level_variables.html
|
5
|
+
https://docs.gitlab.com/ee/api/group_level_variables.html
|
6
|
+
"""
|
7
|
+
|
8
|
+
from gitlab.base import RESTObject
|
9
|
+
from gitlab.mixins import (
|
10
|
+
CreateMixin,
|
11
|
+
DeleteMixin,
|
12
|
+
ListMixin,
|
13
|
+
ObjectDeleteMixin,
|
14
|
+
SaveMixin,
|
15
|
+
)
|
16
|
+
from gitlab.types import RequiredOptional
|
17
|
+
|
18
|
+
__all__ = [
|
19
|
+
"MemberRole",
|
20
|
+
"MemberRoleManager",
|
21
|
+
"GroupMemberRole",
|
22
|
+
"GroupMemberRoleManager",
|
23
|
+
]
|
24
|
+
|
25
|
+
|
26
|
+
class MemberRole(SaveMixin, ObjectDeleteMixin, RESTObject):
|
27
|
+
pass
|
28
|
+
|
29
|
+
|
30
|
+
class MemberRoleManager(
|
31
|
+
ListMixin[MemberRole], CreateMixin[MemberRole], DeleteMixin[MemberRole]
|
32
|
+
):
|
33
|
+
_path = "/member_roles"
|
34
|
+
_obj_cls = MemberRole
|
35
|
+
_create_attrs = RequiredOptional(
|
36
|
+
required=("name", "base_access_level"),
|
37
|
+
optional=(
|
38
|
+
"description",
|
39
|
+
"admin_cicd_variables",
|
40
|
+
"admin_compliance_framework",
|
41
|
+
"admin_group_member",
|
42
|
+
"admin_group_member",
|
43
|
+
"admin_merge_request",
|
44
|
+
"admin_push_rules",
|
45
|
+
"admin_terraform_state",
|
46
|
+
"admin_vulnerability",
|
47
|
+
"admin_web_hook",
|
48
|
+
"archive_project",
|
49
|
+
"manage_deploy_tokens",
|
50
|
+
"manage_group_access_tokens",
|
51
|
+
"manage_merge_request_settings",
|
52
|
+
"manage_project_access_tokens",
|
53
|
+
"manage_security_policy_link",
|
54
|
+
"read_code",
|
55
|
+
"read_runners",
|
56
|
+
"read_dependency",
|
57
|
+
"read_vulnerability",
|
58
|
+
"remove_group",
|
59
|
+
"remove_project",
|
60
|
+
),
|
61
|
+
)
|
62
|
+
|
63
|
+
|
64
|
+
class GroupMemberRole(SaveMixin, ObjectDeleteMixin, RESTObject):
|
65
|
+
pass
|
66
|
+
|
67
|
+
|
68
|
+
class GroupMemberRoleManager(
|
69
|
+
ListMixin[GroupMemberRole],
|
70
|
+
CreateMixin[GroupMemberRole],
|
71
|
+
DeleteMixin[GroupMemberRole],
|
72
|
+
):
|
73
|
+
_path = "/groups/{group_id}/member_roles"
|
74
|
+
_from_parent_attrs = {"group_id": "id"}
|
75
|
+
_obj_cls = GroupMemberRole
|
76
|
+
_create_attrs = RequiredOptional(
|
77
|
+
required=("name", "base_access_level"),
|
78
|
+
optional=(
|
79
|
+
"description",
|
80
|
+
"admin_cicd_variables",
|
81
|
+
"admin_compliance_framework",
|
82
|
+
"admin_group_member",
|
83
|
+
"admin_group_member",
|
84
|
+
"admin_merge_request",
|
85
|
+
"admin_push_rules",
|
86
|
+
"admin_terraform_state",
|
87
|
+
"admin_vulnerability",
|
88
|
+
"admin_web_hook",
|
89
|
+
"archive_project",
|
90
|
+
"manage_deploy_tokens",
|
91
|
+
"manage_group_access_tokens",
|
92
|
+
"manage_merge_request_settings",
|
93
|
+
"manage_project_access_tokens",
|
94
|
+
"manage_security_policy_link",
|
95
|
+
"read_code",
|
96
|
+
"read_runners",
|
97
|
+
"read_dependency",
|
98
|
+
"read_vulnerability",
|
99
|
+
"remove_group",
|
100
|
+
"remove_project",
|
101
|
+
),
|
102
|
+
)
|
gitlab/v4/objects/members.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
from
|
1
|
+
from __future__ import annotations
|
2
2
|
|
3
3
|
from gitlab import types
|
4
|
-
from gitlab.base import
|
4
|
+
from gitlab.base import RESTObject
|
5
5
|
from gitlab.mixins import (
|
6
6
|
CRUDMixin,
|
7
7
|
DeleteMixin,
|
@@ -32,7 +32,7 @@ class GroupMember(SaveMixin, ObjectDeleteMixin, RESTObject):
|
|
32
32
|
_repr_attr = "username"
|
33
33
|
|
34
34
|
|
35
|
-
class GroupMemberManager(CRUDMixin
|
35
|
+
class GroupMemberManager(CRUDMixin[GroupMember]):
|
36
36
|
_path = "/groups/{group_id}/members"
|
37
37
|
_obj_cls = GroupMember
|
38
38
|
_from_parent_attrs = {"group_id": "id"}
|
@@ -49,19 +49,16 @@ class GroupMemberManager(CRUDMixin, RESTManager):
|
|
49
49
|
"tasks_to_be_done": types.ArrayAttribute,
|
50
50
|
}
|
51
51
|
|
52
|
-
def get(
|
53
|
-
self, id: Union[str, int], lazy: bool = False, **kwargs: Any
|
54
|
-
) -> GroupMember:
|
55
|
-
return cast(GroupMember, super().get(id=id, lazy=lazy, **kwargs))
|
56
|
-
|
57
52
|
|
58
53
|
class GroupBillableMember(ObjectDeleteMixin, RESTObject):
|
59
54
|
_repr_attr = "username"
|
60
55
|
|
61
|
-
memberships:
|
56
|
+
memberships: GroupBillableMemberMembershipManager
|
62
57
|
|
63
58
|
|
64
|
-
class GroupBillableMemberManager(
|
59
|
+
class GroupBillableMemberManager(
|
60
|
+
ListMixin[GroupBillableMember], DeleteMixin[GroupBillableMember]
|
61
|
+
):
|
65
62
|
_path = "/groups/{group_id}/billable_members"
|
66
63
|
_obj_cls = GroupBillableMember
|
67
64
|
_from_parent_attrs = {"group_id": "id"}
|
@@ -72,7 +69,7 @@ class GroupBillableMemberMembership(RESTObject):
|
|
72
69
|
_id_attr = "user_id"
|
73
70
|
|
74
71
|
|
75
|
-
class GroupBillableMemberMembershipManager(ListMixin
|
72
|
+
class GroupBillableMemberMembershipManager(ListMixin[GroupBillableMemberMembership]):
|
76
73
|
_path = "/groups/{group_id}/billable_members/{user_id}/memberships"
|
77
74
|
_obj_cls = GroupBillableMemberMembership
|
78
75
|
_from_parent_attrs = {"group_id": "group_id", "user_id": "id"}
|
@@ -82,22 +79,17 @@ class GroupMemberAll(RESTObject):
|
|
82
79
|
_repr_attr = "username"
|
83
80
|
|
84
81
|
|
85
|
-
class GroupMemberAllManager(RetrieveMixin
|
82
|
+
class GroupMemberAllManager(RetrieveMixin[GroupMemberAll]):
|
86
83
|
_path = "/groups/{group_id}/members/all"
|
87
84
|
_obj_cls = GroupMemberAll
|
88
85
|
_from_parent_attrs = {"group_id": "id"}
|
89
86
|
|
90
|
-
def get(
|
91
|
-
self, id: Union[str, int], lazy: bool = False, **kwargs: Any
|
92
|
-
) -> GroupMemberAll:
|
93
|
-
return cast(GroupMemberAll, super().get(id=id, lazy=lazy, **kwargs))
|
94
|
-
|
95
87
|
|
96
88
|
class ProjectMember(SaveMixin, ObjectDeleteMixin, RESTObject):
|
97
89
|
_repr_attr = "username"
|
98
90
|
|
99
91
|
|
100
|
-
class ProjectMemberManager(CRUDMixin
|
92
|
+
class ProjectMemberManager(CRUDMixin[ProjectMember]):
|
101
93
|
_path = "/projects/{project_id}/members"
|
102
94
|
_obj_cls = ProjectMember
|
103
95
|
_from_parent_attrs = {"project_id": "id"}
|
@@ -114,22 +106,12 @@ class ProjectMemberManager(CRUDMixin, RESTManager):
|
|
114
106
|
"tasks_to_be_dones": types.ArrayAttribute,
|
115
107
|
}
|
116
108
|
|
117
|
-
def get(
|
118
|
-
self, id: Union[str, int], lazy: bool = False, **kwargs: Any
|
119
|
-
) -> ProjectMember:
|
120
|
-
return cast(ProjectMember, super().get(id=id, lazy=lazy, **kwargs))
|
121
|
-
|
122
109
|
|
123
110
|
class ProjectMemberAll(RESTObject):
|
124
111
|
_repr_attr = "username"
|
125
112
|
|
126
113
|
|
127
|
-
class ProjectMemberAllManager(RetrieveMixin
|
114
|
+
class ProjectMemberAllManager(RetrieveMixin[ProjectMemberAll]):
|
128
115
|
_path = "/projects/{project_id}/members/all"
|
129
116
|
_obj_cls = ProjectMemberAll
|
130
117
|
_from_parent_attrs = {"project_id": "id"}
|
131
|
-
|
132
|
-
def get(
|
133
|
-
self, id: Union[str, int], lazy: bool = False, **kwargs: Any
|
134
|
-
) -> ProjectMemberAll:
|
135
|
-
return cast(ProjectMemberAll, super().get(id=id, lazy=lazy, **kwargs))
|