gcore 0.1.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.

Files changed (437) hide show
  1. gcore/__init__.py +89 -0
  2. gcore/_base_client.py +1943 -0
  3. gcore/_client.py +493 -0
  4. gcore/_compat.py +219 -0
  5. gcore/_constants.py +16 -0
  6. gcore/_exceptions.py +108 -0
  7. gcore/_files.py +123 -0
  8. gcore/_models.py +803 -0
  9. gcore/_qs.py +150 -0
  10. gcore/_resource.py +43 -0
  11. gcore/_response.py +830 -0
  12. gcore/_streaming.py +333 -0
  13. gcore/_types.py +217 -0
  14. gcore/_utils/__init__.py +57 -0
  15. gcore/_utils/_logs.py +25 -0
  16. gcore/_utils/_proxy.py +65 -0
  17. gcore/_utils/_reflection.py +42 -0
  18. gcore/_utils/_resources_proxy.py +24 -0
  19. gcore/_utils/_streams.py +12 -0
  20. gcore/_utils/_sync.py +86 -0
  21. gcore/_utils/_transform.py +447 -0
  22. gcore/_utils/_typing.py +151 -0
  23. gcore/_utils/_utils.py +422 -0
  24. gcore/_version.py +4 -0
  25. gcore/lib/.keep +4 -0
  26. gcore/lib/polling.py +19 -0
  27. gcore/pagination.py +70 -0
  28. gcore/py.typed +0 -0
  29. gcore/resources/__init__.py +33 -0
  30. gcore/resources/cloud/__init__.py +327 -0
  31. gcore/resources/cloud/baremetal/__init__.py +61 -0
  32. gcore/resources/cloud/baremetal/baremetal.py +166 -0
  33. gcore/resources/cloud/baremetal/flavors.py +371 -0
  34. gcore/resources/cloud/baremetal/images.py +238 -0
  35. gcore/resources/cloud/baremetal/servers.py +1042 -0
  36. gcore/resources/cloud/billing_reservations.py +386 -0
  37. gcore/resources/cloud/cloud.py +774 -0
  38. gcore/resources/cloud/file_shares/__init__.py +33 -0
  39. gcore/resources/cloud/file_shares/access_rules.py +434 -0
  40. gcore/resources/cloud/file_shares/file_shares.py +994 -0
  41. gcore/resources/cloud/floating_ips.py +765 -0
  42. gcore/resources/cloud/gpu_baremetal_clusters/__init__.py +75 -0
  43. gcore/resources/cloud/gpu_baremetal_clusters/flavors.py +211 -0
  44. gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py +1493 -0
  45. gcore/resources/cloud/gpu_baremetal_clusters/images.py +785 -0
  46. gcore/resources/cloud/gpu_baremetal_clusters/interfaces.py +175 -0
  47. gcore/resources/cloud/gpu_baremetal_clusters/servers.py +1178 -0
  48. gcore/resources/cloud/inference/__init__.py +89 -0
  49. gcore/resources/cloud/inference/deployments/__init__.py +33 -0
  50. gcore/resources/cloud/inference/deployments/deployments.py +1493 -0
  51. gcore/resources/cloud/inference/deployments/logs.py +235 -0
  52. gcore/resources/cloud/inference/flavors.py +280 -0
  53. gcore/resources/cloud/inference/inference.py +295 -0
  54. gcore/resources/cloud/inference/models.py +289 -0
  55. gcore/resources/cloud/inference/registry_credentials.py +649 -0
  56. gcore/resources/cloud/inference/secrets.py +629 -0
  57. gcore/resources/cloud/instances/__init__.py +75 -0
  58. gcore/resources/cloud/instances/flavors.py +449 -0
  59. gcore/resources/cloud/instances/images.py +1297 -0
  60. gcore/resources/cloud/instances/instances.py +2821 -0
  61. gcore/resources/cloud/instances/interfaces.py +797 -0
  62. gcore/resources/cloud/instances/metrics.py +217 -0
  63. gcore/resources/cloud/ip_ranges.py +135 -0
  64. gcore/resources/cloud/load_balancers/__init__.py +103 -0
  65. gcore/resources/cloud/load_balancers/flavors.py +193 -0
  66. gcore/resources/cloud/load_balancers/l7_policies/__init__.py +33 -0
  67. gcore/resources/cloud/load_balancers/l7_policies/l7_policies.py +1020 -0
  68. gcore/resources/cloud/load_balancers/l7_policies/rules.py +1036 -0
  69. gcore/resources/cloud/load_balancers/listeners.py +1089 -0
  70. gcore/resources/cloud/load_balancers/load_balancers.py +1583 -0
  71. gcore/resources/cloud/load_balancers/metrics.py +205 -0
  72. gcore/resources/cloud/load_balancers/pools/__init__.py +47 -0
  73. gcore/resources/cloud/load_balancers/pools/health_monitors.py +352 -0
  74. gcore/resources/cloud/load_balancers/pools/members.py +353 -0
  75. gcore/resources/cloud/load_balancers/pools/pools.py +1190 -0
  76. gcore/resources/cloud/load_balancers/statuses.py +260 -0
  77. gcore/resources/cloud/networks/__init__.py +47 -0
  78. gcore/resources/cloud/networks/networks.py +771 -0
  79. gcore/resources/cloud/networks/routers.py +875 -0
  80. gcore/resources/cloud/networks/subnets.py +865 -0
  81. gcore/resources/cloud/placement_groups.py +465 -0
  82. gcore/resources/cloud/projects.py +608 -0
  83. gcore/resources/cloud/quotas/__init__.py +33 -0
  84. gcore/resources/cloud/quotas/quotas.py +335 -0
  85. gcore/resources/cloud/quotas/requests.py +482 -0
  86. gcore/resources/cloud/regions.py +328 -0
  87. gcore/resources/cloud/registries/__init__.py +75 -0
  88. gcore/resources/cloud/registries/artifacts.py +277 -0
  89. gcore/resources/cloud/registries/registries.py +688 -0
  90. gcore/resources/cloud/registries/repositories.py +265 -0
  91. gcore/resources/cloud/registries/tags.py +190 -0
  92. gcore/resources/cloud/registries/users.py +701 -0
  93. gcore/resources/cloud/reserved_fixed_ips/__init__.py +33 -0
  94. gcore/resources/cloud/reserved_fixed_ips/reserved_fixed_ips.py +965 -0
  95. gcore/resources/cloud/reserved_fixed_ips/vip.py +577 -0
  96. gcore/resources/cloud/secrets.py +797 -0
  97. gcore/resources/cloud/security_groups/__init__.py +33 -0
  98. gcore/resources/cloud/security_groups/rules.py +626 -0
  99. gcore/resources/cloud/security_groups/security_groups.py +863 -0
  100. gcore/resources/cloud/ssh_keys.py +635 -0
  101. gcore/resources/cloud/tasks.py +700 -0
  102. gcore/resources/cloud/users/__init__.py +33 -0
  103. gcore/resources/cloud/users/role_assignments.py +533 -0
  104. gcore/resources/cloud/users/users.py +102 -0
  105. gcore/resources/cloud/volumes.py +1710 -0
  106. gcore/resources/waap/__init__.py +33 -0
  107. gcore/resources/waap/domains/__init__.py +33 -0
  108. gcore/resources/waap/domains/domains.py +515 -0
  109. gcore/resources/waap/domains/settings.py +271 -0
  110. gcore/resources/waap/waap.py +102 -0
  111. gcore/types/__init__.py +3 -0
  112. gcore/types/cloud/__init__.py +199 -0
  113. gcore/types/cloud/allowed_address_pairs.py +15 -0
  114. gcore/types/cloud/aws_iam_data.py +13 -0
  115. gcore/types/cloud/aws_iam_data_param.py +15 -0
  116. gcore/types/cloud/baremetal/__init__.py +13 -0
  117. gcore/types/cloud/baremetal/baremetal_fixed_address.py +30 -0
  118. gcore/types/cloud/baremetal/baremetal_floating_address.py +15 -0
  119. gcore/types/cloud/baremetal/baremetal_server.py +178 -0
  120. gcore/types/cloud/baremetal/flavor_list_params.py +35 -0
  121. gcore/types/cloud/baremetal/flavor_list_suitable_params.py +22 -0
  122. gcore/types/cloud/baremetal/image_list_params.py +33 -0
  123. gcore/types/cloud/baremetal/server_create_params.py +370 -0
  124. gcore/types/cloud/baremetal/server_list_params.py +114 -0
  125. gcore/types/cloud/baremetal/server_rebuild_params.py +23 -0
  126. gcore/types/cloud/baremetal_flavor.py +58 -0
  127. gcore/types/cloud/baremetal_flavor_list.py +16 -0
  128. gcore/types/cloud/billing_reservation.py +153 -0
  129. gcore/types/cloud/billing_reservation_list_params.py +59 -0
  130. gcore/types/cloud/blackhole_port.py +66 -0
  131. gcore/types/cloud/capacity.py +13 -0
  132. gcore/types/cloud/console.py +18 -0
  133. gcore/types/cloud/container_probe.py +36 -0
  134. gcore/types/cloud/container_probe_config.py +16 -0
  135. gcore/types/cloud/container_probe_config_create_param.py +18 -0
  136. gcore/types/cloud/container_probe_create_param.py +38 -0
  137. gcore/types/cloud/container_probe_exec.py +12 -0
  138. gcore/types/cloud/container_probe_exec_create_param.py +13 -0
  139. gcore/types/cloud/container_probe_http_get.py +26 -0
  140. gcore/types/cloud/container_probe_http_get_create_param.py +25 -0
  141. gcore/types/cloud/container_probe_tcp_socket.py +10 -0
  142. gcore/types/cloud/container_probe_tcp_socket_create_param.py +12 -0
  143. gcore/types/cloud/container_scale.py +25 -0
  144. gcore/types/cloud/container_scale_trigger_rate.py +13 -0
  145. gcore/types/cloud/container_scale_trigger_sqs.py +33 -0
  146. gcore/types/cloud/container_scale_trigger_threshold.py +10 -0
  147. gcore/types/cloud/container_scale_triggers.py +36 -0
  148. gcore/types/cloud/ddos_profile.py +33 -0
  149. gcore/types/cloud/ddos_profile_field.py +31 -0
  150. gcore/types/cloud/ddos_profile_option_list.py +15 -0
  151. gcore/types/cloud/ddos_profile_status.py +13 -0
  152. gcore/types/cloud/ddos_profile_template.py +18 -0
  153. gcore/types/cloud/ddos_profile_template_field.py +23 -0
  154. gcore/types/cloud/deploy_status.py +13 -0
  155. gcore/types/cloud/file_share.py +111 -0
  156. gcore/types/cloud/file_share_create_params.py +104 -0
  157. gcore/types/cloud/file_share_list_params.py +24 -0
  158. gcore/types/cloud/file_share_resize_params.py +18 -0
  159. gcore/types/cloud/file_share_update_params.py +18 -0
  160. gcore/types/cloud/file_shares/__init__.py +7 -0
  161. gcore/types/cloud/file_shares/access_rule.py +21 -0
  162. gcore/types/cloud/file_shares/access_rule_create_params.py +21 -0
  163. gcore/types/cloud/file_shares/access_rule_list.py +16 -0
  164. gcore/types/cloud/fixed_address.py +38 -0
  165. gcore/types/cloud/fixed_address_short.py +24 -0
  166. gcore/types/cloud/flavor_hardware_description.py +27 -0
  167. gcore/types/cloud/floating_address.py +15 -0
  168. gcore/types/cloud/floating_ip.py +77 -0
  169. gcore/types/cloud/floating_ip_assign_params.py +20 -0
  170. gcore/types/cloud/floating_ip_create_params.py +40 -0
  171. gcore/types/cloud/floating_ip_detailed.py +222 -0
  172. gcore/types/cloud/floating_ip_list_params.py +35 -0
  173. gcore/types/cloud/floating_ip_status.py +7 -0
  174. gcore/types/cloud/gpu_baremetal_cluster.py +116 -0
  175. gcore/types/cloud/gpu_baremetal_cluster_create_params.py +155 -0
  176. gcore/types/cloud/gpu_baremetal_cluster_delete_params.py +28 -0
  177. gcore/types/cloud/gpu_baremetal_cluster_list_params.py +19 -0
  178. gcore/types/cloud/gpu_baremetal_cluster_rebuild_params.py +26 -0
  179. gcore/types/cloud/gpu_baremetal_cluster_resize_params.py +16 -0
  180. gcore/types/cloud/gpu_baremetal_cluster_server.py +200 -0
  181. gcore/types/cloud/gpu_baremetal_cluster_server_list.py +16 -0
  182. gcore/types/cloud/gpu_baremetal_clusters/__init__.py +9 -0
  183. gcore/types/cloud/gpu_baremetal_clusters/flavor_list_params.py +21 -0
  184. gcore/types/cloud/gpu_baremetal_clusters/image_upload_params.py +58 -0
  185. gcore/types/cloud/gpu_baremetal_clusters/server_attach_interface_params.py +253 -0
  186. gcore/types/cloud/gpu_baremetal_clusters/server_delete_params.py +21 -0
  187. gcore/types/cloud/gpu_baremetal_clusters/server_detach_interface_params.py +19 -0
  188. gcore/types/cloud/gpu_baremetal_flavor.py +133 -0
  189. gcore/types/cloud/gpu_baremetal_flavor_list.py +16 -0
  190. gcore/types/cloud/gpu_image.py +70 -0
  191. gcore/types/cloud/gpu_image_list.py +16 -0
  192. gcore/types/cloud/health_monitor.py +48 -0
  193. gcore/types/cloud/health_monitor_status.py +22 -0
  194. gcore/types/cloud/http_method.py +7 -0
  195. gcore/types/cloud/image.py +100 -0
  196. gcore/types/cloud/image_list.py +16 -0
  197. gcore/types/cloud/inference/__init__.py +25 -0
  198. gcore/types/cloud/inference/container.py +26 -0
  199. gcore/types/cloud/inference/deployment_create_params.py +222 -0
  200. gcore/types/cloud/inference/deployment_list_params.py +21 -0
  201. gcore/types/cloud/inference/deployment_update_params.py +215 -0
  202. gcore/types/cloud/inference/deployments/__init__.py +5 -0
  203. gcore/types/cloud/inference/deployments/log_list_params.py +28 -0
  204. gcore/types/cloud/inference/flavor_list_params.py +18 -0
  205. gcore/types/cloud/inference/inference.py +95 -0
  206. gcore/types/cloud/inference/inference_apikey_secret.py +15 -0
  207. gcore/types/cloud/inference/inference_flavor.py +34 -0
  208. gcore/types/cloud/inference/inference_log.py +21 -0
  209. gcore/types/cloud/inference/inference_registry_credential.py +19 -0
  210. gcore/types/cloud/inference/inference_registry_credential_full.py +22 -0
  211. gcore/types/cloud/inference/inference_secret.py +17 -0
  212. gcore/types/cloud/inference/mlcatalog_model_card.py +65 -0
  213. gcore/types/cloud/inference/mlcatalog_order_by_choices.py +7 -0
  214. gcore/types/cloud/inference/model_list_params.py +23 -0
  215. gcore/types/cloud/inference/registry_credential_create_params.py +24 -0
  216. gcore/types/cloud/inference/registry_credential_list_params.py +21 -0
  217. gcore/types/cloud/inference/registry_credential_replace_params.py +21 -0
  218. gcore/types/cloud/inference/secret_create_params.py +23 -0
  219. gcore/types/cloud/inference/secret_list_params.py +21 -0
  220. gcore/types/cloud/inference/secret_replace_params.py +20 -0
  221. gcore/types/cloud/inference_probes.py +19 -0
  222. gcore/types/cloud/ingress_opts_out.py +16 -0
  223. gcore/types/cloud/ingress_opts_param.py +18 -0
  224. gcore/types/cloud/instance.py +296 -0
  225. gcore/types/cloud/instance_action_params.py +32 -0
  226. gcore/types/cloud/instance_add_to_placement_group_params.py +16 -0
  227. gcore/types/cloud/instance_assign_security_group_params.py +28 -0
  228. gcore/types/cloud/instance_create_params.py +622 -0
  229. gcore/types/cloud/instance_delete_params.py +33 -0
  230. gcore/types/cloud/instance_get_console_params.py +16 -0
  231. gcore/types/cloud/instance_interface.py +40 -0
  232. gcore/types/cloud/instance_isolation.py +12 -0
  233. gcore/types/cloud/instance_list.py +16 -0
  234. gcore/types/cloud/instance_list_params.py +146 -0
  235. gcore/types/cloud/instance_metrics_time_unit.py +7 -0
  236. gcore/types/cloud/instance_resize_params.py +16 -0
  237. gcore/types/cloud/instance_unassign_security_group_params.py +28 -0
  238. gcore/types/cloud/instance_update_params.py +18 -0
  239. gcore/types/cloud/instances/__init__.py +19 -0
  240. gcore/types/cloud/instances/flavor_list_for_resize_params.py +16 -0
  241. gcore/types/cloud/instances/flavor_list_params.py +25 -0
  242. gcore/types/cloud/instances/flavor_list_suitable_params.py +56 -0
  243. gcore/types/cloud/instances/image_create_from_volume_params.py +53 -0
  244. gcore/types/cloud/instances/image_get_params.py +16 -0
  245. gcore/types/cloud/instances/image_list_params.py +33 -0
  246. gcore/types/cloud/instances/image_update_params.py +43 -0
  247. gcore/types/cloud/instances/image_upload_params.py +62 -0
  248. gcore/types/cloud/instances/instance_flavor.py +49 -0
  249. gcore/types/cloud/instances/instance_flavor_list.py +16 -0
  250. gcore/types/cloud/instances/interface_attach_params.py +253 -0
  251. gcore/types/cloud/instances/interface_detach_params.py +19 -0
  252. gcore/types/cloud/instances/metric_list_params.py +23 -0
  253. gcore/types/cloud/instances/metrics.py +52 -0
  254. gcore/types/cloud/instances/metrics_list.py +16 -0
  255. gcore/types/cloud/interface_ip_family.py +7 -0
  256. gcore/types/cloud/ip_assignment.py +13 -0
  257. gcore/types/cloud/ip_ranges.py +12 -0
  258. gcore/types/cloud/ip_version.py +7 -0
  259. gcore/types/cloud/laas_index_retention_policy.py +12 -0
  260. gcore/types/cloud/laas_index_retention_policy_param.py +13 -0
  261. gcore/types/cloud/lb_algorithm.py +7 -0
  262. gcore/types/cloud/lb_health_monitor_type.py +7 -0
  263. gcore/types/cloud/lb_listener_protocol.py +7 -0
  264. gcore/types/cloud/lb_pool_protocol.py +7 -0
  265. gcore/types/cloud/lb_session_persistence_type.py +7 -0
  266. gcore/types/cloud/listener_status.py +27 -0
  267. gcore/types/cloud/load_balancer.py +144 -0
  268. gcore/types/cloud/load_balancer_create_params.py +327 -0
  269. gcore/types/cloud/load_balancer_failover_params.py +16 -0
  270. gcore/types/cloud/load_balancer_flavor_detail.py +40 -0
  271. gcore/types/cloud/load_balancer_flavor_list.py +16 -0
  272. gcore/types/cloud/load_balancer_get_params.py +19 -0
  273. gcore/types/cloud/load_balancer_instance_role.py +7 -0
  274. gcore/types/cloud/load_balancer_l7_policy.py +86 -0
  275. gcore/types/cloud/load_balancer_l7_policy_list.py +16 -0
  276. gcore/types/cloud/load_balancer_l7_rule.py +72 -0
  277. gcore/types/cloud/load_balancer_l7_rule_list.py +16 -0
  278. gcore/types/cloud/load_balancer_list_params.py +53 -0
  279. gcore/types/cloud/load_balancer_listener_detail.py +97 -0
  280. gcore/types/cloud/load_balancer_listener_list.py +16 -0
  281. gcore/types/cloud/load_balancer_member_connectivity.py +7 -0
  282. gcore/types/cloud/load_balancer_metrics.py +32 -0
  283. gcore/types/cloud/load_balancer_metrics_list.py +16 -0
  284. gcore/types/cloud/load_balancer_operating_status.py +7 -0
  285. gcore/types/cloud/load_balancer_pool.py +87 -0
  286. gcore/types/cloud/load_balancer_pool_list.py +16 -0
  287. gcore/types/cloud/load_balancer_resize_params.py +16 -0
  288. gcore/types/cloud/load_balancer_statistics.py +22 -0
  289. gcore/types/cloud/load_balancer_status.py +38 -0
  290. gcore/types/cloud/load_balancer_status_list.py +16 -0
  291. gcore/types/cloud/load_balancer_update_params.py +43 -0
  292. gcore/types/cloud/load_balancers/__init__.py +15 -0
  293. gcore/types/cloud/load_balancers/flavor_list_params.py +16 -0
  294. gcore/types/cloud/load_balancers/l7_policies/__init__.py +6 -0
  295. gcore/types/cloud/load_balancers/l7_policies/rule_create_params.py +50 -0
  296. gcore/types/cloud/load_balancers/l7_policies/rule_replace_params.py +43 -0
  297. gcore/types/cloud/load_balancers/l7_policy_create_params.py +54 -0
  298. gcore/types/cloud/load_balancers/l7_policy_replace_params.py +51 -0
  299. gcore/types/cloud/load_balancers/listener_create_params.py +72 -0
  300. gcore/types/cloud/load_balancers/listener_get_params.py +16 -0
  301. gcore/types/cloud/load_balancers/listener_list_params.py +19 -0
  302. gcore/types/cloud/load_balancers/listener_update_params.py +55 -0
  303. gcore/types/cloud/load_balancers/metric_list_params.py +21 -0
  304. gcore/types/cloud/load_balancers/pool_create_params.py +141 -0
  305. gcore/types/cloud/load_balancers/pool_list_params.py +25 -0
  306. gcore/types/cloud/load_balancers/pool_update_params.py +139 -0
  307. gcore/types/cloud/load_balancers/pools/__init__.py +6 -0
  308. gcore/types/cloud/load_balancers/pools/health_monitor_create_params.py +49 -0
  309. gcore/types/cloud/load_balancers/pools/member_add_params.py +44 -0
  310. gcore/types/cloud/logging.py +22 -0
  311. gcore/types/cloud/member.py +47 -0
  312. gcore/types/cloud/member_status.py +24 -0
  313. gcore/types/cloud/network.py +79 -0
  314. gcore/types/cloud/network_create_params.py +36 -0
  315. gcore/types/cloud/network_details.py +80 -0
  316. gcore/types/cloud/network_interface.py +78 -0
  317. gcore/types/cloud/network_interface_list.py +16 -0
  318. gcore/types/cloud/network_list_params.py +41 -0
  319. gcore/types/cloud/network_update_params.py +18 -0
  320. gcore/types/cloud/networks/__init__.py +14 -0
  321. gcore/types/cloud/networks/router.py +83 -0
  322. gcore/types/cloud/networks/router_attach_subnet_params.py +24 -0
  323. gcore/types/cloud/networks/router_create_params.py +75 -0
  324. gcore/types/cloud/networks/router_detach_subnet_params.py +16 -0
  325. gcore/types/cloud/networks/router_list.py +16 -0
  326. gcore/types/cloud/networks/router_list_params.py +19 -0
  327. gcore/types/cloud/networks/router_update_params.py +45 -0
  328. gcore/types/cloud/networks/subnet_create_params.py +82 -0
  329. gcore/types/cloud/networks/subnet_list_params.py +58 -0
  330. gcore/types/cloud/networks/subnet_update_params.py +47 -0
  331. gcore/types/cloud/placement_group.py +41 -0
  332. gcore/types/cloud/placement_group_create_params.py +19 -0
  333. gcore/types/cloud/placement_group_list.py +16 -0
  334. gcore/types/cloud/pool_status.py +31 -0
  335. gcore/types/cloud/project.py +47 -0
  336. gcore/types/cloud/project_create_params.py +22 -0
  337. gcore/types/cloud/project_list_params.py +27 -0
  338. gcore/types/cloud/project_replace_params.py +18 -0
  339. gcore/types/cloud/provisioning_status.py +9 -0
  340. gcore/types/cloud/quota_get_all_response.py +340 -0
  341. gcore/types/cloud/quota_get_by_region_response.py +288 -0
  342. gcore/types/cloud/quota_get_global_response.py +51 -0
  343. gcore/types/cloud/quotas/__init__.py +8 -0
  344. gcore/types/cloud/quotas/request_create_params.py +193 -0
  345. gcore/types/cloud/quotas/request_get_response.py +205 -0
  346. gcore/types/cloud/quotas/request_list_params.py +22 -0
  347. gcore/types/cloud/quotas/request_list_response.py +205 -0
  348. gcore/types/cloud/region.py +101 -0
  349. gcore/types/cloud/region_capacity.py +16 -0
  350. gcore/types/cloud/region_capacity_list.py +16 -0
  351. gcore/types/cloud/region_get_params.py +18 -0
  352. gcore/types/cloud/region_list_params.py +31 -0
  353. gcore/types/cloud/registries/__init__.py +14 -0
  354. gcore/types/cloud/registries/registry_artifact.py +35 -0
  355. gcore/types/cloud/registries/registry_artifact_list.py +16 -0
  356. gcore/types/cloud/registries/registry_repository.py +30 -0
  357. gcore/types/cloud/registries/registry_repository_list.py +16 -0
  358. gcore/types/cloud/registries/registry_user.py +28 -0
  359. gcore/types/cloud/registries/registry_user_created.py +31 -0
  360. gcore/types/cloud/registries/registry_user_list.py +16 -0
  361. gcore/types/cloud/registries/user_create_multiple_params.py +36 -0
  362. gcore/types/cloud/registries/user_create_params.py +30 -0
  363. gcore/types/cloud/registries/user_update_params.py +21 -0
  364. gcore/types/cloud/registry.py +33 -0
  365. gcore/types/cloud/registry_create_params.py +24 -0
  366. gcore/types/cloud/registry_list.py +16 -0
  367. gcore/types/cloud/registry_resize_params.py +16 -0
  368. gcore/types/cloud/registry_tag.py +27 -0
  369. gcore/types/cloud/reserved_fixed_ip.py +98 -0
  370. gcore/types/cloud/reserved_fixed_ip_create_params.py +107 -0
  371. gcore/types/cloud/reserved_fixed_ip_list_params.py +47 -0
  372. gcore/types/cloud/reserved_fixed_ips/__init__.py +12 -0
  373. gcore/types/cloud/reserved_fixed_ips/candidate_port.py +26 -0
  374. gcore/types/cloud/reserved_fixed_ips/candidate_port_list.py +16 -0
  375. gcore/types/cloud/reserved_fixed_ips/connected_port.py +26 -0
  376. gcore/types/cloud/reserved_fixed_ips/connected_port_list.py +16 -0
  377. gcore/types/cloud/reserved_fixed_ips/ip_with_subnet.py +17 -0
  378. gcore/types/cloud/reserved_fixed_ips/vip_replace_connected_ports_params.py +17 -0
  379. gcore/types/cloud/reserved_fixed_ips/vip_toggle_params.py +16 -0
  380. gcore/types/cloud/reserved_fixed_ips/vip_update_connected_ports_params.py +17 -0
  381. gcore/types/cloud/route.py +16 -0
  382. gcore/types/cloud/secret.py +64 -0
  383. gcore/types/cloud/secret_create_params.py +66 -0
  384. gcore/types/cloud/secret_list_response.py +16 -0
  385. gcore/types/cloud/secret_upload_tls_certificate_params.py +39 -0
  386. gcore/types/cloud/security_group.py +45 -0
  387. gcore/types/cloud/security_group_copy_params.py +16 -0
  388. gcore/types/cloud/security_group_create_params.py +94 -0
  389. gcore/types/cloud/security_group_list_params.py +30 -0
  390. gcore/types/cloud/security_group_rule.py +83 -0
  391. gcore/types/cloud/security_group_update_params.py +83 -0
  392. gcore/types/cloud/security_groups/__init__.py +6 -0
  393. gcore/types/cloud/security_groups/rule_create_params.py +65 -0
  394. gcore/types/cloud/security_groups/rule_replace_params.py +72 -0
  395. gcore/types/cloud/session_persistence.py +22 -0
  396. gcore/types/cloud/ssh_key.py +39 -0
  397. gcore/types/cloud/ssh_key_create_params.py +31 -0
  398. gcore/types/cloud/ssh_key_created.py +53 -0
  399. gcore/types/cloud/ssh_key_list_params.py +21 -0
  400. gcore/types/cloud/ssh_key_update_params.py +15 -0
  401. gcore/types/cloud/subnet.py +87 -0
  402. gcore/types/cloud/tag.py +16 -0
  403. gcore/types/cloud/tag_update_map_param.py +10 -0
  404. gcore/types/cloud/task.py +191 -0
  405. gcore/types/cloud/task_acknowledge_all_params.py +16 -0
  406. gcore/types/cloud/task_id_list.py +12 -0
  407. gcore/types/cloud/task_list_params.py +104 -0
  408. gcore/types/cloud/users/__init__.py +9 -0
  409. gcore/types/cloud/users/role_assignment.py +33 -0
  410. gcore/types/cloud/users/role_assignment_create_params.py +22 -0
  411. gcore/types/cloud/users/role_assignment_list_params.py +25 -0
  412. gcore/types/cloud/users/role_assignment_update_delete.py +10 -0
  413. gcore/types/cloud/users/role_assignment_update_params.py +22 -0
  414. gcore/types/cloud/volume.py +141 -0
  415. gcore/types/cloud/volume_attach_to_instance_params.py +21 -0
  416. gcore/types/cloud/volume_change_type_params.py +18 -0
  417. gcore/types/cloud/volume_create_params.py +176 -0
  418. gcore/types/cloud/volume_delete_params.py +18 -0
  419. gcore/types/cloud/volume_detach_from_instance_params.py +18 -0
  420. gcore/types/cloud/volume_list_params.py +56 -0
  421. gcore/types/cloud/volume_resize_params.py +18 -0
  422. gcore/types/cloud/volume_update_params.py +18 -0
  423. gcore/types/waap/__init__.py +12 -0
  424. gcore/types/waap/domain_list_params.py +30 -0
  425. gcore/types/waap/domain_update_params.py +12 -0
  426. gcore/types/waap/domains/__init__.py +5 -0
  427. gcore/types/waap/domains/setting_update_params.py +41 -0
  428. gcore/types/waap/waap_api_urls.py +15 -0
  429. gcore/types/waap/waap_detailed_domain.py +37 -0
  430. gcore/types/waap/waap_domain_ddos_settings.py +31 -0
  431. gcore/types/waap/waap_domain_settings.py +15 -0
  432. gcore/types/waap/waap_domain_status.py +7 -0
  433. gcore/types/waap/waap_summary_domain.py +26 -0
  434. gcore-0.1.0.dist-info/METADATA +482 -0
  435. gcore-0.1.0.dist-info/RECORD +437 -0
  436. gcore-0.1.0.dist-info/WHEEL +4 -0
  437. gcore-0.1.0.dist-info/licenses/LICENSE +201 -0
