gcore 0.5.0__py3-none-any.whl → 0.7.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 (200) hide show
  1. gcore/_client.py +9 -0
  2. gcore/_models.py +24 -3
  3. gcore/_version.py +1 -1
  4. gcore/pagination.py +101 -1
  5. gcore/resources/__init__.py +14 -0
  6. gcore/resources/cloud/__init__.py +42 -0
  7. gcore/resources/cloud/audit_logs.py +480 -0
  8. gcore/resources/cloud/cloud.py +96 -0
  9. gcore/resources/cloud/cost_reports.py +811 -0
  10. gcore/resources/cloud/file_shares/file_shares.py +74 -9
  11. gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py +61 -26
  12. gcore/resources/cloud/inference/__init__.py +14 -0
  13. gcore/resources/cloud/inference/api_keys.py +621 -0
  14. gcore/resources/cloud/inference/inference.py +32 -0
  15. gcore/resources/cloud/inference/registry_credentials.py +4 -6
  16. gcore/resources/cloud/load_balancers/pools/members.py +22 -6
  17. gcore/resources/cloud/usage_reports.py +337 -0
  18. gcore/resources/streaming/__init__.py +159 -0
  19. gcore/resources/streaming/ai_tasks.py +1288 -0
  20. gcore/resources/streaming/broadcasts.py +579 -0
  21. gcore/resources/streaming/directories.py +515 -0
  22. gcore/resources/streaming/players.py +577 -0
  23. gcore/resources/streaming/playlists.py +1059 -0
  24. gcore/resources/streaming/quality_sets.py +331 -0
  25. gcore/resources/streaming/restreams.py +484 -0
  26. gcore/resources/streaming/statistics.py +3224 -0
  27. gcore/resources/streaming/streaming.py +390 -0
  28. gcore/resources/streaming/streams/__init__.py +33 -0
  29. gcore/resources/streaming/streams/overlays.py +716 -0
  30. gcore/resources/streaming/streams/streams.py +1592 -0
  31. gcore/resources/streaming/videos/__init__.py +33 -0
  32. gcore/resources/streaming/videos/subtitles.py +623 -0
  33. gcore/resources/streaming/videos/videos.py +1553 -0
  34. gcore/resources/waap/ip_info.py +28 -10
  35. gcore/types/cloud/__init__.py +12 -0
  36. gcore/types/cloud/audit_log_entry.py +254 -0
  37. gcore/types/cloud/audit_log_list_params.py +158 -0
  38. gcore/types/cloud/cost_report_aggregated.py +865 -0
  39. gcore/types/cloud/cost_report_aggregated_monthly.py +865 -0
  40. gcore/types/cloud/cost_report_detailed.py +1343 -0
  41. gcore/types/cloud/cost_report_get_aggregated_monthly_params.py +394 -0
  42. gcore/types/cloud/cost_report_get_aggregated_params.py +409 -0
  43. gcore/types/cloud/cost_report_get_detailed_params.py +435 -0
  44. gcore/types/cloud/file_share.py +37 -3
  45. gcore/types/cloud/file_share_create_params.py +16 -0
  46. gcore/types/cloud/file_share_update_params.py +29 -3
  47. gcore/types/cloud/gpu_baremetal_cluster.py +2 -2
  48. gcore/types/cloud/gpu_baremetal_cluster_create_params.py +9 -0
  49. gcore/types/cloud/inference/__init__.py +5 -0
  50. gcore/types/cloud/inference/api_key_create_params.py +21 -0
  51. gcore/types/cloud/inference/api_key_list_params.py +21 -0
  52. gcore/types/cloud/inference/api_key_update_params.py +16 -0
  53. gcore/types/cloud/inference/inference_api_key.py +24 -0
  54. gcore/types/cloud/inference/inference_api_key_create.py +27 -0
  55. gcore/types/cloud/load_balancer_create_params.py +14 -3
  56. gcore/types/cloud/load_balancers/pool_create_params.py +14 -3
  57. gcore/types/cloud/load_balancers/pool_update_params.py +14 -3
  58. gcore/types/cloud/load_balancers/pools/member_add_params.py +14 -3
  59. gcore/types/cloud/member.py +12 -4
  60. gcore/types/cloud/quota_get_all_response.py +24 -2
  61. gcore/types/cloud/quota_get_by_region_response.py +24 -2
  62. gcore/types/cloud/quotas/request_create_params.py +12 -1
  63. gcore/types/cloud/quotas/request_get_response.py +12 -1
  64. gcore/types/cloud/quotas/request_list_response.py +12 -1
  65. gcore/types/cloud/usage_report.py +1612 -0
  66. gcore/types/cloud/usage_report_get_params.py +432 -0
  67. gcore/types/streaming/__init__.py +143 -0
  68. gcore/types/streaming/ai_contentmoderation_casm.py +39 -0
  69. gcore/types/streaming/ai_contentmoderation_hardnudity.py +54 -0
  70. gcore/types/streaming/ai_contentmoderation_nsfw.py +39 -0
  71. gcore/types/streaming/ai_contentmoderation_softnudity.py +66 -0
  72. gcore/types/streaming/ai_contentmoderation_sport.py +39 -0
  73. gcore/types/streaming/ai_contentmoderation_weapon.py +39 -0
  74. gcore/types/streaming/ai_task.py +205 -0
  75. gcore/types/streaming/ai_task_cancel_response.py +12 -0
  76. gcore/types/streaming/ai_task_create_params.py +168 -0
  77. gcore/types/streaming/ai_task_create_response.py +10 -0
  78. gcore/types/streaming/ai_task_get_ai_settings_params.py +27 -0
  79. gcore/types/streaming/ai_task_get_ai_settings_response.py +12 -0
  80. gcore/types/streaming/ai_task_get_response.py +313 -0
  81. gcore/types/streaming/ai_task_list_params.py +50 -0
  82. gcore/types/streaming/broadcast.py +71 -0
  83. gcore/types/streaming/broadcast_create_params.py +76 -0
  84. gcore/types/streaming/broadcast_list_params.py +12 -0
  85. gcore/types/streaming/broadcast_spectators_count.py +12 -0
  86. gcore/types/streaming/broadcast_update_params.py +76 -0
  87. gcore/types/streaming/clip.py +78 -0
  88. gcore/types/streaming/create_video_param.py +214 -0
  89. gcore/types/streaming/direct_upload_parameters.py +33 -0
  90. gcore/types/streaming/directories_tree.py +19 -0
  91. gcore/types/streaming/directory_base.py +31 -0
  92. gcore/types/streaming/directory_create_params.py +15 -0
  93. gcore/types/streaming/directory_get_response.py +19 -0
  94. gcore/types/streaming/directory_item.py +13 -0
  95. gcore/types/streaming/directory_update_params.py +18 -0
  96. gcore/types/streaming/directory_video.py +13 -0
  97. gcore/types/streaming/ffprobes.py +25 -0
  98. gcore/types/streaming/max_stream_series.py +21 -0
  99. gcore/types/streaming/meet_series.py +23 -0
  100. gcore/types/streaming/player.py +114 -0
  101. gcore/types/streaming/player_create_params.py +18 -0
  102. gcore/types/streaming/player_list_params.py +12 -0
  103. gcore/types/streaming/player_param.py +114 -0
  104. gcore/types/streaming/player_update_params.py +18 -0
  105. gcore/types/streaming/playlist.py +102 -0
  106. gcore/types/streaming/playlist_create.py +12 -0
  107. gcore/types/streaming/playlist_create_params.py +102 -0
  108. gcore/types/streaming/playlist_list_params.py +12 -0
  109. gcore/types/streaming/playlist_list_videos_response.py +10 -0
  110. gcore/types/streaming/playlist_update_params.py +102 -0
  111. gcore/types/streaming/playlist_video.py +215 -0
  112. gcore/types/streaming/popular_videos.py +17 -0
  113. gcore/types/streaming/quality_set_set_default_params.py +23 -0
  114. gcore/types/streaming/quality_sets.py +57 -0
  115. gcore/types/streaming/restream.py +37 -0
  116. gcore/types/streaming/restream_create_params.py +41 -0
  117. gcore/types/streaming/restream_list_params.py +12 -0
  118. gcore/types/streaming/restream_update_params.py +41 -0
  119. gcore/types/streaming/statistic_get_ffprobes_params.py +22 -0
  120. gcore/types/streaming/statistic_get_live_unique_viewers_params.py +26 -0
  121. gcore/types/streaming/statistic_get_live_unique_viewers_response.py +25 -0
  122. gcore/types/streaming/statistic_get_live_watch_time_cdn_params.py +32 -0
  123. gcore/types/streaming/statistic_get_live_watch_time_total_cdn_params.py +30 -0
  124. gcore/types/streaming/statistic_get_max_streams_series_params.py +20 -0
  125. gcore/types/streaming/statistic_get_meet_series_params.py +20 -0
  126. gcore/types/streaming/statistic_get_popular_videos_params.py +15 -0
  127. gcore/types/streaming/statistic_get_storage_series_params.py +20 -0
  128. gcore/types/streaming/statistic_get_stream_series_params.py +20 -0
  129. gcore/types/streaming/statistic_get_unique_viewers_cdn_params.py +27 -0
  130. gcore/types/streaming/statistic_get_unique_viewers_params.py +34 -0
  131. gcore/types/streaming/statistic_get_views_by_browsers_params.py +15 -0
  132. gcore/types/streaming/statistic_get_views_by_country_params.py +15 -0
  133. gcore/types/streaming/statistic_get_views_by_hostname_params.py +15 -0
  134. gcore/types/streaming/statistic_get_views_by_operating_system_params.py +15 -0
  135. gcore/types/streaming/statistic_get_views_by_referer_params.py +15 -0
  136. gcore/types/streaming/statistic_get_views_by_region_params.py +15 -0
  137. gcore/types/streaming/statistic_get_views_heatmap_params.py +21 -0
  138. gcore/types/streaming/statistic_get_views_params.py +34 -0
  139. gcore/types/streaming/statistic_get_vod_storage_volume_params.py +17 -0
  140. gcore/types/streaming/statistic_get_vod_transcoding_duration_params.py +17 -0
  141. gcore/types/streaming/statistic_get_vod_unique_viewers_cdn_params.py +26 -0
  142. gcore/types/streaming/statistic_get_vod_watch_time_cdn_params.py +32 -0
  143. gcore/types/streaming/statistic_get_vod_watch_time_total_cdn_params.py +30 -0
  144. gcore/types/streaming/statistic_get_vod_watch_time_total_cdn_response.py +22 -0
  145. gcore/types/streaming/storage_series.py +23 -0
  146. gcore/types/streaming/stream.py +420 -0
  147. gcore/types/streaming/stream_create_clip_params.py +48 -0
  148. gcore/types/streaming/stream_create_params.py +165 -0
  149. gcore/types/streaming/stream_list_clips_response.py +10 -0
  150. gcore/types/streaming/stream_list_params.py +18 -0
  151. gcore/types/streaming/stream_series.py +21 -0
  152. gcore/types/streaming/stream_start_recording_response.py +76 -0
  153. gcore/types/streaming/stream_update_params.py +169 -0
  154. gcore/types/streaming/streams/__init__.py +11 -0
  155. gcore/types/streaming/streams/overlay.py +43 -0
  156. gcore/types/streaming/streams/overlay_create_params.py +36 -0
  157. gcore/types/streaming/streams/overlay_create_response.py +10 -0
  158. gcore/types/streaming/streams/overlay_list_response.py +10 -0
  159. gcore/types/streaming/streams/overlay_update_multiple_params.py +39 -0
  160. gcore/types/streaming/streams/overlay_update_multiple_response.py +10 -0
  161. gcore/types/streaming/streams/overlay_update_params.py +33 -0
  162. gcore/types/streaming/subtitle.py +12 -0
  163. gcore/types/streaming/subtitle_base.py +18 -0
  164. gcore/types/streaming/subtitle_base_param.py +18 -0
  165. gcore/types/streaming/unique_viewers.py +35 -0
  166. gcore/types/streaming/unique_viewers_cdn.py +17 -0
  167. gcore/types/streaming/video.py +444 -0
  168. gcore/types/streaming/video_create_multiple_params.py +28 -0
  169. gcore/types/streaming/video_create_multiple_response.py +10 -0
  170. gcore/types/streaming/video_create_params.py +13 -0
  171. gcore/types/streaming/video_create_response.py +10 -0
  172. gcore/types/streaming/video_list_names_params.py +13 -0
  173. gcore/types/streaming/video_list_params.py +59 -0
  174. gcore/types/streaming/video_update_params.py +214 -0
  175. gcore/types/streaming/videos/__init__.py +7 -0
  176. gcore/types/streaming/videos/subtitle_create_params.py +17 -0
  177. gcore/types/streaming/videos/subtitle_list_response.py +10 -0
  178. gcore/types/streaming/videos/subtitle_update_params.py +20 -0
  179. gcore/types/streaming/views.py +35 -0
  180. gcore/types/streaming/views_by_browser.py +17 -0
  181. gcore/types/streaming/views_by_country.py +19 -0
  182. gcore/types/streaming/views_by_hostname.py +17 -0
  183. gcore/types/streaming/views_by_operating_system.py +17 -0
  184. gcore/types/streaming/views_by_referer.py +17 -0
  185. gcore/types/streaming/views_by_region.py +19 -0
  186. gcore/types/streaming/views_heatmap.py +19 -0
  187. gcore/types/streaming/vod_statistics_series.py +21 -0
  188. gcore/types/streaming/vod_total_stream_duration_series.py +22 -0
  189. gcore/types/waap/domains/custom_rule_create_params.py +4 -4
  190. gcore/types/waap/domains/custom_rule_update_params.py +4 -4
  191. gcore/types/waap/ip_info_get_blocked_requests_params.py +5 -1
  192. gcore/types/waap/ip_info_get_counts_params.py +2 -1
  193. gcore/types/waap/ip_info_get_top_sessions_params.py +5 -1
  194. gcore/types/waap/ip_info_get_top_urls_params.py +5 -1
  195. gcore/types/waap/ip_info_get_top_user_agents_params.py +5 -1
  196. gcore/types/waap/waap_custom_rule.py +4 -4
  197. {gcore-0.5.0.dist-info → gcore-0.7.0.dist-info}/METADATA +2 -3
  198. {gcore-0.5.0.dist-info → gcore-0.7.0.dist-info}/RECORD +200 -43
  199. {gcore-0.5.0.dist-info → gcore-0.7.0.dist-info}/WHEEL +0 -0
  200. {gcore-0.5.0.dist-info → gcore-0.7.0.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,811 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import List, Union, Iterable
6
+ from datetime import datetime
7
+ from typing_extensions import Literal
8
+
9
+ import httpx
10
+
11
+ from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
12
+ from ..._utils import maybe_transform, async_maybe_transform
13
+ from ..._compat import cached_property
14
+ from ..._resource import SyncAPIResource, AsyncAPIResource
15
+ from ..._response import (
16
+ to_raw_response_wrapper,
17
+ to_streamed_response_wrapper,
18
+ async_to_raw_response_wrapper,
19
+ async_to_streamed_response_wrapper,
20
+ )
21
+ from ...types.cloud import (
22
+ cost_report_get_detailed_params,
23
+ cost_report_get_aggregated_params,
24
+ cost_report_get_aggregated_monthly_params,
25
+ )
26
+ from ..._base_client import make_request_options
27
+ from ...types.cloud.cost_report_detailed import CostReportDetailed
28
+ from ...types.cloud.cost_report_aggregated import CostReportAggregated
29
+ from ...types.cloud.cost_report_aggregated_monthly import CostReportAggregatedMonthly
30
+
31
+ __all__ = ["CostReportsResource", "AsyncCostReportsResource"]
32
+
33
+
34
+ class CostReportsResource(SyncAPIResource):
35
+ @cached_property
36
+ def with_raw_response(self) -> CostReportsResourceWithRawResponse:
37
+ """
38
+ This property can be used as a prefix for any HTTP method call to return
39
+ the raw response object instead of the parsed content.
40
+
41
+ For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers
42
+ """
43
+ return CostReportsResourceWithRawResponse(self)
44
+
45
+ @cached_property
46
+ def with_streaming_response(self) -> CostReportsResourceWithStreamingResponse:
47
+ """
48
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
49
+
50
+ For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response
51
+ """
52
+ return CostReportsResourceWithStreamingResponse(self)
53
+
54
+ def get_aggregated(
55
+ self,
56
+ *,
57
+ time_from: Union[str, datetime],
58
+ time_to: Union[str, datetime],
59
+ enable_last_day: bool | NotGiven = NOT_GIVEN,
60
+ projects: Iterable[int] | NotGiven = NOT_GIVEN,
61
+ regions: Iterable[int] | NotGiven = NOT_GIVEN,
62
+ response_format: Literal["csv_totals", "json"] | NotGiven = NOT_GIVEN,
63
+ schema_filter: cost_report_get_aggregated_params.SchemaFilter | NotGiven = NOT_GIVEN,
64
+ tags: cost_report_get_aggregated_params.Tags | NotGiven = NOT_GIVEN,
65
+ types: List[
66
+ Literal[
67
+ "ai_cluster",
68
+ "ai_virtual_cluster",
69
+ "backup",
70
+ "baremetal",
71
+ "basic_vm",
72
+ "containers",
73
+ "dbaas_postgresql_connection_pooler",
74
+ "dbaas_postgresql_cpu",
75
+ "dbaas_postgresql_memory",
76
+ "dbaas_postgresql_public_network",
77
+ "dbaas_postgresql_volume",
78
+ "egress_traffic",
79
+ "external_ip",
80
+ "file_share",
81
+ "floatingip",
82
+ "functions",
83
+ "functions_calls",
84
+ "functions_traffic",
85
+ "image",
86
+ "inference",
87
+ "instance",
88
+ "load_balancer",
89
+ "log_index",
90
+ "snapshot",
91
+ "volume",
92
+ ]
93
+ ]
94
+ | NotGiven = NOT_GIVEN,
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
+ ) -> CostReportAggregated:
102
+ """Get cost report totals (aggregated costs) for a given period.
103
+
104
+ Requested period
105
+ should not exceed 31 days. Note: This report assumes there are no active commit
106
+ features in the billing plan. If there are active commit features (pre-paid
107
+ resources) in your plan, use /v1/`reservation_cost_report`/totals, as the
108
+ results from this report will not be accurate. Receiving data from the past hour
109
+ might lead to incomplete statistics. For the most accurate data, we recommend
110
+ accessing the statistics after at least one hour. Typically, updates are
111
+ available within a 24-hour period, although the frequency can vary. Maintenance
112
+ periods or other exceptions may cause delays, potentially extending beyond 24
113
+ hours until the servers are back online and the missing data is filled in.
114
+
115
+ Args:
116
+ time_from: The start date of the report period (ISO 8601). The report starts from the
117
+ beginning of this day.
118
+
119
+ time_to: The end date of the report period (ISO 8601). The report ends just before the
120
+ beginning of this day.
121
+
122
+ enable_last_day: Expenses for the last specified day are taken into account. As the default,
123
+ False.
124
+
125
+ projects: List of project IDs
126
+
127
+ regions: List of region IDs.
128
+
129
+ response_format: Format of the response (csv or json).
130
+
131
+ schema_filter: Extended filter for field filtering.
132
+
133
+ tags: Filter by tags
134
+
135
+ types: List of resource types to be filtered in the report.
136
+
137
+ extra_headers: Send extra headers
138
+
139
+ extra_query: Add additional query parameters to the request
140
+
141
+ extra_body: Add additional JSON properties to the request
142
+
143
+ timeout: Override the client-level default timeout for this request, in seconds
144
+ """
145
+ return self._post(
146
+ "/cloud/v1/cost_report/totals",
147
+ body=maybe_transform(
148
+ {
149
+ "time_from": time_from,
150
+ "time_to": time_to,
151
+ "enable_last_day": enable_last_day,
152
+ "projects": projects,
153
+ "regions": regions,
154
+ "response_format": response_format,
155
+ "schema_filter": schema_filter,
156
+ "tags": tags,
157
+ "types": types,
158
+ },
159
+ cost_report_get_aggregated_params.CostReportGetAggregatedParams,
160
+ ),
161
+ options=make_request_options(
162
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
163
+ ),
164
+ cast_to=CostReportAggregated,
165
+ )
166
+
167
+ def get_aggregated_monthly(
168
+ self,
169
+ *,
170
+ time_from: Union[str, datetime],
171
+ time_to: Union[str, datetime],
172
+ regions: Iterable[int] | NotGiven = NOT_GIVEN,
173
+ response_format: Literal["csv_totals", "json"] | NotGiven = NOT_GIVEN,
174
+ schema_filter: cost_report_get_aggregated_monthly_params.SchemaFilter | NotGiven = NOT_GIVEN,
175
+ tags: cost_report_get_aggregated_monthly_params.Tags | NotGiven = NOT_GIVEN,
176
+ types: List[
177
+ Literal[
178
+ "ai_cluster",
179
+ "ai_virtual_cluster",
180
+ "backup",
181
+ "baremetal",
182
+ "basic_vm",
183
+ "containers",
184
+ "dbaas_postgresql_connection_pooler",
185
+ "dbaas_postgresql_cpu",
186
+ "dbaas_postgresql_memory",
187
+ "dbaas_postgresql_public_network",
188
+ "dbaas_postgresql_volume",
189
+ "egress_traffic",
190
+ "external_ip",
191
+ "file_share",
192
+ "floatingip",
193
+ "functions",
194
+ "functions_calls",
195
+ "functions_traffic",
196
+ "image",
197
+ "inference",
198
+ "instance",
199
+ "load_balancer",
200
+ "log_index",
201
+ "snapshot",
202
+ "volume",
203
+ ]
204
+ ]
205
+ | NotGiven = NOT_GIVEN,
206
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
207
+ # The extra values given here take precedence over values defined on the client or passed to this method.
208
+ extra_headers: Headers | None = None,
209
+ extra_query: Query | None = None,
210
+ extra_body: Body | None = None,
211
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
212
+ ) -> CostReportAggregatedMonthly:
213
+ """
214
+ Retrieve a detailed cost report totals for a specified month, which includes
215
+ both commit and pay-as-you-go (overcommit) prices. Additionally, it provides the
216
+ spent billing units (e.g., hours or GB) for resources. The "`time_to`" parameter
217
+ represents all days in the specified month. Receiving data from the past hour
218
+ might lead to incomplete statistics. For the most accurate data, we recommend
219
+ accessing the statistics after at least one hour. Typically, updates are
220
+ available within a 24-hour period, although the frequency can vary. Maintenance
221
+ periods or other exceptions may cause delays, potentially extending beyond 24
222
+ hours until the servers are back online and the missing data is filled in.
223
+
224
+ Args:
225
+ time_from: Beginning of the period: YYYY-mm
226
+
227
+ time_to: End of the period: YYYY-mm
228
+
229
+ regions: List of region IDs.
230
+
231
+ response_format: Format of the response (`csv_totals` or json).
232
+
233
+ schema_filter: Extended filter for field filtering.
234
+
235
+ tags: Filter by tags
236
+
237
+ types: List of resource types to be filtered in the report.
238
+
239
+ extra_headers: Send extra headers
240
+
241
+ extra_query: Add additional query parameters to the request
242
+
243
+ extra_body: Add additional JSON properties to the request
244
+
245
+ timeout: Override the client-level default timeout for this request, in seconds
246
+ """
247
+ return self._post(
248
+ "/cloud/v1/reservation_cost_report/totals",
249
+ body=maybe_transform(
250
+ {
251
+ "time_from": time_from,
252
+ "time_to": time_to,
253
+ "regions": regions,
254
+ "response_format": response_format,
255
+ "schema_filter": schema_filter,
256
+ "tags": tags,
257
+ "types": types,
258
+ },
259
+ cost_report_get_aggregated_monthly_params.CostReportGetAggregatedMonthlyParams,
260
+ ),
261
+ options=make_request_options(
262
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
263
+ ),
264
+ cast_to=CostReportAggregatedMonthly,
265
+ )
266
+
267
+ def get_detailed(
268
+ self,
269
+ *,
270
+ time_from: Union[str, datetime],
271
+ time_to: Union[str, datetime],
272
+ enable_last_day: bool | NotGiven = NOT_GIVEN,
273
+ limit: int | NotGiven = NOT_GIVEN,
274
+ offset: int | NotGiven = NOT_GIVEN,
275
+ projects: Iterable[int] | NotGiven = NOT_GIVEN,
276
+ regions: Iterable[int] | NotGiven = NOT_GIVEN,
277
+ response_format: Literal["csv_records", "json"] | NotGiven = NOT_GIVEN,
278
+ schema_filter: cost_report_get_detailed_params.SchemaFilter | NotGiven = NOT_GIVEN,
279
+ sorting: Iterable[cost_report_get_detailed_params.Sorting] | NotGiven = NOT_GIVEN,
280
+ tags: cost_report_get_detailed_params.Tags | NotGiven = NOT_GIVEN,
281
+ types: List[
282
+ Literal[
283
+ "ai_cluster",
284
+ "ai_virtual_cluster",
285
+ "backup",
286
+ "baremetal",
287
+ "basic_vm",
288
+ "containers",
289
+ "dbaas_postgresql_connection_pooler",
290
+ "dbaas_postgresql_cpu",
291
+ "dbaas_postgresql_memory",
292
+ "dbaas_postgresql_public_network",
293
+ "dbaas_postgresql_volume",
294
+ "egress_traffic",
295
+ "external_ip",
296
+ "file_share",
297
+ "floatingip",
298
+ "functions",
299
+ "functions_calls",
300
+ "functions_traffic",
301
+ "image",
302
+ "inference",
303
+ "instance",
304
+ "load_balancer",
305
+ "log_index",
306
+ "snapshot",
307
+ "volume",
308
+ ]
309
+ ]
310
+ | NotGiven = NOT_GIVEN,
311
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
312
+ # The extra values given here take precedence over values defined on the client or passed to this method.
313
+ extra_headers: Headers | None = None,
314
+ extra_query: Query | None = None,
315
+ extra_body: Body | None = None,
316
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
317
+ ) -> CostReportDetailed:
318
+ """Get a detailed cost report for a given period and specific resources.
319
+
320
+ Requested
321
+ period should not exceed 31 days. Note: This report assumes there are no active
322
+ commit features in the billing plan. If there are active commit features
323
+ (pre-paid resources) in your plan, use /v1/`reservation_cost_report`/totals, as
324
+ the results from this report will not be accurate. Receiving data from the past
325
+ hour might lead to incomplete statistics. For the most accurate data, we
326
+ recommend accessing the statistics after at least one hour. Typically, updates
327
+ are available within a 24-hour period, although the frequency can vary.
328
+ Maintenance periods or other exceptions may cause delays, potentially extending
329
+ beyond 24 hours until the servers are back online and the missing data is filled
330
+ in.
331
+
332
+ Args:
333
+ time_from: The start date of the report period (ISO 8601). The report starts from the
334
+ beginning of this day.
335
+
336
+ time_to: The end date of the report period (ISO 8601). The report ends just before the
337
+ beginning of this day.
338
+
339
+ enable_last_day: Expenses for the last specified day are taken into account. As the default,
340
+ False.
341
+
342
+ limit: The response resources limit. Defaults to 10.
343
+
344
+ offset: The response resources offset.
345
+
346
+ projects: List of project IDs
347
+
348
+ regions: List of region IDs.
349
+
350
+ response_format: Format of the response (csv or json).
351
+
352
+ schema_filter: Extended filter for field filtering.
353
+
354
+ sorting: List of sorting filters (JSON objects) fields: project. directions: asc, desc.
355
+
356
+ tags: Filter by tags
357
+
358
+ types: List of resource types to be filtered in the report.
359
+
360
+ extra_headers: Send extra headers
361
+
362
+ extra_query: Add additional query parameters to the request
363
+
364
+ extra_body: Add additional JSON properties to the request
365
+
366
+ timeout: Override the client-level default timeout for this request, in seconds
367
+ """
368
+ return self._post(
369
+ "/cloud/v1/cost_report/resources",
370
+ body=maybe_transform(
371
+ {
372
+ "time_from": time_from,
373
+ "time_to": time_to,
374
+ "enable_last_day": enable_last_day,
375
+ "limit": limit,
376
+ "offset": offset,
377
+ "projects": projects,
378
+ "regions": regions,
379
+ "response_format": response_format,
380
+ "schema_filter": schema_filter,
381
+ "sorting": sorting,
382
+ "tags": tags,
383
+ "types": types,
384
+ },
385
+ cost_report_get_detailed_params.CostReportGetDetailedParams,
386
+ ),
387
+ options=make_request_options(
388
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
389
+ ),
390
+ cast_to=CostReportDetailed,
391
+ )
392
+
393
+
394
+ class AsyncCostReportsResource(AsyncAPIResource):
395
+ @cached_property
396
+ def with_raw_response(self) -> AsyncCostReportsResourceWithRawResponse:
397
+ """
398
+ This property can be used as a prefix for any HTTP method call to return
399
+ the raw response object instead of the parsed content.
400
+
401
+ For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers
402
+ """
403
+ return AsyncCostReportsResourceWithRawResponse(self)
404
+
405
+ @cached_property
406
+ def with_streaming_response(self) -> AsyncCostReportsResourceWithStreamingResponse:
407
+ """
408
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
409
+
410
+ For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response
411
+ """
412
+ return AsyncCostReportsResourceWithStreamingResponse(self)
413
+
414
+ async def get_aggregated(
415
+ self,
416
+ *,
417
+ time_from: Union[str, datetime],
418
+ time_to: Union[str, datetime],
419
+ enable_last_day: bool | NotGiven = NOT_GIVEN,
420
+ projects: Iterable[int] | NotGiven = NOT_GIVEN,
421
+ regions: Iterable[int] | NotGiven = NOT_GIVEN,
422
+ response_format: Literal["csv_totals", "json"] | NotGiven = NOT_GIVEN,
423
+ schema_filter: cost_report_get_aggregated_params.SchemaFilter | NotGiven = NOT_GIVEN,
424
+ tags: cost_report_get_aggregated_params.Tags | NotGiven = NOT_GIVEN,
425
+ types: List[
426
+ Literal[
427
+ "ai_cluster",
428
+ "ai_virtual_cluster",
429
+ "backup",
430
+ "baremetal",
431
+ "basic_vm",
432
+ "containers",
433
+ "dbaas_postgresql_connection_pooler",
434
+ "dbaas_postgresql_cpu",
435
+ "dbaas_postgresql_memory",
436
+ "dbaas_postgresql_public_network",
437
+ "dbaas_postgresql_volume",
438
+ "egress_traffic",
439
+ "external_ip",
440
+ "file_share",
441
+ "floatingip",
442
+ "functions",
443
+ "functions_calls",
444
+ "functions_traffic",
445
+ "image",
446
+ "inference",
447
+ "instance",
448
+ "load_balancer",
449
+ "log_index",
450
+ "snapshot",
451
+ "volume",
452
+ ]
453
+ ]
454
+ | NotGiven = NOT_GIVEN,
455
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
456
+ # The extra values given here take precedence over values defined on the client or passed to this method.
457
+ extra_headers: Headers | None = None,
458
+ extra_query: Query | None = None,
459
+ extra_body: Body | None = None,
460
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
461
+ ) -> CostReportAggregated:
462
+ """Get cost report totals (aggregated costs) for a given period.
463
+
464
+ Requested period
465
+ should not exceed 31 days. Note: This report assumes there are no active commit
466
+ features in the billing plan. If there are active commit features (pre-paid
467
+ resources) in your plan, use /v1/`reservation_cost_report`/totals, as the
468
+ results from this report will not be accurate. Receiving data from the past hour
469
+ might lead to incomplete statistics. For the most accurate data, we recommend
470
+ accessing the statistics after at least one hour. Typically, updates are
471
+ available within a 24-hour period, although the frequency can vary. Maintenance
472
+ periods or other exceptions may cause delays, potentially extending beyond 24
473
+ hours until the servers are back online and the missing data is filled in.
474
+
475
+ Args:
476
+ time_from: The start date of the report period (ISO 8601). The report starts from the
477
+ beginning of this day.
478
+
479
+ time_to: The end date of the report period (ISO 8601). The report ends just before the
480
+ beginning of this day.
481
+
482
+ enable_last_day: Expenses for the last specified day are taken into account. As the default,
483
+ False.
484
+
485
+ projects: List of project IDs
486
+
487
+ regions: List of region IDs.
488
+
489
+ response_format: Format of the response (csv or json).
490
+
491
+ schema_filter: Extended filter for field filtering.
492
+
493
+ tags: Filter by tags
494
+
495
+ types: List of resource types to be filtered in the report.
496
+
497
+ extra_headers: Send extra headers
498
+
499
+ extra_query: Add additional query parameters to the request
500
+
501
+ extra_body: Add additional JSON properties to the request
502
+
503
+ timeout: Override the client-level default timeout for this request, in seconds
504
+ """
505
+ return await self._post(
506
+ "/cloud/v1/cost_report/totals",
507
+ body=await async_maybe_transform(
508
+ {
509
+ "time_from": time_from,
510
+ "time_to": time_to,
511
+ "enable_last_day": enable_last_day,
512
+ "projects": projects,
513
+ "regions": regions,
514
+ "response_format": response_format,
515
+ "schema_filter": schema_filter,
516
+ "tags": tags,
517
+ "types": types,
518
+ },
519
+ cost_report_get_aggregated_params.CostReportGetAggregatedParams,
520
+ ),
521
+ options=make_request_options(
522
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
523
+ ),
524
+ cast_to=CostReportAggregated,
525
+ )
526
+
527
+ async def get_aggregated_monthly(
528
+ self,
529
+ *,
530
+ time_from: Union[str, datetime],
531
+ time_to: Union[str, datetime],
532
+ regions: Iterable[int] | NotGiven = NOT_GIVEN,
533
+ response_format: Literal["csv_totals", "json"] | NotGiven = NOT_GIVEN,
534
+ schema_filter: cost_report_get_aggregated_monthly_params.SchemaFilter | NotGiven = NOT_GIVEN,
535
+ tags: cost_report_get_aggregated_monthly_params.Tags | NotGiven = NOT_GIVEN,
536
+ types: List[
537
+ Literal[
538
+ "ai_cluster",
539
+ "ai_virtual_cluster",
540
+ "backup",
541
+ "baremetal",
542
+ "basic_vm",
543
+ "containers",
544
+ "dbaas_postgresql_connection_pooler",
545
+ "dbaas_postgresql_cpu",
546
+ "dbaas_postgresql_memory",
547
+ "dbaas_postgresql_public_network",
548
+ "dbaas_postgresql_volume",
549
+ "egress_traffic",
550
+ "external_ip",
551
+ "file_share",
552
+ "floatingip",
553
+ "functions",
554
+ "functions_calls",
555
+ "functions_traffic",
556
+ "image",
557
+ "inference",
558
+ "instance",
559
+ "load_balancer",
560
+ "log_index",
561
+ "snapshot",
562
+ "volume",
563
+ ]
564
+ ]
565
+ | NotGiven = NOT_GIVEN,
566
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
567
+ # The extra values given here take precedence over values defined on the client or passed to this method.
568
+ extra_headers: Headers | None = None,
569
+ extra_query: Query | None = None,
570
+ extra_body: Body | None = None,
571
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
572
+ ) -> CostReportAggregatedMonthly:
573
+ """
574
+ Retrieve a detailed cost report totals for a specified month, which includes
575
+ both commit and pay-as-you-go (overcommit) prices. Additionally, it provides the
576
+ spent billing units (e.g., hours or GB) for resources. The "`time_to`" parameter
577
+ represents all days in the specified month. Receiving data from the past hour
578
+ might lead to incomplete statistics. For the most accurate data, we recommend
579
+ accessing the statistics after at least one hour. Typically, updates are
580
+ available within a 24-hour period, although the frequency can vary. Maintenance
581
+ periods or other exceptions may cause delays, potentially extending beyond 24
582
+ hours until the servers are back online and the missing data is filled in.
583
+
584
+ Args:
585
+ time_from: Beginning of the period: YYYY-mm
586
+
587
+ time_to: End of the period: YYYY-mm
588
+
589
+ regions: List of region IDs.
590
+
591
+ response_format: Format of the response (`csv_totals` or json).
592
+
593
+ schema_filter: Extended filter for field filtering.
594
+
595
+ tags: Filter by tags
596
+
597
+ types: List of resource types to be filtered in the report.
598
+
599
+ extra_headers: Send extra headers
600
+
601
+ extra_query: Add additional query parameters to the request
602
+
603
+ extra_body: Add additional JSON properties to the request
604
+
605
+ timeout: Override the client-level default timeout for this request, in seconds
606
+ """
607
+ return await self._post(
608
+ "/cloud/v1/reservation_cost_report/totals",
609
+ body=await async_maybe_transform(
610
+ {
611
+ "time_from": time_from,
612
+ "time_to": time_to,
613
+ "regions": regions,
614
+ "response_format": response_format,
615
+ "schema_filter": schema_filter,
616
+ "tags": tags,
617
+ "types": types,
618
+ },
619
+ cost_report_get_aggregated_monthly_params.CostReportGetAggregatedMonthlyParams,
620
+ ),
621
+ options=make_request_options(
622
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
623
+ ),
624
+ cast_to=CostReportAggregatedMonthly,
625
+ )
626
+
627
+ async def get_detailed(
628
+ self,
629
+ *,
630
+ time_from: Union[str, datetime],
631
+ time_to: Union[str, datetime],
632
+ enable_last_day: bool | NotGiven = NOT_GIVEN,
633
+ limit: int | NotGiven = NOT_GIVEN,
634
+ offset: int | NotGiven = NOT_GIVEN,
635
+ projects: Iterable[int] | NotGiven = NOT_GIVEN,
636
+ regions: Iterable[int] | NotGiven = NOT_GIVEN,
637
+ response_format: Literal["csv_records", "json"] | NotGiven = NOT_GIVEN,
638
+ schema_filter: cost_report_get_detailed_params.SchemaFilter | NotGiven = NOT_GIVEN,
639
+ sorting: Iterable[cost_report_get_detailed_params.Sorting] | NotGiven = NOT_GIVEN,
640
+ tags: cost_report_get_detailed_params.Tags | NotGiven = NOT_GIVEN,
641
+ types: List[
642
+ Literal[
643
+ "ai_cluster",
644
+ "ai_virtual_cluster",
645
+ "backup",
646
+ "baremetal",
647
+ "basic_vm",
648
+ "containers",
649
+ "dbaas_postgresql_connection_pooler",
650
+ "dbaas_postgresql_cpu",
651
+ "dbaas_postgresql_memory",
652
+ "dbaas_postgresql_public_network",
653
+ "dbaas_postgresql_volume",
654
+ "egress_traffic",
655
+ "external_ip",
656
+ "file_share",
657
+ "floatingip",
658
+ "functions",
659
+ "functions_calls",
660
+ "functions_traffic",
661
+ "image",
662
+ "inference",
663
+ "instance",
664
+ "load_balancer",
665
+ "log_index",
666
+ "snapshot",
667
+ "volume",
668
+ ]
669
+ ]
670
+ | NotGiven = NOT_GIVEN,
671
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
672
+ # The extra values given here take precedence over values defined on the client or passed to this method.
673
+ extra_headers: Headers | None = None,
674
+ extra_query: Query | None = None,
675
+ extra_body: Body | None = None,
676
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
677
+ ) -> CostReportDetailed:
678
+ """Get a detailed cost report for a given period and specific resources.
679
+
680
+ Requested
681
+ period should not exceed 31 days. Note: This report assumes there are no active
682
+ commit features in the billing plan. If there are active commit features
683
+ (pre-paid resources) in your plan, use /v1/`reservation_cost_report`/totals, as
684
+ the results from this report will not be accurate. Receiving data from the past
685
+ hour might lead to incomplete statistics. For the most accurate data, we
686
+ recommend accessing the statistics after at least one hour. Typically, updates
687
+ are available within a 24-hour period, although the frequency can vary.
688
+ Maintenance periods or other exceptions may cause delays, potentially extending
689
+ beyond 24 hours until the servers are back online and the missing data is filled
690
+ in.
691
+
692
+ Args:
693
+ time_from: The start date of the report period (ISO 8601). The report starts from the
694
+ beginning of this day.
695
+
696
+ time_to: The end date of the report period (ISO 8601). The report ends just before the
697
+ beginning of this day.
698
+
699
+ enable_last_day: Expenses for the last specified day are taken into account. As the default,
700
+ False.
701
+
702
+ limit: The response resources limit. Defaults to 10.
703
+
704
+ offset: The response resources offset.
705
+
706
+ projects: List of project IDs
707
+
708
+ regions: List of region IDs.
709
+
710
+ response_format: Format of the response (csv or json).
711
+
712
+ schema_filter: Extended filter for field filtering.
713
+
714
+ sorting: List of sorting filters (JSON objects) fields: project. directions: asc, desc.
715
+
716
+ tags: Filter by tags
717
+
718
+ types: List of resource types to be filtered in the report.
719
+
720
+ extra_headers: Send extra headers
721
+
722
+ extra_query: Add additional query parameters to the request
723
+
724
+ extra_body: Add additional JSON properties to the request
725
+
726
+ timeout: Override the client-level default timeout for this request, in seconds
727
+ """
728
+ return await self._post(
729
+ "/cloud/v1/cost_report/resources",
730
+ body=await async_maybe_transform(
731
+ {
732
+ "time_from": time_from,
733
+ "time_to": time_to,
734
+ "enable_last_day": enable_last_day,
735
+ "limit": limit,
736
+ "offset": offset,
737
+ "projects": projects,
738
+ "regions": regions,
739
+ "response_format": response_format,
740
+ "schema_filter": schema_filter,
741
+ "sorting": sorting,
742
+ "tags": tags,
743
+ "types": types,
744
+ },
745
+ cost_report_get_detailed_params.CostReportGetDetailedParams,
746
+ ),
747
+ options=make_request_options(
748
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
749
+ ),
750
+ cast_to=CostReportDetailed,
751
+ )
752
+
753
+
754
+ class CostReportsResourceWithRawResponse:
755
+ def __init__(self, cost_reports: CostReportsResource) -> None:
756
+ self._cost_reports = cost_reports
757
+
758
+ self.get_aggregated = to_raw_response_wrapper(
759
+ cost_reports.get_aggregated,
760
+ )
761
+ self.get_aggregated_monthly = to_raw_response_wrapper(
762
+ cost_reports.get_aggregated_monthly,
763
+ )
764
+ self.get_detailed = to_raw_response_wrapper(
765
+ cost_reports.get_detailed,
766
+ )
767
+
768
+
769
+ class AsyncCostReportsResourceWithRawResponse:
770
+ def __init__(self, cost_reports: AsyncCostReportsResource) -> None:
771
+ self._cost_reports = cost_reports
772
+
773
+ self.get_aggregated = async_to_raw_response_wrapper(
774
+ cost_reports.get_aggregated,
775
+ )
776
+ self.get_aggregated_monthly = async_to_raw_response_wrapper(
777
+ cost_reports.get_aggregated_monthly,
778
+ )
779
+ self.get_detailed = async_to_raw_response_wrapper(
780
+ cost_reports.get_detailed,
781
+ )
782
+
783
+
784
+ class CostReportsResourceWithStreamingResponse:
785
+ def __init__(self, cost_reports: CostReportsResource) -> None:
786
+ self._cost_reports = cost_reports
787
+
788
+ self.get_aggregated = to_streamed_response_wrapper(
789
+ cost_reports.get_aggregated,
790
+ )
791
+ self.get_aggregated_monthly = to_streamed_response_wrapper(
792
+ cost_reports.get_aggregated_monthly,
793
+ )
794
+ self.get_detailed = to_streamed_response_wrapper(
795
+ cost_reports.get_detailed,
796
+ )
797
+
798
+
799
+ class AsyncCostReportsResourceWithStreamingResponse:
800
+ def __init__(self, cost_reports: AsyncCostReportsResource) -> None:
801
+ self._cost_reports = cost_reports
802
+
803
+ self.get_aggregated = async_to_streamed_response_wrapper(
804
+ cost_reports.get_aggregated,
805
+ )
806
+ self.get_aggregated_monthly = async_to_streamed_response_wrapper(
807
+ cost_reports.get_aggregated_monthly,
808
+ )
809
+ self.get_detailed = async_to_streamed_response_wrapper(
810
+ cost_reports.get_detailed,
811
+ )