gcore 0.1.0a2__py3-none-any.whl → 0.3.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/_base_client.py +22 -2
- gcore/_client.py +9 -0
- gcore/_models.py +2 -0
- gcore/_types.py +2 -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/flavors.py +2 -2
- gcore/resources/cloud/baremetal/images.py +2 -2
- gcore/resources/cloud/baremetal/servers.py +280 -52
- gcore/resources/cloud/billing_reservations.py +24 -0
- gcore/resources/cloud/file_shares/file_shares.py +16 -0
- gcore/resources/cloud/floating_ips.py +4 -4
- gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py +358 -8
- gcore/resources/cloud/gpu_baremetal_clusters/images.py +206 -2
- gcore/resources/cloud/gpu_baremetal_clusters/servers.py +84 -4
- gcore/resources/cloud/inference/deployments/deployments.py +328 -10
- gcore/resources/cloud/instances/flavors.py +2 -2
- gcore/resources/cloud/instances/images.py +318 -2
- gcore/resources/cloud/instances/instances.py +534 -70
- gcore/resources/cloud/instances/interfaces.py +4 -4
- gcore/resources/cloud/load_balancers/flavors.py +2 -2
- gcore/resources/cloud/load_balancers/l7_policies/l7_policies.py +302 -20
- gcore/resources/cloud/load_balancers/l7_policies/rules.py +326 -0
- gcore/resources/cloud/load_balancers/listeners.py +385 -20
- gcore/resources/cloud/load_balancers/load_balancers.py +392 -24
- gcore/resources/cloud/load_balancers/pools/health_monitors.py +24 -0
- gcore/resources/cloud/load_balancers/pools/members.py +34 -6
- gcore/resources/cloud/load_balancers/pools/pools.py +388 -8
- gcore/resources/cloud/networks/networks.py +72 -16
- gcore/resources/cloud/networks/subnets.py +6 -6
- gcore/resources/cloud/registries/registries.py +6 -10
- gcore/resources/cloud/registries/users.py +4 -10
- gcore/resources/cloud/reserved_fixed_ips/reserved_fixed_ips.py +10 -10
- gcore/resources/cloud/secrets.py +56 -11
- gcore/resources/cloud/security_groups/security_groups.py +2 -2
- gcore/resources/cloud/ssh_keys.py +2 -2
- gcore/resources/cloud/tasks.py +203 -184
- gcore/resources/cloud/users/role_assignments.py +4 -4
- gcore/resources/cloud/volumes.py +18 -18
- gcore/resources/waap/__init__.py +131 -0
- gcore/resources/waap/advanced_rules.py +135 -0
- gcore/resources/waap/clients.py +135 -0
- gcore/resources/waap/custom_page_sets.py +805 -0
- gcore/resources/waap/domains/__init__.py +173 -0
- gcore/resources/waap/domains/advanced_rules.py +876 -0
- gcore/resources/waap/domains/analytics/__init__.py +33 -0
- gcore/resources/waap/domains/analytics/analytics.py +676 -0
- gcore/resources/waap/domains/analytics/requests.py +378 -0
- gcore/resources/waap/domains/api_discovery/__init__.py +33 -0
- gcore/resources/waap/domains/api_discovery/api_discovery.py +530 -0
- gcore/resources/waap/domains/api_discovery/scan_results.py +352 -0
- gcore/resources/waap/domains/api_path_groups.py +163 -0
- gcore/resources/waap/domains/api_paths.py +771 -0
- gcore/resources/waap/domains/custom_rules.py +889 -0
- gcore/resources/waap/domains/domains.py +914 -0
- gcore/resources/waap/domains/firewall_rules.py +884 -0
- gcore/resources/waap/domains/insight_silences.py +689 -0
- gcore/resources/waap/domains/insights.py +425 -0
- gcore/resources/waap/domains/policies.py +173 -0
- gcore/resources/waap/domains/settings.py +271 -0
- gcore/resources/waap/ip_info.py +1017 -0
- gcore/resources/waap/organizations.py +217 -0
- gcore/resources/waap/statistics.py +225 -0
- gcore/resources/waap/tags.py +233 -0
- gcore/resources/waap/waap.py +391 -0
- gcore/types/cloud/__init__.py +1 -0
- gcore/types/cloud/allowed_address_pairs.py +2 -2
- gcore/types/cloud/baremetal/baremetal_server.py +1 -1
- gcore/types/cloud/baremetal/image_list_params.py +1 -1
- gcore/types/cloud/baremetal/server_create_params.py +9 -9
- gcore/types/cloud/baremetal/server_list_params.py +8 -8
- gcore/types/cloud/baremetal/server_rebuild_params.py +1 -1
- gcore/types/cloud/baremetal_flavor.py +3 -3
- gcore/types/cloud/billing_reservation_list_params.py +5 -0
- gcore/types/cloud/container_probe_config.py +1 -1
- gcore/types/cloud/container_probe_config_create_param.py +2 -3
- gcore/types/cloud/container_scale_triggers.py +2 -2
- gcore/types/cloud/file_share.py +3 -0
- gcore/types/cloud/file_share_list_params.py +7 -1
- gcore/types/cloud/floating_ip_detailed.py +1 -1
- gcore/types/cloud/floating_ip_list_params.py +2 -2
- gcore/types/cloud/gpu_baremetal_cluster.py +1 -1
- gcore/types/cloud/gpu_baremetal_cluster_create_params.py +21 -1
- gcore/types/cloud/gpu_baremetal_cluster_delete_params.py +1 -1
- gcore/types/cloud/gpu_baremetal_cluster_rebuild_params.py +1 -1
- gcore/types/cloud/gpu_baremetal_cluster_server.py +1 -1
- gcore/types/cloud/gpu_baremetal_clusters/image_upload_params.py +1 -1
- gcore/types/cloud/gpu_baremetal_clusters/server_attach_interface_params.py +10 -10
- gcore/types/cloud/gpu_baremetal_flavor.py +3 -3
- gcore/types/cloud/image.py +1 -1
- gcore/types/cloud/inference/deployment_create_params.py +4 -4
- gcore/types/cloud/inference/deployment_update_params.py +206 -9
- gcore/types/cloud/inference/inference.py +5 -5
- gcore/types/cloud/instance.py +1 -1
- gcore/types/cloud/instance_create_params.py +8 -10
- gcore/types/cloud/instance_list_params.py +8 -8
- gcore/types/cloud/instances/flavor_list_suitable_params.py +4 -1
- gcore/types/cloud/instances/image_list_params.py +1 -1
- gcore/types/cloud/instances/instance_flavor.py +3 -3
- gcore/types/cloud/instances/interface_attach_params.py +10 -10
- gcore/types/cloud/load_balancer_create_params.py +17 -15
- gcore/types/cloud/load_balancer_flavor_detail.py +3 -3
- gcore/types/cloud/load_balancer_l7_policy.py +5 -5
- gcore/types/cloud/load_balancer_list_params.py +5 -5
- gcore/types/cloud/load_balancer_listener_detail.py +17 -17
- gcore/types/cloud/load_balancer_pool.py +13 -13
- gcore/types/cloud/load_balancer_pool_list.py +99 -4
- gcore/types/cloud/load_balancers/l7_policy_create_params.py +5 -5
- gcore/types/cloud/load_balancers/l7_policy_replace_params.py +5 -5
- gcore/types/cloud/load_balancers/listener_create_params.py +6 -4
- 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 +5 -3
- gcore/types/cloud/load_balancers/pool_create_params.py +6 -4
- gcore/types/cloud/load_balancers/pool_list_params.py +5 -6
- gcore/types/cloud/load_balancers/pool_update_params.py +6 -4
- gcore/types/cloud/load_balancers/pools/health_monitor_create_params.py +2 -0
- gcore/types/cloud/load_balancers/pools/member_add_params.py +5 -3
- gcore/types/cloud/member.py +2 -2
- gcore/types/cloud/network.py +22 -22
- gcore/types/cloud/network_create_params.py +2 -0
- gcore/types/cloud/network_details.py +25 -24
- gcore/types/cloud/network_list_params.py +15 -10
- gcore/types/cloud/network_update_params.py +2 -0
- gcore/types/cloud/networks/subnet_create_params.py +1 -1
- gcore/types/cloud/networks/subnet_list_params.py +2 -2
- 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/region.py +4 -4
- gcore/types/cloud/registries/user_create_multiple_params.py +3 -5
- gcore/types/cloud/registries/user_create_params.py +3 -5
- gcore/types/cloud/registry_create_params.py +3 -5
- gcore/types/cloud/reserved_fixed_ip_create_params.py +2 -2
- gcore/types/cloud/reserved_fixed_ip_list_params.py +3 -3
- gcore/types/cloud/secret_list_params.py +24 -0
- gcore/types/cloud/security_group_list_params.py +1 -1
- gcore/types/cloud/session_persistence.py +1 -1
- gcore/types/cloud/ssh_key_created.py +3 -6
- gcore/types/cloud/task.py +1 -4
- gcore/types/cloud/task_list_params.py +56 -46
- gcore/types/cloud/users/role_assignment_create_params.py +1 -1
- gcore/types/cloud/users/role_assignment_update_params.py +1 -1
- gcore/types/cloud/volume_create_params.py +6 -6
- gcore/types/cloud/volume_list_params.py +3 -3
- gcore/types/waap/__init__.py +108 -0
- gcore/types/waap/client_me_response.py +34 -0
- gcore/types/waap/custom_page_set_create_params.py +35 -0
- gcore/types/waap/custom_page_set_list_params.py +25 -0
- gcore/types/waap/custom_page_set_preview_params.py +34 -0
- gcore/types/waap/custom_page_set_update_params.py +35 -0
- gcore/types/waap/domain_list_params.py +30 -0
- gcore/types/waap/domain_list_rule_sets_response.py +10 -0
- gcore/types/waap/domain_update_params.py +12 -0
- gcore/types/waap/domains/__init__.py +47 -0
- gcore/types/waap/domains/advanced_rule_create_params.py +80 -0
- gcore/types/waap/domains/advanced_rule_list_params.py +58 -0
- gcore/types/waap/domains/advanced_rule_update_params.py +83 -0
- gcore/types/waap/domains/analytics/__init__.py +5 -0
- gcore/types/waap/domains/analytics/request_list_params.py +53 -0
- gcore/types/waap/domains/analytics_get_event_statistics_params.py +34 -0
- gcore/types/waap/domains/analytics_list_ddos_attacks_params.py +28 -0
- gcore/types/waap/domains/analytics_list_ddos_info_params.py +31 -0
- gcore/types/waap/domains/analytics_list_event_traffic_params.py +26 -0
- gcore/types/waap/domains/analytics_list_event_traffic_response.py +10 -0
- gcore/types/waap/domains/api_discovery/__init__.py +7 -0
- gcore/types/waap/domains/api_discovery/scan_result_get_response.py +29 -0
- gcore/types/waap/domains/api_discovery/scan_result_list_params.py +41 -0
- gcore/types/waap/domains/api_discovery/scan_result_list_response.py +29 -0
- gcore/types/waap/domains/api_discovery_get_settings_response.py +36 -0
- gcore/types/waap/domains/api_discovery_scan_openapi_response.py +10 -0
- gcore/types/waap/domains/api_discovery_update_settings_params.py +34 -0
- gcore/types/waap/domains/api_discovery_update_settings_response.py +36 -0
- gcore/types/waap/domains/api_discovery_upload_openapi_params.py +19 -0
- gcore/types/waap/domains/api_discovery_upload_openapi_response.py +10 -0
- gcore/types/waap/domains/api_path_create_params.py +31 -0
- gcore/types/waap/domains/api_path_create_response.py +50 -0
- gcore/types/waap/domains/api_path_get_response.py +50 -0
- gcore/types/waap/domains/api_path_group_list_response.py +12 -0
- gcore/types/waap/domains/api_path_list_params.py +62 -0
- gcore/types/waap/domains/api_path_list_response.py +50 -0
- gcore/types/waap/domains/api_path_update_params.py +29 -0
- gcore/types/waap/domains/custom_rule_create_params.py +368 -0
- gcore/types/waap/domains/custom_rule_delete_multiple_params.py +13 -0
- gcore/types/waap/domains/custom_rule_list_params.py +35 -0
- gcore/types/waap/domains/custom_rule_update_params.py +371 -0
- gcore/types/waap/domains/firewall_rule_create_params.py +75 -0
- gcore/types/waap/domains/firewall_rule_delete_multiple_params.py +13 -0
- gcore/types/waap/domains/firewall_rule_list_params.py +33 -0
- gcore/types/waap/domains/firewall_rule_update_params.py +78 -0
- gcore/types/waap/domains/insight_list_params.py +34 -0
- gcore/types/waap/domains/insight_replace_params.py +17 -0
- gcore/types/waap/domains/insight_silence_create_params.py +28 -0
- gcore/types/waap/domains/insight_silence_list_params.py +33 -0
- gcore/types/waap/domains/insight_silence_update_params.py +28 -0
- gcore/types/waap/domains/setting_update_params.py +48 -0
- gcore/types/waap/ip_info_get_attack_time_series_params.py +12 -0
- gcore/types/waap/ip_info_get_attack_time_series_response.py +10 -0
- gcore/types/waap/ip_info_get_blocked_requests_params.py +15 -0
- gcore/types/waap/ip_info_get_blocked_requests_response.py +10 -0
- gcore/types/waap/ip_info_get_counts_params.py +19 -0
- gcore/types/waap/ip_info_get_ddos_attack_series_params.py +12 -0
- gcore/types/waap/ip_info_get_params.py +12 -0
- gcore/types/waap/ip_info_get_top_sessions_params.py +15 -0
- gcore/types/waap/ip_info_get_top_sessions_response.py +10 -0
- gcore/types/waap/ip_info_get_top_urls_params.py +15 -0
- gcore/types/waap/ip_info_get_top_urls_response.py +10 -0
- gcore/types/waap/ip_info_get_top_user_agents_params.py +15 -0
- gcore/types/waap/ip_info_get_top_user_agents_response.py +10 -0
- gcore/types/waap/ip_info_list_attacked_countries_params.py +12 -0
- gcore/types/waap/ip_info_list_attacked_countries_response.py +10 -0
- gcore/types/waap/organization_list_params.py +22 -0
- gcore/types/waap/statistic_get_usage_series_params.py +25 -0
- gcore/types/waap/tag_list_params.py +28 -0
- gcore/types/waap/waap_advanced_rule.py +83 -0
- gcore/types/waap/waap_advanced_rule_descriptor.py +49 -0
- gcore/types/waap/waap_advanced_rule_descriptor_list.py +15 -0
- gcore/types/waap/waap_block_csrf_page_data.py +28 -0
- gcore/types/waap/waap_block_csrf_page_data_param.py +28 -0
- gcore/types/waap/waap_block_page_data.py +28 -0
- gcore/types/waap/waap_block_page_data_param.py +28 -0
- gcore/types/waap/waap_blocked_statistics.py +36 -0
- gcore/types/waap/waap_captcha_page_data.py +31 -0
- gcore/types/waap/waap_captcha_page_data_param.py +31 -0
- gcore/types/waap/waap_common_tag.py +16 -0
- gcore/types/waap/waap_cookie_disabled_page_data.py +18 -0
- gcore/types/waap/waap_cookie_disabled_page_data_param.py +18 -0
- gcore/types/waap/waap_count_statistics.py +36 -0
- gcore/types/waap/waap_custom_page_preview.py +10 -0
- gcore/types/waap/waap_custom_page_set.py +36 -0
- gcore/types/waap/waap_custom_rule.py +373 -0
- gcore/types/waap/waap_customer_rule_state.py +7 -0
- gcore/types/waap/waap_ddos_attack.py +16 -0
- gcore/types/waap/waap_ddos_info.py +17 -0
- gcore/types/waap/waap_detailed_domain.py +37 -0
- gcore/types/waap/waap_domain_api_settings.py +22 -0
- gcore/types/waap/waap_domain_ddos_settings.py +31 -0
- gcore/types/waap/waap_domain_policy.py +29 -0
- gcore/types/waap/waap_domain_settings_model.py +15 -0
- gcore/types/waap/waap_domain_status.py +7 -0
- gcore/types/waap/waap_event_statistics.py +15 -0
- gcore/types/waap/waap_firewall_rule.py +78 -0
- gcore/types/waap/waap_get_account_overview_response.py +34 -0
- gcore/types/waap/waap_handshake_page_data.py +25 -0
- gcore/types/waap/waap_handshake_page_data_param.py +25 -0
- gcore/types/waap/waap_insight.py +38 -0
- gcore/types/waap/waap_insight_silence.py +28 -0
- gcore/types/waap/waap_insight_silence_sort_by.py +9 -0
- gcore/types/waap/waap_insight_sort_by.py +20 -0
- gcore/types/waap/waap_insight_status.py +7 -0
- gcore/types/waap/waap_ip_country_attack.py +16 -0
- gcore/types/waap/waap_ip_ddos_info_model.py +23 -0
- gcore/types/waap/waap_ip_info.py +57 -0
- gcore/types/waap/waap_ip_info_counts.py +16 -0
- gcore/types/waap/waap_javascript_disabled_page_data.py +18 -0
- gcore/types/waap/waap_javascript_disabled_page_data_param.py +18 -0
- gcore/types/waap/waap_network_details.py +17 -0
- gcore/types/waap/waap_organization.py +13 -0
- gcore/types/waap/waap_page_type.py +9 -0
- gcore/types/waap/waap_paginated_custom_page_set.py +22 -0
- gcore/types/waap/waap_paginated_ddos_attack.py +22 -0
- gcore/types/waap/waap_paginated_ddos_info.py +22 -0
- gcore/types/waap/waap_paginated_request_summary.py +22 -0
- gcore/types/waap/waap_pattern_matched_tag.py +37 -0
- gcore/types/waap/waap_policy_action.py +7 -0
- gcore/types/waap/waap_policy_mode.py +10 -0
- gcore/types/waap/waap_request_details.py +92 -0
- gcore/types/waap/waap_request_organization.py +13 -0
- gcore/types/waap/waap_request_summary.py +59 -0
- gcore/types/waap/waap_resolution.py +7 -0
- gcore/types/waap/waap_rule_action_type.py +7 -0
- gcore/types/waap/waap_rule_blocked_requests.py +16 -0
- gcore/types/waap/waap_rule_set.py +41 -0
- gcore/types/waap/waap_statistic_item.py +18 -0
- gcore/types/waap/waap_statistics_series.py +16 -0
- gcore/types/waap/waap_summary_domain.py +26 -0
- gcore/types/waap/waap_tag.py +16 -0
- gcore/types/waap/waap_time_series_attack.py +23 -0
- gcore/types/waap/waap_top_session.py +24 -0
- gcore/types/waap/waap_top_url.py +13 -0
- gcore/types/waap/waap_top_user_agent.py +13 -0
- gcore/types/waap/waap_traffic_metrics.py +68 -0
- gcore/types/waap/waap_traffic_type.py +28 -0
- gcore/types/waap/waap_user_agent_details.py +40 -0
- {gcore-0.1.0a2.dist-info → gcore-0.3.0.dist-info}/METADATA +3 -3
- {gcore-0.1.0a2.dist-info → gcore-0.3.0.dist-info}/RECORD +293 -126
- {gcore-0.1.0a2.dist-info → gcore-0.3.0.dist-info}/WHEEL +0 -0
- {gcore-0.1.0a2.dist-info → gcore-0.3.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -139,18 +139,15 @@ class InstancesResource(SyncAPIResource):
|
|
|
139
139
|
For Linux,
|
|
140
140
|
|
|
141
141
|
- Use the `user_data` field to provide a
|
|
142
|
-
|
|
143
|
-
|
|
142
|
+
[cloud-init script](https://cloudinit.readthedocs.io/en/latest/reference/examples.html)
|
|
143
|
+
in base64 to apply configurations to the instance.
|
|
144
144
|
- Specify the `username` and `password` to create a new user.
|
|
145
145
|
- When only `password` is provided, it is set as the password for the default
|
|
146
146
|
user of the image.
|
|
147
|
-
- The `user_data` is ignored when the `password` is specified.
|
|
148
|
-
|
|
149
|
-
For Windows,
|
|
150
|
-
|
|
147
|
+
- The `user_data` is ignored when the `password` is specified. For Windows,
|
|
151
148
|
- Use the `user_data` field to provide a
|
|
152
|
-
|
|
153
|
-
|
|
149
|
+
[cloudbase-init script](https://cloudbase-init.readthedocs.io/en/latest/userdata.html#cloud-config)
|
|
150
|
+
in base64 to create new users on Windows.
|
|
154
151
|
- Use the `password` field to set the password for the 'Admin' user on Windows.
|
|
155
152
|
- The password of the Admin user cannot be updated via `user_data`.
|
|
156
153
|
- The `username` cannot be specified in the request.
|
|
@@ -179,21 +176,20 @@ class InstancesResource(SyncAPIResource):
|
|
|
179
176
|
name_template: If you want the instance name to be automatically generated based on IP
|
|
180
177
|
addresses, you can provide a name template instead of specifying the name
|
|
181
178
|
manually. The template should include a placeholder that will be replaced during
|
|
182
|
-
provisioning. Supported placeholders are: `{ip_octets}` (last 3 octets of the
|
|
183
|
-
IP), `{two_ip_octets}`, and `{one_ip_octet}`.
|
|
179
|
+
provisioning. Supported placeholders are: `{`ip_octets`}` (last 3 octets of the
|
|
180
|
+
IP), `{`two_ip_octets`}`, and `{`one_ip_octet`}`.
|
|
184
181
|
|
|
185
182
|
password: For Linux instances, 'username' and 'password' are used to create a new user.
|
|
186
183
|
When only 'password' is provided, it is set as the password for the default user
|
|
187
184
|
of the image. For Windows instances, 'username' cannot be specified. Use the
|
|
188
185
|
'password' field to set the password for the 'Admin' user on Windows. Use the
|
|
189
|
-
'user_data' field to provide a script to create new users on Windows. The
|
|
190
|
-
password of the Admin user cannot be updated via 'user_data'.
|
|
186
|
+
'`user_data`' field to provide a script to create new users on Windows. The
|
|
187
|
+
password of the Admin user cannot be updated via '`user_data`'.
|
|
191
188
|
|
|
192
189
|
security_groups: Specifies security group UUIDs to be applied to all instance network interfaces.
|
|
193
190
|
|
|
194
|
-
servergroup_id:
|
|
195
|
-
|
|
196
|
-
Supported group types:
|
|
191
|
+
servergroup_id:
|
|
192
|
+
Placement group ID for instance placement policy. Supported group types:
|
|
197
193
|
|
|
198
194
|
- `anti-affinity`: Ensures instances are placed on different hosts for high
|
|
199
195
|
availability.
|
|
@@ -202,7 +198,7 @@ class InstancesResource(SyncAPIResource):
|
|
|
202
198
|
sharing if needed.
|
|
203
199
|
|
|
204
200
|
ssh_key_name: Specifies the name of the SSH keypair, created via the
|
|
205
|
-
|
|
201
|
+
[/v1/`ssh_keys` endpoint](/docs/api-reference/ssh-keys/add-or-generate-ssh-key).
|
|
206
202
|
|
|
207
203
|
tags: Key-value tags to associate with the resource. A tag is a key-value pair that
|
|
208
204
|
can be associated with a resource, enabling efficient filtering and grouping for
|
|
@@ -210,10 +206,10 @@ class InstancesResource(SyncAPIResource):
|
|
|
210
206
|
modified by the user. Tags are also integrated with cost reports, allowing cost
|
|
211
207
|
data to be filtered based on tag keys or values.
|
|
212
208
|
|
|
213
|
-
user_data: String in base64 format. For Linux instances, 'user_data' is ignored when
|
|
209
|
+
user_data: String in base64 format. For Linux instances, '`user_data`' is ignored when
|
|
214
210
|
'password' field is provided. For Windows instances, Admin user password is set
|
|
215
|
-
by 'password' field and cannot be updated via 'user_data'. Examples of the
|
|
216
|
-
user_data
|
|
211
|
+
by 'password' field and cannot be updated via '`user_data`'. Examples of the
|
|
212
|
+
`user_data`: https://cloudinit.readthedocs.io/en/latest/topics/examples.html
|
|
217
213
|
|
|
218
214
|
username: For Linux instances, 'username' and 'password' are used to create a new user.
|
|
219
215
|
For Windows instances, 'username' cannot be specified. Use 'password' field to
|
|
@@ -258,6 +254,76 @@ class InstancesResource(SyncAPIResource):
|
|
|
258
254
|
cast_to=TaskIDList,
|
|
259
255
|
)
|
|
260
256
|
|
|
257
|
+
def create_and_poll(
|
|
258
|
+
self,
|
|
259
|
+
*,
|
|
260
|
+
project_id: int | None = None,
|
|
261
|
+
region_id: int | None = None,
|
|
262
|
+
flavor: str,
|
|
263
|
+
interfaces: Iterable[instance_create_params.Interface],
|
|
264
|
+
volumes: Iterable[instance_create_params.Volume],
|
|
265
|
+
allow_app_ports: bool | NotGiven = NOT_GIVEN,
|
|
266
|
+
configuration: Optional[object] | NotGiven = NOT_GIVEN,
|
|
267
|
+
name: str | NotGiven = NOT_GIVEN,
|
|
268
|
+
name_template: str | NotGiven = NOT_GIVEN,
|
|
269
|
+
password: str | NotGiven = NOT_GIVEN,
|
|
270
|
+
security_groups: Iterable[instance_create_params.SecurityGroup] | NotGiven = NOT_GIVEN,
|
|
271
|
+
servergroup_id: str | NotGiven = NOT_GIVEN,
|
|
272
|
+
ssh_key_name: Optional[str] | NotGiven = NOT_GIVEN,
|
|
273
|
+
tags: TagUpdateMapParam | NotGiven = NOT_GIVEN,
|
|
274
|
+
user_data: str | NotGiven = NOT_GIVEN,
|
|
275
|
+
username: str | NotGiven = NOT_GIVEN,
|
|
276
|
+
polling_interval_seconds: int | NotGiven = NOT_GIVEN,
|
|
277
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
278
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
279
|
+
extra_headers: Headers | None = None,
|
|
280
|
+
extra_query: Query | None = None,
|
|
281
|
+
extra_body: Body | None = None,
|
|
282
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
283
|
+
) -> Instance:
|
|
284
|
+
"""Create one or many instances or basic VMs and poll for the result."""
|
|
285
|
+
response = self.create(
|
|
286
|
+
project_id=project_id,
|
|
287
|
+
region_id=region_id,
|
|
288
|
+
flavor=flavor,
|
|
289
|
+
interfaces=interfaces,
|
|
290
|
+
volumes=volumes,
|
|
291
|
+
allow_app_ports=allow_app_ports,
|
|
292
|
+
configuration=configuration,
|
|
293
|
+
name_template=name_template,
|
|
294
|
+
name=name,
|
|
295
|
+
password=password,
|
|
296
|
+
security_groups=security_groups,
|
|
297
|
+
servergroup_id=servergroup_id,
|
|
298
|
+
ssh_key_name=ssh_key_name,
|
|
299
|
+
tags=tags,
|
|
300
|
+
user_data=user_data,
|
|
301
|
+
username=username,
|
|
302
|
+
extra_headers=extra_headers,
|
|
303
|
+
extra_query=extra_query,
|
|
304
|
+
extra_body=extra_body,
|
|
305
|
+
timeout=timeout,
|
|
306
|
+
)
|
|
307
|
+
if not response.tasks or len(response.tasks) != 1:
|
|
308
|
+
raise ValueError(f"Expected exactly one task to be created")
|
|
309
|
+
task = self._client.cloud.tasks.poll(
|
|
310
|
+
task_id=response.tasks[0],
|
|
311
|
+
extra_headers=extra_headers,
|
|
312
|
+
polling_interval_seconds=polling_interval_seconds,
|
|
313
|
+
)
|
|
314
|
+
if (
|
|
315
|
+
not task.created_resources
|
|
316
|
+
or not task.created_resources.instances
|
|
317
|
+
or len(task.created_resources.instances) != 1
|
|
318
|
+
):
|
|
319
|
+
raise ValueError(f"Expected exactly one resource to be created in a task")
|
|
320
|
+
return self.get(
|
|
321
|
+
instance_id=task.created_resources.instances[0],
|
|
322
|
+
project_id=project_id,
|
|
323
|
+
region_id=region_id,
|
|
324
|
+
extra_headers=extra_headers,
|
|
325
|
+
)
|
|
326
|
+
|
|
261
327
|
def update(
|
|
262
328
|
self,
|
|
263
329
|
instance_id: str,
|
|
@@ -382,9 +448,9 @@ class InstancesResource(SyncAPIResource):
|
|
|
382
448
|
|
|
383
449
|
exclude_secgroup: Exclude instances with specified security group name
|
|
384
450
|
|
|
385
|
-
flavor_id: Filter out instances by flavor_id
|
|
451
|
+
flavor_id: Filter out instances by `flavor_id`. Flavor id must match exactly.
|
|
386
452
|
|
|
387
|
-
flavor_prefix: Filter out instances by flavor_prefix
|
|
453
|
+
flavor_prefix: Filter out instances by `flavor_prefix`.
|
|
388
454
|
|
|
389
455
|
include_ai: Include GPU clusters' servers
|
|
390
456
|
|
|
@@ -411,22 +477,22 @@ class InstancesResource(SyncAPIResource):
|
|
|
411
477
|
|
|
412
478
|
order_by: Order by field and direction.
|
|
413
479
|
|
|
414
|
-
profile_name: Filter result by ddos protection profile name. Effective only with with_ddos
|
|
415
|
-
to true.
|
|
480
|
+
profile_name: Filter result by ddos protection profile name. Effective only with `with_ddos`
|
|
481
|
+
set to true.
|
|
416
482
|
|
|
417
|
-
protection_status: Filter result by DDoS protection_status
|
|
418
|
-
only with with_ddos set to true. (Active, Queued or Error)
|
|
483
|
+
protection_status: Filter result by DDoS `protection_status`. if parameter is provided. Effective
|
|
484
|
+
only with `with_ddos` set to true. (Active, Queued or Error)
|
|
419
485
|
|
|
420
486
|
status: Filters instances by status.
|
|
421
487
|
|
|
422
488
|
tag_key_value: Optional. Filter by tag key-value pairs. curl -G --data-urlencode
|
|
423
|
-
"tag_key_value
|
|
489
|
+
"`tag_key_value`={"key": "value"}" --url
|
|
424
490
|
"https://example.com/cloud/v1/resource/1/1"
|
|
425
491
|
|
|
426
|
-
tag_value: Optional. Filter by tag values.
|
|
492
|
+
tag_value: Optional. Filter by tag values. ?`tag_value`=value1&`tag_value`=value2
|
|
427
493
|
|
|
428
494
|
type_ddos_profile: Return bare metals either only with advanced or only basic DDoS protection.
|
|
429
|
-
Effective only with with_ddos set to true. (advanced or basic)
|
|
495
|
+
Effective only with `with_ddos` set to true. (advanced or basic)
|
|
430
496
|
|
|
431
497
|
uuid: Filter the server list result by the UUID of the server. Allowed UUID part
|
|
432
498
|
|
|
@@ -561,6 +627,48 @@ class InstancesResource(SyncAPIResource):
|
|
|
561
627
|
cast_to=TaskIDList,
|
|
562
628
|
)
|
|
563
629
|
|
|
630
|
+
def delete_and_poll(
|
|
631
|
+
self,
|
|
632
|
+
instance_id: str,
|
|
633
|
+
*,
|
|
634
|
+
project_id: int | None = None,
|
|
635
|
+
region_id: int | None = None,
|
|
636
|
+
delete_floatings: bool | NotGiven = NOT_GIVEN,
|
|
637
|
+
floatings: str | NotGiven = NOT_GIVEN,
|
|
638
|
+
reserved_fixed_ips: str | NotGiven = NOT_GIVEN,
|
|
639
|
+
volumes: str | NotGiven = NOT_GIVEN,
|
|
640
|
+
polling_interval_seconds: int | NotGiven = NOT_GIVEN,
|
|
641
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
642
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
643
|
+
extra_headers: Headers | None = None,
|
|
644
|
+
extra_query: Query | None = None,
|
|
645
|
+
extra_body: Body | None = None,
|
|
646
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
647
|
+
) -> None:
|
|
648
|
+
"""
|
|
649
|
+
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.
|
|
650
|
+
"""
|
|
651
|
+
response = self.delete(
|
|
652
|
+
instance_id=instance_id,
|
|
653
|
+
project_id=project_id,
|
|
654
|
+
region_id=region_id,
|
|
655
|
+
delete_floatings=delete_floatings,
|
|
656
|
+
floatings=floatings,
|
|
657
|
+
reserved_fixed_ips=reserved_fixed_ips,
|
|
658
|
+
volumes=volumes,
|
|
659
|
+
extra_headers=extra_headers,
|
|
660
|
+
extra_query=extra_query,
|
|
661
|
+
extra_body=extra_body,
|
|
662
|
+
timeout=timeout,
|
|
663
|
+
)
|
|
664
|
+
if not response.tasks:
|
|
665
|
+
raise ValueError("Expected at least one task to be created")
|
|
666
|
+
self._client.cloud.tasks.poll(
|
|
667
|
+
task_id=response.tasks[0],
|
|
668
|
+
extra_headers=extra_headers,
|
|
669
|
+
polling_interval_seconds=polling_interval_seconds,
|
|
670
|
+
)
|
|
671
|
+
|
|
564
672
|
@overload
|
|
565
673
|
def action(
|
|
566
674
|
self,
|
|
@@ -579,7 +687,7 @@ class InstancesResource(SyncAPIResource):
|
|
|
579
687
|
) -> TaskIDList:
|
|
580
688
|
"""
|
|
581
689
|
The action can be one of: start, stop, reboot, powercycle, suspend or resume.
|
|
582
|
-
Suspend and resume are not available for
|
|
690
|
+
Suspend and resume are not available for bare metal instances.
|
|
583
691
|
|
|
584
692
|
Args:
|
|
585
693
|
action: Instance action name
|
|
@@ -613,7 +721,7 @@ class InstancesResource(SyncAPIResource):
|
|
|
613
721
|
) -> TaskIDList:
|
|
614
722
|
"""
|
|
615
723
|
The action can be one of: start, stop, reboot, powercycle, suspend or resume.
|
|
616
|
-
Suspend and resume are not available for
|
|
724
|
+
Suspend and resume are not available for bare metal instances.
|
|
617
725
|
|
|
618
726
|
Args:
|
|
619
727
|
action: Instance action name
|
|
@@ -711,6 +819,48 @@ class InstancesResource(SyncAPIResource):
|
|
|
711
819
|
cast_to=TaskIDList,
|
|
712
820
|
)
|
|
713
821
|
|
|
822
|
+
def add_to_placement_group_and_poll(
|
|
823
|
+
self,
|
|
824
|
+
instance_id: str,
|
|
825
|
+
*,
|
|
826
|
+
project_id: int | None = None,
|
|
827
|
+
region_id: int | None = None,
|
|
828
|
+
servergroup_id: str,
|
|
829
|
+
polling_interval_seconds: int | NotGiven = NOT_GIVEN,
|
|
830
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
831
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
832
|
+
extra_headers: Headers | None = None,
|
|
833
|
+
extra_query: Query | None = None,
|
|
834
|
+
extra_body: Body | None = None,
|
|
835
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
836
|
+
) -> Instance:
|
|
837
|
+
"""
|
|
838
|
+
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.
|
|
839
|
+
"""
|
|
840
|
+
response = self.add_to_placement_group(
|
|
841
|
+
instance_id=instance_id,
|
|
842
|
+
project_id=project_id,
|
|
843
|
+
region_id=region_id,
|
|
844
|
+
servergroup_id=servergroup_id,
|
|
845
|
+
extra_headers=extra_headers,
|
|
846
|
+
extra_query=extra_query,
|
|
847
|
+
extra_body=extra_body,
|
|
848
|
+
timeout=timeout,
|
|
849
|
+
)
|
|
850
|
+
if not response.tasks:
|
|
851
|
+
raise ValueError("Expected at least one task to be created")
|
|
852
|
+
self._client.cloud.tasks.poll(
|
|
853
|
+
task_id=response.tasks[0],
|
|
854
|
+
extra_headers=extra_headers,
|
|
855
|
+
polling_interval_seconds=polling_interval_seconds,
|
|
856
|
+
)
|
|
857
|
+
return self.get(
|
|
858
|
+
instance_id=instance_id,
|
|
859
|
+
project_id=project_id,
|
|
860
|
+
region_id=region_id,
|
|
861
|
+
extra_headers=extra_headers,
|
|
862
|
+
)
|
|
863
|
+
|
|
714
864
|
def assign_security_group(
|
|
715
865
|
self,
|
|
716
866
|
instance_id: str,
|
|
@@ -730,7 +880,7 @@ class InstancesResource(SyncAPIResource):
|
|
|
730
880
|
"""Assign the security group to the server.
|
|
731
881
|
|
|
732
882
|
To assign multiple security groups to
|
|
733
|
-
all ports, use the NULL value for the port_id field
|
|
883
|
+
all ports, use the NULL value for the `port_id` field
|
|
734
884
|
|
|
735
885
|
Args:
|
|
736
886
|
name: Security group name, applies to all ports
|
|
@@ -863,9 +1013,9 @@ class InstancesResource(SyncAPIResource):
|
|
|
863
1013
|
|
|
864
1014
|
- `language` (str, optional): Language for the response content. Affects the
|
|
865
1015
|
`ddos_profile` field. Supported values:
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
1016
|
+
- `'en'` (default)
|
|
1017
|
+
- `'de'`
|
|
1018
|
+
- `'ru'`
|
|
869
1019
|
|
|
870
1020
|
Args:
|
|
871
1021
|
project_id: Project ID
|
|
@@ -983,6 +1133,46 @@ class InstancesResource(SyncAPIResource):
|
|
|
983
1133
|
cast_to=TaskIDList,
|
|
984
1134
|
)
|
|
985
1135
|
|
|
1136
|
+
def remove_from_placement_group_and_poll(
|
|
1137
|
+
self,
|
|
1138
|
+
instance_id: str,
|
|
1139
|
+
*,
|
|
1140
|
+
project_id: int | None = None,
|
|
1141
|
+
region_id: int | None = None,
|
|
1142
|
+
polling_interval_seconds: int | NotGiven = NOT_GIVEN,
|
|
1143
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
1144
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
1145
|
+
extra_headers: Headers | None = None,
|
|
1146
|
+
extra_query: Query | None = None,
|
|
1147
|
+
extra_body: Body | None = None,
|
|
1148
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
1149
|
+
) -> Instance:
|
|
1150
|
+
"""
|
|
1151
|
+
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.
|
|
1152
|
+
"""
|
|
1153
|
+
response = self.remove_from_placement_group(
|
|
1154
|
+
instance_id=instance_id,
|
|
1155
|
+
project_id=project_id,
|
|
1156
|
+
region_id=region_id,
|
|
1157
|
+
extra_headers=extra_headers,
|
|
1158
|
+
extra_query=extra_query,
|
|
1159
|
+
extra_body=extra_body,
|
|
1160
|
+
timeout=timeout,
|
|
1161
|
+
)
|
|
1162
|
+
if not response.tasks:
|
|
1163
|
+
raise ValueError("Expected at least one task to be created")
|
|
1164
|
+
self._client.cloud.tasks.poll(
|
|
1165
|
+
task_id=response.tasks[0],
|
|
1166
|
+
extra_headers=extra_headers,
|
|
1167
|
+
polling_interval_seconds=polling_interval_seconds,
|
|
1168
|
+
)
|
|
1169
|
+
return self.get(
|
|
1170
|
+
instance_id=instance_id,
|
|
1171
|
+
project_id=project_id,
|
|
1172
|
+
region_id=region_id,
|
|
1173
|
+
extra_headers=extra_headers,
|
|
1174
|
+
)
|
|
1175
|
+
|
|
986
1176
|
def resize(
|
|
987
1177
|
self,
|
|
988
1178
|
instance_id: str,
|
|
@@ -1026,6 +1216,48 @@ class InstancesResource(SyncAPIResource):
|
|
|
1026
1216
|
cast_to=TaskIDList,
|
|
1027
1217
|
)
|
|
1028
1218
|
|
|
1219
|
+
def resize_and_poll(
|
|
1220
|
+
self,
|
|
1221
|
+
instance_id: str,
|
|
1222
|
+
*,
|
|
1223
|
+
project_id: int | None = None,
|
|
1224
|
+
region_id: int | None = None,
|
|
1225
|
+
flavor_id: str,
|
|
1226
|
+
polling_interval_seconds: int | NotGiven = NOT_GIVEN,
|
|
1227
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
1228
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
1229
|
+
extra_headers: Headers | None = None,
|
|
1230
|
+
extra_query: Query | None = None,
|
|
1231
|
+
extra_body: Body | None = None,
|
|
1232
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
1233
|
+
) -> Instance:
|
|
1234
|
+
"""
|
|
1235
|
+
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.
|
|
1236
|
+
"""
|
|
1237
|
+
response = self.resize(
|
|
1238
|
+
instance_id=instance_id,
|
|
1239
|
+
project_id=project_id,
|
|
1240
|
+
region_id=region_id,
|
|
1241
|
+
flavor_id=flavor_id,
|
|
1242
|
+
extra_headers=extra_headers,
|
|
1243
|
+
extra_query=extra_query,
|
|
1244
|
+
extra_body=extra_body,
|
|
1245
|
+
timeout=timeout,
|
|
1246
|
+
)
|
|
1247
|
+
if not response.tasks:
|
|
1248
|
+
raise ValueError("Expected at least one task to be created")
|
|
1249
|
+
self._client.cloud.tasks.poll(
|
|
1250
|
+
task_id=response.tasks[0],
|
|
1251
|
+
extra_headers=extra_headers,
|
|
1252
|
+
polling_interval_seconds=polling_interval_seconds,
|
|
1253
|
+
)
|
|
1254
|
+
return self.get(
|
|
1255
|
+
instance_id=instance_id,
|
|
1256
|
+
project_id=project_id,
|
|
1257
|
+
region_id=region_id,
|
|
1258
|
+
extra_headers=extra_headers,
|
|
1259
|
+
)
|
|
1260
|
+
|
|
1029
1261
|
def unassign_security_group(
|
|
1030
1262
|
self,
|
|
1031
1263
|
instance_id: str,
|
|
@@ -1045,7 +1277,7 @@ class InstancesResource(SyncAPIResource):
|
|
|
1045
1277
|
"""Un-assign the security group to the server.
|
|
1046
1278
|
|
|
1047
1279
|
To un-assign multiple security
|
|
1048
|
-
groups to all ports, use the NULL value for the port_id field
|
|
1280
|
+
groups to all ports, use the NULL value for the `port_id` field
|
|
1049
1281
|
|
|
1050
1282
|
Args:
|
|
1051
1283
|
name: Security group name, applies to all ports
|
|
@@ -1149,18 +1381,15 @@ class AsyncInstancesResource(AsyncAPIResource):
|
|
|
1149
1381
|
For Linux,
|
|
1150
1382
|
|
|
1151
1383
|
- Use the `user_data` field to provide a
|
|
1152
|
-
|
|
1153
|
-
|
|
1384
|
+
[cloud-init script](https://cloudinit.readthedocs.io/en/latest/reference/examples.html)
|
|
1385
|
+
in base64 to apply configurations to the instance.
|
|
1154
1386
|
- Specify the `username` and `password` to create a new user.
|
|
1155
1387
|
- When only `password` is provided, it is set as the password for the default
|
|
1156
1388
|
user of the image.
|
|
1157
|
-
- The `user_data` is ignored when the `password` is specified.
|
|
1158
|
-
|
|
1159
|
-
For Windows,
|
|
1160
|
-
|
|
1389
|
+
- The `user_data` is ignored when the `password` is specified. For Windows,
|
|
1161
1390
|
- Use the `user_data` field to provide a
|
|
1162
|
-
|
|
1163
|
-
|
|
1391
|
+
[cloudbase-init script](https://cloudbase-init.readthedocs.io/en/latest/userdata.html#cloud-config)
|
|
1392
|
+
in base64 to create new users on Windows.
|
|
1164
1393
|
- Use the `password` field to set the password for the 'Admin' user on Windows.
|
|
1165
1394
|
- The password of the Admin user cannot be updated via `user_data`.
|
|
1166
1395
|
- The `username` cannot be specified in the request.
|
|
@@ -1189,21 +1418,20 @@ class AsyncInstancesResource(AsyncAPIResource):
|
|
|
1189
1418
|
name_template: If you want the instance name to be automatically generated based on IP
|
|
1190
1419
|
addresses, you can provide a name template instead of specifying the name
|
|
1191
1420
|
manually. The template should include a placeholder that will be replaced during
|
|
1192
|
-
provisioning. Supported placeholders are: `{ip_octets}` (last 3 octets of the
|
|
1193
|
-
IP), `{two_ip_octets}`, and `{one_ip_octet}`.
|
|
1421
|
+
provisioning. Supported placeholders are: `{`ip_octets`}` (last 3 octets of the
|
|
1422
|
+
IP), `{`two_ip_octets`}`, and `{`one_ip_octet`}`.
|
|
1194
1423
|
|
|
1195
1424
|
password: For Linux instances, 'username' and 'password' are used to create a new user.
|
|
1196
1425
|
When only 'password' is provided, it is set as the password for the default user
|
|
1197
1426
|
of the image. For Windows instances, 'username' cannot be specified. Use the
|
|
1198
1427
|
'password' field to set the password for the 'Admin' user on Windows. Use the
|
|
1199
|
-
'user_data' field to provide a script to create new users on Windows. The
|
|
1200
|
-
password of the Admin user cannot be updated via 'user_data'.
|
|
1428
|
+
'`user_data`' field to provide a script to create new users on Windows. The
|
|
1429
|
+
password of the Admin user cannot be updated via '`user_data`'.
|
|
1201
1430
|
|
|
1202
1431
|
security_groups: Specifies security group UUIDs to be applied to all instance network interfaces.
|
|
1203
1432
|
|
|
1204
|
-
servergroup_id:
|
|
1205
|
-
|
|
1206
|
-
Supported group types:
|
|
1433
|
+
servergroup_id:
|
|
1434
|
+
Placement group ID for instance placement policy. Supported group types:
|
|
1207
1435
|
|
|
1208
1436
|
- `anti-affinity`: Ensures instances are placed on different hosts for high
|
|
1209
1437
|
availability.
|
|
@@ -1212,7 +1440,7 @@ class AsyncInstancesResource(AsyncAPIResource):
|
|
|
1212
1440
|
sharing if needed.
|
|
1213
1441
|
|
|
1214
1442
|
ssh_key_name: Specifies the name of the SSH keypair, created via the
|
|
1215
|
-
|
|
1443
|
+
[/v1/`ssh_keys` endpoint](/docs/api-reference/ssh-keys/add-or-generate-ssh-key).
|
|
1216
1444
|
|
|
1217
1445
|
tags: Key-value tags to associate with the resource. A tag is a key-value pair that
|
|
1218
1446
|
can be associated with a resource, enabling efficient filtering and grouping for
|
|
@@ -1220,10 +1448,10 @@ class AsyncInstancesResource(AsyncAPIResource):
|
|
|
1220
1448
|
modified by the user. Tags are also integrated with cost reports, allowing cost
|
|
1221
1449
|
data to be filtered based on tag keys or values.
|
|
1222
1450
|
|
|
1223
|
-
user_data: String in base64 format. For Linux instances, 'user_data' is ignored when
|
|
1451
|
+
user_data: String in base64 format. For Linux instances, '`user_data`' is ignored when
|
|
1224
1452
|
'password' field is provided. For Windows instances, Admin user password is set
|
|
1225
|
-
by 'password' field and cannot be updated via 'user_data'. Examples of the
|
|
1226
|
-
user_data
|
|
1453
|
+
by 'password' field and cannot be updated via '`user_data`'. Examples of the
|
|
1454
|
+
`user_data`: https://cloudinit.readthedocs.io/en/latest/topics/examples.html
|
|
1227
1455
|
|
|
1228
1456
|
username: For Linux instances, 'username' and 'password' are used to create a new user.
|
|
1229
1457
|
For Windows instances, 'username' cannot be specified. Use 'password' field to
|
|
@@ -1268,6 +1496,76 @@ class AsyncInstancesResource(AsyncAPIResource):
|
|
|
1268
1496
|
cast_to=TaskIDList,
|
|
1269
1497
|
)
|
|
1270
1498
|
|
|
1499
|
+
async def create_and_poll(
|
|
1500
|
+
self,
|
|
1501
|
+
*,
|
|
1502
|
+
project_id: int | None = None,
|
|
1503
|
+
region_id: int | None = None,
|
|
1504
|
+
flavor: str,
|
|
1505
|
+
interfaces: Iterable[instance_create_params.Interface],
|
|
1506
|
+
volumes: Iterable[instance_create_params.Volume],
|
|
1507
|
+
allow_app_ports: bool | NotGiven = NOT_GIVEN,
|
|
1508
|
+
configuration: Optional[object] | NotGiven = NOT_GIVEN,
|
|
1509
|
+
name: str | NotGiven = NOT_GIVEN,
|
|
1510
|
+
name_template: str | NotGiven = NOT_GIVEN,
|
|
1511
|
+
password: str | NotGiven = NOT_GIVEN,
|
|
1512
|
+
security_groups: Iterable[instance_create_params.SecurityGroup] | NotGiven = NOT_GIVEN,
|
|
1513
|
+
servergroup_id: str | NotGiven = NOT_GIVEN,
|
|
1514
|
+
ssh_key_name: Optional[str] | NotGiven = NOT_GIVEN,
|
|
1515
|
+
tags: TagUpdateMapParam | NotGiven = NOT_GIVEN,
|
|
1516
|
+
user_data: str | NotGiven = NOT_GIVEN,
|
|
1517
|
+
username: str | NotGiven = NOT_GIVEN,
|
|
1518
|
+
polling_interval_seconds: int | NotGiven = NOT_GIVEN,
|
|
1519
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
1520
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
1521
|
+
extra_headers: Headers | None = None,
|
|
1522
|
+
extra_query: Query | None = None,
|
|
1523
|
+
extra_body: Body | None = None,
|
|
1524
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
1525
|
+
) -> Instance:
|
|
1526
|
+
"""Create one or many instances or basic VMs and poll for the result."""
|
|
1527
|
+
response = await self.create(
|
|
1528
|
+
project_id=project_id,
|
|
1529
|
+
region_id=region_id,
|
|
1530
|
+
flavor=flavor,
|
|
1531
|
+
interfaces=interfaces,
|
|
1532
|
+
volumes=volumes,
|
|
1533
|
+
allow_app_ports=allow_app_ports,
|
|
1534
|
+
configuration=configuration,
|
|
1535
|
+
name_template=name_template,
|
|
1536
|
+
name=name,
|
|
1537
|
+
password=password,
|
|
1538
|
+
security_groups=security_groups,
|
|
1539
|
+
servergroup_id=servergroup_id,
|
|
1540
|
+
ssh_key_name=ssh_key_name,
|
|
1541
|
+
tags=tags,
|
|
1542
|
+
user_data=user_data,
|
|
1543
|
+
username=username,
|
|
1544
|
+
extra_headers=extra_headers,
|
|
1545
|
+
extra_query=extra_query,
|
|
1546
|
+
extra_body=extra_body,
|
|
1547
|
+
timeout=timeout,
|
|
1548
|
+
)
|
|
1549
|
+
if not response.tasks or len(response.tasks) != 1:
|
|
1550
|
+
raise ValueError(f"Expected exactly one task to be created")
|
|
1551
|
+
task = await self._client.cloud.tasks.poll(
|
|
1552
|
+
task_id=response.tasks[0],
|
|
1553
|
+
extra_headers=extra_headers,
|
|
1554
|
+
polling_interval_seconds=polling_interval_seconds,
|
|
1555
|
+
)
|
|
1556
|
+
if (
|
|
1557
|
+
not task.created_resources
|
|
1558
|
+
or not task.created_resources.instances
|
|
1559
|
+
or len(task.created_resources.instances) != 1
|
|
1560
|
+
):
|
|
1561
|
+
raise ValueError(f"Expected exactly one resource to be created in a task")
|
|
1562
|
+
return await self.get(
|
|
1563
|
+
instance_id=task.created_resources.instances[0],
|
|
1564
|
+
project_id=project_id,
|
|
1565
|
+
region_id=region_id,
|
|
1566
|
+
extra_headers=extra_headers,
|
|
1567
|
+
)
|
|
1568
|
+
|
|
1271
1569
|
async def update(
|
|
1272
1570
|
self,
|
|
1273
1571
|
instance_id: str,
|
|
@@ -1392,9 +1690,9 @@ class AsyncInstancesResource(AsyncAPIResource):
|
|
|
1392
1690
|
|
|
1393
1691
|
exclude_secgroup: Exclude instances with specified security group name
|
|
1394
1692
|
|
|
1395
|
-
flavor_id: Filter out instances by flavor_id
|
|
1693
|
+
flavor_id: Filter out instances by `flavor_id`. Flavor id must match exactly.
|
|
1396
1694
|
|
|
1397
|
-
flavor_prefix: Filter out instances by flavor_prefix
|
|
1695
|
+
flavor_prefix: Filter out instances by `flavor_prefix`.
|
|
1398
1696
|
|
|
1399
1697
|
include_ai: Include GPU clusters' servers
|
|
1400
1698
|
|
|
@@ -1421,22 +1719,22 @@ class AsyncInstancesResource(AsyncAPIResource):
|
|
|
1421
1719
|
|
|
1422
1720
|
order_by: Order by field and direction.
|
|
1423
1721
|
|
|
1424
|
-
profile_name: Filter result by ddos protection profile name. Effective only with with_ddos
|
|
1425
|
-
to true.
|
|
1722
|
+
profile_name: Filter result by ddos protection profile name. Effective only with `with_ddos`
|
|
1723
|
+
set to true.
|
|
1426
1724
|
|
|
1427
|
-
protection_status: Filter result by DDoS protection_status
|
|
1428
|
-
only with with_ddos set to true. (Active, Queued or Error)
|
|
1725
|
+
protection_status: Filter result by DDoS `protection_status`. if parameter is provided. Effective
|
|
1726
|
+
only with `with_ddos` set to true. (Active, Queued or Error)
|
|
1429
1727
|
|
|
1430
1728
|
status: Filters instances by status.
|
|
1431
1729
|
|
|
1432
1730
|
tag_key_value: Optional. Filter by tag key-value pairs. curl -G --data-urlencode
|
|
1433
|
-
"tag_key_value
|
|
1731
|
+
"`tag_key_value`={"key": "value"}" --url
|
|
1434
1732
|
"https://example.com/cloud/v1/resource/1/1"
|
|
1435
1733
|
|
|
1436
|
-
tag_value: Optional. Filter by tag values.
|
|
1734
|
+
tag_value: Optional. Filter by tag values. ?`tag_value`=value1&`tag_value`=value2
|
|
1437
1735
|
|
|
1438
1736
|
type_ddos_profile: Return bare metals either only with advanced or only basic DDoS protection.
|
|
1439
|
-
Effective only with with_ddos set to true. (advanced or basic)
|
|
1737
|
+
Effective only with `with_ddos` set to true. (advanced or basic)
|
|
1440
1738
|
|
|
1441
1739
|
uuid: Filter the server list result by the UUID of the server. Allowed UUID part
|
|
1442
1740
|
|
|
@@ -1571,6 +1869,48 @@ class AsyncInstancesResource(AsyncAPIResource):
|
|
|
1571
1869
|
cast_to=TaskIDList,
|
|
1572
1870
|
)
|
|
1573
1871
|
|
|
1872
|
+
async def delete_and_poll(
|
|
1873
|
+
self,
|
|
1874
|
+
instance_id: str,
|
|
1875
|
+
*,
|
|
1876
|
+
project_id: int | None = None,
|
|
1877
|
+
region_id: int | None = None,
|
|
1878
|
+
delete_floatings: bool | NotGiven = NOT_GIVEN,
|
|
1879
|
+
floatings: str | NotGiven = NOT_GIVEN,
|
|
1880
|
+
reserved_fixed_ips: str | NotGiven = NOT_GIVEN,
|
|
1881
|
+
volumes: str | NotGiven = NOT_GIVEN,
|
|
1882
|
+
polling_interval_seconds: int | NotGiven = NOT_GIVEN,
|
|
1883
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
1884
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
1885
|
+
extra_headers: Headers | None = None,
|
|
1886
|
+
extra_query: Query | None = None,
|
|
1887
|
+
extra_body: Body | None = None,
|
|
1888
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
1889
|
+
) -> None:
|
|
1890
|
+
"""
|
|
1891
|
+
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.
|
|
1892
|
+
"""
|
|
1893
|
+
response = await self.delete(
|
|
1894
|
+
instance_id=instance_id,
|
|
1895
|
+
project_id=project_id,
|
|
1896
|
+
region_id=region_id,
|
|
1897
|
+
delete_floatings=delete_floatings,
|
|
1898
|
+
floatings=floatings,
|
|
1899
|
+
reserved_fixed_ips=reserved_fixed_ips,
|
|
1900
|
+
volumes=volumes,
|
|
1901
|
+
extra_headers=extra_headers,
|
|
1902
|
+
extra_query=extra_query,
|
|
1903
|
+
extra_body=extra_body,
|
|
1904
|
+
timeout=timeout,
|
|
1905
|
+
)
|
|
1906
|
+
if not response.tasks:
|
|
1907
|
+
raise ValueError("Expected at least one task to be created")
|
|
1908
|
+
await self._client.cloud.tasks.poll(
|
|
1909
|
+
task_id=response.tasks[0],
|
|
1910
|
+
extra_headers=extra_headers,
|
|
1911
|
+
polling_interval_seconds=polling_interval_seconds,
|
|
1912
|
+
)
|
|
1913
|
+
|
|
1574
1914
|
@overload
|
|
1575
1915
|
async def action(
|
|
1576
1916
|
self,
|
|
@@ -1589,7 +1929,7 @@ class AsyncInstancesResource(AsyncAPIResource):
|
|
|
1589
1929
|
) -> TaskIDList:
|
|
1590
1930
|
"""
|
|
1591
1931
|
The action can be one of: start, stop, reboot, powercycle, suspend or resume.
|
|
1592
|
-
Suspend and resume are not available for
|
|
1932
|
+
Suspend and resume are not available for bare metal instances.
|
|
1593
1933
|
|
|
1594
1934
|
Args:
|
|
1595
1935
|
action: Instance action name
|
|
@@ -1623,7 +1963,7 @@ class AsyncInstancesResource(AsyncAPIResource):
|
|
|
1623
1963
|
) -> TaskIDList:
|
|
1624
1964
|
"""
|
|
1625
1965
|
The action can be one of: start, stop, reboot, powercycle, suspend or resume.
|
|
1626
|
-
Suspend and resume are not available for
|
|
1966
|
+
Suspend and resume are not available for bare metal instances.
|
|
1627
1967
|
|
|
1628
1968
|
Args:
|
|
1629
1969
|
action: Instance action name
|
|
@@ -1721,6 +2061,48 @@ class AsyncInstancesResource(AsyncAPIResource):
|
|
|
1721
2061
|
cast_to=TaskIDList,
|
|
1722
2062
|
)
|
|
1723
2063
|
|
|
2064
|
+
async def add_to_placement_group_and_poll(
|
|
2065
|
+
self,
|
|
2066
|
+
instance_id: str,
|
|
2067
|
+
*,
|
|
2068
|
+
project_id: int | None = None,
|
|
2069
|
+
region_id: int | None = None,
|
|
2070
|
+
servergroup_id: str,
|
|
2071
|
+
polling_interval_seconds: int | NotGiven = NOT_GIVEN,
|
|
2072
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
2073
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
2074
|
+
extra_headers: Headers | None = None,
|
|
2075
|
+
extra_query: Query | None = None,
|
|
2076
|
+
extra_body: Body | None = None,
|
|
2077
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
2078
|
+
) -> Instance:
|
|
2079
|
+
"""
|
|
2080
|
+
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.
|
|
2081
|
+
"""
|
|
2082
|
+
response = await self.add_to_placement_group(
|
|
2083
|
+
instance_id=instance_id,
|
|
2084
|
+
project_id=project_id,
|
|
2085
|
+
region_id=region_id,
|
|
2086
|
+
servergroup_id=servergroup_id,
|
|
2087
|
+
extra_headers=extra_headers,
|
|
2088
|
+
extra_query=extra_query,
|
|
2089
|
+
extra_body=extra_body,
|
|
2090
|
+
timeout=timeout,
|
|
2091
|
+
)
|
|
2092
|
+
if not response.tasks:
|
|
2093
|
+
raise ValueError("Expected at least one task to be created")
|
|
2094
|
+
await self._client.cloud.tasks.poll(
|
|
2095
|
+
task_id=response.tasks[0],
|
|
2096
|
+
extra_headers=extra_headers,
|
|
2097
|
+
polling_interval_seconds=polling_interval_seconds,
|
|
2098
|
+
)
|
|
2099
|
+
return await self.get(
|
|
2100
|
+
instance_id=instance_id,
|
|
2101
|
+
project_id=project_id,
|
|
2102
|
+
region_id=region_id,
|
|
2103
|
+
extra_headers=extra_headers,
|
|
2104
|
+
)
|
|
2105
|
+
|
|
1724
2106
|
async def assign_security_group(
|
|
1725
2107
|
self,
|
|
1726
2108
|
instance_id: str,
|
|
@@ -1740,7 +2122,7 @@ class AsyncInstancesResource(AsyncAPIResource):
|
|
|
1740
2122
|
"""Assign the security group to the server.
|
|
1741
2123
|
|
|
1742
2124
|
To assign multiple security groups to
|
|
1743
|
-
all ports, use the NULL value for the port_id field
|
|
2125
|
+
all ports, use the NULL value for the `port_id` field
|
|
1744
2126
|
|
|
1745
2127
|
Args:
|
|
1746
2128
|
name: Security group name, applies to all ports
|
|
@@ -1873,9 +2255,9 @@ class AsyncInstancesResource(AsyncAPIResource):
|
|
|
1873
2255
|
|
|
1874
2256
|
- `language` (str, optional): Language for the response content. Affects the
|
|
1875
2257
|
`ddos_profile` field. Supported values:
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
2258
|
+
- `'en'` (default)
|
|
2259
|
+
- `'de'`
|
|
2260
|
+
- `'ru'`
|
|
1879
2261
|
|
|
1880
2262
|
Args:
|
|
1881
2263
|
project_id: Project ID
|
|
@@ -1993,6 +2375,46 @@ class AsyncInstancesResource(AsyncAPIResource):
|
|
|
1993
2375
|
cast_to=TaskIDList,
|
|
1994
2376
|
)
|
|
1995
2377
|
|
|
2378
|
+
async def remove_from_placement_group_and_poll(
|
|
2379
|
+
self,
|
|
2380
|
+
instance_id: str,
|
|
2381
|
+
*,
|
|
2382
|
+
project_id: int | None = None,
|
|
2383
|
+
region_id: int | None = None,
|
|
2384
|
+
polling_interval_seconds: int | NotGiven = NOT_GIVEN,
|
|
2385
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
2386
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
2387
|
+
extra_headers: Headers | None = None,
|
|
2388
|
+
extra_query: Query | None = None,
|
|
2389
|
+
extra_body: Body | None = None,
|
|
2390
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
2391
|
+
) -> Instance:
|
|
2392
|
+
"""
|
|
2393
|
+
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.
|
|
2394
|
+
"""
|
|
2395
|
+
response = await self.remove_from_placement_group(
|
|
2396
|
+
instance_id=instance_id,
|
|
2397
|
+
project_id=project_id,
|
|
2398
|
+
region_id=region_id,
|
|
2399
|
+
extra_headers=extra_headers,
|
|
2400
|
+
extra_query=extra_query,
|
|
2401
|
+
extra_body=extra_body,
|
|
2402
|
+
timeout=timeout,
|
|
2403
|
+
)
|
|
2404
|
+
if not response.tasks:
|
|
2405
|
+
raise ValueError("Expected at least one task to be created")
|
|
2406
|
+
await self._client.cloud.tasks.poll(
|
|
2407
|
+
task_id=response.tasks[0],
|
|
2408
|
+
extra_headers=extra_headers,
|
|
2409
|
+
polling_interval_seconds=polling_interval_seconds,
|
|
2410
|
+
)
|
|
2411
|
+
return await self.get(
|
|
2412
|
+
instance_id=instance_id,
|
|
2413
|
+
project_id=project_id,
|
|
2414
|
+
region_id=region_id,
|
|
2415
|
+
extra_headers=extra_headers,
|
|
2416
|
+
)
|
|
2417
|
+
|
|
1996
2418
|
async def resize(
|
|
1997
2419
|
self,
|
|
1998
2420
|
instance_id: str,
|
|
@@ -2036,6 +2458,48 @@ class AsyncInstancesResource(AsyncAPIResource):
|
|
|
2036
2458
|
cast_to=TaskIDList,
|
|
2037
2459
|
)
|
|
2038
2460
|
|
|
2461
|
+
async def resize_and_poll(
|
|
2462
|
+
self,
|
|
2463
|
+
instance_id: str,
|
|
2464
|
+
*,
|
|
2465
|
+
project_id: int | None = None,
|
|
2466
|
+
region_id: int | None = None,
|
|
2467
|
+
flavor_id: str,
|
|
2468
|
+
polling_interval_seconds: int | NotGiven = NOT_GIVEN,
|
|
2469
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
2470
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
2471
|
+
extra_headers: Headers | None = None,
|
|
2472
|
+
extra_query: Query | None = None,
|
|
2473
|
+
extra_body: Body | None = None,
|
|
2474
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
2475
|
+
) -> Instance:
|
|
2476
|
+
"""
|
|
2477
|
+
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.
|
|
2478
|
+
"""
|
|
2479
|
+
response = await self.resize(
|
|
2480
|
+
instance_id=instance_id,
|
|
2481
|
+
project_id=project_id,
|
|
2482
|
+
region_id=region_id,
|
|
2483
|
+
flavor_id=flavor_id,
|
|
2484
|
+
extra_headers=extra_headers,
|
|
2485
|
+
extra_query=extra_query,
|
|
2486
|
+
extra_body=extra_body,
|
|
2487
|
+
timeout=timeout,
|
|
2488
|
+
)
|
|
2489
|
+
if not response.tasks:
|
|
2490
|
+
raise ValueError("Expected at least one task to be created")
|
|
2491
|
+
await self._client.cloud.tasks.poll(
|
|
2492
|
+
task_id=response.tasks[0],
|
|
2493
|
+
extra_headers=extra_headers,
|
|
2494
|
+
polling_interval_seconds=polling_interval_seconds,
|
|
2495
|
+
)
|
|
2496
|
+
return await self.get(
|
|
2497
|
+
instance_id=instance_id,
|
|
2498
|
+
project_id=project_id,
|
|
2499
|
+
region_id=region_id,
|
|
2500
|
+
extra_headers=extra_headers,
|
|
2501
|
+
)
|
|
2502
|
+
|
|
2039
2503
|
async def unassign_security_group(
|
|
2040
2504
|
self,
|
|
2041
2505
|
instance_id: str,
|
|
@@ -2055,7 +2519,7 @@ class AsyncInstancesResource(AsyncAPIResource):
|
|
|
2055
2519
|
"""Un-assign the security group to the server.
|
|
2056
2520
|
|
|
2057
2521
|
To un-assign multiple security
|
|
2058
|
-
groups to all ports, use the NULL value for the port_id field
|
|
2522
|
+
groups to all ports, use the NULL value for the `port_id` field
|
|
2059
2523
|
|
|
2060
2524
|
Args:
|
|
2061
2525
|
name: Security group name, applies to all ports
|