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,281 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
4
+
5
+ import httpx
6
+
7
+ from ......_types import Body, Query, Headers, NotGiven, not_given
8
+ from ......_compat import cached_property
9
+ from ......_resource import SyncAPIResource, AsyncAPIResource
10
+ from ......_response import (
11
+ to_raw_response_wrapper,
12
+ to_streamed_response_wrapper,
13
+ async_to_raw_response_wrapper,
14
+ async_to_streamed_response_wrapper,
15
+ )
16
+ from ......_base_client import make_request_options
17
+ from ......types.cloud.databases.postgres.clusters.postgres_user_credentials import PostgresUserCredentials
18
+
19
+ __all__ = ["UserCredentialsResource", "AsyncUserCredentialsResource"]
20
+
21
+
22
+ class UserCredentialsResource(SyncAPIResource):
23
+ @cached_property
24
+ def with_raw_response(self) -> UserCredentialsResourceWithRawResponse:
25
+ """
26
+ This property can be used as a prefix for any HTTP method call to return
27
+ the raw response object instead of the parsed content.
28
+
29
+ For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers
30
+ """
31
+ return UserCredentialsResourceWithRawResponse(self)
32
+
33
+ @cached_property
34
+ def with_streaming_response(self) -> UserCredentialsResourceWithStreamingResponse:
35
+ """
36
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
37
+
38
+ For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response
39
+ """
40
+ return UserCredentialsResourceWithStreamingResponse(self)
41
+
42
+ def get(
43
+ self,
44
+ username: str,
45
+ *,
46
+ project_id: int | None = None,
47
+ region_id: int | None = None,
48
+ cluster_name: str,
49
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
50
+ # The extra values given here take precedence over values defined on the client or passed to this method.
51
+ extra_headers: Headers | None = None,
52
+ extra_query: Query | None = None,
53
+ extra_body: Body | None = None,
54
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
55
+ ) -> PostgresUserCredentials:
56
+ """Get the credentials for a specific user in a PostgreSQL cluster.
57
+
58
+ This endpoint
59
+ can only be used once per user.
60
+
61
+ Args:
62
+ extra_headers: Send extra headers
63
+
64
+ extra_query: Add additional query parameters to the request
65
+
66
+ extra_body: Add additional JSON properties to the request
67
+
68
+ timeout: Override the client-level default timeout for this request, in seconds
69
+ """
70
+ if project_id is None:
71
+ project_id = self._client._get_cloud_project_id_path_param()
72
+ if region_id is None:
73
+ region_id = self._client._get_cloud_region_id_path_param()
74
+ if not cluster_name:
75
+ raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}")
76
+ if not username:
77
+ raise ValueError(f"Expected a non-empty value for `username` but received {username!r}")
78
+ return self._get(
79
+ f"/cloud/v1/dbaas/postgres/clusters/{project_id}/{region_id}/{cluster_name}/users/{username}/credentials",
80
+ options=make_request_options(
81
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
82
+ ),
83
+ cast_to=PostgresUserCredentials,
84
+ )
85
+
86
+ def regenerate(
87
+ self,
88
+ username: str,
89
+ *,
90
+ project_id: int | None = None,
91
+ region_id: int | None = None,
92
+ cluster_name: str,
93
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
94
+ # The extra values given here take precedence over values defined on the client or passed to this method.
95
+ extra_headers: Headers | None = None,
96
+ extra_query: Query | None = None,
97
+ extra_body: Body | None = None,
98
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
99
+ ) -> PostgresUserCredentials:
100
+ """
101
+ Generate new credentials for a specific user in a PostgreSQL cluster.
102
+
103
+ Args:
104
+ extra_headers: Send extra headers
105
+
106
+ extra_query: Add additional query parameters to the request
107
+
108
+ extra_body: Add additional JSON properties to the request
109
+
110
+ timeout: Override the client-level default timeout for this request, in seconds
111
+ """
112
+ if project_id is None:
113
+ project_id = self._client._get_cloud_project_id_path_param()
114
+ if region_id is None:
115
+ region_id = self._client._get_cloud_region_id_path_param()
116
+ if not cluster_name:
117
+ raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}")
118
+ if not username:
119
+ raise ValueError(f"Expected a non-empty value for `username` but received {username!r}")
120
+ return self._post(
121
+ f"/cloud/v1/dbaas/postgres/clusters/{project_id}/{region_id}/{cluster_name}/users/{username}/credentials",
122
+ options=make_request_options(
123
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
124
+ ),
125
+ cast_to=PostgresUserCredentials,
126
+ )
127
+
128
+
129
+ class AsyncUserCredentialsResource(AsyncAPIResource):
130
+ @cached_property
131
+ def with_raw_response(self) -> AsyncUserCredentialsResourceWithRawResponse:
132
+ """
133
+ This property can be used as a prefix for any HTTP method call to return
134
+ the raw response object instead of the parsed content.
135
+
136
+ For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers
137
+ """
138
+ return AsyncUserCredentialsResourceWithRawResponse(self)
139
+
140
+ @cached_property
141
+ def with_streaming_response(self) -> AsyncUserCredentialsResourceWithStreamingResponse:
142
+ """
143
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
144
+
145
+ For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response
146
+ """
147
+ return AsyncUserCredentialsResourceWithStreamingResponse(self)
148
+
149
+ async def get(
150
+ self,
151
+ username: str,
152
+ *,
153
+ project_id: int | None = None,
154
+ region_id: int | None = None,
155
+ cluster_name: str,
156
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
157
+ # The extra values given here take precedence over values defined on the client or passed to this method.
158
+ extra_headers: Headers | None = None,
159
+ extra_query: Query | None = None,
160
+ extra_body: Body | None = None,
161
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
162
+ ) -> PostgresUserCredentials:
163
+ """Get the credentials for a specific user in a PostgreSQL cluster.
164
+
165
+ This endpoint
166
+ can only be used once per user.
167
+
168
+ Args:
169
+ extra_headers: Send extra headers
170
+
171
+ extra_query: Add additional query parameters to the request
172
+
173
+ extra_body: Add additional JSON properties to the request
174
+
175
+ timeout: Override the client-level default timeout for this request, in seconds
176
+ """
177
+ if project_id is None:
178
+ project_id = self._client._get_cloud_project_id_path_param()
179
+ if region_id is None:
180
+ region_id = self._client._get_cloud_region_id_path_param()
181
+ if not cluster_name:
182
+ raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}")
183
+ if not username:
184
+ raise ValueError(f"Expected a non-empty value for `username` but received {username!r}")
185
+ return await self._get(
186
+ f"/cloud/v1/dbaas/postgres/clusters/{project_id}/{region_id}/{cluster_name}/users/{username}/credentials",
187
+ options=make_request_options(
188
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
189
+ ),
190
+ cast_to=PostgresUserCredentials,
191
+ )
192
+
193
+ async def regenerate(
194
+ self,
195
+ username: str,
196
+ *,
197
+ project_id: int | None = None,
198
+ region_id: int | None = None,
199
+ cluster_name: str,
200
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
201
+ # The extra values given here take precedence over values defined on the client or passed to this method.
202
+ extra_headers: Headers | None = None,
203
+ extra_query: Query | None = None,
204
+ extra_body: Body | None = None,
205
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
206
+ ) -> PostgresUserCredentials:
207
+ """
208
+ Generate new credentials for a specific user in a PostgreSQL cluster.
209
+
210
+ Args:
211
+ extra_headers: Send extra headers
212
+
213
+ extra_query: Add additional query parameters to the request
214
+
215
+ extra_body: Add additional JSON properties to the request
216
+
217
+ timeout: Override the client-level default timeout for this request, in seconds
218
+ """
219
+ if project_id is None:
220
+ project_id = self._client._get_cloud_project_id_path_param()
221
+ if region_id is None:
222
+ region_id = self._client._get_cloud_region_id_path_param()
223
+ if not cluster_name:
224
+ raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}")
225
+ if not username:
226
+ raise ValueError(f"Expected a non-empty value for `username` but received {username!r}")
227
+ return await self._post(
228
+ f"/cloud/v1/dbaas/postgres/clusters/{project_id}/{region_id}/{cluster_name}/users/{username}/credentials",
229
+ options=make_request_options(
230
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
231
+ ),
232
+ cast_to=PostgresUserCredentials,
233
+ )
234
+
235
+
236
+ class UserCredentialsResourceWithRawResponse:
237
+ def __init__(self, user_credentials: UserCredentialsResource) -> None:
238
+ self._user_credentials = user_credentials
239
+
240
+ self.get = to_raw_response_wrapper(
241
+ user_credentials.get,
242
+ )
243
+ self.regenerate = to_raw_response_wrapper(
244
+ user_credentials.regenerate,
245
+ )
246
+
247
+
248
+ class AsyncUserCredentialsResourceWithRawResponse:
249
+ def __init__(self, user_credentials: AsyncUserCredentialsResource) -> None:
250
+ self._user_credentials = user_credentials
251
+
252
+ self.get = async_to_raw_response_wrapper(
253
+ user_credentials.get,
254
+ )
255
+ self.regenerate = async_to_raw_response_wrapper(
256
+ user_credentials.regenerate,
257
+ )
258
+
259
+
260
+ class UserCredentialsResourceWithStreamingResponse:
261
+ def __init__(self, user_credentials: UserCredentialsResource) -> None:
262
+ self._user_credentials = user_credentials
263
+
264
+ self.get = to_streamed_response_wrapper(
265
+ user_credentials.get,
266
+ )
267
+ self.regenerate = to_streamed_response_wrapper(
268
+ user_credentials.regenerate,
269
+ )
270
+
271
+
272
+ class AsyncUserCredentialsResourceWithStreamingResponse:
273
+ def __init__(self, user_credentials: AsyncUserCredentialsResource) -> None:
274
+ self._user_credentials = user_credentials
275
+
276
+ self.get = async_to_streamed_response_wrapper(
277
+ user_credentials.get,
278
+ )
279
+ self.regenerate = async_to_streamed_response_wrapper(
280
+ user_credentials.regenerate,
281
+ )
@@ -0,0 +1,169 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
4
+
5
+ import httpx
6
+
7
+ from ....._types import Body, Query, Headers, NotGiven, not_given
8
+ from ....._compat import cached_property
9
+ from ....._resource import SyncAPIResource, AsyncAPIResource
10
+ from ....._response import (
11
+ to_raw_response_wrapper,
12
+ to_streamed_response_wrapper,
13
+ async_to_raw_response_wrapper,
14
+ async_to_streamed_response_wrapper,
15
+ )
16
+ from ....._base_client import make_request_options
17
+ from .....types.cloud.databases.postgres.postgres_configuration import PostgresConfiguration
18
+
19
+ __all__ = ["ConfigurationsResource", "AsyncConfigurationsResource"]
20
+
21
+
22
+ class ConfigurationsResource(SyncAPIResource):
23
+ @cached_property
24
+ def with_raw_response(self) -> ConfigurationsResourceWithRawResponse:
25
+ """
26
+ This property can be used as a prefix for any HTTP method call to return
27
+ the raw response object instead of the parsed content.
28
+
29
+ For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers
30
+ """
31
+ return ConfigurationsResourceWithRawResponse(self)
32
+
33
+ @cached_property
34
+ def with_streaming_response(self) -> ConfigurationsResourceWithStreamingResponse:
35
+ """
36
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
37
+
38
+ For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response
39
+ """
40
+ return ConfigurationsResourceWithStreamingResponse(self)
41
+
42
+ def get(
43
+ self,
44
+ *,
45
+ project_id: int | None = None,
46
+ region_id: int | None = None,
47
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
48
+ # The extra values given here take precedence over values defined on the client or passed to this method.
49
+ extra_headers: Headers | None = None,
50
+ extra_query: Query | None = None,
51
+ extra_body: Body | None = None,
52
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
53
+ ) -> PostgresConfiguration:
54
+ """
55
+ Get all available PostgreSQL configurations for the specified region.
56
+
57
+ Args:
58
+ extra_headers: Send extra headers
59
+
60
+ extra_query: Add additional query parameters to the request
61
+
62
+ extra_body: Add additional JSON properties to the request
63
+
64
+ timeout: Override the client-level default timeout for this request, in seconds
65
+ """
66
+ if project_id is None:
67
+ project_id = self._client._get_cloud_project_id_path_param()
68
+ if region_id is None:
69
+ region_id = self._client._get_cloud_region_id_path_param()
70
+ return self._get(
71
+ f"/cloud/v1/dbaas/postgres/configuration/{project_id}/{region_id}",
72
+ options=make_request_options(
73
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
74
+ ),
75
+ cast_to=PostgresConfiguration,
76
+ )
77
+
78
+
79
+ class AsyncConfigurationsResource(AsyncAPIResource):
80
+ @cached_property
81
+ def with_raw_response(self) -> AsyncConfigurationsResourceWithRawResponse:
82
+ """
83
+ This property can be used as a prefix for any HTTP method call to return
84
+ the raw response object instead of the parsed content.
85
+
86
+ For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers
87
+ """
88
+ return AsyncConfigurationsResourceWithRawResponse(self)
89
+
90
+ @cached_property
91
+ def with_streaming_response(self) -> AsyncConfigurationsResourceWithStreamingResponse:
92
+ """
93
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
94
+
95
+ For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response
96
+ """
97
+ return AsyncConfigurationsResourceWithStreamingResponse(self)
98
+
99
+ async def get(
100
+ self,
101
+ *,
102
+ project_id: int | None = None,
103
+ region_id: int | None = None,
104
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
105
+ # The extra values given here take precedence over values defined on the client or passed to this method.
106
+ extra_headers: Headers | None = None,
107
+ extra_query: Query | None = None,
108
+ extra_body: Body | None = None,
109
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
110
+ ) -> PostgresConfiguration:
111
+ """
112
+ Get all available PostgreSQL configurations for the specified region.
113
+
114
+ Args:
115
+ extra_headers: Send extra headers
116
+
117
+ extra_query: Add additional query parameters to the request
118
+
119
+ extra_body: Add additional JSON properties to the request
120
+
121
+ timeout: Override the client-level default timeout for this request, in seconds
122
+ """
123
+ if project_id is None:
124
+ project_id = self._client._get_cloud_project_id_path_param()
125
+ if region_id is None:
126
+ region_id = self._client._get_cloud_region_id_path_param()
127
+ return await self._get(
128
+ f"/cloud/v1/dbaas/postgres/configuration/{project_id}/{region_id}",
129
+ options=make_request_options(
130
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
131
+ ),
132
+ cast_to=PostgresConfiguration,
133
+ )
134
+
135
+
136
+ class ConfigurationsResourceWithRawResponse:
137
+ def __init__(self, configurations: ConfigurationsResource) -> None:
138
+ self._configurations = configurations
139
+
140
+ self.get = to_raw_response_wrapper(
141
+ configurations.get,
142
+ )
143
+
144
+
145
+ class AsyncConfigurationsResourceWithRawResponse:
146
+ def __init__(self, configurations: AsyncConfigurationsResource) -> None:
147
+ self._configurations = configurations
148
+
149
+ self.get = async_to_raw_response_wrapper(
150
+ configurations.get,
151
+ )
152
+
153
+
154
+ class ConfigurationsResourceWithStreamingResponse:
155
+ def __init__(self, configurations: ConfigurationsResource) -> None:
156
+ self._configurations = configurations
157
+
158
+ self.get = to_streamed_response_wrapper(
159
+ configurations.get,
160
+ )
161
+
162
+
163
+ class AsyncConfigurationsResourceWithStreamingResponse:
164
+ def __init__(self, configurations: AsyncConfigurationsResource) -> None:
165
+ self._configurations = configurations
166
+
167
+ self.get = async_to_streamed_response_wrapper(
168
+ configurations.get,
169
+ )
@@ -0,0 +1,197 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
4
+
5
+ import httpx
6
+
7
+ from ....._types import Body, Query, Headers, NotGiven, not_given
8
+ from ....._utils import maybe_transform, async_maybe_transform
9
+ from ....._compat import cached_property
10
+ from ....._resource import SyncAPIResource, AsyncAPIResource
11
+ from ....._response import (
12
+ to_raw_response_wrapper,
13
+ to_streamed_response_wrapper,
14
+ async_to_raw_response_wrapper,
15
+ async_to_streamed_response_wrapper,
16
+ )
17
+ from ....._base_client import make_request_options
18
+ from .....types.cloud.databases.postgres import custom_configuration_validate_params
19
+ from .....types.cloud.databases.postgres.pg_conf_validation import PgConfValidation
20
+
21
+ __all__ = ["CustomConfigurationsResource", "AsyncCustomConfigurationsResource"]
22
+
23
+
24
+ class CustomConfigurationsResource(SyncAPIResource):
25
+ @cached_property
26
+ def with_raw_response(self) -> CustomConfigurationsResourceWithRawResponse:
27
+ """
28
+ This property can be used as a prefix for any HTTP method call to return
29
+ the raw response object instead of the parsed content.
30
+
31
+ For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers
32
+ """
33
+ return CustomConfigurationsResourceWithRawResponse(self)
34
+
35
+ @cached_property
36
+ def with_streaming_response(self) -> CustomConfigurationsResourceWithStreamingResponse:
37
+ """
38
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
39
+
40
+ For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response
41
+ """
42
+ return CustomConfigurationsResourceWithStreamingResponse(self)
43
+
44
+ def validate(
45
+ self,
46
+ *,
47
+ project_id: int | None = None,
48
+ region_id: int | None = None,
49
+ pg_conf: str,
50
+ version: str,
51
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
52
+ # The extra values given here take precedence over values defined on the client or passed to this method.
53
+ extra_headers: Headers | None = None,
54
+ extra_query: Query | None = None,
55
+ extra_body: Body | None = None,
56
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
57
+ ) -> PgConfValidation:
58
+ """
59
+ Validate a custom PostgreSQL configuration file.
60
+
61
+ Args:
62
+ pg_conf: PostgreSQL configuration
63
+
64
+ version: PostgreSQL version
65
+
66
+ extra_headers: Send extra headers
67
+
68
+ extra_query: Add additional query parameters to the request
69
+
70
+ extra_body: Add additional JSON properties to the request
71
+
72
+ timeout: Override the client-level default timeout for this request, in seconds
73
+ """
74
+ if project_id is None:
75
+ project_id = self._client._get_cloud_project_id_path_param()
76
+ if region_id is None:
77
+ region_id = self._client._get_cloud_region_id_path_param()
78
+ return self._post(
79
+ f"/cloud/v1/dbaas/postgres/validate_pg_conf/{project_id}/{region_id}",
80
+ body=maybe_transform(
81
+ {
82
+ "pg_conf": pg_conf,
83
+ "version": version,
84
+ },
85
+ custom_configuration_validate_params.CustomConfigurationValidateParams,
86
+ ),
87
+ options=make_request_options(
88
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
89
+ ),
90
+ cast_to=PgConfValidation,
91
+ )
92
+
93
+
94
+ class AsyncCustomConfigurationsResource(AsyncAPIResource):
95
+ @cached_property
96
+ def with_raw_response(self) -> AsyncCustomConfigurationsResourceWithRawResponse:
97
+ """
98
+ This property can be used as a prefix for any HTTP method call to return
99
+ the raw response object instead of the parsed content.
100
+
101
+ For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers
102
+ """
103
+ return AsyncCustomConfigurationsResourceWithRawResponse(self)
104
+
105
+ @cached_property
106
+ def with_streaming_response(self) -> AsyncCustomConfigurationsResourceWithStreamingResponse:
107
+ """
108
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
109
+
110
+ For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response
111
+ """
112
+ return AsyncCustomConfigurationsResourceWithStreamingResponse(self)
113
+
114
+ async def validate(
115
+ self,
116
+ *,
117
+ project_id: int | None = None,
118
+ region_id: int | None = None,
119
+ pg_conf: str,
120
+ version: str,
121
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
122
+ # The extra values given here take precedence over values defined on the client or passed to this method.
123
+ extra_headers: Headers | None = None,
124
+ extra_query: Query | None = None,
125
+ extra_body: Body | None = None,
126
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
127
+ ) -> PgConfValidation:
128
+ """
129
+ Validate a custom PostgreSQL configuration file.
130
+
131
+ Args:
132
+ pg_conf: PostgreSQL configuration
133
+
134
+ version: PostgreSQL version
135
+
136
+ extra_headers: Send extra headers
137
+
138
+ extra_query: Add additional query parameters to the request
139
+
140
+ extra_body: Add additional JSON properties to the request
141
+
142
+ timeout: Override the client-level default timeout for this request, in seconds
143
+ """
144
+ if project_id is None:
145
+ project_id = self._client._get_cloud_project_id_path_param()
146
+ if region_id is None:
147
+ region_id = self._client._get_cloud_region_id_path_param()
148
+ return await self._post(
149
+ f"/cloud/v1/dbaas/postgres/validate_pg_conf/{project_id}/{region_id}",
150
+ body=await async_maybe_transform(
151
+ {
152
+ "pg_conf": pg_conf,
153
+ "version": version,
154
+ },
155
+ custom_configuration_validate_params.CustomConfigurationValidateParams,
156
+ ),
157
+ options=make_request_options(
158
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
159
+ ),
160
+ cast_to=PgConfValidation,
161
+ )
162
+
163
+
164
+ class CustomConfigurationsResourceWithRawResponse:
165
+ def __init__(self, custom_configurations: CustomConfigurationsResource) -> None:
166
+ self._custom_configurations = custom_configurations
167
+
168
+ self.validate = to_raw_response_wrapper(
169
+ custom_configurations.validate,
170
+ )
171
+
172
+
173
+ class AsyncCustomConfigurationsResourceWithRawResponse:
174
+ def __init__(self, custom_configurations: AsyncCustomConfigurationsResource) -> None:
175
+ self._custom_configurations = custom_configurations
176
+
177
+ self.validate = async_to_raw_response_wrapper(
178
+ custom_configurations.validate,
179
+ )
180
+
181
+
182
+ class CustomConfigurationsResourceWithStreamingResponse:
183
+ def __init__(self, custom_configurations: CustomConfigurationsResource) -> None:
184
+ self._custom_configurations = custom_configurations
185
+
186
+ self.validate = to_streamed_response_wrapper(
187
+ custom_configurations.validate,
188
+ )
189
+
190
+
191
+ class AsyncCustomConfigurationsResourceWithStreamingResponse:
192
+ def __init__(self, custom_configurations: AsyncCustomConfigurationsResource) -> None:
193
+ self._custom_configurations = custom_configurations
194
+
195
+ self.validate = async_to_streamed_response_wrapper(
196
+ custom_configurations.validate,
197
+ )