|
128 | 128 | "ProjectForkManager",
|
129 | 129 | "ProjectRemoteMirror",
|
130 | 130 | "ProjectRemoteMirrorManager",
|
| 131 | +"ProjectPullMirror", |
| 132 | +"ProjectPullMirrorManager", |
131 | 133 | "ProjectStorage",
|
132 | 134 | "ProjectStorageManager",
|
133 | 135 | "SharedProject",
|
@@ -249,6 +251,7 @@ class Project(
|
249 | 251 | releases:ProjectReleaseManager
|
250 | 252 | resource_groups:ProjectResourceGroupManager
|
251 | 253 | remote_mirrors:"ProjectRemoteMirrorManager"
|
| 254 | +pull_mirror:"ProjectPullMirrorManager" |
252 | 255 | repositories:ProjectRegistryRepositoryManager
|
253 | 256 | runners:ProjectRunnerManager
|
254 | 257 | secure_files:ProjectSecureFileManager
|
@@ -1240,6 +1243,65 @@ class ProjectRemoteMirrorManager(
|
1240 | 1243 | _update_attrs=RequiredOptional(optional=("enabled","only_protected_branches"))
|
1241 | 1244 |
|
1242 | 1245 |
|
| 1246 | +classProjectPullMirror(SaveMixin,RESTObject): |
| 1247 | +_id_attr=None |
| 1248 | + |
| 1249 | + |
| 1250 | +classProjectPullMirrorManager(GetWithoutIdMixin,UpdateMixin,RESTManager): |
| 1251 | +_path="/projects/{project_id}/mirror/pull" |
| 1252 | +_obj_cls=ProjectPullMirror |
| 1253 | +_from_parent_attrs= {"project_id":"id"} |
| 1254 | +_update_attrs=RequiredOptional(optional=("url",)) |
| 1255 | + |
| 1256 | +defget(self,**kwargs:Any)->ProjectPullMirror: |
| 1257 | +returncast(ProjectPullMirror,super().get(**kwargs)) |
| 1258 | + |
| 1259 | +@exc.on_http_error(exc.GitlabCreateError) |
| 1260 | +defcreate(self,data:Dict[str,Any],**kwargs:Any)->ProjectPullMirror: |
| 1261 | +"""Create a new object. |
| 1262 | +
|
| 1263 | + Args: |
| 1264 | + data: parameters to send to the server to create the |
| 1265 | + resource |
| 1266 | + **kwargs: Extra options to send to the server (e.g. sudo) |
| 1267 | +
|
| 1268 | + Returns: |
| 1269 | + A new instance of the managed object class built with |
| 1270 | + the data sent by the server |
| 1271 | +
|
| 1272 | + Raises: |
| 1273 | + GitlabAuthenticationError: If authentication is not correct |
| 1274 | + GitlabCreateError: If the server cannot perform the request |
| 1275 | + """ |
| 1276 | +ifTYPE_CHECKING: |
| 1277 | +assertdataisnotNone |
| 1278 | +self._create_attrs.validate_attrs(data=data) |
| 1279 | + |
| 1280 | +ifTYPE_CHECKING: |
| 1281 | +assertself.pathisnotNone |
| 1282 | +server_data=self.gitlab.http_put(self.path,post_data=data,**kwargs) |
| 1283 | + |
| 1284 | +ifTYPE_CHECKING: |
| 1285 | +assertnotisinstance(server_data,requests.Response) |
| 1286 | +returnself._obj_cls(self,server_data) |
| 1287 | + |
| 1288 | +@cli.register_custom_action(cls_names="ProjectPullMirrorManager") |
| 1289 | +@exc.on_http_error(exc.GitlabCreateError) |
| 1290 | +defstart(self,**kwargs:Any)->None: |
| 1291 | +"""Start the pull mirroring process for the project. |
| 1292 | +
|
| 1293 | + Args: |
| 1294 | + **kwargs: Extra options to send to the server (e.g. sudo) |
| 1295 | +
|
| 1296 | + Raises: |
| 1297 | + GitlabAuthenticationError: If authentication is not correct |
| 1298 | + GitlabCreateError: If the server failed to perform the request |
| 1299 | + """ |
| 1300 | +ifTYPE_CHECKING: |
| 1301 | +assertself.pathisnotNone |
| 1302 | +self.gitlab.http_post(self.path,**kwargs) |
| 1303 | + |
| 1304 | + |
1243 | 1305 | classProjectStorage(RefreshMixin,RESTObject):
|
1244 | 1306 | pass
|
1245 | 1307 |
|
|