gcore 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of gcore might be problematic. Click here for more details.

Files changed (437) hide show
  1. gcore/__init__.py +89 -0
  2. gcore/_base_client.py +1943 -0
  3. gcore/_client.py +493 -0
  4. gcore/_compat.py +219 -0
  5. gcore/_constants.py +16 -0
  6. gcore/_exceptions.py +108 -0
  7. gcore/_files.py +123 -0
  8. gcore/_models.py +803 -0
  9. gcore/_qs.py +150 -0
  10. gcore/_resource.py +43 -0
  11. gcore/_response.py +830 -0
  12. gcore/_streaming.py +333 -0
  13. gcore/_types.py +217 -0
  14. gcore/_utils/__init__.py +57 -0
  15. gcore/_utils/_logs.py +25 -0
  16. gcore/_utils/_proxy.py +65 -0
  17. gcore/_utils/_reflection.py +42 -0
  18. gcore/_utils/_resources_proxy.py +24 -0
  19. gcore/_utils/_streams.py +12 -0
  20. gcore/_utils/_sync.py +86 -0
  21. gcore/_utils/_transform.py +447 -0
  22. gcore/_utils/_typing.py +151 -0
  23. gcore/_utils/_utils.py +422 -0
  24. gcore/_version.py +4 -0
  25. gcore/lib/.keep +4 -0
  26. gcore/lib/polling.py +19 -0
  27. gcore/pagination.py +70 -0
  28. gcore/py.typed +0 -0
  29. gcore/resources/__init__.py +33 -0
  30. gcore/resources/cloud/__init__.py +327 -0
  31. gcore/resources/cloud/baremetal/__init__.py +61 -0
  32. gcore/resources/cloud/baremetal/baremetal.py +166 -0
  33. gcore/resources/cloud/baremetal/flavors.py +371 -0
  34. gcore/resources/cloud/baremetal/images.py +238 -0
  35. gcore/resources/cloud/baremetal/servers.py +1042 -0
  36. gcore/resources/cloud/billing_reservations.py +386 -0
  37. gcore/resources/cloud/cloud.py +774 -0
  38. gcore/resources/cloud/file_shares/__init__.py +33 -0
  39. gcore/resources/cloud/file_shares/access_rules.py +434 -0
  40. gcore/resources/cloud/file_shares/file_shares.py +994 -0
  41. gcore/resources/cloud/floating_ips.py +765 -0
  42. gcore/resources/cloud/gpu_baremetal_clusters/__init__.py +75 -0
  43. gcore/resources/cloud/gpu_baremetal_clusters/flavors.py +211 -0
  44. gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py +1493 -0
  45. gcore/resources/cloud/gpu_baremetal_clusters/images.py +785 -0
  46. gcore/resources/cloud/gpu_baremetal_clusters/interfaces.py +175 -0
  47. gcore/resources/cloud/gpu_baremetal_clusters/servers.py +1178 -0
  48. gcore/resources/cloud/inference/__init__.py +89 -0
  49. gcore/resources/cloud/inference/deployments/__init__.py +33 -0
  50. gcore/resources/cloud/inference/deployments/deployments.py +1493 -0
  51. gcore/resources/cloud/inference/deployments/logs.py +235 -0
  52. gcore/resources/cloud/inference/flavors.py +280 -0
  53. gcore/resources/cloud/inference/inference.py +295 -0
  54. gcore/resources/cloud/inference/models.py +289 -0
  55. gcore/resources/cloud/inference/registry_credentials.py +649 -0
  56. gcore/resources/cloud/inference/secrets.py +629 -0
  57. gcore/resources/cloud/instances/__init__.py +75 -0
  58. gcore/resources/cloud/instances/flavors.py +449 -0
  59. gcore/resources/cloud/instances/images.py +1297 -0
  60. gcore/resources/cloud/instances/instances.py +2821 -0
  61. gcore/resources/cloud/instances/interfaces.py +797 -0
  62. gcore/resources/cloud/instances/metrics.py +217 -0
  63. gcore/resources/cloud/ip_ranges.py +135 -0
  64. gcore/resources/cloud/load_balancers/__init__.py +103 -0
  65. gcore/resources/cloud/load_balancers/flavors.py +193 -0
  66. gcore/resources/cloud/load_balancers/l7_policies/__init__.py +33 -0
  67. gcore/resources/cloud/load_balancers/l7_policies/l7_policies.py +1020 -0
  68. gcore/resources/cloud/load_balancers/l7_policies/rules.py +1036 -0
  69. gcore/resources/cloud/load_balancers/listeners.py +1089 -0
  70. gcore/resources/cloud/load_balancers/load_balancers.py +1583 -0
  71. gcore/resources/cloud/load_balancers/metrics.py +205 -0
  72. gcore/resources/cloud/load_balancers/pools/__init__.py +47 -0
  73. gcore/resources/cloud/load_balancers/pools/health_monitors.py +352 -0
  74. gcore/resources/cloud/load_balancers/pools/members.py +353 -0
  75. gcore/resources/cloud/load_balancers/pools/pools.py +1190 -0
  76. gcore/resources/cloud/load_balancers/statuses.py +260 -0
  77. gcore/resources/cloud/networks/__init__.py +47 -0
  78. gcore/resources/cloud/networks/networks.py +771 -0
  79. gcore/resources/cloud/networks/routers.py +875 -0
  80. gcore/resources/cloud/networks/subnets.py +865 -0
  81. gcore/resources/cloud/placement_groups.py +465 -0
  82. gcore/resources/cloud/projects.py +608 -0
  83. gcore/resources/cloud/quotas/__init__.py +33 -0
  84. gcore/resources/cloud/quotas/quotas.py +335 -0
  85. gcore/resources/cloud/quotas/requests.py +482 -0
  86. gcore/resources/cloud/regions.py +328 -0
  87. gcore/resources/cloud/registries/__init__.py +75 -0
  88. gcore/resources/cloud/registries/artifacts.py +277 -0
  89. gcore/resources/cloud/registries/registries.py +688 -0
  90. gcore/resources/cloud/registries/repositories.py +265 -0
  91. gcore/resources/cloud/registries/tags.py +190 -0
  92. gcore/resources/cloud/registries/users.py +701 -0
  93. gcore/resources/cloud/reserved_fixed_ips/__init__.py +33 -0
  94. gcore/resources/cloud/reserved_fixed_ips/reserved_fixed_ips.py +965 -0
  95. gcore/resources/cloud/reserved_fixed_ips/vip.py +577 -0
  96. gcore/resources/cloud/secrets.py +797 -0
  97. gcore/resources/cloud/security_groups/__init__.py +33 -0
  98. gcore/resources/cloud/security_groups/rules.py +626 -0
  99. gcore/resources/cloud/security_groups/security_groups.py +863 -0
  100. gcore/resources/cloud/ssh_keys.py +635 -0
  101. gcore/resources/cloud/tasks.py +700 -0
  102. gcore/resources/cloud/users/__init__.py +33 -0
  103. gcore/resources/cloud/users/role_assignments.py +533 -0
  104. gcore/resources/cloud/users/users.py +102 -0
  105. gcore/resources/cloud/volumes.py +1710 -0
  106. gcore/resources/waap/__init__.py +33 -0
  107. gcore/resources/waap/domains/__init__.py +33 -0
  108. gcore/resources/waap/domains/domains.py +515 -0
  109. gcore/resources/waap/domains/settings.py +271 -0
  110. gcore/resources/waap/waap.py +102 -0
  111. gcore/types/__init__.py +3 -0
  112. gcore/types/cloud/__init__.py +199 -0
  113. gcore/types/cloud/allowed_address_pairs.py +15 -0
  114. gcore/types/cloud/aws_iam_data.py +13 -0
  115. gcore/types/cloud/aws_iam_data_param.py +15 -0
  116. gcore/types/cloud/baremetal/__init__.py +13 -0
  117. gcore/types/cloud/baremetal/baremetal_fixed_address.py +30 -0
  118. gcore/types/cloud/baremetal/baremetal_floating_address.py +15 -0
  119. gcore/types/cloud/baremetal/baremetal_server.py +178 -0
  120. gcore/types/cloud/baremetal/flavor_list_params.py +35 -0
  121. gcore/types/cloud/baremetal/flavor_list_suitable_params.py +22 -0
  122. gcore/types/cloud/baremetal/image_list_params.py +33 -0
  123. gcore/types/cloud/baremetal/server_create_params.py +370 -0
  124. gcore/types/cloud/baremetal/server_list_params.py +114 -0
  125. gcore/types/cloud/baremetal/server_rebuild_params.py +23 -0
  126. gcore/types/cloud/baremetal_flavor.py +58 -0
  127. gcore/types/cloud/baremetal_flavor_list.py +16 -0
  128. gcore/types/cloud/billing_reservation.py +153 -0
  129. gcore/types/cloud/billing_reservation_list_params.py +59 -0
  130. gcore/types/cloud/blackhole_port.py +66 -0
  131. gcore/types/cloud/capacity.py +13 -0
  132. gcore/types/cloud/console.py +18 -0
  133. gcore/types/cloud/container_probe.py +36 -0
  134. gcore/types/cloud/container_probe_config.py +16 -0
  135. gcore/types/cloud/container_probe_config_create_param.py +18 -0
  136. gcore/types/cloud/container_probe_create_param.py +38 -0
  137. gcore/types/cloud/container_probe_exec.py +12 -0
  138. gcore/types/cloud/container_probe_exec_create_param.py +13 -0
  139. gcore/types/cloud/container_probe_http_get.py +26 -0
  140. gcore/types/cloud/container_probe_http_get_create_param.py +25 -0
  141. gcore/types/cloud/container_probe_tcp_socket.py +10 -0
  142. gcore/types/cloud/container_probe_tcp_socket_create_param.py +12 -0
  143. gcore/types/cloud/container_scale.py +25 -0
  144. gcore/types/cloud/container_scale_trigger_rate.py +13 -0
  145. gcore/types/cloud/container_scale_trigger_sqs.py +33 -0
  146. gcore/types/cloud/container_scale_trigger_threshold.py +10 -0
  147. gcore/types/cloud/container_scale_triggers.py +36 -0
  148. gcore/types/cloud/ddos_profile.py +33 -0
  149. gcore/types/cloud/ddos_profile_field.py +31 -0
  150. gcore/types/cloud/ddos_profile_option_list.py +15 -0
  151. gcore/types/cloud/ddos_profile_status.py +13 -0
  152. gcore/types/cloud/ddos_profile_template.py +18 -0
  153. gcore/types/cloud/ddos_profile_template_field.py +23 -0
  154. gcore/types/cloud/deploy_status.py +13 -0
  155. gcore/types/cloud/file_share.py +111 -0
  156. gcore/types/cloud/file_share_create_params.py +104 -0
  157. gcore/types/cloud/file_share_list_params.py +24 -0
  158. gcore/types/cloud/file_share_resize_params.py +18 -0
  159. gcore/types/cloud/file_share_update_params.py +18 -0
  160. gcore/types/cloud/file_shares/__init__.py +7 -0
  161. gcore/types/cloud/file_shares/access_rule.py +21 -0
  162. gcore/types/cloud/file_shares/access_rule_create_params.py +21 -0
  163. gcore/types/cloud/file_shares/access_rule_list.py +16 -0
  164. gcore/types/cloud/fixed_address.py +38 -0
  165. gcore/types/cloud/fixed_address_short.py +24 -0
  166. gcore/types/cloud/flavor_hardware_description.py +27 -0
  167. gcore/types/cloud/floating_address.py +15 -0
  168. gcore/types/cloud/floating_ip.py +77 -0
  169. gcore/types/cloud/floating_ip_assign_params.py +20 -0
  170. gcore/types/cloud/floating_ip_create_params.py +40 -0
  171. gcore/types/cloud/floating_ip_detailed.py +222 -0
  172. gcore/types/cloud/floating_ip_list_params.py +35 -0
  173. gcore/types/cloud/floating_ip_status.py +7 -0
  174. gcore/types/cloud/gpu_baremetal_cluster.py +116 -0
  175. gcore/types/cloud/gpu_baremetal_cluster_create_params.py +155 -0
  176. gcore/types/cloud/gpu_baremetal_cluster_delete_params.py +28 -0
  177. gcore/types/cloud/gpu_baremetal_cluster_list_params.py +19 -0
  178. gcore/types/cloud/gpu_baremetal_cluster_rebuild_params.py +26 -0
  179. gcore/types/cloud/gpu_baremetal_cluster_resize_params.py +16 -0
  180. gcore/types/cloud/gpu_baremetal_cluster_server.py +200 -0
  181. gcore/types/cloud/gpu_baremetal_cluster_server_list.py +16 -0
  182. gcore/types/cloud/gpu_baremetal_clusters/__init__.py +9 -0
  183. gcore/types/cloud/gpu_baremetal_clusters/flavor_list_params.py +21 -0
  184. gcore/types/cloud/gpu_baremetal_clusters/image_upload_params.py +58 -0
  185. gcore/types/cloud/gpu_baremetal_clusters/server_attach_interface_params.py +253 -0
  186. gcore/types/cloud/gpu_baremetal_clusters/server_delete_params.py +21 -0
  187. gcore/types/cloud/gpu_baremetal_clusters/server_detach_interface_params.py +19 -0
  188. gcore/types/cloud/gpu_baremetal_flavor.py +133 -0
  189. gcore/types/cloud/gpu_baremetal_flavor_list.py +16 -0
  190. gcore/types/cloud/gpu_image.py +70 -0
  191. gcore/types/cloud/gpu_image_list.py +16 -0
  192. gcore/types/cloud/health_monitor.py +48 -0
  193. gcore/types/cloud/health_monitor_status.py +22 -0
  194. gcore/types/cloud/http_method.py +7 -0
  195. gcore/types/cloud/image.py +100 -0
  196. gcore/types/cloud/image_list.py +16 -0
  197. gcore/types/cloud/inference/__init__.py +25 -0
  198. gcore/types/cloud/inference/container.py +26 -0
  199. gcore/types/cloud/inference/deployment_create_params.py +222 -0
  200. gcore/types/cloud/inference/deployment_list_params.py +21 -0
  201. gcore/types/cloud/inference/deployment_update_params.py +215 -0
  202. gcore/types/cloud/inference/deployments/__init__.py +5 -0
  203. gcore/types/cloud/inference/deployments/log_list_params.py +28 -0
  204. gcore/types/cloud/inference/flavor_list_params.py +18 -0
  205. gcore/types/cloud/inference/inference.py +95 -0
  206. gcore/types/cloud/inference/inference_apikey_secret.py +15 -0
  207. gcore/types/cloud/inference/inference_flavor.py +34 -0
  208. gcore/types/cloud/inference/inference_log.py +21 -0
  209. gcore/types/cloud/inference/inference_registry_credential.py +19 -0
  210. gcore/types/cloud/inference/inference_registry_credential_full.py +22 -0
  211. gcore/types/cloud/inference/inference_secret.py +17 -0
  212. gcore/types/cloud/inference/mlcatalog_model_card.py +65 -0
  213. gcore/types/cloud/inference/mlcatalog_order_by_choices.py +7 -0
  214. gcore/types/cloud/inference/model_list_params.py +23 -0
  215. gcore/types/cloud/inference/registry_credential_create_params.py +24 -0
  216. gcore/types/cloud/inference/registry_credential_list_params.py +21 -0
  217. gcore/types/cloud/inference/registry_credential_replace_params.py +21 -0
  218. gcore/types/cloud/inference/secret_create_params.py +23 -0
  219. gcore/types/cloud/inference/secret_list_params.py +21 -0
  220. gcore/types/cloud/inference/secret_replace_params.py +20 -0
  221. gcore/types/cloud/inference_probes.py +19 -0
  222. gcore/types/cloud/ingress_opts_out.py +16 -0
  223. gcore/types/cloud/ingress_opts_param.py +18 -0
  224. gcore/types/cloud/instance.py +296 -0
  225. gcore/types/cloud/instance_action_params.py +32 -0
  226. gcore/types/cloud/instance_add_to_placement_group_params.py +16 -0
  227. gcore/types/cloud/instance_assign_security_group_params.py +28 -0
  228. gcore/types/cloud/instance_create_params.py +622 -0
  229. gcore/types/cloud/instance_delete_params.py +33 -0
  230. gcore/types/cloud/instance_get_console_params.py +16 -0
  231. gcore/types/cloud/instance_interface.py +40 -0
  232. gcore/types/cloud/instance_isolation.py +12 -0
  233. gcore/types/cloud/instance_list.py +16 -0
  234. gcore/types/cloud/instance_list_params.py +146 -0
  235. gcore/types/cloud/instance_metrics_time_unit.py +7 -0
  236. gcore/types/cloud/instance_resize_params.py +16 -0
  237. gcore/types/cloud/instance_unassign_security_group_params.py +28 -0
  238. gcore/types/cloud/instance_update_params.py +18 -0
  239. gcore/types/cloud/instances/__init__.py +19 -0
  240. gcore/types/cloud/instances/flavor_list_for_resize_params.py +16 -0
  241. gcore/types/cloud/instances/flavor_list_params.py +25 -0
  242. gcore/types/cloud/instances/flavor_list_suitable_params.py +56 -0
  243. gcore/types/cloud/instances/image_create_from_volume_params.py +53 -0
  244. gcore/types/cloud/instances/image_get_params.py +16 -0
  245. gcore/types/cloud/instances/image_list_params.py +33 -0
  246. gcore/types/cloud/instances/image_update_params.py +43 -0
  247. gcore/types/cloud/instances/image_upload_params.py +62 -0
  248. gcore/types/cloud/instances/instance_flavor.py +49 -0
  249. gcore/types/cloud/instances/instance_flavor_list.py +16 -0
  250. gcore/types/cloud/instances/interface_attach_params.py +253 -0
  251. gcore/types/cloud/instances/interface_detach_params.py +19 -0
  252. gcore/types/cloud/instances/metric_list_params.py +23 -0
  253. gcore/types/cloud/instances/metrics.py +52 -0
  254. gcore/types/cloud/instances/metrics_list.py +16 -0
  255. gcore/types/cloud/interface_ip_family.py +7 -0
  256. gcore/types/cloud/ip_assignment.py +13 -0
  257. gcore/types/cloud/ip_ranges.py +12 -0
  258. gcore/types/cloud/ip_version.py +7 -0
  259. gcore/types/cloud/laas_index_retention_policy.py +12 -0
  260. gcore/types/cloud/laas_index_retention_policy_param.py +13 -0
  261. gcore/types/cloud/lb_algorithm.py +7 -0
  262. gcore/types/cloud/lb_health_monitor_type.py +7 -0
  263. gcore/types/cloud/lb_listener_protocol.py +7 -0
  264. gcore/types/cloud/lb_pool_protocol.py +7 -0
  265. gcore/types/cloud/lb_session_persistence_type.py +7 -0
  266. gcore/types/cloud/listener_status.py +27 -0
  267. gcore/types/cloud/load_balancer.py +144 -0
  268. gcore/types/cloud/load_balancer_create_params.py +327 -0
  269. gcore/types/cloud/load_balancer_failover_params.py +16 -0
  270. gcore/types/cloud/load_balancer_flavor_detail.py +40 -0
  271. gcore/types/cloud/load_balancer_flavor_list.py +16 -0
  272. gcore/types/cloud/load_balancer_get_params.py +19 -0
  273. gcore/types/cloud/load_balancer_instance_role.py +7 -0
  274. gcore/types/cloud/load_balancer_l7_policy.py +86 -0
  275. gcore/types/cloud/load_balancer_l7_policy_list.py +16 -0
  276. gcore/types/cloud/load_balancer_l7_rule.py +72 -0
  277. gcore/types/cloud/load_balancer_l7_rule_list.py +16 -0
  278. gcore/types/cloud/load_balancer_list_params.py +53 -0
  279. gcore/types/cloud/load_balancer_listener_detail.py +97 -0
  280. gcore/types/cloud/load_balancer_listener_list.py +16 -0
  281. gcore/types/cloud/load_balancer_member_connectivity.py +7 -0
  282. gcore/types/cloud/load_balancer_metrics.py +32 -0
  283. gcore/types/cloud/load_balancer_metrics_list.py +16 -0
  284. gcore/types/cloud/load_balancer_operating_status.py +7 -0
  285. gcore/types/cloud/load_balancer_pool.py +87 -0
  286. gcore/types/cloud/load_balancer_pool_list.py +16 -0
  287. gcore/types/cloud/load_balancer_resize_params.py +16 -0
  288. gcore/types/cloud/load_balancer_statistics.py +22 -0
  289. gcore/types/cloud/load_balancer_status.py +38 -0
  290. gcore/types/cloud/load_balancer_status_list.py +16 -0
  291. gcore/types/cloud/load_balancer_update_params.py +43 -0
  292. gcore/types/cloud/load_balancers/__init__.py +15 -0
  293. gcore/types/cloud/load_balancers/flavor_list_params.py +16 -0
  294. gcore/types/cloud/load_balancers/l7_policies/__init__.py +6 -0
  295. gcore/types/cloud/load_balancers/l7_policies/rule_create_params.py +50 -0
  296. gcore/types/cloud/load_balancers/l7_policies/rule_replace_params.py +43 -0
  297. gcore/types/cloud/load_balancers/l7_policy_create_params.py +54 -0
  298. gcore/types/cloud/load_balancers/l7_policy_replace_params.py +51 -0
  299. gcore/types/cloud/load_balancers/listener_create_params.py +72 -0
  300. gcore/types/cloud/load_balancers/listener_get_params.py +16 -0
  301. gcore/types/cloud/load_balancers/listener_list_params.py +19 -0
  302. gcore/types/cloud/load_balancers/listener_update_params.py +55 -0
  303. gcore/types/cloud/load_balancers/metric_list_params.py +21 -0
  304. gcore/types/cloud/load_balancers/pool_create_params.py +141 -0
  305. gcore/types/cloud/load_balancers/pool_list_params.py +25 -0
  306. gcore/types/cloud/load_balancers/pool_update_params.py +139 -0
  307. gcore/types/cloud/load_balancers/pools/__init__.py +6 -0
  308. gcore/types/cloud/load_balancers/pools/health_monitor_create_params.py +49 -0
  309. gcore/types/cloud/load_balancers/pools/member_add_params.py +44 -0
  310. gcore/types/cloud/logging.py +22 -0
  311. gcore/types/cloud/member.py +47 -0
  312. gcore/types/cloud/member_status.py +24 -0
  313. gcore/types/cloud/network.py +79 -0
  314. gcore/types/cloud/network_create_params.py +36 -0
  315. gcore/types/cloud/network_details.py +80 -0
  316. gcore/types/cloud/network_interface.py +78 -0
  317. gcore/types/cloud/network_interface_list.py +16 -0
  318. gcore/types/cloud/network_list_params.py +41 -0
  319. gcore/types/cloud/network_update_params.py +18 -0
  320. gcore/types/cloud/networks/__init__.py +14 -0
  321. gcore/types/cloud/networks/router.py +83 -0
  322. gcore/types/cloud/networks/router_attach_subnet_params.py +24 -0
  323. gcore/types/cloud/networks/router_create_params.py +75 -0
  324. gcore/types/cloud/networks/router_detach_subnet_params.py +16 -0
  325. gcore/types/cloud/networks/router_list.py +16 -0
  326. gcore/types/cloud/networks/router_list_params.py +19 -0
  327. gcore/types/cloud/networks/router_update_params.py +45 -0
  328. gcore/types/cloud/networks/subnet_create_params.py +82 -0
  329. gcore/types/cloud/networks/subnet_list_params.py +58 -0
  330. gcore/types/cloud/networks/subnet_update_params.py +47 -0
  331. gcore/types/cloud/placement_group.py +41 -0
  332. gcore/types/cloud/placement_group_create_params.py +19 -0
  333. gcore/types/cloud/placement_group_list.py +16 -0
  334. gcore/types/cloud/pool_status.py +31 -0
  335. gcore/types/cloud/project.py +47 -0
  336. gcore/types/cloud/project_create_params.py +22 -0
  337. gcore/types/cloud/project_list_params.py +27 -0
  338. gcore/types/cloud/project_replace_params.py +18 -0
  339. gcore/types/cloud/provisioning_status.py +9 -0
  340. gcore/types/cloud/quota_get_all_response.py +340 -0
  341. gcore/types/cloud/quota_get_by_region_response.py +288 -0
  342. gcore/types/cloud/quota_get_global_response.py +51 -0
  343. gcore/types/cloud/quotas/__init__.py +8 -0
  344. gcore/types/cloud/quotas/request_create_params.py +193 -0
  345. gcore/types/cloud/quotas/request_get_response.py +205 -0
  346. gcore/types/cloud/quotas/request_list_params.py +22 -0
  347. gcore/types/cloud/quotas/request_list_response.py +205 -0
  348. gcore/types/cloud/region.py +101 -0
  349. gcore/types/cloud/region_capacity.py +16 -0
  350. gcore/types/cloud/region_capacity_list.py +16 -0
  351. gcore/types/cloud/region_get_params.py +18 -0
  352. gcore/types/cloud/region_list_params.py +31 -0
  353. gcore/types/cloud/registries/__init__.py +14 -0
  354. gcore/types/cloud/registries/registry_artifact.py +35 -0
  355. gcore/types/cloud/registries/registry_artifact_list.py +16 -0
  356. gcore/types/cloud/registries/registry_repository.py +30 -0
  357. gcore/types/cloud/registries/registry_repository_list.py +16 -0
  358. gcore/types/cloud/registries/registry_user.py +28 -0
  359. gcore/types/cloud/registries/registry_user_created.py +31 -0
  360. gcore/types/cloud/registries/registry_user_list.py +16 -0
  361. gcore/types/cloud/registries/user_create_multiple_params.py +36 -0
  362. gcore/types/cloud/registries/user_create_params.py +30 -0
  363. gcore/types/cloud/registries/user_update_params.py +21 -0
  364. gcore/types/cloud/registry.py +33 -0
  365. gcore/types/cloud/registry_create_params.py +24 -0
  366. gcore/types/cloud/registry_list.py +16 -0
  367. gcore/types/cloud/registry_resize_params.py +16 -0
  368. gcore/types/cloud/registry_tag.py +27 -0
  369. gcore/types/cloud/reserved_fixed_ip.py +98 -0
  370. gcore/types/cloud/reserved_fixed_ip_create_params.py +107 -0
  371. gcore/types/cloud/reserved_fixed_ip_list_params.py +47 -0
  372. gcore/types/cloud/reserved_fixed_ips/__init__.py +12 -0
  373. gcore/types/cloud/reserved_fixed_ips/candidate_port.py +26 -0
  374. gcore/types/cloud/reserved_fixed_ips/candidate_port_list.py +16 -0
  375. gcore/types/cloud/reserved_fixed_ips/connected_port.py +26 -0
  376. gcore/types/cloud/reserved_fixed_ips/connected_port_list.py +16 -0
  377. gcore/types/cloud/reserved_fixed_ips/ip_with_subnet.py +17 -0
  378. gcore/types/cloud/reserved_fixed_ips/vip_replace_connected_ports_params.py +17 -0
  379. gcore/types/cloud/reserved_fixed_ips/vip_toggle_params.py +16 -0
  380. gcore/types/cloud/reserved_fixed_ips/vip_update_connected_ports_params.py +17 -0
  381. gcore/types/cloud/route.py +16 -0
  382. gcore/types/cloud/secret.py +64 -0
  383. gcore/types/cloud/secret_create_params.py +66 -0
  384. gcore/types/cloud/secret_list_response.py +16 -0
  385. gcore/types/cloud/secret_upload_tls_certificate_params.py +39 -0
  386. gcore/types/cloud/security_group.py +45 -0
  387. gcore/types/cloud/security_group_copy_params.py +16 -0
  388. gcore/types/cloud/security_group_create_params.py +94 -0
  389. gcore/types/cloud/security_group_list_params.py +30 -0
  390. gcore/types/cloud/security_group_rule.py +83 -0
  391. gcore/types/cloud/security_group_update_params.py +83 -0
  392. gcore/types/cloud/security_groups/__init__.py +6 -0
  393. gcore/types/cloud/security_groups/rule_create_params.py +65 -0
  394. gcore/types/cloud/security_groups/rule_replace_params.py +72 -0
  395. gcore/types/cloud/session_persistence.py +22 -0
  396. gcore/types/cloud/ssh_key.py +39 -0
  397. gcore/types/cloud/ssh_key_create_params.py +31 -0
  398. gcore/types/cloud/ssh_key_created.py +53 -0
  399. gcore/types/cloud/ssh_key_list_params.py +21 -0
  400. gcore/types/cloud/ssh_key_update_params.py +15 -0
  401. gcore/types/cloud/subnet.py +87 -0
  402. gcore/types/cloud/tag.py +16 -0
  403. gcore/types/cloud/tag_update_map_param.py +10 -0
  404. gcore/types/cloud/task.py +191 -0
  405. gcore/types/cloud/task_acknowledge_all_params.py +16 -0
  406. gcore/types/cloud/task_id_list.py +12 -0
  407. gcore/types/cloud/task_list_params.py +104 -0
  408. gcore/types/cloud/users/__init__.py +9 -0
  409. gcore/types/cloud/users/role_assignment.py +33 -0
  410. gcore/types/cloud/users/role_assignment_create_params.py +22 -0
  411. gcore/types/cloud/users/role_assignment_list_params.py +25 -0
  412. gcore/types/cloud/users/role_assignment_update_delete.py +10 -0
  413. gcore/types/cloud/users/role_assignment_update_params.py +22 -0
  414. gcore/types/cloud/volume.py +141 -0
  415. gcore/types/cloud/volume_attach_to_instance_params.py +21 -0
  416. gcore/types/cloud/volume_change_type_params.py +18 -0
  417. gcore/types/cloud/volume_create_params.py +176 -0
  418. gcore/types/cloud/volume_delete_params.py +18 -0
  419. gcore/types/cloud/volume_detach_from_instance_params.py +18 -0
  420. gcore/types/cloud/volume_list_params.py +56 -0
  421. gcore/types/cloud/volume_resize_params.py +18 -0
  422. gcore/types/cloud/volume_update_params.py +18 -0
  423. gcore/types/waap/__init__.py +12 -0
  424. gcore/types/waap/domain_list_params.py +30 -0
  425. gcore/types/waap/domain_update_params.py +12 -0
  426. gcore/types/waap/domains/__init__.py +5 -0
  427. gcore/types/waap/domains/setting_update_params.py +41 -0
  428. gcore/types/waap/waap_api_urls.py +15 -0
  429. gcore/types/waap/waap_detailed_domain.py +37 -0
  430. gcore/types/waap/waap_domain_ddos_settings.py +31 -0
  431. gcore/types/waap/waap_domain_settings.py +15 -0
  432. gcore/types/waap/waap_domain_status.py +7 -0
  433. gcore/types/waap/waap_summary_domain.py +26 -0
  434. gcore-0.1.0.dist-info/METADATA +482 -0
  435. gcore-0.1.0.dist-info/RECORD +437 -0
  436. gcore-0.1.0.dist-info/WHEEL +4 -0
  437. gcore-0.1.0.dist-info/licenses/LICENSE +201 -0
