smplkit 3.0.133 → 3.0.134
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.
- checksums.yaml +4 -4
- data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/api/runs_api.rb +70 -0
- data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/run_stat.rb +246 -0
- data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/run_stat_bucket.rb +193 -0
- data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/run_stat_failure.rb +249 -0
- data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/run_stat_next_scheduled.rb +231 -0
- data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/run_stat_resource.rb +187 -0
- data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/run_stat_tally.rb +274 -0
- data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/run_stats_response.rb +165 -0
- data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client.rb +7 -0
- data/lib/smplkit/_generated/jobs/spec/api/runs_api_spec.rb +14 -0
- data/lib/smplkit/_generated/jobs/spec/models/run_stat_bucket_spec.rb +42 -0
- data/lib/smplkit/_generated/jobs/spec/models/run_stat_failure_spec.rb +58 -0
- data/lib/smplkit/_generated/jobs/spec/models/run_stat_next_scheduled_spec.rb +54 -0
- data/lib/smplkit/_generated/jobs/spec/models/run_stat_resource_spec.rb +48 -0
- data/lib/smplkit/_generated/jobs/spec/models/run_stat_spec.rb +60 -0
- data/lib/smplkit/_generated/jobs/spec/models/run_stat_tally_spec.rb +60 -0
- data/lib/smplkit/_generated/jobs/spec/models/run_stats_response_spec.rb +36 -0
- metadata +15 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: cf2f498b2e69289af423a44bb47b11c024cb9fa6f6a5d92c59c9386a2495636c
|
|
4
|
+
data.tar.gz: 6427e58289966df501d6484c772c662256e16536d346b60681268bb1f7a93aba
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1f34027f5bd130aab9c529b2336c81bae00c1ebe17c28128a3abddd9ba6adeea2c437a858e7aaba2f008a4526dc5eb09240c4e569f07dd2071179f653c449078
|
|
7
|
+
data.tar.gz: 5c341e78b89c8a5b8ad314a7fd75867b8937817dbe43e86b4f7f572acbbb73ed4d6ac11a9aea05fa83a98a0c29f3cb46efeb174a6693be6374d54068e0b4fa59
|
|
@@ -145,6 +145,76 @@ module SmplkitGeneratedClient::Jobs
|
|
|
145
145
|
return data, status_code, headers
|
|
146
146
|
end
|
|
147
147
|
|
|
148
|
+
# Get Run Stats
|
|
149
|
+
# Report aggregated statistics over this account's runs. One request answers the common monitoring questions: how many runs matched the filters (`total`), how they broke down by lifecycle state (`tally`), how they were distributed over time (`buckets`, when the `bucket` directive is given), which runs failed most recently (`recent_failures`, at most 3, newest first), and what fires next (`next_scheduled`). Filters compose with AND: - `filter[created_at]` — a half-open `[start,end)` date range (see the parameter for the interval syntax). - `filter[environment]` — one environment key or a comma-separated list (any-of); omitted covers every environment you can access. `next_scheduled` honors only the environment filter: it reports the soonest `PENDING` run with a fire time at or after the request, no matter when that run was created. The resource id is always `current` — statistics are computed at read time, not stored.
|
|
150
|
+
# @param [Hash] opts the optional parameters
|
|
151
|
+
# @option opts [String] :filter_created_at Restrict the statistics to runs whose `created_at` falls in a half-open `[start,end)` interval. Bounds are ISO-8601 timestamps; `*` leaves a bound open. The leading bracket is `[` (inclusive) or `(` (exclusive) and the trailing bracket is `]` (inclusive) or `)` (exclusive). Example: `[2026-06-01T00:00:00Z,*)` covers everything from June 1 onward. Does not apply to `next_scheduled`.
|
|
152
|
+
# @option opts [String] :filter_environment Comma-separated list of environment keys to scope the statistics to (e.g. `production,staging`). When omitted, statistics cover every environment you can access.
|
|
153
|
+
# @option opts [String] :bucket Also return run counts over time, grouped into buckets of this size (a directive, not a filter). One of `1m`, `5m`, `15m`, `1h`, `6h`, or `1d`. Omit to skip the time series.
|
|
154
|
+
# @return [RunStatsResponse]
|
|
155
|
+
def get_run_stats(opts = {})
|
|
156
|
+
data, _status_code, _headers = get_run_stats_with_http_info(opts)
|
|
157
|
+
data
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
# Get Run Stats
|
|
161
|
+
# Report aggregated statistics over this account's runs. One request answers the common monitoring questions: how many runs matched the filters (`total`), how they broke down by lifecycle state (`tally`), how they were distributed over time (`buckets`, when the `bucket` directive is given), which runs failed most recently (`recent_failures`, at most 3, newest first), and what fires next (`next_scheduled`). Filters compose with AND: - `filter[created_at]` — a half-open `[start,end)` date range (see the parameter for the interval syntax). - `filter[environment]` — one environment key or a comma-separated list (any-of); omitted covers every environment you can access. `next_scheduled` honors only the environment filter: it reports the soonest `PENDING` run with a fire time at or after the request, no matter when that run was created. The resource id is always `current` — statistics are computed at read time, not stored.
|
|
162
|
+
# @param [Hash] opts the optional parameters
|
|
163
|
+
# @option opts [String] :filter_created_at Restrict the statistics to runs whose `created_at` falls in a half-open `[start,end)` interval. Bounds are ISO-8601 timestamps; `*` leaves a bound open. The leading bracket is `[` (inclusive) or `(` (exclusive) and the trailing bracket is `]` (inclusive) or `)` (exclusive). Example: `[2026-06-01T00:00:00Z,*)` covers everything from June 1 onward. Does not apply to `next_scheduled`.
|
|
164
|
+
# @option opts [String] :filter_environment Comma-separated list of environment keys to scope the statistics to (e.g. `production,staging`). When omitted, statistics cover every environment you can access.
|
|
165
|
+
# @option opts [String] :bucket Also return run counts over time, grouped into buckets of this size (a directive, not a filter). One of `1m`, `5m`, `15m`, `1h`, `6h`, or `1d`. Omit to skip the time series.
|
|
166
|
+
# @return [Array<(RunStatsResponse, Integer, Hash)>] RunStatsResponse data, response status code and response headers
|
|
167
|
+
def get_run_stats_with_http_info(opts = {})
|
|
168
|
+
if @api_client.config.debugging
|
|
169
|
+
@api_client.config.logger.debug 'Calling API: RunsApi.get_run_stats ...'
|
|
170
|
+
end
|
|
171
|
+
allowable_values = ["1m", "5m", "15m", "1h", "6h", "1d"]
|
|
172
|
+
if @api_client.config.client_side_validation && opts[:'bucket'] && !allowable_values.include?(opts[:'bucket'])
|
|
173
|
+
fail ArgumentError, "invalid value for \"bucket\", must be one of #{allowable_values}"
|
|
174
|
+
end
|
|
175
|
+
# resource path
|
|
176
|
+
local_var_path = '/api/v1/run_stats'
|
|
177
|
+
|
|
178
|
+
# query parameters
|
|
179
|
+
query_params = opts[:query_params] || {}
|
|
180
|
+
query_params[:'filter[created_at]'] = opts[:'filter_created_at'] if !opts[:'filter_created_at'].nil?
|
|
181
|
+
query_params[:'filter[environment]'] = opts[:'filter_environment'] if !opts[:'filter_environment'].nil?
|
|
182
|
+
query_params[:'bucket'] = opts[:'bucket'] if !opts[:'bucket'].nil?
|
|
183
|
+
|
|
184
|
+
# header parameters
|
|
185
|
+
header_params = opts[:header_params] || {}
|
|
186
|
+
# HTTP header 'Accept' (if needed)
|
|
187
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json']) unless header_params['Accept']
|
|
188
|
+
|
|
189
|
+
# form parameters
|
|
190
|
+
form_params = opts[:form_params] || {}
|
|
191
|
+
|
|
192
|
+
# http body (model)
|
|
193
|
+
post_body = opts[:debug_body]
|
|
194
|
+
|
|
195
|
+
# return_type
|
|
196
|
+
return_type = opts[:debug_return_type] || 'RunStatsResponse'
|
|
197
|
+
|
|
198
|
+
# auth_names
|
|
199
|
+
auth_names = opts[:debug_auth_names] || ['HTTPBearer']
|
|
200
|
+
|
|
201
|
+
new_options = opts.merge(
|
|
202
|
+
:operation => :"RunsApi.get_run_stats",
|
|
203
|
+
:header_params => header_params,
|
|
204
|
+
:query_params => query_params,
|
|
205
|
+
:form_params => form_params,
|
|
206
|
+
:body => post_body,
|
|
207
|
+
:auth_names => auth_names,
|
|
208
|
+
:return_type => return_type
|
|
209
|
+
)
|
|
210
|
+
|
|
211
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
|
212
|
+
if @api_client.config.debugging
|
|
213
|
+
@api_client.config.logger.debug "API called: RunsApi#get_run_stats\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
214
|
+
end
|
|
215
|
+
return data, status_code, headers
|
|
216
|
+
end
|
|
217
|
+
|
|
148
218
|
# List Runs
|
|
149
219
|
# List runs for this account (cursor paginated). Default sort is `-created_at` (newest first). Sort by `created_at`, `started_at`, `finished_at`, `scheduled_for`, `status`, `job`, or `total_duration_ms`, ascending or descending (prefix `-` for descending). Keep the same `sort` value across paginated requests so the cursor stays consistent. Runs that have not reached the relevant lifecycle point (`started_at`, `finished_at`, `scheduled_for`, `total_duration_ms` unset) sort to the end regardless of direction. Filters compose with AND: - `filter[job]={id}` — a single job's run history. - `filter[status]` — one state or a comma-separated list (any-of). - `filter[trigger]` — one trigger (`SCHEDULE`, `MANUAL`, `RERUN`, `RETRY`) or a comma-separated list of them (any-of). - `filter[environment]` — one environment key or a comma-separated list (any-of); omitted covers every environment you can access. - `filter[created_at]` / `filter[started_at]` / `filter[finished_at]` / `filter[scheduled_for]` — half-open `[start,end)` date ranges (see each parameter for the interval syntax). Set `last_run_only=true` to collapse the result to the last completed run for each job-and-environment combination. \"Completed\" means a terminal state — succeeded, failed, or canceled; in-flight runs (pending or running) are not included, so a job that is mid-run still surfaces its previous completed result and a combination with no completed run yet returns nothing. The filters above still apply, evaluated before the collapse, so each row is the most recent completed run in its group that also satisfies them.
|
|
150
220
|
# @param [Hash] opts the optional parameters
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#smplkit Jobs API
|
|
3
|
+
|
|
4
|
+
#Scheduled HTTP job execution API for smplkit.
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 0.1.0
|
|
7
|
+
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.22.0
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'date'
|
|
14
|
+
require 'time'
|
|
15
|
+
|
|
16
|
+
module SmplkitGeneratedClient::Jobs
|
|
17
|
+
# Aggregated run statistics for the requested scope. Computed on demand from the account's runs; `total`, `tally`, `buckets`, and `recent_failures` honor the request's filters, while `next_scheduled` honors only the environment filter (it is forward-looking by definition).
|
|
18
|
+
class RunStat < ApiModelBase
|
|
19
|
+
# Runs matching the filters.
|
|
20
|
+
attr_accessor :total
|
|
21
|
+
|
|
22
|
+
# Those runs counted by lifecycle state.
|
|
23
|
+
attr_accessor :tally
|
|
24
|
+
|
|
25
|
+
# Run counts over time at the requested `bucket` granularity, ordered by bucket start. Only buckets containing at least one run are listed — treat missing buckets as zero. `null` when the request did not include the `bucket` directive.
|
|
26
|
+
attr_accessor :buckets
|
|
27
|
+
|
|
28
|
+
# The most recently created `FAILED` runs matching the filters, newest first — at most 3.
|
|
29
|
+
attr_accessor :recent_failures
|
|
30
|
+
|
|
31
|
+
# The soonest `PENDING` run with a fire time at or after the request, or `null` when nothing upcoming is scheduled. The `filter[created_at]` range does not apply here — a run scheduled long ago for a future fire time is still next.
|
|
32
|
+
attr_accessor :next_scheduled
|
|
33
|
+
|
|
34
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
35
|
+
def self.attribute_map
|
|
36
|
+
{
|
|
37
|
+
:'total' => :'total',
|
|
38
|
+
:'tally' => :'tally',
|
|
39
|
+
:'buckets' => :'buckets',
|
|
40
|
+
:'recent_failures' => :'recent_failures',
|
|
41
|
+
:'next_scheduled' => :'next_scheduled'
|
|
42
|
+
}
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# Returns attribute mapping this model knows about
|
|
46
|
+
def self.acceptable_attribute_map
|
|
47
|
+
attribute_map
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# Returns all the JSON keys this model knows about
|
|
51
|
+
def self.acceptable_attributes
|
|
52
|
+
acceptable_attribute_map.values
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
# Attribute type mapping.
|
|
56
|
+
def self.openapi_types
|
|
57
|
+
{
|
|
58
|
+
:'total' => :'Integer',
|
|
59
|
+
:'tally' => :'RunStatTally',
|
|
60
|
+
:'buckets' => :'Array<RunStatBucket>',
|
|
61
|
+
:'recent_failures' => :'Array<RunStatFailure>',
|
|
62
|
+
:'next_scheduled' => :'RunStatNextScheduled'
|
|
63
|
+
}
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
# List of attributes with nullable: true
|
|
67
|
+
def self.openapi_nullable
|
|
68
|
+
Set.new([
|
|
69
|
+
:'buckets',
|
|
70
|
+
:'next_scheduled'
|
|
71
|
+
])
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
# Initializes the object
|
|
75
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
76
|
+
def initialize(attributes = {})
|
|
77
|
+
if (!attributes.is_a?(Hash))
|
|
78
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `SmplkitGeneratedClient::Jobs::RunStat` initialize method"
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
82
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
83
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
84
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
85
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `SmplkitGeneratedClient::Jobs::RunStat`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
86
|
+
end
|
|
87
|
+
h[k.to_sym] = v
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
if attributes.key?(:'total')
|
|
91
|
+
self.total = attributes[:'total']
|
|
92
|
+
else
|
|
93
|
+
self.total = nil
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
if attributes.key?(:'tally')
|
|
97
|
+
self.tally = attributes[:'tally']
|
|
98
|
+
else
|
|
99
|
+
self.tally = nil
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
if attributes.key?(:'buckets')
|
|
103
|
+
if (value = attributes[:'buckets']).is_a?(Array)
|
|
104
|
+
self.buckets = value
|
|
105
|
+
end
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
if attributes.key?(:'recent_failures')
|
|
109
|
+
if (value = attributes[:'recent_failures']).is_a?(Array)
|
|
110
|
+
self.recent_failures = value
|
|
111
|
+
end
|
|
112
|
+
else
|
|
113
|
+
self.recent_failures = nil
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
if attributes.key?(:'next_scheduled')
|
|
117
|
+
self.next_scheduled = attributes[:'next_scheduled']
|
|
118
|
+
end
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
122
|
+
# @return Array for valid properties with the reasons
|
|
123
|
+
def list_invalid_properties
|
|
124
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
125
|
+
invalid_properties = Array.new
|
|
126
|
+
if @total.nil?
|
|
127
|
+
invalid_properties.push('invalid value for "total", total cannot be nil.')
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
if @tally.nil?
|
|
131
|
+
invalid_properties.push('invalid value for "tally", tally cannot be nil.')
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
if @recent_failures.nil?
|
|
135
|
+
invalid_properties.push('invalid value for "recent_failures", recent_failures cannot be nil.')
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
invalid_properties
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
# Check to see if the all the properties in the model are valid
|
|
142
|
+
# @return true if the model is valid
|
|
143
|
+
def valid?
|
|
144
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
145
|
+
return false if @total.nil?
|
|
146
|
+
return false if @tally.nil?
|
|
147
|
+
return false if @recent_failures.nil?
|
|
148
|
+
true
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
# Custom attribute writer method with validation
|
|
152
|
+
# @param [Object] total Value to be assigned
|
|
153
|
+
def total=(total)
|
|
154
|
+
if total.nil?
|
|
155
|
+
fail ArgumentError, 'total cannot be nil'
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
@total = total
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
# Custom attribute writer method with validation
|
|
162
|
+
# @param [Object] tally Value to be assigned
|
|
163
|
+
def tally=(tally)
|
|
164
|
+
if tally.nil?
|
|
165
|
+
fail ArgumentError, 'tally cannot be nil'
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
@tally = tally
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
# Custom attribute writer method with validation
|
|
172
|
+
# @param [Object] recent_failures Value to be assigned
|
|
173
|
+
def recent_failures=(recent_failures)
|
|
174
|
+
if recent_failures.nil?
|
|
175
|
+
fail ArgumentError, 'recent_failures cannot be nil'
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
@recent_failures = recent_failures
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
# Checks equality by comparing each attribute.
|
|
182
|
+
# @param [Object] Object to be compared
|
|
183
|
+
def ==(o)
|
|
184
|
+
return true if self.equal?(o)
|
|
185
|
+
self.class == o.class &&
|
|
186
|
+
total == o.total &&
|
|
187
|
+
tally == o.tally &&
|
|
188
|
+
buckets == o.buckets &&
|
|
189
|
+
recent_failures == o.recent_failures &&
|
|
190
|
+
next_scheduled == o.next_scheduled
|
|
191
|
+
end
|
|
192
|
+
|
|
193
|
+
# @see the `==` method
|
|
194
|
+
# @param [Object] Object to be compared
|
|
195
|
+
def eql?(o)
|
|
196
|
+
self == o
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
# Calculates hash code according to all attributes.
|
|
200
|
+
# @return [Integer] Hash code
|
|
201
|
+
def hash
|
|
202
|
+
[total, tally, buckets, recent_failures, next_scheduled].hash
|
|
203
|
+
end
|
|
204
|
+
|
|
205
|
+
# Builds the object from hash
|
|
206
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
207
|
+
# @return [Object] Returns the model itself
|
|
208
|
+
def self.build_from_hash(attributes)
|
|
209
|
+
return nil unless attributes.is_a?(Hash)
|
|
210
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
211
|
+
transformed_hash = {}
|
|
212
|
+
openapi_types.each_pair do |key, type|
|
|
213
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
214
|
+
transformed_hash["#{key}"] = nil
|
|
215
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
216
|
+
# check to ensure the input is an array given that the attribute
|
|
217
|
+
# is documented as an array but the input is not
|
|
218
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
219
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
220
|
+
end
|
|
221
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
222
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
223
|
+
end
|
|
224
|
+
end
|
|
225
|
+
new(transformed_hash)
|
|
226
|
+
end
|
|
227
|
+
|
|
228
|
+
# Returns the object in the form of hash
|
|
229
|
+
# @return [Hash] Returns the object in the form of hash
|
|
230
|
+
def to_hash
|
|
231
|
+
hash = {}
|
|
232
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
233
|
+
value = self.send(attr)
|
|
234
|
+
if value.nil?
|
|
235
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
236
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
237
|
+
end
|
|
238
|
+
|
|
239
|
+
hash[param] = _to_hash(value)
|
|
240
|
+
end
|
|
241
|
+
hash
|
|
242
|
+
end
|
|
243
|
+
|
|
244
|
+
end
|
|
245
|
+
|
|
246
|
+
end
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#smplkit Jobs API
|
|
3
|
+
|
|
4
|
+
#Scheduled HTTP job execution API for smplkit.
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 0.1.0
|
|
7
|
+
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.22.0
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'date'
|
|
14
|
+
require 'time'
|
|
15
|
+
|
|
16
|
+
module SmplkitGeneratedClient::Jobs
|
|
17
|
+
# Run count for one time bucket.
|
|
18
|
+
class RunStatBucket < ApiModelBase
|
|
19
|
+
# Start of the bucket (UTC). Buckets are aligned to the epoch — e.g. `1h` buckets start on the hour.
|
|
20
|
+
attr_accessor :bucket
|
|
21
|
+
|
|
22
|
+
# Runs created within this bucket.
|
|
23
|
+
attr_accessor :count
|
|
24
|
+
|
|
25
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
26
|
+
def self.attribute_map
|
|
27
|
+
{
|
|
28
|
+
:'bucket' => :'bucket',
|
|
29
|
+
:'count' => :'count'
|
|
30
|
+
}
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# Returns attribute mapping this model knows about
|
|
34
|
+
def self.acceptable_attribute_map
|
|
35
|
+
attribute_map
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# Returns all the JSON keys this model knows about
|
|
39
|
+
def self.acceptable_attributes
|
|
40
|
+
acceptable_attribute_map.values
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# Attribute type mapping.
|
|
44
|
+
def self.openapi_types
|
|
45
|
+
{
|
|
46
|
+
:'bucket' => :'Time',
|
|
47
|
+
:'count' => :'Integer'
|
|
48
|
+
}
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# List of attributes with nullable: true
|
|
52
|
+
def self.openapi_nullable
|
|
53
|
+
Set.new([
|
|
54
|
+
])
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
# Initializes the object
|
|
58
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
59
|
+
def initialize(attributes = {})
|
|
60
|
+
if (!attributes.is_a?(Hash))
|
|
61
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `SmplkitGeneratedClient::Jobs::RunStatBucket` initialize method"
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
65
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
66
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
67
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
68
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `SmplkitGeneratedClient::Jobs::RunStatBucket`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
69
|
+
end
|
|
70
|
+
h[k.to_sym] = v
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
if attributes.key?(:'bucket')
|
|
74
|
+
self.bucket = attributes[:'bucket']
|
|
75
|
+
else
|
|
76
|
+
self.bucket = nil
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
if attributes.key?(:'count')
|
|
80
|
+
self.count = attributes[:'count']
|
|
81
|
+
else
|
|
82
|
+
self.count = nil
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
87
|
+
# @return Array for valid properties with the reasons
|
|
88
|
+
def list_invalid_properties
|
|
89
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
90
|
+
invalid_properties = Array.new
|
|
91
|
+
if @bucket.nil?
|
|
92
|
+
invalid_properties.push('invalid value for "bucket", bucket cannot be nil.')
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
if @count.nil?
|
|
96
|
+
invalid_properties.push('invalid value for "count", count cannot be nil.')
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
invalid_properties
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
# Check to see if the all the properties in the model are valid
|
|
103
|
+
# @return true if the model is valid
|
|
104
|
+
def valid?
|
|
105
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
106
|
+
return false if @bucket.nil?
|
|
107
|
+
return false if @count.nil?
|
|
108
|
+
true
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
# Custom attribute writer method with validation
|
|
112
|
+
# @param [Object] bucket Value to be assigned
|
|
113
|
+
def bucket=(bucket)
|
|
114
|
+
if bucket.nil?
|
|
115
|
+
fail ArgumentError, 'bucket cannot be nil'
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
@bucket = bucket
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
# Custom attribute writer method with validation
|
|
122
|
+
# @param [Object] count Value to be assigned
|
|
123
|
+
def count=(count)
|
|
124
|
+
if count.nil?
|
|
125
|
+
fail ArgumentError, 'count cannot be nil'
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
@count = count
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
# Checks equality by comparing each attribute.
|
|
132
|
+
# @param [Object] Object to be compared
|
|
133
|
+
def ==(o)
|
|
134
|
+
return true if self.equal?(o)
|
|
135
|
+
self.class == o.class &&
|
|
136
|
+
bucket == o.bucket &&
|
|
137
|
+
count == o.count
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
# @see the `==` method
|
|
141
|
+
# @param [Object] Object to be compared
|
|
142
|
+
def eql?(o)
|
|
143
|
+
self == o
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
# Calculates hash code according to all attributes.
|
|
147
|
+
# @return [Integer] Hash code
|
|
148
|
+
def hash
|
|
149
|
+
[bucket, count].hash
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
# Builds the object from hash
|
|
153
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
154
|
+
# @return [Object] Returns the model itself
|
|
155
|
+
def self.build_from_hash(attributes)
|
|
156
|
+
return nil unless attributes.is_a?(Hash)
|
|
157
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
158
|
+
transformed_hash = {}
|
|
159
|
+
openapi_types.each_pair do |key, type|
|
|
160
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
161
|
+
transformed_hash["#{key}"] = nil
|
|
162
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
163
|
+
# check to ensure the input is an array given that the attribute
|
|
164
|
+
# is documented as an array but the input is not
|
|
165
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
166
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
167
|
+
end
|
|
168
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
169
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
170
|
+
end
|
|
171
|
+
end
|
|
172
|
+
new(transformed_hash)
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
# Returns the object in the form of hash
|
|
176
|
+
# @return [Hash] Returns the object in the form of hash
|
|
177
|
+
def to_hash
|
|
178
|
+
hash = {}
|
|
179
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
180
|
+
value = self.send(attr)
|
|
181
|
+
if value.nil?
|
|
182
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
183
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
184
|
+
end
|
|
185
|
+
|
|
186
|
+
hash[param] = _to_hash(value)
|
|
187
|
+
end
|
|
188
|
+
hash
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
end
|
|
192
|
+
|
|
193
|
+
end
|