diff options
| author | Gauvain Pocentek <gauvain@pocentek.net> | 2018-01-01 15:44:47 +0100 |
|---|---|---|
| committer | Gauvain Pocentek <gauvain@pocentek.net> | 2018-01-01 15:44:47 +0100 |
| commit | fa520242b878d25e37aacfcb0d838c58d3a4b271 (patch) | |
| tree | 2d63086ba96dd02765359591beab77960bf3e844 /gitlab/v4 | |
| parent | f5850d950a77b1d985fdc3d1639e2627468d3548 (diff) | |
| download | gitlab-fa520242b878d25e37aacfcb0d838c58d3a4b271.tar.gz | |
Add support for project and group custom variables
implements parts of #367
Diffstat (limited to 'gitlab/v4')
| -rw-r--r-- | gitlab/v4/objects.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/gitlab/v4/objects.py b/gitlab/v4/objects.py index 0a0cebd..106b102 100644 --- a/gitlab/v4/objects.py +++ b/gitlab/v4/objects.py @@ -461,6 +461,17 @@ class GroupAccessRequestManager(GetFromListMixin, CreateMixin, DeleteMixin, _from_parent_attrs = {'group_id': 'id'} +class GroupCustomAttribute(ObjectDeleteMixin, RESTObject): + _id_attr = 'key' + + +class GroupCustomAttributeManager(RetrieveMixin, SetMixin, DeleteMixin, + RESTManager): + _path = '/groups/%(group_id)s/custom_attributes' + _obj_cls = GroupCustomAttribute + _from_parent_attrs = {'group_id': 'id'} + + class GroupIssue(RESTObject): pass @@ -614,6 +625,7 @@ class Group(SaveMixin, ObjectDeleteMixin, RESTObject): _short_print_attr = 'name' _managers = ( ('accessrequests', 'GroupAccessRequestManager'), + ('customattributes', 'GroupCustomAttributeManager'), ('issues', 'GroupIssueManager'), ('members', 'GroupMemberManager'), ('milestones', 'GroupMilestoneManager'), @@ -839,6 +851,17 @@ class ProjectBranchManager(NoUpdateMixin, RESTManager): _create_attrs = (('branch', 'ref'), tuple()) +class ProjectCustomAttribute(ObjectDeleteMixin, RESTObject): + _id_attr = 'key' + + +class ProjectCustomAttributeManager(RetrieveMixin, SetMixin, DeleteMixin, + RESTManager): + _path = '/projects/%(project_id)s/custom_attributes' + _obj_cls = ProjectCustomAttribute + _from_parent_attrs = {'project_id': 'id'} + + class ProjectJob(RESTObject): @cli.register_custom_action('ProjectJob') @exc.on_http_error(exc.GitlabJobCancelError) @@ -2200,6 +2223,7 @@ class Project(SaveMixin, ObjectDeleteMixin, RESTObject): ('branches', 'ProjectBranchManager'), ('jobs', 'ProjectJobManager'), ('commits', 'ProjectCommitManager'), + ('customattributes', 'ProjectCustomAttributeManager'), ('deployments', 'ProjectDeploymentManager'), ('environments', 'ProjectEnvironmentManager'), ('events', 'ProjectEventManager'), |
