gcore 0.16.0__py3-none-any.whl → 0.23.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 (220) hide show
  1. gcore/_client.py +16 -0
  2. gcore/_models.py +37 -15
  3. gcore/_streaming.py +12 -12
  4. gcore/_utils/_sync.py +3 -31
  5. gcore/_utils/_utils.py +1 -1
  6. gcore/_version.py +1 -1
  7. gcore/resources/cdn/audit_log.py +4 -4
  8. gcore/resources/cdn/cdn.py +120 -21
  9. gcore/resources/cdn/ip_ranges.py +97 -5
  10. gcore/resources/cdn/{logs/logs.py → logs.py} +9 -9
  11. gcore/resources/cdn/resources/resources.py +20 -20
  12. gcore/resources/cdn/statistics.py +56 -58
  13. gcore/resources/cloud/__init__.py +40 -12
  14. gcore/resources/cloud/audit_logs.py +20 -0
  15. gcore/resources/cloud/baremetal/servers.py +48 -14
  16. gcore/resources/cloud/billing_reservations.py +2 -2
  17. gcore/resources/cloud/cloud.py +100 -18
  18. gcore/resources/cloud/databases/__init__.py +33 -0
  19. gcore/resources/cloud/databases/databases.py +102 -0
  20. gcore/resources/cloud/databases/postgres/__init__.py +61 -0
  21. gcore/resources/cloud/databases/postgres/clusters/__init__.py +33 -0
  22. gcore/resources/cloud/databases/postgres/clusters/clusters.py +716 -0
  23. gcore/resources/cloud/databases/postgres/clusters/user_credentials.py +281 -0
  24. gcore/resources/cloud/databases/postgres/configurations.py +169 -0
  25. gcore/resources/cloud/databases/postgres/custom_configurations.py +197 -0
  26. gcore/resources/cloud/databases/postgres/postgres.py +166 -0
  27. gcore/resources/cloud/file_shares/file_shares.py +154 -49
  28. gcore/resources/cloud/floating_ips.py +42 -10
  29. gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py +70 -10
  30. gcore/resources/cloud/gpu_baremetal_clusters/images.py +40 -6
  31. gcore/resources/cloud/gpu_baremetal_clusters/servers.py +16 -0
  32. gcore/resources/cloud/gpu_virtual_clusters/__init__.py +89 -0
  33. gcore/resources/cloud/gpu_virtual_clusters/flavors.py +211 -0
  34. gcore/resources/cloud/gpu_virtual_clusters/gpu_virtual_clusters.py +1551 -0
  35. gcore/resources/cloud/gpu_virtual_clusters/images.py +582 -0
  36. gcore/resources/cloud/gpu_virtual_clusters/interfaces.py +187 -0
  37. gcore/resources/cloud/gpu_virtual_clusters/servers.py +506 -0
  38. gcore/resources/cloud/gpu_virtual_clusters/volumes.py +187 -0
  39. gcore/resources/cloud/inference/deployments/deployments.py +52 -4
  40. gcore/resources/cloud/instances/images.py +72 -18
  41. gcore/resources/cloud/instances/instances.py +110 -18
  42. gcore/resources/cloud/instances/interfaces.py +12 -0
  43. gcore/resources/cloud/k8s/__init__.py +12 -12
  44. gcore/resources/cloud/k8s/clusters/clusters.py +25 -25
  45. gcore/resources/cloud/k8s/clusters/pools/pools.py +14 -14
  46. gcore/resources/cloud/k8s/k8s.py +24 -24
  47. gcore/resources/cloud/load_balancers/l7_policies/l7_policies.py +1420 -218
  48. gcore/resources/cloud/load_balancers/l7_policies/rules.py +134 -22
  49. gcore/resources/cloud/load_balancers/listeners.py +77 -6
  50. gcore/resources/cloud/load_balancers/load_balancers.py +92 -14
  51. gcore/resources/cloud/load_balancers/pools/pools.py +52 -4
  52. gcore/resources/cloud/networks/networks.py +30 -10
  53. gcore/resources/cloud/networks/subnets.py +26 -10
  54. gcore/resources/cloud/placement_groups.py +8 -0
  55. gcore/resources/cloud/projects.py +99 -119
  56. gcore/resources/cloud/quotas/requests.py +0 -8
  57. gcore/resources/cloud/reserved_fixed_ips/reserved_fixed_ips.py +18 -0
  58. gcore/resources/cloud/secrets.py +16 -0
  59. gcore/resources/cloud/security_groups/security_groups.py +38 -12
  60. gcore/resources/cloud/ssh_keys.py +10 -0
  61. gcore/resources/cloud/tasks.py +22 -7
  62. gcore/resources/cloud/volumes.py +65 -23
  63. gcore/resources/dns/zones/rrsets.py +10 -10
  64. gcore/resources/dns/zones/zones.py +2 -2
  65. gcore/resources/security/bgp_announces.py +0 -4
  66. gcore/resources/security/profiles.py +31 -7
  67. gcore/resources/storage/credentials.py +0 -28
  68. gcore/resources/storage/storage.py +2 -2
  69. gcore/types/cdn/__init__.py +5 -0
  70. gcore/types/cdn/alibaba_regions.py +22 -0
  71. gcore/types/cdn/audit_log_list_params.py +2 -2
  72. gcore/types/cdn/aws_regions.py +22 -0
  73. gcore/types/cdn/cdn_list_purge_statuses_response.py +10 -0
  74. gcore/types/cdn/cdn_resource.py +17 -12
  75. gcore/types/cdn/ip_range_list_ips_params.py +19 -0
  76. gcore/types/cdn/ip_range_list_params.py +19 -0
  77. gcore/types/cdn/resource_create_params.py +17 -12
  78. gcore/types/cdn/resource_purge_params.py +4 -4
  79. gcore/types/cdn/resource_replace_params.py +17 -12
  80. gcore/types/cdn/resource_update_params.py +17 -12
  81. gcore/types/cdn/resource_usage_stats.py +16 -15
  82. gcore/types/cdn/resources/cdn_resource_rule.py +15 -10
  83. gcore/types/cdn/resources/rule_create_params.py +15 -10
  84. gcore/types/cdn/resources/rule_replace_params.py +15 -10
  85. gcore/types/cdn/resources/rule_update_params.py +15 -10
  86. gcore/types/cdn/rule_template.py +15 -10
  87. gcore/types/cdn/rule_template_create_params.py +15 -10
  88. gcore/types/cdn/rule_template_replace_params.py +15 -10
  89. gcore/types/cdn/rule_template_update_params.py +15 -10
  90. gcore/types/cdn/statistic_get_logs_usage_aggregated_params.py +4 -1
  91. gcore/types/cdn/statistic_get_logs_usage_series_params.py +5 -12
  92. gcore/types/cdn/statistic_get_resource_usage_aggregated_params.py +10 -21
  93. gcore/types/cdn/statistic_get_resource_usage_series_params.py +6 -1
  94. gcore/types/cdn/statistic_get_shield_usage_aggregated_params.py +5 -2
  95. gcore/types/cdn/statistic_get_shield_usage_series_params.py +3 -0
  96. gcore/types/cloud/__init__.py +9 -3
  97. gcore/types/cloud/audit_log_entry.py +9 -3
  98. gcore/types/cloud/audit_log_list_params.py +12 -0
  99. gcore/types/cloud/baremetal/server_create_params.py +7 -7
  100. gcore/types/cloud/baremetal_flavor.py +0 -6
  101. gcore/types/cloud/billing_reservation_list_params.py +1 -1
  102. gcore/types/cloud/blackhole_port.py +4 -1
  103. gcore/types/cloud/databases/postgres/__init__.py +12 -0
  104. gcore/types/cloud/databases/postgres/cluster_create_params.py +108 -0
  105. gcore/types/cloud/databases/postgres/cluster_list_params.py +19 -0
  106. gcore/types/cloud/databases/postgres/cluster_update_params.py +102 -0
  107. gcore/types/cloud/databases/postgres/clusters/__init__.py +5 -0
  108. gcore/types/cloud/databases/postgres/clusters/postgres_user_credentials.py +13 -0
  109. gcore/types/cloud/databases/postgres/custom_configuration_validate_params.py +19 -0
  110. gcore/types/cloud/databases/postgres/pg_conf_validation.py +15 -0
  111. gcore/types/cloud/databases/postgres/postgres_cluster.py +118 -0
  112. gcore/types/cloud/databases/postgres/postgres_cluster_short.py +22 -0
  113. gcore/types/cloud/databases/postgres/postgres_configuration.py +31 -0
  114. gcore/types/cloud/file_share_create_params.py +8 -8
  115. gcore/types/cloud/file_share_update_params.py +7 -2
  116. gcore/types/cloud/floating_ip.py +5 -1
  117. gcore/types/cloud/floating_ip_create_params.py +4 -4
  118. gcore/types/cloud/floating_ip_detailed.py +5 -1
  119. gcore/types/cloud/floating_ip_list_params.py +8 -0
  120. gcore/types/cloud/floating_ip_update_params.py +7 -2
  121. gcore/types/cloud/gpu_baremetal_cluster.py +18 -3
  122. gcore/types/cloud/gpu_baremetal_cluster_action_params.py +7 -2
  123. gcore/types/cloud/gpu_baremetal_cluster_create_params.py +16 -4
  124. gcore/types/cloud/gpu_baremetal_clusters/gpu_baremetal_cluster_server.py +5 -2
  125. gcore/types/cloud/gpu_baremetal_clusters/image_upload_params.py +4 -4
  126. gcore/types/cloud/gpu_image.py +9 -0
  127. gcore/types/cloud/gpu_virtual_cluster.py +189 -0
  128. gcore/types/cloud/gpu_virtual_cluster_action_params.py +127 -0
  129. gcore/types/cloud/gpu_virtual_cluster_create_params.py +213 -0
  130. gcore/types/cloud/gpu_virtual_cluster_delete_params.py +41 -0
  131. gcore/types/cloud/gpu_virtual_cluster_list_params.py +21 -0
  132. gcore/types/cloud/gpu_virtual_cluster_update_params.py +18 -0
  133. gcore/types/cloud/gpu_virtual_clusters/__init__.py +16 -0
  134. gcore/types/cloud/gpu_virtual_clusters/flavor_list_params.py +21 -0
  135. gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_cluster_server.py +77 -0
  136. gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_cluster_server_list.py +16 -0
  137. gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_cluster_volume.py +64 -0
  138. gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_cluster_volume_list.py +16 -0
  139. gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_flavor.py +155 -0
  140. gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_flavor_list.py +16 -0
  141. gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_interface.py +190 -0
  142. gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_interface_list.py +16 -0
  143. gcore/types/cloud/gpu_virtual_clusters/image_upload_params.py +56 -0
  144. gcore/types/cloud/gpu_virtual_clusters/server_delete_params.py +44 -0
  145. gcore/types/cloud/gpu_virtual_clusters/server_list_params.py +75 -0
  146. gcore/types/cloud/image.py +9 -0
  147. gcore/types/cloud/inference/deployment_create_params.py +1 -1
  148. gcore/types/cloud/inference/deployment_update_params.py +1 -1
  149. gcore/types/cloud/inference/inference_deployment.py +1 -1
  150. gcore/types/cloud/instance_create_params.py +27 -27
  151. gcore/types/cloud/instance_update_params.py +7 -2
  152. gcore/types/cloud/instances/image_create_from_volume_params.py +4 -4
  153. gcore/types/cloud/instances/image_update_params.py +4 -4
  154. gcore/types/cloud/instances/image_upload_params.py +4 -4
  155. gcore/types/cloud/k8s/__init__.py +4 -4
  156. gcore/types/cloud/k8s/cluster_update_params.py +5 -5
  157. gcore/types/cloud/k8s/clusters/__init__.py +2 -2
  158. gcore/types/cloud/k8s/clusters/k8s_cluster_pool.py +2 -2
  159. gcore/types/cloud/k8s/clusters/k8s_cluster_pool_list.py +4 -4
  160. gcore/types/cloud/k8s/k8s_cluster.py +4 -4
  161. gcore/types/cloud/k8s/k8s_cluster_certificate.py +2 -2
  162. gcore/types/cloud/k8s/k8s_cluster_kubeconfig.py +14 -2
  163. gcore/types/cloud/k8s/k8s_cluster_list.py +4 -4
  164. gcore/types/cloud/k8s_cluster_version.py +2 -2
  165. gcore/types/cloud/k8s_cluster_version_list.py +4 -4
  166. gcore/types/cloud/load_balancer_create_params.py +14 -8
  167. gcore/types/cloud/load_balancer_flavor_detail.py +2 -2
  168. gcore/types/cloud/load_balancer_l7_policy.py +29 -16
  169. gcore/types/cloud/load_balancer_l7_policy_list.py +3 -3
  170. gcore/types/cloud/load_balancer_l7_rule.py +14 -23
  171. gcore/types/cloud/load_balancer_l7_rule_list.py +3 -3
  172. gcore/types/cloud/load_balancer_listener_detail.py +2 -2
  173. gcore/types/cloud/load_balancer_update_params.py +7 -2
  174. gcore/types/cloud/load_balancers/__init__.py +1 -0
  175. gcore/types/cloud/load_balancers/l7_policies/rule_create_params.py +5 -10
  176. gcore/types/cloud/load_balancers/l7_policies/rule_replace_params.py +7 -11
  177. gcore/types/cloud/load_balancers/l7_policy_create_params.py +102 -18
  178. gcore/types/cloud/load_balancers/l7_policy_replace_params.py +94 -16
  179. gcore/types/cloud/load_balancers/listener_create_params.py +4 -1
  180. gcore/types/cloud/load_balancers/listener_delete_params.py +18 -0
  181. gcore/types/cloud/load_balancers/listener_update_params.py +4 -1
  182. gcore/types/cloud/load_balancers/pool_create_params.py +1 -1
  183. gcore/types/cloud/network_create_params.py +4 -4
  184. gcore/types/cloud/network_update_params.py +7 -2
  185. gcore/types/cloud/networks/subnet_create_params.py +4 -4
  186. gcore/types/cloud/networks/subnet_update_params.py +7 -2
  187. gcore/types/cloud/project_create_params.py +0 -6
  188. gcore/types/cloud/{project_replace_params.py → project_update_params.py} +2 -2
  189. gcore/types/cloud/quotas/request_create_params.py +0 -3
  190. gcore/types/cloud/region.py +3 -3
  191. gcore/types/cloud/security_group.py +8 -1
  192. gcore/types/cloud/security_group_create_params.py +7 -5
  193. gcore/types/cloud/security_group_list_params.py +6 -4
  194. gcore/types/cloud/security_group_update_params.py +7 -2
  195. gcore/types/cloud/ssh_key_list_params.py +7 -0
  196. gcore/types/cloud/tag.py +2 -2
  197. gcore/types/cloud/task_id_list.py +3 -3
  198. gcore/types/cloud/volume_create_params.py +12 -12
  199. gcore/types/cloud/volume_update_params.py +7 -2
  200. gcore/types/dns/zone_list_params.py +1 -1
  201. gcore/types/iam/api_token_create.py +70 -1
  202. gcore/types/security/bgp_announce_list_params.py +0 -2
  203. gcore/types/security/client_profile.py +1 -0
  204. gcore/types/security/profile_create_params.py +4 -2
  205. gcore/types/security/profile_recreate_params.py +4 -2
  206. gcore/types/security/profile_replace_params.py +4 -2
  207. gcore/types/storage/credential_recreate_params.py +0 -17
  208. gcore/types/storage/storage.py +1 -1
  209. gcore/types/storage/storage_create_params.py +1 -1
  210. gcore/types/streaming/stream.py +3 -2
  211. gcore/types/streaming/video.py +1 -1
  212. gcore/types/waap/domains/custom_rule_create_params.py +1 -1
  213. gcore/types/waap/domains/custom_rule_update_params.py +1 -1
  214. gcore/types/waap/domains/waap_custom_rule.py +1 -1
  215. {gcore-0.16.0.dist-info → gcore-0.23.0.dist-info}/METADATA +14 -14
  216. {gcore-0.16.0.dist-info → gcore-0.23.0.dist-info}/RECORD +219 -168
  217. gcore/resources/cdn/logs/__init__.py +0 -19
  218. /gcore/types/{cdn/logs → cloud/databases}/__init__.py +0 -0
  219. {gcore-0.16.0.dist-info → gcore-0.23.0.dist-info}/WHEEL +0 -0
  220. {gcore-0.16.0.dist-info → gcore-0.23.0.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,582 @@
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, Optional
6
+ from typing_extensions import Literal
7
+
8
+ import httpx
9
+
10
+ from ...._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
11
+ from ...._utils import maybe_transform, async_maybe_transform
12
+ from ...._compat import cached_property
13
+ from ...._resource import SyncAPIResource, AsyncAPIResource
14
+ from ...._response import (
15
+ to_raw_response_wrapper,
16
+ to_streamed_response_wrapper,
17
+ async_to_raw_response_wrapper,
18
+ async_to_streamed_response_wrapper,
19
+ )
20
+ from ...._base_client import make_request_options
21
+ from ....types.cloud.gpu_image import GPUImage
22
+ from ....types.cloud.task_id_list import TaskIDList
23
+ from ....types.cloud.gpu_image_list import GPUImageList
24
+ from ....types.cloud.gpu_virtual_clusters import image_upload_params
25
+
26
+ __all__ = ["ImagesResource", "AsyncImagesResource"]
27
+
28
+
29
+ class ImagesResource(SyncAPIResource):
30
+ @cached_property
31
+ def with_raw_response(self) -> ImagesResourceWithRawResponse:
32
+ """
33
+ This property can be used as a prefix for any HTTP method call to return
34
+ the raw response object instead of the parsed content.
35
+
36
+ For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers
37
+ """
38
+ return ImagesResourceWithRawResponse(self)
39
+
40
+ @cached_property
41
+ def with_streaming_response(self) -> ImagesResourceWithStreamingResponse:
42
+ """
43
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
44
+
45
+ For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response
46
+ """
47
+ return ImagesResourceWithStreamingResponse(self)
48
+
49
+ def list(
50
+ self,
51
+ *,
52
+ project_id: int | None = None,
53
+ region_id: int | None = None,
54
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
55
+ # The extra values given here take precedence over values defined on the client or passed to this method.
56
+ extra_headers: Headers | None = None,
57
+ extra_query: Query | None = None,
58
+ extra_body: Body | None = None,
59
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
60
+ ) -> GPUImageList:
61
+ """
62
+ List virtual GPU images
63
+
64
+ Args:
65
+ project_id: Project ID
66
+
67
+ region_id: Region ID
68
+
69
+ extra_headers: Send extra headers
70
+
71
+ extra_query: Add additional query parameters to the request
72
+
73
+ extra_body: Add additional JSON properties to the request
74
+
75
+ timeout: Override the client-level default timeout for this request, in seconds
76
+ """
77
+ if project_id is None:
78
+ project_id = self._client._get_cloud_project_id_path_param()
79
+ if region_id is None:
80
+ region_id = self._client._get_cloud_region_id_path_param()
81
+ return self._get(
82
+ f"/cloud/v3/gpu/virtual/{project_id}/{region_id}/images",
83
+ options=make_request_options(
84
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
85
+ ),
86
+ cast_to=GPUImageList,
87
+ )
88
+
89
+ def delete(
90
+ self,
91
+ image_id: str,
92
+ *,
93
+ project_id: int | None = None,
94
+ region_id: int | None = None,
95
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
96
+ # The extra values given here take precedence over values defined on the client or passed to this method.
97
+ extra_headers: Headers | None = None,
98
+ extra_query: Query | None = None,
99
+ extra_body: Body | None = None,
100
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
101
+ ) -> TaskIDList:
102
+ """
103
+ Delete virtual GPU image
104
+
105
+ Args:
106
+ project_id: Project ID
107
+
108
+ region_id: Region ID
109
+
110
+ image_id: Image ID
111
+
112
+ extra_headers: Send extra headers
113
+
114
+ extra_query: Add additional query parameters to the request
115
+
116
+ extra_body: Add additional JSON properties to the request
117
+
118
+ timeout: Override the client-level default timeout for this request, in seconds
119
+ """
120
+ if project_id is None:
121
+ project_id = self._client._get_cloud_project_id_path_param()
122
+ if region_id is None:
123
+ region_id = self._client._get_cloud_region_id_path_param()
124
+ if not image_id:
125
+ raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}")
126
+ return self._delete(
127
+ f"/cloud/v3/gpu/virtual/{project_id}/{region_id}/images/{image_id}",
128
+ options=make_request_options(
129
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
130
+ ),
131
+ cast_to=TaskIDList,
132
+ )
133
+
134
+ def get(
135
+ self,
136
+ image_id: str,
137
+ *,
138
+ project_id: int | None = None,
139
+ region_id: int | None = None,
140
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
141
+ # The extra values given here take precedence over values defined on the client or passed to this method.
142
+ extra_headers: Headers | None = None,
143
+ extra_query: Query | None = None,
144
+ extra_body: Body | None = None,
145
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
146
+ ) -> GPUImage:
147
+ """
148
+ Get virtual GPU image
149
+
150
+ Args:
151
+ project_id: Project ID
152
+
153
+ region_id: Region ID
154
+
155
+ image_id: Image ID
156
+
157
+ extra_headers: Send extra headers
158
+
159
+ extra_query: Add additional query parameters to the request
160
+
161
+ extra_body: Add additional JSON properties to the request
162
+
163
+ timeout: Override the client-level default timeout for this request, in seconds
164
+ """
165
+ if project_id is None:
166
+ project_id = self._client._get_cloud_project_id_path_param()
167
+ if region_id is None:
168
+ region_id = self._client._get_cloud_region_id_path_param()
169
+ if not image_id:
170
+ raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}")
171
+ return self._get(
172
+ f"/cloud/v3/gpu/virtual/{project_id}/{region_id}/images/{image_id}",
173
+ options=make_request_options(
174
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
175
+ ),
176
+ cast_to=GPUImage,
177
+ )
178
+
179
+ def upload(
180
+ self,
181
+ *,
182
+ project_id: int | None = None,
183
+ region_id: int | None = None,
184
+ name: str,
185
+ url: str,
186
+ architecture: Optional[Literal["aarch64", "x86_64"]] | Omit = omit,
187
+ cow_format: bool | Omit = omit,
188
+ hw_firmware_type: Optional[Literal["bios", "uefi"]] | Omit = omit,
189
+ os_distro: Optional[str] | Omit = omit,
190
+ os_type: Optional[Literal["linux", "windows"]] | Omit = omit,
191
+ os_version: Optional[str] | Omit = omit,
192
+ ssh_key: Literal["allow", "deny", "required"] | Omit = omit,
193
+ tags: Dict[str, str] | Omit = omit,
194
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
195
+ # The extra values given here take precedence over values defined on the client or passed to this method.
196
+ extra_headers: Headers | None = None,
197
+ extra_query: Query | None = None,
198
+ extra_body: Body | None = None,
199
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
200
+ ) -> TaskIDList:
201
+ """
202
+ Upload new virtual GPU image
203
+
204
+ Args:
205
+ project_id: Project ID
206
+
207
+ region_id: Region ID
208
+
209
+ name: Image name
210
+
211
+ url: Image URL
212
+
213
+ architecture: Image architecture type: aarch64, `x86_64`
214
+
215
+ cow_format: When True, image cannot be deleted unless all volumes, created from it, are
216
+ deleted.
217
+
218
+ hw_firmware_type: Specifies the type of firmware with which to boot the guest.
219
+
220
+ os_distro: OS Distribution, i.e. Debian, CentOS, Ubuntu, CoreOS etc.
221
+
222
+ os_type: The operating system installed on the image. Linux by default
223
+
224
+ os_version: OS version, i.e. 19.04 (for Ubuntu) or 9.4 for Debian
225
+
226
+ ssh_key: Permission to use a ssh key in instances
227
+
228
+ tags: Key-value tags to associate with the resource. A tag is a key-value pair that
229
+ can be associated with a resource, enabling efficient filtering and grouping for
230
+ better organization and management. Both tag keys and values have a maximum
231
+ length of 255 characters. Some tags are read-only and cannot be modified by the
232
+ user. Tags are also integrated with cost reports, allowing cost data to be
233
+ filtered based on tag keys or values.
234
+
235
+ extra_headers: Send extra headers
236
+
237
+ extra_query: Add additional query parameters to the request
238
+
239
+ extra_body: Add additional JSON properties to the request
240
+
241
+ timeout: Override the client-level default timeout for this request, in seconds
242
+ """
243
+ if project_id is None:
244
+ project_id = self._client._get_cloud_project_id_path_param()
245
+ if region_id is None:
246
+ region_id = self._client._get_cloud_region_id_path_param()
247
+ return self._post(
248
+ f"/cloud/v3/gpu/virtual/{project_id}/{region_id}/images",
249
+ body=maybe_transform(
250
+ {
251
+ "name": name,
252
+ "url": url,
253
+ "architecture": architecture,
254
+ "cow_format": cow_format,
255
+ "hw_firmware_type": hw_firmware_type,
256
+ "os_distro": os_distro,
257
+ "os_type": os_type,
258
+ "os_version": os_version,
259
+ "ssh_key": ssh_key,
260
+ "tags": tags,
261
+ },
262
+ image_upload_params.ImageUploadParams,
263
+ ),
264
+ options=make_request_options(
265
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
266
+ ),
267
+ cast_to=TaskIDList,
268
+ )
269
+
270
+
271
+ class AsyncImagesResource(AsyncAPIResource):
272
+ @cached_property
273
+ def with_raw_response(self) -> AsyncImagesResourceWithRawResponse:
274
+ """
275
+ This property can be used as a prefix for any HTTP method call to return
276
+ the raw response object instead of the parsed content.
277
+
278
+ For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers
279
+ """
280
+ return AsyncImagesResourceWithRawResponse(self)
281
+
282
+ @cached_property
283
+ def with_streaming_response(self) -> AsyncImagesResourceWithStreamingResponse:
284
+ """
285
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
286
+
287
+ For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response
288
+ """
289
+ return AsyncImagesResourceWithStreamingResponse(self)
290
+
291
+ async def list(
292
+ self,
293
+ *,
294
+ project_id: int | None = None,
295
+ region_id: int | None = None,
296
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
297
+ # The extra values given here take precedence over values defined on the client or passed to this method.
298
+ extra_headers: Headers | None = None,
299
+ extra_query: Query | None = None,
300
+ extra_body: Body | None = None,
301
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
302
+ ) -> GPUImageList:
303
+ """
304
+ List virtual GPU images
305
+
306
+ Args:
307
+ project_id: Project ID
308
+
309
+ region_id: Region ID
310
+
311
+ extra_headers: Send extra headers
312
+
313
+ extra_query: Add additional query parameters to the request
314
+
315
+ extra_body: Add additional JSON properties to the request
316
+
317
+ timeout: Override the client-level default timeout for this request, in seconds
318
+ """
319
+ if project_id is None:
320
+ project_id = self._client._get_cloud_project_id_path_param()
321
+ if region_id is None:
322
+ region_id = self._client._get_cloud_region_id_path_param()
323
+ return await self._get(
324
+ f"/cloud/v3/gpu/virtual/{project_id}/{region_id}/images",
325
+ options=make_request_options(
326
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
327
+ ),
328
+ cast_to=GPUImageList,
329
+ )
330
+
331
+ async def delete(
332
+ self,
333
+ image_id: str,
334
+ *,
335
+ project_id: int | None = None,
336
+ region_id: int | None = None,
337
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
338
+ # The extra values given here take precedence over values defined on the client or passed to this method.
339
+ extra_headers: Headers | None = None,
340
+ extra_query: Query | None = None,
341
+ extra_body: Body | None = None,
342
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
343
+ ) -> TaskIDList:
344
+ """
345
+ Delete virtual GPU image
346
+
347
+ Args:
348
+ project_id: Project ID
349
+
350
+ region_id: Region ID
351
+
352
+ image_id: Image ID
353
+
354
+ extra_headers: Send extra headers
355
+
356
+ extra_query: Add additional query parameters to the request
357
+
358
+ extra_body: Add additional JSON properties to the request
359
+
360
+ timeout: Override the client-level default timeout for this request, in seconds
361
+ """
362
+ if project_id is None:
363
+ project_id = self._client._get_cloud_project_id_path_param()
364
+ if region_id is None:
365
+ region_id = self._client._get_cloud_region_id_path_param()
366
+ if not image_id:
367
+ raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}")
368
+ return await self._delete(
369
+ f"/cloud/v3/gpu/virtual/{project_id}/{region_id}/images/{image_id}",
370
+ options=make_request_options(
371
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
372
+ ),
373
+ cast_to=TaskIDList,
374
+ )
375
+
376
+ async def get(
377
+ self,
378
+ image_id: str,
379
+ *,
380
+ project_id: int | None = None,
381
+ region_id: int | None = None,
382
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
383
+ # The extra values given here take precedence over values defined on the client or passed to this method.
384
+ extra_headers: Headers | None = None,
385
+ extra_query: Query | None = None,
386
+ extra_body: Body | None = None,
387
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
388
+ ) -> GPUImage:
389
+ """
390
+ Get virtual GPU image
391
+
392
+ Args:
393
+ project_id: Project ID
394
+
395
+ region_id: Region ID
396
+
397
+ image_id: Image ID
398
+
399
+ extra_headers: Send extra headers
400
+
401
+ extra_query: Add additional query parameters to the request
402
+
403
+ extra_body: Add additional JSON properties to the request
404
+
405
+ timeout: Override the client-level default timeout for this request, in seconds
406
+ """
407
+ if project_id is None:
408
+ project_id = self._client._get_cloud_project_id_path_param()
409
+ if region_id is None:
410
+ region_id = self._client._get_cloud_region_id_path_param()
411
+ if not image_id:
412
+ raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}")
413
+ return await self._get(
414
+ f"/cloud/v3/gpu/virtual/{project_id}/{region_id}/images/{image_id}",
415
+ options=make_request_options(
416
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
417
+ ),
418
+ cast_to=GPUImage,
419
+ )
420
+
421
+ async def upload(
422
+ self,
423
+ *,
424
+ project_id: int | None = None,
425
+ region_id: int | None = None,
426
+ name: str,
427
+ url: str,
428
+ architecture: Optional[Literal["aarch64", "x86_64"]] | Omit = omit,
429
+ cow_format: bool | Omit = omit,
430
+ hw_firmware_type: Optional[Literal["bios", "uefi"]] | Omit = omit,
431
+ os_distro: Optional[str] | Omit = omit,
432
+ os_type: Optional[Literal["linux", "windows"]] | Omit = omit,
433
+ os_version: Optional[str] | Omit = omit,
434
+ ssh_key: Literal["allow", "deny", "required"] | Omit = omit,
435
+ tags: Dict[str, str] | Omit = omit,
436
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
437
+ # The extra values given here take precedence over values defined on the client or passed to this method.
438
+ extra_headers: Headers | None = None,
439
+ extra_query: Query | None = None,
440
+ extra_body: Body | None = None,
441
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
442
+ ) -> TaskIDList:
443
+ """
444
+ Upload new virtual GPU image
445
+
446
+ Args:
447
+ project_id: Project ID
448
+
449
+ region_id: Region ID
450
+
451
+ name: Image name
452
+
453
+ url: Image URL
454
+
455
+ architecture: Image architecture type: aarch64, `x86_64`
456
+
457
+ cow_format: When True, image cannot be deleted unless all volumes, created from it, are
458
+ deleted.
459
+
460
+ hw_firmware_type: Specifies the type of firmware with which to boot the guest.
461
+
462
+ os_distro: OS Distribution, i.e. Debian, CentOS, Ubuntu, CoreOS etc.
463
+
464
+ os_type: The operating system installed on the image. Linux by default
465
+
466
+ os_version: OS version, i.e. 19.04 (for Ubuntu) or 9.4 for Debian
467
+
468
+ ssh_key: Permission to use a ssh key in instances
469
+
470
+ tags: Key-value tags to associate with the resource. A tag is a key-value pair that
471
+ can be associated with a resource, enabling efficient filtering and grouping for
472
+ better organization and management. Both tag keys and values have a maximum
473
+ length of 255 characters. Some tags are read-only and cannot be modified by the
474
+ user. Tags are also integrated with cost reports, allowing cost data to be
475
+ filtered based on tag keys or values.
476
+
477
+ extra_headers: Send extra headers
478
+
479
+ extra_query: Add additional query parameters to the request
480
+
481
+ extra_body: Add additional JSON properties to the request
482
+
483
+ timeout: Override the client-level default timeout for this request, in seconds
484
+ """
485
+ if project_id is None:
486
+ project_id = self._client._get_cloud_project_id_path_param()
487
+ if region_id is None:
488
+ region_id = self._client._get_cloud_region_id_path_param()
489
+ return await self._post(
490
+ f"/cloud/v3/gpu/virtual/{project_id}/{region_id}/images",
491
+ body=await async_maybe_transform(
492
+ {
493
+ "name": name,
494
+ "url": url,
495
+ "architecture": architecture,
496
+ "cow_format": cow_format,
497
+ "hw_firmware_type": hw_firmware_type,
498
+ "os_distro": os_distro,
499
+ "os_type": os_type,
500
+ "os_version": os_version,
501
+ "ssh_key": ssh_key,
502
+ "tags": tags,
503
+ },
504
+ image_upload_params.ImageUploadParams,
505
+ ),
506
+ options=make_request_options(
507
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
508
+ ),
509
+ cast_to=TaskIDList,
510
+ )
511
+
512
+
513
+ class ImagesResourceWithRawResponse:
514
+ def __init__(self, images: ImagesResource) -> None:
515
+ self._images = images
516
+
517
+ self.list = to_raw_response_wrapper(
518
+ images.list,
519
+ )
520
+ self.delete = to_raw_response_wrapper(
521
+ images.delete,
522
+ )
523
+ self.get = to_raw_response_wrapper(
524
+ images.get,
525
+ )
526
+ self.upload = to_raw_response_wrapper(
527
+ images.upload,
528
+ )
529
+
530
+
531
+ class AsyncImagesResourceWithRawResponse:
532
+ def __init__(self, images: AsyncImagesResource) -> None:
533
+ self._images = images
534
+
535
+ self.list = async_to_raw_response_wrapper(
536
+ images.list,
537
+ )
538
+ self.delete = async_to_raw_response_wrapper(
539
+ images.delete,
540
+ )
541
+ self.get = async_to_raw_response_wrapper(
542
+ images.get,
543
+ )
544
+ self.upload = async_to_raw_response_wrapper(
545
+ images.upload,
546
+ )
547
+
548
+
549
+ class ImagesResourceWithStreamingResponse:
550
+ def __init__(self, images: ImagesResource) -> None:
551
+ self._images = images
552
+
553
+ self.list = to_streamed_response_wrapper(
554
+ images.list,
555
+ )
556
+ self.delete = to_streamed_response_wrapper(
557
+ images.delete,
558
+ )
559
+ self.get = to_streamed_response_wrapper(
560
+ images.get,
561
+ )
562
+ self.upload = to_streamed_response_wrapper(
563
+ images.upload,
564
+ )
565
+
566
+
567
+ class AsyncImagesResourceWithStreamingResponse:
568
+ def __init__(self, images: AsyncImagesResource) -> None:
569
+ self._images = images
570
+
571
+ self.list = async_to_streamed_response_wrapper(
572
+ images.list,
573
+ )
574
+ self.delete = async_to_streamed_response_wrapper(
575
+ images.delete,
576
+ )
577
+ self.get = async_to_streamed_response_wrapper(
578
+ images.get,
579
+ )
580
+ self.upload = async_to_streamed_response_wrapper(
581
+ images.upload,
582
+ )