@@ -991,6 +991,26 @@ class GroupEpicManager(CRUDMixin, RESTManager):
991991 _types = {"labels" : types .ListAttribute }
992992
993993
994+ class GroupExport (ExportMixin , RESTObject ):
995+ _id_attr = None
996+
997+
998+ class GroupExportManager (GetWithoutIdMixin , CreateMixin , RESTManager ):
999+ _path = "/groups/%(group_id)s/export"
1000+ _obj_cls = GroupExport
1001+ _from_parent_attrs = {"group_id" : "id" }
1002+
1003+
1004+ class GroupImport (RESTObject ):
1005+ _id_attr = None
1006+
1007+
1008+ class GroupImportManager (GetWithoutIdMixin , RESTManager ):
1009+ _path = "/groups/%(group_id)s/import"
1010+ _obj_cls = GroupImport
1011+ _from_parent_attrs = {"group_id" : "id" }
1012+
1013+
9941014class GroupIssue (RESTObject ):
9951015 pass
9961016
@@ -1290,7 +1310,9 @@ class Group(SaveMixin, ObjectDeleteMixin, RESTObject):
12901310 ("badges" , "GroupBadgeManager" ),
12911311 ("boards" , "GroupBoardManager" ),
12921312 ("customattributes" , "GroupCustomAttributeManager" ),
1313+ ("exports" , "GroupExportManager" ),
12931314 ("epics" , "GroupEpicManager" ),
1315+ ("imports" , "GroupImportManager" ),
12941316 ("issues" , "GroupIssueManager" ),
12951317 ("labels" , "GroupLabelManager" ),
12961318 ("members" , "GroupMemberManager" ),
@@ -1431,6 +1453,34 @@ class GroupManager(CRUDMixin, RESTManager):
14311453 ),
14321454 )
14331455
1456+ @exc .on_http_error (exc .GitlabImportError )
1457+ def import_group (self , file , path , name , parent_id = None , ** kwargs ):
1458+ """Import a group from an archive file.
1459+
1460+ Args:
1461+ file: Data or file object containing the group
1462+ path (str): The path for the new group to be imported.
1463+ name (str): The name for the new group.
1464+ parent_id (str): ID of a parent group that the group will
1465+ be imported into.
1466+ **kwargs: Extra options to send to the server (e.g. sudo)
1467+
1468+ Raises:
1469+ GitlabAuthenticationError: If authentication is not correct
1470+ GitlabImportError: If the server failed to perform the request
1471+
1472+ Returns:
1473+ dict: A representation of the import status.
1474+ """
1475+ files = {"file" : ("file.tar.gz" , file )}
1476+ data = {"path" : path , "name" : name }
1477+ if parent_id is not None :
1478+ data ["parent_id" ] = parent_id
1479+
1480+ return self .gitlab .http_post (
1481+ "/groups/import" , post_data = data , files = files , ** kwargs
1482+ )
1483+
14341484
14351485class Hook (ObjectDeleteMixin , RESTObject ):
14361486 _url = "/hooks"
0 commit comments