FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
python-gitlab/gitlab/v4/objects/job_token_scope.py at v7.1.0 · python-gitlab/python-gitlab · GitHub
python-gitlab
python-gitlab
Repository navigation
Code
Issues
16
(16)
Pull requests
15
(15)
Discussions
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
python-gitlab
/
gitlab
/
v4
/
objects
/
job_token_scope.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
81 lines (63 loc) · 2.57 KB
Breadcrumbs
python-gitlab
/
gitlab
/
v4
/
objects
/
job_token_scope.py
Copy path
File metadata and controls
81 lines (63 loc) · 2.57 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
from
__future__
import
annotations
from
typing
import
cast
from
gitlab
.
base
import
RESTObject
from
gitlab
.
mixins
import
(
CreateMixin
,
DeleteMixin
,
GetWithoutIdMixin
,
ListMixin
,
ObjectDeleteMixin
,
RefreshMixin
,
SaveMixin
,
UpdateMethod
,
UpdateMixin
,
)
from
gitlab
.
types
import
RequiredOptional
__all__
=
[
"ProjectJobTokenScope"
,
"ProjectJobTokenScopeManager"
]
class
ProjectJobTokenScope
(
RefreshMixin
,
SaveMixin
,
RESTObject
):
_id_attr
=
None
allowlist
:
AllowlistProjectManager
groups_allowlist
:
AllowlistGroupManager
class
ProjectJobTokenScopeManager
(
GetWithoutIdMixin
[
ProjectJobTokenScope
],
UpdateMixin
[
ProjectJobTokenScope
]
):
_path
=
"/projects/{project_id}/job_token_scope"
_obj_cls
=
ProjectJobTokenScope
_from_parent_attrs
=
{
"project_id"
:
"id"
}
_update_method
=
UpdateMethod
.
PATCH
class
AllowlistProject
(
ObjectDeleteMixin
,
RESTObject
):
_id_attr
=
"target_project_id"
# note: only true for create endpoint
def
get_id
(
self
)
->
int
:
"""Returns the id of the resource. This override deals with
the fact that either an `id` or a `target_project_id` attribute
is returned by the server depending on the endpoint called."""
target_project_id
=
cast
(
int
,
super
().
get_id
())
if
target_project_id
is
not
None
:
return
target_project_id
return
cast
(
int
,
self
.
id
)
class
AllowlistProjectManager
(
ListMixin
[
AllowlistProject
],
CreateMixin
[
AllowlistProject
],
DeleteMixin
[
AllowlistProject
],
):
_path
=
"/projects/{project_id}/job_token_scope/allowlist"
_obj_cls
=
AllowlistProject
_from_parent_attrs
=
{
"project_id"
:
"project_id"
}
_create_attrs
=
RequiredOptional
(
required
=
(
"target_project_id"
,))
class
AllowlistGroup
(
ObjectDeleteMixin
,
RESTObject
):
_id_attr
=
"target_group_id"
# note: only true for create endpoint
def
get_id
(
self
)
->
int
:
"""Returns the id of the resource. This override deals with
the fact that either an `id` or a `target_group_id` attribute
is returned by the server depending on the endpoint called."""
target_group_id
=
cast
(
int
,
super
().
get_id
())
if
target_group_id
is
not
None
:
return
target_group_id
return
cast
(
int
,
self
.
id
)
class
AllowlistGroupManager
(
ListMixin
[
AllowlistGroup
],
CreateMixin
[
AllowlistGroup
],
DeleteMixin
[
AllowlistGroup
]
):
_path
=
"/projects/{project_id}/job_token_scope/groups_allowlist"
_obj_cls
=
AllowlistGroup
_from_parent_attrs
=
{
"project_id"
:
"project_id"
}
_create_attrs
=
RequiredOptional
(
required
=
(
"target_group_id"
,))
Back
|
FazBrowse Home
|
New Git URL