FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
python-gitlab/gitlab/v4/objects/features.py at main · 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
/
features.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
68 lines (56 loc) · 1.91 KB
Breadcrumbs
python-gitlab
/
gitlab
/
v4
/
objects
/
features.py
Copy path
File metadata and controls
68 lines (56 loc) · 1.91 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
"""
GitLab API:
https://docs.gitlab.com/ee/api/features.html
"""
from
__future__
import
annotations
from
typing
import
Any
,
TYPE_CHECKING
from
gitlab
import
exceptions
as
exc
from
gitlab
import
utils
from
gitlab
.
base
import
RESTObject
from
gitlab
.
mixins
import
DeleteMixin
,
ListMixin
,
ObjectDeleteMixin
__all__
=
[
"Feature"
,
"FeatureManager"
]
class
Feature
(
ObjectDeleteMixin
,
RESTObject
):
_id_attr
=
"name"
class
FeatureManager
(
ListMixin
[
Feature
],
DeleteMixin
[
Feature
]):
_path
=
"/features/"
_obj_cls
=
Feature
@
exc
.
on_http_error
(
exc
.
GitlabSetError
)
def
set
(
self
,
name
:
str
,
value
:
bool
|
int
,
feature_group
:
str
|
None
=
None
,
user
:
str
|
None
=
None
,
group
:
str
|
None
=
None
,
project
:
str
|
None
=
None
,
**
kwargs
:
Any
,
)
->
Feature
:
"""Create or update the object.
Args:
name: The value to set for the object
value: The value to set for the object
feature_group: A feature group name
user: A GitLab username
group: A GitLab group
project: A GitLab project in form group/project
**kwargs: Extra options to send to the server (e.g. sudo)
Raises:
GitlabAuthenticationError: If authentication is not correct
GitlabSetError: If an error occurred
Returns:
The created/updated attribute
"""
name
=
utils
.
EncodedId
(
name
)
path
=
f"
{
self
.
path
}
/
{
name
}
"
data
=
{
"value"
:
value
,
"feature_group"
:
feature_group
,
"user"
:
user
,
"group"
:
group
,
"project"
:
project
,
}
data
=
utils
.
remove_none_from_dict
(
data
)
server_data
=
self
.
gitlab
.
http_post
(
path
,
post_data
=
data
,
**
kwargs
)
if
TYPE_CHECKING
:
assert
isinstance
(
server_data
,
dict
)
return
self
.
_obj_cls
(
self
,
server_data
)
Back
|
FazBrowse Home
|
New Git URL