From 9c19e06dbb792308d2fcd4fff1239043981b5f61 Mon Sep 17 00:00:00 2001 From: Gauvain Pocentek Date: Mon, 28 May 2018 08:02:23 +0200 Subject: Add support for environment stop() --- gitlab/v4/objects.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'gitlab/v4/objects.py') 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, -- cgit v1.2.1