From 6eb11fd73840889a7ab244c516c235a2dc7e6867 Mon Sep 17 00:00:00 2001 From: Gauvain Pocentek Date: Sun, 17 Jul 2016 09:16:34 +0200 Subject: Implement runners global API --- gitlab/objects.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'gitlab/objects.py') diff --git a/gitlab/objects.py b/gitlab/objects.py index dba54f0..a760a16 100644 --- a/gitlab/objects.py +++ b/gitlab/objects.py @@ -1965,6 +1965,35 @@ class Project(GitlabObject): raise_error_from_response(r, GitlabCreateError, 201) +class Runner(GitlabObject): + _url = '/runners' + canCreate = False + optionalUpdateAttrs = ['description', 'active', 'tag_list'] + + +class RunnerManager(BaseManager): + obj_cls = Runner + + def all(self, scope=None, **kwargs): + """List all the runners. + + Args: + scope (str): The scope of runners to show, one of: specific, + shared, active, paused, online + + Returns: + list(Runner): a list of runners matching the scope. + + Raises: + GitlabConnectionError: If the server cannot be reached. + GitlabListError; If the resource cannot be found + """ + url = '/runners/all' + if scope is not None: + url += '?scope=' + scope + return self.gitlab._raw_list(url, self.obj_cls, **kwargs) + + class TeamMember(GitlabObject): _url = '/user_teams/%(team_id)s/members' canUpdate = False -- cgit v1.2.1