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