gcore 0.3.0__py3-none-any.whl → 0.5.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 (226) hide show
  1. gcore/__init__.py +2 -1
  2. gcore/_base_client.py +31 -2
  3. gcore/_client.py +18 -0
  4. gcore/_constants.py +2 -2
  5. gcore/_models.py +8 -5
  6. gcore/_version.py +1 -1
  7. gcore/pagination.py +252 -1
  8. gcore/resources/__init__.py +28 -0
  9. gcore/resources/cloud/baremetal/flavors.py +11 -137
  10. gcore/resources/cloud/baremetal/images.py +10 -12
  11. gcore/resources/cloud/baremetal/servers.py +33 -30
  12. gcore/resources/cloud/billing_reservations.py +2 -2
  13. gcore/resources/cloud/file_shares/file_shares.py +7 -8
  14. gcore/resources/cloud/floating_ips.py +7 -12
  15. gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py +33 -22
  16. gcore/resources/cloud/gpu_baremetal_clusters/images.py +9 -10
  17. gcore/resources/cloud/gpu_baremetal_clusters/interfaces.py +2 -2
  18. gcore/resources/cloud/gpu_baremetal_clusters/servers.py +8 -4
  19. gcore/resources/cloud/inference/deployments/deployments.py +76 -35
  20. gcore/resources/cloud/inference/deployments/logs.py +7 -7
  21. gcore/resources/cloud/inference/inference.py +5 -5
  22. gcore/resources/cloud/inference/models.py +16 -15
  23. gcore/resources/cloud/inference/registry_credentials.py +18 -18
  24. gcore/resources/cloud/inference/secrets.py +12 -13
  25. gcore/resources/cloud/instances/flavors.py +9 -233
  26. gcore/resources/cloud/instances/images.py +47 -37
  27. gcore/resources/cloud/instances/instances.py +49 -34
  28. gcore/resources/cloud/instances/interfaces.py +2 -2
  29. gcore/resources/cloud/ip_ranges.py +34 -2
  30. gcore/resources/cloud/load_balancers/l7_policies/l7_policies.py +10 -2
  31. gcore/resources/cloud/load_balancers/listeners.py +17 -8
  32. gcore/resources/cloud/load_balancers/load_balancers.py +73 -21
  33. gcore/resources/cloud/load_balancers/metrics.py +2 -2
  34. gcore/resources/cloud/load_balancers/pools/health_monitors.py +2 -2
  35. gcore/resources/cloud/load_balancers/pools/members.py +6 -2
  36. gcore/resources/cloud/networks/networks.py +81 -17
  37. gcore/resources/cloud/networks/routers.py +18 -18
  38. gcore/resources/cloud/networks/subnets.py +51 -11
  39. gcore/resources/cloud/projects.py +38 -24
  40. gcore/resources/cloud/quotas/quotas.py +6 -6
  41. gcore/resources/cloud/quotas/requests.py +8 -8
  42. gcore/resources/cloud/registries/artifacts.py +4 -4
  43. gcore/resources/cloud/registries/registries.py +14 -16
  44. gcore/resources/cloud/registries/repositories.py +4 -4
  45. gcore/resources/cloud/registries/tags.py +2 -2
  46. gcore/resources/cloud/registries/users.py +21 -22
  47. gcore/resources/cloud/reserved_fixed_ips/reserved_fixed_ips.py +20 -20
  48. gcore/resources/cloud/reserved_fixed_ips/vip.py +10 -10
  49. gcore/resources/cloud/secrets.py +14 -224
  50. gcore/resources/cloud/security_groups/rules.py +6 -6
  51. gcore/resources/cloud/security_groups/security_groups.py +70 -31
  52. gcore/resources/cloud/tasks.py +34 -32
  53. gcore/resources/cloud/users/role_assignments.py +12 -14
  54. gcore/resources/cloud/volumes.py +139 -49
  55. gcore/resources/fastedge/__init__.py +103 -0
  56. gcore/resources/fastedge/apps/__init__.py +33 -0
  57. gcore/resources/fastedge/apps/apps.py +932 -0
  58. gcore/resources/fastedge/apps/logs.py +248 -0
  59. gcore/resources/fastedge/binaries.py +286 -0
  60. gcore/resources/fastedge/fastedge.py +327 -0
  61. gcore/resources/fastedge/kv_stores.py +523 -0
  62. gcore/resources/fastedge/secrets.py +687 -0
  63. gcore/resources/fastedge/statistics.py +347 -0
  64. gcore/resources/fastedge/templates.py +652 -0
  65. gcore/resources/iam/__init__.py +47 -0
  66. gcore/resources/iam/api_tokens.py +521 -0
  67. gcore/resources/iam/iam.py +199 -0
  68. gcore/resources/iam/users.py +642 -0
  69. gcore/resources/waap/__init__.py +0 -14
  70. gcore/resources/waap/waap.py +0 -32
  71. gcore/types/cloud/__init__.py +2 -28
  72. gcore/types/cloud/baremetal/__init__.py +0 -1
  73. gcore/types/cloud/baremetal/image_list_params.py +1 -5
  74. gcore/types/cloud/baremetal/server_create_params.py +5 -9
  75. gcore/types/cloud/baremetal/server_list_params.py +1 -5
  76. gcore/types/cloud/ddos_profile.py +9 -3
  77. gcore/types/cloud/file_share_create_params.py +3 -5
  78. gcore/types/cloud/floating_ip_create_params.py +2 -4
  79. gcore/types/cloud/floating_ip_list_params.py +1 -5
  80. gcore/types/cloud/gpu_baremetal_cluster_create_params.py +3 -4
  81. gcore/types/cloud/gpu_baremetal_clusters/image_upload_params.py +2 -4
  82. gcore/types/cloud/health_monitor.py +6 -1
  83. gcore/types/cloud/inference/__init__.py +12 -8
  84. gcore/types/cloud/inference/deployment_create_params.py +224 -7
  85. gcore/types/cloud/inference/deployment_update_params.py +24 -3
  86. gcore/types/cloud/inference/deployments/__init__.py +1 -0
  87. gcore/types/cloud/inference/{inference_log.py → deployments/inference_deployment_log.py} +3 -3
  88. gcore/types/cloud/inference/inference_deployment.py +266 -0
  89. gcore/types/cloud/inference/{inference_apikey_secret.py → inference_deployment_api_key.py} +2 -2
  90. gcore/types/cloud/inference/{mlcatalog_model_card.py → inference_model.py} +2 -2
  91. gcore/types/cloud/inference/{inference_registry_credential.py → inference_registry_credentials.py} +2 -2
  92. gcore/types/cloud/inference/{inference_registry_credential_full.py → inference_registry_credentials_create.py} +2 -2
  93. gcore/types/cloud/inference/inference_secret.py +10 -3
  94. gcore/types/cloud/inference/model_list_params.py +2 -4
  95. gcore/types/cloud/{container_probe.py → inference/probe.py} +9 -9
  96. gcore/types/cloud/{container_probe_config.py → inference/probe_config.py} +5 -5
  97. gcore/types/cloud/{container_probe_exec.py → inference/probe_exec.py} +3 -3
  98. gcore/types/cloud/{container_probe_http_get.py → inference/probe_http_get.py} +3 -3
  99. gcore/types/cloud/{container_probe_tcp_socket.py → inference/probe_tcp_socket.py} +3 -3
  100. gcore/types/cloud/inference/secret_create_params.py +10 -4
  101. gcore/types/cloud/inference/secret_replace_params.py +10 -4
  102. gcore/types/cloud/{region_capacity.py → inference_region_capacity.py} +10 -3
  103. gcore/types/cloud/{region_capacity_list.py → inference_region_capacity_list.py} +4 -4
  104. gcore/types/cloud/instance_create_params.py +8 -9
  105. gcore/types/cloud/instance_list_params.py +1 -5
  106. gcore/types/cloud/instances/__init__.py +0 -2
  107. gcore/types/cloud/instances/image_create_from_volume_params.py +2 -4
  108. gcore/types/cloud/instances/image_list_params.py +1 -5
  109. gcore/types/cloud/instances/image_upload_params.py +2 -4
  110. gcore/types/cloud/load_balancer_create_params.py +8 -4
  111. gcore/types/cloud/load_balancer_list_params.py +1 -5
  112. gcore/types/cloud/load_balancer_update_params.py +24 -0
  113. gcore/types/cloud/load_balancers/pool_create_params.py +6 -1
  114. gcore/types/cloud/load_balancers/pool_update_params.py +6 -1
  115. gcore/types/cloud/load_balancers/pools/member_add_params.py +6 -1
  116. gcore/types/cloud/member.py +6 -1
  117. gcore/types/cloud/network_create_params.py +2 -3
  118. gcore/types/cloud/network_list_params.py +4 -5
  119. gcore/types/cloud/network_update_params.py +28 -2
  120. gcore/types/cloud/networks/router_list_params.py +2 -2
  121. gcore/types/cloud/networks/subnet_create_params.py +2 -3
  122. gcore/types/cloud/networks/subnet_list_params.py +1 -5
  123. gcore/types/cloud/networks/subnet_update_params.py +25 -0
  124. gcore/types/cloud/registries/__init__.py +1 -0
  125. gcore/types/cloud/registries/user_refresh_secret_response.py +31 -0
  126. gcore/types/cloud/reserved_fixed_ip_list_params.py +2 -2
  127. gcore/types/cloud/security_group_list_params.py +3 -7
  128. gcore/types/cloud/security_group_update_params.py +25 -0
  129. gcore/types/cloud/tag_update_map_param.py +2 -2
  130. gcore/types/cloud/task_list_params.py +15 -14
  131. gcore/types/cloud/volume_list_params.py +1 -5
  132. gcore/types/cloud/volume_update_params.py +29 -3
  133. gcore/types/fastedge/__init__.py +48 -0
  134. gcore/types/fastedge/app.py +81 -0
  135. gcore/types/fastedge/app_create_params.py +56 -0
  136. gcore/types/fastedge/app_list_params.py +50 -0
  137. gcore/types/fastedge/app_param.py +56 -0
  138. gcore/types/fastedge/app_replace_params.py +17 -0
  139. gcore/types/fastedge/app_short.py +60 -0
  140. gcore/types/fastedge/app_update_params.py +56 -0
  141. gcore/types/fastedge/apps/__init__.py +6 -0
  142. gcore/types/fastedge/apps/log.py +28 -0
  143. gcore/types/fastedge/apps/log_list_params.py +37 -0
  144. gcore/types/fastedge/binary.py +40 -0
  145. gcore/types/fastedge/binary_list_response.py +12 -0
  146. gcore/types/fastedge/binary_short.py +32 -0
  147. gcore/types/fastedge/call_status.py +24 -0
  148. gcore/types/fastedge/client.py +57 -0
  149. gcore/types/fastedge/duration_stats.py +30 -0
  150. gcore/types/fastedge/kv_store.py +33 -0
  151. gcore/types/fastedge/kv_store_create_params.py +23 -0
  152. gcore/types/fastedge/kv_store_get_response.py +10 -0
  153. gcore/types/fastedge/kv_store_list_params.py +12 -0
  154. gcore/types/fastedge/kv_store_list_response.py +15 -0
  155. gcore/types/fastedge/kv_store_replace_params.py +23 -0
  156. gcore/types/fastedge/kv_store_short.py +19 -0
  157. gcore/types/fastedge/kv_store_stats.py +26 -0
  158. gcore/types/fastedge/secret.py +29 -0
  159. gcore/types/fastedge/secret_create_params.py +27 -0
  160. gcore/types/fastedge/secret_create_response.py +12 -0
  161. gcore/types/fastedge/secret_delete_params.py +12 -0
  162. gcore/types/fastedge/secret_list_params.py +15 -0
  163. gcore/types/{cloud → fastedge}/secret_list_response.py +2 -6
  164. gcore/types/fastedge/secret_replace_params.py +27 -0
  165. gcore/types/fastedge/secret_short.py +21 -0
  166. gcore/types/fastedge/secret_update_params.py +27 -0
  167. gcore/types/fastedge/statistic_get_call_series_params.py +28 -0
  168. gcore/types/fastedge/statistic_get_call_series_response.py +12 -0
  169. gcore/types/fastedge/statistic_get_duration_series_params.py +28 -0
  170. gcore/types/fastedge/statistic_get_duration_series_response.py +12 -0
  171. gcore/types/fastedge/template.py +31 -0
  172. gcore/types/fastedge/template_create_params.py +30 -0
  173. gcore/types/fastedge/template_delete_params.py +12 -0
  174. gcore/types/fastedge/template_list_params.py +25 -0
  175. gcore/types/fastedge/template_parameter.py +22 -0
  176. gcore/types/fastedge/template_parameter_param.py +21 -0
  177. gcore/types/fastedge/template_replace_params.py +30 -0
  178. gcore/types/fastedge/template_short.py +27 -0
  179. gcore/types/iam/__init__.py +17 -0
  180. gcore/types/iam/account_overview.py +488 -0
  181. gcore/types/iam/api_token.py +78 -0
  182. gcore/types/iam/api_token_create.py +15 -0
  183. gcore/types/iam/api_token_create_params.py +42 -0
  184. gcore/types/iam/api_token_list.py +81 -0
  185. gcore/types/iam/api_token_list_params.py +41 -0
  186. gcore/types/iam/user.py +86 -0
  187. gcore/types/iam/user_detailed.py +104 -0
  188. gcore/types/iam/user_invite.py +15 -0
  189. gcore/types/iam/user_invite_params.py +37 -0
  190. gcore/types/iam/user_list_params.py +15 -0
  191. gcore/types/iam/user_update.py +104 -0
  192. gcore/types/iam/user_update_params.py +52 -0
  193. gcore/types/waap/__init__.py +0 -1
  194. gcore/types/waap/domains/custom_rule_create_params.py +7 -3
  195. gcore/types/waap/domains/custom_rule_update_params.py +7 -3
  196. gcore/types/waap/waap_custom_rule.py +7 -3
  197. {gcore-0.3.0.dist-info → gcore-0.5.0.dist-info}/METADATA +44 -5
  198. {gcore-0.3.0.dist-info → gcore-0.5.0.dist-info}/RECORD +200 -151
  199. gcore/resources/waap/clients.py +0 -135
  200. gcore/types/cloud/aws_iam_data.py +0 -13
  201. gcore/types/cloud/aws_iam_data_param.py +0 -15
  202. gcore/types/cloud/baremetal/flavor_list_suitable_params.py +0 -22
  203. gcore/types/cloud/capacity.py +0 -13
  204. gcore/types/cloud/container_probe_config_create_param.py +0 -17
  205. gcore/types/cloud/container_probe_create_param.py +0 -38
  206. gcore/types/cloud/container_probe_exec_create_param.py +0 -13
  207. gcore/types/cloud/container_probe_http_get_create_param.py +0 -25
  208. gcore/types/cloud/container_probe_tcp_socket_create_param.py +0 -12
  209. gcore/types/cloud/container_scale.py +0 -25
  210. gcore/types/cloud/container_scale_trigger_rate.py +0 -13
  211. gcore/types/cloud/container_scale_trigger_sqs.py +0 -33
  212. gcore/types/cloud/container_scale_trigger_threshold.py +0 -10
  213. gcore/types/cloud/container_scale_triggers.py +0 -36
  214. gcore/types/cloud/deploy_status.py +0 -13
  215. gcore/types/cloud/inference/container.py +0 -26
  216. gcore/types/cloud/inference/inference.py +0 -95
  217. gcore/types/cloud/inference/mlcatalog_order_by_choices.py +0 -7
  218. gcore/types/cloud/inference_probes.py +0 -19
  219. gcore/types/cloud/ingress_opts_out.py +0 -16
  220. gcore/types/cloud/ingress_opts_param.py +0 -18
  221. gcore/types/cloud/instances/flavor_list_for_resize_params.py +0 -16
  222. gcore/types/cloud/instances/flavor_list_suitable_params.py +0 -59
  223. gcore/types/cloud/secret_create_params.py +0 -66
  224. gcore/types/waap/client_me_response.py +0 -34
  225. {gcore-0.3.0.dist-info → gcore-0.5.0.dist-info}/WHEEL +0 -0
  226. {gcore-0.3.0.dist-info → gcore-0.5.0.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,521 @@
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 NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven
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 ...types.iam import api_token_list_params, api_token_create_params
18
+ from ..._base_client import make_request_options
19
+ from ...types.iam.api_token import APIToken
20
+ from ...types.iam.api_token_list import APITokenList
21
+ from ...types.iam.api_token_create import APITokenCreate
22
+
23
+ __all__ = ["APITokensResource", "AsyncAPITokensResource"]
24
+
25
+
26
+ class APITokensResource(SyncAPIResource):
27
+ @cached_property
28
+ def with_raw_response(self) -> APITokensResourceWithRawResponse:
29
+ """
30
+ This property can be used as a prefix for any HTTP method call to return
31
+ the raw response object instead of the parsed content.
32
+
33
+ For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers
34
+ """
35
+ return APITokensResourceWithRawResponse(self)
36
+
37
+ @cached_property
38
+ def with_streaming_response(self) -> APITokensResourceWithStreamingResponse:
39
+ """
40
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
41
+
42
+ For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response
43
+ """
44
+ return APITokensResourceWithStreamingResponse(self)
45
+
46
+ def create(
47
+ self,
48
+ client_id: int,
49
+ *,
50
+ client_user: api_token_create_params.ClientUser,
51
+ exp_date: str,
52
+ name: str,
53
+ description: str | NotGiven = NOT_GIVEN,
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
+ ) -> APITokenCreate:
61
+ """
62
+ Create an API token in the current account.
63
+
64
+ Args:
65
+ client_user: API token role.
66
+
67
+ exp_date: Date when the API token becomes expired (ISO 8086/RFC 3339 format), UTC. If
68
+ null, then the API token will never expire.
69
+
70
+ name: API token name.
71
+
72
+ description: API token description.
73
+
74
+ extra_headers: Send extra headers
75
+
76
+ extra_query: Add additional query parameters to the request
77
+
78
+ extra_body: Add additional JSON properties to the request
79
+
80
+ timeout: Override the client-level default timeout for this request, in seconds
81
+ """
82
+ return self._post(
83
+ f"/iam/clients/{client_id}/tokens",
84
+ body=maybe_transform(
85
+ {
86
+ "client_user": client_user,
87
+ "exp_date": exp_date,
88
+ "name": name,
89
+ "description": description,
90
+ },
91
+ api_token_create_params.APITokenCreateParams,
92
+ ),
93
+ options=make_request_options(
94
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
95
+ ),
96
+ cast_to=APITokenCreate,
97
+ )
98
+
99
+ def list(
100
+ self,
101
+ client_id: int,
102
+ *,
103
+ deleted: bool | NotGiven = NOT_GIVEN,
104
+ issued_by: int | NotGiven = NOT_GIVEN,
105
+ not_issued_by: int | NotGiven = NOT_GIVEN,
106
+ role: str | NotGiven = NOT_GIVEN,
107
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
108
+ # The extra values given here take precedence over values defined on the client or passed to this method.
109
+ extra_headers: Headers | None = None,
110
+ extra_query: Query | None = None,
111
+ extra_body: Body | None = None,
112
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
113
+ ) -> APITokenList:
114
+ """Get information about your permanent API tokens in the account.
115
+
116
+ A user with the
117
+ Administrators role gets information about all API tokens in the account.
118
+
119
+ Args:
120
+ deleted: The state of API tokens included in the response.
121
+ Two possible values:
122
+
123
+ - True - API token was not deleted.\\** False - API token was deleted.
124
+
125
+ Example, _&deleted=True_
126
+
127
+ issued_by: User's ID. Use to get API tokens issued by a particular user.
128
+ Example, _&`issued_by`=1234_
129
+
130
+ not_issued_by: User's ID. Use to get API tokens issued by anyone except a particular user.
131
+ Example, _¬_issued_by=1234_
132
+
133
+ role:
134
+ Group's ID. Possible values are:
135
+
136
+ - 1 - Administrators* 2 - Users* 5 - Engineers* 3009 - Purge and Prefetch only
137
+ (API+Web)* 3022 - Purge and Prefetch only (API)
138
+
139
+ Example, _&role=Engineers_
140
+
141
+ extra_headers: Send extra headers
142
+
143
+ extra_query: Add additional query parameters to the request
144
+
145
+ extra_body: Add additional JSON properties to the request
146
+
147
+ timeout: Override the client-level default timeout for this request, in seconds
148
+ """
149
+ return self._get(
150
+ f"/iam/clients/{client_id}/tokens",
151
+ options=make_request_options(
152
+ extra_headers=extra_headers,
153
+ extra_query=extra_query,
154
+ extra_body=extra_body,
155
+ timeout=timeout,
156
+ query=maybe_transform(
157
+ {
158
+ "deleted": deleted,
159
+ "issued_by": issued_by,
160
+ "not_issued_by": not_issued_by,
161
+ "role": role,
162
+ },
163
+ api_token_list_params.APITokenListParams,
164
+ ),
165
+ ),
166
+ cast_to=APITokenList,
167
+ )
168
+
169
+ def delete(
170
+ self,
171
+ token_id: int,
172
+ *,
173
+ client_id: int,
174
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
175
+ # The extra values given here take precedence over values defined on the client or passed to this method.
176
+ extra_headers: Headers | None = None,
177
+ extra_query: Query | None = None,
178
+ extra_body: Body | None = None,
179
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
180
+ ) -> None:
181
+ """Delete API token from current account.
182
+
183
+ Ensure that the API token is not being
184
+ used by an active application. After deleting the token, all applications that
185
+ use this token will not be able to get access to your account via API. The
186
+ action cannot be reversed.
187
+
188
+ Args:
189
+ extra_headers: Send extra headers
190
+
191
+ extra_query: Add additional query parameters to the request
192
+
193
+ extra_body: Add additional JSON properties to the request
194
+
195
+ timeout: Override the client-level default timeout for this request, in seconds
196
+ """
197
+ extra_headers = {"Accept": "*/*", **(extra_headers or {})}
198
+ return self._delete(
199
+ f"/iam/clients/{client_id}/tokens/{token_id}",
200
+ options=make_request_options(
201
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
202
+ ),
203
+ cast_to=NoneType,
204
+ )
205
+
206
+ def get(
207
+ self,
208
+ token_id: int,
209
+ *,
210
+ client_id: int,
211
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
212
+ # The extra values given here take precedence over values defined on the client or passed to this method.
213
+ extra_headers: Headers | None = None,
214
+ extra_query: Query | None = None,
215
+ extra_body: Body | None = None,
216
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
217
+ ) -> APIToken:
218
+ """
219
+ Get API Token
220
+
221
+ Args:
222
+ extra_headers: Send extra headers
223
+
224
+ extra_query: Add additional query parameters to the request
225
+
226
+ extra_body: Add additional JSON properties to the request
227
+
228
+ timeout: Override the client-level default timeout for this request, in seconds
229
+ """
230
+ return self._get(
231
+ f"/iam/clients/{client_id}/tokens/{token_id}",
232
+ options=make_request_options(
233
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
234
+ ),
235
+ cast_to=APIToken,
236
+ )
237
+
238
+
239
+ class AsyncAPITokensResource(AsyncAPIResource):
240
+ @cached_property
241
+ def with_raw_response(self) -> AsyncAPITokensResourceWithRawResponse:
242
+ """
243
+ This property can be used as a prefix for any HTTP method call to return
244
+ the raw response object instead of the parsed content.
245
+
246
+ For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers
247
+ """
248
+ return AsyncAPITokensResourceWithRawResponse(self)
249
+
250
+ @cached_property
251
+ def with_streaming_response(self) -> AsyncAPITokensResourceWithStreamingResponse:
252
+ """
253
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
254
+
255
+ For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response
256
+ """
257
+ return AsyncAPITokensResourceWithStreamingResponse(self)
258
+
259
+ async def create(
260
+ self,
261
+ client_id: int,
262
+ *,
263
+ client_user: api_token_create_params.ClientUser,
264
+ exp_date: str,
265
+ name: str,
266
+ description: str | NotGiven = NOT_GIVEN,
267
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
268
+ # The extra values given here take precedence over values defined on the client or passed to this method.
269
+ extra_headers: Headers | None = None,
270
+ extra_query: Query | None = None,
271
+ extra_body: Body | None = None,
272
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
273
+ ) -> APITokenCreate:
274
+ """
275
+ Create an API token in the current account.
276
+
277
+ Args:
278
+ client_user: API token role.
279
+
280
+ exp_date: Date when the API token becomes expired (ISO 8086/RFC 3339 format), UTC. If
281
+ null, then the API token will never expire.
282
+
283
+ name: API token name.
284
+
285
+ description: API token description.
286
+
287
+ extra_headers: Send extra headers
288
+
289
+ extra_query: Add additional query parameters to the request
290
+
291
+ extra_body: Add additional JSON properties to the request
292
+
293
+ timeout: Override the client-level default timeout for this request, in seconds
294
+ """
295
+ return await self._post(
296
+ f"/iam/clients/{client_id}/tokens",
297
+ body=await async_maybe_transform(
298
+ {
299
+ "client_user": client_user,
300
+ "exp_date": exp_date,
301
+ "name": name,
302
+ "description": description,
303
+ },
304
+ api_token_create_params.APITokenCreateParams,
305
+ ),
306
+ options=make_request_options(
307
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
308
+ ),
309
+ cast_to=APITokenCreate,
310
+ )
311
+
312
+ async def list(
313
+ self,
314
+ client_id: int,
315
+ *,
316
+ deleted: bool | NotGiven = NOT_GIVEN,
317
+ issued_by: int | NotGiven = NOT_GIVEN,
318
+ not_issued_by: int | NotGiven = NOT_GIVEN,
319
+ role: str | NotGiven = NOT_GIVEN,
320
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
321
+ # The extra values given here take precedence over values defined on the client or passed to this method.
322
+ extra_headers: Headers | None = None,
323
+ extra_query: Query | None = None,
324
+ extra_body: Body | None = None,
325
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
326
+ ) -> APITokenList:
327
+ """Get information about your permanent API tokens in the account.
328
+
329
+ A user with the
330
+ Administrators role gets information about all API tokens in the account.
331
+
332
+ Args:
333
+ deleted: The state of API tokens included in the response.
334
+ Two possible values:
335
+
336
+ - True - API token was not deleted.\\** False - API token was deleted.
337
+
338
+ Example, _&deleted=True_
339
+
340
+ issued_by: User's ID. Use to get API tokens issued by a particular user.
341
+ Example, _&`issued_by`=1234_
342
+
343
+ not_issued_by: User's ID. Use to get API tokens issued by anyone except a particular user.
344
+ Example, _¬_issued_by=1234_
345
+
346
+ role:
347
+ Group's ID. Possible values are:
348
+
349
+ - 1 - Administrators* 2 - Users* 5 - Engineers* 3009 - Purge and Prefetch only
350
+ (API+Web)* 3022 - Purge and Prefetch only (API)
351
+
352
+ Example, _&role=Engineers_
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
+ return await self._get(
363
+ f"/iam/clients/{client_id}/tokens",
364
+ options=make_request_options(
365
+ extra_headers=extra_headers,
366
+ extra_query=extra_query,
367
+ extra_body=extra_body,
368
+ timeout=timeout,
369
+ query=await async_maybe_transform(
370
+ {
371
+ "deleted": deleted,
372
+ "issued_by": issued_by,
373
+ "not_issued_by": not_issued_by,
374
+ "role": role,
375
+ },
376
+ api_token_list_params.APITokenListParams,
377
+ ),
378
+ ),
379
+ cast_to=APITokenList,
380
+ )
381
+
382
+ async def delete(
383
+ self,
384
+ token_id: int,
385
+ *,
386
+ client_id: int,
387
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
388
+ # The extra values given here take precedence over values defined on the client or passed to this method.
389
+ extra_headers: Headers | None = None,
390
+ extra_query: Query | None = None,
391
+ extra_body: Body | None = None,
392
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
393
+ ) -> None:
394
+ """Delete API token from current account.
395
+
396
+ Ensure that the API token is not being
397
+ used by an active application. After deleting the token, all applications that
398
+ use this token will not be able to get access to your account via API. The
399
+ action cannot be reversed.
400
+
401
+ Args:
402
+ extra_headers: Send extra headers
403
+
404
+ extra_query: Add additional query parameters to the request
405
+
406
+ extra_body: Add additional JSON properties to the request
407
+
408
+ timeout: Override the client-level default timeout for this request, in seconds
409
+ """
410
+ extra_headers = {"Accept": "*/*", **(extra_headers or {})}
411
+ return await self._delete(
412
+ f"/iam/clients/{client_id}/tokens/{token_id}",
413
+ options=make_request_options(
414
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
415
+ ),
416
+ cast_to=NoneType,
417
+ )
418
+
419
+ async def get(
420
+ self,
421
+ token_id: int,
422
+ *,
423
+ client_id: int,
424
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
425
+ # The extra values given here take precedence over values defined on the client or passed to this method.
426
+ extra_headers: Headers | None = None,
427
+ extra_query: Query | None = None,
428
+ extra_body: Body | None = None,
429
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
430
+ ) -> APIToken:
431
+ """
432
+ Get API Token
433
+
434
+ Args:
435
+ extra_headers: Send extra headers
436
+
437
+ extra_query: Add additional query parameters to the request
438
+
439
+ extra_body: Add additional JSON properties to the request
440
+
441
+ timeout: Override the client-level default timeout for this request, in seconds
442
+ """
443
+ return await self._get(
444
+ f"/iam/clients/{client_id}/tokens/{token_id}",
445
+ options=make_request_options(
446
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
447
+ ),
448
+ cast_to=APIToken,
449
+ )
450
+
451
+
452
+ class APITokensResourceWithRawResponse:
453
+ def __init__(self, api_tokens: APITokensResource) -> None:
454
+ self._api_tokens = api_tokens
455
+
456
+ self.create = to_raw_response_wrapper(
457
+ api_tokens.create,
458
+ )
459
+ self.list = to_raw_response_wrapper(
460
+ api_tokens.list,
461
+ )
462
+ self.delete = to_raw_response_wrapper(
463
+ api_tokens.delete,
464
+ )
465
+ self.get = to_raw_response_wrapper(
466
+ api_tokens.get,
467
+ )
468
+
469
+
470
+ class AsyncAPITokensResourceWithRawResponse:
471
+ def __init__(self, api_tokens: AsyncAPITokensResource) -> None:
472
+ self._api_tokens = api_tokens
473
+
474
+ self.create = async_to_raw_response_wrapper(
475
+ api_tokens.create,
476
+ )
477
+ self.list = async_to_raw_response_wrapper(
478
+ api_tokens.list,
479
+ )
480
+ self.delete = async_to_raw_response_wrapper(
481
+ api_tokens.delete,
482
+ )
483
+ self.get = async_to_raw_response_wrapper(
484
+ api_tokens.get,
485
+ )
486
+
487
+
488
+ class APITokensResourceWithStreamingResponse:
489
+ def __init__(self, api_tokens: APITokensResource) -> None:
490
+ self._api_tokens = api_tokens
491
+
492
+ self.create = to_streamed_response_wrapper(
493
+ api_tokens.create,
494
+ )
495
+ self.list = to_streamed_response_wrapper(
496
+ api_tokens.list,
497
+ )
498
+ self.delete = to_streamed_response_wrapper(
499
+ api_tokens.delete,
500
+ )
501
+ self.get = to_streamed_response_wrapper(
502
+ api_tokens.get,
503
+ )
504
+
505
+
506
+ class AsyncAPITokensResourceWithStreamingResponse:
507
+ def __init__(self, api_tokens: AsyncAPITokensResource) -> None:
508
+ self._api_tokens = api_tokens
509
+
510
+ self.create = async_to_streamed_response_wrapper(
511
+ api_tokens.create,
512
+ )
513
+ self.list = async_to_streamed_response_wrapper(
514
+ api_tokens.list,
515
+ )
516
+ self.delete = async_to_streamed_response_wrapper(
517
+ api_tokens.delete,
518
+ )
519
+ self.get = async_to_streamed_response_wrapper(
520
+ api_tokens.get,
521
+ )