@@ -93,12 +93,34 @@ def transfer_project(self, project_id: int, **kwargs: Any) -> None:
93
93
path = f"/groups/{ self .id } /projects/{ project_id } "
94
94
self .manager .gitlab .http_post (path , ** kwargs )
95
95
96
+ @cli .register_custom_action ("Group" , tuple (), ("group_id" ,))
97
+ @exc .on_http_error (exc .GitlabTransferGroupError )
98
+ def transfer_group (self , group_id : Optional [int ] = None , ** kwargs : Any ) -> None :
99
+ """Transfer the group to a new parent group or make it a top-level group.
100
+
101
+ Requires GitLab ≥14.6.
102
+
103
+ Args:
104
+ group_id: ID of the new parent group. When not specified,
105
+ the group to transfer is instead turned into a top-level group.
106
+ **kwargs: Extra options to send to the server (e.g. sudo)
107
+
108
+ Raises:
109
+ GitlabAuthenticationError: If authentication is not correct
110
+ GitlabTransferGroupError: If the group could not be transferred
111
+ """
112
+ path = f"/groups/{ self .id } /transfer"
113
+ post_data = {}
114
+ if group_id is not None :
115
+ post_data ["group_id" ] = group_id
116
+ self .manager .gitlab .http_post (path , post_data = post_data , ** kwargs )
117
+
96
118
@cli .register_custom_action ("Group" , ("scope" , "search" ))
97
119
@exc .on_http_error (exc .GitlabSearchError )
98
120
def search (
99
121
self , scope : str , search : str , ** kwargs : Any
100
122
) -> Union [gitlab .GitlabList , List [Dict [str , Any ]]]:
101
- """Search the group resources matching the provided string.'
123
+ """Search the group resources matching the provided string.
102
124
103
125
Args:
104
126
scope: Scope of the search
0 commit comments