gcore 0.1.0a1__py3-none-any.whl → 0.2.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of gcore might be problematic. Click here for more details.
- gcore/__init__.py +5 -0
- gcore/_client.py +9 -0
- gcore/_utils/_proxy.py +4 -1
- gcore/_utils/_resources_proxy.py +24 -0
- gcore/_version.py +1 -1
- gcore/resources/__init__.py +14 -0
- gcore/resources/cloud/baremetal/servers.py +234 -0
- gcore/resources/cloud/billing_reservations.py +24 -0
- gcore/resources/cloud/file_shares/file_shares.py +16 -0
- gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py +352 -2
- gcore/resources/cloud/gpu_baremetal_clusters/images.py +204 -0
- gcore/resources/cloud/gpu_baremetal_clusters/servers.py +80 -0
- gcore/resources/cloud/inference/deployments/deployments.py +322 -4
- gcore/resources/cloud/instances/images.py +316 -0
- gcore/resources/cloud/instances/instances.py +472 -0
- gcore/resources/cloud/load_balancers/l7_policies/l7_policies.py +282 -0
- gcore/resources/cloud/load_balancers/l7_policies/rules.py +326 -0
- gcore/resources/cloud/load_balancers/listeners.py +371 -6
- gcore/resources/cloud/load_balancers/load_balancers.py +364 -0
- gcore/resources/cloud/load_balancers/pools/health_monitors.py +24 -0
- gcore/resources/cloud/load_balancers/pools/members.py +28 -0
- gcore/resources/cloud/load_balancers/pools/pools.py +388 -8
- gcore/resources/cloud/networks/networks.py +72 -16
- gcore/resources/cloud/secrets.py +56 -11
- gcore/resources/cloud/tasks.py +107 -96
- gcore/resources/waap/__init__.py +33 -0
- gcore/resources/waap/domains/__init__.py +33 -0
- gcore/resources/waap/domains/domains.py +515 -0
- gcore/resources/waap/domains/settings.py +271 -0
- gcore/resources/waap/waap.py +102 -0
- gcore/types/cloud/__init__.py +1 -0
- gcore/types/cloud/billing_reservation_list_params.py +5 -0
- gcore/types/cloud/container_probe_config_create_param.py +1 -2
- gcore/types/cloud/file_share.py +3 -0
- gcore/types/cloud/file_share_list_params.py +7 -1
- gcore/types/cloud/gpu_baremetal_cluster_create_params.py +20 -0
- gcore/types/cloud/inference/deployment_update_params.py +203 -6
- gcore/types/cloud/inference/inference.py +3 -1
- gcore/types/cloud/load_balancer_listener_detail.py +13 -13
- gcore/types/cloud/load_balancer_pool.py +13 -13
- gcore/types/cloud/load_balancer_pool_list.py +99 -4
- gcore/types/cloud/load_balancers/listener_create_params.py +2 -0
- gcore/types/cloud/load_balancers/listener_get_params.py +3 -1
- gcore/types/cloud/load_balancers/listener_list_params.py +4 -2
- gcore/types/cloud/load_balancers/listener_update_params.py +2 -0
- gcore/types/cloud/load_balancers/pool_create_params.py +2 -0
- gcore/types/cloud/load_balancers/pool_list_params.py +5 -6
- gcore/types/cloud/load_balancers/pool_update_params.py +2 -0
- gcore/types/cloud/load_balancers/pools/health_monitor_create_params.py +2 -0
- gcore/types/cloud/load_balancers/pools/member_add_params.py +2 -0
- gcore/types/cloud/network.py +21 -21
- gcore/types/cloud/network_create_params.py +2 -0
- gcore/types/cloud/network_details.py +24 -23
- gcore/types/cloud/network_list_params.py +15 -10
- gcore/types/cloud/network_update_params.py +2 -0
- gcore/types/cloud/quota_get_all_response.py +18 -0
- gcore/types/cloud/quota_get_by_region_response.py +18 -0
- gcore/types/cloud/quotas/request_create_params.py +9 -0
- gcore/types/cloud/quotas/request_get_response.py +9 -0
- gcore/types/cloud/quotas/request_list_response.py +9 -0
- gcore/types/cloud/secret_list_params.py +24 -0
- gcore/types/cloud/task.py +0 -3
- gcore/types/cloud/task_list_params.py +8 -2
- gcore/types/waap/__init__.py +12 -0
- gcore/types/waap/domain_list_params.py +30 -0
- gcore/types/waap/domain_update_params.py +12 -0
- gcore/types/waap/domains/__init__.py +5 -0
- gcore/types/waap/domains/setting_update_params.py +41 -0
- gcore/types/waap/waap_api_urls.py +15 -0
- gcore/types/waap/waap_detailed_domain.py +37 -0
- gcore/types/waap/waap_domain_ddos_settings.py +31 -0
- gcore/types/waap/waap_domain_settings.py +15 -0
- gcore/types/waap/waap_domain_status.py +7 -0
- gcore/types/waap/waap_summary_domain.py +26 -0
- {gcore-0.1.0a1.dist-info → gcore-0.2.0.dist-info}/METADATA +4 -7
- {gcore-0.1.0a1.dist-info → gcore-0.2.0.dist-info}/RECORD +78 -60
- {gcore-0.1.0a1.dist-info → gcore-0.2.0.dist-info}/WHEEL +0 -0
- {gcore-0.1.0a1.dist-info → gcore-0.2.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -258,6 +258,76 @@ class InstancesResource(SyncAPIResource):
|
|
|
258
258
|
cast_to=TaskIDList,
|
|
259
259
|
)
|
|
260
260
|
|
|
261
|
+
def create_and_poll(
|
|
262
|
+
self,
|
|
263
|
+
*,
|
|
264
|
+
project_id: int | None = None,
|
|
265
|
+
region_id: int | None = None,
|
|
266
|
+
flavor: str,
|
|
267
|
+
interfaces: Iterable[instance_create_params.Interface],
|
|
268
|
+
volumes: Iterable[instance_create_params.Volume],
|
|
269
|
+
allow_app_ports: bool | NotGiven = NOT_GIVEN,
|
|
270
|
+
configuration: Optional[object] | NotGiven = NOT_GIVEN,
|
|
271
|
+
name: str | NotGiven = NOT_GIVEN,
|
|
272
|
+
name_template: str | NotGiven = NOT_GIVEN,
|
|
273
|
+
password: str | NotGiven = NOT_GIVEN,
|
|
274
|
+
security_groups: Iterable[instance_create_params.SecurityGroup] | NotGiven = NOT_GIVEN,
|
|
275
|
+
servergroup_id: str | NotGiven = NOT_GIVEN,
|
|
276
|
+
ssh_key_name: Optional[str] | NotGiven = NOT_GIVEN,
|
|
277
|
+
tags: TagUpdateMapParam | NotGiven = NOT_GIVEN,
|
|
278
|
+
user_data: str | NotGiven = NOT_GIVEN,
|
|
279
|
+
username: str | NotGiven = NOT_GIVEN,
|
|
280
|
+
polling_interval_seconds: int | NotGiven = NOT_GIVEN,
|
|
281
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
282
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
283
|
+
extra_headers: Headers | None = None,
|
|
284
|
+
extra_query: Query | None = None,
|
|
285
|
+
extra_body: Body | None = None,
|
|
286
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
287
|
+
) -> Instance:
|
|
288
|
+
"""Create one or many instances or basic VMs and poll for the result."""
|
|
289
|
+
response = self.create(
|
|
290
|
+
project_id=project_id,
|
|
291
|
+
region_id=region_id,
|
|
292
|
+
flavor=flavor,
|
|
293
|
+
interfaces=interfaces,
|
|
294
|
+
volumes=volumes,
|
|
295
|
+
allow_app_ports=allow_app_ports,
|
|
296
|
+
configuration=configuration,
|
|
297
|
+
name_template=name_template,
|
|
298
|
+
name=name,
|
|
299
|
+
password=password,
|
|
300
|
+
security_groups=security_groups,
|
|
301
|
+
servergroup_id=servergroup_id,
|
|
302
|
+
ssh_key_name=ssh_key_name,
|
|
303
|
+
tags=tags,
|
|
304
|
+
user_data=user_data,
|
|
305
|
+
username=username,
|
|
306
|
+
extra_headers=extra_headers,
|
|
307
|
+
extra_query=extra_query,
|
|
308
|
+
extra_body=extra_body,
|
|
309
|
+
timeout=timeout,
|
|
310
|
+
)
|
|
311
|
+
if not response.tasks or len(response.tasks) != 1:
|
|
312
|
+
raise ValueError(f"Expected exactly one task to be created")
|
|
313
|
+
task = self._client.cloud.tasks.poll(
|
|
314
|
+
task_id=response.tasks[0],
|
|
315
|
+
extra_headers=extra_headers,
|
|
316
|
+
polling_interval_seconds=polling_interval_seconds,
|
|
317
|
+
)
|
|
318
|
+
if (
|
|
319
|
+
not task.created_resources
|
|
320
|
+
or not task.created_resources.instances
|
|
321
|
+
or len(task.created_resources.instances) != 1
|
|
322
|
+
):
|
|
323
|
+
raise ValueError(f"Expected exactly one resource to be created in a task")
|
|
324
|
+
return self.get(
|
|
325
|
+
instance_id=task.created_resources.instances[0],
|
|
326
|
+
project_id=project_id,
|
|
327
|
+
region_id=region_id,
|
|
328
|
+
extra_headers=extra_headers,
|
|
329
|
+
)
|
|
330
|
+
|
|
261
331
|
def update(
|
|
262
332
|
self,
|
|
263
333
|
instance_id: str,
|
|
@@ -561,6 +631,48 @@ class InstancesResource(SyncAPIResource):
|
|
|
561
631
|
cast_to=TaskIDList,
|
|
562
632
|
)
|
|
563
633
|
|
|
634
|
+
def delete_and_poll(
|
|
635
|
+
self,
|
|
636
|
+
instance_id: str,
|
|
637
|
+
*,
|
|
638
|
+
project_id: int | None = None,
|
|
639
|
+
region_id: int | None = None,
|
|
640
|
+
delete_floatings: bool | NotGiven = NOT_GIVEN,
|
|
641
|
+
floatings: str | NotGiven = NOT_GIVEN,
|
|
642
|
+
reserved_fixed_ips: str | NotGiven = NOT_GIVEN,
|
|
643
|
+
volumes: str | NotGiven = NOT_GIVEN,
|
|
644
|
+
polling_interval_seconds: int | NotGiven = NOT_GIVEN,
|
|
645
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
646
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
647
|
+
extra_headers: Headers | None = None,
|
|
648
|
+
extra_query: Query | None = None,
|
|
649
|
+
extra_body: Body | None = None,
|
|
650
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
651
|
+
) -> None:
|
|
652
|
+
"""
|
|
653
|
+
Delete instance and poll for the result. Only the first task will be polled. If you need to poll more tasks, use the `tasks.poll` method.
|
|
654
|
+
"""
|
|
655
|
+
response = self.delete(
|
|
656
|
+
instance_id=instance_id,
|
|
657
|
+
project_id=project_id,
|
|
658
|
+
region_id=region_id,
|
|
659
|
+
delete_floatings=delete_floatings,
|
|
660
|
+
floatings=floatings,
|
|
661
|
+
reserved_fixed_ips=reserved_fixed_ips,
|
|
662
|
+
volumes=volumes,
|
|
663
|
+
extra_headers=extra_headers,
|
|
664
|
+
extra_query=extra_query,
|
|
665
|
+
extra_body=extra_body,
|
|
666
|
+
timeout=timeout,
|
|
667
|
+
)
|
|
668
|
+
if not response.tasks:
|
|
669
|
+
raise ValueError("Expected at least one task to be created")
|
|
670
|
+
self._client.cloud.tasks.poll(
|
|
671
|
+
task_id=response.tasks[0],
|
|
672
|
+
extra_headers=extra_headers,
|
|
673
|
+
polling_interval_seconds=polling_interval_seconds,
|
|
674
|
+
)
|
|
675
|
+
|
|
564
676
|
@overload
|
|
565
677
|
def action(
|
|
566
678
|
self,
|
|
@@ -711,6 +823,48 @@ class InstancesResource(SyncAPIResource):
|
|
|
711
823
|
cast_to=TaskIDList,
|
|
712
824
|
)
|
|
713
825
|
|
|
826
|
+
def add_to_placement_group_and_poll(
|
|
827
|
+
self,
|
|
828
|
+
instance_id: str,
|
|
829
|
+
*,
|
|
830
|
+
project_id: int | None = None,
|
|
831
|
+
region_id: int | None = None,
|
|
832
|
+
servergroup_id: str,
|
|
833
|
+
polling_interval_seconds: int | NotGiven = NOT_GIVEN,
|
|
834
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
835
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
836
|
+
extra_headers: Headers | None = None,
|
|
837
|
+
extra_query: Query | None = None,
|
|
838
|
+
extra_body: Body | None = None,
|
|
839
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
840
|
+
) -> Instance:
|
|
841
|
+
"""
|
|
842
|
+
Put instance into the server group and poll for the result. Only the first task will be polled. If you need to poll more tasks, use the `tasks.poll` method.
|
|
843
|
+
"""
|
|
844
|
+
response = self.add_to_placement_group(
|
|
845
|
+
instance_id=instance_id,
|
|
846
|
+
project_id=project_id,
|
|
847
|
+
region_id=region_id,
|
|
848
|
+
servergroup_id=servergroup_id,
|
|
849
|
+
extra_headers=extra_headers,
|
|
850
|
+
extra_query=extra_query,
|
|
851
|
+
extra_body=extra_body,
|
|
852
|
+
timeout=timeout,
|
|
853
|
+
)
|
|
854
|
+
if not response.tasks:
|
|
855
|
+
raise ValueError("Expected at least one task to be created")
|
|
856
|
+
self._client.cloud.tasks.poll(
|
|
857
|
+
task_id=response.tasks[0],
|
|
858
|
+
extra_headers=extra_headers,
|
|
859
|
+
polling_interval_seconds=polling_interval_seconds,
|
|
860
|
+
)
|
|
861
|
+
return self.get(
|
|
862
|
+
instance_id=instance_id,
|
|
863
|
+
project_id=project_id,
|
|
864
|
+
region_id=region_id,
|
|
865
|
+
extra_headers=extra_headers,
|
|
866
|
+
)
|
|
867
|
+
|
|
714
868
|
def assign_security_group(
|
|
715
869
|
self,
|
|
716
870
|
instance_id: str,
|
|
@@ -983,6 +1137,46 @@ class InstancesResource(SyncAPIResource):
|
|
|
983
1137
|
cast_to=TaskIDList,
|
|
984
1138
|
)
|
|
985
1139
|
|
|
1140
|
+
def remove_from_placement_group_and_poll(
|
|
1141
|
+
self,
|
|
1142
|
+
instance_id: str,
|
|
1143
|
+
*,
|
|
1144
|
+
project_id: int | None = None,
|
|
1145
|
+
region_id: int | None = None,
|
|
1146
|
+
polling_interval_seconds: int | NotGiven = NOT_GIVEN,
|
|
1147
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
1148
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
1149
|
+
extra_headers: Headers | None = None,
|
|
1150
|
+
extra_query: Query | None = None,
|
|
1151
|
+
extra_body: Body | None = None,
|
|
1152
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
1153
|
+
) -> Instance:
|
|
1154
|
+
"""
|
|
1155
|
+
Remove instance from the server group and poll for the result. Only the first task will be polled. If you need to poll more tasks, use the `tasks.poll` method.
|
|
1156
|
+
"""
|
|
1157
|
+
response = self.remove_from_placement_group(
|
|
1158
|
+
instance_id=instance_id,
|
|
1159
|
+
project_id=project_id,
|
|
1160
|
+
region_id=region_id,
|
|
1161
|
+
extra_headers=extra_headers,
|
|
1162
|
+
extra_query=extra_query,
|
|
1163
|
+
extra_body=extra_body,
|
|
1164
|
+
timeout=timeout,
|
|
1165
|
+
)
|
|
1166
|
+
if not response.tasks:
|
|
1167
|
+
raise ValueError("Expected at least one task to be created")
|
|
1168
|
+
self._client.cloud.tasks.poll(
|
|
1169
|
+
task_id=response.tasks[0],
|
|
1170
|
+
extra_headers=extra_headers,
|
|
1171
|
+
polling_interval_seconds=polling_interval_seconds,
|
|
1172
|
+
)
|
|
1173
|
+
return self.get(
|
|
1174
|
+
instance_id=instance_id,
|
|
1175
|
+
project_id=project_id,
|
|
1176
|
+
region_id=region_id,
|
|
1177
|
+
extra_headers=extra_headers,
|
|
1178
|
+
)
|
|
1179
|
+
|
|
986
1180
|
def resize(
|
|
987
1181
|
self,
|
|
988
1182
|
instance_id: str,
|
|
@@ -1026,6 +1220,48 @@ class InstancesResource(SyncAPIResource):
|
|
|
1026
1220
|
cast_to=TaskIDList,
|
|
1027
1221
|
)
|
|
1028
1222
|
|
|
1223
|
+
def resize_and_poll(
|
|
1224
|
+
self,
|
|
1225
|
+
instance_id: str,
|
|
1226
|
+
*,
|
|
1227
|
+
project_id: int | None = None,
|
|
1228
|
+
region_id: int | None = None,
|
|
1229
|
+
flavor_id: str,
|
|
1230
|
+
polling_interval_seconds: int | NotGiven = NOT_GIVEN,
|
|
1231
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
1232
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
1233
|
+
extra_headers: Headers | None = None,
|
|
1234
|
+
extra_query: Query | None = None,
|
|
1235
|
+
extra_body: Body | None = None,
|
|
1236
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
1237
|
+
) -> Instance:
|
|
1238
|
+
"""
|
|
1239
|
+
Change flavor of the instance and poll for the result. Only the first task will be polled. If you need to poll more tasks, use the `tasks.poll` method.
|
|
1240
|
+
"""
|
|
1241
|
+
response = self.resize(
|
|
1242
|
+
instance_id=instance_id,
|
|
1243
|
+
project_id=project_id,
|
|
1244
|
+
region_id=region_id,
|
|
1245
|
+
flavor_id=flavor_id,
|
|
1246
|
+
extra_headers=extra_headers,
|
|
1247
|
+
extra_query=extra_query,
|
|
1248
|
+
extra_body=extra_body,
|
|
1249
|
+
timeout=timeout,
|
|
1250
|
+
)
|
|
1251
|
+
if not response.tasks:
|
|
1252
|
+
raise ValueError("Expected at least one task to be created")
|
|
1253
|
+
self._client.cloud.tasks.poll(
|
|
1254
|
+
task_id=response.tasks[0],
|
|
1255
|
+
extra_headers=extra_headers,
|
|
1256
|
+
polling_interval_seconds=polling_interval_seconds,
|
|
1257
|
+
)
|
|
1258
|
+
return self.get(
|
|
1259
|
+
instance_id=instance_id,
|
|
1260
|
+
project_id=project_id,
|
|
1261
|
+
region_id=region_id,
|
|
1262
|
+
extra_headers=extra_headers,
|
|
1263
|
+
)
|
|
1264
|
+
|
|
1029
1265
|
def unassign_security_group(
|
|
1030
1266
|
self,
|
|
1031
1267
|
instance_id: str,
|
|
@@ -1268,6 +1504,76 @@ class AsyncInstancesResource(AsyncAPIResource):
|
|
|
1268
1504
|
cast_to=TaskIDList,
|
|
1269
1505
|
)
|
|
1270
1506
|
|
|
1507
|
+
async def create_and_poll(
|
|
1508
|
+
self,
|
|
1509
|
+
*,
|
|
1510
|
+
project_id: int | None = None,
|
|
1511
|
+
region_id: int | None = None,
|
|
1512
|
+
flavor: str,
|
|
1513
|
+
interfaces: Iterable[instance_create_params.Interface],
|
|
1514
|
+
volumes: Iterable[instance_create_params.Volume],
|
|
1515
|
+
allow_app_ports: bool | NotGiven = NOT_GIVEN,
|
|
1516
|
+
configuration: Optional[object] | NotGiven = NOT_GIVEN,
|
|
1517
|
+
name: str | NotGiven = NOT_GIVEN,
|
|
1518
|
+
name_template: str | NotGiven = NOT_GIVEN,
|
|
1519
|
+
password: str | NotGiven = NOT_GIVEN,
|
|
1520
|
+
security_groups: Iterable[instance_create_params.SecurityGroup] | NotGiven = NOT_GIVEN,
|
|
1521
|
+
servergroup_id: str | NotGiven = NOT_GIVEN,
|
|
1522
|
+
ssh_key_name: Optional[str] | NotGiven = NOT_GIVEN,
|
|
1523
|
+
tags: TagUpdateMapParam | NotGiven = NOT_GIVEN,
|
|
1524
|
+
user_data: str | NotGiven = NOT_GIVEN,
|
|
1525
|
+
username: str | NotGiven = NOT_GIVEN,
|
|
1526
|
+
polling_interval_seconds: int | NotGiven = NOT_GIVEN,
|
|
1527
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
1528
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
1529
|
+
extra_headers: Headers | None = None,
|
|
1530
|
+
extra_query: Query | None = None,
|
|
1531
|
+
extra_body: Body | None = None,
|
|
1532
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
1533
|
+
) -> Instance:
|
|
1534
|
+
"""Create one or many instances or basic VMs and poll for the result."""
|
|
1535
|
+
response = await self.create(
|
|
1536
|
+
project_id=project_id,
|
|
1537
|
+
region_id=region_id,
|
|
1538
|
+
flavor=flavor,
|
|
1539
|
+
interfaces=interfaces,
|
|
1540
|
+
volumes=volumes,
|
|
1541
|
+
allow_app_ports=allow_app_ports,
|
|
1542
|
+
configuration=configuration,
|
|
1543
|
+
name_template=name_template,
|
|
1544
|
+
name=name,
|
|
1545
|
+
password=password,
|
|
1546
|
+
security_groups=security_groups,
|
|
1547
|
+
servergroup_id=servergroup_id,
|
|
1548
|
+
ssh_key_name=ssh_key_name,
|
|
1549
|
+
tags=tags,
|
|
1550
|
+
user_data=user_data,
|
|
1551
|
+
username=username,
|
|
1552
|
+
extra_headers=extra_headers,
|
|
1553
|
+
extra_query=extra_query,
|
|
1554
|
+
extra_body=extra_body,
|
|
1555
|
+
timeout=timeout,
|
|
1556
|
+
)
|
|
1557
|
+
if not response.tasks or len(response.tasks) != 1:
|
|
1558
|
+
raise ValueError(f"Expected exactly one task to be created")
|
|
1559
|
+
task = await self._client.cloud.tasks.poll(
|
|
1560
|
+
task_id=response.tasks[0],
|
|
1561
|
+
extra_headers=extra_headers,
|
|
1562
|
+
polling_interval_seconds=polling_interval_seconds,
|
|
1563
|
+
)
|
|
1564
|
+
if (
|
|
1565
|
+
not task.created_resources
|
|
1566
|
+
or not task.created_resources.instances
|
|
1567
|
+
or len(task.created_resources.instances) != 1
|
|
1568
|
+
):
|
|
1569
|
+
raise ValueError(f"Expected exactly one resource to be created in a task")
|
|
1570
|
+
return await self.get(
|
|
1571
|
+
instance_id=task.created_resources.instances[0],
|
|
1572
|
+
project_id=project_id,
|
|
1573
|
+
region_id=region_id,
|
|
1574
|
+
extra_headers=extra_headers,
|
|
1575
|
+
)
|
|
1576
|
+
|
|
1271
1577
|
async def update(
|
|
1272
1578
|
self,
|
|
1273
1579
|
instance_id: str,
|
|
@@ -1571,6 +1877,48 @@ class AsyncInstancesResource(AsyncAPIResource):
|
|
|
1571
1877
|
cast_to=TaskIDList,
|
|
1572
1878
|
)
|
|
1573
1879
|
|
|
1880
|
+
async def delete_and_poll(
|
|
1881
|
+
self,
|
|
1882
|
+
instance_id: str,
|
|
1883
|
+
*,
|
|
1884
|
+
project_id: int | None = None,
|
|
1885
|
+
region_id: int | None = None,
|
|
1886
|
+
delete_floatings: bool | NotGiven = NOT_GIVEN,
|
|
1887
|
+
floatings: str | NotGiven = NOT_GIVEN,
|
|
1888
|
+
reserved_fixed_ips: str | NotGiven = NOT_GIVEN,
|
|
1889
|
+
volumes: str | NotGiven = NOT_GIVEN,
|
|
1890
|
+
polling_interval_seconds: int | NotGiven = NOT_GIVEN,
|
|
1891
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
1892
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
1893
|
+
extra_headers: Headers | None = None,
|
|
1894
|
+
extra_query: Query | None = None,
|
|
1895
|
+
extra_body: Body | None = None,
|
|
1896
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
1897
|
+
) -> None:
|
|
1898
|
+
"""
|
|
1899
|
+
Delete instance and poll for the result. Only the first task will be polled. If you need to poll more tasks, use the `tasks.poll` method.
|
|
1900
|
+
"""
|
|
1901
|
+
response = await self.delete(
|
|
1902
|
+
instance_id=instance_id,
|
|
1903
|
+
project_id=project_id,
|
|
1904
|
+
region_id=region_id,
|
|
1905
|
+
delete_floatings=delete_floatings,
|
|
1906
|
+
floatings=floatings,
|
|
1907
|
+
reserved_fixed_ips=reserved_fixed_ips,
|
|
1908
|
+
volumes=volumes,
|
|
1909
|
+
extra_headers=extra_headers,
|
|
1910
|
+
extra_query=extra_query,
|
|
1911
|
+
extra_body=extra_body,
|
|
1912
|
+
timeout=timeout,
|
|
1913
|
+
)
|
|
1914
|
+
if not response.tasks:
|
|
1915
|
+
raise ValueError("Expected at least one task to be created")
|
|
1916
|
+
await self._client.cloud.tasks.poll(
|
|
1917
|
+
task_id=response.tasks[0],
|
|
1918
|
+
extra_headers=extra_headers,
|
|
1919
|
+
polling_interval_seconds=polling_interval_seconds,
|
|
1920
|
+
)
|
|
1921
|
+
|
|
1574
1922
|
@overload
|
|
1575
1923
|
async def action(
|
|
1576
1924
|
self,
|
|
@@ -1721,6 +2069,48 @@ class AsyncInstancesResource(AsyncAPIResource):
|
|
|
1721
2069
|
cast_to=TaskIDList,
|
|
1722
2070
|
)
|
|
1723
2071
|
|
|
2072
|
+
async def add_to_placement_group_and_poll(
|
|
2073
|
+
self,
|
|
2074
|
+
instance_id: str,
|
|
2075
|
+
*,
|
|
2076
|
+
project_id: int | None = None,
|
|
2077
|
+
region_id: int | None = None,
|
|
2078
|
+
servergroup_id: str,
|
|
2079
|
+
polling_interval_seconds: int | NotGiven = NOT_GIVEN,
|
|
2080
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
2081
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
2082
|
+
extra_headers: Headers | None = None,
|
|
2083
|
+
extra_query: Query | None = None,
|
|
2084
|
+
extra_body: Body | None = None,
|
|
2085
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
2086
|
+
) -> Instance:
|
|
2087
|
+
"""
|
|
2088
|
+
Put instance into the server group and poll for the result. Only the first task will be polled. If you need to poll more tasks, use the `tasks.poll` method.
|
|
2089
|
+
"""
|
|
2090
|
+
response = await self.add_to_placement_group(
|
|
2091
|
+
instance_id=instance_id,
|
|
2092
|
+
project_id=project_id,
|
|
2093
|
+
region_id=region_id,
|
|
2094
|
+
servergroup_id=servergroup_id,
|
|
2095
|
+
extra_headers=extra_headers,
|
|
2096
|
+
extra_query=extra_query,
|
|
2097
|
+
extra_body=extra_body,
|
|
2098
|
+
timeout=timeout,
|
|
2099
|
+
)
|
|
2100
|
+
if not response.tasks:
|
|
2101
|
+
raise ValueError("Expected at least one task to be created")
|
|
2102
|
+
await self._client.cloud.tasks.poll(
|
|
2103
|
+
task_id=response.tasks[0],
|
|
2104
|
+
extra_headers=extra_headers,
|
|
2105
|
+
polling_interval_seconds=polling_interval_seconds,
|
|
2106
|
+
)
|
|
2107
|
+
return await self.get(
|
|
2108
|
+
instance_id=instance_id,
|
|
2109
|
+
project_id=project_id,
|
|
2110
|
+
region_id=region_id,
|
|
2111
|
+
extra_headers=extra_headers,
|
|
2112
|
+
)
|
|
2113
|
+
|
|
1724
2114
|
async def assign_security_group(
|
|
1725
2115
|
self,
|
|
1726
2116
|
instance_id: str,
|
|
@@ -1993,6 +2383,46 @@ class AsyncInstancesResource(AsyncAPIResource):
|
|
|
1993
2383
|
cast_to=TaskIDList,
|
|
1994
2384
|
)
|
|
1995
2385
|
|
|
2386
|
+
async def remove_from_placement_group_and_poll(
|
|
2387
|
+
self,
|
|
2388
|
+
instance_id: str,
|
|
2389
|
+
*,
|
|
2390
|
+
project_id: int | None = None,
|
|
2391
|
+
region_id: int | None = None,
|
|
2392
|
+
polling_interval_seconds: int | NotGiven = NOT_GIVEN,
|
|
2393
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
2394
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
2395
|
+
extra_headers: Headers | None = None,
|
|
2396
|
+
extra_query: Query | None = None,
|
|
2397
|
+
extra_body: Body | None = None,
|
|
2398
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
2399
|
+
) -> Instance:
|
|
2400
|
+
"""
|
|
2401
|
+
Remove instance from the server group and poll for the result. Only the first task will be polled. If you need to poll more tasks, use the `tasks.poll` method.
|
|
2402
|
+
"""
|
|
2403
|
+
response = await self.remove_from_placement_group(
|
|
2404
|
+
instance_id=instance_id,
|
|
2405
|
+
project_id=project_id,
|
|
2406
|
+
region_id=region_id,
|
|
2407
|
+
extra_headers=extra_headers,
|
|
2408
|
+
extra_query=extra_query,
|
|
2409
|
+
extra_body=extra_body,
|
|
2410
|
+
timeout=timeout,
|
|
2411
|
+
)
|
|
2412
|
+
if not response.tasks:
|
|
2413
|
+
raise ValueError("Expected at least one task to be created")
|
|
2414
|
+
await self._client.cloud.tasks.poll(
|
|
2415
|
+
task_id=response.tasks[0],
|
|
2416
|
+
extra_headers=extra_headers,
|
|
2417
|
+
polling_interval_seconds=polling_interval_seconds,
|
|
2418
|
+
)
|
|
2419
|
+
return await self.get(
|
|
2420
|
+
instance_id=instance_id,
|
|
2421
|
+
project_id=project_id,
|
|
2422
|
+
region_id=region_id,
|
|
2423
|
+
extra_headers=extra_headers,
|
|
2424
|
+
)
|
|
2425
|
+
|
|
1996
2426
|
async def resize(
|
|
1997
2427
|
self,
|
|
1998
2428
|
instance_id: str,
|
|
@@ -2036,6 +2466,48 @@ class AsyncInstancesResource(AsyncAPIResource):
|
|
|
2036
2466
|
cast_to=TaskIDList,
|
|
2037
2467
|
)
|
|
2038
2468
|
|
|
2469
|
+
async def resize_and_poll(
|
|
2470
|
+
self,
|
|
2471
|
+
instance_id: str,
|
|
2472
|
+
*,
|
|
2473
|
+
project_id: int | None = None,
|
|
2474
|
+
region_id: int | None = None,
|
|
2475
|
+
flavor_id: str,
|
|
2476
|
+
polling_interval_seconds: int | NotGiven = NOT_GIVEN,
|
|
2477
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
2478
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
2479
|
+
extra_headers: Headers | None = None,
|
|
2480
|
+
extra_query: Query | None = None,
|
|
2481
|
+
extra_body: Body | None = None,
|
|
2482
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
2483
|
+
) -> Instance:
|
|
2484
|
+
"""
|
|
2485
|
+
Change flavor of the instance and poll for the result. Only the first task will be polled. If you need to poll more tasks, use the `tasks.poll` method.
|
|
2486
|
+
"""
|
|
2487
|
+
response = await self.resize(
|
|
2488
|
+
instance_id=instance_id,
|
|
2489
|
+
project_id=project_id,
|
|
2490
|
+
region_id=region_id,
|
|
2491
|
+
flavor_id=flavor_id,
|
|
2492
|
+
extra_headers=extra_headers,
|
|
2493
|
+
extra_query=extra_query,
|
|
2494
|
+
extra_body=extra_body,
|
|
2495
|
+
timeout=timeout,
|
|
2496
|
+
)
|
|
2497
|
+
if not response.tasks:
|
|
2498
|
+
raise ValueError("Expected at least one task to be created")
|
|
2499
|
+
await self._client.cloud.tasks.poll(
|
|
2500
|
+
task_id=response.tasks[0],
|
|
2501
|
+
extra_headers=extra_headers,
|
|
2502
|
+
polling_interval_seconds=polling_interval_seconds,
|
|
2503
|
+
)
|
|
2504
|
+
return await self.get(
|
|
2505
|
+
instance_id=instance_id,
|
|
2506
|
+
project_id=project_id,
|
|
2507
|
+
region_id=region_id,
|
|
2508
|
+
extra_headers=extra_headers,
|
|
2509
|
+
)
|
|
2510
|
+
|
|
2039
2511
|
async def unassign_security_group(
|
|
2040
2512
|
self,
|
|
2041
2513
|
instance_id: str,
|