@@ -991,6 +991,26 @@ class GroupEpicManager(CRUDMixin, RESTManager):
991
991
_types = {"labels" : types .ListAttribute }
992
992
993
993
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
+
994
1014
class GroupIssue (RESTObject ):
995
1015
pass
996
1016
@@ -1290,7 +1310,9 @@ class Group(SaveMixin, ObjectDeleteMixin, RESTObject):
1290
1310
("badges" , "GroupBadgeManager" ),
1291
1311
("boards" , "GroupBoardManager" ),
1292
1312
("customattributes" , "GroupCustomAttributeManager" ),
1313
+ ("exports" , "GroupExportManager" ),
1293
1314
("epics" , "GroupEpicManager" ),
1315
+ ("imports" , "GroupImportManager" ),
1294
1316
("issues" , "GroupIssueManager" ),
1295
1317
("labels" , "GroupLabelManager" ),
1296
1318
("members" , "GroupMemberManager" ),
@@ -1431,6 +1453,34 @@ class GroupManager(CRUDMixin, RESTManager):
1431
1453
),
1432
1454
)
1433
1455
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
+
1434
1484
1435
1485
class Hook (ObjectDeleteMixin , RESTObject ):
1436
1486
_url = "/hooks"
0 commit comments