forked from python-gitlab/python-gitlab
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpackage_protection_rules.py
More file actions
43 lines (38 loc) · 1.19 KB
/
Copy pathpackage_protection_rules.py
File metadata and controls
43 lines (38 loc) · 1.19 KB
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
from gitlab.base import RESTObject
from gitlab.mixins import (
CreateMixin,
DeleteMixin,
ListMixin,
ObjectDeleteMixin,
SaveMixin,
UpdateMethod,
UpdateMixin,
)
from gitlab.types import RequiredOptional
__all__ = ["ProjectPackageProtectionRule", "ProjectPackageProtectionRuleManager"]
class ProjectPackageProtectionRule(ObjectDeleteMixin, SaveMixin, RESTObject):
_repr_attr = "package_name_pattern"
class ProjectPackageProtectionRuleManager(
ListMixin[ProjectPackageProtectionRule],
CreateMixin[ProjectPackageProtectionRule],
DeleteMixin[ProjectPackageProtectionRule],
UpdateMixin[ProjectPackageProtectionRule],
):
_path = "/projects/{project_id}/packages/protection/rules"
_obj_cls = ProjectPackageProtectionRule
_from_parent_attrs = {"project_id": "id"}
_create_attrs = RequiredOptional(
required=(
"package_name_pattern",
"package_type",
"minimum_access_level_for_push",
)
)
_update_attrs = RequiredOptional(
optional=(
"package_name_pattern",
"package_type",
"minimum_access_level_for_push",
)
)
_update_method = UpdateMethod.PATCH