8000 feat(api): Add support for group service account access tokens. · python-gitlab/python-gitlab@c2c3882 · GitHub
[go: up one dir, main page]

Skip to content

Commit c2c3882

Browse files
author
Rolf Offermanns
committed
feat(api): Add support for group service account access tokens.
Fixes #2946
1 parent c20565d commit c2c3882

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

gitlab/v4/objects/service_accounts.py

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
from gitlab.base import RESTManager, RESTObject
2-
from gitlab.mixins import CreateMixin, DeleteMixin, ListMixin, ObjectDeleteMixin
3-
from gitlab.types import RequiredOptional
2+
from gitlab.mixins import CreateMixin, DeleteMixin, ListMixin, RotateMixin, ObjectDeleteMixin, ObjectRotateMixin
3+
from gitlab.types import RequiredOptional, ArrayAttribute
44

55
__all__ = [
66
"ServiceAccount",
77
"ServiceAccountManager",
88
"GroupServiceAccount",
9-
"GroupServiceAccountManager"
9+
"GroupServiceAccountManager",
10+
"GroupServiceAccountAccessToken",
11+
"GroupServiceAccountAccessTokenManager"
1012
]
1113

1214

@@ -33,3 +35,17 @@ class GroupServiceAccountManager(CreateMixin, DeleteMixin, ListMixin, RESTManage
3335
_create_attrs = RequiredOptional(
3436
optional=("name", "username"),
3537
)
38+
39+
40+
class GroupServiceAccountAccessToken(ObjectRotateMixin, RESTObject):
41+
pass
42+
43+
44+
class GroupServiceAccountAccessTokenManager(CreateMixin, RotateMixin, RESTManager):
45+
_path = "/groups/{group_id}/service_accounts/{user_id}/personal_access_tokens"
46+
_obj_cls = GroupServiceAccountAccessToken
47+
_from_parent_attrs = {"group_id": "id", "user_id": "user_id"}
48+
_create_attrs = RequiredOptional(
49+
required=("name", "scopes"), optional=("expires_at",),
50+
)
51+
_types = {"scopes": ArrayAttribute}

0 commit comments

Comments
 (0)
0