summaryrefslogtreecommitdiff
path: root/gitlab/v4/objects/environments.py
diff options
context:
space:
mode:
Diffstat (limited to 'gitlab/v4/objects/environments.py')
-rw-r--r--gitlab/v4/objects/environments.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/gitlab/v4/objects/environments.py b/gitlab/v4/objects/environments.py
index 7e2089f..a8bd9d5 100644
--- a/gitlab/v4/objects/environments.py
+++ b/gitlab/v4/objects/environments.py
@@ -18,6 +18,8 @@ from gitlab.types import RequiredOptional
__all__ = [
"ProjectEnvironment",
"ProjectEnvironmentManager",
+ "ProjectProtectedEnvironment",
+ "ProjectProtectedEnvironmentManager",
]
@@ -55,3 +57,30 @@ class ProjectEnvironmentManager(
self, id: Union[str, int], lazy: bool = False, **kwargs: Any
) -> ProjectEnvironment:
return cast(ProjectEnvironment, super().get(id=id, lazy=lazy, **kwargs))
+
+
+class ProjectProtectedEnvironment(ObjectDeleteMixin, RESTObject):
+ _id_attr = "name"
+ _repr_attr = "name"
+
+
+class ProjectProtectedEnvironmentManager(
+ RetrieveMixin, CreateMixin, DeleteMixin, RESTManager
+):
+ _path = "/projects/{project_id}/protected_environments"
+ _obj_cls = ProjectProtectedEnvironment
+ _from_parent_attrs = {"project_id": "id"}
+ _create_attrs = RequiredOptional(
+ required=(
+ "name",
+ "deploy_access_levels",
+ ),
+ optional=("required_approval_count", "approval_rules"),
+ )
+
+ def get(
+ self, id: Union[str, int], lazy: bool = False, **kwargs: Any
+ ) -> ProjectProtectedEnvironment:
+ return cast(
+ ProjectProtectedEnvironment, super().get(id=id, lazy=lazy, **kwargs)
+ )