influxdb-client-apis 2.9.0.pre.6293 → 2.9.0.pre.6399

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,221 @@
1
+ =begin
2
+ #InfluxDB OSS API Service
3
+
4
+ #The InfluxDB v2 API provides a programmatic interface for all interactions with InfluxDB. Access the InfluxDB API using the `/api/v2/` endpoint.
5
+
6
+ The version of the OpenAPI document: 2.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+
10
+ =end
11
+
12
+ require 'date'
13
+ require 'set'
14
+ require 'time'
15
+
16
+ module InfluxDB2::API
17
+ class Runs
18
+ attr_accessor :links
19
+
20
+ attr_accessor :runs
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'links' => :'links',
26
+ :'runs' => :'runs',
27
+ }
28
+ end
29
+
30
+ # Attribute type mapping.
31
+ def self.openapi_types
32
+ {
33
+ :'links' => :'Links',
34
+ :'runs' => :'Array<Run>'
35
+ }
36
+ end
37
+
38
+ # List of attributes with nullable: true
39
+ def self.openapi_nullable
40
+ Set.new([
41
+ ])
42
+ end
43
+
44
+ # Initializes the object
45
+ # @param [Hash] attributes Model attributes in the form of hash
46
+ def initialize(attributes = {})
47
+ if (!attributes.is_a?(Hash))
48
+ fail ArgumentError, "The input argument (attributes) must be a hash in `InfluxDB2::Runs` initialize method"
49
+ end
50
+
51
+ # check to see if the attribute exists and convert string to symbol for hash key
52
+ attributes = attributes.each_with_object({}) { |(k, v), h|
53
+ if (!self.class.attribute_map.key?(k.to_sym))
54
+ fail ArgumentError, "`#{k}` is not a valid attribute in `InfluxDB2::Runs`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
55
+ end
56
+ h[k.to_sym] = v
57
+ }
58
+
59
+ if attributes.key?(:'links')
60
+ self.links = attributes[:'links']
61
+ end
62
+
63
+ if attributes.key?(:'runs')
64
+ if (value = attributes[:'runs']).is_a?(Array)
65
+ self.runs = value
66
+ end
67
+ end
68
+ end
69
+
70
+ # Show invalid properties with the reasons. Usually used together with valid?
71
+ # @return Array for valid properties with the reasons
72
+ def list_invalid_properties
73
+ invalid_properties = Array.new
74
+ invalid_properties
75
+ end
76
+
77
+ # Check to see if the all the properties in the model are valid
78
+ # @return true if the model is valid
79
+ def valid?
80
+ true
81
+ end
82
+
83
+ # Checks equality by comparing each attribute.
84
+ # @param [Object] Object to be compared
85
+ def ==(o)
86
+ return true if self.equal?(o)
87
+ self.class == o.class &&
88
+ links == o.links &&
89
+ runs == o.runs
90
+ end
91
+
92
+ # @see the `==` method
93
+ # @param [Object] Object to be compared
94
+ def eql?(o)
95
+ self == o
96
+ end
97
+
98
+ # Calculates hash code according to all attributes.
99
+ # @return [Integer] Hash code
100
+ def hash
101
+ [links, runs].hash
102
+ end
103
+
104
+ # Builds the object from hash
105
+ # @param [Hash] attributes Model attributes in the form of hash
106
+ # @return [Object] Returns the model itself
107
+ def self.build_from_hash(attributes)
108
+ new.build_from_hash(attributes)
109
+ end
110
+
111
+ # Builds the object from hash
112
+ # @param [Hash] attributes Model attributes in the form of hash
113
+ # @return [Object] Returns the model itself
114
+ def build_from_hash(attributes)
115
+ return nil unless attributes.is_a?(Hash)
116
+ self.class.openapi_types.each_pair do |key, type|
117
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
118
+ self.send("#{key}=", nil)
119
+ elsif type =~ /\AArray<(.*)>/i
120
+ # check to ensure the input is an array given that the attribute
121
+ # is documented as an array but the input is not
122
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
123
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
124
+ end
125
+ elsif !attributes[self.class.attribute_map[key]].nil?
126
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
127
+ end
128
+ end
129
+
130
+ self
131
+ end
132
+
133
+ # Deserializes the data based on type
134
+ # @param string type Data type
135
+ # @param string value Value to be deserialized
136
+ # @return [Object] Deserialized data
137
+ def _deserialize(type, value)
138
+ case type.to_sym
139
+ when :Time
140
+ Time.parse(value)
141
+ when :Date
142
+ Date.parse(value)
143
+ when :String
144
+ value.to_s
145
+ when :Integer
146
+ value.to_i
147
+ when :Float
148
+ value.to_f
149
+ when :Boolean
150
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
151
+ true
152
+ else
153
+ false
154
+ end
155
+ when :Object
156
+ # generic object (usually a Hash), return directly
157
+ value
158
+ when /\AArray<(?<inner_type>.+)>\z/
159
+ inner_type = Regexp.last_match[:inner_type]
160
+ value.map { |v| _deserialize(inner_type, v) }
161
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
162
+ k_type = Regexp.last_match[:k_type]
163
+ v_type = Regexp.last_match[:v_type]
164
+ {}.tap do |hash|
165
+ value.each do |k, v|
166
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
167
+ end
168
+ end
169
+ else # model
170
+ InfluxDB2::API.const_get(type).build_from_hash(value)
171
+ end
172
+ end
173
+
174
+ # Returns the string representation of the object
175
+ # @return [String] String presentation of the object
176
+ def to_s
177
+ to_hash.to_s
178
+ end
179
+
180
+ # to_body is an alias to to_hash (backward compatibility)
181
+ # @return [Hash] Returns the object in the form of hash
182
+ def to_body
183
+ to_hash
184
+ end
185
+
186
+ # Returns the object in the form of hash
187
+ # @return [Hash] Returns the object in the form of hash
188
+ def to_hash
189
+ hash = {}
190
+ self.class.attribute_map.each_pair do |attr, param|
191
+ value = self.send(attr)
192
+ if value.nil?
193
+ is_nullable = self.class.openapi_nullable.include?(attr)
194
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
195
+ end
196
+
197
+ hash[param] = _to_hash(value)
198
+ end
199
+ hash
200
+ end
201
+
202
+ # Outputs non-array value in the form of hash
203
+ # For object, use to_hash. Otherwise, just return the value
204
+ # @param [Object] value Any valid value
205
+ # @return [Hash] Returns the value in the form of hash
206
+ def _to_hash(value)
207
+ if value.is_a?(Array)
208
+ value.compact.map { |v| _to_hash(v) }
209
+ elsif value.is_a?(Hash)
210
+ {}.tap do |hash|
211
+ value.each { |k, v| hash[k] = _to_hash(v) }
212
+ end
213
+ elsif value.respond_to? :to_hash
214
+ value.to_hash
215
+ else
216
+ value
217
+ end
218
+ end
219
+
220
+ end
221
+ end
@@ -0,0 +1,440 @@
1
+ =begin
2
+ #InfluxDB OSS API Service
3
+
4
+ #The InfluxDB v2 API provides a programmatic interface for all interactions with InfluxDB. Access the InfluxDB API using the `/api/v2/` endpoint.
5
+
6
+ The version of the OpenAPI document: 2.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+
10
+ =end
11
+
12
+ require 'date'
13
+ require 'set'
14
+ require 'time'
15
+
16
+ module InfluxDB2::API
17
+ class Task
18
+ # The resource ID that InfluxDB uses to uniquely identify the task.
19
+ attr_accessor :id
20
+
21
+ # An organization ID. Identifies the [organization](https://docs.influxdata.com/influxdb/latest/reference/glossary/#organization) that owns the task.
22
+ attr_accessor :org_id
23
+
24
+ # An organization name. Identifies the [organization](https://docs.influxdata.com/influxdb/latest/reference/glossary/#organization) that owns the task.
25
+ attr_accessor :org
26
+
27
+ # The name of the task.
28
+ attr_accessor :name
29
+
30
+ # A description of the task.
31
+ attr_accessor :description
32
+
33
+ # A user ID. Identifies the [user](https://docs.influxdata.com/influxdb/latest/reference/glossary/#user) that owns the task. To find a user ID, use the [`GET /api/v2/users` endpoint](#operation/GetUsers) to list users.
34
+ attr_accessor :owner_id
35
+
36
+ attr_accessor :status
37
+
38
+ attr_accessor :labels
39
+
40
+ # An authorization ID. Identifies the authorization used when the task communicates with the query engine. To find an authorization ID, use the [`GET /api/v2/authorizations` endpoint](#operation/GetAuthorizations) to list authorizations.
41
+ attr_accessor :authorization_id
42
+
43
+ # Flux with [task configuration options](https://docs.influxdata.com/influxdb/latest/process-data/task-options/) and the script for the task to run. #### Related guides - [Task configuration options](https://docs.influxdata.com/influxdb/latest/process-data/task-options/)
44
+ attr_accessor :flux
45
+
46
+ # The interval ([duration literal](https://docs.influxdata.com/influxdb/latest/reference/glossary/#rfc3339-timestamp)) at which the task runs. `every` also determines when the task first runs, depending on the specified time.
47
+ attr_accessor :every
48
+
49
+ # A [Cron expression](https://en.wikipedia.org/wiki/Cron#Overview) that defines the schedule on which the task runs. InfluxDB uses the system time when evaluating Cron expressions.
50
+ attr_accessor :cron
51
+
52
+ # A [duration](https://docs.influxdata.com/flux/v0.x/spec/lexical-elements/#duration-literals) to delay execution of the task after the scheduled time has elapsed. `0` removes the offset.
53
+ attr_accessor :offset
54
+
55
+ # A timestamp ([RFC3339 date/time format](https://docs.influxdata.com/influxdb/latest/reference/glossary/#rfc3339-timestamp)) of the latest scheduled and completed run.
56
+ attr_accessor :latest_completed
57
+
58
+ attr_reader :last_run_status
59
+
60
+ attr_accessor :last_run_error
61
+
62
+ attr_accessor :created_at
63
+
64
+ attr_accessor :updated_at
65
+
66
+ attr_accessor :links
67
+
68
+ class EnumAttributeValidator
69
+ attr_reader :datatype
70
+ attr_reader :allowable_values
71
+
72
+ def initialize(datatype, allowable_values)
73
+ @allowable_values = allowable_values.map do |value|
74
+ case datatype.to_s
75
+ when /Integer/i
76
+ value.to_i
77
+ when /Float/i
78
+ value.to_f
79
+ else
80
+ value
81
+ end
82
+ end
83
+ end
84
+
85
+ def valid?(value)
86
+ !value || allowable_values.include?(value)
87
+ end
88
+ end
89
+
90
+ # Attribute mapping from ruby-style variable name to JSON key.
91
+ def self.attribute_map
92
+ {
93
+ :'id' => :'id',
94
+ :'org_id' => :'orgID',
95
+ :'org' => :'org',
96
+ :'name' => :'name',
97
+ :'description' => :'description',
98
+ :'owner_id' => :'ownerID',
99
+ :'status' => :'status',
100
+ :'labels' => :'labels',
101
+ :'authorization_id' => :'authorizationID',
102
+ :'flux' => :'flux',
103
+ :'every' => :'every',
104
+ :'cron' => :'cron',
105
+ :'offset' => :'offset',
106
+ :'latest_completed' => :'latestCompleted',
107
+ :'last_run_status' => :'lastRunStatus',
108
+ :'last_run_error' => :'lastRunError',
109
+ :'created_at' => :'createdAt',
110
+ :'updated_at' => :'updatedAt',
111
+ :'links' => :'links',
112
+ }
113
+ end
114
+
115
+ # Attribute type mapping.
116
+ def self.openapi_types
117
+ {
118
+ :'id' => :'String',
119
+ :'org_id' => :'String',
120
+ :'org' => :'String',
121
+ :'name' => :'String',
122
+ :'description' => :'String',
123
+ :'owner_id' => :'String',
124
+ :'status' => :'TaskStatusType',
125
+ :'labels' => :'Array<Label>',
126
+ :'authorization_id' => :'String',
127
+ :'flux' => :'String',
128
+ :'every' => :'String',
129
+ :'cron' => :'String',
130
+ :'offset' => :'String',
131
+ :'latest_completed' => :'Time',
132
+ :'last_run_status' => :'String',
133
+ :'last_run_error' => :'String',
134
+ :'created_at' => :'Time',
135
+ :'updated_at' => :'Time',
136
+ :'links' => :'TaskLinks'
137
+ }
138
+ end
139
+
140
+ # List of attributes with nullable: true
141
+ def self.openapi_nullable
142
+ Set.new([
143
+ ])
144
+ end
145
+
146
+ # Initializes the object
147
+ # @param [Hash] attributes Model attributes in the form of hash
148
+ def initialize(attributes = {})
149
+ if (!attributes.is_a?(Hash))
150
+ fail ArgumentError, "The input argument (attributes) must be a hash in `InfluxDB2::Task` initialize method"
151
+ end
152
+
153
+ # check to see if the attribute exists and convert string to symbol for hash key
154
+ attributes = attributes.each_with_object({}) { |(k, v), h|
155
+ if (!self.class.attribute_map.key?(k.to_sym))
156
+ fail ArgumentError, "`#{k}` is not a valid attribute in `InfluxDB2::Task`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
157
+ end
158
+ h[k.to_sym] = v
159
+ }
160
+
161
+ if attributes.key?(:'id')
162
+ self.id = attributes[:'id']
163
+ end
164
+
165
+ if attributes.key?(:'org_id')
166
+ self.org_id = attributes[:'org_id']
167
+ end
168
+
169
+ if attributes.key?(:'org')
170
+ self.org = attributes[:'org']
171
+ end
172
+
173
+ if attributes.key?(:'name')
174
+ self.name = attributes[:'name']
175
+ end
176
+
177
+ if attributes.key?(:'description')
178
+ self.description = attributes[:'description']
179
+ end
180
+
181
+ if attributes.key?(:'owner_id')
182
+ self.owner_id = attributes[:'owner_id']
183
+ end
184
+
185
+ if attributes.key?(:'status')
186
+ self.status = attributes[:'status']
187
+ end
188
+
189
+ if attributes.key?(:'labels')
190
+ if (value = attributes[:'labels']).is_a?(Array)
191
+ self.labels = value
192
+ end
193
+ end
194
+
195
+ if attributes.key?(:'authorization_id')
196
+ self.authorization_id = attributes[:'authorization_id']
197
+ end
198
+
199
+ if attributes.key?(:'flux')
200
+ self.flux = attributes[:'flux']
201
+ end
202
+
203
+ if attributes.key?(:'every')
204
+ self.every = attributes[:'every']
205
+ end
206
+
207
+ if attributes.key?(:'cron')
208
+ self.cron = attributes[:'cron']
209
+ end
210
+
211
+ if attributes.key?(:'offset')
212
+ self.offset = attributes[:'offset']
213
+ end
214
+
215
+ if attributes.key?(:'latest_completed')
216
+ self.latest_completed = attributes[:'latest_completed']
217
+ end
218
+
219
+ if attributes.key?(:'last_run_status')
220
+ self.last_run_status = attributes[:'last_run_status']
221
+ end
222
+
223
+ if attributes.key?(:'last_run_error')
224
+ self.last_run_error = attributes[:'last_run_error']
225
+ end
226
+
227
+ if attributes.key?(:'created_at')
228
+ self.created_at = attributes[:'created_at']
229
+ end
230
+
231
+ if attributes.key?(:'updated_at')
232
+ self.updated_at = attributes[:'updated_at']
233
+ end
234
+
235
+ if attributes.key?(:'links')
236
+ self.links = attributes[:'links']
237
+ end
238
+ end
239
+
240
+ # Show invalid properties with the reasons. Usually used together with valid?
241
+ # @return Array for valid properties with the reasons
242
+ def list_invalid_properties
243
+ invalid_properties = Array.new
244
+ if @id.nil?
245
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
246
+ end
247
+
248
+ if @org_id.nil?
249
+ invalid_properties.push('invalid value for "org_id", org_id cannot be nil.')
250
+ end
251
+
252
+ if @name.nil?
253
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
254
+ end
255
+
256
+ if @flux.nil?
257
+ invalid_properties.push('invalid value for "flux", flux cannot be nil.')
258
+ end
259
+
260
+ invalid_properties
261
+ end
262
+
263
+ # Check to see if the all the properties in the model are valid
264
+ # @return true if the model is valid
265
+ def valid?
266
+ return false if @id.nil?
267
+ return false if @org_id.nil?
268
+ return false if @name.nil?
269
+ return false if @flux.nil?
270
+ last_run_status_validator = EnumAttributeValidator.new('String', ["failed", "success", "canceled"])
271
+ return false unless last_run_status_validator.valid?(@last_run_status)
272
+ true
273
+ end
274
+
275
+ # Custom attribute writer method checking allowed values (enum).
276
+ # @param [Object] last_run_status Object to be assigned
277
+ def last_run_status=(last_run_status)
278
+ validator = EnumAttributeValidator.new('String', ["failed", "success", "canceled"])
279
+ unless validator.valid?(last_run_status)
280
+ fail ArgumentError, "invalid value for \"last_run_status\", must be one of #{validator.allowable_values}."
281
+ end
282
+ @last_run_status = last_run_status
283
+ end
284
+
285
+ # Checks equality by comparing each attribute.
286
+ # @param [Object] Object to be compared
287
+ def ==(o)
288
+ return true if self.equal?(o)
289
+ self.class == o.class &&
290
+ id == o.id &&
291
+ org_id == o.org_id &&
292
+ org == o.org &&
293
+ name == o.name &&
294
+ description == o.description &&
295
+ owner_id == o.owner_id &&
296
+ status == o.status &&
297
+ labels == o.labels &&
298
+ authorization_id == o.authorization_id &&
299
+ flux == o.flux &&
300
+ every == o.every &&
301
+ cron == o.cron &&
302
+ offset == o.offset &&
303
+ latest_completed == o.latest_completed &&
304
+ last_run_status == o.last_run_status &&
305
+ last_run_error == o.last_run_error &&
306
+ created_at == o.created_at &&
307
+ updated_at == o.updated_at &&
308
+ links == o.links
309
+ end
310
+
311
+ # @see the `==` method
312
+ # @param [Object] Object to be compared
313
+ def eql?(o)
314
+ self == o
315
+ end
316
+
317
+ # Calculates hash code according to all attributes.
318
+ # @return [Integer] Hash code
319
+ def hash
320
+ [id, org_id, org, name, description, owner_id, status, labels, authorization_id, flux, every, cron, offset, latest_completed, last_run_status, last_run_error, created_at, updated_at, links].hash
321
+ end
322
+
323
+ # Builds the object from hash
324
+ # @param [Hash] attributes Model attributes in the form of hash
325
+ # @return [Object] Returns the model itself
326
+ def self.build_from_hash(attributes)
327
+ new.build_from_hash(attributes)
328
+ end
329
+
330
+ # Builds the object from hash
331
+ # @param [Hash] attributes Model attributes in the form of hash
332
+ # @return [Object] Returns the model itself
333
+ def build_from_hash(attributes)
334
+ return nil unless attributes.is_a?(Hash)
335
+ self.class.openapi_types.each_pair do |key, type|
336
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
337
+ self.send("#{key}=", nil)
338
+ elsif type =~ /\AArray<(.*)>/i
339
+ # check to ensure the input is an array given that the attribute
340
+ # is documented as an array but the input is not
341
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
342
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
343
+ end
344
+ elsif !attributes[self.class.attribute_map[key]].nil?
345
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
346
+ end
347
+ end
348
+
349
+ self
350
+ end
351
+
352
+ # Deserializes the data based on type
353
+ # @param string type Data type
354
+ # @param string value Value to be deserialized
355
+ # @return [Object] Deserialized data
356
+ def _deserialize(type, value)
357
+ case type.to_sym
358
+ when :Time
359
+ Time.parse(value)
360
+ when :Date
361
+ Date.parse(value)
362
+ when :String
363
+ value.to_s
364
+ when :Integer
365
+ value.to_i
366
+ when :Float
367
+ value.to_f
368
+ when :Boolean
369
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
370
+ true
371
+ else
372
+ false
373
+ end
374
+ when :Object
375
+ # generic object (usually a Hash), return directly
376
+ value
377
+ when /\AArray<(?<inner_type>.+)>\z/
378
+ inner_type = Regexp.last_match[:inner_type]
379
+ value.map { |v| _deserialize(inner_type, v) }
380
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
381
+ k_type = Regexp.last_match[:k_type]
382
+ v_type = Regexp.last_match[:v_type]
383
+ {}.tap do |hash|
384
+ value.each do |k, v|
385
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
386
+ end
387
+ end
388
+ else # model
389
+ InfluxDB2::API.const_get(type).build_from_hash(value)
390
+ end
391
+ end
392
+
393
+ # Returns the string representation of the object
394
+ # @return [String] String presentation of the object
395
+ def to_s
396
+ to_hash.to_s
397
+ end
398
+
399
+ # to_body is an alias to to_hash (backward compatibility)
400
+ # @return [Hash] Returns the object in the form of hash
401
+ def to_body
402
+ to_hash
403
+ end
404
+
405
+ # Returns the object in the form of hash
406
+ # @return [Hash] Returns the object in the form of hash
407
+ def to_hash
408
+ hash = {}
409
+ self.class.attribute_map.each_pair do |attr, param|
410
+ value = self.send(attr)
411
+ if value.nil?
412
+ is_nullable = self.class.openapi_nullable.include?(attr)
413
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
414
+ end
415
+
416
+ hash[param] = _to_hash(value)
417
+ end
418
+ hash
419
+ end
420
+
421
+ # Outputs non-array value in the form of hash
422
+ # For object, use to_hash. Otherwise, just return the value
423
+ # @param [Object] value Any valid value
424
+ # @return [Hash] Returns the value in the form of hash
425
+ def _to_hash(value)
426
+ if value.is_a?(Array)
427
+ value.compact.map { |v| _to_hash(v) }
428
+ elsif value.is_a?(Hash)
429
+ {}.tap do |hash|
430
+ value.each { |k, v| hash[k] = _to_hash(v) }
431
+ end
432
+ elsif value.respond_to? :to_hash
433
+ value.to_hash
434
+ else
435
+ value
436
+ end
437
+ end
438
+
439
+ end
440
+ end