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

Skip to content

Commit 6e8d054

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

File tree

1 file changed

+26
-2
lines changed

1 file changed

+26
-2
lines changed

gitlab/v4/objects/service_accounts.py

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,21 @@
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 (
3+
CreateMixin,
4+
DeleteMixin,
5+
ListMixin,
6+
RotateMixin,
7+
ObjectDeleteMixin,
8+
ObjectRotateMixin,
9+
)
10+
from gitlab.types import RequiredOptional, ArrayAttribute
411

512
__all__ = [
613
"ServiceAccount",
714
"ServiceAccountManager",
815
"GroupServiceAccount",
916
"GroupServiceAccountManager",
17+
"GroupServiceAccountAccessToken",
18+
"GroupServiceAccountAccessTokenManager",
1019
]
1120

1221

@@ -33,3 +42,18 @@ class GroupServiceAccountManager(CreateMixin, DeleteMixin, ListMixin, RESTManage
3342
_create_attrs = RequiredOptional(
3443
optional=("name", "username"),
3544
)
45+
46+
47+
class GroupServiceAccountAccessToken(ObjectRotateMixin, RESTObject):
48+
pass
49+
50+
51+
class GroupServiceAccountAccessTokenManager(CreateMixin, RotateMixin, RESTManager):
52+
_path = "/groups/{group_id}/service_accounts/{user_id}/personal_access_tokens"
53+
_obj_cls = GroupServiceAccountAccessToken
54+
_from_parent_attrs = {"group_id": "id", "user_id": "user_id"}
55+
_create_attrs = RequiredOptional(
56+
required=("name", "scopes"),
57+
optional=("expires_at",),
58+
)
59+
_types = {"scopes": ArrayAttribute}

0 commit comments

Comments
 (0)
0