@@ -0,0 +1,2821 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import List, Union, Iterable, Optional
6
+ from datetime import datetime
7
+ from typing_extensions import Literal, overload
8
+
9
+ import httpx
10
+
11
+ from .images import (
12
+ ImagesResource,
13
+ AsyncImagesResource,
14
+ ImagesResourceWithRawResponse,
15
+ AsyncImagesResourceWithRawResponse,
16
+ ImagesResourceWithStreamingResponse,
17
+ AsyncImagesResourceWithStreamingResponse,
18
+ )
19
+ from .flavors import (
20
+ FlavorsResource,
21
+ AsyncFlavorsResource,
22
+ FlavorsResourceWithRawResponse,
23
+ AsyncFlavorsResourceWithRawResponse,
24
+ FlavorsResourceWithStreamingResponse,
25
+ AsyncFlavorsResourceWithStreamingResponse,
26
+ )
27
+ from .metrics import (
28
+ MetricsResource,
29
+ AsyncMetricsResource,
30
+ MetricsResourceWithRawResponse,
31
+ AsyncMetricsResourceWithRawResponse,
32
+ MetricsResourceWithStreamingResponse,
33
+ AsyncMetricsResourceWithStreamingResponse,
34
+ )
35
+ from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven
36
+ from ...._utils import required_args, maybe_transform, async_maybe_transform
37
+ from ...._compat import cached_property
38
+ from .interfaces import (
39
+ InterfacesResource,
40
+ AsyncInterfacesResource,
41
+ InterfacesResourceWithRawResponse,
42
+ AsyncInterfacesResourceWithRawResponse,
43
+ InterfacesResourceWithStreamingResponse,
44
+ AsyncInterfacesResourceWithStreamingResponse,
45
+ )
46
+ from ...._resource import SyncAPIResource, AsyncAPIResource
47
+ from ...._response import (
48
+ to_raw_response_wrapper,
49
+ to_streamed_response_wrapper,
50
+ async_to_raw_response_wrapper,
51
+ async_to_streamed_response_wrapper,
52
+ )
53
+ from ....pagination import SyncOffsetPage, AsyncOffsetPage
54
+ from ....types.cloud import (
55
+ instance_list_params,
56
+ instance_action_params,
57
+ instance_create_params,
58
+ instance_delete_params,
59
+ instance_resize_params,
60
+ instance_update_params,
61
+ instance_get_console_params,
62
+ instance_assign_security_group_params,
63
+ instance_add_to_placement_group_params,
64
+ instance_unassign_security_group_params,
65
+ )
66
+ from ...._base_client import AsyncPaginator, make_request_options
67
+ from ....types.cloud.console import Console
68
+ from ....types.cloud.instance import Instance
69
+ from ....types.cloud.task_id_list import TaskIDList
70
+ from ....types.cloud.instance_interface import InstanceInterface
71
+ from ....types.cloud.tag_update_map_param import TagUpdateMapParam
72
+
73
+ __all__ = ["InstancesResource", "AsyncInstancesResource"]
74
+
75
+
76
+ class InstancesResource(SyncAPIResource):
77
+ @cached_property
78
+ def flavors(self) -> FlavorsResource:
79
+ return FlavorsResource(self._client)
80
+
81
+ @cached_property
82
+ def interfaces(self) -> InterfacesResource:
83
+ return InterfacesResource(self._client)
84
+
85
+ @cached_property
86
+ def images(self) -> ImagesResource:
87
+ return ImagesResource(self._client)
88
+
89
+ @cached_property
90
+ def metrics(self) -> MetricsResource:
91
+ return MetricsResource(self._client)
92
+
93
+ @cached_property
94
+ def with_raw_response(self) -> InstancesResourceWithRawResponse:
95
+ """
96
+ This property can be used as a prefix for any HTTP method call to return
97
+ the raw response object instead of the parsed content.
98
+
99
+ For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers
100
+ """
101
+ return InstancesResourceWithRawResponse(self)
102
+
103
+ @cached_property
104
+ def with_streaming_response(self) -> InstancesResourceWithStreamingResponse:
105
+ """
106
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
107
+
108
+ For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response
109
+ """
110
+ return InstancesResourceWithStreamingResponse(self)
111
+
112
+ def create(
113
+ self,
114
+ *,
115
+ project_id: int | None = None,
116
+ region_id: int | None = None,
117
+ flavor: str,
118
+ interfaces: Iterable[instance_create_params.Interface],
119
+ volumes: Iterable[instance_create_params.Volume],
120
+ allow_app_ports: bool | NotGiven = NOT_GIVEN,
121
+ configuration: Optional[object] | NotGiven = NOT_GIVEN,
122
+ name: str | NotGiven = NOT_GIVEN,
123
+ name_template: str | NotGiven = NOT_GIVEN,
124
+ password: str | NotGiven = NOT_GIVEN,
125
+ security_groups: Iterable[instance_create_params.SecurityGroup] | NotGiven = NOT_GIVEN,
126
+ servergroup_id: str | NotGiven = NOT_GIVEN,
127
+ ssh_key_name: Optional[str] | NotGiven = NOT_GIVEN,
128
+ tags: TagUpdateMapParam | NotGiven = NOT_GIVEN,
129
+ user_data: str | NotGiven = NOT_GIVEN,
130
+ username: str | NotGiven = NOT_GIVEN,
131
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
132
+ # The extra values given here take precedence over values defined on the client or passed to this method.
133
+ extra_headers: Headers | None = None,
134
+ extra_query: Query | None = None,
135
+ extra_body: Body | None = None,
136
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
137
+ ) -> TaskIDList:
138
+ """
139
+ For Linux,
140
+
141
+ - Use the `user_data` field to provide a
142
+ <a href=https://cloudinit.readthedocs.io/en/latest/reference/examples.html>cloud-init
143
+ script</a> in base64 to apply configurations to the instance.
144
+ - Specify the `username` and `password` to create a new user.
145
+ - When only `password` is provided, it is set as the password for the default
146
+ user of the image.
147
+ - The `user_data` is ignored when the `password` is specified.
148
+
149
+ For Windows,
150
+
151
+ - Use the `user_data` field to provide a
152
+ <a href=https://cloudbase-init.readthedocs.io/en/latest/userdata.html#cloud-config>cloudbase-init
153
+ script</a> in base64 to create new users on Windows.
154
+ - Use the `password` field to set the password for the 'Admin' user on Windows.
155
+ - The password of the Admin user cannot be updated via `user_data`.
156
+ - The `username` cannot be specified in the request.
157
+
158
+ Args:
159
+ project_id: Project ID
160
+
161
+ region_id: Region ID
162
+
163
+ flavor: The flavor of the instance.
164
+
165
+ interfaces: A list of network interfaces for the instance. You can create one or more
166
+ interfaces - private, public, or both.
167
+
168
+ volumes: List of volumes that will be attached to the instance.
169
+
170
+ allow_app_ports: Set to `true` if creating the instance from an `apptemplate`. This allows
171
+ application ports in the security group for instances created from a marketplace
172
+ application template.
173
+
174
+ configuration: Parameters for the application template if creating the instance from an
175
+ `apptemplate`.
176
+
177
+ name: Instance name.
178
+
179
+ name_template: If you want the instance name to be automatically generated based on IP
180
+ addresses, you can provide a name template instead of specifying the name
181
+ 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}`.
184
+
185
+ password: For Linux instances, 'username' and 'password' are used to create a new user.
186
+ When only 'password' is provided, it is set as the password for the default user
187
+ of the image. For Windows instances, 'username' cannot be specified. Use the
188
+ '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'.
191
+
192
+ security_groups: Specifies security group UUIDs to be applied to all instance network interfaces.
193
+
194
+ servergroup_id: Placement group ID for instance placement policy.
195
+
196
+ Supported group types:
197
+
198
+ - `anti-affinity`: Ensures instances are placed on different hosts for high
199
+ availability.
200
+ - `affinity`: Places instances on the same host for low-latency communication.
201
+ - `soft-anti-affinity`: Tries to place instances on different hosts but allows
202
+ sharing if needed.
203
+
204
+ ssh_key_name: Specifies the name of the SSH keypair, created via the
205
+ <a href="#operation/SSHKeyCollectionViewSet.post">/v1/ssh_keys endpoint</a>.
206
+
207
+ tags: Key-value tags to associate with the resource. A tag is a key-value pair that
208
+ can be associated with a resource, enabling efficient filtering and grouping for
209
+ better organization and management. Some tags are read-only and cannot be
210
+ modified by the user. Tags are also integrated with cost reports, allowing cost
211
+ data to be filtered based on tag keys or values.
212
+
213
+ user_data: String in base64 format. For Linux instances, 'user_data' is ignored when
214
+ '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: https://cloudinit.readthedocs.io/en/latest/topics/examples.html
217
+
218
+ username: For Linux instances, 'username' and 'password' are used to create a new user.
219
+ For Windows instances, 'username' cannot be specified. Use 'password' field to
220
+ set the password for the 'Admin' user on Windows.
221
+
222
+ extra_headers: Send extra headers
223
+
224
+ extra_query: Add additional query parameters to the request
225
+
226
+ extra_body: Add additional JSON properties to the request
227
+
228
+ timeout: Override the client-level default timeout for this request, in seconds
229
+ """
230
+ if project_id is None:
231
+ project_id = self._client._get_cloud_project_id_path_param()
232
+ if region_id is None:
233
+ region_id = self._client._get_cloud_region_id_path_param()
234
+ return self._post(
235
+ f"/cloud/v2/instances/{project_id}/{region_id}",
236
+ body=maybe_transform(
237
+ {
238
+ "flavor": flavor,
239
+ "interfaces": interfaces,
240
+ "volumes": volumes,
241
+ "allow_app_ports": allow_app_ports,
242
+ "configuration": configuration,
243
+ "name": name,
244
+ "name_template": name_template,
245
+ "password": password,
246
+ "security_groups": security_groups,
247
+ "servergroup_id": servergroup_id,
248
+ "ssh_key_name": ssh_key_name,
249
+ "tags": tags,
250
+ "user_data": user_data,
251
+ "username": username,
252
+ },
253
+ instance_create_params.InstanceCreateParams,
254
+ ),
255
+ options=make_request_options(
256
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
257
+ ),
258
+ cast_to=TaskIDList,
259
+ )
260
+
261
+ def create_and_poll(
262
+ self,
263
+ *,
264
+ project_id: int | None = None,
265
+ region_id: int | None = None,
266
+ flavor: str,
267
+ interfaces: Iterable[instance_create_params.Interface],
268
+ volumes: Iterable[instance_create_params.Volume],
269
+ allow_app_ports: bool | NotGiven = NOT_GIVEN,
270
+ configuration: Optional[object] | NotGiven = NOT_GIVEN,
271
+ name: str | NotGiven = NOT_GIVEN,
272
+ name_template: str | NotGiven = NOT_GIVEN,
273
+ password: str | NotGiven = NOT_GIVEN,
274
+ security_groups: Iterable[instance_create_params.SecurityGroup] | NotGiven = NOT_GIVEN,
275
+ servergroup_id: str | NotGiven = NOT_GIVEN,
276
+ ssh_key_name: Optional[str] | NotGiven = NOT_GIVEN,
277
+ tags: TagUpdateMapParam | NotGiven = NOT_GIVEN,
278
+ user_data: str | NotGiven = NOT_GIVEN,
279
+ username: str | NotGiven = NOT_GIVEN,
280
+ polling_interval_seconds: int | NotGiven = NOT_GIVEN,
281
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
282
+ # The extra values given here take precedence over values defined on the client or passed to this method.
283
+ extra_headers: Headers | None = None,
284
+ extra_query: Query | None = None,
285
+ extra_body: Body | None = None,
286
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
287
+ ) -> Instance:
288
+ """Create one or many instances or basic VMs and poll for the result."""
289
+ response = self.create(
290
+ project_id=project_id,
291
+ region_id=region_id,
292
+ flavor=flavor,
293
+ interfaces=interfaces,
294
+ volumes=volumes,
295
+ allow_app_ports=allow_app_ports,
296
+ configuration=configuration,
297
+ name_template=name_template,
298
+ name=name,
299
+ password=password,
300
+ security_groups=security_groups,
301
+ servergroup_id=servergroup_id,
302
+ ssh_key_name=ssh_key_name,
303
+ tags=tags,
304
+ user_data=user_data,
305
+ username=username,
306
+ extra_headers=extra_headers,
307
+ extra_query=extra_query,
308
+ extra_body=extra_body,
309
+ timeout=timeout,
310
+ )
311
+ if not response.tasks or len(response.tasks) != 1:
312
+ raise ValueError(f"Expected exactly one task to be created")
313
+ task = self._client.cloud.tasks.poll(
314
+ task_id=response.tasks[0],
315
+ extra_headers=extra_headers,
316
+ polling_interval_seconds=polling_interval_seconds,
317
+ )
318
+ if (
319
+ not task.created_resources
320
+ or not task.created_resources.instances
321
+ or len(task.created_resources.instances) != 1
322
+ ):
323
+ raise ValueError(f"Expected exactly one resource to be created in a task")
324
+ return self.get(
325
+ instance_id=task.created_resources.instances[0],
326
+ project_id=project_id,
327
+ region_id=region_id,
328
+ extra_headers=extra_headers,
329
+ )
330
+
331
+ def update(
332
+ self,
333
+ instance_id: str,
334
+ *,
335
+ project_id: int | None = None,
336
+ region_id: int | None = None,
337
+ name: str,
338
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
339
+ # The extra values given here take precedence over values defined on the client or passed to this method.
340
+ extra_headers: Headers | None = None,
341
+ extra_query: Query | None = None,
342
+ extra_body: Body | None = None,
343
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
344
+ ) -> Instance:
345
+ """
346
+ Rename instance
347
+
348
+ Args:
349
+ project_id: Project ID
350
+
351
+ region_id: Region ID
352
+
353
+ instance_id: Instance ID
354
+
355
+ name: Name.
356
+
357
+ extra_headers: Send extra headers
358
+
359
+ extra_query: Add additional query parameters to the request
360
+
361
+ extra_body: Add additional JSON properties to the request
362
+
363
+ timeout: Override the client-level default timeout for this request, in seconds
364
+ """
365
+ if project_id is None:
366
+ project_id = self._client._get_cloud_project_id_path_param()
367
+ if region_id is None:
368
+ region_id = self._client._get_cloud_region_id_path_param()
369
+ if not instance_id:
370
+ raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}")
371
+ return self._patch(
372
+ f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}",
373
+ body=maybe_transform({"name": name}, instance_update_params.InstanceUpdateParams),
374
+ options=make_request_options(
375
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
376
+ ),
377
+ cast_to=Instance,
378
+ )
379
+
380
+ def list(
381
+ self,
382
+ *,
383
+ project_id: int | None = None,
384
+ region_id: int | None = None,
385
+ available_floating: bool | NotGiven = NOT_GIVEN,
386
+ changes_before: Union[str, datetime] | NotGiven = NOT_GIVEN,
387
+ changes_since: Union[str, datetime] | NotGiven = NOT_GIVEN,
388
+ exclude_flavor_prefix: str | NotGiven = NOT_GIVEN,
389
+ exclude_secgroup: str | NotGiven = NOT_GIVEN,
390
+ flavor_id: str | NotGiven = NOT_GIVEN,
391
+ flavor_prefix: str | NotGiven = NOT_GIVEN,
392
+ include_ai: bool | NotGiven = NOT_GIVEN,
393
+ include_baremetal: bool | NotGiven = NOT_GIVEN,
394
+ include_k8s: bool | NotGiven = NOT_GIVEN,
395
+ ip: str | NotGiven = NOT_GIVEN,
396
+ limit: int | NotGiven = NOT_GIVEN,
397
+ name: str | NotGiven = NOT_GIVEN,
398
+ offset: int | NotGiven = NOT_GIVEN,
399
+ only_isolated: bool | NotGiven = NOT_GIVEN,
400
+ only_with_fixed_external_ip: bool | NotGiven = NOT_GIVEN,
401
+ order_by: Literal["created.asc", "created.desc", "name.asc", "name.desc"] | NotGiven = NOT_GIVEN,
402
+ profile_name: str | NotGiven = NOT_GIVEN,
403
+ protection_status: Literal["Active", "Queued", "Error"] | NotGiven = NOT_GIVEN,
404
+ status: Literal[
405
+ "ACTIVE",
406
+ "BUILD",
407
+ "ERROR",
408
+ "HARD_REBOOT",
409
+ "MIGRATING",
410
+ "PAUSED",
411
+ "REBOOT",
412
+ "REBUILD",
413
+ "RESIZE",
414
+ "REVERT_RESIZE",
415
+ "SHELVED",
416
+ "SHELVED_OFFLOADED",
417
+ "SHUTOFF",
418
+ "SOFT_DELETED",
419
+ "SUSPENDED",
420
+ "VERIFY_RESIZE",
421
+ ]
422
+ | NotGiven = NOT_GIVEN,
423
+ tag_key_value: str | NotGiven = NOT_GIVEN,
424
+ tag_value: List[str] | NotGiven = NOT_GIVEN,
425
+ type_ddos_profile: Literal["basic", "advanced"] | NotGiven = NOT_GIVEN,
426
+ uuid: str | NotGiven = NOT_GIVEN,
427
+ with_ddos: bool | NotGiven = NOT_GIVEN,
428
+ with_interfaces_name: bool | NotGiven = NOT_GIVEN,
429
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
430
+ # The extra values given here take precedence over values defined on the client or passed to this method.
431
+ extra_headers: Headers | None = None,
432
+ extra_query: Query | None = None,
433
+ extra_body: Body | None = None,
434
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
435
+ ) -> SyncOffsetPage[Instance]:
436
+ """
437
+ List instances
438
+
439
+ Args:
440
+ project_id: Project ID
441
+
442
+ region_id: Region ID
443
+
444
+ available_floating: Only show instances which are able to handle floating address
445
+
446
+ changes_before: Filters the instances by a date and time stamp when the instances last changed.
447
+
448
+ changes_since: Filters the instances by a date and time stamp when the instances last changed
449
+ status.
450
+
451
+ exclude_flavor_prefix: Exclude instances with specified flavor prefix
452
+
453
+ exclude_secgroup: Exclude instances with specified security group name
454
+
455
+ flavor_id: Filter out instances by flavor_id. Flavor id must match exactly.
456
+
457
+ flavor_prefix: Filter out instances by flavor_prefix.
458
+
459
+ include_ai: Include GPU clusters' servers
460
+
461
+ include_baremetal: Include bare metal servers. Please, use `GET /v1/bminstances/` instead
462
+
463
+ include_k8s: Include managed k8s worker nodes
464
+
465
+ ip: An IPv4 address to filter results by. Note: partial matches are allowed. For
466
+ example, searching for 192.168.0.1 will return 192.168.0.1, 192.168.0.10,
467
+ 192.168.0.110, and so on.
468
+
469
+ limit: Optional. Limit the number of returned items
470
+
471
+ name: Filter instances by name. You can provide a full or partial name, instances with
472
+ matching names will be returned. For example, entering 'test' will return all
473
+ instances that contain 'test' in their name.
474
+
475
+ offset: Optional. Offset value is used to exclude the first set of records from the
476
+ result
477
+
478
+ only_isolated: Include only isolated instances
479
+
480
+ only_with_fixed_external_ip: Return bare metals only with external fixed IP addresses.
481
+
482
+ order_by: Order by field and direction.
483
+
484
+ profile_name: Filter result by ddos protection profile name. Effective only with with_ddos set
485
+ to true.
486
+
487
+ protection_status: Filter result by DDoS protection_status. if parameter is provided. Effective
488
+ only with with_ddos set to true. (Active, Queued or Error)
489
+
490
+ status: Filters instances by status.
491
+
492
+ tag_key_value: Optional. Filter by tag key-value pairs. curl -G --data-urlencode
493
+ "tag_key_value={"key": "value"}" --url
494
+ "https://example.com/cloud/v1/resource/1/1"
495
+
496
+ tag_value: Optional. Filter by tag values. ?tag_value=value1&tag_value=value2
497
+
498
+ type_ddos_profile: Return bare metals either only with advanced or only basic DDoS protection.
499
+ Effective only with with_ddos set to true. (advanced or basic)
500
+
501
+ uuid: Filter the server list result by the UUID of the server. Allowed UUID part
502
+
503
+ with_ddos: Include DDoS profile information in the response when set to `true`. Otherwise,
504
+ the `ddos_profile` field in the response is `null` by default.
505
+
506
+ with_interfaces_name: Include `interface_name` in the addresses
507
+
508
+ extra_headers: Send extra headers
509
+
510
+ extra_query: Add additional query parameters to the request
511
+
512
+ extra_body: Add additional JSON properties to the request
513
+
514
+ timeout: Override the client-level default timeout for this request, in seconds
515
+ """
516
+ if project_id is None:
517
+ project_id = self._client._get_cloud_project_id_path_param()
518
+ if region_id is None:
519
+ region_id = self._client._get_cloud_region_id_path_param()
520
+ return self._get_api_list(
521
+ f"/cloud/v1/instances/{project_id}/{region_id}",
522
+ page=SyncOffsetPage[Instance],
523
+ options=make_request_options(
524
+ extra_headers=extra_headers,
525
+ extra_query=extra_query,
526
+ extra_body=extra_body,
527
+ timeout=timeout,
528
+ query=maybe_transform(
529
+ {
530
+ "available_floating": available_floating,
531
+ "changes_before": changes_before,
532
+ "changes_since": changes_since,
533
+ "exclude_flavor_prefix": exclude_flavor_prefix,
534
+ "exclude_secgroup": exclude_secgroup,
535
+ "flavor_id": flavor_id,
536
+ "flavor_prefix": flavor_prefix,
537
+ "include_ai": include_ai,
538
+ "include_baremetal": include_baremetal,
539
+ "include_k8s": include_k8s,
540
+ "ip": ip,
541
+ "limit": limit,
542
+ "name": name,
543
+ "offset": offset,
544
+ "only_isolated": only_isolated,
545
+ "only_with_fixed_external_ip": only_with_fixed_external_ip,
546
+ "order_by": order_by,
547
+ "profile_name": profile_name,
548
+ "protection_status": protection_status,
549
+ "status": status,
550
+ "tag_key_value": tag_key_value,
551
+ "tag_value": tag_value,
552
+ "type_ddos_profile": type_ddos_profile,
553
+ "uuid": uuid,
554
+ "with_ddos": with_ddos,
555
+ "with_interfaces_name": with_interfaces_name,
556
+ },
557
+ instance_list_params.InstanceListParams,
558
+ ),
559
+ ),
560
+ model=Instance,
561
+ )
562
+
563
+ def delete(
564
+ self,
565
+ instance_id: str,
566
+ *,
567
+ project_id: int | None = None,
568
+ region_id: int | None = None,
569
+ delete_floatings: bool | NotGiven = NOT_GIVEN,
570
+ floatings: str | NotGiven = NOT_GIVEN,
571
+ reserved_fixed_ips: str | NotGiven = NOT_GIVEN,
572
+ volumes: str | NotGiven = NOT_GIVEN,
573
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
574
+ # The extra values given here take precedence over values defined on the client or passed to this method.
575
+ extra_headers: Headers | None = None,
576
+ extra_query: Query | None = None,
577
+ extra_body: Body | None = None,
578
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
579
+ ) -> TaskIDList:
580
+ """
581
+ Delete instance
582
+
583
+ Args:
584
+ project_id: Project ID
585
+
586
+ region_id: Region ID
587
+
588
+ instance_id: Instance ID
589
+
590
+ delete_floatings: True if it is required to delete floating IPs assigned to the instance. Can't be
591
+ used with `floatings`.
592
+
593
+ floatings: Comma separated list of floating ids that should be deleted. Can't be used with
594
+ `delete_floatings`.
595
+
596
+ reserved_fixed_ips: Comma separated list of port IDs to be deleted with the instance
597
+
598
+ volumes: Comma separated list of volume IDs to be deleted with the instance
599
+
600
+ extra_headers: Send extra headers
601
+
602
+ extra_query: Add additional query parameters to the request
603
+
604
+ extra_body: Add additional JSON properties to the request
605
+
606
+ timeout: Override the client-level default timeout for this request, in seconds
607
+ """
608
+ if project_id is None:
609
+ project_id = self._client._get_cloud_project_id_path_param()
610
+ if region_id is None:
611
+ region_id = self._client._get_cloud_region_id_path_param()
612
+ if not instance_id:
613
+ raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}")
614
+ return self._delete(
615
+ f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}",
616
+ options=make_request_options(
617
+ extra_headers=extra_headers,
618
+ extra_query=extra_query,
619
+ extra_body=extra_body,
620
+ timeout=timeout,
621
+ query=maybe_transform(
622
+ {
623
+ "delete_floatings": delete_floatings,
624
+ "floatings": floatings,
625
+ "reserved_fixed_ips": reserved_fixed_ips,
626
+ "volumes": volumes,
627
+ },
628
+ instance_delete_params.InstanceDeleteParams,
629
+ ),
630
+ ),
631
+ cast_to=TaskIDList,
632
+ )
633
+
634
+ def delete_and_poll(
635
+ self,
636
+ instance_id: str,
637
+ *,
638
+ project_id: int | None = None,
639
+ region_id: int | None = None,
640
+ delete_floatings: bool | NotGiven = NOT_GIVEN,
641
+ floatings: str | NotGiven = NOT_GIVEN,
642
+ reserved_fixed_ips: str | NotGiven = NOT_GIVEN,
643
+ volumes: str | NotGiven = NOT_GIVEN,
644
+ polling_interval_seconds: int | NotGiven = NOT_GIVEN,
645
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
646
+ # The extra values given here take precedence over values defined on the client or passed to this method.
647
+ extra_headers: Headers | None = None,
648
+ extra_query: Query | None = None,
649
+ extra_body: Body | None = None,
650
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
651
+ ) -> None:
652
+ """
653
+ Delete instance and poll for the result
654
+ """
655
+ response = self.delete(
656
+ instance_id=instance_id,
657
+ project_id=project_id,
658
+ region_id=region_id,
659
+ delete_floatings=delete_floatings,
660
+ floatings=floatings,
661
+ reserved_fixed_ips=reserved_fixed_ips,
662
+ volumes=volumes,
663
+ extra_headers=extra_headers,
664
+ extra_query=extra_query,
665
+ extra_body=extra_body,
666
+ timeout=timeout,
667
+ )
668
+ if not response.tasks or len(response.tasks) != 1:
669
+ raise ValueError(f"Expected exactly one task to be created")
670
+ self._client.cloud.tasks.poll(
671
+ task_id=response.tasks[0],
672
+ extra_headers=extra_headers,
673
+ polling_interval_seconds=polling_interval_seconds,
674
+ )
675
+
676
+ @overload
677
+ def action(
678
+ self,
679
+ instance_id: str,
680
+ *,
681
+ project_id: int | None = None,
682
+ region_id: int | None = None,
683
+ action: Literal["start"],
684
+ activate_profile: Optional[bool] | NotGiven = NOT_GIVEN,
685
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
686
+ # The extra values given here take precedence over values defined on the client or passed to this method.
687
+ extra_headers: Headers | None = None,
688
+ extra_query: Query | None = None,
689
+ extra_body: Body | None = None,
690
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
691
+ ) -> TaskIDList:
692
+ """
693
+ The action can be one of: start, stop, reboot, powercycle, suspend or resume.
694
+ Suspend and resume are not available for baremetal instances.
695
+
696
+ Args:
697
+ action: Instance action name
698
+
699
+ activate_profile: Used on start instance to activate Advanced DDoS profile
700
+
701
+ extra_headers: Send extra headers
702
+
703
+ extra_query: Add additional query parameters to the request
704
+
705
+ extra_body: Add additional JSON properties to the request
706
+
707
+ timeout: Override the client-level default timeout for this request, in seconds
708
+ """
709
+ ...
710
+
711
+ @overload
712
+ def action(
713
+ self,
714
+ instance_id: str,
715
+ *,
716
+ project_id: int | None = None,
717
+ region_id: int | None = None,
718
+ action: Literal["reboot", "reboot_hard", "resume", "stop", "suspend"],
719
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
720
+ # The extra values given here take precedence over values defined on the client or passed to this method.
721
+ extra_headers: Headers | None = None,
722
+ extra_query: Query | None = None,
723
+ extra_body: Body | None = None,
724
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
725
+ ) -> TaskIDList:
726
+ """
727
+ The action can be one of: start, stop, reboot, powercycle, suspend or resume.
728
+ Suspend and resume are not available for baremetal instances.
729
+
730
+ Args:
731
+ action: Instance action name
732
+
733
+ extra_headers: Send extra headers
734
+
735
+ extra_query: Add additional query parameters to the request
736
+
737
+ extra_body: Add additional JSON properties to the request
738
+
739
+ timeout: Override the client-level default timeout for this request, in seconds
740
+ """
741
+ ...
742
+
743
+ @required_args(["action"])
744
+ def action(
745
+ self,
746
+ instance_id: str,
747
+ *,
748
+ project_id: int | None = None,
749
+ region_id: int | None = None,
750
+ action: Literal["start"] | Literal["reboot", "reboot_hard", "resume", "stop", "suspend"],
751
+ activate_profile: Optional[bool] | NotGiven = NOT_GIVEN,
752
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
753
+ # The extra values given here take precedence over values defined on the client or passed to this method.
754
+ extra_headers: Headers | None = None,
755
+ extra_query: Query | None = None,
756
+ extra_body: Body | None = None,
757
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
758
+ ) -> TaskIDList:
759
+ if project_id is None:
760
+ project_id = self._client._get_cloud_project_id_path_param()
761
+ if region_id is None:
762
+ region_id = self._client._get_cloud_region_id_path_param()
763
+ if not instance_id:
764
+ raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}")
765
+ return self._post(
766
+ f"/cloud/v2/instances/{project_id}/{region_id}/{instance_id}/action",
767
+ body=maybe_transform(
768
+ {
769
+ "action": action,
770
+ "activate_profile": activate_profile,
771
+ },
772
+ instance_action_params.InstanceActionParams,
773
+ ),
774
+ options=make_request_options(
775
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
776
+ ),
777
+ cast_to=TaskIDList,
778
+ )
779
+
780
+ def add_to_placement_group(
781
+ self,
782
+ instance_id: str,
783
+ *,
784
+ project_id: int | None = None,
785
+ region_id: int | None = None,
786
+ servergroup_id: str,
787
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
788
+ # The extra values given here take precedence over values defined on the client or passed to this method.
789
+ extra_headers: Headers | None = None,
790
+ extra_query: Query | None = None,
791
+ extra_body: Body | None = None,
792
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
793
+ ) -> TaskIDList:
794
+ """
795
+ Put instance into the server group
796
+
797
+ Args:
798
+ servergroup_id: Anti-affinity or affinity or soft-anti-affinity server group ID.
799
+
800
+ extra_headers: Send extra headers
801
+
802
+ extra_query: Add additional query parameters to the request
803
+
804
+ extra_body: Add additional JSON properties to the request
805
+
806
+ timeout: Override the client-level default timeout for this request, in seconds
807
+ """
808
+ if project_id is None:
809
+ project_id = self._client._get_cloud_project_id_path_param()
810
+ if region_id is None:
811
+ region_id = self._client._get_cloud_region_id_path_param()
812
+ if not instance_id:
813
+ raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}")
814
+ return self._post(
815
+ f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/put_into_servergroup",
816
+ body=maybe_transform(
817
+ {"servergroup_id": servergroup_id},
818
+ instance_add_to_placement_group_params.InstanceAddToPlacementGroupParams,
819
+ ),
820
+ options=make_request_options(
821
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
822
+ ),
823
+ cast_to=TaskIDList,
824
+ )
825
+
826
+ def add_to_placement_group_and_poll(
827
+ self,
828
+ instance_id: str,
829
+ *,
830
+ project_id: int | None = None,
831
+ region_id: int | None = None,
832
+ servergroup_id: str,
833
+ polling_interval_seconds: int | NotGiven = NOT_GIVEN,
834
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
835
+ # The extra values given here take precedence over values defined on the client or passed to this method.
836
+ extra_headers: Headers | None = None,
837
+ extra_query: Query | None = None,
838
+ extra_body: Body | None = None,
839
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
840
+ ) -> Instance:
841
+ """
842
+ Put instance into the server group and poll for the result
843
+ """
844
+ response = self.add_to_placement_group(
845
+ instance_id=instance_id,
846
+ project_id=project_id,
847
+ region_id=region_id,
848
+ servergroup_id=servergroup_id,
849
+ extra_headers=extra_headers,
850
+ extra_query=extra_query,
851
+ extra_body=extra_body,
852
+ timeout=timeout,
853
+ )
854
+ if not response.tasks or len(response.tasks) != 1:
855
+ raise ValueError(f"Expected exactly one task to be created")
856
+ self._client.cloud.tasks.poll(
857
+ task_id=response.tasks[0],
858
+ extra_headers=extra_headers,
859
+ polling_interval_seconds=polling_interval_seconds,
860
+ )
861
+ return self.get(
862
+ instance_id=instance_id,
863
+ project_id=project_id,
864
+ region_id=region_id,
865
+ extra_headers=extra_headers,
866
+ )
867
+
868
+ def assign_security_group(
869
+ self,
870
+ instance_id: str,
871
+ *,
872
+ project_id: int | None = None,
873
+ region_id: int | None = None,
874
+ name: str | NotGiven = NOT_GIVEN,
875
+ ports_security_group_names: Iterable[instance_assign_security_group_params.PortsSecurityGroupName]
876
+ | NotGiven = NOT_GIVEN,
877
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
878
+ # The extra values given here take precedence over values defined on the client or passed to this method.
879
+ extra_headers: Headers | None = None,
880
+ extra_query: Query | None = None,
881
+ extra_body: Body | None = None,
882
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
883
+ ) -> None:
884
+ """Assign the security group to the server.
885
+
886
+ To assign multiple security groups to
887
+ all ports, use the NULL value for the port_id field
888
+
889
+ Args:
890
+ name: Security group name, applies to all ports
891
+
892
+ ports_security_group_names: Port security groups mapping
893
+
894
+ extra_headers: Send extra headers
895
+
896
+ extra_query: Add additional query parameters to the request
897
+
898
+ extra_body: Add additional JSON properties to the request
899
+
900
+ timeout: Override the client-level default timeout for this request, in seconds
901
+ """
902
+ if project_id is None:
903
+ project_id = self._client._get_cloud_project_id_path_param()
904
+ if region_id is None:
905
+ region_id = self._client._get_cloud_region_id_path_param()
906
+ if not instance_id:
907
+ raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}")
908
+ extra_headers = {"Accept": "*/*", **(extra_headers or {})}
909
+ return self._post(
910
+ f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/addsecuritygroup",
911
+ body=maybe_transform(
912
+ {
913
+ "name": name,
914
+ "ports_security_group_names": ports_security_group_names,
915
+ },
916
+ instance_assign_security_group_params.InstanceAssignSecurityGroupParams,
917
+ ),
918
+ options=make_request_options(
919
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
920
+ ),
921
+ cast_to=NoneType,
922
+ )
923
+
924
+ def disable_port_security(
925
+ self,
926
+ port_id: str,
927
+ *,
928
+ project_id: int | None = None,
929
+ region_id: int | None = None,
930
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
931
+ # The extra values given here take precedence over values defined on the client or passed to this method.
932
+ extra_headers: Headers | None = None,
933
+ extra_query: Query | None = None,
934
+ extra_body: Body | None = None,
935
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
936
+ ) -> InstanceInterface:
937
+ """
938
+ Disable port security for instance interface
939
+
940
+ Args:
941
+ extra_headers: Send extra headers
942
+
943
+ extra_query: Add additional query parameters to the request
944
+
945
+ extra_body: Add additional JSON properties to the request
946
+
947
+ timeout: Override the client-level default timeout for this request, in seconds
948
+ """
949
+ if project_id is None:
950
+ project_id = self._client._get_cloud_project_id_path_param()
951
+ if region_id is None:
952
+ region_id = self._client._get_cloud_region_id_path_param()
953
+ if not port_id:
954
+ raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}")
955
+ return self._post(
956
+ f"/cloud/v1/ports/{project_id}/{region_id}/{port_id}/disable_port_security",
957
+ options=make_request_options(
958
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
959
+ ),
960
+ cast_to=InstanceInterface,
961
+ )
962
+
963
+ def enable_port_security(
964
+ self,
965
+ port_id: str,
966
+ *,
967
+ project_id: int | None = None,
968
+ region_id: int | None = None,
969
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
970
+ # The extra values given here take precedence over values defined on the client or passed to this method.
971
+ extra_headers: Headers | None = None,
972
+ extra_query: Query | None = None,
973
+ extra_body: Body | None = None,
974
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
975
+ ) -> InstanceInterface:
976
+ """
977
+ Enable port security for instance interface
978
+
979
+ Args:
980
+ extra_headers: Send extra headers
981
+
982
+ extra_query: Add additional query parameters to the request
983
+
984
+ extra_body: Add additional JSON properties to the request
985
+
986
+ timeout: Override the client-level default timeout for this request, in seconds
987
+ """
988
+ if project_id is None:
989
+ project_id = self._client._get_cloud_project_id_path_param()
990
+ if region_id is None:
991
+ region_id = self._client._get_cloud_region_id_path_param()
992
+ if not port_id:
993
+ raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}")
994
+ return self._post(
995
+ f"/cloud/v1/ports/{project_id}/{region_id}/{port_id}/enable_port_security",
996
+ options=make_request_options(
997
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
998
+ ),
999
+ cast_to=InstanceInterface,
1000
+ )
1001
+
1002
+ def get(
1003
+ self,
1004
+ instance_id: str,
1005
+ *,
1006
+ project_id: int | None = None,
1007
+ region_id: int | None = None,
1008
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1009
+ # The extra values given here take precedence over values defined on the client or passed to this method.
1010
+ extra_headers: Headers | None = None,
1011
+ extra_query: Query | None = None,
1012
+ extra_body: Body | None = None,
1013
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
1014
+ ) -> Instance:
1015
+ """
1016
+ **Cookie Parameters**:
1017
+
1018
+ - `language` (str, optional): Language for the response content. Affects the
1019
+ `ddos_profile` field. Supported values:
1020
+ - `'en'` (default)
1021
+ - `'de'`
1022
+ - `'ru'`
1023
+
1024
+ Args:
1025
+ project_id: Project ID
1026
+
1027
+ region_id: Region ID
1028
+
1029
+ instance_id: Instance ID
1030
+
1031
+ extra_headers: Send extra headers
1032
+
1033
+ extra_query: Add additional query parameters to the request
1034
+
1035
+ extra_body: Add additional JSON properties to the request
1036
+
1037
+ timeout: Override the client-level default timeout for this request, in seconds
1038
+ """
1039
+ if project_id is None:
1040
+ project_id = self._client._get_cloud_project_id_path_param()
1041
+ if region_id is None:
1042
+ region_id = self._client._get_cloud_region_id_path_param()
1043
+ if not instance_id:
1044
+ raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}")
1045
+ return self._get(
1046
+ f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}",
1047
+ options=make_request_options(
1048
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
1049
+ ),
1050
+ cast_to=Instance,
1051
+ )
1052
+
1053
+ def get_console(
1054
+ self,
1055
+ instance_id: str,
1056
+ *,
1057
+ project_id: int | None = None,
1058
+ region_id: int | None = None,
1059
+ console_type: str | NotGiven = NOT_GIVEN,
1060
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1061
+ # The extra values given here take precedence over values defined on the client or passed to this method.
1062
+ extra_headers: Headers | None = None,
1063
+ extra_query: Query | None = None,
1064
+ extra_body: Body | None = None,
1065
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
1066
+ ) -> Console:
1067
+ """
1068
+ Get instance console URL
1069
+
1070
+ Args:
1071
+ console_type: Console type
1072
+
1073
+ extra_headers: Send extra headers
1074
+
1075
+ extra_query: Add additional query parameters to the request
1076
+
1077
+ extra_body: Add additional JSON properties to the request
1078
+
1079
+ timeout: Override the client-level default timeout for this request, in seconds
1080
+ """
1081
+ if project_id is None:
1082
+ project_id = self._client._get_cloud_project_id_path_param()
1083
+ if region_id is None:
1084
+ region_id = self._client._get_cloud_region_id_path_param()
1085
+ if not instance_id:
1086
+ raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}")
1087
+ return self._get(
1088
+ f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/get_console",
1089
+ options=make_request_options(
1090
+ extra_headers=extra_headers,
1091
+ extra_query=extra_query,
1092
+ extra_body=extra_body,
1093
+ timeout=timeout,
1094
+ query=maybe_transform(
1095
+ {"console_type": console_type}, instance_get_console_params.InstanceGetConsoleParams
1096
+ ),
1097
+ ),
1098
+ cast_to=Console,
1099
+ )
1100
+
1101
+ def remove_from_placement_group(
1102
+ self,
1103
+ instance_id: str,
1104
+ *,
1105
+ project_id: int | None = None,
1106
+ region_id: int | None = None,
1107
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1108
+ # The extra values given here take precedence over values defined on the client or passed to this method.
1109
+ extra_headers: Headers | None = None,
1110
+ extra_query: Query | None = None,
1111
+ extra_body: Body | None = None,
1112
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
1113
+ ) -> TaskIDList:
1114
+ """
1115
+ Remove instance from the server group
1116
+
1117
+ Args:
1118
+ extra_headers: Send extra headers
1119
+
1120
+ extra_query: Add additional query parameters to the request
1121
+
1122
+ extra_body: Add additional JSON properties to the request
1123
+
1124
+ timeout: Override the client-level default timeout for this request, in seconds
1125
+ """
1126
+ if project_id is None:
1127
+ project_id = self._client._get_cloud_project_id_path_param()
1128
+ if region_id is None:
1129
+ region_id = self._client._get_cloud_region_id_path_param()
1130
+ if not instance_id:
1131
+ raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}")
1132
+ return self._post(
1133
+ f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/remove_from_servergroup",
1134
+ options=make_request_options(
1135
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
1136
+ ),
1137
+ cast_to=TaskIDList,
1138
+ )
1139
+
1140
+ def remove_from_placement_group_and_poll(
1141
+ self,
1142
+ instance_id: str,
1143
+ *,
1144
+ project_id: int | None = None,
1145
+ region_id: int | None = None,
1146
+ polling_interval_seconds: int | NotGiven = NOT_GIVEN,
1147
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1148
+ # The extra values given here take precedence over values defined on the client or passed to this method.
1149
+ extra_headers: Headers | None = None,
1150
+ extra_query: Query | None = None,
1151
+ extra_body: Body | None = None,
1152
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
1153
+ ) -> Instance:
1154
+ """
1155
+ Remove instance from the server group and poll for the result
1156
+ """
1157
+ response = self.remove_from_placement_group(
1158
+ instance_id=instance_id,
1159
+ project_id=project_id,
1160
+ region_id=region_id,
1161
+ extra_headers=extra_headers,
1162
+ extra_query=extra_query,
1163
+ extra_body=extra_body,
1164
+ timeout=timeout,
1165
+ )
1166
+ if not response.tasks or len(response.tasks) != 1:
1167
+ raise ValueError(f"Expected exactly one task to be created")
1168
+ self._client.cloud.tasks.poll(
1169
+ task_id=response.tasks[0],
1170
+ extra_headers=extra_headers,
1171
+ polling_interval_seconds=polling_interval_seconds,
1172
+ )
1173
+ return self.get(
1174
+ instance_id=instance_id,
1175
+ project_id=project_id,
1176
+ region_id=region_id,
1177
+ extra_headers=extra_headers,
1178
+ )
1179
+
1180
+ def resize(
1181
+ self,
1182
+ instance_id: str,
1183
+ *,
1184
+ project_id: int | None = None,
1185
+ region_id: int | None = None,
1186
+ flavor_id: str,
1187
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1188
+ # The extra values given here take precedence over values defined on the client or passed to this method.
1189
+ extra_headers: Headers | None = None,
1190
+ extra_query: Query | None = None,
1191
+ extra_body: Body | None = None,
1192
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
1193
+ ) -> TaskIDList:
1194
+ """
1195
+ Change flavor of the instance
1196
+
1197
+ Args:
1198
+ flavor_id: Flavor ID
1199
+
1200
+ extra_headers: Send extra headers
1201
+
1202
+ extra_query: Add additional query parameters to the request
1203
+
1204
+ extra_body: Add additional JSON properties to the request
1205
+
1206
+ timeout: Override the client-level default timeout for this request, in seconds
1207
+ """
1208
+ if project_id is None:
1209
+ project_id = self._client._get_cloud_project_id_path_param()
1210
+ if region_id is None:
1211
+ region_id = self._client._get_cloud_region_id_path_param()
1212
+ if not instance_id:
1213
+ raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}")
1214
+ return self._post(
1215
+ f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/changeflavor",
1216
+ body=maybe_transform({"flavor_id": flavor_id}, instance_resize_params.InstanceResizeParams),
1217
+ options=make_request_options(
1218
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
1219
+ ),
1220
+ cast_to=TaskIDList,
1221
+ )
1222
+
1223
+ def resize_and_poll(
1224
+ self,
1225
+ instance_id: str,
1226
+ *,
1227
+ project_id: int | None = None,
1228
+ region_id: int | None = None,
1229
+ flavor_id: str,
1230
+ polling_interval_seconds: int | NotGiven = NOT_GIVEN,
1231
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1232
+ # The extra values given here take precedence over values defined on the client or passed to this method.
1233
+ extra_headers: Headers | None = None,
1234
+ extra_query: Query | None = None,
1235
+ extra_body: Body | None = None,
1236
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
1237
+ ) -> Instance:
1238
+ """
1239
+ Change flavor of the instance and poll for the result
1240
+ """
1241
+ response = self.resize(
1242
+ instance_id=instance_id,
1243
+ project_id=project_id,
1244
+ region_id=region_id,
1245
+ flavor_id=flavor_id,
1246
+ extra_headers=extra_headers,
1247
+ extra_query=extra_query,
1248
+ extra_body=extra_body,
1249
+ timeout=timeout,
1250
+ )
1251
+ if not response.tasks or len(response.tasks) != 1:
1252
+ raise ValueError(f"Expected exactly one task to be created")
1253
+ self._client.cloud.tasks.poll(
1254
+ task_id=response.tasks[0],
1255
+ extra_headers=extra_headers,
1256
+ polling_interval_seconds=polling_interval_seconds,
1257
+ )
1258
+ return self.get(
1259
+ instance_id=instance_id,
1260
+ project_id=project_id,
1261
+ region_id=region_id,
1262
+ extra_headers=extra_headers,
1263
+ )
1264
+
1265
+ def unassign_security_group(
1266
+ self,
1267
+ instance_id: str,
1268
+ *,
1269
+ project_id: int | None = None,
1270
+ region_id: int | None = None,
1271
+ name: str | NotGiven = NOT_GIVEN,
1272
+ ports_security_group_names: Iterable[instance_unassign_security_group_params.PortsSecurityGroupName]
1273
+ | NotGiven = NOT_GIVEN,
1274
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1275
+ # The extra values given here take precedence over values defined on the client or passed to this method.
1276
+ extra_headers: Headers | None = None,
1277
+ extra_query: Query | None = None,
1278
+ extra_body: Body | None = None,
1279
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
1280
+ ) -> None:
1281
+ """Un-assign the security group to the server.
1282
+
1283
+ To un-assign multiple security
1284
+ groups to all ports, use the NULL value for the port_id field
1285
+
1286
+ Args:
1287
+ name: Security group name, applies to all ports
1288
+
1289
+ ports_security_group_names: Port security groups mapping
1290
+
1291
+ extra_headers: Send extra headers
1292
+
1293
+ extra_query: Add additional query parameters to the request
1294
+
1295
+ extra_body: Add additional JSON properties to the request
1296
+
1297
+ timeout: Override the client-level default timeout for this request, in seconds
1298
+ """
1299
+ if project_id is None:
1300
+ project_id = self._client._get_cloud_project_id_path_param()
1301
+ if region_id is None:
1302
+ region_id = self._client._get_cloud_region_id_path_param()
1303
+ if not instance_id:
1304
+ raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}")
1305
+ extra_headers = {"Accept": "*/*", **(extra_headers or {})}
1306
+ return self._post(
1307
+ f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/delsecuritygroup",
1308
+ body=maybe_transform(
1309
+ {
1310
+ "name": name,
1311
+ "ports_security_group_names": ports_security_group_names,
1312
+ },
1313
+ instance_unassign_security_group_params.InstanceUnassignSecurityGroupParams,
1314
+ ),
1315
+ options=make_request_options(
1316
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
1317
+ ),
1318
+ cast_to=NoneType,
1319
+ )
1320
+
1321
+
1322
+ class AsyncInstancesResource(AsyncAPIResource):
1323
+ @cached_property
1324
+ def flavors(self) -> AsyncFlavorsResource:
1325
+ return AsyncFlavorsResource(self._client)
1326
+
1327
+ @cached_property
1328
+ def interfaces(self) -> AsyncInterfacesResource:
1329
+ return AsyncInterfacesResource(self._client)
1330
+
1331
+ @cached_property
1332
+ def images(self) -> AsyncImagesResource:
1333
+ return AsyncImagesResource(self._client)
1334
+
1335
+ @cached_property
1336
+ def metrics(self) -> AsyncMetricsResource:
1337
+ return AsyncMetricsResource(self._client)
1338
+
1339
+ @cached_property
1340
+ def with_raw_response(self) -> AsyncInstancesResourceWithRawResponse:
1341
+ """
1342
+ This property can be used as a prefix for any HTTP method call to return
1343
+ the raw response object instead of the parsed content.
1344
+
1345
+ For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers
1346
+ """
1347
+ return AsyncInstancesResourceWithRawResponse(self)
1348
+
1349
+ @cached_property
1350
+ def with_streaming_response(self) -> AsyncInstancesResourceWithStreamingResponse:
1351
+ """
1352
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
1353
+
1354
+ For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response
1355
+ """
1356
+ return AsyncInstancesResourceWithStreamingResponse(self)
1357
+
1358
+ async def create(
1359
+ self,
1360
+ *,
1361
+ project_id: int | None = None,
1362
+ region_id: int | None = None,
1363
+ flavor: str,
1364
+ interfaces: Iterable[instance_create_params.Interface],
1365
+ volumes: Iterable[instance_create_params.Volume],
1366
+ allow_app_ports: bool | NotGiven = NOT_GIVEN,
1367
+ configuration: Optional[object] | NotGiven = NOT_GIVEN,
1368
+ name: str | NotGiven = NOT_GIVEN,
1369
+ name_template: str | NotGiven = NOT_GIVEN,
1370
+ password: str | NotGiven = NOT_GIVEN,
1371
+ security_groups: Iterable[instance_create_params.SecurityGroup] | NotGiven = NOT_GIVEN,
1372
+ servergroup_id: str | NotGiven = NOT_GIVEN,
1373
+ ssh_key_name: Optional[str] | NotGiven = NOT_GIVEN,
1374
+ tags: TagUpdateMapParam | NotGiven = NOT_GIVEN,
1375
+ user_data: str | NotGiven = NOT_GIVEN,
1376
+ username: str | NotGiven = NOT_GIVEN,
1377
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1378
+ # The extra values given here take precedence over values defined on the client or passed to this method.
1379
+ extra_headers: Headers | None = None,
1380
+ extra_query: Query | None = None,
1381
+ extra_body: Body | None = None,
1382
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
1383
+ ) -> TaskIDList:
1384
+ """
1385
+ For Linux,
1386
+
1387
+ - Use the `user_data` field to provide a
1388
+ <a href=https://cloudinit.readthedocs.io/en/latest/reference/examples.html>cloud-init
1389
+ script</a> in base64 to apply configurations to the instance.
1390
+ - Specify the `username` and `password` to create a new user.
1391
+ - When only `password` is provided, it is set as the password for the default
1392
+ user of the image.
1393
+ - The `user_data` is ignored when the `password` is specified.
1394
+
1395
+ For Windows,
1396
+
1397
+ - Use the `user_data` field to provide a
1398
+ <a href=https://cloudbase-init.readthedocs.io/en/latest/userdata.html#cloud-config>cloudbase-init
1399
+ script</a> in base64 to create new users on Windows.
1400
+ - Use the `password` field to set the password for the 'Admin' user on Windows.
1401
+ - The password of the Admin user cannot be updated via `user_data`.
1402
+ - The `username` cannot be specified in the request.
1403
+
1404
+ Args:
1405
+ project_id: Project ID
1406
+
1407
+ region_id: Region ID
1408
+
1409
+ flavor: The flavor of the instance.
1410
+
1411
+ interfaces: A list of network interfaces for the instance. You can create one or more
1412
+ interfaces - private, public, or both.
1413
+
1414
+ volumes: List of volumes that will be attached to the instance.
1415
+
1416
+ allow_app_ports: Set to `true` if creating the instance from an `apptemplate`. This allows
1417
+ application ports in the security group for instances created from a marketplace
1418
+ application template.
1419
+
1420
+ configuration: Parameters for the application template if creating the instance from an
1421
+ `apptemplate`.
1422
+
1423
+ name: Instance name.
1424
+
1425
+ name_template: If you want the instance name to be automatically generated based on IP
1426
+ addresses, you can provide a name template instead of specifying the name
1427
+ manually. The template should include a placeholder that will be replaced during
1428
+ provisioning. Supported placeholders are: `{ip_octets}` (last 3 octets of the
1429
+ IP), `{two_ip_octets}`, and `{one_ip_octet}`.
1430
+
1431
+ password: For Linux instances, 'username' and 'password' are used to create a new user.
1432
+ When only 'password' is provided, it is set as the password for the default user
1433
+ of the image. For Windows instances, 'username' cannot be specified. Use the
1434
+ 'password' field to set the password for the 'Admin' user on Windows. Use the
1435
+ 'user_data' field to provide a script to create new users on Windows. The
1436
+ password of the Admin user cannot be updated via 'user_data'.
1437
+
1438
+ security_groups: Specifies security group UUIDs to be applied to all instance network interfaces.
1439
+
1440
+ servergroup_id: Placement group ID for instance placement policy.
1441
+
1442
+ Supported group types:
1443
+
1444
+ - `anti-affinity`: Ensures instances are placed on different hosts for high
1445
+ availability.
1446
+ - `affinity`: Places instances on the same host for low-latency communication.
1447
+ - `soft-anti-affinity`: Tries to place instances on different hosts but allows
1448
+ sharing if needed.
1449
+
1450
+ ssh_key_name: Specifies the name of the SSH keypair, created via the
1451
+ <a href="#operation/SSHKeyCollectionViewSet.post">/v1/ssh_keys endpoint</a>.
1452
+
1453
+ tags: Key-value tags to associate with the resource. A tag is a key-value pair that
1454
+ can be associated with a resource, enabling efficient filtering and grouping for
1455
+ better organization and management. Some tags are read-only and cannot be
1456
+ modified by the user. Tags are also integrated with cost reports, allowing cost
1457
+ data to be filtered based on tag keys or values.
1458
+
1459
+ user_data: String in base64 format. For Linux instances, 'user_data' is ignored when
1460
+ 'password' field is provided. For Windows instances, Admin user password is set
1461
+ by 'password' field and cannot be updated via 'user_data'. Examples of the
1462
+ user_data: https://cloudinit.readthedocs.io/en/latest/topics/examples.html
1463
+
1464
+ username: For Linux instances, 'username' and 'password' are used to create a new user.
1465
+ For Windows instances, 'username' cannot be specified. Use 'password' field to
1466
+ set the password for the 'Admin' user on Windows.
1467
+
1468
+ extra_headers: Send extra headers
1469
+
1470
+ extra_query: Add additional query parameters to the request
1471
+
1472
+ extra_body: Add additional JSON properties to the request
1473
+
1474
+ timeout: Override the client-level default timeout for this request, in seconds
1475
+ """
1476
+ if project_id is None:
1477
+ project_id = self._client._get_cloud_project_id_path_param()
1478
+ if region_id is None:
1479
+ region_id = self._client._get_cloud_region_id_path_param()
1480
+ return await self._post(
1481
+ f"/cloud/v2/instances/{project_id}/{region_id}",
1482
+ body=await async_maybe_transform(
1483
+ {
1484
+ "flavor": flavor,
1485
+ "interfaces": interfaces,
1486
+ "volumes": volumes,
1487
+ "allow_app_ports": allow_app_ports,
1488
+ "configuration": configuration,
1489
+ "name": name,
1490
+ "name_template": name_template,
1491
+ "password": password,
1492
+ "security_groups": security_groups,
1493
+ "servergroup_id": servergroup_id,
1494
+ "ssh_key_name": ssh_key_name,
1495
+ "tags": tags,
1496
+ "user_data": user_data,
1497
+ "username": username,
1498
+ },
1499
+ instance_create_params.InstanceCreateParams,
1500
+ ),
1501
+ options=make_request_options(
1502
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
1503
+ ),
1504
+ cast_to=TaskIDList,
1505
+ )
1506
+
1507
+ async def create_and_poll(
1508
+ self,
1509
+ *,
1510
+ project_id: int | None = None,
1511
+ region_id: int | None = None,
1512
+ flavor: str,
1513
+ interfaces: Iterable[instance_create_params.Interface],
1514
+ volumes: Iterable[instance_create_params.Volume],
1515
+ allow_app_ports: bool | NotGiven = NOT_GIVEN,
1516
+ configuration: Optional[object] | NotGiven = NOT_GIVEN,
1517
+ name: str | NotGiven = NOT_GIVEN,
1518
+ name_template: str | NotGiven = NOT_GIVEN,
1519
+ password: str | NotGiven = NOT_GIVEN,
1520
+ security_groups: Iterable[instance_create_params.SecurityGroup] | NotGiven = NOT_GIVEN,
1521
+ servergroup_id: str | NotGiven = NOT_GIVEN,
1522
+ ssh_key_name: Optional[str] | NotGiven = NOT_GIVEN,
1523
+ tags: TagUpdateMapParam | NotGiven = NOT_GIVEN,
1524
+ user_data: str | NotGiven = NOT_GIVEN,
1525
+ username: str | NotGiven = NOT_GIVEN,
1526
+ polling_interval_seconds: int | NotGiven = NOT_GIVEN,
1527
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1528
+ # The extra values given here take precedence over values defined on the client or passed to this method.
1529
+ extra_headers: Headers | None = None,
1530
+ extra_query: Query | None = None,
1531
+ extra_body: Body | None = None,
1532
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
1533
+ ) -> Instance:
1534
+ """Create one or many instances or basic VMs and poll for the result."""
1535
+ response = await self.create(
1536
+ project_id=project_id,
1537
+ region_id=region_id,
1538
+ flavor=flavor,
1539
+ interfaces=interfaces,
1540
+ volumes=volumes,
1541
+ allow_app_ports=allow_app_ports,
1542
+ configuration=configuration,
1543
+ name_template=name_template,
1544
+ name=name,
1545
+ password=password,
1546
+ security_groups=security_groups,
1547
+ servergroup_id=servergroup_id,
1548
+ ssh_key_name=ssh_key_name,
1549
+ tags=tags,
1550
+ user_data=user_data,
1551
+ username=username,
1552
+ extra_headers=extra_headers,
1553
+ extra_query=extra_query,
1554
+ extra_body=extra_body,
1555
+ timeout=timeout,
1556
+ )
1557
+ if not response.tasks or len(response.tasks) != 1:
1558
+ raise ValueError(f"Expected exactly one task to be created")
1559
+ task = await self._client.cloud.tasks.poll(
1560
+ task_id=response.tasks[0],
1561
+ extra_headers=extra_headers,
1562
+ polling_interval_seconds=polling_interval_seconds,
1563
+ )
1564
+ if (
1565
+ not task.created_resources
1566
+ or not task.created_resources.instances
1567
+ or len(task.created_resources.instances) != 1
1568
+ ):
1569
+ raise ValueError(f"Expected exactly one resource to be created in a task")
1570
+ return await self.get(
1571
+ instance_id=task.created_resources.instances[0],
1572
+ project_id=project_id,
1573
+ region_id=region_id,
1574
+ extra_headers=extra_headers,
1575
+ )
1576
+
1577
+ async def update(
1578
+ self,
1579
+ instance_id: str,
1580
+ *,
1581
+ project_id: int | None = None,
1582
+ region_id: int | None = None,
1583
+ name: str,
1584
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1585
+ # The extra values given here take precedence over values defined on the client or passed to this method.
1586
+ extra_headers: Headers | None = None,
1587
+ extra_query: Query | None = None,
1588
+ extra_body: Body | None = None,
1589
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
1590
+ ) -> Instance:
1591
+ """
1592
+ Rename instance
1593
+
1594
+ Args:
1595
+ project_id: Project ID
1596
+
1597
+ region_id: Region ID
1598
+
1599
+ instance_id: Instance ID
1600
+
1601
+ name: Name.
1602
+
1603
+ extra_headers: Send extra headers
1604
+
1605
+ extra_query: Add additional query parameters to the request
1606
+
1607
+ extra_body: Add additional JSON properties to the request
1608
+
1609
+ timeout: Override the client-level default timeout for this request, in seconds
1610
+ """
1611
+ if project_id is None:
1612
+ project_id = self._client._get_cloud_project_id_path_param()
1613
+ if region_id is None:
1614
+ region_id = self._client._get_cloud_region_id_path_param()
1615
+ if not instance_id:
1616
+ raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}")
1617
+ return await self._patch(
1618
+ f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}",
1619
+ body=await async_maybe_transform({"name": name}, instance_update_params.InstanceUpdateParams),
1620
+ options=make_request_options(
1621
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
1622
+ ),
1623
+ cast_to=Instance,
1624
+ )
1625
+
1626
+ def list(
1627
+ self,
1628
+ *,
1629
+ project_id: int | None = None,
1630
+ region_id: int | None = None,
1631
+ available_floating: bool | NotGiven = NOT_GIVEN,
1632
+ changes_before: Union[str, datetime] | NotGiven = NOT_GIVEN,
1633
+ changes_since: Union[str, datetime] | NotGiven = NOT_GIVEN,
1634
+ exclude_flavor_prefix: str | NotGiven = NOT_GIVEN,
1635
+ exclude_secgroup: str | NotGiven = NOT_GIVEN,
1636
+ flavor_id: str | NotGiven = NOT_GIVEN,
1637
+ flavor_prefix: str | NotGiven = NOT_GIVEN,
1638
+ include_ai: bool | NotGiven = NOT_GIVEN,
1639
+ include_baremetal: bool | NotGiven = NOT_GIVEN,
1640
+ include_k8s: bool | NotGiven = NOT_GIVEN,
1641
+ ip: str | NotGiven = NOT_GIVEN,
1642
+ limit: int | NotGiven = NOT_GIVEN,
1643
+ name: str | NotGiven = NOT_GIVEN,
1644
+ offset: int | NotGiven = NOT_GIVEN,
1645
+ only_isolated: bool | NotGiven = NOT_GIVEN,
1646
+ only_with_fixed_external_ip: bool | NotGiven = NOT_GIVEN,
1647
+ order_by: Literal["created.asc", "created.desc", "name.asc", "name.desc"] | NotGiven = NOT_GIVEN,
1648
+ profile_name: str | NotGiven = NOT_GIVEN,
1649
+ protection_status: Literal["Active", "Queued", "Error"] | NotGiven = NOT_GIVEN,
1650
+ status: Literal[
1651
+ "ACTIVE",
1652
+ "BUILD",
1653
+ "ERROR",
1654
+ "HARD_REBOOT",
1655
+ "MIGRATING",
1656
+ "PAUSED",
1657
+ "REBOOT",
1658
+ "REBUILD",
1659
+ "RESIZE",
1660
+ "REVERT_RESIZE",
1661
+ "SHELVED",
1662
+ "SHELVED_OFFLOADED",
1663
+ "SHUTOFF",
1664
+ "SOFT_DELETED",
1665
+ "SUSPENDED",
1666
+ "VERIFY_RESIZE",
1667
+ ]
1668
+ | NotGiven = NOT_GIVEN,
1669
+ tag_key_value: str | NotGiven = NOT_GIVEN,
1670
+ tag_value: List[str] | NotGiven = NOT_GIVEN,
1671
+ type_ddos_profile: Literal["basic", "advanced"] | NotGiven = NOT_GIVEN,
1672
+ uuid: str | NotGiven = NOT_GIVEN,
1673
+ with_ddos: bool | NotGiven = NOT_GIVEN,
1674
+ with_interfaces_name: bool | NotGiven = NOT_GIVEN,
1675
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1676
+ # The extra values given here take precedence over values defined on the client or passed to this method.
1677
+ extra_headers: Headers | None = None,
1678
+ extra_query: Query | None = None,
1679
+ extra_body: Body | None = None,
1680
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
1681
+ ) -> AsyncPaginator[Instance, AsyncOffsetPage[Instance]]:
1682
+ """
1683
+ List instances
1684
+
1685
+ Args:
1686
+ project_id: Project ID
1687
+
1688
+ region_id: Region ID
1689
+
1690
+ available_floating: Only show instances which are able to handle floating address
1691
+
1692
+ changes_before: Filters the instances by a date and time stamp when the instances last changed.
1693
+
1694
+ changes_since: Filters the instances by a date and time stamp when the instances last changed
1695
+ status.
1696
+
1697
+ exclude_flavor_prefix: Exclude instances with specified flavor prefix
1698
+
1699
+ exclude_secgroup: Exclude instances with specified security group name
1700
+
1701
+ flavor_id: Filter out instances by flavor_id. Flavor id must match exactly.
1702
+
1703
+ flavor_prefix: Filter out instances by flavor_prefix.
1704
+
1705
+ include_ai: Include GPU clusters' servers
1706
+
1707
+ include_baremetal: Include bare metal servers. Please, use `GET /v1/bminstances/` instead
1708
+
1709
+ include_k8s: Include managed k8s worker nodes
1710
+
1711
+ ip: An IPv4 address to filter results by. Note: partial matches are allowed. For
1712
+ example, searching for 192.168.0.1 will return 192.168.0.1, 192.168.0.10,
1713
+ 192.168.0.110, and so on.
1714
+
1715
+ limit: Optional. Limit the number of returned items
1716
+
1717
+ name: Filter instances by name. You can provide a full or partial name, instances with
1718
+ matching names will be returned. For example, entering 'test' will return all
1719
+ instances that contain 'test' in their name.
1720
+
1721
+ offset: Optional. Offset value is used to exclude the first set of records from the
1722
+ result
1723
+
1724
+ only_isolated: Include only isolated instances
1725
+
1726
+ only_with_fixed_external_ip: Return bare metals only with external fixed IP addresses.
1727
+
1728
+ order_by: Order by field and direction.
1729
+
1730
+ profile_name: Filter result by ddos protection profile name. Effective only with with_ddos set
1731
+ to true.
1732
+
1733
+ protection_status: Filter result by DDoS protection_status. if parameter is provided. Effective
1734
+ only with with_ddos set to true. (Active, Queued or Error)
1735
+
1736
+ status: Filters instances by status.
1737
+
1738
+ tag_key_value: Optional. Filter by tag key-value pairs. curl -G --data-urlencode
1739
+ "tag_key_value={"key": "value"}" --url
1740
+ "https://example.com/cloud/v1/resource/1/1"
1741
+
1742
+ tag_value: Optional. Filter by tag values. ?tag_value=value1&tag_value=value2
1743
+
1744
+ type_ddos_profile: Return bare metals either only with advanced or only basic DDoS protection.
1745
+ Effective only with with_ddos set to true. (advanced or basic)
1746
+
1747
+ uuid: Filter the server list result by the UUID of the server. Allowed UUID part
1748
+
1749
+ with_ddos: Include DDoS profile information in the response when set to `true`. Otherwise,
1750
+ the `ddos_profile` field in the response is `null` by default.
1751
+
1752
+ with_interfaces_name: Include `interface_name` in the addresses
1753
+
1754
+ extra_headers: Send extra headers
1755
+
1756
+ extra_query: Add additional query parameters to the request
1757
+
1758
+ extra_body: Add additional JSON properties to the request
1759
+
1760
+ timeout: Override the client-level default timeout for this request, in seconds
1761
+ """
1762
+ if project_id is None:
1763
+ project_id = self._client._get_cloud_project_id_path_param()
1764
+ if region_id is None:
1765
+ region_id = self._client._get_cloud_region_id_path_param()
1766
+ return self._get_api_list(
1767
+ f"/cloud/v1/instances/{project_id}/{region_id}",
1768
+ page=AsyncOffsetPage[Instance],
1769
+ options=make_request_options(
1770
+ extra_headers=extra_headers,
1771
+ extra_query=extra_query,
1772
+ extra_body=extra_body,
1773
+ timeout=timeout,
1774
+ query=maybe_transform(
1775
+ {
1776
+ "available_floating": available_floating,
1777
+ "changes_before": changes_before,
1778
+ "changes_since": changes_since,
1779
+ "exclude_flavor_prefix": exclude_flavor_prefix,
1780
+ "exclude_secgroup": exclude_secgroup,
1781
+ "flavor_id": flavor_id,
1782
+ "flavor_prefix": flavor_prefix,
1783
+ "include_ai": include_ai,
1784
+ "include_baremetal": include_baremetal,
1785
+ "include_k8s": include_k8s,
1786
+ "ip": ip,
1787
+ "limit": limit,
1788
+ "name": name,
1789
+ "offset": offset,
1790
+ "only_isolated": only_isolated,
1791
+ "only_with_fixed_external_ip": only_with_fixed_external_ip,
1792
+ "order_by": order_by,
1793
+ "profile_name": profile_name,
1794
+ "protection_status": protection_status,
1795
+ "status": status,
1796
+ "tag_key_value": tag_key_value,
1797
+ "tag_value": tag_value,
1798
+ "type_ddos_profile": type_ddos_profile,
1799
+ "uuid": uuid,
1800
+ "with_ddos": with_ddos,
1801
+ "with_interfaces_name": with_interfaces_name,
1802
+ },
1803
+ instance_list_params.InstanceListParams,
1804
+ ),
1805
+ ),
1806
+ model=Instance,
1807
+ )
1808
+
1809
+ async def delete(
1810
+ self,
1811
+ instance_id: str,
1812
+ *,
1813
+ project_id: int | None = None,
1814
+ region_id: int | None = None,
1815
+ delete_floatings: bool | NotGiven = NOT_GIVEN,
1816
+ floatings: str | NotGiven = NOT_GIVEN,
1817
+ reserved_fixed_ips: str | NotGiven = NOT_GIVEN,
1818
+ volumes: str | NotGiven = NOT_GIVEN,
1819
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1820
+ # The extra values given here take precedence over values defined on the client or passed to this method.
1821
+ extra_headers: Headers | None = None,
1822
+ extra_query: Query | None = None,
1823
+ extra_body: Body | None = None,
1824
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
1825
+ ) -> TaskIDList:
1826
+ """
1827
+ Delete instance
1828
+
1829
+ Args:
1830
+ project_id: Project ID
1831
+
1832
+ region_id: Region ID
1833
+
1834
+ instance_id: Instance ID
1835
+
1836
+ delete_floatings: True if it is required to delete floating IPs assigned to the instance. Can't be
1837
+ used with `floatings`.
1838
+
1839
+ floatings: Comma separated list of floating ids that should be deleted. Can't be used with
1840
+ `delete_floatings`.
1841
+
1842
+ reserved_fixed_ips: Comma separated list of port IDs to be deleted with the instance
1843
+
1844
+ volumes: Comma separated list of volume IDs to be deleted with the instance
1845
+
1846
+ extra_headers: Send extra headers
1847
+
1848
+ extra_query: Add additional query parameters to the request
1849
+
1850
+ extra_body: Add additional JSON properties to the request
1851
+
1852
+ timeout: Override the client-level default timeout for this request, in seconds
1853
+ """
1854
+ if project_id is None:
1855
+ project_id = self._client._get_cloud_project_id_path_param()
1856
+ if region_id is None:
1857
+ region_id = self._client._get_cloud_region_id_path_param()
1858
+ if not instance_id:
1859
+ raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}")
1860
+ return await self._delete(
1861
+ f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}",
1862
+ options=make_request_options(
1863
+ extra_headers=extra_headers,
1864
+ extra_query=extra_query,
1865
+ extra_body=extra_body,
1866
+ timeout=timeout,
1867
+ query=await async_maybe_transform(
1868
+ {
1869
+ "delete_floatings": delete_floatings,
1870
+ "floatings": floatings,
1871
+ "reserved_fixed_ips": reserved_fixed_ips,
1872
+ "volumes": volumes,
1873
+ },
1874
+ instance_delete_params.InstanceDeleteParams,
1875
+ ),
1876
+ ),
1877
+ cast_to=TaskIDList,
1878
+ )
1879
+
1880
+ async def delete_and_poll(
1881
+ self,
1882
+ instance_id: str,
1883
+ *,
1884
+ project_id: int | None = None,
1885
+ region_id: int | None = None,
1886
+ delete_floatings: bool | NotGiven = NOT_GIVEN,
1887
+ floatings: str | NotGiven = NOT_GIVEN,
1888
+ reserved_fixed_ips: str | NotGiven = NOT_GIVEN,
1889
+ volumes: str | NotGiven = NOT_GIVEN,
1890
+ polling_interval_seconds: int | NotGiven = NOT_GIVEN,
1891
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1892
+ # The extra values given here take precedence over values defined on the client or passed to this method.
1893
+ extra_headers: Headers | None = None,
1894
+ extra_query: Query | None = None,
1895
+ extra_body: Body | None = None,
1896
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
1897
+ ) -> None:
1898
+ """
1899
+ Delete instance and poll for the result
1900
+ """
1901
+ response = await self.delete(
1902
+ instance_id=instance_id,
1903
+ project_id=project_id,
1904
+ region_id=region_id,
1905
+ delete_floatings=delete_floatings,
1906
+ floatings=floatings,
1907
+ reserved_fixed_ips=reserved_fixed_ips,
1908
+ volumes=volumes,
1909
+ extra_headers=extra_headers,
1910
+ extra_query=extra_query,
1911
+ extra_body=extra_body,
1912
+ timeout=timeout,
1913
+ )
1914
+ if not response.tasks or len(response.tasks) != 1:
1915
+ raise ValueError(f"Expected exactly one task to be created")
1916
+ await self._client.cloud.tasks.poll(
1917
+ task_id=response.tasks[0],
1918
+ extra_headers=extra_headers,
1919
+ polling_interval_seconds=polling_interval_seconds,
1920
+ )
1921
+
1922
+ @overload
1923
+ async def action(
1924
+ self,
1925
+ instance_id: str,
1926
+ *,
1927
+ project_id: int | None = None,
1928
+ region_id: int | None = None,
1929
+ action: Literal["start"],
1930
+ activate_profile: Optional[bool] | NotGiven = NOT_GIVEN,
1931
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1932
+ # The extra values given here take precedence over values defined on the client or passed to this method.
1933
+ extra_headers: Headers | None = None,
1934
+ extra_query: Query | None = None,
1935
+ extra_body: Body | None = None,
1936
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
1937
+ ) -> TaskIDList:
1938
+ """
1939
+ The action can be one of: start, stop, reboot, powercycle, suspend or resume.
1940
+ Suspend and resume are not available for baremetal instances.
1941
+
1942
+ Args:
1943
+ action: Instance action name
1944
+
1945
+ activate_profile: Used on start instance to activate Advanced DDoS profile
1946
+
1947
+ extra_headers: Send extra headers
1948
+
1949
+ extra_query: Add additional query parameters to the request
1950
+
1951
+ extra_body: Add additional JSON properties to the request
1952
+
1953
+ timeout: Override the client-level default timeout for this request, in seconds
1954
+ """
1955
+ ...
1956
+
1957
+ @overload
1958
+ async def action(
1959
+ self,
1960
+ instance_id: str,
1961
+ *,
1962
+ project_id: int | None = None,
1963
+ region_id: int | None = None,
1964
+ action: Literal["reboot", "reboot_hard", "resume", "stop", "suspend"],
1965
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1966
+ # The extra values given here take precedence over values defined on the client or passed to this method.
1967
+ extra_headers: Headers | None = None,
1968
+ extra_query: Query | None = None,
1969
+ extra_body: Body | None = None,
1970
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
1971
+ ) -> TaskIDList:
1972
+ """
1973
+ The action can be one of: start, stop, reboot, powercycle, suspend or resume.
1974
+ Suspend and resume are not available for baremetal instances.
1975
+
1976
+ Args:
1977
+ action: Instance action name
1978
+
1979
+ extra_headers: Send extra headers
1980
+
1981
+ extra_query: Add additional query parameters to the request
1982
+
1983
+ extra_body: Add additional JSON properties to the request
1984
+
1985
+ timeout: Override the client-level default timeout for this request, in seconds
1986
+ """
1987
+ ...
1988
+
1989
+ @required_args(["action"])
1990
+ async def action(
1991
+ self,
1992
+ instance_id: str,
1993
+ *,
1994
+ project_id: int | None = None,
1995
+ region_id: int | None = None,
1996
+ action: Literal["start"] | Literal["reboot", "reboot_hard", "resume", "stop", "suspend"],
1997
+ activate_profile: Optional[bool] | NotGiven = NOT_GIVEN,
1998
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1999
+ # The extra values given here take precedence over values defined on the client or passed to this method.
2000
+ extra_headers: Headers | None = None,
2001
+ extra_query: Query | None = None,
2002
+ extra_body: Body | None = None,
2003
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
2004
+ ) -> TaskIDList:
2005
+ if project_id is None:
2006
+ project_id = self._client._get_cloud_project_id_path_param()
2007
+ if region_id is None:
2008
+ region_id = self._client._get_cloud_region_id_path_param()
2009
+ if not instance_id:
2010
+ raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}")
2011
+ return await self._post(
2012
+ f"/cloud/v2/instances/{project_id}/{region_id}/{instance_id}/action",
2013
+ body=await async_maybe_transform(
2014
+ {
2015
+ "action": action,
2016
+ "activate_profile": activate_profile,
2017
+ },
2018
+ instance_action_params.InstanceActionParams,
2019
+ ),
2020
+ options=make_request_options(
2021
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
2022
+ ),
2023
+ cast_to=TaskIDList,
2024
+ )
2025
+
2026
+ async def add_to_placement_group(
2027
+ self,
2028
+ instance_id: str,
2029
+ *,
2030
+ project_id: int | None = None,
2031
+ region_id: int | None = None,
2032
+ servergroup_id: str,
2033
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
2034
+ # The extra values given here take precedence over values defined on the client or passed to this method.
2035
+ extra_headers: Headers | None = None,
2036
+ extra_query: Query | None = None,
2037
+ extra_body: Body | None = None,
2038
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
2039
+ ) -> TaskIDList:
2040
+ """
2041
+ Put instance into the server group
2042
+
2043
+ Args:
2044
+ servergroup_id: Anti-affinity or affinity or soft-anti-affinity server group ID.
2045
+
2046
+ extra_headers: Send extra headers
2047
+
2048
+ extra_query: Add additional query parameters to the request
2049
+
2050
+ extra_body: Add additional JSON properties to the request
2051
+
2052
+ timeout: Override the client-level default timeout for this request, in seconds
2053
+ """
2054
+ if project_id is None:
2055
+ project_id = self._client._get_cloud_project_id_path_param()
2056
+ if region_id is None:
2057
+ region_id = self._client._get_cloud_region_id_path_param()
2058
+ if not instance_id:
2059
+ raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}")
2060
+ return await self._post(
2061
+ f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/put_into_servergroup",
2062
+ body=await async_maybe_transform(
2063
+ {"servergroup_id": servergroup_id},
2064
+ instance_add_to_placement_group_params.InstanceAddToPlacementGroupParams,
2065
+ ),
2066
+ options=make_request_options(
2067
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
2068
+ ),
2069
+ cast_to=TaskIDList,
2070
+ )
2071
+
2072
+ async def add_to_placement_group_and_poll(
2073
+ self,
2074
+ instance_id: str,
2075
+ *,
2076
+ project_id: int | None = None,
2077
+ region_id: int | None = None,
2078
+ servergroup_id: str,
2079
+ polling_interval_seconds: int | NotGiven = NOT_GIVEN,
2080
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
2081
+ # The extra values given here take precedence over values defined on the client or passed to this method.
2082
+ extra_headers: Headers | None = None,
2083
+ extra_query: Query | None = None,
2084
+ extra_body: Body | None = None,
2085
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
2086
+ ) -> Instance:
2087
+ """
2088
+ Put instance into the server group and poll for the result
2089
+ """
2090
+ response = await self.add_to_placement_group(
2091
+ instance_id=instance_id,
2092
+ project_id=project_id,
2093
+ region_id=region_id,
2094
+ servergroup_id=servergroup_id,
2095
+ extra_headers=extra_headers,
2096
+ extra_query=extra_query,
2097
+ extra_body=extra_body,
2098
+ timeout=timeout,
2099
+ )
2100
+ if not response.tasks or len(response.tasks) != 1:
2101
+ raise ValueError(f"Expected exactly one task to be created")
2102
+ await self._client.cloud.tasks.poll(
2103
+ task_id=response.tasks[0],
2104
+ extra_headers=extra_headers,
2105
+ polling_interval_seconds=polling_interval_seconds,
2106
+ )
2107
+ return await self.get(
2108
+ instance_id=instance_id,
2109
+ project_id=project_id,
2110
+ region_id=region_id,
2111
+ extra_headers=extra_headers,
2112
+ )
2113
+
2114
+ async def assign_security_group(
2115
+ self,
2116
+ instance_id: str,
2117
+ *,
2118
+ project_id: int | None = None,
2119
+ region_id: int | None = None,
2120
+ name: str | NotGiven = NOT_GIVEN,
2121
+ ports_security_group_names: Iterable[instance_assign_security_group_params.PortsSecurityGroupName]
2122
+ | NotGiven = NOT_GIVEN,
2123
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
2124
+ # The extra values given here take precedence over values defined on the client or passed to this method.
2125
+ extra_headers: Headers | None = None,
2126
+ extra_query: Query | None = None,
2127
+ extra_body: Body | None = None,
2128
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
2129
+ ) -> None:
2130
+ """Assign the security group to the server.
2131
+
2132
+ To assign multiple security groups to
2133
+ all ports, use the NULL value for the port_id field
2134
+
2135
+ Args:
2136
+ name: Security group name, applies to all ports
2137
+
2138
+ ports_security_group_names: Port security groups mapping
2139
+
2140
+ extra_headers: Send extra headers
2141
+
2142
+ extra_query: Add additional query parameters to the request
2143
+
2144
+ extra_body: Add additional JSON properties to the request
2145
+
2146
+ timeout: Override the client-level default timeout for this request, in seconds
2147
+ """
2148
+ if project_id is None:
2149
+ project_id = self._client._get_cloud_project_id_path_param()
2150
+ if region_id is None:
2151
+ region_id = self._client._get_cloud_region_id_path_param()
2152
+ if not instance_id:
2153
+ raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}")
2154
+ extra_headers = {"Accept": "*/*", **(extra_headers or {})}
2155
+ return await self._post(
2156
+ f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/addsecuritygroup",
2157
+ body=await async_maybe_transform(
2158
+ {
2159
+ "name": name,
2160
+ "ports_security_group_names": ports_security_group_names,
2161
+ },
2162
+ instance_assign_security_group_params.InstanceAssignSecurityGroupParams,
2163
+ ),
2164
+ options=make_request_options(
2165
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
2166
+ ),
2167
+ cast_to=NoneType,
2168
+ )
2169
+
2170
+ async def disable_port_security(
2171
+ self,
2172
+ port_id: str,
2173
+ *,
2174
+ project_id: int | None = None,
2175
+ region_id: int | None = None,
2176
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
2177
+ # The extra values given here take precedence over values defined on the client or passed to this method.
2178
+ extra_headers: Headers | None = None,
2179
+ extra_query: Query | None = None,
2180
+ extra_body: Body | None = None,
2181
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
2182
+ ) -> InstanceInterface:
2183
+ """
2184
+ Disable port security for instance interface
2185
+
2186
+ Args:
2187
+ extra_headers: Send extra headers
2188
+
2189
+ extra_query: Add additional query parameters to the request
2190
+
2191
+ extra_body: Add additional JSON properties to the request
2192
+
2193
+ timeout: Override the client-level default timeout for this request, in seconds
2194
+ """
2195
+ if project_id is None:
2196
+ project_id = self._client._get_cloud_project_id_path_param()
2197
+ if region_id is None:
2198
+ region_id = self._client._get_cloud_region_id_path_param()
2199
+ if not port_id:
2200
+ raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}")
2201
+ return await self._post(
2202
+ f"/cloud/v1/ports/{project_id}/{region_id}/{port_id}/disable_port_security",
2203
+ options=make_request_options(
2204
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
2205
+ ),
2206
+ cast_to=InstanceInterface,
2207
+ )
2208
+
2209
+ async def enable_port_security(
2210
+ self,
2211
+ port_id: str,
2212
+ *,
2213
+ project_id: int | None = None,
2214
+ region_id: int | None = None,
2215
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
2216
+ # The extra values given here take precedence over values defined on the client or passed to this method.
2217
+ extra_headers: Headers | None = None,
2218
+ extra_query: Query | None = None,
2219
+ extra_body: Body | None = None,
2220
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
2221
+ ) -> InstanceInterface:
2222
+ """
2223
+ Enable port security for instance interface
2224
+
2225
+ Args:
2226
+ extra_headers: Send extra headers
2227
+
2228
+ extra_query: Add additional query parameters to the request
2229
+
2230
+ extra_body: Add additional JSON properties to the request
2231
+
2232
+ timeout: Override the client-level default timeout for this request, in seconds
2233
+ """
2234
+ if project_id is None:
2235
+ project_id = self._client._get_cloud_project_id_path_param()
2236
+ if region_id is None:
2237
+ region_id = self._client._get_cloud_region_id_path_param()
2238
+ if not port_id:
2239
+ raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}")
2240
+ return await self._post(
2241
+ f"/cloud/v1/ports/{project_id}/{region_id}/{port_id}/enable_port_security",
2242
+ options=make_request_options(
2243
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
2244
+ ),
2245
+ cast_to=InstanceInterface,
2246
+ )
2247
+
2248
+ async def get(
2249
+ self,
2250
+ instance_id: str,
2251
+ *,
2252
+ project_id: int | None = None,
2253
+ region_id: int | None = None,
2254
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
2255
+ # The extra values given here take precedence over values defined on the client or passed to this method.
2256
+ extra_headers: Headers | None = None,
2257
+ extra_query: Query | None = None,
2258
+ extra_body: Body | None = None,
2259
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
2260
+ ) -> Instance:
2261
+ """
2262
+ **Cookie Parameters**:
2263
+
2264
+ - `language` (str, optional): Language for the response content. Affects the
2265
+ `ddos_profile` field. Supported values:
2266
+ - `'en'` (default)
2267
+ - `'de'`
2268
+ - `'ru'`
2269
+
2270
+ Args:
2271
+ project_id: Project ID
2272
+
2273
+ region_id: Region ID
2274
+
2275
+ instance_id: Instance ID
2276
+
2277
+ extra_headers: Send extra headers
2278
+
2279
+ extra_query: Add additional query parameters to the request
2280
+
2281
+ extra_body: Add additional JSON properties to the request
2282
+
2283
+ timeout: Override the client-level default timeout for this request, in seconds
2284
+ """
2285
+ if project_id is None:
2286
+ project_id = self._client._get_cloud_project_id_path_param()
2287
+ if region_id is None:
2288
+ region_id = self._client._get_cloud_region_id_path_param()
2289
+ if not instance_id:
2290
+ raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}")
2291
+ return await self._get(
2292
+ f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}",
2293
+ options=make_request_options(
2294
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
2295
+ ),
2296
+ cast_to=Instance,
2297
+ )
2298
+
2299
+ async def get_console(
2300
+ self,
2301
+ instance_id: str,
2302
+ *,
2303
+ project_id: int | None = None,
2304
+ region_id: int | None = None,
2305
+ console_type: str | NotGiven = NOT_GIVEN,
2306
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
2307
+ # The extra values given here take precedence over values defined on the client or passed to this method.
2308
+ extra_headers: Headers | None = None,
2309
+ extra_query: Query | None = None,
2310
+ extra_body: Body | None = None,
2311
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
2312
+ ) -> Console:
2313
+ """
2314
+ Get instance console URL
2315
+
2316
+ Args:
2317
+ console_type: Console type
2318
+
2319
+ extra_headers: Send extra headers
2320
+
2321
+ extra_query: Add additional query parameters to the request
2322
+
2323
+ extra_body: Add additional JSON properties to the request
2324
+
2325
+ timeout: Override the client-level default timeout for this request, in seconds
2326
+ """
2327
+ if project_id is None:
2328
+ project_id = self._client._get_cloud_project_id_path_param()
2329
+ if region_id is None:
2330
+ region_id = self._client._get_cloud_region_id_path_param()
2331
+ if not instance_id:
2332
+ raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}")
2333
+ return await self._get(
2334
+ f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/get_console",
2335
+ options=make_request_options(
2336
+ extra_headers=extra_headers,
2337
+ extra_query=extra_query,
2338
+ extra_body=extra_body,
2339
+ timeout=timeout,
2340
+ query=await async_maybe_transform(
2341
+ {"console_type": console_type}, instance_get_console_params.InstanceGetConsoleParams
2342
+ ),
2343
+ ),
2344
+ cast_to=Console,
2345
+ )
2346
+
2347
+ async def remove_from_placement_group(
2348
+ self,
2349
+ instance_id: str,
2350
+ *,
2351
+ project_id: int | None = None,
2352
+ region_id: int | None = None,
2353
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
2354
+ # The extra values given here take precedence over values defined on the client or passed to this method.
2355
+ extra_headers: Headers | None = None,
2356
+ extra_query: Query | None = None,
2357
+ extra_body: Body | None = None,
2358
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
2359
+ ) -> TaskIDList:
2360
+ """
2361
+ Remove instance from the server group
2362
+
2363
+ Args:
2364
+ extra_headers: Send extra headers
2365
+
2366
+ extra_query: Add additional query parameters to the request
2367
+
2368
+ extra_body: Add additional JSON properties to the request
2369
+
2370
+ timeout: Override the client-level default timeout for this request, in seconds
2371
+ """
2372
+ if project_id is None:
2373
+ project_id = self._client._get_cloud_project_id_path_param()
2374
+ if region_id is None:
2375
+ region_id = self._client._get_cloud_region_id_path_param()
2376
+ if not instance_id:
2377
+ raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}")
2378
+ return await self._post(
2379
+ f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/remove_from_servergroup",
2380
+ options=make_request_options(
2381
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
2382
+ ),
2383
+ cast_to=TaskIDList,
2384
+ )
2385
+
2386
+ async def remove_from_placement_group_and_poll(
2387
+ self,
2388
+ instance_id: str,
2389
+ *,
2390
+ project_id: int | None = None,
2391
+ region_id: int | None = None,
2392
+ polling_interval_seconds: int | NotGiven = NOT_GIVEN,
2393
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
2394
+ # The extra values given here take precedence over values defined on the client or passed to this method.
2395
+ extra_headers: Headers | None = None,
2396
+ extra_query: Query | None = None,
2397
+ extra_body: Body | None = None,
2398
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
2399
+ ) -> Instance:
2400
+ """
2401
+ Remove instance from the server group and poll for the result
2402
+ """
2403
+ response = await self.remove_from_placement_group(
2404
+ instance_id=instance_id,
2405
+ project_id=project_id,
2406
+ region_id=region_id,
2407
+ extra_headers=extra_headers,
2408
+ extra_query=extra_query,
2409
+ extra_body=extra_body,
2410
+ timeout=timeout,
2411
+ )
2412
+ if not response.tasks or len(response.tasks) != 1:
2413
+ raise ValueError(f"Expected exactly one task to be created")
2414
+ await self._client.cloud.tasks.poll(
2415
+ task_id=response.tasks[0],
2416
+ extra_headers=extra_headers,
2417
+ polling_interval_seconds=polling_interval_seconds,
2418
+ )
2419
+ return await self.get(
2420
+ instance_id=instance_id,
2421
+ project_id=project_id,
2422
+ region_id=region_id,
2423
+ extra_headers=extra_headers,
2424
+ )
2425
+
2426
+ async def resize(
2427
+ self,
2428
+ instance_id: str,
2429
+ *,
2430
+ project_id: int | None = None,
2431
+ region_id: int | None = None,
2432
+ flavor_id: str,
2433
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
2434
+ # The extra values given here take precedence over values defined on the client or passed to this method.
2435
+ extra_headers: Headers | None = None,
2436
+ extra_query: Query | None = None,
2437
+ extra_body: Body | None = None,
2438
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
2439
+ ) -> TaskIDList:
2440
+ """
2441
+ Change flavor of the instance
2442
+
2443
+ Args:
2444
+ flavor_id: Flavor ID
2445
+
2446
+ extra_headers: Send extra headers
2447
+
2448
+ extra_query: Add additional query parameters to the request
2449
+
2450
+ extra_body: Add additional JSON properties to the request
2451
+
2452
+ timeout: Override the client-level default timeout for this request, in seconds
2453
+ """
2454
+ if project_id is None:
2455
+ project_id = self._client._get_cloud_project_id_path_param()
2456
+ if region_id is None:
2457
+ region_id = self._client._get_cloud_region_id_path_param()
2458
+ if not instance_id:
2459
+ raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}")
2460
+ return await self._post(
2461
+ f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/changeflavor",
2462
+ body=await async_maybe_transform({"flavor_id": flavor_id}, instance_resize_params.InstanceResizeParams),
2463
+ options=make_request_options(
2464
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
2465
+ ),
2466
+ cast_to=TaskIDList,
2467
+ )
2468
+
2469
+ async def resize_and_poll(
2470
+ self,
2471
+ instance_id: str,
2472
+ *,
2473
+ project_id: int | None = None,
2474
+ region_id: int | None = None,
2475
+ flavor_id: str,
2476
+ polling_interval_seconds: int | NotGiven = NOT_GIVEN,
2477
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
2478
+ # The extra values given here take precedence over values defined on the client or passed to this method.
2479
+ extra_headers: Headers | None = None,
2480
+ extra_query: Query | None = None,
2481
+ extra_body: Body | None = None,
2482
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
2483
+ ) -> Instance:
2484
+ """
2485
+ Change flavor of the instance and poll for the result
2486
+ """
2487
+ response = await self.resize(
2488
+ instance_id=instance_id,
2489
+ project_id=project_id,
2490
+ region_id=region_id,
2491
+ flavor_id=flavor_id,
2492
+ extra_headers=extra_headers,
2493
+ extra_query=extra_query,
2494
+ extra_body=extra_body,
2495
+ timeout=timeout,
2496
+ )
2497
+ if not response.tasks or len(response.tasks) != 1:
2498
+ raise ValueError(f"Expected exactly one task to be created")
2499
+ await self._client.cloud.tasks.poll(
2500
+ task_id=response.tasks[0],
2501
+ extra_headers=extra_headers,
2502
+ polling_interval_seconds=polling_interval_seconds,
2503
+ )
2504
+ return await self.get(
2505
+ instance_id=instance_id,
2506
+ project_id=project_id,
2507
+ region_id=region_id,
2508
+ extra_headers=extra_headers,
2509
+ )
2510
+
2511
+ async def unassign_security_group(
2512
+ self,
2513
+ instance_id: str,
2514
+ *,
2515
+ project_id: int | None = None,
2516
+ region_id: int | None = None,
2517
+ name: str | NotGiven = NOT_GIVEN,
2518
+ ports_security_group_names: Iterable[instance_unassign_security_group_params.PortsSecurityGroupName]
2519
+ | NotGiven = NOT_GIVEN,
2520
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
2521
+ # The extra values given here take precedence over values defined on the client or passed to this method.
2522
+ extra_headers: Headers | None = None,
2523
+ extra_query: Query | None = None,
2524
+ extra_body: Body | None = None,
2525
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
2526
+ ) -> None:
2527
+ """Un-assign the security group to the server.
2528
+
2529
+ To un-assign multiple security
2530
+ groups to all ports, use the NULL value for the port_id field
2531
+
2532
+ Args:
2533
+ name: Security group name, applies to all ports
2534
+
2535
+ ports_security_group_names: Port security groups mapping
2536
+
2537
+ extra_headers: Send extra headers
2538
+
2539
+ extra_query: Add additional query parameters to the request
2540
+
2541
+ extra_body: Add additional JSON properties to the request
2542
+
2543
+ timeout: Override the client-level default timeout for this request, in seconds
2544
+ """
2545
+ if project_id is None:
2546
+ project_id = self._client._get_cloud_project_id_path_param()
2547
+ if region_id is None:
2548
+ region_id = self._client._get_cloud_region_id_path_param()
2549
+ if not instance_id:
2550
+ raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}")
2551
+ extra_headers = {"Accept": "*/*", **(extra_headers or {})}
2552
+ return await self._post(
2553
+ f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/delsecuritygroup",
2554
+ body=await async_maybe_transform(
2555
+ {
2556
+ "name": name,
2557
+ "ports_security_group_names": ports_security_group_names,
2558
+ },
2559
+ instance_unassign_security_group_params.InstanceUnassignSecurityGroupParams,
2560
+ ),
2561
+ options=make_request_options(
2562
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
2563
+ ),
2564
+ cast_to=NoneType,
2565
+ )
2566
+
2567
+
2568
+ class InstancesResourceWithRawResponse:
2569
+ def __init__(self, instances: InstancesResource) -> None:
2570
+ self._instances = instances
2571
+
2572
+ self.create = to_raw_response_wrapper(
2573
+ instances.create,
2574
+ )
2575
+ self.update = to_raw_response_wrapper(
2576
+ instances.update,
2577
+ )
2578
+ self.list = to_raw_response_wrapper(
2579
+ instances.list,
2580
+ )
2581
+ self.delete = to_raw_response_wrapper(
2582
+ instances.delete,
2583
+ )
2584
+ self.action = to_raw_response_wrapper(
2585
+ instances.action,
2586
+ )
2587
+ self.add_to_placement_group = to_raw_response_wrapper(
2588
+ instances.add_to_placement_group,
2589
+ )
2590
+ self.assign_security_group = to_raw_response_wrapper(
2591
+ instances.assign_security_group,
2592
+ )
2593
+ self.disable_port_security = to_raw_response_wrapper(
2594
+ instances.disable_port_security,
2595
+ )
2596
+ self.enable_port_security = to_raw_response_wrapper(
2597
+ instances.enable_port_security,
2598
+ )
2599
+ self.get = to_raw_response_wrapper(
2600
+ instances.get,
2601
+ )
2602
+ self.get_console = to_raw_response_wrapper(
2603
+ instances.get_console,
2604
+ )
2605
+ self.remove_from_placement_group = to_raw_response_wrapper(
2606
+ instances.remove_from_placement_group,
2607
+ )
2608
+ self.resize = to_raw_response_wrapper(
2609
+ instances.resize,
2610
+ )
2611
+ self.unassign_security_group = to_raw_response_wrapper(
2612
+ instances.unassign_security_group,
2613
+ )
2614
+
2615
+ @cached_property
2616
+ def flavors(self) -> FlavorsResourceWithRawResponse:
2617
+ return FlavorsResourceWithRawResponse(self._instances.flavors)
2618
+
2619
+ @cached_property
2620
+ def interfaces(self) -> InterfacesResourceWithRawResponse:
2621
+ return InterfacesResourceWithRawResponse(self._instances.interfaces)
2622
+
2623
+ @cached_property
2624
+ def images(self) -> ImagesResourceWithRawResponse:
2625
+ return ImagesResourceWithRawResponse(self._instances.images)
2626
+
2627
+ @cached_property
2628
+ def metrics(self) -> MetricsResourceWithRawResponse:
2629
+ return MetricsResourceWithRawResponse(self._instances.metrics)
2630
+
2631
+
2632
+ class AsyncInstancesResourceWithRawResponse:
2633
+ def __init__(self, instances: AsyncInstancesResource) -> None:
2634
+ self._instances = instances
2635
+
2636
+ self.create = async_to_raw_response_wrapper(
2637
+ instances.create,
2638
+ )
2639
+ self.update = async_to_raw_response_wrapper(
2640
+ instances.update,
2641
+ )
2642
+ self.list = async_to_raw_response_wrapper(
2643
+ instances.list,
2644
+ )
2645
+ self.delete = async_to_raw_response_wrapper(
2646
+ instances.delete,
2647
+ )
2648
+ self.action = async_to_raw_response_wrapper(
2649
+ instances.action,
2650
+ )
2651
+ self.add_to_placement_group = async_to_raw_response_wrapper(
2652
+ instances.add_to_placement_group,
2653
+ )
2654
+ self.assign_security_group = async_to_raw_response_wrapper(
2655
+ instances.assign_security_group,
2656
+ )
2657
+ self.disable_port_security = async_to_raw_response_wrapper(
2658
+ instances.disable_port_security,
2659
+ )
2660
+ self.enable_port_security = async_to_raw_response_wrapper(
2661
+ instances.enable_port_security,
2662
+ )
2663
+ self.get = async_to_raw_response_wrapper(
2664
+ instances.get,
2665
+ )
2666
+ self.get_console = async_to_raw_response_wrapper(
2667
+ instances.get_console,
2668
+ )
2669
+ self.remove_from_placement_group = async_to_raw_response_wrapper(
2670
+ instances.remove_from_placement_group,
2671
+ )
2672
+ self.resize = async_to_raw_response_wrapper(
2673
+ instances.resize,
2674
+ )
2675
+ self.unassign_security_group = async_to_raw_response_wrapper(
2676
+ instances.unassign_security_group,
2677
+ )
2678
+
2679
+ @cached_property
2680
+ def flavors(self) -> AsyncFlavorsResourceWithRawResponse:
2681
+ return AsyncFlavorsResourceWithRawResponse(self._instances.flavors)
2682
+
2683
+ @cached_property
2684
+ def interfaces(self) -> AsyncInterfacesResourceWithRawResponse:
2685
+ return AsyncInterfacesResourceWithRawResponse(self._instances.interfaces)
2686
+
2687
+ @cached_property
2688
+ def images(self) -> AsyncImagesResourceWithRawResponse:
2689
+ return AsyncImagesResourceWithRawResponse(self._instances.images)
2690
+
2691
+ @cached_property
2692
+ def metrics(self) -> AsyncMetricsResourceWithRawResponse:
2693
+ return AsyncMetricsResourceWithRawResponse(self._instances.metrics)
2694
+
2695
+
2696
+ class InstancesResourceWithStreamingResponse:
2697
+ def __init__(self, instances: InstancesResource) -> None:
2698
+ self._instances = instances
2699
+
2700
+ self.create = to_streamed_response_wrapper(
2701
+ instances.create,
2702
+ )
2703
+ self.update = to_streamed_response_wrapper(
2704
+ instances.update,
2705
+ )
2706
+ self.list = to_streamed_response_wrapper(
2707
+ instances.list,
2708
+ )
2709
+ self.delete = to_streamed_response_wrapper(
2710
+ instances.delete,
2711
+ )
2712
+ self.action = to_streamed_response_wrapper(
2713
+ instances.action,
2714
+ )
2715
+ self.add_to_placement_group = to_streamed_response_wrapper(
2716
+ instances.add_to_placement_group,
2717
+ )
2718
+ self.assign_security_group = to_streamed_response_wrapper(
2719
+ instances.assign_security_group,
2720
+ )
2721
+ self.disable_port_security = to_streamed_response_wrapper(
2722
+ instances.disable_port_security,
2723
+ )
2724
+ self.enable_port_security = to_streamed_response_wrapper(
2725
+ instances.enable_port_security,
2726
+ )
2727
+ self.get = to_streamed_response_wrapper(
2728
+ instances.get,
2729
+ )
2730
+ self.get_console = to_streamed_response_wrapper(
2731
+ instances.get_console,
2732
+ )
2733
+ self.remove_from_placement_group = to_streamed_response_wrapper(
2734
+ instances.remove_from_placement_group,
2735
+ )
2736
+ self.resize = to_streamed_response_wrapper(
2737
+ instances.resize,
2738
+ )
2739
+ self.unassign_security_group = to_streamed_response_wrapper(
2740
+ instances.unassign_security_group,
2741
+ )
2742
+
2743
+ @cached_property
2744
+ def flavors(self) -> FlavorsResourceWithStreamingResponse:
2745
+ return FlavorsResourceWithStreamingResponse(self._instances.flavors)
2746
+
2747
+ @cached_property
2748
+ def interfaces(self) -> InterfacesResourceWithStreamingResponse:
2749
+ return InterfacesResourceWithStreamingResponse(self._instances.interfaces)
2750
+
2751
+ @cached_property
2752
+ def images(self) -> ImagesResourceWithStreamingResponse:
2753
+ return ImagesResourceWithStreamingResponse(self._instances.images)
2754
+
2755
+ @cached_property
2756
+ def metrics(self) -> MetricsResourceWithStreamingResponse:
2757
+ return MetricsResourceWithStreamingResponse(self._instances.metrics)
2758
+
2759
+
2760
+ class AsyncInstancesResourceWithStreamingResponse:
2761
+ def __init__(self, instances: AsyncInstancesResource) -> None:
2762
+ self._instances = instances
2763
+
2764
+ self.create = async_to_streamed_response_wrapper(
2765
+ instances.create,
2766
+ )
2767
+ self.update = async_to_streamed_response_wrapper(
2768
+ instances.update,
2769
+ )
2770
+ self.list = async_to_streamed_response_wrapper(
2771
+ instances.list,
2772
+ )
2773
+ self.delete = async_to_streamed_response_wrapper(
2774
+ instances.delete,
2775
+ )
2776
+ self.action = async_to_streamed_response_wrapper(
2777
+ instances.action,
2778
+ )
2779
+ self.add_to_placement_group = async_to_streamed_response_wrapper(
2780
+ instances.add_to_placement_group,
2781
+ )
2782
+ self.assign_security_group = async_to_streamed_response_wrapper(
2783
+ instances.assign_security_group,
2784
+ )
2785
+ self.disable_port_security = async_to_streamed_response_wrapper(
2786
+ instances.disable_port_security,
2787
+ )
2788
+ self.enable_port_security = async_to_streamed_response_wrapper(
2789
+ instances.enable_port_security,
2790
+ )
2791
+ self.get = async_to_streamed_response_wrapper(
2792
+ instances.get,
2793
+ )
2794
+ self.get_console = async_to_streamed_response_wrapper(
2795
+ instances.get_console,
2796
+ )
2797
+ self.remove_from_placement_group = async_to_streamed_response_wrapper(
2798
+ instances.remove_from_placement_group,
2799
+ )
2800
+ self.resize = async_to_streamed_response_wrapper(
2801
+ instances.resize,
2802
+ )
2803
+ self.unassign_security_group = async_to_streamed_response_wrapper(
2804
+ instances.unassign_security_group,
2805
+ )
2806
+
2807
+ @cached_property
2808
+ def flavors(self) -> AsyncFlavorsResourceWithStreamingResponse:
2809
+ return AsyncFlavorsResourceWithStreamingResponse(self._instances.flavors)
2810
+
2811
+ @cached_property
2812
+ def interfaces(self) -> AsyncInterfacesResourceWithStreamingResponse:
2813
+ return AsyncInterfacesResourceWithStreamingResponse(self._instances.interfaces)
2814
+
2815
+ @cached_property
2816
+ def images(self) -> AsyncImagesResourceWithStreamingResponse:
2817
+ return AsyncImagesResourceWithStreamingResponse(self._instances.images)
2818
+
2819
+ @cached_property
2820
+ def metrics(self) -> AsyncMetricsResourceWithStreamingResponse:
2821
+ return AsyncMetricsResourceWithStreamingResponse(self._instances.metrics)