@@ -360,6 +360,17 @@ class GitlabciymlManager(RetrieveMixin, RESTManager):
360360 _obj_cls = Gitlabciyml
361361
362362
363+ class GroupAccessRequest (AccessRequestMixin , ObjectDeleteMixin , RESTObject ):
364+ pass
365+
366+
367+ class GroupAccessRequestManager (GetFromListMixin , CreateMixin , DeleteMixin ,
368+ RESTManager ):
369+ _path = '/groups/%(group_id)s/access_requests'
370+ _obj_cls = GroupAccessRequest
371+ _from_parent_attrs = {'group_id' : 'id' }
372+
373+
363374class GroupIssue (RESTObject ):
364375 pass
365376
@@ -394,15 +405,71 @@ class GroupNotificationSettingsManager(NotificationSettingsManager):
394405 _from_parent_attrs = {'group_id' : 'id' }
395406
396407
397- class GroupAccessRequest ( AccessRequestMixin , ObjectDeleteMixin , RESTObject ):
408+ class GroupProject ( RESTObject ):
398409 pass
399410
400411
401- class GroupAccessRequestManager (GetFromListMixin , CreateMixin , DeleteMixin ,
402- RESTManager ):
403- _path = '/groups/%(group_id)s/access_requests'
404- _obj_cls = GroupAccessRequest
412+ class GroupProjectManager (GetFromListMixin , RESTManager ):
413+ _path = '/groups/%(group_id)s/projects'
414+ _obj_cls = GroupProject
415+ _from_parent_attrs = {'group_id' : 'id' }
416+ _list_filters = ('archived' , 'visibility' , 'order_by' , 'sort' , 'search' ,
417+ 'ci_enabled_first' )
418+
419+
420+ class GroupVariable (SaveMixin , ObjectDeleteMixin , RESTObject ):
421+ _id_attr = 'key'
422+
423+
424+ class GroupVariableManager (CRUDMixin , RESTManager ):
425+ _path = '/groups/%(group_id)s/variables'
426+ _obj_cls = GroupVariable
405427 _from_parent_attrs = {'group_id' : 'id' }
428+ _create_attrs = (('key' , 'value' ), ('protected' ,))
429+ _update_attrs = (('key' , 'value' ), ('protected' ,))
430+
431+
432+ class Group (SaveMixin , ObjectDeleteMixin , RESTObject ):
433+ _short_print_attr = 'name'
434+ _managers = (
435+ ('accessrequests' , 'GroupAccessRequestManager' ),
436+ ('members' , 'GroupMemberManager' ),
437+ ('notificationsettings' , 'GroupNotificationSettingsManager' ),
438+ ('projects' , 'GroupProjectManager' ),
439+ ('issues' , 'GroupIssueManager' ),
440+ ('variables' , 'GroupVariableManager' ),
441+ )
442+
443+ @cli .register_custom_action ('Group' , ('to_project_id' , ))
444+ @exc .on_http_error (exc .GitlabTransferProjectError )
445+ def transfer_project (self , to_project_id , ** kwargs ):
446+ """Transfer a project to this group.
447+
448+ Args:
449+ to_project_id (int): ID of the project to transfer
450+ **kwargs: Extra options to send to the server (e.g. sudo)
451+
452+ Raises:
453+ GitlabAuthenticationError: If authentication is not correct
454+ GitlabTransferProjectError: If the project could not be transfered
455+ """
456+ path = '/groups/%d/projects/%d' % (self .id , to_project_id )
457+ self .manager .gitlab .http_post (path , ** kwargs )
458+
459+
460+ class GroupManager (CRUDMixin , RESTManager ):
461+ _path = '/groups'
462+ _obj_cls = Group
463+ _create_attrs = (
464+ ('name' , 'path' ),
465+ ('description' , 'visibility' , 'parent_id' , 'lfs_enabled' ,
466+ 'request_access_enabled' )
467+ )
468+ _update_attrs = (
469+ tuple (),
470+ ('name' , 'path' , 'description' , 'visibility' , 'lfs_enabled' ,
471+ 'request_access_enabled' )
472+ )
406473
407474
408475class Hook (ObjectDeleteMixin , RESTObject ):
@@ -2266,70 +2333,3 @@ class ProjectManager(CRUDMixin, RESTManager):
22662333 _list_filters = ('search' , 'owned' , 'starred' , 'archived' , 'visibility' ,
22672334 'order_by' , 'sort' , 'simple' , 'membership' , 'statistics' ,
22682335 'with_issues_enabled' , 'with_merge_requests_enabled' )
2269-
2270-
2271- class GroupProject (RESTObject ):
2272- pass
2273-
2274-
2275- class GroupProjectManager (GetFromListMixin , RESTManager ):
2276- _path = '/groups/%(group_id)s/projects'
2277- _obj_cls = GroupProject
2278- _from_parent_attrs = {'group_id' : 'id' }
2279- _list_filters = ('archived' , 'visibility' , 'order_by' , 'sort' , 'search' ,
2280- 'ci_enabled_first' )
2281-
2282-
2283- class GroupVariable (SaveMixin , ObjectDeleteMixin , RESTObject ):
2284- _id_attr = 'key'
2285-
2286-
2287- class GroupVariableManager (CRUDMixin , RESTManager ):
2288- _path = '/groups/%(group_id)s/variables'
2289- _obj_cls = GroupVariable
2290- _from_parent_attrs = {'group_id' : 'id' }
2291- _create_attrs = (('key' , 'value' ), ('protected' ,))
2292- _update_attrs = (('key' , 'value' ), ('protected' ,))
2293-
2294-
2295- class Group (SaveMixin , ObjectDeleteMixin , RESTObject ):
2296- _short_print_attr = 'name'
2297- _managers = (
2298- ('accessrequests' , 'GroupAccessRequestManager' ),
2299- ('members' , 'GroupMemberManager' ),
2300- ('notificationsettings' , 'GroupNotificationSettingsManager' ),
2301- ('projects' , 'GroupProjectManager' ),
2302- ('issues' , 'GroupIssueManager' ),
2303- ('variables' , 'GroupVariableManager' ),
2304- )
2305-
2306- @cli .register_custom_action ('Group' , ('to_project_id' , ))
2307- @exc .on_http_error (exc .GitlabTransferProjectError )
2308- def transfer_project (self , to_project_id , ** kwargs ):
2309- """Transfer a project to this group.
2310-
2311- Args:
2312- to_project_id (int): ID of the project to transfer
2313- **kwargs: Extra options to send to the server (e.g. sudo)
2314-
2315- Raises:
2316- GitlabAuthenticationError: If authentication is not correct
2317- GitlabTransferProjectError: If the project could not be transfered
2318- """
2319- path = '/groups/%d/projects/%d' % (self .id , to_project_id )
2320- self .manager .gitlab .http_post (path , ** kwargs )
2321-
2322-
2323- class GroupManager (CRUDMixin , RESTManager ):
2324- _path = '/groups'
2325- _obj_cls = Group
2326- _create_attrs = (
2327- ('name' , 'path' ),
2328- ('description' , 'visibility' , 'parent_id' , 'lfs_enabled' ,
2329- 'request_access_enabled' )
2330- )
2331- _update_attrs = (
2332- tuple (),
2333- ('name' , 'path' , 'description' , 'visibility' , 'lfs_enabled' ,
2334- 'request_access_enabled' )
2335- )
0 commit comments