summaryrefslogtreecommitdiff
path: root/gitlab
diff options
context:
space:
mode:
Diffstat (limited to 'gitlab')
-rw-r--r--gitlab/exceptions.py4
-rw-r--r--gitlab/v4/objects.py15
2 files changed, 18 insertions, 1 deletions
diff --git a/gitlab/exceptions.py b/gitlab/exceptions.py
index 00d99c6..9e3fa4a 100644
--- a/gitlab/exceptions.py
+++ b/gitlab/exceptions.py
@@ -201,6 +201,10 @@ class GitlabSearchError(GitlabOperationError):
pass
+class GitlabStopError(GitlabOperationError):
+ pass
+
+
def on_http_error(error):
"""Manage GitlabHttpError exceptions.
diff --git a/gitlab/v4/objects.py b/gitlab/v4/objects.py
index da2f6ed..6c0c84f 100644
--- a/gitlab/v4/objects.py
+++ b/gitlab/v4/objects.py
@@ -1278,7 +1278,20 @@ class ProjectCommitManager(RetrieveMixin, CreateMixin, RESTManager):
class ProjectEnvironment(SaveMixin, ObjectDeleteMixin, RESTObject):
- pass
+ @cli.register_custom_action('ProjectEnvironment')
+ @exc.on_http_error(exc.GitlabStopError)
+ def stop(self, **kwargs):
+ """Stop the environment.
+
+ Args:
+ **kwargs: Extra options to send to the server (e.g. sudo)
+
+ Raises:
+ GitlabAuthenticationError: If authentication is not correct
+ GitlabStopError: If the operation failed
+ """
+ path = '%s/%s/stop' % (self.manager.path, self.get_id())
+ self.manager.gitlab.http_post(path, **kwargs)
class ProjectEnvironmentManager(ListMixin, CreateMixin, UpdateMixin,