|
30 | 30 | fromstackit.git.models.instanceimportInstance |
31 | 31 | fromstackit.git.models.list_flavorsimportListFlavors |
32 | 32 | fromstackit.git.models.list_instancesimportListInstances |
| 33 | +fromstackit.git.models.patch_operationimportPatchOperation |
33 | 34 | fromstackit.git.restimportRESTResponseType |
34 | 35 |
|
35 | 36 |
|
@@ -1300,3 +1301,293 @@ def _list_instances_serialize( |
1300 | 1301 | _host=_host, |
1301 | 1302 | _request_auth=_request_auth, |
1302 | 1303 | ) |
| 1304 | + |
| 1305 | +@validate_call |
| 1306 | +defpatch_instance( |
| 1307 | +self, |
| 1308 | +project_id:Annotated[str,Field(min_length=36,strict=True,max_length=36,description="Project identifier.")], |
| 1309 | +instance_id:Annotated[ |
| 1310 | +str,Field(min_length=36,strict=True,max_length=36,description="Instance identifier.") |
| 1311 | + ], |
| 1312 | +patch_operation:List[PatchOperation], |
| 1313 | +_request_timeout:Union[ |
| 1314 | +None, |
| 1315 | +Annotated[StrictFloat,Field(gt=0)], |
| 1316 | +Tuple[Annotated[StrictFloat,Field(gt=0)],Annotated[StrictFloat,Field(gt=0)]], |
| 1317 | + ]=None, |
| 1318 | +_request_auth:Optional[Dict[StrictStr,Any]]=None, |
| 1319 | +_content_type:Optional[StrictStr]=None, |
| 1320 | +_headers:Optional[Dict[StrictStr,Any]]=None, |
| 1321 | +_host_index:Annotated[StrictInt,Field(ge=0,le=0)]=0, |
| 1322 | + )->Instance: |
| 1323 | +"""Patch Instance. |
| 1324 | +
|
| 1325 | + Patches the Instance. |
| 1326 | +
|
| 1327 | + :param project_id: Project identifier. (required) |
| 1328 | + :type project_id: str |
| 1329 | + :param instance_id: Instance identifier. (required) |
| 1330 | + :type instance_id: str |
| 1331 | + :param patch_operation: (required) |
| 1332 | + :type patch_operation: List[PatchOperation] |
| 1333 | + :param _request_timeout: timeout setting for this request. If one |
| 1334 | + number provided, it will be total request |
| 1335 | + timeout. It can also be a pair (tuple) of |
| 1336 | + (connection, read) timeouts. |
| 1337 | + :type _request_timeout: int, tuple(int, int), optional |
| 1338 | + :param _request_auth: set to override the auth_settings for an a single |
| 1339 | + request; this effectively ignores the |
| 1340 | + authentication in the spec for a single request. |
| 1341 | + :type _request_auth: dict, optional |
| 1342 | + :param _content_type: force content-type for the request. |
| 1343 | + :type _content_type: str, Optional |
| 1344 | + :param _headers: set to override the headers for a single |
| 1345 | + request; this effectively ignores the headers |
| 1346 | + in the spec for a single request. |
| 1347 | + :type _headers: dict, optional |
| 1348 | + :param _host_index: set to override the host_index for a single |
| 1349 | + request; this effectively ignores the host_index |
| 1350 | + in the spec for a single request. |
| 1351 | + :type _host_index: int, optional |
| 1352 | + :return: Returns the result object. |
| 1353 | + """# noqa: E501 |
| 1354 | + |
| 1355 | +_param=self._patch_instance_serialize( |
| 1356 | +project_id=project_id, |
| 1357 | +instance_id=instance_id, |
| 1358 | +patch_operation=patch_operation, |
| 1359 | +_request_auth=_request_auth, |
| 1360 | +_content_type=_content_type, |
| 1361 | +_headers=_headers, |
| 1362 | +_host_index=_host_index, |
| 1363 | + ) |
| 1364 | + |
| 1365 | +_response_types_map:Dict[str,Optional[str]]= { |
| 1366 | +"200":"Instance", |
| 1367 | +"202":None, |
| 1368 | +"400":"GenericErrorResponse", |
| 1369 | +"401":"UnauthorizedResponse", |
| 1370 | +"404":None, |
| 1371 | +"409":None, |
| 1372 | +"500":"GenericErrorResponse", |
| 1373 | + } |
| 1374 | +response_data=self.api_client.call_api(*_param,_request_timeout=_request_timeout) |
| 1375 | +response_data.read() |
| 1376 | +returnself.api_client.response_deserialize( |
| 1377 | +response_data=response_data, |
| 1378 | +response_types_map=_response_types_map, |
| 1379 | + ).data |
| 1380 | + |
| 1381 | +@validate_call |
| 1382 | +defpatch_instance_with_http_info( |
| 1383 | +self, |
| 1384 | +project_id:Annotated[str,Field(min_length=36,strict=True,max_length=36,description="Project identifier.")], |
| 1385 | +instance_id:Annotated[ |
| 1386 | +str,Field(min_length=36,strict=True,max_length=36,description="Instance identifier.") |
| 1387 | + ], |
| 1388 | +patch_operation:List[PatchOperation], |
| 1389 | +_request_timeout:Union[ |
| 1390 | +None, |
| 1391 | +Annotated[StrictFloat,Field(gt=0)], |
| 1392 | +Tuple[Annotated[StrictFloat,Field(gt=0)],Annotated[StrictFloat,Field(gt=0)]], |
| 1393 | + ]=None, |
| 1394 | +_request_auth:Optional[Dict[StrictStr,Any]]=None, |
| 1395 | +_content_type:Optional[StrictStr]=None, |
| 1396 | +_headers:Optional[Dict[StrictStr,Any]]=None, |
| 1397 | +_host_index:Annotated[StrictInt,Field(ge=0,le=0)]=0, |
| 1398 | + )->ApiResponse[Instance]: |
| 1399 | +"""Patch Instance. |
| 1400 | +
|
| 1401 | + Patches the Instance. |
| 1402 | +
|
| 1403 | + :param project_id: Project identifier. (required) |
| 1404 | + :type project_id: str |
| 1405 | + :param instance_id: Instance identifier. (required) |
| 1406 | + :type instance_id: str |
| 1407 | + :param patch_operation: (required) |
| 1408 | + :type patch_operation: List[PatchOperation] |
| 1409 | + :param _request_timeout: timeout setting for this request. If one |
| 1410 | + number provided, it will be total request |
| 1411 | + timeout. It can also be a pair (tuple) of |
| 1412 | + (connection, read) timeouts. |
| 1413 | + :type _request_timeout: int, tuple(int, int), optional |
| 1414 | + :param _request_auth: set to override the auth_settings for an a single |
| 1415 | + request; this effectively ignores the |
| 1416 | + authentication in the spec for a single request. |
| 1417 | + :type _request_auth: dict, optional |
| 1418 | + :param _content_type: force content-type for the request. |
| 1419 | + :type _content_type: str, Optional |
| 1420 | + :param _headers: set to override the headers for a single |
| 1421 | + request; this effectively ignores the headers |
| 1422 | + in the spec for a single request. |
| 1423 | + :type _headers: dict, optional |
| 1424 | + :param _host_index: set to override the host_index for a single |
| 1425 | + request; this effectively ignores the host_index |
| 1426 | + in the spec for a single request. |
| 1427 | + :type _host_index: int, optional |
| 1428 | + :return: Returns the result object. |
| 1429 | + """# noqa: E501 |
| 1430 | + |
| 1431 | +_param=self._patch_instance_serialize( |
| 1432 | +project_id=project_id, |
| 1433 | +instance_id=instance_id, |
| 1434 | +patch_operation=patch_operation, |
| 1435 | +_request_auth=_request_auth, |
| 1436 | +_content_type=_content_type, |
| 1437 | +_headers=_headers, |
| 1438 | +_host_index=_host_index, |
| 1439 | + ) |
| 1440 | + |
| 1441 | +_response_types_map:Dict[str,Optional[str]]= { |
| 1442 | +"200":"Instance", |
| 1443 | +"202":None, |
| 1444 | +"400":"GenericErrorResponse", |
| 1445 | +"401":"UnauthorizedResponse", |
| 1446 | +"404":None, |
| 1447 | +"409":None, |
| 1448 | +"500":"GenericErrorResponse", |
| 1449 | + } |
| 1450 | +response_data=self.api_client.call_api(*_param,_request_timeout=_request_timeout) |
| 1451 | +response_data.read() |
| 1452 | +returnself.api_client.response_deserialize( |
| 1453 | +response_data=response_data, |
| 1454 | +response_types_map=_response_types_map, |
| 1455 | + ) |
| 1456 | + |
| 1457 | +@validate_call |
| 1458 | +defpatch_instance_without_preload_content( |
| 1459 | +self, |
| 1460 | +project_id:Annotated[str,Field(min_length=36,strict=True,max_length=36,description="Project identifier.")], |
| 1461 | +instance_id:Annotated[ |
| 1462 | +str,Field(min_length=36,strict=True,max_length=36,description="Instance identifier.") |
| 1463 | + ], |
| 1464 | +patch_operation:List[PatchOperation], |
| 1465 | +_request_timeout:Union[ |
| 1466 | +None, |
| 1467 | +Annotated[StrictFloat,Field(gt=0)], |
| 1468 | +Tuple[Annotated[StrictFloat,Field(gt=0)],Annotated[StrictFloat,Field(gt=0)]], |
| 1469 | + ]=None, |
| 1470 | +_request_auth:Optional[Dict[StrictStr,Any]]=None, |
| 1471 | +_content_type:Optional[StrictStr]=None, |
| 1472 | +_headers:Optional[Dict[StrictStr,Any]]=None, |
| 1473 | +_host_index:Annotated[StrictInt,Field(ge=0,le=0)]=0, |
| 1474 | + )->RESTResponseType: |
| 1475 | +"""Patch Instance. |
| 1476 | +
|
| 1477 | + Patches the Instance. |
| 1478 | +
|
| 1479 | + :param project_id: Project identifier. (required) |
| 1480 | + :type project_id: str |
| 1481 | + :param instance_id: Instance identifier. (required) |
| 1482 | + :type instance_id: str |
| 1483 | + :param patch_operation: (required) |
| 1484 | + :type patch_operation: List[PatchOperation] |
| 1485 | + :param _request_timeout: timeout setting for this request. If one |
| 1486 | + number provided, it will be total request |
| 1487 | + timeout. It can also be a pair (tuple) of |
| 1488 | + (connection, read) timeouts. |
| 1489 | + :type _request_timeout: int, tuple(int, int), optional |
| 1490 | + :param _request_auth: set to override the auth_settings for an a single |
| 1491 | + request; this effectively ignores the |
| 1492 | + authentication in the spec for a single request. |
| 1493 | + :type _request_auth: dict, optional |
| 1494 | + :param _content_type: force content-type for the request. |
| 1495 | + :type _content_type: str, Optional |
| 1496 | + :param _headers: set to override the headers for a single |
| 1497 | + request; this effectively ignores the headers |
| 1498 | + in the spec for a single request. |
| 1499 | + :type _headers: dict, optional |
| 1500 | + :param _host_index: set to override the host_index for a single |
| 1501 | + request; this effectively ignores the host_index |
| 1502 | + in the spec for a single request. |
| 1503 | + :type _host_index: int, optional |
| 1504 | + :return: Returns the result object. |
| 1505 | + """# noqa: E501 |
| 1506 | + |
| 1507 | +_param=self._patch_instance_serialize( |
| 1508 | +project_id=project_id, |
| 1509 | +instance_id=instance_id, |
| 1510 | +patch_operation=patch_operation, |
| 1511 | +_request_auth=_request_auth, |
| 1512 | +_content_type=_content_type, |
| 1513 | +_headers=_headers, |
| 1514 | +_host_index=_host_index, |
| 1515 | + ) |
| 1516 | + |
| 1517 | +_response_types_map:Dict[str,Optional[str]]= { |
| 1518 | +"200":"Instance", |
| 1519 | +"202":None, |
| 1520 | +"400":"GenericErrorResponse", |
| 1521 | +"401":"UnauthorizedResponse", |
| 1522 | +"404":None, |
| 1523 | +"409":None, |
| 1524 | +"500":"GenericErrorResponse", |
| 1525 | + } |
| 1526 | +response_data=self.api_client.call_api(*_param,_request_timeout=_request_timeout) |
| 1527 | +returnresponse_data.response |
| 1528 | + |
| 1529 | +def_patch_instance_serialize( |
| 1530 | +self, |
| 1531 | +project_id, |
| 1532 | +instance_id, |
| 1533 | +patch_operation, |
| 1534 | +_request_auth, |
| 1535 | +_content_type, |
| 1536 | +_headers, |
| 1537 | +_host_index, |
| 1538 | + )->RequestSerialized: |
| 1539 | + |
| 1540 | +_host=None |
| 1541 | + |
| 1542 | +_collection_formats:Dict[str,str]= { |
| 1543 | +"PatchOperation":"", |
| 1544 | + } |
| 1545 | + |
| 1546 | +_path_params:Dict[str,str]= {} |
| 1547 | +_query_params:List[Tuple[str,str]]= [] |
| 1548 | +_header_params:Dict[str,Optional[str]]=_headersor {} |
| 1549 | +_form_params:List[Tuple[str,str]]= [] |
| 1550 | +_files:Dict[str,Union[str,bytes,List[str],List[bytes],List[Tuple[str,bytes]]]]= {} |
| 1551 | +_body_params:Optional[bytes]=None |
| 1552 | + |
| 1553 | +# process the path parameters |
| 1554 | +ifproject_idisnotNone: |
| 1555 | +_path_params["projectId"]=project_id |
| 1556 | +ifinstance_idisnotNone: |
| 1557 | +_path_params["instanceId"]=instance_id |
| 1558 | +# process the query parameters |
| 1559 | +# process the header parameters |
| 1560 | +# process the form parameters |
| 1561 | +# process the body parameter |
| 1562 | +ifpatch_operationisnotNone: |
| 1563 | +_body_params=patch_operation |
| 1564 | + |
| 1565 | +# set the HTTP header `Accept` |
| 1566 | +if"Accept"notin_header_params: |
| 1567 | +_header_params["Accept"]=self.api_client.select_header_accept(["application/json"]) |
| 1568 | + |
| 1569 | +# set the HTTP header `Content-Type` |
| 1570 | +if_content_type: |
| 1571 | +_header_params["Content-Type"]=_content_type |
| 1572 | +else: |
| 1573 | +_default_content_type=self.api_client.select_header_content_type(["application/json-patch+json"]) |
| 1574 | +if_default_content_typeisnotNone: |
| 1575 | +_header_params["Content-Type"]=_default_content_type |
| 1576 | + |
| 1577 | +# authentication setting |
| 1578 | +_auth_settings:List[str]= [] |
| 1579 | + |
| 1580 | +returnself.api_client.param_serialize( |
| 1581 | +method="PATCH", |
| 1582 | +resource_path="/v1beta/projects/{projectId}/instances/{instanceId}", |
| 1583 | +path_params=_path_params, |
| 1584 | +query_params=_query_params, |
| 1585 | +header_params=_header_params, |
| 1586 | +body=_body_params, |
| 1587 | +post_params=_form_params, |
| 1588 | +files=_files, |
| 1589 | +auth_settings=_auth_settings, |
| 1590 | +collection_formats=_collection_formats, |
| 1591 | +_host=_host, |
| 1592 | +_request_auth=_request_auth, |
| 1593 | + ) |