gcore 0.10.0__py3-none-any.whl → 0.12.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/_base_client.py +3 -3
- gcore/_client.py +18 -0
- gcore/_compat.py +48 -48
- gcore/_models.py +41 -41
- gcore/_types.py +35 -1
- gcore/_utils/__init__.py +9 -2
- gcore/_utils/_compat.py +45 -0
- gcore/_utils/_datetime_parse.py +136 -0
- gcore/_utils/_transform.py +11 -1
- gcore/_utils/_typing.py +6 -1
- gcore/_utils/_utils.py +0 -1
- gcore/_version.py +1 -1
- gcore/resources/__init__.py +28 -0
- gcore/resources/cloud/__init__.py +14 -0
- gcore/resources/cloud/audit_logs.py +3 -3
- gcore/resources/cloud/baremetal/images.py +3 -4
- gcore/resources/cloud/baremetal/servers.py +16 -4
- gcore/resources/cloud/cloud.py +32 -0
- gcore/resources/cloud/cost_reports.py +24 -16
- gcore/resources/cloud/file_shares/access_rules.py +2 -2
- gcore/resources/cloud/file_shares/file_shares.py +30 -14
- gcore/resources/cloud/floating_ips.py +196 -4
- gcore/resources/cloud/gpu_baremetal_clusters/flavors.py +1 -1
- gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py +166 -190
- gcore/resources/cloud/gpu_baremetal_clusters/servers.py +268 -12
- gcore/resources/cloud/inference/__init__.py +14 -14
- gcore/resources/cloud/inference/applications/__init__.py +47 -0
- gcore/resources/cloud/inference/applications/applications.py +134 -0
- gcore/resources/cloud/inference/applications/deployments.py +649 -0
- gcore/resources/cloud/inference/applications/templates.py +238 -0
- gcore/resources/cloud/inference/deployments/deployments.py +41 -22
- gcore/resources/cloud/inference/inference.py +32 -32
- gcore/resources/cloud/inference/registry_credentials.py +8 -9
- gcore/resources/cloud/instances/images.py +4 -4
- gcore/resources/cloud/instances/instances.py +254 -4
- gcore/resources/cloud/instances/interfaces.py +544 -0
- gcore/resources/cloud/k8s/__init__.py +47 -0
- gcore/resources/cloud/k8s/clusters/__init__.py +47 -0
- gcore/resources/cloud/k8s/clusters/clusters.py +1391 -0
- gcore/resources/cloud/k8s/clusters/nodes.py +291 -0
- gcore/resources/cloud/k8s/clusters/pools/__init__.py +33 -0
- gcore/resources/cloud/k8s/clusters/pools/nodes.py +303 -0
- gcore/resources/cloud/k8s/clusters/pools/pools.py +870 -0
- gcore/resources/cloud/k8s/flavors.py +209 -0
- gcore/resources/cloud/k8s/k8s.py +233 -0
- gcore/resources/cloud/load_balancers/l7_policies/l7_policies.py +11 -12
- gcore/resources/cloud/load_balancers/l7_policies/rules.py +9 -10
- gcore/resources/cloud/load_balancers/listeners.py +18 -18
- gcore/resources/cloud/load_balancers/load_balancers.py +4 -4
- gcore/resources/cloud/load_balancers/pools/health_monitors.py +18 -6
- gcore/resources/cloud/load_balancers/pools/members.py +32 -2
- gcore/resources/cloud/load_balancers/pools/pools.py +32 -8
- gcore/resources/cloud/networks/networks.py +192 -4
- gcore/resources/cloud/networks/subnets.py +140 -8
- gcore/resources/cloud/reserved_fixed_ips/reserved_fixed_ips.py +608 -0
- gcore/resources/cloud/reserved_fixed_ips/vip.py +5 -7
- gcore/resources/cloud/security_groups/security_groups.py +6 -6
- gcore/resources/cloud/tasks.py +46 -46
- gcore/resources/cloud/users/role_assignments.py +5 -4
- gcore/resources/cloud/volumes.py +1125 -223
- gcore/resources/dns/__init__.py +75 -0
- gcore/resources/dns/dns.py +374 -0
- gcore/resources/dns/locations.py +288 -0
- gcore/resources/dns/metrics.py +214 -0
- gcore/resources/dns/pickers/__init__.py +33 -0
- gcore/resources/dns/pickers/pickers.py +167 -0
- gcore/resources/dns/pickers/presets.py +135 -0
- gcore/resources/dns/zones/__init__.py +47 -0
- gcore/resources/{cloud/inference/models.py → dns/zones/dnssec.py} +80 -122
- gcore/resources/dns/zones/rrsets.py +1005 -0
- gcore/resources/dns/zones/zones.py +1493 -0
- gcore/resources/storage/__init__.py +75 -0
- gcore/resources/storage/buckets/__init__.py +61 -0
- gcore/resources/storage/buckets/buckets.py +470 -0
- gcore/resources/storage/buckets/cors.py +265 -0
- gcore/resources/storage/buckets/lifecycle.py +276 -0
- gcore/resources/storage/buckets/policy.py +345 -0
- gcore/resources/storage/credentials.py +221 -0
- gcore/resources/storage/locations.py +190 -0
- gcore/resources/storage/statistics.py +364 -0
- gcore/resources/storage/storage.py +1046 -0
- gcore/resources/streaming/ai_tasks.py +56 -70
- gcore/resources/streaming/playlists.py +18 -18
- gcore/resources/streaming/quality_sets.py +8 -8
- gcore/resources/streaming/statistics.py +4 -122
- gcore/resources/streaming/streams/overlays.py +6 -6
- gcore/resources/streaming/streams/streams.py +40 -64
- gcore/resources/streaming/videos/subtitles.py +32 -30
- gcore/resources/streaming/videos/videos.py +78 -72
- gcore/resources/waap/domains/advanced_rules.py +2 -2
- gcore/resources/waap/domains/api_paths.py +13 -13
- gcore/resources/waap/domains/custom_rules.py +2 -2
- gcore/resources/waap/domains/domains.py +4 -4
- gcore/resources/waap/domains/firewall_rules.py +2 -2
- gcore/resources/waap/domains/insight_silences.py +6 -6
- gcore/resources/waap/domains/insights.py +7 -7
- gcore/resources/waap/domains/statistics.py +47 -47
- gcore/types/cloud/__init__.py +2 -4
- gcore/types/cloud/audit_log_list_params.py +2 -1
- gcore/types/cloud/baremetal/image_list_params.py +3 -2
- gcore/types/cloud/baremetal/server_create_params.py +8 -6
- gcore/types/cloud/baremetal/server_list_params.py +3 -2
- gcore/types/cloud/baremetal/server_rebuild_params.py +2 -0
- gcore/types/cloud/cost_report_get_aggregated_monthly_params.py +35 -31
- gcore/types/cloud/cost_report_get_aggregated_params.py +26 -25
- gcore/types/cloud/cost_report_get_detailed_params.py +26 -25
- gcore/types/cloud/ddos_profile.py +13 -7
- gcore/types/cloud/ddos_profile_field.py +21 -8
- gcore/types/cloud/ddos_profile_option_list.py +7 -6
- gcore/types/cloud/ddos_profile_status.py +2 -2
- gcore/types/cloud/ddos_profile_template.py +7 -3
- gcore/types/cloud/ddos_profile_template_field.py +12 -3
- gcore/types/cloud/file_share.py +2 -2
- gcore/types/cloud/file_share_create_params.py +12 -6
- gcore/types/cloud/floating_ip_list_params.py +3 -2
- gcore/types/cloud/gpu_baremetal_cluster.py +101 -74
- gcore/types/cloud/gpu_baremetal_cluster_create_params.py +76 -93
- gcore/types/cloud/gpu_baremetal_cluster_delete_params.py +17 -10
- gcore/types/cloud/gpu_baremetal_cluster_list_params.py +14 -3
- gcore/types/cloud/gpu_baremetal_cluster_rebuild_params.py +4 -2
- gcore/types/cloud/gpu_baremetal_clusters/__init__.py +6 -0
- gcore/types/cloud/gpu_baremetal_clusters/gpu_baremetal_cluster_server.py +74 -0
- gcore/types/cloud/{gpu_baremetal_cluster_server.py → gpu_baremetal_clusters/gpu_baremetal_cluster_server_v1.py} +10 -10
- gcore/types/cloud/gpu_baremetal_clusters/gpu_baremetal_cluster_server_v1_list.py +16 -0
- gcore/types/cloud/{gpu_baremetal_flavor.py → gpu_baremetal_clusters/gpu_baremetal_flavor.py} +1 -1
- gcore/types/cloud/{gpu_baremetal_flavor_list.py → gpu_baremetal_clusters/gpu_baremetal_flavor_list.py} +1 -1
- gcore/types/cloud/gpu_baremetal_clusters/server_list_params.py +75 -0
- gcore/types/cloud/inference/__init__.py +0 -5
- gcore/types/cloud/inference/applications/__init__.py +12 -0
- gcore/types/cloud/inference/applications/deployment_create_params.py +68 -0
- gcore/types/cloud/inference/applications/deployment_patch_params.py +62 -0
- gcore/types/cloud/inference/applications/inference_application_deployment.py +111 -0
- gcore/types/cloud/inference/applications/inference_application_deployment_list.py +16 -0
- gcore/types/cloud/inference/applications/inference_application_template.py +94 -0
- gcore/types/cloud/inference/applications/inference_application_template_list.py +16 -0
- gcore/types/cloud/inference/deployment_create_params.py +7 -6
- gcore/types/cloud/inference/deployment_update_params.py +7 -6
- gcore/types/cloud/instance_assign_security_group_params.py +4 -2
- gcore/types/cloud/instance_list_params.py +3 -2
- gcore/types/cloud/instance_unassign_security_group_params.py +4 -2
- gcore/types/cloud/instances/image_list_params.py +3 -2
- gcore/types/cloud/k8s/__init__.py +13 -0
- gcore/types/cloud/k8s/cluster_create_params.py +299 -0
- gcore/types/cloud/k8s/cluster_delete_params.py +16 -0
- gcore/types/cloud/k8s/cluster_update_params.py +203 -0
- gcore/types/cloud/k8s/cluster_upgrade_params.py +16 -0
- gcore/types/cloud/k8s/clusters/__init__.py +10 -0
- gcore/types/cloud/k8s/clusters/k8s_cluster_pool.py +66 -0
- gcore/types/cloud/k8s/clusters/k8s_cluster_pool_list.py +16 -0
- gcore/types/cloud/k8s/clusters/node_list_params.py +16 -0
- gcore/types/cloud/k8s/clusters/pool_create_params.py +53 -0
- gcore/types/cloud/k8s/clusters/pool_resize_params.py +18 -0
- gcore/types/cloud/k8s/clusters/pool_update_params.py +34 -0
- gcore/types/cloud/k8s/clusters/pools/__init__.py +5 -0
- gcore/types/cloud/k8s/clusters/pools/node_list_params.py +18 -0
- gcore/types/cloud/k8s/flavor_list_params.py +19 -0
- gcore/types/cloud/k8s/k8s_cluster.py +209 -0
- gcore/types/cloud/k8s/k8s_cluster_certificate.py +13 -0
- gcore/types/cloud/k8s/k8s_cluster_kubeconfig.py +19 -0
- gcore/types/cloud/k8s/k8s_cluster_list.py +16 -0
- gcore/types/cloud/k8s_cluster_version.py +10 -0
- gcore/types/cloud/{gpu_baremetal_cluster_server_list.py → k8s_cluster_version_list.py} +4 -4
- gcore/types/cloud/load_balancer_create_params.py +23 -4
- gcore/types/cloud/load_balancer_list_params.py +3 -2
- gcore/types/cloud/load_balancers/l7_policies/rule_create_params.py +3 -2
- gcore/types/cloud/load_balancers/l7_policies/rule_replace_params.py +3 -2
- gcore/types/cloud/load_balancers/l7_policy_create_params.py +3 -2
- gcore/types/cloud/load_balancers/l7_policy_replace_params.py +3 -2
- gcore/types/cloud/load_balancers/listener_create_params.py +4 -3
- gcore/types/cloud/load_balancers/listener_update_params.py +5 -3
- gcore/types/cloud/load_balancers/pool_create_params.py +19 -1
- gcore/types/cloud/load_balancers/pool_update_params.py +19 -1
- gcore/types/cloud/load_balancers/pools/member_add_params.py +19 -1
- gcore/types/cloud/member.py +19 -1
- gcore/types/cloud/network_list_params.py +3 -2
- gcore/types/cloud/networks/subnet_create_params.py +3 -2
- gcore/types/cloud/networks/subnet_list_params.py +3 -2
- gcore/types/cloud/networks/subnet_update_params.py +3 -2
- gcore/types/cloud/project.py +9 -9
- gcore/types/cloud/reserved_fixed_ips/vip_replace_connected_ports_params.py +3 -2
- gcore/types/cloud/reserved_fixed_ips/vip_update_connected_ports_params.py +3 -2
- gcore/types/cloud/security_group_create_params.py +4 -2
- gcore/types/cloud/security_group_list_params.py +3 -2
- gcore/types/cloud/task_id_list.py +8 -1
- gcore/types/cloud/task_list_params.py +23 -23
- gcore/types/cloud/usage_report_get_params.py +26 -25
- gcore/types/cloud/users/role_assignment.py +2 -1
- gcore/types/cloud/users/role_assignment_create_params.py +4 -2
- gcore/types/cloud/users/role_assignment_update_params.py +4 -2
- gcore/types/cloud/volume_list_params.py +3 -2
- gcore/types/dns/__init__.py +31 -0
- gcore/types/dns/dns_get_account_overview_response.py +21 -0
- gcore/types/dns/dns_label_name.py +13 -0
- gcore/types/dns/dns_location_translations.py +11 -0
- gcore/types/dns/dns_lookup_params.py +15 -0
- gcore/types/dns/dns_lookup_response.py +21 -0
- gcore/types/dns/dns_name_server.py +17 -0
- gcore/types/dns/location_list_continents_response.py +10 -0
- gcore/types/dns/location_list_countries_response.py +10 -0
- gcore/types/dns/location_list_regions_response.py +10 -0
- gcore/types/dns/location_list_response.py +16 -0
- gcore/types/dns/metric_list_params.py +24 -0
- gcore/types/dns/metric_list_response.py +7 -0
- gcore/types/dns/picker_list_response.py +10 -0
- gcore/types/dns/pickers/__init__.py +5 -0
- gcore/types/dns/pickers/preset_list_response.py +10 -0
- gcore/types/dns/zone_check_delegation_status_response.py +20 -0
- gcore/types/dns/zone_create_params.py +59 -0
- gcore/types/dns/zone_create_response.py +13 -0
- gcore/types/dns/zone_export_response.py +11 -0
- gcore/types/dns/zone_get_response.py +106 -0
- gcore/types/dns/zone_get_statistics_params.py +43 -0
- gcore/types/dns/zone_get_statistics_response.py +19 -0
- gcore/types/dns/zone_import_params.py +32 -0
- gcore/types/dns/zone_import_response.py +26 -0
- gcore/types/dns/zone_list_params.py +57 -0
- gcore/types/dns/zone_list_response.py +105 -0
- gcore/types/dns/zone_replace_params.py +61 -0
- gcore/types/dns/zones/__init__.py +15 -0
- gcore/types/dns/zones/dns_failover_log.py +19 -0
- gcore/types/dns/zones/dns_output_rrset.py +123 -0
- gcore/types/dns/zones/dnssec_get_response.py +38 -0
- gcore/types/dns/zones/dnssec_update_params.py +11 -0
- gcore/types/dns/zones/dnssec_update_response.py +38 -0
- gcore/types/dns/zones/rrset_create_params.py +82 -0
- gcore/types/dns/zones/rrset_get_failover_logs_params.py +21 -0
- gcore/types/dns/zones/rrset_get_failover_logs_response.py +15 -0
- gcore/types/dns/zones/rrset_list_params.py +21 -0
- gcore/types/dns/zones/rrset_list_response.py +14 -0
- gcore/types/dns/zones/rrset_replace_params.py +82 -0
- gcore/types/security/client_profile.py +1 -1
- gcore/types/security/profile_create_params.py +2 -2
- gcore/types/security/profile_recreate_params.py +2 -2
- gcore/types/security/profile_replace_params.py +2 -2
- gcore/types/storage/__init__.py +21 -0
- gcore/types/storage/bucket.py +15 -0
- gcore/types/storage/bucket_list_params.py +15 -0
- gcore/types/storage/buckets/__init__.py +9 -0
- gcore/types/storage/buckets/bucket_cors.py +18 -0
- gcore/types/storage/buckets/bucket_policy.py +7 -0
- gcore/types/storage/buckets/cor_create_params.py +17 -0
- gcore/types/storage/buckets/lifecycle_create_params.py +18 -0
- gcore/types/storage/buckets/policy_get_response.py +7 -0
- gcore/types/storage/credential_recreate_params.py +36 -0
- gcore/types/storage/location.py +24 -0
- gcore/types/storage/location_list_params.py +13 -0
- gcore/types/storage/statistic_get_usage_aggregated_params.py +24 -0
- gcore/types/storage/statistic_get_usage_series_params.py +38 -0
- gcore/types/storage/statistic_get_usage_series_response.py +12 -0
- gcore/types/storage/storage.py +101 -0
- gcore/types/storage/storage_create_params.py +44 -0
- gcore/types/storage/storage_list_params.py +39 -0
- gcore/types/storage/storage_restore_params.py +11 -0
- gcore/types/storage/storage_update_params.py +18 -0
- gcore/types/storage/usage_series.py +201 -0
- gcore/types/storage/usage_total.py +54 -0
- gcore/types/streaming/__init__.py +0 -4
- gcore/types/streaming/ai_contentmoderation_hardnudity.py +1 -1
- gcore/types/streaming/ai_contentmoderation_nsfw.py +1 -1
- gcore/types/streaming/ai_contentmoderation_softnudity.py +1 -1
- gcore/types/streaming/ai_contentmoderation_sport.py +1 -1
- gcore/types/streaming/ai_task.py +1 -5
- gcore/types/streaming/ai_task_create_params.py +2 -2
- gcore/types/streaming/ai_task_get_response.py +0 -46
- gcore/types/streaming/clip.py +2 -1
- gcore/types/streaming/create_video_param.py +13 -12
- gcore/types/streaming/max_stream_series.py +5 -5
- gcore/types/streaming/playlist.py +1 -1
- gcore/types/streaming/playlist_create_params.py +1 -1
- gcore/types/streaming/playlist_update_params.py +1 -1
- gcore/types/streaming/playlist_video.py +13 -12
- gcore/types/streaming/storage_series.py +5 -5
- gcore/types/streaming/stream.py +86 -49
- gcore/types/streaming/stream_create_clip_params.py +2 -1
- gcore/types/streaming/stream_create_params.py +9 -23
- gcore/types/streaming/stream_series.py +5 -5
- gcore/types/streaming/stream_update_params.py +9 -23
- gcore/types/streaming/video.py +53 -42
- gcore/types/streaming/video_update_params.py +13 -12
- gcore/types/streaming/vod_statistics_series.py +5 -5
- gcore/types/streaming/vod_total_stream_duration_series.py +3 -3
- gcore/types/waap/domain_list_params.py +1 -1
- gcore/types/waap/domain_update_params.py +1 -1
- gcore/types/waap/domains/advanced_rule_create_params.py +7 -4
- gcore/types/waap/domains/advanced_rule_update_params.py +6 -3
- gcore/types/waap/domains/api_path_create_params.py +4 -3
- gcore/types/waap/domains/api_path_list_params.py +3 -1
- gcore/types/waap/domains/api_path_update_params.py +5 -4
- gcore/types/waap/domains/custom_rule_create_params.py +13 -14
- gcore/types/waap/domains/custom_rule_update_params.py +12 -13
- gcore/types/waap/domains/firewall_rule_create_params.py +3 -2
- gcore/types/waap/domains/firewall_rule_update_params.py +2 -1
- gcore/types/waap/domains/insight_list_params.py +4 -2
- gcore/types/waap/domains/insight_replace_params.py +1 -1
- gcore/types/waap/domains/insight_silence_list_params.py +5 -3
- gcore/types/waap/domains/setting_update_params.py +3 -2
- gcore/types/waap/domains/statistic_get_ddos_info_params.py +6 -9
- gcore/types/waap/domains/statistic_get_events_aggregated_params.py +9 -10
- gcore/types/waap/domains/statistic_get_requests_series_params.py +8 -9
- gcore/types/waap/domains/statistic_get_traffic_series_params.py +6 -9
- gcore/types/waap/domains/waap_advanced_rule.py +3 -2
- gcore/types/waap/domains/waap_api_path.py +4 -4
- gcore/types/waap/domains/waap_api_scan_result.py +2 -2
- gcore/types/waap/domains/waap_custom_rule.py +4 -7
- gcore/types/waap/domains/waap_firewall_rule.py +3 -2
- gcore/types/waap/domains/waap_insight.py +1 -1
- gcore/types/waap/domains/waap_request_details.py +5 -4
- gcore/types/waap/waap_ip_ddos_info_model.py +3 -3
- gcore/types/waap/waap_rule_set.py +1 -1
- {gcore-0.10.0.dist-info → gcore-0.12.0.dist-info}/METADATA +7 -2
- {gcore-0.10.0.dist-info → gcore-0.12.0.dist-info}/RECORD +313 -193
- gcore/types/cloud/inference/inference_model.py +0 -65
- gcore/types/cloud/inference/inference_registry_credentials_create.py +0 -22
- gcore/types/cloud/inference/model_list_params.py +0 -21
- gcore/types/streaming/ai_contentmoderation_casm.py +0 -39
- gcore/types/streaming/ai_contentmoderation_weapon.py +0 -39
- gcore/types/streaming/meet_series.py +0 -23
- gcore/types/streaming/statistic_get_meet_series_params.py +0 -20
- {gcore-0.10.0.dist-info → gcore-0.12.0.dist-info}/WHEEL +0 -0
- {gcore-0.10.0.dist-info → gcore-0.12.0.dist-info}/licenses/LICENSE +0 -0
gcore/resources/cloud/volumes.py
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
-
from typing import
|
|
5
|
+
from typing import Iterable, Optional
|
|
6
6
|
from typing_extensions import Literal, overload
|
|
7
7
|
|
|
8
8
|
import httpx
|
|
9
9
|
|
|
10
|
-
from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven
|
|
10
|
+
from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven, SequenceNotStr
|
|
11
11
|
from ..._utils import required_args, maybe_transform, async_maybe_transform
|
|
12
12
|
from ..._compat import cached_property
|
|
13
13
|
from ..._resource import SyncAPIResource, AsyncAPIResource
|
|
@@ -403,7 +403,7 @@ class VolumesResource(SyncAPIResource):
|
|
|
403
403
|
limit: int | NotGiven = NOT_GIVEN,
|
|
404
404
|
name_part: str | NotGiven = NOT_GIVEN,
|
|
405
405
|
offset: int | NotGiven = NOT_GIVEN,
|
|
406
|
-
tag_key:
|
|
406
|
+
tag_key: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
|
|
407
407
|
tag_key_value: str | NotGiven = NOT_GIVEN,
|
|
408
408
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
409
409
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
@@ -844,29 +844,8 @@ class VolumesResource(SyncAPIResource):
|
|
|
844
844
|
cast_to=NoneType,
|
|
845
845
|
)
|
|
846
846
|
|
|
847
|
-
|
|
848
|
-
class AsyncVolumesResource(AsyncAPIResource):
|
|
849
|
-
@cached_property
|
|
850
|
-
def with_raw_response(self) -> AsyncVolumesResourceWithRawResponse:
|
|
851
|
-
"""
|
|
852
|
-
This property can be used as a prefix for any HTTP method call to return
|
|
853
|
-
the raw response object instead of the parsed content.
|
|
854
|
-
|
|
855
|
-
For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers
|
|
856
|
-
"""
|
|
857
|
-
return AsyncVolumesResourceWithRawResponse(self)
|
|
858
|
-
|
|
859
|
-
@cached_property
|
|
860
|
-
def with_streaming_response(self) -> AsyncVolumesResourceWithStreamingResponse:
|
|
861
|
-
"""
|
|
862
|
-
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
863
|
-
|
|
864
|
-
For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response
|
|
865
|
-
"""
|
|
866
|
-
return AsyncVolumesResourceWithStreamingResponse(self)
|
|
867
|
-
|
|
868
847
|
@overload
|
|
869
|
-
|
|
848
|
+
def create_and_poll(
|
|
870
849
|
self,
|
|
871
850
|
*,
|
|
872
851
|
project_id: int | None = None,
|
|
@@ -881,14 +860,15 @@ class AsyncVolumesResource(AsyncAPIResource):
|
|
|
881
860
|
tags: TagUpdateMapParam | NotGiven = NOT_GIVEN,
|
|
882
861
|
type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"]
|
|
883
862
|
| NotGiven = NOT_GIVEN,
|
|
863
|
+
polling_interval_seconds: int | NotGiven = NOT_GIVEN,
|
|
864
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
884
865
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
885
866
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
886
867
|
extra_headers: Headers | None = None,
|
|
887
868
|
extra_query: Query | None = None,
|
|
888
869
|
extra_body: Body | None = None,
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
"""Create a new volume in the project and region.
|
|
870
|
+
) -> Volume:
|
|
871
|
+
"""Create a new volume in the project and region and poll for the result. Only the first task will be polled. If you need to poll more tasks, use the `tasks.poll` method.
|
|
892
872
|
|
|
893
873
|
The volume can be created from
|
|
894
874
|
scratch, from an image, or from a snapshot. Optionally attach the volume to an
|
|
@@ -935,7 +915,7 @@ class AsyncVolumesResource(AsyncAPIResource):
|
|
|
935
915
|
...
|
|
936
916
|
|
|
937
917
|
@overload
|
|
938
|
-
|
|
918
|
+
def create_and_poll(
|
|
939
919
|
self,
|
|
940
920
|
*,
|
|
941
921
|
project_id: int | None = None,
|
|
@@ -950,14 +930,15 @@ class AsyncVolumesResource(AsyncAPIResource):
|
|
|
950
930
|
tags: TagUpdateMapParam | NotGiven = NOT_GIVEN,
|
|
951
931
|
type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"]
|
|
952
932
|
| NotGiven = NOT_GIVEN,
|
|
933
|
+
polling_interval_seconds: int | NotGiven = NOT_GIVEN,
|
|
934
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
953
935
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
954
936
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
955
937
|
extra_headers: Headers | None = None,
|
|
956
938
|
extra_query: Query | None = None,
|
|
957
939
|
extra_body: Body | None = None,
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
"""Create a new volume in the project and region.
|
|
940
|
+
) -> Volume:
|
|
941
|
+
"""Create a new volume in the project and region and poll for the result. Only the first task will be polled. If you need to poll more tasks, use the `tasks.poll` method.
|
|
961
942
|
|
|
962
943
|
The volume can be created from
|
|
963
944
|
scratch, from an image, or from a snapshot. Optionally attach the volume to an
|
|
@@ -1005,7 +986,7 @@ class AsyncVolumesResource(AsyncAPIResource):
|
|
|
1005
986
|
...
|
|
1006
987
|
|
|
1007
988
|
@overload
|
|
1008
|
-
|
|
989
|
+
def create_and_poll(
|
|
1009
990
|
self,
|
|
1010
991
|
*,
|
|
1011
992
|
project_id: int | None = None,
|
|
@@ -1019,14 +1000,15 @@ class AsyncVolumesResource(AsyncAPIResource):
|
|
|
1019
1000
|
tags: TagUpdateMapParam | NotGiven = NOT_GIVEN,
|
|
1020
1001
|
type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"]
|
|
1021
1002
|
| NotGiven = NOT_GIVEN,
|
|
1003
|
+
polling_interval_seconds: int | NotGiven = NOT_GIVEN,
|
|
1004
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
1022
1005
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
1023
1006
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
1024
1007
|
extra_headers: Headers | None = None,
|
|
1025
1008
|
extra_query: Query | None = None,
|
|
1026
1009
|
extra_body: Body | None = None,
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
"""Create a new volume in the project and region.
|
|
1010
|
+
) -> Volume:
|
|
1011
|
+
"""Create a new volume in the project and region and poll for the result. Only the first task will be polled. If you need to poll more tasks, use the `tasks.poll` method.
|
|
1030
1012
|
|
|
1031
1013
|
The volume can be created from
|
|
1032
1014
|
scratch, from an image, or from a snapshot. Optionally attach the volume to an
|
|
@@ -1073,7 +1055,7 @@ class AsyncVolumesResource(AsyncAPIResource):
|
|
|
1073
1055
|
@required_args(
|
|
1074
1056
|
["image_id", "name", "size", "source"], ["name", "snapshot_id", "source"], ["name", "size", "source"]
|
|
1075
1057
|
)
|
|
1076
|
-
|
|
1058
|
+
def create_and_poll(
|
|
1077
1059
|
self,
|
|
1078
1060
|
*,
|
|
1079
1061
|
project_id: int | None = None,
|
|
@@ -1089,170 +1071,279 @@ class AsyncVolumesResource(AsyncAPIResource):
|
|
|
1089
1071
|
type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"]
|
|
1090
1072
|
| NotGiven = NOT_GIVEN,
|
|
1091
1073
|
snapshot_id: str | NotGiven = NOT_GIVEN,
|
|
1074
|
+
polling_interval_seconds: int | NotGiven = NOT_GIVEN,
|
|
1075
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
1092
1076
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
1093
1077
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
1094
1078
|
extra_headers: Headers | None = None,
|
|
1095
1079
|
extra_query: Query | None = None,
|
|
1096
1080
|
extra_body: Body | None = None,
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
project_id
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1081
|
+
) -> Volume:
|
|
1082
|
+
"""Create a new volume in the project and region and poll for the result. Only the first task will be polled. If you need to poll more tasks, use the `tasks.poll` method."""
|
|
1083
|
+
response: TaskIDList = self.create( # type: ignore
|
|
1084
|
+
project_id=project_id,
|
|
1085
|
+
region_id=region_id,
|
|
1086
|
+
image_id=image_id,
|
|
1087
|
+
name=name,
|
|
1088
|
+
size=size,
|
|
1089
|
+
source=source,
|
|
1090
|
+
attachment_tag=attachment_tag,
|
|
1091
|
+
instance_id_to_attach_to=instance_id_to_attach_to,
|
|
1092
|
+
lifecycle_policy_ids=lifecycle_policy_ids,
|
|
1093
|
+
tags=tags,
|
|
1094
|
+
type_name=type_name,
|
|
1095
|
+
snapshot_id=snapshot_id,
|
|
1096
|
+
extra_headers=extra_headers,
|
|
1097
|
+
extra_query=extra_query,
|
|
1098
|
+
extra_body=extra_body,
|
|
1099
|
+
timeout=timeout,
|
|
1100
|
+
)
|
|
1101
|
+
if not response.tasks: # type: ignore
|
|
1102
|
+
raise ValueError("Expected at least one task to be created")
|
|
1103
|
+
task = self._client.cloud.tasks.poll(
|
|
1104
|
+
task_id=response.tasks[0], # type: ignore
|
|
1105
|
+
extra_headers=extra_headers,
|
|
1106
|
+
polling_interval_seconds=polling_interval_seconds,
|
|
1107
|
+
)
|
|
1108
|
+
if task.created_resources is None or task.created_resources.volumes is None or len(task.created_resources.volumes) != 1:
|
|
1109
|
+
raise ValueError("Task completed but created_resources or volumes is missing or invalid")
|
|
1110
|
+
created_volume_id = task.created_resources.volumes[0]
|
|
1111
|
+
return self.get(
|
|
1112
|
+
volume_id=created_volume_id,
|
|
1113
|
+
project_id=project_id,
|
|
1114
|
+
region_id=region_id,
|
|
1115
|
+
extra_headers=extra_headers,
|
|
1116
|
+
extra_query=extra_query,
|
|
1117
|
+
extra_body=extra_body,
|
|
1118
|
+
timeout=timeout,
|
|
1124
1119
|
)
|
|
1125
1120
|
|
|
1126
|
-
|
|
1121
|
+
def delete_and_poll(
|
|
1127
1122
|
self,
|
|
1128
1123
|
volume_id: str,
|
|
1129
1124
|
*,
|
|
1130
1125
|
project_id: int | None = None,
|
|
1131
1126
|
region_id: int | None = None,
|
|
1132
|
-
|
|
1133
|
-
|
|
1127
|
+
snapshots: str | NotGiven = NOT_GIVEN,
|
|
1128
|
+
polling_interval_seconds: int | NotGiven = NOT_GIVEN,
|
|
1129
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
1134
1130
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
1135
1131
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
1136
1132
|
extra_headers: Headers | None = None,
|
|
1137
1133
|
extra_query: Query | None = None,
|
|
1138
1134
|
extra_body: Body | None = None,
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1135
|
+
) -> None:
|
|
1136
|
+
"""Delete a volume and all its snapshots and poll for the result. Only the first task will be polled. If you need to poll more tasks, use the `tasks.poll` method."""
|
|
1137
|
+
response = self.delete(
|
|
1138
|
+
volume_id=volume_id,
|
|
1139
|
+
project_id=project_id,
|
|
1140
|
+
region_id=region_id,
|
|
1141
|
+
snapshots=snapshots,
|
|
1142
|
+
extra_headers=extra_headers,
|
|
1143
|
+
extra_query=extra_query,
|
|
1144
|
+
extra_body=extra_body,
|
|
1145
|
+
timeout=timeout,
|
|
1146
|
+
)
|
|
1147
|
+
if not response.tasks:
|
|
1148
|
+
raise ValueError("Expected at least one task to be created")
|
|
1149
|
+
self._client.cloud.tasks.poll(
|
|
1150
|
+
task_id=response.tasks[0],
|
|
1151
|
+
extra_headers=extra_headers,
|
|
1152
|
+
polling_interval_seconds=polling_interval_seconds,
|
|
1153
|
+
)
|
|
1148
1154
|
|
|
1149
|
-
|
|
1155
|
+
def attach_to_instance_and_poll(
|
|
1156
|
+
self,
|
|
1157
|
+
volume_id: str,
|
|
1158
|
+
*,
|
|
1159
|
+
project_id: int | None = None,
|
|
1160
|
+
region_id: int | None = None,
|
|
1161
|
+
instance_id: str,
|
|
1162
|
+
attachment_tag: str | NotGiven = NOT_GIVEN,
|
|
1163
|
+
polling_interval_seconds: int | NotGiven = NOT_GIVEN,
|
|
1164
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
1165
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
1166
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
1167
|
+
extra_headers: Headers | None = None,
|
|
1168
|
+
extra_query: Query | None = None,
|
|
1169
|
+
extra_body: Body | None = None,
|
|
1170
|
+
) -> None:
|
|
1171
|
+
"""Attach the volume to 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."""
|
|
1172
|
+
response = self.attach_to_instance(
|
|
1173
|
+
volume_id=volume_id,
|
|
1174
|
+
project_id=project_id,
|
|
1175
|
+
region_id=region_id,
|
|
1176
|
+
instance_id=instance_id,
|
|
1177
|
+
attachment_tag=attachment_tag,
|
|
1178
|
+
extra_headers=extra_headers,
|
|
1179
|
+
extra_query=extra_query,
|
|
1180
|
+
extra_body=extra_body,
|
|
1181
|
+
timeout=timeout,
|
|
1182
|
+
)
|
|
1183
|
+
if not response.tasks:
|
|
1184
|
+
raise ValueError("Expected at least one task to be created")
|
|
1185
|
+
self._client.cloud.tasks.poll(
|
|
1186
|
+
task_id=response.tasks[0],
|
|
1187
|
+
extra_headers=extra_headers,
|
|
1188
|
+
polling_interval_seconds=polling_interval_seconds,
|
|
1189
|
+
)
|
|
1150
1190
|
|
|
1151
|
-
|
|
1191
|
+
def detach_from_instance_and_poll(
|
|
1192
|
+
self,
|
|
1193
|
+
volume_id: str,
|
|
1194
|
+
*,
|
|
1195
|
+
project_id: int | None = None,
|
|
1196
|
+
region_id: int | None = None,
|
|
1197
|
+
instance_id: str,
|
|
1198
|
+
polling_interval_seconds: int | NotGiven = NOT_GIVEN,
|
|
1199
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
1200
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
1201
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
1202
|
+
extra_headers: Headers | None = None,
|
|
1203
|
+
extra_query: Query | None = None,
|
|
1204
|
+
extra_body: Body | None = None,
|
|
1205
|
+
) -> None:
|
|
1206
|
+
"""Detach the volume from 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."""
|
|
1207
|
+
response = self.detach_from_instance(
|
|
1208
|
+
volume_id=volume_id,
|
|
1209
|
+
project_id=project_id,
|
|
1210
|
+
region_id=region_id,
|
|
1211
|
+
instance_id=instance_id,
|
|
1212
|
+
extra_headers=extra_headers,
|
|
1213
|
+
extra_query=extra_query,
|
|
1214
|
+
extra_body=extra_body,
|
|
1215
|
+
timeout=timeout,
|
|
1216
|
+
)
|
|
1217
|
+
if not response.tasks:
|
|
1218
|
+
raise ValueError("Expected at least one task to be created")
|
|
1219
|
+
self._client.cloud.tasks.poll(
|
|
1220
|
+
task_id=response.tasks[0],
|
|
1221
|
+
extra_headers=extra_headers,
|
|
1222
|
+
polling_interval_seconds=polling_interval_seconds,
|
|
1223
|
+
)
|
|
1152
1224
|
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1225
|
+
def resize_and_poll(
|
|
1226
|
+
self,
|
|
1227
|
+
volume_id: str,
|
|
1228
|
+
*,
|
|
1229
|
+
project_id: int | None = None,
|
|
1230
|
+
region_id: int | None = None,
|
|
1231
|
+
size: int,
|
|
1232
|
+
polling_interval_seconds: int | NotGiven = NOT_GIVEN,
|
|
1233
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
1234
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
1235
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
1236
|
+
extra_headers: Headers | None = None,
|
|
1237
|
+
extra_query: Query | None = None,
|
|
1238
|
+
extra_body: Body | None = None,
|
|
1239
|
+
) -> Volume:
|
|
1240
|
+
"""Increase the size of a volume and poll for the result. Only the first task will be polled. If you need to poll more tasks, use the `tasks.poll` method."""
|
|
1241
|
+
response = self.resize(
|
|
1242
|
+
volume_id=volume_id,
|
|
1243
|
+
project_id=project_id,
|
|
1244
|
+
region_id=region_id,
|
|
1245
|
+
size=size,
|
|
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
|
+
volume_id=volume_id,
|
|
1260
|
+
project_id=project_id,
|
|
1261
|
+
region_id=region_id,
|
|
1262
|
+
extra_headers=extra_headers,
|
|
1263
|
+
extra_query=extra_query,
|
|
1264
|
+
extra_body=extra_body,
|
|
1265
|
+
timeout=timeout,
|
|
1266
|
+
)
|
|
1157
1267
|
|
|
1158
|
-
- **Add/update tags:**
|
|
1159
|
-
`{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or
|
|
1160
|
-
updates existing ones.
|
|
1161
|
-
- **Delete tags:** `{'tags': {'`old_tag`': null}}` removes specific tags.
|
|
1162
|
-
- **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only
|
|
1163
|
-
tags are preserved).
|
|
1164
|
-
- **Partial update:** `{'tags': {'environment': 'staging'}}` only updates
|
|
1165
|
-
specified tags.
|
|
1166
|
-
- **Mixed operations:**
|
|
1167
|
-
`{'tags': {'environment': 'production', '`cost_center`': 'engineering', '`deprecated_tag`': null}}`
|
|
1168
|
-
adds/updates 'environment' and '`cost_center`' while removing
|
|
1169
|
-
'`deprecated_tag`', preserving other existing tags.
|
|
1170
|
-
- **Replace all:** first delete existing tags with null values, then add new
|
|
1171
|
-
ones in the same request.
|
|
1172
1268
|
|
|
1173
|
-
|
|
1269
|
+
class AsyncVolumesResource(AsyncAPIResource):
|
|
1270
|
+
@cached_property
|
|
1271
|
+
def with_raw_response(self) -> AsyncVolumesResourceWithRawResponse:
|
|
1272
|
+
"""
|
|
1273
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
1274
|
+
the raw response object instead of the parsed content.
|
|
1174
1275
|
|
|
1175
|
-
|
|
1276
|
+
For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers
|
|
1277
|
+
"""
|
|
1278
|
+
return AsyncVolumesResourceWithRawResponse(self)
|
|
1176
1279
|
|
|
1177
|
-
|
|
1280
|
+
@cached_property
|
|
1281
|
+
def with_streaming_response(self) -> AsyncVolumesResourceWithStreamingResponse:
|
|
1282
|
+
"""
|
|
1283
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
1178
1284
|
|
|
1179
|
-
|
|
1285
|
+
For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response
|
|
1180
1286
|
"""
|
|
1181
|
-
|
|
1182
|
-
project_id = self._client._get_cloud_project_id_path_param()
|
|
1183
|
-
if region_id is None:
|
|
1184
|
-
region_id = self._client._get_cloud_region_id_path_param()
|
|
1185
|
-
if not volume_id:
|
|
1186
|
-
raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}")
|
|
1187
|
-
return await self._patch(
|
|
1188
|
-
f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}",
|
|
1189
|
-
body=await async_maybe_transform(
|
|
1190
|
-
{
|
|
1191
|
-
"name": name,
|
|
1192
|
-
"tags": tags,
|
|
1193
|
-
},
|
|
1194
|
-
volume_update_params.VolumeUpdateParams,
|
|
1195
|
-
),
|
|
1196
|
-
options=make_request_options(
|
|
1197
|
-
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
1198
|
-
),
|
|
1199
|
-
cast_to=Volume,
|
|
1200
|
-
)
|
|
1287
|
+
return AsyncVolumesResourceWithStreamingResponse(self)
|
|
1201
1288
|
|
|
1202
|
-
|
|
1289
|
+
@overload
|
|
1290
|
+
async def create(
|
|
1203
1291
|
self,
|
|
1204
1292
|
*,
|
|
1205
1293
|
project_id: int | None = None,
|
|
1206
1294
|
region_id: int | None = None,
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1295
|
+
image_id: str,
|
|
1296
|
+
name: str,
|
|
1297
|
+
size: int,
|
|
1298
|
+
source: Literal["image"],
|
|
1299
|
+
attachment_tag: str | NotGiven = NOT_GIVEN,
|
|
1300
|
+
instance_id_to_attach_to: str | NotGiven = NOT_GIVEN,
|
|
1301
|
+
lifecycle_policy_ids: Iterable[int] | NotGiven = NOT_GIVEN,
|
|
1302
|
+
tags: TagUpdateMapParam | NotGiven = NOT_GIVEN,
|
|
1303
|
+
type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"]
|
|
1304
|
+
| NotGiven = NOT_GIVEN,
|
|
1217
1305
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
1218
1306
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
1219
1307
|
extra_headers: Headers | None = None,
|
|
1220
1308
|
extra_query: Query | None = None,
|
|
1221
1309
|
extra_body: Body | None = None,
|
|
1222
1310
|
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
1223
|
-
) ->
|
|
1224
|
-
"""
|
|
1311
|
+
) -> TaskIDList:
|
|
1312
|
+
"""Create a new volume in the project and region.
|
|
1225
1313
|
|
|
1226
|
-
The
|
|
1227
|
-
|
|
1228
|
-
|
|
1314
|
+
The volume can be created from
|
|
1315
|
+
scratch, from an image, or from a snapshot. Optionally attach the volume to an
|
|
1316
|
+
instance during creation.
|
|
1229
1317
|
|
|
1230
1318
|
Args:
|
|
1231
1319
|
project_id: Project ID
|
|
1232
1320
|
|
|
1233
1321
|
region_id: Region ID
|
|
1234
1322
|
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
cluster_id: Filter volumes by k8s cluster ID
|
|
1323
|
+
image_id: Image ID
|
|
1238
1324
|
|
|
1239
|
-
|
|
1325
|
+
name: Volume name
|
|
1240
1326
|
|
|
1241
|
-
|
|
1327
|
+
size: Volume size in GiB
|
|
1242
1328
|
|
|
1243
|
-
|
|
1329
|
+
source: Volume source type
|
|
1244
1330
|
|
|
1245
|
-
|
|
1331
|
+
attachment_tag: Block device attachment tag (not exposed in the user tags). Only used in
|
|
1332
|
+
conjunction with `instance_id_to_attach_to`
|
|
1246
1333
|
|
|
1247
|
-
|
|
1248
|
-
and volumes will be returned with names containing the substring.
|
|
1334
|
+
instance_id_to_attach_to: `instance_id` to attach newly-created volume to
|
|
1249
1335
|
|
|
1250
|
-
|
|
1251
|
-
|
|
1336
|
+
lifecycle_policy_ids: List of lifecycle policy IDs (snapshot creation schedules) to associate with the
|
|
1337
|
+
volume
|
|
1252
1338
|
|
|
1253
|
-
|
|
1339
|
+
tags: Key-value tags to associate with the resource. A tag is a key-value pair that
|
|
1340
|
+
can be associated with a resource, enabling efficient filtering and grouping for
|
|
1341
|
+
better organization and management. Some tags are read-only and cannot be
|
|
1342
|
+
modified by the user. Tags are also integrated with cost reports, allowing cost
|
|
1343
|
+
data to be filtered based on tag keys or values.
|
|
1254
1344
|
|
|
1255
|
-
|
|
1345
|
+
type_name: Volume type. Defaults to `standard`. If not specified for source `snapshot`,
|
|
1346
|
+
volume type will be derived from the snapshot volume.
|
|
1256
1347
|
|
|
1257
1348
|
extra_headers: Send extra headers
|
|
1258
1349
|
|
|
@@ -1262,7 +1353,337 @@ class AsyncVolumesResource(AsyncAPIResource):
|
|
|
1262
1353
|
|
|
1263
1354
|
timeout: Override the client-level default timeout for this request, in seconds
|
|
1264
1355
|
"""
|
|
1265
|
-
|
|
1356
|
+
...
|
|
1357
|
+
|
|
1358
|
+
@overload
|
|
1359
|
+
async def create(
|
|
1360
|
+
self,
|
|
1361
|
+
*,
|
|
1362
|
+
project_id: int | None = None,
|
|
1363
|
+
region_id: int | None = None,
|
|
1364
|
+
name: str,
|
|
1365
|
+
snapshot_id: str,
|
|
1366
|
+
source: Literal["snapshot"],
|
|
1367
|
+
attachment_tag: str | NotGiven = NOT_GIVEN,
|
|
1368
|
+
instance_id_to_attach_to: str | NotGiven = NOT_GIVEN,
|
|
1369
|
+
lifecycle_policy_ids: Iterable[int] | NotGiven = NOT_GIVEN,
|
|
1370
|
+
size: int | NotGiven = NOT_GIVEN,
|
|
1371
|
+
tags: TagUpdateMapParam | NotGiven = NOT_GIVEN,
|
|
1372
|
+
type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"]
|
|
1373
|
+
| NotGiven = NOT_GIVEN,
|
|
1374
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
1375
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
1376
|
+
extra_headers: Headers | None = None,
|
|
1377
|
+
extra_query: Query | None = None,
|
|
1378
|
+
extra_body: Body | None = None,
|
|
1379
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
1380
|
+
) -> TaskIDList:
|
|
1381
|
+
"""Create a new volume in the project and region.
|
|
1382
|
+
|
|
1383
|
+
The volume can be created from
|
|
1384
|
+
scratch, from an image, or from a snapshot. Optionally attach the volume to an
|
|
1385
|
+
instance during creation.
|
|
1386
|
+
|
|
1387
|
+
Args:
|
|
1388
|
+
project_id: Project ID
|
|
1389
|
+
|
|
1390
|
+
region_id: Region ID
|
|
1391
|
+
|
|
1392
|
+
name: Volume name
|
|
1393
|
+
|
|
1394
|
+
snapshot_id: Snapshot ID
|
|
1395
|
+
|
|
1396
|
+
source: Volume source type
|
|
1397
|
+
|
|
1398
|
+
attachment_tag: Block device attachment tag (not exposed in the user tags). Only used in
|
|
1399
|
+
conjunction with `instance_id_to_attach_to`
|
|
1400
|
+
|
|
1401
|
+
instance_id_to_attach_to: `instance_id` to attach newly-created volume to
|
|
1402
|
+
|
|
1403
|
+
lifecycle_policy_ids: List of lifecycle policy IDs (snapshot creation schedules) to associate with the
|
|
1404
|
+
volume
|
|
1405
|
+
|
|
1406
|
+
size: Volume size in GiB. If specified, value must be equal to respective snapshot
|
|
1407
|
+
size
|
|
1408
|
+
|
|
1409
|
+
tags: Key-value tags to associate with the resource. A tag is a key-value pair that
|
|
1410
|
+
can be associated with a resource, enabling efficient filtering and grouping for
|
|
1411
|
+
better organization and management. Some tags are read-only and cannot be
|
|
1412
|
+
modified by the user. Tags are also integrated with cost reports, allowing cost
|
|
1413
|
+
data to be filtered based on tag keys or values.
|
|
1414
|
+
|
|
1415
|
+
type_name: Volume type. Defaults to `standard`. If not specified for source `snapshot`,
|
|
1416
|
+
volume type will be derived from the snapshot volume.
|
|
1417
|
+
|
|
1418
|
+
extra_headers: Send extra headers
|
|
1419
|
+
|
|
1420
|
+
extra_query: Add additional query parameters to the request
|
|
1421
|
+
|
|
1422
|
+
extra_body: Add additional JSON properties to the request
|
|
1423
|
+
|
|
1424
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
1425
|
+
"""
|
|
1426
|
+
...
|
|
1427
|
+
|
|
1428
|
+
@overload
|
|
1429
|
+
async def create(
|
|
1430
|
+
self,
|
|
1431
|
+
*,
|
|
1432
|
+
project_id: int | None = None,
|
|
1433
|
+
region_id: int | None = None,
|
|
1434
|
+
name: str,
|
|
1435
|
+
size: int,
|
|
1436
|
+
source: Literal["new-volume"],
|
|
1437
|
+
attachment_tag: str | NotGiven = NOT_GIVEN,
|
|
1438
|
+
instance_id_to_attach_to: str | NotGiven = NOT_GIVEN,
|
|
1439
|
+
lifecycle_policy_ids: Iterable[int] | NotGiven = NOT_GIVEN,
|
|
1440
|
+
tags: TagUpdateMapParam | NotGiven = NOT_GIVEN,
|
|
1441
|
+
type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"]
|
|
1442
|
+
| NotGiven = NOT_GIVEN,
|
|
1443
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
1444
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
1445
|
+
extra_headers: Headers | None = None,
|
|
1446
|
+
extra_query: Query | None = None,
|
|
1447
|
+
extra_body: Body | None = None,
|
|
1448
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
1449
|
+
) -> TaskIDList:
|
|
1450
|
+
"""Create a new volume in the project and region.
|
|
1451
|
+
|
|
1452
|
+
The volume can be created from
|
|
1453
|
+
scratch, from an image, or from a snapshot. Optionally attach the volume to an
|
|
1454
|
+
instance during creation.
|
|
1455
|
+
|
|
1456
|
+
Args:
|
|
1457
|
+
project_id: Project ID
|
|
1458
|
+
|
|
1459
|
+
region_id: Region ID
|
|
1460
|
+
|
|
1461
|
+
name: Volume name
|
|
1462
|
+
|
|
1463
|
+
size: Volume size in GiB
|
|
1464
|
+
|
|
1465
|
+
source: Volume source type
|
|
1466
|
+
|
|
1467
|
+
attachment_tag: Block device attachment tag (not exposed in the user tags). Only used in
|
|
1468
|
+
conjunction with `instance_id_to_attach_to`
|
|
1469
|
+
|
|
1470
|
+
instance_id_to_attach_to: `instance_id` to attach newly-created volume to
|
|
1471
|
+
|
|
1472
|
+
lifecycle_policy_ids: List of lifecycle policy IDs (snapshot creation schedules) to associate with the
|
|
1473
|
+
volume
|
|
1474
|
+
|
|
1475
|
+
tags: Key-value tags to associate with the resource. A tag is a key-value pair that
|
|
1476
|
+
can be associated with a resource, enabling efficient filtering and grouping for
|
|
1477
|
+
better organization and management. Some tags are read-only and cannot be
|
|
1478
|
+
modified by the user. Tags are also integrated with cost reports, allowing cost
|
|
1479
|
+
data to be filtered based on tag keys or values.
|
|
1480
|
+
|
|
1481
|
+
type_name: Volume type. Defaults to `standard`. If not specified for source `snapshot`,
|
|
1482
|
+
volume type will be derived from the snapshot volume.
|
|
1483
|
+
|
|
1484
|
+
extra_headers: Send extra headers
|
|
1485
|
+
|
|
1486
|
+
extra_query: Add additional query parameters to the request
|
|
1487
|
+
|
|
1488
|
+
extra_body: Add additional JSON properties to the request
|
|
1489
|
+
|
|
1490
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
1491
|
+
"""
|
|
1492
|
+
...
|
|
1493
|
+
|
|
1494
|
+
@required_args(
|
|
1495
|
+
["image_id", "name", "size", "source"], ["name", "snapshot_id", "source"], ["name", "size", "source"]
|
|
1496
|
+
)
|
|
1497
|
+
async def create(
|
|
1498
|
+
self,
|
|
1499
|
+
*,
|
|
1500
|
+
project_id: int | None = None,
|
|
1501
|
+
region_id: int | None = None,
|
|
1502
|
+
image_id: str | NotGiven = NOT_GIVEN,
|
|
1503
|
+
name: str,
|
|
1504
|
+
size: int | NotGiven = NOT_GIVEN,
|
|
1505
|
+
source: Literal["image"] | Literal["snapshot"] | Literal["new-volume"],
|
|
1506
|
+
attachment_tag: str | NotGiven = NOT_GIVEN,
|
|
1507
|
+
instance_id_to_attach_to: str | NotGiven = NOT_GIVEN,
|
|
1508
|
+
lifecycle_policy_ids: Iterable[int] | NotGiven = NOT_GIVEN,
|
|
1509
|
+
tags: TagUpdateMapParam | NotGiven = NOT_GIVEN,
|
|
1510
|
+
type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"]
|
|
1511
|
+
| NotGiven = NOT_GIVEN,
|
|
1512
|
+
snapshot_id: str | NotGiven = NOT_GIVEN,
|
|
1513
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
1514
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
1515
|
+
extra_headers: Headers | None = None,
|
|
1516
|
+
extra_query: Query | None = None,
|
|
1517
|
+
extra_body: Body | None = None,
|
|
1518
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
1519
|
+
) -> TaskIDList:
|
|
1520
|
+
if project_id is None:
|
|
1521
|
+
project_id = self._client._get_cloud_project_id_path_param()
|
|
1522
|
+
if region_id is None:
|
|
1523
|
+
region_id = self._client._get_cloud_region_id_path_param()
|
|
1524
|
+
return await self._post(
|
|
1525
|
+
f"/cloud/v1/volumes/{project_id}/{region_id}",
|
|
1526
|
+
body=await async_maybe_transform(
|
|
1527
|
+
{
|
|
1528
|
+
"image_id": image_id,
|
|
1529
|
+
"name": name,
|
|
1530
|
+
"size": size,
|
|
1531
|
+
"source": source,
|
|
1532
|
+
"attachment_tag": attachment_tag,
|
|
1533
|
+
"instance_id_to_attach_to": instance_id_to_attach_to,
|
|
1534
|
+
"lifecycle_policy_ids": lifecycle_policy_ids,
|
|
1535
|
+
"tags": tags,
|
|
1536
|
+
"type_name": type_name,
|
|
1537
|
+
"snapshot_id": snapshot_id,
|
|
1538
|
+
},
|
|
1539
|
+
volume_create_params.VolumeCreateParams,
|
|
1540
|
+
),
|
|
1541
|
+
options=make_request_options(
|
|
1542
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
1543
|
+
),
|
|
1544
|
+
cast_to=TaskIDList,
|
|
1545
|
+
)
|
|
1546
|
+
|
|
1547
|
+
async def update(
|
|
1548
|
+
self,
|
|
1549
|
+
volume_id: str,
|
|
1550
|
+
*,
|
|
1551
|
+
project_id: int | None = None,
|
|
1552
|
+
region_id: int | None = None,
|
|
1553
|
+
name: str | NotGiven = NOT_GIVEN,
|
|
1554
|
+
tags: Optional[TagUpdateMapParam] | NotGiven = NOT_GIVEN,
|
|
1555
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
1556
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
1557
|
+
extra_headers: Headers | None = None,
|
|
1558
|
+
extra_query: Query | None = None,
|
|
1559
|
+
extra_body: Body | None = None,
|
|
1560
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
1561
|
+
) -> Volume:
|
|
1562
|
+
"""
|
|
1563
|
+
Rename a volume or update tags
|
|
1564
|
+
|
|
1565
|
+
Args:
|
|
1566
|
+
project_id: Project ID
|
|
1567
|
+
|
|
1568
|
+
region_id: Region ID
|
|
1569
|
+
|
|
1570
|
+
volume_id: Volume ID
|
|
1571
|
+
|
|
1572
|
+
name: Name
|
|
1573
|
+
|
|
1574
|
+
tags: Update key-value tags using JSON Merge Patch semantics (RFC 7386). Provide
|
|
1575
|
+
key-value pairs to add or update tags. Set tag values to `null` to remove tags.
|
|
1576
|
+
Unspecified tags remain unchanged. Read-only tags are always preserved and
|
|
1577
|
+
cannot be modified. **Examples:**
|
|
1578
|
+
|
|
1579
|
+
- **Add/update tags:**
|
|
1580
|
+
`{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or
|
|
1581
|
+
updates existing ones.
|
|
1582
|
+
- **Delete tags:** `{'tags': {'`old_tag`': null}}` removes specific tags.
|
|
1583
|
+
- **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only
|
|
1584
|
+
tags are preserved).
|
|
1585
|
+
- **Partial update:** `{'tags': {'environment': 'staging'}}` only updates
|
|
1586
|
+
specified tags.
|
|
1587
|
+
- **Mixed operations:**
|
|
1588
|
+
`{'tags': {'environment': 'production', '`cost_center`': 'engineering', '`deprecated_tag`': null}}`
|
|
1589
|
+
adds/updates 'environment' and '`cost_center`' while removing
|
|
1590
|
+
'`deprecated_tag`', preserving other existing tags.
|
|
1591
|
+
- **Replace all:** first delete existing tags with null values, then add new
|
|
1592
|
+
ones in the same request.
|
|
1593
|
+
|
|
1594
|
+
extra_headers: Send extra headers
|
|
1595
|
+
|
|
1596
|
+
extra_query: Add additional query parameters to the request
|
|
1597
|
+
|
|
1598
|
+
extra_body: Add additional JSON properties to the request
|
|
1599
|
+
|
|
1600
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
1601
|
+
"""
|
|
1602
|
+
if project_id is None:
|
|
1603
|
+
project_id = self._client._get_cloud_project_id_path_param()
|
|
1604
|
+
if region_id is None:
|
|
1605
|
+
region_id = self._client._get_cloud_region_id_path_param()
|
|
1606
|
+
if not volume_id:
|
|
1607
|
+
raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}")
|
|
1608
|
+
return await self._patch(
|
|
1609
|
+
f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}",
|
|
1610
|
+
body=await async_maybe_transform(
|
|
1611
|
+
{
|
|
1612
|
+
"name": name,
|
|
1613
|
+
"tags": tags,
|
|
1614
|
+
},
|
|
1615
|
+
volume_update_params.VolumeUpdateParams,
|
|
1616
|
+
),
|
|
1617
|
+
options=make_request_options(
|
|
1618
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
1619
|
+
),
|
|
1620
|
+
cast_to=Volume,
|
|
1621
|
+
)
|
|
1622
|
+
|
|
1623
|
+
def list(
|
|
1624
|
+
self,
|
|
1625
|
+
*,
|
|
1626
|
+
project_id: int | None = None,
|
|
1627
|
+
region_id: int | None = None,
|
|
1628
|
+
bootable: bool | NotGiven = NOT_GIVEN,
|
|
1629
|
+
cluster_id: str | NotGiven = NOT_GIVEN,
|
|
1630
|
+
has_attachments: bool | NotGiven = NOT_GIVEN,
|
|
1631
|
+
id_part: str | NotGiven = NOT_GIVEN,
|
|
1632
|
+
instance_id: str | NotGiven = NOT_GIVEN,
|
|
1633
|
+
limit: int | NotGiven = NOT_GIVEN,
|
|
1634
|
+
name_part: str | NotGiven = NOT_GIVEN,
|
|
1635
|
+
offset: int | NotGiven = NOT_GIVEN,
|
|
1636
|
+
tag_key: SequenceNotStr[str] | NotGiven = NOT_GIVEN,
|
|
1637
|
+
tag_key_value: str | NotGiven = NOT_GIVEN,
|
|
1638
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
1639
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
1640
|
+
extra_headers: Headers | None = None,
|
|
1641
|
+
extra_query: Query | None = None,
|
|
1642
|
+
extra_body: Body | None = None,
|
|
1643
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
1644
|
+
) -> AsyncPaginator[Volume, AsyncOffsetPage[Volume]]:
|
|
1645
|
+
"""Retrieve a list of volumes in the project and region.
|
|
1646
|
+
|
|
1647
|
+
The list can be filtered
|
|
1648
|
+
by various parameters like bootable status, metadata/tags, attachments, instance
|
|
1649
|
+
ID, name, and ID.
|
|
1650
|
+
|
|
1651
|
+
Args:
|
|
1652
|
+
project_id: Project ID
|
|
1653
|
+
|
|
1654
|
+
region_id: Region ID
|
|
1655
|
+
|
|
1656
|
+
bootable: Filter by bootable field
|
|
1657
|
+
|
|
1658
|
+
cluster_id: Filter volumes by k8s cluster ID
|
|
1659
|
+
|
|
1660
|
+
has_attachments: Filter by the presence of attachments
|
|
1661
|
+
|
|
1662
|
+
id_part: Filter the volume list result by the ID part of the volume
|
|
1663
|
+
|
|
1664
|
+
instance_id: Filter volumes by instance ID
|
|
1665
|
+
|
|
1666
|
+
limit: Optional. Limit the number of returned items
|
|
1667
|
+
|
|
1668
|
+
name_part: Filter volumes by `name_part` inclusion in volume name.Any substring can be used
|
|
1669
|
+
and volumes will be returned with names containing the substring.
|
|
1670
|
+
|
|
1671
|
+
offset: Optional. Offset value is used to exclude the first set of records from the
|
|
1672
|
+
result
|
|
1673
|
+
|
|
1674
|
+
tag_key: Optional. Filter by tag keys. ?`tag_key`=key1&`tag_key`=key2
|
|
1675
|
+
|
|
1676
|
+
tag_key_value: Optional. Filter by tag key-value pairs.
|
|
1677
|
+
|
|
1678
|
+
extra_headers: Send extra headers
|
|
1679
|
+
|
|
1680
|
+
extra_query: Add additional query parameters to the request
|
|
1681
|
+
|
|
1682
|
+
extra_body: Add additional JSON properties to the request
|
|
1683
|
+
|
|
1684
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
1685
|
+
"""
|
|
1686
|
+
if project_id is None:
|
|
1266
1687
|
project_id = self._client._get_cloud_project_id_path_param()
|
|
1267
1688
|
if region_id is None:
|
|
1268
1689
|
region_id = self._client._get_cloud_region_id_path_param()
|
|
@@ -1511,28 +1932,280 @@ class AsyncVolumesResource(AsyncAPIResource):
|
|
|
1511
1932
|
cast_to=TaskIDList,
|
|
1512
1933
|
)
|
|
1513
1934
|
|
|
1514
|
-
async def get(
|
|
1935
|
+
async def get(
|
|
1936
|
+
self,
|
|
1937
|
+
volume_id: str,
|
|
1938
|
+
*,
|
|
1939
|
+
project_id: int | None = None,
|
|
1940
|
+
region_id: int | None = None,
|
|
1941
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
1942
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
1943
|
+
extra_headers: Headers | None = None,
|
|
1944
|
+
extra_query: Query | None = None,
|
|
1945
|
+
extra_body: Body | None = None,
|
|
1946
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
1947
|
+
) -> Volume:
|
|
1948
|
+
"""
|
|
1949
|
+
Retrieve detailed information about a specific volume.
|
|
1950
|
+
|
|
1951
|
+
Args:
|
|
1952
|
+
project_id: Project ID
|
|
1953
|
+
|
|
1954
|
+
region_id: Region ID
|
|
1955
|
+
|
|
1956
|
+
volume_id: Volume ID
|
|
1957
|
+
|
|
1958
|
+
extra_headers: Send extra headers
|
|
1959
|
+
|
|
1960
|
+
extra_query: Add additional query parameters to the request
|
|
1961
|
+
|
|
1962
|
+
extra_body: Add additional JSON properties to the request
|
|
1963
|
+
|
|
1964
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
1965
|
+
"""
|
|
1966
|
+
if project_id is None:
|
|
1967
|
+
project_id = self._client._get_cloud_project_id_path_param()
|
|
1968
|
+
if region_id is None:
|
|
1969
|
+
region_id = self._client._get_cloud_region_id_path_param()
|
|
1970
|
+
if not volume_id:
|
|
1971
|
+
raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}")
|
|
1972
|
+
return await self._get(
|
|
1973
|
+
f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}",
|
|
1974
|
+
options=make_request_options(
|
|
1975
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
1976
|
+
),
|
|
1977
|
+
cast_to=Volume,
|
|
1978
|
+
)
|
|
1979
|
+
|
|
1980
|
+
async def resize(
|
|
1981
|
+
self,
|
|
1982
|
+
volume_id: str,
|
|
1983
|
+
*,
|
|
1984
|
+
project_id: int | None = None,
|
|
1985
|
+
region_id: int | None = None,
|
|
1986
|
+
size: int,
|
|
1987
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
1988
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
1989
|
+
extra_headers: Headers | None = None,
|
|
1990
|
+
extra_query: Query | None = None,
|
|
1991
|
+
extra_body: Body | None = None,
|
|
1992
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
1993
|
+
) -> TaskIDList:
|
|
1994
|
+
"""Increase the size of a volume.
|
|
1995
|
+
|
|
1996
|
+
The new size must be greater than the current
|
|
1997
|
+
size.
|
|
1998
|
+
|
|
1999
|
+
Args:
|
|
2000
|
+
project_id: Project ID
|
|
2001
|
+
|
|
2002
|
+
region_id: Region ID
|
|
2003
|
+
|
|
2004
|
+
volume_id: Volume ID
|
|
2005
|
+
|
|
2006
|
+
size: New volume size in GiB
|
|
2007
|
+
|
|
2008
|
+
extra_headers: Send extra headers
|
|
2009
|
+
|
|
2010
|
+
extra_query: Add additional query parameters to the request
|
|
2011
|
+
|
|
2012
|
+
extra_body: Add additional JSON properties to the request
|
|
2013
|
+
|
|
2014
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
2015
|
+
"""
|
|
2016
|
+
if project_id is None:
|
|
2017
|
+
project_id = self._client._get_cloud_project_id_path_param()
|
|
2018
|
+
if region_id is None:
|
|
2019
|
+
region_id = self._client._get_cloud_region_id_path_param()
|
|
2020
|
+
if not volume_id:
|
|
2021
|
+
raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}")
|
|
2022
|
+
return await self._post(
|
|
2023
|
+
f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/extend",
|
|
2024
|
+
body=await async_maybe_transform({"size": size}, volume_resize_params.VolumeResizeParams),
|
|
2025
|
+
options=make_request_options(
|
|
2026
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
2027
|
+
),
|
|
2028
|
+
cast_to=TaskIDList,
|
|
2029
|
+
)
|
|
2030
|
+
|
|
2031
|
+
async def revert_to_last_snapshot(
|
|
2032
|
+
self,
|
|
2033
|
+
volume_id: str,
|
|
2034
|
+
*,
|
|
2035
|
+
project_id: int | None = None,
|
|
2036
|
+
region_id: int | None = None,
|
|
2037
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
2038
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
2039
|
+
extra_headers: Headers | None = None,
|
|
2040
|
+
extra_query: Query | None = None,
|
|
2041
|
+
extra_body: Body | None = None,
|
|
2042
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
2043
|
+
) -> None:
|
|
2044
|
+
"""Revert a volume to its last snapshot.
|
|
2045
|
+
|
|
2046
|
+
The volume must be in an available state
|
|
2047
|
+
to be reverted.
|
|
2048
|
+
|
|
2049
|
+
Args:
|
|
2050
|
+
project_id: Project ID
|
|
2051
|
+
|
|
2052
|
+
region_id: Region ID
|
|
2053
|
+
|
|
2054
|
+
volume_id: Volume ID
|
|
2055
|
+
|
|
2056
|
+
extra_headers: Send extra headers
|
|
2057
|
+
|
|
2058
|
+
extra_query: Add additional query parameters to the request
|
|
2059
|
+
|
|
2060
|
+
extra_body: Add additional JSON properties to the request
|
|
2061
|
+
|
|
2062
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
2063
|
+
"""
|
|
2064
|
+
if project_id is None:
|
|
2065
|
+
project_id = self._client._get_cloud_project_id_path_param()
|
|
2066
|
+
if region_id is None:
|
|
2067
|
+
region_id = self._client._get_cloud_region_id_path_param()
|
|
2068
|
+
if not volume_id:
|
|
2069
|
+
raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}")
|
|
2070
|
+
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
|
|
2071
|
+
return await self._post(
|
|
2072
|
+
f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/revert",
|
|
2073
|
+
options=make_request_options(
|
|
2074
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
2075
|
+
),
|
|
2076
|
+
cast_to=NoneType,
|
|
2077
|
+
)
|
|
2078
|
+
|
|
2079
|
+
@overload
|
|
2080
|
+
async def create_and_poll(
|
|
2081
|
+
self,
|
|
2082
|
+
*,
|
|
2083
|
+
project_id: int | None = None,
|
|
2084
|
+
region_id: int | None = None,
|
|
2085
|
+
image_id: str,
|
|
2086
|
+
name: str,
|
|
2087
|
+
size: int,
|
|
2088
|
+
source: Literal["image"],
|
|
2089
|
+
attachment_tag: str | NotGiven = NOT_GIVEN,
|
|
2090
|
+
instance_id_to_attach_to: str | NotGiven = NOT_GIVEN,
|
|
2091
|
+
lifecycle_policy_ids: Iterable[int] | NotGiven = NOT_GIVEN,
|
|
2092
|
+
tags: TagUpdateMapParam | NotGiven = NOT_GIVEN,
|
|
2093
|
+
type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"]
|
|
2094
|
+
| NotGiven = NOT_GIVEN,
|
|
2095
|
+
polling_interval_seconds: int | NotGiven = NOT_GIVEN,
|
|
2096
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
2097
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
2098
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
2099
|
+
extra_headers: Headers | None = None,
|
|
2100
|
+
extra_query: Query | None = None,
|
|
2101
|
+
extra_body: Body | None = None,
|
|
2102
|
+
) -> Volume:
|
|
2103
|
+
"""Create a new volume in the project and region and poll for the result. Only the first task will be polled. If you need to poll more tasks, use the `tasks.poll` method.
|
|
2104
|
+
|
|
2105
|
+
The volume can be created from
|
|
2106
|
+
scratch, from an image, or from a snapshot. Optionally attach the volume to an
|
|
2107
|
+
instance during creation.
|
|
2108
|
+
|
|
2109
|
+
Args:
|
|
2110
|
+
project_id: Project ID
|
|
2111
|
+
|
|
2112
|
+
region_id: Region ID
|
|
2113
|
+
|
|
2114
|
+
image_id: Image ID
|
|
2115
|
+
|
|
2116
|
+
name: Volume name
|
|
2117
|
+
|
|
2118
|
+
size: Volume size in GiB
|
|
2119
|
+
|
|
2120
|
+
source: Volume source type
|
|
2121
|
+
|
|
2122
|
+
attachment_tag: Block device attachment tag (not exposed in the user tags). Only used in
|
|
2123
|
+
conjunction with `instance_id_to_attach_to`
|
|
2124
|
+
|
|
2125
|
+
instance_id_to_attach_to: `instance_id` to attach newly-created volume to
|
|
2126
|
+
|
|
2127
|
+
lifecycle_policy_ids: List of lifecycle policy IDs (snapshot creation schedules) to associate with the
|
|
2128
|
+
volume
|
|
2129
|
+
|
|
2130
|
+
tags: Key-value tags to associate with the resource. A tag is a key-value pair that
|
|
2131
|
+
can be associated with a resource, enabling efficient filtering and grouping for
|
|
2132
|
+
better organization and management. Some tags are read-only and cannot be
|
|
2133
|
+
modified by the user. Tags are also integrated with cost reports, allowing cost
|
|
2134
|
+
data to be filtered based on tag keys or values.
|
|
2135
|
+
|
|
2136
|
+
type_name: Volume type. Defaults to `standard`. If not specified for source `snapshot`,
|
|
2137
|
+
volume type will be derived from the snapshot volume.
|
|
2138
|
+
|
|
2139
|
+
extra_headers: Send extra headers
|
|
2140
|
+
|
|
2141
|
+
extra_query: Add additional query parameters to the request
|
|
2142
|
+
|
|
2143
|
+
extra_body: Add additional JSON properties to the request
|
|
2144
|
+
|
|
2145
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
2146
|
+
"""
|
|
2147
|
+
...
|
|
2148
|
+
|
|
2149
|
+
@overload
|
|
2150
|
+
async def create_and_poll(
|
|
1515
2151
|
self,
|
|
1516
|
-
volume_id: str,
|
|
1517
2152
|
*,
|
|
1518
2153
|
project_id: int | None = None,
|
|
1519
2154
|
region_id: int | None = None,
|
|
2155
|
+
name: str,
|
|
2156
|
+
snapshot_id: str,
|
|
2157
|
+
source: Literal["snapshot"],
|
|
2158
|
+
attachment_tag: str | NotGiven = NOT_GIVEN,
|
|
2159
|
+
instance_id_to_attach_to: str | NotGiven = NOT_GIVEN,
|
|
2160
|
+
lifecycle_policy_ids: Iterable[int] | NotGiven = NOT_GIVEN,
|
|
2161
|
+
size: int | NotGiven = NOT_GIVEN,
|
|
2162
|
+
tags: TagUpdateMapParam | NotGiven = NOT_GIVEN,
|
|
2163
|
+
type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"]
|
|
2164
|
+
| NotGiven = NOT_GIVEN,
|
|
2165
|
+
polling_interval_seconds: int | NotGiven = NOT_GIVEN,
|
|
2166
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
1520
2167
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
1521
2168
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
1522
2169
|
extra_headers: Headers | None = None,
|
|
1523
2170
|
extra_query: Query | None = None,
|
|
1524
2171
|
extra_body: Body | None = None,
|
|
1525
|
-
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
1526
2172
|
) -> Volume:
|
|
1527
|
-
"""
|
|
1528
|
-
|
|
2173
|
+
"""Create a new volume in the project and region and poll for the result. Only the first task will be polled. If you need to poll more tasks, use the `tasks.poll` method.
|
|
2174
|
+
|
|
2175
|
+
The volume can be created from
|
|
2176
|
+
scratch, from an image, or from a snapshot. Optionally attach the volume to an
|
|
2177
|
+
instance during creation.
|
|
1529
2178
|
|
|
1530
2179
|
Args:
|
|
1531
2180
|
project_id: Project ID
|
|
1532
2181
|
|
|
1533
2182
|
region_id: Region ID
|
|
1534
2183
|
|
|
1535
|
-
|
|
2184
|
+
name: Volume name
|
|
2185
|
+
|
|
2186
|
+
snapshot_id: Snapshot ID
|
|
2187
|
+
|
|
2188
|
+
source: Volume source type
|
|
2189
|
+
|
|
2190
|
+
attachment_tag: Block device attachment tag (not exposed in the user tags). Only used in
|
|
2191
|
+
conjunction with `instance_id_to_attach_to`
|
|
2192
|
+
|
|
2193
|
+
instance_id_to_attach_to: `instance_id` to attach newly-created volume to
|
|
2194
|
+
|
|
2195
|
+
lifecycle_policy_ids: List of lifecycle policy IDs (snapshot creation schedules) to associate with the
|
|
2196
|
+
volume
|
|
2197
|
+
|
|
2198
|
+
size: Volume size in GiB. If specified, value must be equal to respective snapshot
|
|
2199
|
+
size
|
|
2200
|
+
|
|
2201
|
+
tags: Key-value tags to associate with the resource. A tag is a key-value pair that
|
|
2202
|
+
can be associated with a resource, enabling efficient filtering and grouping for
|
|
2203
|
+
better organization and management. Some tags are read-only and cannot be
|
|
2204
|
+
modified by the user. Tags are also integrated with cost reports, allowing cost
|
|
2205
|
+
data to be filtered based on tag keys or values.
|
|
2206
|
+
|
|
2207
|
+
type_name: Volume type. Defaults to `standard`. If not specified for source `snapshot`,
|
|
2208
|
+
volume type will be derived from the snapshot volume.
|
|
1536
2209
|
|
|
1537
2210
|
extra_headers: Send extra headers
|
|
1538
2211
|
|
|
@@ -1542,47 +2215,64 @@ class AsyncVolumesResource(AsyncAPIResource):
|
|
|
1542
2215
|
|
|
1543
2216
|
timeout: Override the client-level default timeout for this request, in seconds
|
|
1544
2217
|
"""
|
|
1545
|
-
|
|
1546
|
-
project_id = self._client._get_cloud_project_id_path_param()
|
|
1547
|
-
if region_id is None:
|
|
1548
|
-
region_id = self._client._get_cloud_region_id_path_param()
|
|
1549
|
-
if not volume_id:
|
|
1550
|
-
raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}")
|
|
1551
|
-
return await self._get(
|
|
1552
|
-
f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}",
|
|
1553
|
-
options=make_request_options(
|
|
1554
|
-
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
1555
|
-
),
|
|
1556
|
-
cast_to=Volume,
|
|
1557
|
-
)
|
|
2218
|
+
...
|
|
1558
2219
|
|
|
1559
|
-
|
|
2220
|
+
@overload
|
|
2221
|
+
async def create_and_poll(
|
|
1560
2222
|
self,
|
|
1561
|
-
volume_id: str,
|
|
1562
2223
|
*,
|
|
1563
2224
|
project_id: int | None = None,
|
|
1564
2225
|
region_id: int | None = None,
|
|
2226
|
+
name: str,
|
|
1565
2227
|
size: int,
|
|
2228
|
+
source: Literal["new-volume"],
|
|
2229
|
+
attachment_tag: str | NotGiven = NOT_GIVEN,
|
|
2230
|
+
instance_id_to_attach_to: str | NotGiven = NOT_GIVEN,
|
|
2231
|
+
lifecycle_policy_ids: Iterable[int] | NotGiven = NOT_GIVEN,
|
|
2232
|
+
tags: TagUpdateMapParam | NotGiven = NOT_GIVEN,
|
|
2233
|
+
type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"]
|
|
2234
|
+
| NotGiven = NOT_GIVEN,
|
|
2235
|
+
polling_interval_seconds: int | NotGiven = NOT_GIVEN,
|
|
2236
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
1566
2237
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
1567
2238
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
1568
2239
|
extra_headers: Headers | None = None,
|
|
1569
2240
|
extra_query: Query | None = None,
|
|
1570
2241
|
extra_body: Body | None = None,
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
"""Increase the size of a volume.
|
|
2242
|
+
) -> Volume:
|
|
2243
|
+
"""Create a new volume in the project and region and poll for the result. Only the first task will be polled. If you need to poll more tasks, use the `tasks.poll` method.
|
|
1574
2244
|
|
|
1575
|
-
The
|
|
1576
|
-
|
|
2245
|
+
The volume can be created from
|
|
2246
|
+
scratch, from an image, or from a snapshot. Optionally attach the volume to an
|
|
2247
|
+
instance during creation.
|
|
1577
2248
|
|
|
1578
2249
|
Args:
|
|
1579
2250
|
project_id: Project ID
|
|
1580
2251
|
|
|
1581
2252
|
region_id: Region ID
|
|
1582
2253
|
|
|
1583
|
-
|
|
2254
|
+
name: Volume name
|
|
1584
2255
|
|
|
1585
|
-
size:
|
|
2256
|
+
size: Volume size in GiB
|
|
2257
|
+
|
|
2258
|
+
source: Volume source type
|
|
2259
|
+
|
|
2260
|
+
attachment_tag: Block device attachment tag (not exposed in the user tags). Only used in
|
|
2261
|
+
conjunction with `instance_id_to_attach_to`
|
|
2262
|
+
|
|
2263
|
+
instance_id_to_attach_to: `instance_id` to attach newly-created volume to
|
|
2264
|
+
|
|
2265
|
+
lifecycle_policy_ids: List of lifecycle policy IDs (snapshot creation schedules) to associate with the
|
|
2266
|
+
volume
|
|
2267
|
+
|
|
2268
|
+
tags: Key-value tags to associate with the resource. A tag is a key-value pair that
|
|
2269
|
+
can be associated with a resource, enabling efficient filtering and grouping for
|
|
2270
|
+
better organization and management. Some tags are read-only and cannot be
|
|
2271
|
+
modified by the user. Tags are also integrated with cost reports, allowing cost
|
|
2272
|
+
data to be filtered based on tag keys or values.
|
|
2273
|
+
|
|
2274
|
+
type_name: Volume type. Defaults to `standard`. If not specified for source `snapshot`,
|
|
2275
|
+
volume type will be derived from the snapshot volume.
|
|
1586
2276
|
|
|
1587
2277
|
extra_headers: Send extra headers
|
|
1588
2278
|
|
|
@@ -1592,67 +2282,219 @@ class AsyncVolumesResource(AsyncAPIResource):
|
|
|
1592
2282
|
|
|
1593
2283
|
timeout: Override the client-level default timeout for this request, in seconds
|
|
1594
2284
|
"""
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
2285
|
+
...
|
|
2286
|
+
|
|
2287
|
+
@required_args(
|
|
2288
|
+
["image_id", "name", "size", "source"], ["name", "snapshot_id", "source"], ["name", "size", "source"]
|
|
2289
|
+
)
|
|
2290
|
+
async def create_and_poll(
|
|
2291
|
+
self,
|
|
2292
|
+
*,
|
|
2293
|
+
project_id: int | None = None,
|
|
2294
|
+
region_id: int | None = None,
|
|
2295
|
+
image_id: str | NotGiven = NOT_GIVEN,
|
|
2296
|
+
name: str,
|
|
2297
|
+
size: int | NotGiven = NOT_GIVEN,
|
|
2298
|
+
source: Literal["image"] | Literal["snapshot"] | Literal["new-volume"],
|
|
2299
|
+
attachment_tag: str | NotGiven = NOT_GIVEN,
|
|
2300
|
+
instance_id_to_attach_to: str | NotGiven = NOT_GIVEN,
|
|
2301
|
+
lifecycle_policy_ids: Iterable[int] | NotGiven = NOT_GIVEN,
|
|
2302
|
+
tags: TagUpdateMapParam | NotGiven = NOT_GIVEN,
|
|
2303
|
+
type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"]
|
|
2304
|
+
| NotGiven = NOT_GIVEN,
|
|
2305
|
+
snapshot_id: str | NotGiven = NOT_GIVEN,
|
|
2306
|
+
polling_interval_seconds: int | NotGiven = NOT_GIVEN,
|
|
2307
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
2308
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
2309
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
2310
|
+
extra_headers: Headers | None = None,
|
|
2311
|
+
extra_query: Query | None = None,
|
|
2312
|
+
extra_body: Body | None = None,
|
|
2313
|
+
) -> Volume:
|
|
2314
|
+
"""Create a new volume in the project and region and poll for the result. Only the first task will be polled. If you need to poll more tasks, use the `tasks.poll` method."""
|
|
2315
|
+
response: TaskIDList = await self.create( # type: ignore
|
|
2316
|
+
project_id=project_id,
|
|
2317
|
+
region_id=region_id,
|
|
2318
|
+
image_id=image_id,
|
|
2319
|
+
name=name,
|
|
2320
|
+
size=size,
|
|
2321
|
+
source=source,
|
|
2322
|
+
attachment_tag=attachment_tag,
|
|
2323
|
+
instance_id_to_attach_to=instance_id_to_attach_to,
|
|
2324
|
+
lifecycle_policy_ids=lifecycle_policy_ids,
|
|
2325
|
+
tags=tags,
|
|
2326
|
+
type_name=type_name,
|
|
2327
|
+
snapshot_id=snapshot_id,
|
|
2328
|
+
extra_headers=extra_headers,
|
|
2329
|
+
extra_query=extra_query,
|
|
2330
|
+
extra_body=extra_body,
|
|
2331
|
+
timeout=timeout,
|
|
2332
|
+
)
|
|
2333
|
+
if not response.tasks: # type: ignore
|
|
2334
|
+
raise ValueError("Expected at least one task to be created")
|
|
2335
|
+
task = await self._client.cloud.tasks.poll(
|
|
2336
|
+
task_id=response.tasks[0], # type: ignore
|
|
2337
|
+
extra_headers=extra_headers,
|
|
2338
|
+
polling_interval_seconds=polling_interval_seconds,
|
|
2339
|
+
)
|
|
2340
|
+
if task.created_resources is None or task.created_resources.volumes is None or len(task.created_resources.volumes) != 1:
|
|
2341
|
+
raise ValueError("Task completed but created_resources or volumes is missing or invalid")
|
|
2342
|
+
created_volume_id = task.created_resources.volumes[0]
|
|
2343
|
+
return await self.get(
|
|
2344
|
+
volume_id=created_volume_id,
|
|
2345
|
+
project_id=project_id,
|
|
2346
|
+
region_id=region_id,
|
|
2347
|
+
extra_headers=extra_headers,
|
|
2348
|
+
extra_query=extra_query,
|
|
2349
|
+
extra_body=extra_body,
|
|
2350
|
+
timeout=timeout,
|
|
1608
2351
|
)
|
|
1609
2352
|
|
|
1610
|
-
async def
|
|
2353
|
+
async def delete_and_poll(
|
|
1611
2354
|
self,
|
|
1612
2355
|
volume_id: str,
|
|
1613
2356
|
*,
|
|
1614
2357
|
project_id: int | None = None,
|
|
1615
2358
|
region_id: int | None = None,
|
|
2359
|
+
snapshots: str | NotGiven = NOT_GIVEN,
|
|
2360
|
+
polling_interval_seconds: int | NotGiven = NOT_GIVEN,
|
|
2361
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
1616
2362
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
1617
2363
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
1618
2364
|
extra_headers: Headers | None = None,
|
|
1619
2365
|
extra_query: Query | None = None,
|
|
1620
2366
|
extra_body: Body | None = None,
|
|
1621
|
-
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
1622
2367
|
) -> None:
|
|
1623
|
-
"""
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
2368
|
+
"""Delete a volume and all its snapshots and poll for the result. Only the first task will be polled. If you need to poll more tasks, use the `tasks.poll` method."""
|
|
2369
|
+
response = await self.delete(
|
|
2370
|
+
volume_id=volume_id,
|
|
2371
|
+
project_id=project_id,
|
|
2372
|
+
region_id=region_id,
|
|
2373
|
+
snapshots=snapshots,
|
|
2374
|
+
extra_headers=extra_headers,
|
|
2375
|
+
extra_query=extra_query,
|
|
2376
|
+
extra_body=extra_body,
|
|
2377
|
+
timeout=timeout,
|
|
2378
|
+
)
|
|
2379
|
+
if not response.tasks:
|
|
2380
|
+
raise ValueError("Expected at least one task to be created")
|
|
2381
|
+
await self._client.cloud.tasks.poll(
|
|
2382
|
+
task_id=response.tasks[0],
|
|
2383
|
+
extra_headers=extra_headers,
|
|
2384
|
+
polling_interval_seconds=polling_interval_seconds,
|
|
2385
|
+
)
|
|
1636
2386
|
|
|
1637
|
-
|
|
2387
|
+
async def attach_to_instance_and_poll(
|
|
2388
|
+
self,
|
|
2389
|
+
volume_id: str,
|
|
2390
|
+
*,
|
|
2391
|
+
project_id: int | None = None,
|
|
2392
|
+
region_id: int | None = None,
|
|
2393
|
+
instance_id: str,
|
|
2394
|
+
attachment_tag: str | NotGiven = NOT_GIVEN,
|
|
2395
|
+
polling_interval_seconds: int | NotGiven = NOT_GIVEN,
|
|
2396
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
2397
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
2398
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
2399
|
+
extra_headers: Headers | None = None,
|
|
2400
|
+
extra_query: Query | None = None,
|
|
2401
|
+
extra_body: Body | None = None,
|
|
2402
|
+
) -> None:
|
|
2403
|
+
"""Attach the volume to 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."""
|
|
2404
|
+
response = await self.attach_to_instance(
|
|
2405
|
+
volume_id=volume_id,
|
|
2406
|
+
project_id=project_id,
|
|
2407
|
+
region_id=region_id,
|
|
2408
|
+
instance_id=instance_id,
|
|
2409
|
+
attachment_tag=attachment_tag,
|
|
2410
|
+
extra_headers=extra_headers,
|
|
2411
|
+
extra_query=extra_query,
|
|
2412
|
+
extra_body=extra_body,
|
|
2413
|
+
timeout=timeout,
|
|
2414
|
+
)
|
|
2415
|
+
if not response.tasks:
|
|
2416
|
+
raise ValueError("Expected at least one task to be created")
|
|
2417
|
+
await self._client.cloud.tasks.poll(
|
|
2418
|
+
task_id=response.tasks[0],
|
|
2419
|
+
extra_headers=extra_headers,
|
|
2420
|
+
polling_interval_seconds=polling_interval_seconds,
|
|
2421
|
+
)
|
|
1638
2422
|
|
|
1639
|
-
|
|
2423
|
+
async def detach_from_instance_and_poll(
|
|
2424
|
+
self,
|
|
2425
|
+
volume_id: str,
|
|
2426
|
+
*,
|
|
2427
|
+
project_id: int | None = None,
|
|
2428
|
+
region_id: int | None = None,
|
|
2429
|
+
instance_id: str,
|
|
2430
|
+
polling_interval_seconds: int | NotGiven = NOT_GIVEN,
|
|
2431
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
2432
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
2433
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
2434
|
+
extra_headers: Headers | None = None,
|
|
2435
|
+
extra_query: Query | None = None,
|
|
2436
|
+
extra_body: Body | None = None,
|
|
2437
|
+
) -> None:
|
|
2438
|
+
"""Detach the volume from 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."""
|
|
2439
|
+
response = await self.detach_from_instance(
|
|
2440
|
+
volume_id=volume_id,
|
|
2441
|
+
project_id=project_id,
|
|
2442
|
+
region_id=region_id,
|
|
2443
|
+
instance_id=instance_id,
|
|
2444
|
+
extra_headers=extra_headers,
|
|
2445
|
+
extra_query=extra_query,
|
|
2446
|
+
extra_body=extra_body,
|
|
2447
|
+
timeout=timeout,
|
|
2448
|
+
)
|
|
2449
|
+
if not response.tasks:
|
|
2450
|
+
raise ValueError("Expected at least one task to be created")
|
|
2451
|
+
await self._client.cloud.tasks.poll(
|
|
2452
|
+
task_id=response.tasks[0],
|
|
2453
|
+
extra_headers=extra_headers,
|
|
2454
|
+
polling_interval_seconds=polling_interval_seconds,
|
|
2455
|
+
)
|
|
1640
2456
|
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
2457
|
+
async def resize_and_poll(
|
|
2458
|
+
self,
|
|
2459
|
+
volume_id: str,
|
|
2460
|
+
*,
|
|
2461
|
+
project_id: int | None = None,
|
|
2462
|
+
region_id: int | None = None,
|
|
2463
|
+
size: int,
|
|
2464
|
+
polling_interval_seconds: int | NotGiven = NOT_GIVEN,
|
|
2465
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
2466
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
2467
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
2468
|
+
extra_headers: Headers | None = None,
|
|
2469
|
+
extra_query: Query | None = None,
|
|
2470
|
+
extra_body: Body | None = None,
|
|
2471
|
+
) -> Volume:
|
|
2472
|
+
"""Increase the size of a volume and poll for the result. Only the first task will be polled. If you need to poll more tasks, use the `tasks.poll` method."""
|
|
2473
|
+
response = await self.resize(
|
|
2474
|
+
volume_id=volume_id,
|
|
2475
|
+
project_id=project_id,
|
|
2476
|
+
region_id=region_id,
|
|
2477
|
+
size=size,
|
|
2478
|
+
extra_headers=extra_headers,
|
|
2479
|
+
extra_query=extra_query,
|
|
2480
|
+
extra_body=extra_body,
|
|
2481
|
+
timeout=timeout,
|
|
2482
|
+
)
|
|
2483
|
+
if not response.tasks:
|
|
2484
|
+
raise ValueError("Expected at least one task to be created")
|
|
2485
|
+
await self._client.cloud.tasks.poll(
|
|
2486
|
+
task_id=response.tasks[0],
|
|
2487
|
+
extra_headers=extra_headers,
|
|
2488
|
+
polling_interval_seconds=polling_interval_seconds,
|
|
2489
|
+
)
|
|
2490
|
+
return await self.get(
|
|
2491
|
+
volume_id=volume_id,
|
|
2492
|
+
project_id=project_id,
|
|
2493
|
+
region_id=region_id,
|
|
2494
|
+
extra_headers=extra_headers,
|
|
2495
|
+
extra_query=extra_query,
|
|
2496
|
+
extra_body=extra_body,
|
|
2497
|
+
timeout=timeout,
|
|
1656
2498
|
)
|
|
1657
2499
|
|
|
1658
2500
|
|
|
@@ -1690,6 +2532,21 @@ class VolumesResourceWithRawResponse:
|
|
|
1690
2532
|
self.revert_to_last_snapshot = to_raw_response_wrapper(
|
|
1691
2533
|
volumes.revert_to_last_snapshot,
|
|
1692
2534
|
)
|
|
2535
|
+
self.create_and_poll = to_raw_response_wrapper(
|
|
2536
|
+
volumes.create_and_poll,
|
|
2537
|
+
)
|
|
2538
|
+
self.delete_and_poll = to_raw_response_wrapper(
|
|
2539
|
+
volumes.delete_and_poll,
|
|
2540
|
+
)
|
|
2541
|
+
self.attach_to_instance_and_poll = to_raw_response_wrapper(
|
|
2542
|
+
volumes.attach_to_instance_and_poll,
|
|
2543
|
+
)
|
|
2544
|
+
self.detach_from_instance_and_poll = to_raw_response_wrapper(
|
|
2545
|
+
volumes.detach_from_instance_and_poll,
|
|
2546
|
+
)
|
|
2547
|
+
self.resize_and_poll = to_raw_response_wrapper(
|
|
2548
|
+
volumes.resize_and_poll,
|
|
2549
|
+
)
|
|
1693
2550
|
|
|
1694
2551
|
|
|
1695
2552
|
class AsyncVolumesResourceWithRawResponse:
|
|
@@ -1726,6 +2583,21 @@ class AsyncVolumesResourceWithRawResponse:
|
|
|
1726
2583
|
self.revert_to_last_snapshot = async_to_raw_response_wrapper(
|
|
1727
2584
|
volumes.revert_to_last_snapshot,
|
|
1728
2585
|
)
|
|
2586
|
+
self.create_and_poll = async_to_raw_response_wrapper(
|
|
2587
|
+
volumes.create_and_poll,
|
|
2588
|
+
)
|
|
2589
|
+
self.delete_and_poll = async_to_raw_response_wrapper(
|
|
2590
|
+
volumes.delete_and_poll,
|
|
2591
|
+
)
|
|
2592
|
+
self.attach_to_instance_and_poll = async_to_raw_response_wrapper(
|
|
2593
|
+
volumes.attach_to_instance_and_poll,
|
|
2594
|
+
)
|
|
2595
|
+
self.detach_from_instance_and_poll = async_to_raw_response_wrapper(
|
|
2596
|
+
volumes.detach_from_instance_and_poll,
|
|
2597
|
+
)
|
|
2598
|
+
self.resize_and_poll = async_to_raw_response_wrapper(
|
|
2599
|
+
volumes.resize_and_poll,
|
|
2600
|
+
)
|
|
1729
2601
|
|
|
1730
2602
|
|
|
1731
2603
|
class VolumesResourceWithStreamingResponse:
|
|
@@ -1762,6 +2634,21 @@ class VolumesResourceWithStreamingResponse:
|
|
|
1762
2634
|
self.revert_to_last_snapshot = to_streamed_response_wrapper(
|
|
1763
2635
|
volumes.revert_to_last_snapshot,
|
|
1764
2636
|
)
|
|
2637
|
+
self.create_and_poll = to_streamed_response_wrapper(
|
|
2638
|
+
volumes.create_and_poll,
|
|
2639
|
+
)
|
|
2640
|
+
self.delete_and_poll = to_streamed_response_wrapper(
|
|
2641
|
+
volumes.delete_and_poll,
|
|
2642
|
+
)
|
|
2643
|
+
self.attach_to_instance_and_poll = to_streamed_response_wrapper(
|
|
2644
|
+
volumes.attach_to_instance_and_poll,
|
|
2645
|
+
)
|
|
2646
|
+
self.detach_from_instance_and_poll = to_streamed_response_wrapper(
|
|
2647
|
+
volumes.detach_from_instance_and_poll,
|
|
2648
|
+
)
|
|
2649
|
+
self.resize_and_poll = to_streamed_response_wrapper(
|
|
2650
|
+
volumes.resize_and_poll,
|
|
2651
|
+
)
|
|
1765
2652
|
|
|
1766
2653
|
|
|
1767
2654
|
class AsyncVolumesResourceWithStreamingResponse:
|
|
@@ -1798,3 +2685,18 @@ class AsyncVolumesResourceWithStreamingResponse:
|
|
|
1798
2685
|
self.revert_to_last_snapshot = async_to_streamed_response_wrapper(
|
|
1799
2686
|
volumes.revert_to_last_snapshot,
|
|
1800
2687
|
)
|
|
2688
|
+
self.create_and_poll = async_to_streamed_response_wrapper(
|
|
2689
|
+
volumes.create_and_poll,
|
|
2690
|
+
)
|
|
2691
|
+
self.delete_and_poll = async_to_streamed_response_wrapper(
|
|
2692
|
+
volumes.delete_and_poll,
|
|
2693
|
+
)
|
|
2694
|
+
self.attach_to_instance_and_poll = async_to_streamed_response_wrapper(
|
|
2695
|
+
volumes.attach_to_instance_and_poll,
|
|
2696
|
+
)
|
|
2697
|
+
self.detach_from_instance_and_poll = async_to_streamed_response_wrapper(
|
|
2698
|
+
volumes.detach_from_instance_and_poll,
|
|
2699
|
+
)
|
|
2700
|
+
self.resize_and_poll = async_to_streamed_response_wrapper(
|
|
2701
|
+
volumes.resize_and_poll,
|
|
2702
|
+
)
|