daytona_analytics_api_client 0.197.0

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.
@@ -0,0 +1,339 @@
1
+ =begin
2
+ #Daytona Analytics API
3
+
4
+ #Daytona Analytics API - Read-only telemetry and usage data. Authenticated via Daytona API keys or JWT tokens.
5
+
6
+ The version of the OpenAPI document: v0.4.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.21.0
10
+
11
+ =end
12
+
13
+ require 'cgi'
14
+
15
+ module DaytonaAnalyticsApiClient
16
+ class UsageApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Get sandbox usage periods
23
+ # Returns individual usage records for a specific sandbox within a time range
24
+ # @param organization_id [String] Organization ID
25
+ # @param sandbox_id [String] Sandbox ID
26
+ # @param from [String] Start time (RFC3339)
27
+ # @param to [String] End time (RFC3339)
28
+ # @param [Hash] opts the optional parameters
29
+ # @return [Array<ModelsUsagePeriod>]
30
+ def organization_organization_id_sandbox_sandbox_id_usage_get(organization_id, sandbox_id, from, to, opts = {})
31
+ data, _status_code, _headers = organization_organization_id_sandbox_sandbox_id_usage_get_with_http_info(organization_id, sandbox_id, from, to, opts)
32
+ data
33
+ end
34
+
35
+ # Get sandbox usage periods
36
+ # Returns individual usage records for a specific sandbox within a time range
37
+ # @param organization_id [String] Organization ID
38
+ # @param sandbox_id [String] Sandbox ID
39
+ # @param from [String] Start time (RFC3339)
40
+ # @param to [String] End time (RFC3339)
41
+ # @param [Hash] opts the optional parameters
42
+ # @return [Array<(Array<ModelsUsagePeriod>, Integer, Hash)>] Array<ModelsUsagePeriod> data, response status code and response headers
43
+ def organization_organization_id_sandbox_sandbox_id_usage_get_with_http_info(organization_id, sandbox_id, from, to, opts = {})
44
+ if @api_client.config.debugging
45
+ @api_client.config.logger.debug 'Calling API: UsageApi.organization_organization_id_sandbox_sandbox_id_usage_get ...'
46
+ end
47
+ # verify the required parameter 'organization_id' is set
48
+ if @api_client.config.client_side_validation && organization_id.nil?
49
+ fail ArgumentError, "Missing the required parameter 'organization_id' when calling UsageApi.organization_organization_id_sandbox_sandbox_id_usage_get"
50
+ end
51
+ # verify the required parameter 'sandbox_id' is set
52
+ if @api_client.config.client_side_validation && sandbox_id.nil?
53
+ fail ArgumentError, "Missing the required parameter 'sandbox_id' when calling UsageApi.organization_organization_id_sandbox_sandbox_id_usage_get"
54
+ end
55
+ # verify the required parameter 'from' is set
56
+ if @api_client.config.client_side_validation && from.nil?
57
+ fail ArgumentError, "Missing the required parameter 'from' when calling UsageApi.organization_organization_id_sandbox_sandbox_id_usage_get"
58
+ end
59
+ # verify the required parameter 'to' is set
60
+ if @api_client.config.client_side_validation && to.nil?
61
+ fail ArgumentError, "Missing the required parameter 'to' when calling UsageApi.organization_organization_id_sandbox_sandbox_id_usage_get"
62
+ end
63
+ # resource path
64
+ local_var_path = '/organization/{organizationId}/sandbox/{sandboxId}/usage'.sub('{' + 'organizationId' + '}', CGI.escape(organization_id.to_s)).sub('{' + 'sandboxId' + '}', CGI.escape(sandbox_id.to_s))
65
+
66
+ # query parameters
67
+ query_params = opts[:query_params] || {}
68
+ query_params[:'from'] = from
69
+ query_params[:'to'] = to
70
+
71
+ # header parameters
72
+ header_params = opts[:header_params] || {}
73
+ # HTTP header 'Accept' (if needed)
74
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
75
+
76
+ # form parameters
77
+ form_params = opts[:form_params] || {}
78
+
79
+ # http body (model)
80
+ post_body = opts[:debug_body]
81
+
82
+ # return_type
83
+ return_type = opts[:debug_return_type] || 'Array<ModelsUsagePeriod>'
84
+
85
+ # auth_names
86
+ auth_names = opts[:debug_auth_names] || ['Bearer']
87
+
88
+ new_options = opts.merge(
89
+ :operation => :"UsageApi.organization_organization_id_sandbox_sandbox_id_usage_get",
90
+ :header_params => header_params,
91
+ :query_params => query_params,
92
+ :form_params => form_params,
93
+ :body => post_body,
94
+ :auth_names => auth_names,
95
+ :return_type => return_type
96
+ )
97
+
98
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
99
+ if @api_client.config.debugging
100
+ @api_client.config.logger.debug "API called: UsageApi#organization_organization_id_sandbox_sandbox_id_usage_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
101
+ end
102
+ return data, status_code, headers
103
+ end
104
+
105
+ # Get aggregated usage
106
+ # Returns organization-level resource usage totals for a given time period
107
+ # @param organization_id [String] Organization ID
108
+ # @param from [String] Start time (RFC3339)
109
+ # @param to [String] End time (RFC3339)
110
+ # @param [Hash] opts the optional parameters
111
+ # @return [ModelsAggregatedUsage]
112
+ def organization_organization_id_usage_aggregated_get(organization_id, from, to, opts = {})
113
+ data, _status_code, _headers = organization_organization_id_usage_aggregated_get_with_http_info(organization_id, from, to, opts)
114
+ data
115
+ end
116
+
117
+ # Get aggregated usage
118
+ # Returns organization-level resource usage totals for a given time period
119
+ # @param organization_id [String] Organization ID
120
+ # @param from [String] Start time (RFC3339)
121
+ # @param to [String] End time (RFC3339)
122
+ # @param [Hash] opts the optional parameters
123
+ # @return [Array<(ModelsAggregatedUsage, Integer, Hash)>] ModelsAggregatedUsage data, response status code and response headers
124
+ def organization_organization_id_usage_aggregated_get_with_http_info(organization_id, from, to, opts = {})
125
+ if @api_client.config.debugging
126
+ @api_client.config.logger.debug 'Calling API: UsageApi.organization_organization_id_usage_aggregated_get ...'
127
+ end
128
+ # verify the required parameter 'organization_id' is set
129
+ if @api_client.config.client_side_validation && organization_id.nil?
130
+ fail ArgumentError, "Missing the required parameter 'organization_id' when calling UsageApi.organization_organization_id_usage_aggregated_get"
131
+ end
132
+ # verify the required parameter 'from' is set
133
+ if @api_client.config.client_side_validation && from.nil?
134
+ fail ArgumentError, "Missing the required parameter 'from' when calling UsageApi.organization_organization_id_usage_aggregated_get"
135
+ end
136
+ # verify the required parameter 'to' is set
137
+ if @api_client.config.client_side_validation && to.nil?
138
+ fail ArgumentError, "Missing the required parameter 'to' when calling UsageApi.organization_organization_id_usage_aggregated_get"
139
+ end
140
+ # resource path
141
+ local_var_path = '/organization/{organizationId}/usage/aggregated'.sub('{' + 'organizationId' + '}', CGI.escape(organization_id.to_s))
142
+
143
+ # query parameters
144
+ query_params = opts[:query_params] || {}
145
+ query_params[:'from'] = from
146
+ query_params[:'to'] = to
147
+
148
+ # header parameters
149
+ header_params = opts[:header_params] || {}
150
+ # HTTP header 'Accept' (if needed)
151
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
152
+
153
+ # form parameters
154
+ form_params = opts[:form_params] || {}
155
+
156
+ # http body (model)
157
+ post_body = opts[:debug_body]
158
+
159
+ # return_type
160
+ return_type = opts[:debug_return_type] || 'ModelsAggregatedUsage'
161
+
162
+ # auth_names
163
+ auth_names = opts[:debug_auth_names] || ['Bearer']
164
+
165
+ new_options = opts.merge(
166
+ :operation => :"UsageApi.organization_organization_id_usage_aggregated_get",
167
+ :header_params => header_params,
168
+ :query_params => query_params,
169
+ :form_params => form_params,
170
+ :body => post_body,
171
+ :auth_names => auth_names,
172
+ :return_type => return_type
173
+ )
174
+
175
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
176
+ if @api_client.config.debugging
177
+ @api_client.config.logger.debug "API called: UsageApi#organization_organization_id_usage_aggregated_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
178
+ end
179
+ return data, status_code, headers
180
+ end
181
+
182
+ # Get usage chart data
183
+ # Returns resource usage data points for a given time period with auto-scaled resolution
184
+ # @param organization_id [String] Organization ID
185
+ # @param from [String] Start time (RFC3339)
186
+ # @param to [String] End time (RFC3339)
187
+ # @param [Hash] opts the optional parameters
188
+ # @option opts [String] :region Region filter
189
+ # @return [Array<ModelsUsageChartPoint>]
190
+ def organization_organization_id_usage_chart_get(organization_id, from, to, opts = {})
191
+ data, _status_code, _headers = organization_organization_id_usage_chart_get_with_http_info(organization_id, from, to, opts)
192
+ data
193
+ end
194
+
195
+ # Get usage chart data
196
+ # Returns resource usage data points for a given time period with auto-scaled resolution
197
+ # @param organization_id [String] Organization ID
198
+ # @param from [String] Start time (RFC3339)
199
+ # @param to [String] End time (RFC3339)
200
+ # @param [Hash] opts the optional parameters
201
+ # @option opts [String] :region Region filter
202
+ # @return [Array<(Array<ModelsUsageChartPoint>, Integer, Hash)>] Array<ModelsUsageChartPoint> data, response status code and response headers
203
+ def organization_organization_id_usage_chart_get_with_http_info(organization_id, from, to, opts = {})
204
+ if @api_client.config.debugging
205
+ @api_client.config.logger.debug 'Calling API: UsageApi.organization_organization_id_usage_chart_get ...'
206
+ end
207
+ # verify the required parameter 'organization_id' is set
208
+ if @api_client.config.client_side_validation && organization_id.nil?
209
+ fail ArgumentError, "Missing the required parameter 'organization_id' when calling UsageApi.organization_organization_id_usage_chart_get"
210
+ end
211
+ # verify the required parameter 'from' is set
212
+ if @api_client.config.client_side_validation && from.nil?
213
+ fail ArgumentError, "Missing the required parameter 'from' when calling UsageApi.organization_organization_id_usage_chart_get"
214
+ end
215
+ # verify the required parameter 'to' is set
216
+ if @api_client.config.client_side_validation && to.nil?
217
+ fail ArgumentError, "Missing the required parameter 'to' when calling UsageApi.organization_organization_id_usage_chart_get"
218
+ end
219
+ # resource path
220
+ local_var_path = '/organization/{organizationId}/usage/chart'.sub('{' + 'organizationId' + '}', CGI.escape(organization_id.to_s))
221
+
222
+ # query parameters
223
+ query_params = opts[:query_params] || {}
224
+ query_params[:'from'] = from
225
+ query_params[:'to'] = to
226
+ query_params[:'region'] = opts[:'region'] if !opts[:'region'].nil?
227
+
228
+ # header parameters
229
+ header_params = opts[:header_params] || {}
230
+ # HTTP header 'Accept' (if needed)
231
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
232
+
233
+ # form parameters
234
+ form_params = opts[:form_params] || {}
235
+
236
+ # http body (model)
237
+ post_body = opts[:debug_body]
238
+
239
+ # return_type
240
+ return_type = opts[:debug_return_type] || 'Array<ModelsUsageChartPoint>'
241
+
242
+ # auth_names
243
+ auth_names = opts[:debug_auth_names] || ['Bearer']
244
+
245
+ new_options = opts.merge(
246
+ :operation => :"UsageApi.organization_organization_id_usage_chart_get",
247
+ :header_params => header_params,
248
+ :query_params => query_params,
249
+ :form_params => form_params,
250
+ :body => post_body,
251
+ :auth_names => auth_names,
252
+ :return_type => return_type
253
+ )
254
+
255
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
256
+ if @api_client.config.debugging
257
+ @api_client.config.logger.debug "API called: UsageApi#organization_organization_id_usage_chart_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
258
+ end
259
+ return data, status_code, headers
260
+ end
261
+
262
+ # Get per-sandbox usage
263
+ # Returns resource usage aggregated per sandbox for a given time period
264
+ # @param organization_id [String] Organization ID
265
+ # @param from [String] Start time (RFC3339)
266
+ # @param to [String] End time (RFC3339)
267
+ # @param [Hash] opts the optional parameters
268
+ # @return [Array<ModelsSandboxUsage>]
269
+ def organization_organization_id_usage_sandbox_get(organization_id, from, to, opts = {})
270
+ data, _status_code, _headers = organization_organization_id_usage_sandbox_get_with_http_info(organization_id, from, to, opts)
271
+ data
272
+ end
273
+
274
+ # Get per-sandbox usage
275
+ # Returns resource usage aggregated per sandbox for a given time period
276
+ # @param organization_id [String] Organization ID
277
+ # @param from [String] Start time (RFC3339)
278
+ # @param to [String] End time (RFC3339)
279
+ # @param [Hash] opts the optional parameters
280
+ # @return [Array<(Array<ModelsSandboxUsage>, Integer, Hash)>] Array<ModelsSandboxUsage> data, response status code and response headers
281
+ def organization_organization_id_usage_sandbox_get_with_http_info(organization_id, from, to, opts = {})
282
+ if @api_client.config.debugging
283
+ @api_client.config.logger.debug 'Calling API: UsageApi.organization_organization_id_usage_sandbox_get ...'
284
+ end
285
+ # verify the required parameter 'organization_id' is set
286
+ if @api_client.config.client_side_validation && organization_id.nil?
287
+ fail ArgumentError, "Missing the required parameter 'organization_id' when calling UsageApi.organization_organization_id_usage_sandbox_get"
288
+ end
289
+ # verify the required parameter 'from' is set
290
+ if @api_client.config.client_side_validation && from.nil?
291
+ fail ArgumentError, "Missing the required parameter 'from' when calling UsageApi.organization_organization_id_usage_sandbox_get"
292
+ end
293
+ # verify the required parameter 'to' is set
294
+ if @api_client.config.client_side_validation && to.nil?
295
+ fail ArgumentError, "Missing the required parameter 'to' when calling UsageApi.organization_organization_id_usage_sandbox_get"
296
+ end
297
+ # resource path
298
+ local_var_path = '/organization/{organizationId}/usage/sandbox'.sub('{' + 'organizationId' + '}', CGI.escape(organization_id.to_s))
299
+
300
+ # query parameters
301
+ query_params = opts[:query_params] || {}
302
+ query_params[:'from'] = from
303
+ query_params[:'to'] = to
304
+
305
+ # header parameters
306
+ header_params = opts[:header_params] || {}
307
+ # HTTP header 'Accept' (if needed)
308
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
309
+
310
+ # form parameters
311
+ form_params = opts[:form_params] || {}
312
+
313
+ # http body (model)
314
+ post_body = opts[:debug_body]
315
+
316
+ # return_type
317
+ return_type = opts[:debug_return_type] || 'Array<ModelsSandboxUsage>'
318
+
319
+ # auth_names
320
+ auth_names = opts[:debug_auth_names] || ['Bearer']
321
+
322
+ new_options = opts.merge(
323
+ :operation => :"UsageApi.organization_organization_id_usage_sandbox_get",
324
+ :header_params => header_params,
325
+ :query_params => query_params,
326
+ :form_params => form_params,
327
+ :body => post_body,
328
+ :auth_names => auth_names,
329
+ :return_type => return_type
330
+ )
331
+
332
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
333
+ if @api_client.config.debugging
334
+ @api_client.config.logger.debug "API called: UsageApi#organization_organization_id_usage_sandbox_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
335
+ end
336
+ return data, status_code, headers
337
+ end
338
+ end
339
+ end