@@ -0,0 +1,1493 @@
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 Dict, List, Iterable, Optional
6
+
7
+ import httpx
8
+
9
+ from .logs import (
10
+ LogsResource,
11
+ AsyncLogsResource,
12
+ LogsResourceWithRawResponse,
13
+ AsyncLogsResourceWithRawResponse,
14
+ LogsResourceWithStreamingResponse,
15
+ AsyncLogsResourceWithStreamingResponse,
16
+ )
17
+ from ....._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven
18
+ from ....._utils import maybe_transform, async_maybe_transform
19
+ from ....._compat import cached_property
20
+ from ....._resource import SyncAPIResource, AsyncAPIResource
21
+ from ....._response import (
22
+ to_raw_response_wrapper,
23
+ to_streamed_response_wrapper,
24
+ async_to_raw_response_wrapper,
25
+ async_to_streamed_response_wrapper,
26
+ )
27
+ from .....pagination import SyncOffsetPage, AsyncOffsetPage
28
+ from ....._base_client import AsyncPaginator, make_request_options
29
+ from .....types.cloud.inference import deployment_list_params, deployment_create_params, deployment_update_params
30
+ from .....types.cloud.task_id_list import TaskIDList
31
+ from .....types.cloud.ingress_opts_param import IngressOptsParam
32
+ from .....types.cloud.inference.inference import Inference
33
+ from .....types.cloud.inference.inference_apikey_secret import InferenceApikeySecret
34
+
35
+ __all__ = ["DeploymentsResource", "AsyncDeploymentsResource"]
36
+
37
+
38
+ class DeploymentsResource(SyncAPIResource):
39
+ @cached_property
40
+ def logs(self) -> LogsResource:
41
+ return LogsResource(self._client)
42
+
43
+ @cached_property
44
+ def with_raw_response(self) -> DeploymentsResourceWithRawResponse:
45
+ """
46
+ This property can be used as a prefix for any HTTP method call to return
47
+ the raw response object instead of the parsed content.
48
+
49
+ For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers
50
+ """
51
+ return DeploymentsResourceWithRawResponse(self)
52
+
53
+ @cached_property
54
+ def with_streaming_response(self) -> DeploymentsResourceWithStreamingResponse:
55
+ """
56
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
57
+
58
+ For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response
59
+ """
60
+ return DeploymentsResourceWithStreamingResponse(self)
61
+
62
+ def create(
63
+ self,
64
+ *,
65
+ project_id: int | None = None,
66
+ containers: Iterable[deployment_create_params.Container],
67
+ flavor_name: str,
68
+ image: str,
69
+ listening_port: int,
70
+ name: str,
71
+ auth_enabled: bool | NotGiven = NOT_GIVEN,
72
+ command: Optional[List[str]] | NotGiven = NOT_GIVEN,
73
+ credentials_name: Optional[str] | NotGiven = NOT_GIVEN,
74
+ description: Optional[str] | NotGiven = NOT_GIVEN,
75
+ envs: Dict[str, str] | NotGiven = NOT_GIVEN,
76
+ ingress_opts: Optional[IngressOptsParam] | NotGiven = NOT_GIVEN,
77
+ logging: Optional[deployment_create_params.Logging] | NotGiven = NOT_GIVEN,
78
+ probes: Optional[deployment_create_params.Probes] | NotGiven = NOT_GIVEN,
79
+ api_timeout: Optional[int] | NotGiven = NOT_GIVEN,
80
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
81
+ # The extra values given here take precedence over values defined on the client or passed to this method.
82
+ extra_headers: Headers | None = None,
83
+ extra_query: Query | None = None,
84
+ extra_body: Body | None = None,
85
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
86
+ ) -> TaskIDList:
87
+ """
88
+ Create inference deployment
89
+
90
+ Args:
91
+ project_id: Project ID
92
+
93
+ containers: List of containers for the inference instance.
94
+
95
+ flavor_name: Flavor name for the inference instance.
96
+
97
+ image: Docker image for the inference instance. This field should contain the image
98
+ name and tag in the format 'name:tag', e.g., 'nginx:latest'. It defaults to
99
+ Docker Hub as the image registry, but any accessible Docker image URL can be
100
+ specified.
101
+
102
+ listening_port: Listening port for the inference instance.
103
+
104
+ name: Inference instance name.
105
+
106
+ auth_enabled: Set to `true` to enable API key authentication for the inference instance.
107
+ `"Authorization": "Bearer *****"` or `"X-Api-Key": "*****"` header is required
108
+ for the requests to the instance if enabled
109
+
110
+ command: Command to be executed when running a container from an image.
111
+
112
+ credentials_name: Registry credentials name
113
+
114
+ description: Inference instance description.
115
+
116
+ envs: Environment variables for the inference instance.
117
+
118
+ ingress_opts: Ingress options for the inference instance
119
+
120
+ logging: Logging configuration for the inference instance
121
+
122
+ probes: Probes configured for all containers of the inference instance. If probes are
123
+ not provided, and the image_name is from a the Model Catalog registry, the
124
+ default probes will be used.
125
+
126
+ api_timeout: Specifies the duration in seconds without any requests after which the
127
+ containers will be downscaled to their minimum scale value as defined by
128
+ `scale.min`. If set, this helps in optimizing resource usage by reducing the
129
+ number of container instances during periods of inactivity. The default value
130
+ when the parameter is not set is 120.
131
+
132
+ extra_headers: Send extra headers
133
+
134
+ extra_query: Add additional query parameters to the request
135
+
136
+ extra_body: Add additional JSON properties to the request
137
+
138
+ timeout: Override the client-level default timeout for this request, in seconds
139
+ """
140
+ if project_id is None:
141
+ project_id = self._client._get_cloud_project_id_path_param()
142
+ return self._post(
143
+ f"/cloud/v3/inference/{project_id}/deployments",
144
+ body=maybe_transform(
145
+ {
146
+ "containers": containers,
147
+ "flavor_name": flavor_name,
148
+ "image": image,
149
+ "listening_port": listening_port,
150
+ "name": name,
151
+ "auth_enabled": auth_enabled,
152
+ "command": command,
153
+ "credentials_name": credentials_name,
154
+ "description": description,
155
+ "envs": envs,
156
+ "ingress_opts": ingress_opts,
157
+ "logging": logging,
158
+ "probes": probes,
159
+ "api_timeout": api_timeout,
160
+ },
161
+ deployment_create_params.DeploymentCreateParams,
162
+ ),
163
+ options=make_request_options(
164
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
165
+ ),
166
+ cast_to=TaskIDList,
167
+ )
168
+
169
+ def update(
170
+ self,
171
+ deployment_name: str,
172
+ *,
173
+ project_id: int | None = None,
174
+ auth_enabled: Optional[bool] | NotGiven = NOT_GIVEN,
175
+ command: Optional[List[str]] | NotGiven = NOT_GIVEN,
176
+ containers: Optional[Iterable[deployment_update_params.Container]] | NotGiven = NOT_GIVEN,
177
+ credentials_name: Optional[str] | NotGiven = NOT_GIVEN,
178
+ description: Optional[str] | NotGiven = NOT_GIVEN,
179
+ envs: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
180
+ flavor_name: Optional[str] | NotGiven = NOT_GIVEN,
181
+ image: Optional[str] | NotGiven = NOT_GIVEN,
182
+ ingress_opts: Optional[IngressOptsParam] | NotGiven = NOT_GIVEN,
183
+ listening_port: Optional[int] | NotGiven = NOT_GIVEN,
184
+ logging: Optional[deployment_update_params.Logging] | NotGiven = NOT_GIVEN,
185
+ probes: Optional[deployment_update_params.Probes] | NotGiven = NOT_GIVEN,
186
+ api_timeout: Optional[int] | NotGiven = NOT_GIVEN,
187
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
188
+ # The extra values given here take precedence over values defined on the client or passed to this method.
189
+ extra_headers: Headers | None = None,
190
+ extra_query: Query | None = None,
191
+ extra_body: Body | None = None,
192
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
193
+ ) -> TaskIDList:
194
+ """
195
+ Update inference deployment
196
+
197
+ Args:
198
+ project_id: Project ID
199
+
200
+ deployment_name: Inference instance name.
201
+
202
+ auth_enabled: Set to `true` to enable API key authentication for the inference instance.
203
+ `"Authorization": "Bearer *****"` or `"X-Api-Key": "*****"` header is required
204
+ for the requests to the instance if enabled
205
+
206
+ command: Command to be executed when running a container from an image.
207
+
208
+ containers: List of containers for the inference instance.
209
+
210
+ credentials_name: Registry credentials name
211
+
212
+ description: Inference instance description.
213
+
214
+ envs: Environment variables for the inference instance.
215
+
216
+ flavor_name: Flavor name for the inference instance.
217
+
218
+ image: Docker image for the inference instance. This field should contain the image
219
+ name and tag in the format 'name:tag', e.g., 'nginx:latest'. It defaults to
220
+ Docker Hub as the image registry, but any accessible Docker image URL can be
221
+ specified.
222
+
223
+ ingress_opts: Ingress options for the inference instance
224
+
225
+ listening_port: Listening port for the inference instance.
226
+
227
+ logging: Logging configuration for the inference instance
228
+
229
+ probes: Probes configured for all containers of the inference instance.
230
+
231
+ api_timeout: Specifies the duration in seconds without any requests after which the
232
+ containers will be downscaled to their minimum scale value as defined by
233
+ `scale.min`. If set, this helps in optimizing resource usage by reducing the
234
+ number of container instances during periods of inactivity. The default value
235
+ when the parameter is not set is 120.
236
+
237
+ extra_headers: Send extra headers
238
+
239
+ extra_query: Add additional query parameters to the request
240
+
241
+ extra_body: Add additional JSON properties to the request
242
+
243
+ timeout: Override the client-level default timeout for this request, in seconds
244
+ """
245
+ if project_id is None:
246
+ project_id = self._client._get_cloud_project_id_path_param()
247
+ if not deployment_name:
248
+ raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}")
249
+ return self._patch(
250
+ f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}",
251
+ body=maybe_transform(
252
+ {
253
+ "auth_enabled": auth_enabled,
254
+ "command": command,
255
+ "containers": containers,
256
+ "credentials_name": credentials_name,
257
+ "description": description,
258
+ "envs": envs,
259
+ "flavor_name": flavor_name,
260
+ "image": image,
261
+ "ingress_opts": ingress_opts,
262
+ "listening_port": listening_port,
263
+ "logging": logging,
264
+ "probes": probes,
265
+ "api_timeout": api_timeout,
266
+ },
267
+ deployment_update_params.DeploymentUpdateParams,
268
+ ),
269
+ options=make_request_options(
270
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
271
+ ),
272
+ cast_to=TaskIDList,
273
+ )
274
+
275
+ def list(
276
+ self,
277
+ *,
278
+ project_id: int | None = None,
279
+ limit: int | NotGiven = NOT_GIVEN,
280
+ offset: int | NotGiven = NOT_GIVEN,
281
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
282
+ # The extra values given here take precedence over values defined on the client or passed to this method.
283
+ extra_headers: Headers | None = None,
284
+ extra_query: Query | None = None,
285
+ extra_body: Body | None = None,
286
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
287
+ ) -> SyncOffsetPage[Inference]:
288
+ """List inference deployments
289
+
290
+ Args:
291
+ project_id: Project ID
292
+
293
+ limit: Optional.
294
+
295
+ Limit the number of returned items
296
+
297
+ offset: Optional. Offset value is used to exclude the first set of records from the
298
+ result
299
+
300
+ extra_headers: Send extra headers
301
+
302
+ extra_query: Add additional query parameters to the request
303
+
304
+ extra_body: Add additional JSON properties to the request
305
+
306
+ timeout: Override the client-level default timeout for this request, in seconds
307
+ """
308
+ if project_id is None:
309
+ project_id = self._client._get_cloud_project_id_path_param()
310
+ return self._get_api_list(
311
+ f"/cloud/v3/inference/{project_id}/deployments",
312
+ page=SyncOffsetPage[Inference],
313
+ options=make_request_options(
314
+ extra_headers=extra_headers,
315
+ extra_query=extra_query,
316
+ extra_body=extra_body,
317
+ timeout=timeout,
318
+ query=maybe_transform(
319
+ {
320
+ "limit": limit,
321
+ "offset": offset,
322
+ },
323
+ deployment_list_params.DeploymentListParams,
324
+ ),
325
+ ),
326
+ model=Inference,
327
+ )
328
+
329
+ def delete(
330
+ self,
331
+ deployment_name: str,
332
+ *,
333
+ project_id: int | None = None,
334
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
335
+ # The extra values given here take precedence over values defined on the client or passed to this method.
336
+ extra_headers: Headers | None = None,
337
+ extra_query: Query | None = None,
338
+ extra_body: Body | None = None,
339
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
340
+ ) -> TaskIDList:
341
+ """
342
+ Delete inference deployment
343
+
344
+ Args:
345
+ project_id: Project ID
346
+
347
+ deployment_name: Inference instance name.
348
+
349
+ extra_headers: Send extra headers
350
+
351
+ extra_query: Add additional query parameters to the request
352
+
353
+ extra_body: Add additional JSON properties to the request
354
+
355
+ timeout: Override the client-level default timeout for this request, in seconds
356
+ """
357
+ if project_id is None:
358
+ project_id = self._client._get_cloud_project_id_path_param()
359
+ if not deployment_name:
360
+ raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}")
361
+ return self._delete(
362
+ f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}",
363
+ options=make_request_options(
364
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
365
+ ),
366
+ cast_to=TaskIDList,
367
+ )
368
+
369
+ def get(
370
+ self,
371
+ deployment_name: str,
372
+ *,
373
+ project_id: int | None = None,
374
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
375
+ # The extra values given here take precedence over values defined on the client or passed to this method.
376
+ extra_headers: Headers | None = None,
377
+ extra_query: Query | None = None,
378
+ extra_body: Body | None = None,
379
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
380
+ ) -> Inference:
381
+ """
382
+ Get inference deployment
383
+
384
+ Args:
385
+ project_id: Project ID
386
+
387
+ deployment_name: Inference instance name.
388
+
389
+ extra_headers: Send extra headers
390
+
391
+ extra_query: Add additional query parameters to the request
392
+
393
+ extra_body: Add additional JSON properties to the request
394
+
395
+ timeout: Override the client-level default timeout for this request, in seconds
396
+ """
397
+ if project_id is None:
398
+ project_id = self._client._get_cloud_project_id_path_param()
399
+ if not deployment_name:
400
+ raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}")
401
+ return self._get(
402
+ f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}",
403
+ options=make_request_options(
404
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
405
+ ),
406
+ cast_to=Inference,
407
+ )
408
+
409
+ def get_api_key(
410
+ self,
411
+ deployment_name: str,
412
+ *,
413
+ project_id: int | None = None,
414
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
415
+ # The extra values given here take precedence over values defined on the client or passed to this method.
416
+ extra_headers: Headers | None = None,
417
+ extra_query: Query | None = None,
418
+ extra_body: Body | None = None,
419
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
420
+ ) -> InferenceApikeySecret:
421
+ """
422
+ Get inference deployment API key
423
+
424
+ Args:
425
+ project_id: Project ID
426
+
427
+ deployment_name: Inference instance name.
428
+
429
+ extra_headers: Send extra headers
430
+
431
+ extra_query: Add additional query parameters to the request
432
+
433
+ extra_body: Add additional JSON properties to the request
434
+
435
+ timeout: Override the client-level default timeout for this request, in seconds
436
+ """
437
+ if project_id is None:
438
+ project_id = self._client._get_cloud_project_id_path_param()
439
+ if not deployment_name:
440
+ raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}")
441
+ return self._get(
442
+ f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/apikey",
443
+ options=make_request_options(
444
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
445
+ ),
446
+ cast_to=InferenceApikeySecret,
447
+ )
448
+
449
+ def start(
450
+ self,
451
+ deployment_name: str,
452
+ *,
453
+ project_id: int | None = None,
454
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
455
+ # The extra values given here take precedence over values defined on the client or passed to this method.
456
+ extra_headers: Headers | None = None,
457
+ extra_query: Query | None = None,
458
+ extra_body: Body | None = None,
459
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
460
+ ) -> None:
461
+ """
462
+ This operation initializes an inference deployment after it was stopped, making
463
+ it available to handle inference requests again. The instance will launch with
464
+ the **minimum** number of replicas defined in the scaling settings.
465
+
466
+ - If the minimum replicas are set to **0**, the instance will initially start
467
+ with **0** replicas.
468
+ - It will automatically scale up when it receives requests or SQS messages,
469
+ according to the configured scaling rules.
470
+
471
+ Args:
472
+ project_id: Project ID
473
+
474
+ deployment_name: Inference instance name.
475
+
476
+ extra_headers: Send extra headers
477
+
478
+ extra_query: Add additional query parameters to the request
479
+
480
+ extra_body: Add additional JSON properties to the request
481
+
482
+ timeout: Override the client-level default timeout for this request, in seconds
483
+ """
484
+ if project_id is None:
485
+ project_id = self._client._get_cloud_project_id_path_param()
486
+ if not deployment_name:
487
+ raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}")
488
+ extra_headers = {"Accept": "*/*", **(extra_headers or {})}
489
+ return self._post(
490
+ f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/start",
491
+ options=make_request_options(
492
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
493
+ ),
494
+ cast_to=NoneType,
495
+ )
496
+
497
+ def stop(
498
+ self,
499
+ deployment_name: str,
500
+ *,
501
+ project_id: int | None = None,
502
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
503
+ # The extra values given here take precedence over values defined on the client or passed to this method.
504
+ extra_headers: Headers | None = None,
505
+ extra_query: Query | None = None,
506
+ extra_body: Body | None = None,
507
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
508
+ ) -> None:
509
+ """
510
+ This operation shuts down an inference deployment, making it unavailable for
511
+ handling requests. The deployment will scale down to **0** replicas, overriding
512
+ any minimum replica settings.
513
+
514
+ - Once stopped, the deployment will **not** process any inference requests or
515
+ SQS messages.
516
+ - It will **not** restart automatically and must be started manually.
517
+ - While stopped, the deployment will **not** incur any charges.
518
+
519
+ Args:
520
+ project_id: Project ID
521
+
522
+ deployment_name: Inference instance name.
523
+
524
+ extra_headers: Send extra headers
525
+
526
+ extra_query: Add additional query parameters to the request
527
+
528
+ extra_body: Add additional JSON properties to the request
529
+
530
+ timeout: Override the client-level default timeout for this request, in seconds
531
+ """
532
+ if project_id is None:
533
+ project_id = self._client._get_cloud_project_id_path_param()
534
+ if not deployment_name:
535
+ raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}")
536
+ extra_headers = {"Accept": "*/*", **(extra_headers or {})}
537
+ return self._post(
538
+ f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/stop",
539
+ options=make_request_options(
540
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
541
+ ),
542
+ cast_to=NoneType,
543
+ )
544
+
545
+ def create_and_poll(
546
+ self,
547
+ *,
548
+ project_id: int | None = None,
549
+ containers: Iterable[deployment_create_params.Container],
550
+ flavor_name: str,
551
+ image: str,
552
+ listening_port: int,
553
+ name: str,
554
+ auth_enabled: bool | NotGiven = NOT_GIVEN,
555
+ command: Optional[List[str]] | NotGiven = NOT_GIVEN,
556
+ credentials_name: Optional[str] | NotGiven = NOT_GIVEN,
557
+ description: Optional[str] | NotGiven = NOT_GIVEN,
558
+ envs: Dict[str, str] | NotGiven = NOT_GIVEN,
559
+ ingress_opts: Optional[IngressOptsParam] | NotGiven = NOT_GIVEN,
560
+ logging: Optional[deployment_create_params.Logging] | NotGiven = NOT_GIVEN,
561
+ probes: Optional[deployment_create_params.Probes] | NotGiven = NOT_GIVEN,
562
+ api_timeout: Optional[int] | NotGiven = NOT_GIVEN,
563
+ polling_interval_seconds: int | NotGiven = NOT_GIVEN,
564
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
565
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
566
+ # The extra values given here take precedence over values defined on the client or passed to this method.
567
+ extra_headers: Headers | None = None,
568
+ extra_query: Query | None = None,
569
+ extra_body: Body | None = None,
570
+ ) -> Inference:
571
+ response = self.create(
572
+ project_id=project_id,
573
+ containers=containers,
574
+ flavor_name=flavor_name,
575
+ image=image,
576
+ listening_port=listening_port,
577
+ name=name,
578
+ auth_enabled=auth_enabled,
579
+ command=command,
580
+ credentials_name=credentials_name,
581
+ description=description,
582
+ envs=envs,
583
+ ingress_opts=ingress_opts,
584
+ logging=logging,
585
+ probes=probes,
586
+ api_timeout=api_timeout,
587
+ extra_headers=extra_headers,
588
+ extra_query=extra_query,
589
+ extra_body=extra_body,
590
+ timeout=timeout,
591
+ )
592
+ if not response.tasks or len(response.tasks) != 1:
593
+ raise ValueError(f"Expected exactly one task to be created")
594
+ task = self._client.cloud.tasks.poll(
595
+ task_id=response.tasks[0],
596
+ extra_headers=extra_headers,
597
+ polling_interval_seconds=polling_interval_seconds,
598
+ )
599
+ if not task.created_resources or not task.created_resources.inference_instances or len(task.created_resources.inference_instances) != 1:
600
+ raise ValueError(f"Expected exactly one resource to be created in a task")
601
+ return self.get(
602
+ deployment_name=task.created_resources.inference_instances[0],
603
+ project_id=project_id,
604
+ extra_headers=extra_headers,
605
+ timeout=timeout,
606
+ )
607
+
608
+ def update_and_poll(
609
+ self,
610
+ deployment_name: str,
611
+ *,
612
+ project_id: int | None = None,
613
+ auth_enabled: Optional[bool] | NotGiven = NOT_GIVEN,
614
+ command: Optional[List[str]] | NotGiven = NOT_GIVEN,
615
+ containers: Optional[Iterable[deployment_update_params.Container]] | NotGiven = NOT_GIVEN,
616
+ credentials_name: Optional[str] | NotGiven = NOT_GIVEN,
617
+ description: Optional[str] | NotGiven = NOT_GIVEN,
618
+ envs: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
619
+ flavor_name: Optional[str] | NotGiven = NOT_GIVEN,
620
+ image: Optional[str] | NotGiven = NOT_GIVEN,
621
+ ingress_opts: Optional[IngressOptsParam] | NotGiven = NOT_GIVEN,
622
+ listening_port: Optional[int] | NotGiven = NOT_GIVEN,
623
+ logging: Optional[deployment_update_params.Logging] | NotGiven = NOT_GIVEN,
624
+ probes: Optional[deployment_update_params.Probes] | NotGiven = NOT_GIVEN,
625
+ api_timeout: Optional[int] | NotGiven = NOT_GIVEN,
626
+ polling_interval_seconds: int | NotGiven = NOT_GIVEN,
627
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
628
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
629
+ # The extra values given here take precedence over values defined on the client or passed to this method.
630
+ extra_headers: Headers | None = None,
631
+ extra_query: Query | None = None,
632
+ extra_body: Body | None = None,
633
+ ) -> Inference:
634
+ response = self.update(
635
+ deployment_name=deployment_name,
636
+ project_id=project_id,
637
+ auth_enabled=auth_enabled,
638
+ command=command,
639
+ containers=containers,
640
+ credentials_name=credentials_name,
641
+ description=description,
642
+ envs=envs,
643
+ flavor_name=flavor_name,
644
+ image=image,
645
+ ingress_opts=ingress_opts,
646
+ listening_port=listening_port,
647
+ logging=logging,
648
+ probes=probes,
649
+ api_timeout=api_timeout,
650
+ extra_headers=extra_headers,
651
+ extra_query=extra_query,
652
+ extra_body=extra_body,
653
+ timeout=timeout,
654
+ )
655
+ if not response.tasks or len(response.tasks) != 1:
656
+ raise ValueError(f"Expected exactly one task to be created")
657
+ self._client.cloud.tasks.poll(
658
+ task_id=response.tasks[0],
659
+ extra_headers=extra_headers,
660
+ polling_interval_seconds=polling_interval_seconds,
661
+ )
662
+ return self.get(
663
+ deployment_name=deployment_name,
664
+ project_id=project_id,
665
+ extra_headers=extra_headers,
666
+ timeout=timeout,
667
+ )
668
+
669
+ def delete_and_poll(
670
+ self,
671
+ deployment_name: str,
672
+ *,
673
+ project_id: int | None = None,
674
+ polling_interval_seconds: int | NotGiven = NOT_GIVEN,
675
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
676
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
677
+ # The extra values given here take precedence over values defined on the client or passed to this method.
678
+ extra_headers: Headers | None = None,
679
+ extra_query: Query | None = None,
680
+ extra_body: Body | None = None,
681
+ ) -> None:
682
+ response = self.delete(
683
+ deployment_name=deployment_name,
684
+ project_id=project_id,
685
+ extra_headers=extra_headers,
686
+ extra_query=extra_query,
687
+ extra_body=extra_body,
688
+ timeout=timeout,
689
+ )
690
+ if not response.tasks or len(response.tasks) != 1:
691
+ raise ValueError(f"Expected exactly one task to be created")
692
+ self._client.cloud.tasks.poll(
693
+ task_id=response.tasks[0],
694
+ extra_headers=extra_headers,
695
+ polling_interval_seconds=polling_interval_seconds,
696
+ )
697
+
698
+
699
+ class AsyncDeploymentsResource(AsyncAPIResource):
700
+ @cached_property
701
+ def logs(self) -> AsyncLogsResource:
702
+ return AsyncLogsResource(self._client)
703
+
704
+ @cached_property
705
+ def with_raw_response(self) -> AsyncDeploymentsResourceWithRawResponse:
706
+ """
707
+ This property can be used as a prefix for any HTTP method call to return
708
+ the raw response object instead of the parsed content.
709
+
710
+ For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers
711
+ """
712
+ return AsyncDeploymentsResourceWithRawResponse(self)
713
+
714
+ @cached_property
715
+ def with_streaming_response(self) -> AsyncDeploymentsResourceWithStreamingResponse:
716
+ """
717
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
718
+
719
+ For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response
720
+ """
721
+ return AsyncDeploymentsResourceWithStreamingResponse(self)
722
+
723
+ async def create(
724
+ self,
725
+ *,
726
+ project_id: int | None = None,
727
+ containers: Iterable[deployment_create_params.Container],
728
+ flavor_name: str,
729
+ image: str,
730
+ listening_port: int,
731
+ name: str,
732
+ auth_enabled: bool | NotGiven = NOT_GIVEN,
733
+ command: Optional[List[str]] | NotGiven = NOT_GIVEN,
734
+ credentials_name: Optional[str] | NotGiven = NOT_GIVEN,
735
+ description: Optional[str] | NotGiven = NOT_GIVEN,
736
+ envs: Dict[str, str] | NotGiven = NOT_GIVEN,
737
+ ingress_opts: Optional[IngressOptsParam] | NotGiven = NOT_GIVEN,
738
+ logging: Optional[deployment_create_params.Logging] | NotGiven = NOT_GIVEN,
739
+ probes: Optional[deployment_create_params.Probes] | NotGiven = NOT_GIVEN,
740
+ api_timeout: Optional[int] | NotGiven = NOT_GIVEN,
741
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
742
+ # The extra values given here take precedence over values defined on the client or passed to this method.
743
+ extra_headers: Headers | None = None,
744
+ extra_query: Query | None = None,
745
+ extra_body: Body | None = None,
746
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
747
+ ) -> TaskIDList:
748
+ """
749
+ Create inference deployment
750
+
751
+ Args:
752
+ project_id: Project ID
753
+
754
+ containers: List of containers for the inference instance.
755
+
756
+ flavor_name: Flavor name for the inference instance.
757
+
758
+ image: Docker image for the inference instance. This field should contain the image
759
+ name and tag in the format 'name:tag', e.g., 'nginx:latest'. It defaults to
760
+ Docker Hub as the image registry, but any accessible Docker image URL can be
761
+ specified.
762
+
763
+ listening_port: Listening port for the inference instance.
764
+
765
+ name: Inference instance name.
766
+
767
+ auth_enabled: Set to `true` to enable API key authentication for the inference instance.
768
+ `"Authorization": "Bearer *****"` or `"X-Api-Key": "*****"` header is required
769
+ for the requests to the instance if enabled
770
+
771
+ command: Command to be executed when running a container from an image.
772
+
773
+ credentials_name: Registry credentials name
774
+
775
+ description: Inference instance description.
776
+
777
+ envs: Environment variables for the inference instance.
778
+
779
+ ingress_opts: Ingress options for the inference instance
780
+
781
+ logging: Logging configuration for the inference instance
782
+
783
+ probes: Probes configured for all containers of the inference instance. If probes are
784
+ not provided, and the image_name is from a the Model Catalog registry, the
785
+ default probes will be used.
786
+
787
+ api_timeout: Specifies the duration in seconds without any requests after which the
788
+ containers will be downscaled to their minimum scale value as defined by
789
+ `scale.min`. If set, this helps in optimizing resource usage by reducing the
790
+ number of container instances during periods of inactivity. The default value
791
+ when the parameter is not set is 120.
792
+
793
+ extra_headers: Send extra headers
794
+
795
+ extra_query: Add additional query parameters to the request
796
+
797
+ extra_body: Add additional JSON properties to the request
798
+
799
+ timeout: Override the client-level default timeout for this request, in seconds
800
+ """
801
+ if project_id is None:
802
+ project_id = self._client._get_cloud_project_id_path_param()
803
+ return await self._post(
804
+ f"/cloud/v3/inference/{project_id}/deployments",
805
+ body=await async_maybe_transform(
806
+ {
807
+ "containers": containers,
808
+ "flavor_name": flavor_name,
809
+ "image": image,
810
+ "listening_port": listening_port,
811
+ "name": name,
812
+ "auth_enabled": auth_enabled,
813
+ "command": command,
814
+ "credentials_name": credentials_name,
815
+ "description": description,
816
+ "envs": envs,
817
+ "ingress_opts": ingress_opts,
818
+ "logging": logging,
819
+ "probes": probes,
820
+ "api_timeout": api_timeout,
821
+ },
822
+ deployment_create_params.DeploymentCreateParams,
823
+ ),
824
+ options=make_request_options(
825
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
826
+ ),
827
+ cast_to=TaskIDList,
828
+ )
829
+
830
+ async def update(
831
+ self,
832
+ deployment_name: str,
833
+ *,
834
+ project_id: int | None = None,
835
+ auth_enabled: Optional[bool] | NotGiven = NOT_GIVEN,
836
+ command: Optional[List[str]] | NotGiven = NOT_GIVEN,
837
+ containers: Optional[Iterable[deployment_update_params.Container]] | NotGiven = NOT_GIVEN,
838
+ credentials_name: Optional[str] | NotGiven = NOT_GIVEN,
839
+ description: Optional[str] | NotGiven = NOT_GIVEN,
840
+ envs: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
841
+ flavor_name: Optional[str] | NotGiven = NOT_GIVEN,
842
+ image: Optional[str] | NotGiven = NOT_GIVEN,
843
+ ingress_opts: Optional[IngressOptsParam] | NotGiven = NOT_GIVEN,
844
+ listening_port: Optional[int] | NotGiven = NOT_GIVEN,
845
+ logging: Optional[deployment_update_params.Logging] | NotGiven = NOT_GIVEN,
846
+ probes: Optional[deployment_update_params.Probes] | NotGiven = NOT_GIVEN,
847
+ api_timeout: Optional[int] | NotGiven = NOT_GIVEN,
848
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
849
+ # The extra values given here take precedence over values defined on the client or passed to this method.
850
+ extra_headers: Headers | None = None,
851
+ extra_query: Query | None = None,
852
+ extra_body: Body | None = None,
853
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
854
+ ) -> TaskIDList:
855
+ """
856
+ Update inference deployment
857
+
858
+ Args:
859
+ project_id: Project ID
860
+
861
+ deployment_name: Inference instance name.
862
+
863
+ auth_enabled: Set to `true` to enable API key authentication for the inference instance.
864
+ `"Authorization": "Bearer *****"` or `"X-Api-Key": "*****"` header is required
865
+ for the requests to the instance if enabled
866
+
867
+ command: Command to be executed when running a container from an image.
868
+
869
+ containers: List of containers for the inference instance.
870
+
871
+ credentials_name: Registry credentials name
872
+
873
+ description: Inference instance description.
874
+
875
+ envs: Environment variables for the inference instance.
876
+
877
+ flavor_name: Flavor name for the inference instance.
878
+
879
+ image: Docker image for the inference instance. This field should contain the image
880
+ name and tag in the format 'name:tag', e.g., 'nginx:latest'. It defaults to
881
+ Docker Hub as the image registry, but any accessible Docker image URL can be
882
+ specified.
883
+
884
+ ingress_opts: Ingress options for the inference instance
885
+
886
+ listening_port: Listening port for the inference instance.
887
+
888
+ logging: Logging configuration for the inference instance
889
+
890
+ probes: Probes configured for all containers of the inference instance.
891
+
892
+ api_timeout: Specifies the duration in seconds without any requests after which the
893
+ containers will be downscaled to their minimum scale value as defined by
894
+ `scale.min`. If set, this helps in optimizing resource usage by reducing the
895
+ number of container instances during periods of inactivity. The default value
896
+ when the parameter is not set is 120.
897
+
898
+ extra_headers: Send extra headers
899
+
900
+ extra_query: Add additional query parameters to the request
901
+
902
+ extra_body: Add additional JSON properties to the request
903
+
904
+ timeout: Override the client-level default timeout for this request, in seconds
905
+ """
906
+ if project_id is None:
907
+ project_id = self._client._get_cloud_project_id_path_param()
908
+ if not deployment_name:
909
+ raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}")
910
+ return await self._patch(
911
+ f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}",
912
+ body=await async_maybe_transform(
913
+ {
914
+ "auth_enabled": auth_enabled,
915
+ "command": command,
916
+ "containers": containers,
917
+ "credentials_name": credentials_name,
918
+ "description": description,
919
+ "envs": envs,
920
+ "flavor_name": flavor_name,
921
+ "image": image,
922
+ "ingress_opts": ingress_opts,
923
+ "listening_port": listening_port,
924
+ "logging": logging,
925
+ "probes": probes,
926
+ "api_timeout": api_timeout,
927
+ },
928
+ deployment_update_params.DeploymentUpdateParams,
929
+ ),
930
+ options=make_request_options(
931
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
932
+ ),
933
+ cast_to=TaskIDList,
934
+ )
935
+
936
+ def list(
937
+ self,
938
+ *,
939
+ project_id: int | None = None,
940
+ limit: int | NotGiven = NOT_GIVEN,
941
+ offset: int | NotGiven = NOT_GIVEN,
942
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
943
+ # The extra values given here take precedence over values defined on the client or passed to this method.
944
+ extra_headers: Headers | None = None,
945
+ extra_query: Query | None = None,
946
+ extra_body: Body | None = None,
947
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
948
+ ) -> AsyncPaginator[Inference, AsyncOffsetPage[Inference]]:
949
+ """List inference deployments
950
+
951
+ Args:
952
+ project_id: Project ID
953
+
954
+ limit: Optional.
955
+
956
+ Limit the number of returned items
957
+
958
+ offset: Optional. Offset value is used to exclude the first set of records from the
959
+ result
960
+
961
+ extra_headers: Send extra headers
962
+
963
+ extra_query: Add additional query parameters to the request
964
+
965
+ extra_body: Add additional JSON properties to the request
966
+
967
+ timeout: Override the client-level default timeout for this request, in seconds
968
+ """
969
+ if project_id is None:
970
+ project_id = self._client._get_cloud_project_id_path_param()
971
+ return self._get_api_list(
972
+ f"/cloud/v3/inference/{project_id}/deployments",
973
+ page=AsyncOffsetPage[Inference],
974
+ options=make_request_options(
975
+ extra_headers=extra_headers,
976
+ extra_query=extra_query,
977
+ extra_body=extra_body,
978
+ timeout=timeout,
979
+ query=maybe_transform(
980
+ {
981
+ "limit": limit,
982
+ "offset": offset,
983
+ },
984
+ deployment_list_params.DeploymentListParams,
985
+ ),
986
+ ),
987
+ model=Inference,
988
+ )
989
+
990
+ async def delete(
991
+ self,
992
+ deployment_name: str,
993
+ *,
994
+ project_id: int | None = None,
995
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
996
+ # The extra values given here take precedence over values defined on the client or passed to this method.
997
+ extra_headers: Headers | None = None,
998
+ extra_query: Query | None = None,
999
+ extra_body: Body | None = None,
1000
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
1001
+ ) -> TaskIDList:
1002
+ """
1003
+ Delete inference deployment
1004
+
1005
+ Args:
1006
+ project_id: Project ID
1007
+
1008
+ deployment_name: Inference instance name.
1009
+
1010
+ extra_headers: Send extra headers
1011
+
1012
+ extra_query: Add additional query parameters to the request
1013
+
1014
+ extra_body: Add additional JSON properties to the request
1015
+
1016
+ timeout: Override the client-level default timeout for this request, in seconds
1017
+ """
1018
+ if project_id is None:
1019
+ project_id = self._client._get_cloud_project_id_path_param()
1020
+ if not deployment_name:
1021
+ raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}")
1022
+ return await self._delete(
1023
+ f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}",
1024
+ options=make_request_options(
1025
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
1026
+ ),
1027
+ cast_to=TaskIDList,
1028
+ )
1029
+
1030
+ async def get(
1031
+ self,
1032
+ deployment_name: str,
1033
+ *,
1034
+ project_id: int | None = None,
1035
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1036
+ # The extra values given here take precedence over values defined on the client or passed to this method.
1037
+ extra_headers: Headers | None = None,
1038
+ extra_query: Query | None = None,
1039
+ extra_body: Body | None = None,
1040
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
1041
+ ) -> Inference:
1042
+ """
1043
+ Get inference deployment
1044
+
1045
+ Args:
1046
+ project_id: Project ID
1047
+
1048
+ deployment_name: Inference instance name.
1049
+
1050
+ extra_headers: Send extra headers
1051
+
1052
+ extra_query: Add additional query parameters to the request
1053
+
1054
+ extra_body: Add additional JSON properties to the request
1055
+
1056
+ timeout: Override the client-level default timeout for this request, in seconds
1057
+ """
1058
+ if project_id is None:
1059
+ project_id = self._client._get_cloud_project_id_path_param()
1060
+ if not deployment_name:
1061
+ raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}")
1062
+ return await self._get(
1063
+ f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}",
1064
+ options=make_request_options(
1065
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
1066
+ ),
1067
+ cast_to=Inference,
1068
+ )
1069
+
1070
+ async def get_api_key(
1071
+ self,
1072
+ deployment_name: str,
1073
+ *,
1074
+ project_id: int | None = None,
1075
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1076
+ # The extra values given here take precedence over values defined on the client or passed to this method.
1077
+ extra_headers: Headers | None = None,
1078
+ extra_query: Query | None = None,
1079
+ extra_body: Body | None = None,
1080
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
1081
+ ) -> InferenceApikeySecret:
1082
+ """
1083
+ Get inference deployment API key
1084
+
1085
+ Args:
1086
+ project_id: Project ID
1087
+
1088
+ deployment_name: Inference instance name.
1089
+
1090
+ extra_headers: Send extra headers
1091
+
1092
+ extra_query: Add additional query parameters to the request
1093
+
1094
+ extra_body: Add additional JSON properties to the request
1095
+
1096
+ timeout: Override the client-level default timeout for this request, in seconds
1097
+ """
1098
+ if project_id is None:
1099
+ project_id = self._client._get_cloud_project_id_path_param()
1100
+ if not deployment_name:
1101
+ raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}")
1102
+ return await self._get(
1103
+ f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/apikey",
1104
+ options=make_request_options(
1105
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
1106
+ ),
1107
+ cast_to=InferenceApikeySecret,
1108
+ )
1109
+
1110
+ async def start(
1111
+ self,
1112
+ deployment_name: str,
1113
+ *,
1114
+ project_id: int | None = None,
1115
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1116
+ # The extra values given here take precedence over values defined on the client or passed to this method.
1117
+ extra_headers: Headers | None = None,
1118
+ extra_query: Query | None = None,
1119
+ extra_body: Body | None = None,
1120
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
1121
+ ) -> None:
1122
+ """
1123
+ This operation initializes an inference deployment after it was stopped, making
1124
+ it available to handle inference requests again. The instance will launch with
1125
+ the **minimum** number of replicas defined in the scaling settings.
1126
+
1127
+ - If the minimum replicas are set to **0**, the instance will initially start
1128
+ with **0** replicas.
1129
+ - It will automatically scale up when it receives requests or SQS messages,
1130
+ according to the configured scaling rules.
1131
+
1132
+ Args:
1133
+ project_id: Project ID
1134
+
1135
+ deployment_name: Inference instance name.
1136
+
1137
+ extra_headers: Send extra headers
1138
+
1139
+ extra_query: Add additional query parameters to the request
1140
+
1141
+ extra_body: Add additional JSON properties to the request
1142
+
1143
+ timeout: Override the client-level default timeout for this request, in seconds
1144
+ """
1145
+ if project_id is None:
1146
+ project_id = self._client._get_cloud_project_id_path_param()
1147
+ if not deployment_name:
1148
+ raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}")
1149
+ extra_headers = {"Accept": "*/*", **(extra_headers or {})}
1150
+ return await self._post(
1151
+ f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/start",
1152
+ options=make_request_options(
1153
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
1154
+ ),
1155
+ cast_to=NoneType,
1156
+ )
1157
+
1158
+ async def stop(
1159
+ self,
1160
+ deployment_name: str,
1161
+ *,
1162
+ project_id: int | None = None,
1163
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1164
+ # The extra values given here take precedence over values defined on the client or passed to this method.
1165
+ extra_headers: Headers | None = None,
1166
+ extra_query: Query | None = None,
1167
+ extra_body: Body | None = None,
1168
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
1169
+ ) -> None:
1170
+ """
1171
+ This operation shuts down an inference deployment, making it unavailable for
1172
+ handling requests. The deployment will scale down to **0** replicas, overriding
1173
+ any minimum replica settings.
1174
+
1175
+ - Once stopped, the deployment will **not** process any inference requests or
1176
+ SQS messages.
1177
+ - It will **not** restart automatically and must be started manually.
1178
+ - While stopped, the deployment will **not** incur any charges.
1179
+
1180
+ Args:
1181
+ project_id: Project ID
1182
+
1183
+ deployment_name: Inference instance name.
1184
+
1185
+ extra_headers: Send extra headers
1186
+
1187
+ extra_query: Add additional query parameters to the request
1188
+
1189
+ extra_body: Add additional JSON properties to the request
1190
+
1191
+ timeout: Override the client-level default timeout for this request, in seconds
1192
+ """
1193
+ if project_id is None:
1194
+ project_id = self._client._get_cloud_project_id_path_param()
1195
+ if not deployment_name:
1196
+ raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}")
1197
+ extra_headers = {"Accept": "*/*", **(extra_headers or {})}
1198
+ return await self._post(
1199
+ f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/stop",
1200
+ options=make_request_options(
1201
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
1202
+ ),
1203
+ cast_to=NoneType,
1204
+ )
1205
+
1206
+ async def create_and_poll(
1207
+ self,
1208
+ *,
1209
+ project_id: int | None = None,
1210
+ containers: Iterable[deployment_create_params.Container],
1211
+ flavor_name: str,
1212
+ image: str,
1213
+ listening_port: int,
1214
+ name: str,
1215
+ auth_enabled: bool | NotGiven = NOT_GIVEN,
1216
+ command: Optional[List[str]] | NotGiven = NOT_GIVEN,
1217
+ credentials_name: Optional[str] | NotGiven = NOT_GIVEN,
1218
+ description: Optional[str] | NotGiven = NOT_GIVEN,
1219
+ envs: Dict[str, str] | NotGiven = NOT_GIVEN,
1220
+ ingress_opts: Optional[IngressOptsParam] | NotGiven = NOT_GIVEN,
1221
+ logging: Optional[deployment_create_params.Logging] | NotGiven = NOT_GIVEN,
1222
+ probes: Optional[deployment_create_params.Probes] | NotGiven = NOT_GIVEN,
1223
+ api_timeout: Optional[int] | NotGiven = NOT_GIVEN,
1224
+ polling_interval_seconds: int | NotGiven = NOT_GIVEN,
1225
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
1226
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1227
+ # The extra values given here take precedence over values defined on the client or passed to this method.
1228
+ extra_headers: Headers | None = None,
1229
+ extra_query: Query | None = None,
1230
+ extra_body: Body | None = None,
1231
+ ) -> Inference:
1232
+ response = await self.create(
1233
+ project_id=project_id,
1234
+ containers=containers,
1235
+ flavor_name=flavor_name,
1236
+ image=image,
1237
+ listening_port=listening_port,
1238
+ name=name,
1239
+ auth_enabled=auth_enabled,
1240
+ command=command,
1241
+ credentials_name=credentials_name,
1242
+ description=description,
1243
+ envs=envs,
1244
+ ingress_opts=ingress_opts,
1245
+ logging=logging,
1246
+ probes=probes,
1247
+ api_timeout=api_timeout,
1248
+ extra_headers=extra_headers,
1249
+ extra_query=extra_query,
1250
+ extra_body=extra_body,
1251
+ timeout=timeout,
1252
+ )
1253
+ if not response.tasks or len(response.tasks) != 1:
1254
+ raise ValueError(f"Expected exactly one task to be created")
1255
+ task = await self._client.cloud.tasks.poll(
1256
+ task_id=response.tasks[0],
1257
+ extra_headers=extra_headers,
1258
+ polling_interval_seconds=polling_interval_seconds,
1259
+ )
1260
+ if not task.created_resources or not task.created_resources.inference_instances or len(task.created_resources.inference_instances) != 1:
1261
+ raise ValueError(f"Expected exactly one resource to be created in a task")
1262
+ return await self.get(
1263
+ deployment_name=task.created_resources.inference_instances[0],
1264
+ project_id=project_id,
1265
+ extra_headers=extra_headers,
1266
+ timeout=timeout,
1267
+ )
1268
+
1269
+ async def update_and_poll(
1270
+ self,
1271
+ deployment_name: str,
1272
+ *,
1273
+ project_id: int | None = None,
1274
+ auth_enabled: Optional[bool] | NotGiven = NOT_GIVEN,
1275
+ command: Optional[List[str]] | NotGiven = NOT_GIVEN,
1276
+ containers: Optional[Iterable[deployment_update_params.Container]] | NotGiven = NOT_GIVEN,
1277
+ credentials_name: Optional[str] | NotGiven = NOT_GIVEN,
1278
+ description: Optional[str] | NotGiven = NOT_GIVEN,
1279
+ envs: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
1280
+ flavor_name: Optional[str] | NotGiven = NOT_GIVEN,
1281
+ image: Optional[str] | NotGiven = NOT_GIVEN,
1282
+ ingress_opts: Optional[IngressOptsParam] | NotGiven = NOT_GIVEN,
1283
+ listening_port: Optional[int] | NotGiven = NOT_GIVEN,
1284
+ logging: Optional[deployment_update_params.Logging] | NotGiven = NOT_GIVEN,
1285
+ probes: Optional[deployment_update_params.Probes] | NotGiven = NOT_GIVEN,
1286
+ api_timeout: Optional[int] | NotGiven = NOT_GIVEN,
1287
+ polling_interval_seconds: int | NotGiven = NOT_GIVEN,
1288
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
1289
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1290
+ # The extra values given here take precedence over values defined on the client or passed to this method.
1291
+ extra_headers: Headers | None = None,
1292
+ extra_query: Query | None = None,
1293
+ extra_body: Body | None = None,
1294
+ ) -> Inference:
1295
+ response = await self.update(
1296
+ deployment_name=deployment_name,
1297
+ project_id=project_id,
1298
+ auth_enabled=auth_enabled,
1299
+ command=command,
1300
+ containers=containers,
1301
+ credentials_name=credentials_name,
1302
+ description=description,
1303
+ envs=envs,
1304
+ flavor_name=flavor_name,
1305
+ image=image,
1306
+ ingress_opts=ingress_opts,
1307
+ listening_port=listening_port,
1308
+ logging=logging,
1309
+ probes=probes,
1310
+ api_timeout=api_timeout,
1311
+ extra_headers=extra_headers,
1312
+ extra_query=extra_query,
1313
+ extra_body=extra_body,
1314
+ timeout=timeout,
1315
+ )
1316
+ if not response.tasks or len(response.tasks) != 1:
1317
+ raise ValueError(f"Expected exactly one task to be created")
1318
+ await self._client.cloud.tasks.poll(
1319
+ task_id=response.tasks[0],
1320
+ extra_headers=extra_headers,
1321
+ polling_interval_seconds=polling_interval_seconds,
1322
+ )
1323
+ return await self.get(
1324
+ deployment_name=deployment_name,
1325
+ project_id=project_id,
1326
+ extra_headers=extra_headers,
1327
+ timeout=timeout,
1328
+ )
1329
+
1330
+ async def delete_and_poll(
1331
+ self,
1332
+ deployment_name: str,
1333
+ *,
1334
+ project_id: int | None = None,
1335
+ polling_interval_seconds: int | NotGiven = NOT_GIVEN,
1336
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
1337
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1338
+ # The extra values given here take precedence over values defined on the client or passed to this method.
1339
+ extra_headers: Headers | None = None,
1340
+ extra_query: Query | None = None,
1341
+ extra_body: Body | None = None,
1342
+ ) -> None:
1343
+ response = await self.delete(
1344
+ deployment_name=deployment_name,
1345
+ project_id=project_id,
1346
+ extra_headers=extra_headers,
1347
+ extra_query=extra_query,
1348
+ extra_body=extra_body,
1349
+ timeout=timeout,
1350
+ )
1351
+ if not response.tasks or len(response.tasks) != 1:
1352
+ raise ValueError(f"Expected exactly one task to be created")
1353
+ await self._client.cloud.tasks.poll(
1354
+ task_id=response.tasks[0],
1355
+ extra_headers=extra_headers,
1356
+ polling_interval_seconds=polling_interval_seconds,
1357
+ )
1358
+
1359
+
1360
+ class DeploymentsResourceWithRawResponse:
1361
+ def __init__(self, deployments: DeploymentsResource) -> None:
1362
+ self._deployments = deployments
1363
+
1364
+ self.create = to_raw_response_wrapper(
1365
+ deployments.create,
1366
+ )
1367
+ self.update = to_raw_response_wrapper(
1368
+ deployments.update,
1369
+ )
1370
+ self.list = to_raw_response_wrapper(
1371
+ deployments.list,
1372
+ )
1373
+ self.delete = to_raw_response_wrapper(
1374
+ deployments.delete,
1375
+ )
1376
+ self.get = to_raw_response_wrapper(
1377
+ deployments.get,
1378
+ )
1379
+ self.get_api_key = to_raw_response_wrapper(
1380
+ deployments.get_api_key,
1381
+ )
1382
+ self.start = to_raw_response_wrapper(
1383
+ deployments.start,
1384
+ )
1385
+ self.stop = to_raw_response_wrapper(
1386
+ deployments.stop,
1387
+ )
1388
+
1389
+ @cached_property
1390
+ def logs(self) -> LogsResourceWithRawResponse:
1391
+ return LogsResourceWithRawResponse(self._deployments.logs)
1392
+
1393
+
1394
+ class AsyncDeploymentsResourceWithRawResponse:
1395
+ def __init__(self, deployments: AsyncDeploymentsResource) -> None:
1396
+ self._deployments = deployments
1397
+
1398
+ self.create = async_to_raw_response_wrapper(
1399
+ deployments.create,
1400
+ )
1401
+ self.update = async_to_raw_response_wrapper(
1402
+ deployments.update,
1403
+ )
1404
+ self.list = async_to_raw_response_wrapper(
1405
+ deployments.list,
1406
+ )
1407
+ self.delete = async_to_raw_response_wrapper(
1408
+ deployments.delete,
1409
+ )
1410
+ self.get = async_to_raw_response_wrapper(
1411
+ deployments.get,
1412
+ )
1413
+ self.get_api_key = async_to_raw_response_wrapper(
1414
+ deployments.get_api_key,
1415
+ )
1416
+ self.start = async_to_raw_response_wrapper(
1417
+ deployments.start,
1418
+ )
1419
+ self.stop = async_to_raw_response_wrapper(
1420
+ deployments.stop,
1421
+ )
1422
+
1423
+ @cached_property
1424
+ def logs(self) -> AsyncLogsResourceWithRawResponse:
1425
+ return AsyncLogsResourceWithRawResponse(self._deployments.logs)
1426
+
1427
+
1428
+ class DeploymentsResourceWithStreamingResponse:
1429
+ def __init__(self, deployments: DeploymentsResource) -> None:
1430
+ self._deployments = deployments
1431
+
1432
+ self.create = to_streamed_response_wrapper(
1433
+ deployments.create,
1434
+ )
1435
+ self.update = to_streamed_response_wrapper(
1436
+ deployments.update,
1437
+ )
1438
+ self.list = to_streamed_response_wrapper(
1439
+ deployments.list,
1440
+ )
1441
+ self.delete = to_streamed_response_wrapper(
1442
+ deployments.delete,
1443
+ )
1444
+ self.get = to_streamed_response_wrapper(
1445
+ deployments.get,
1446
+ )
1447
+ self.get_api_key = to_streamed_response_wrapper(
1448
+ deployments.get_api_key,
1449
+ )
1450
+ self.start = to_streamed_response_wrapper(
1451
+ deployments.start,
1452
+ )
1453
+ self.stop = to_streamed_response_wrapper(
1454
+ deployments.stop,
1455
+ )
1456
+
1457
+ @cached_property
1458
+ def logs(self) -> LogsResourceWithStreamingResponse:
1459
+ return LogsResourceWithStreamingResponse(self._deployments.logs)
1460
+
1461
+
1462
+ class AsyncDeploymentsResourceWithStreamingResponse:
1463
+ def __init__(self, deployments: AsyncDeploymentsResource) -> None:
1464
+ self._deployments = deployments
1465
+
1466
+ self.create = async_to_streamed_response_wrapper(
1467
+ deployments.create,
1468
+ )
1469
+ self.update = async_to_streamed_response_wrapper(
1470
+ deployments.update,
1471
+ )
1472
+ self.list = async_to_streamed_response_wrapper(
1473
+ deployments.list,
1474
+ )
1475
+ self.delete = async_to_streamed_response_wrapper(
1476
+ deployments.delete,
1477
+ )
1478
+ self.get = async_to_streamed_response_wrapper(
1479
+ deployments.get,
1480
+ )
1481
+ self.get_api_key = async_to_streamed_response_wrapper(
1482
+ deployments.get_api_key,
1483
+ )
1484
+ self.start = async_to_streamed_response_wrapper(
1485
+ deployments.start,
1486
+ )
1487
+ self.stop = async_to_streamed_response_wrapper(
1488
+ deployments.stop,
1489
+ )
1490
+
1491
+ @cached_property
1492
+ def logs(self) -> AsyncLogsResourceWithStreamingResponse:
1493
+ return AsyncLogsResourceWithStreamingResponse(self._deployments.logs)