blob: 9b5edb03966bd71313c5021d6343d15639a31252 (
plain)
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
|
######
Groups
######
Groups
======
Reference
---------
* v4 API:
+ :class:`gitlab.v4.objects.Group`
+ :class:`gitlab.v4.objects.GroupManager`
+ :attr:`gitlab.Gitlab.groups`
* v3 API:
+ :class:`gitlab.v3.objects.Group`
+ :class:`gitlab.v3.objects.GroupManager`
+ :attr:`gitlab.Gitlab.groups`
* GitLab API: https://docs.gitlab.com/ce/api/groups.html
Examples
--------
List the groups:
.. literalinclude:: groups.py
:start-after: # list
:end-before: # end list
Get a group's detail:
.. literalinclude:: groups.py
:start-after: # get
:end-before: # end get
List a group's projects:
.. literalinclude:: groups.py
:start-after: # projects list
:end-before: # end projects list
You can filter and sort the result using the following parameters:
* ``archived``: limit by archived status
* ``visibility``: limit by visibility. Allowed values are ``public``,
``internal`` and ``private``
* ``search``: limit to groups matching the given value
* ``order_by``: sort by criteria. Allowed values are ``id``, ``name``, ``path``,
``created_at``, ``updated_at`` and ``last_activity_at``
* ``sort``: sort order: ``asc`` or ``desc``
* ``ci_enabled_first``: return CI enabled groups first
Create a group:
.. literalinclude:: groups.py
:start-after: # create
:end-before: # end create
Update a group:
.. literalinclude:: groups.py
:start-after: # update
:end-before: # end update
Remove a group:
.. literalinclude:: groups.py
:start-after: # delete
:end-before: # end delete
Subgroups
=========
Reference
---------
* v4 API:
+ :class:`gitlab.v4.objects.GroupSubgroup`
+ :class:`gitlab.v4.objects.GroupSubgroupManager`
+ :attr:`gitlab.v4.objects.Group.subgroups`
Examples
--------
List the subgroups for a group::
subgroups = group.subgroups.list()
Group custom attributes
=======================
Reference
---------
* v4 API:
+ :class:`gitlab.v4.objects.GroupCustomAttribute`
+ :class:`gitlab.v4.objects.GroupCustomAttributeManager`
+ :attr:`gitlab.v4.objects.Group.customattributes`
* GitLab API: https://docs.gitlab.com/ce/api/custom_attributes.html
Examples
--------
List custom attributes for a group::
attrs = group.customattributes.list()
Get a custom attribute for a group::
attr = group.customattributes.get(attr_key)
Set (create or update) a custom attribute for a group::
attr = group.customattributes.set(attr_key, attr_value)
Delete a custom attribute for a group::
attr.delete()
# or
group.customattributes.delete(attr_key)
Group members
=============
The following constants define the supported access levels:
* ``gitlab.GUEST_ACCESS = 10``
* ``gitlab.REPORTER_ACCESS = 20``
* ``gitlab.DEVELOPER_ACCESS = 30``
* ``gitlab.MASTER_ACCESS = 40``
* ``gitlab.OWNER_ACCESS = 50``
Reference
---------
* v4 API:
+ :class:`gitlab.v4.objects.GroupMember`
+ :class:`gitlab.v4.objects.GroupMemberManager`
+ :attr:`gitlab.v4.objects.Group.members`
* v3 API:
+ :class:`gitlab.v3.objects.GroupMember`
+ :class:`gitlab.v3.objects.GroupMemberManager`
+ :attr:`gitlab.v3.objects.Group.members`
+ :attr:`gitlab.Gitlab.group_members`
* GitLab API: https://docs.gitlab.com/ce/api/groups.html
Examples
--------
List group members:
.. literalinclude:: groups.py
:start-after: # member list
:end-before: # end member list
Get a group member:
.. literalinclude:: groups.py
:start-after: # member get
:end-before: # end member get
Add a member to the group:
.. literalinclude:: groups.py
:start-after: # member create
:end-before: # end member create
Update a member (change the access level):
.. literalinclude:: groups.py
:start-after: # member update
:end-before: # end member update
Remove a member from the group:
.. literalinclude:: groups.py
:start-after: # member delete
:end-before: # end member delete
|