Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit4492fc4

Browse files
committed
feat(api): add support for instance variables
1 parentda8af6f commit4492fc4

File tree

3 files changed

+52
-24
lines changed

3 files changed

+52
-24
lines changed

‎gitlab/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ def __init__(
139139
self.pagesdomains=objects.PagesDomainManager(self)
140140
self.user_activities=objects.UserActivitiesManager(self)
141141
self.applications=objects.ApplicationManager(self)
142+
self.variables=objects.VariableManager(self)
142143

143144
def__enter__(self):
144145
returnself

‎gitlab/v4/objects/__init__.py

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
fromgitlab.mixinsimport*# noqa
2424
fromgitlabimporttypes
2525
fromgitlabimportutils
26+
fromgitlab.v4.objects.variablesimport*
27+
2628

2729
VISIBILITY_PRIVATE="private"
2830
VISIBILITY_INTERNAL="internal"
@@ -1366,18 +1368,6 @@ class GroupSubgroupManager(ListMixin, RESTManager):
13661368
)
13671369

13681370

1369-
classGroupVariable(SaveMixin,ObjectDeleteMixin,RESTObject):
1370-
_id_attr="key"
1371-
1372-
1373-
classGroupVariableManager(CRUDMixin,RESTManager):
1374-
_path="/groups/%(group_id)s/variables"
1375-
_obj_cls=GroupVariable
1376-
_from_parent_attrs= {"group_id":"id"}
1377-
_create_attrs= (("key","value"), ("protected","variable_type","masked"))
1378-
_update_attrs= (("key","value"), ("protected","variable_type","masked"))
1379-
1380-
13811371
classGroup(SaveMixin,ObjectDeleteMixin,RESTObject):
13821372
_short_print_attr="name"
13831373
_managers= (
@@ -4116,18 +4106,6 @@ class ProjectUserManager(ListMixin, RESTManager):
41164106
_list_filters= ("search",)
41174107

41184108

4119-
classProjectVariable(SaveMixin,ObjectDeleteMixin,RESTObject):
4120-
_id_attr="key"
4121-
4122-
4123-
classProjectVariableManager(CRUDMixin,RESTManager):
4124-
_path="/projects/%(project_id)s/variables"
4125-
_obj_cls=ProjectVariable
4126-
_from_parent_attrs= {"project_id":"id"}
4127-
_create_attrs= (("key","value"), ("protected","variable_type","masked"))
4128-
_update_attrs= (("key","value"), ("protected","variable_type","masked"))
4129-
4130-
41314109
classProjectService(SaveMixin,ObjectDeleteMixin,RESTObject):
41324110
pass
41334111

‎gitlab/v4/objects/variables.py

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
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+
fromgitlab.baseimport*# noqa
8+
fromgitlab.mixinsimport*# noqa
9+
10+
11+
classVariable(SaveMixin,ObjectDeleteMixin,RESTObject):
12+
_id_attr="key"
13+
14+
15+
classVariableManager(CRUDMixin,RESTManager):
16+
_path="/admin/ci/variables"
17+
_obj_cls=Variable
18+
_create_attrs= (("key","value"), ("protected","variable_type","masked"))
19+
_update_attrs= (("key","value"), ("protected","variable_type","masked"))
20+
21+
22+
classGroupVariable(SaveMixin,ObjectDeleteMixin,RESTObject):
23+
_id_attr="key"
24+
25+
26+
classGroupVariableManager(CRUDMixin,RESTManager):
27+
_path="/groups/%(group_id)s/variables"
28+
_obj_cls=GroupVariable
29+
_from_parent_attrs= {"group_id":"id"}
30+
_create_attrs= (("key","value"), ("protected","variable_type","masked"))
31+
_update_attrs= (("key","value"), ("protected","variable_type","masked"))
32+
33+
34+
classProjectVariable(SaveMixin,ObjectDeleteMixin,RESTObject):
35+
_id_attr="key"
36+
37+
38+
classProjectVariableManager(CRUDMixin,RESTManager):
39+
_path="/projects/%(project_id)s/variables"
40+
_obj_cls=ProjectVariable
41+
_from_parent_attrs= {"project_id":"id"}
42+
_create_attrs= (
43+
("key","value"),
44+
("protected","variable_type","masked","environment_scope"),
45+
)
46+
_update_attrs= (
47+
("key","value"),
48+
("protected","variable_type","masked","environment_scope"),
49+
)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp