influxdb-client 1.11.0.pre.1533 → 1.12.0.pre.1923

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,14 +3,15 @@
3
3
 
4
4
  #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
5
 
6
- OpenAPI spec version: 0.1.0
6
+ The version of the OpenAPI document: 0.1.0
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 3.3.4
9
+ OpenAPI Generator version: 5.0.0-beta3
10
10
 
11
11
  =end
12
12
 
13
13
  require 'date'
14
+ require 'time'
14
15
 
15
16
  module InfluxDB2
16
17
  class HealthCheck
@@ -20,7 +21,7 @@ module InfluxDB2
20
21
 
21
22
  attr_accessor :checks
22
23
 
23
- attr_accessor :status
24
+ attr_reader :status
24
25
 
25
26
  attr_accessor :version
26
27
 
@@ -48,7 +49,7 @@ module InfluxDB2
48
49
  end
49
50
  end
50
51
 
51
- # Attribute mapping from ruby-style variable name to JSON key.
52
+ # Attribute mapping from ruby-style variable name to JSON key
52
53
  def self.attribute_map
53
54
  {
54
55
  :'name' => :'name',
@@ -56,7 +57,7 @@ module InfluxDB2
56
57
  :'checks' => :'checks',
57
58
  :'status' => :'status',
58
59
  :'version' => :'version',
59
- :'commit' => :'commit'
60
+ :'commit' => :'commit',
60
61
  }
61
62
  end
62
63
 
@@ -68,41 +69,54 @@ module InfluxDB2
68
69
  :'checks' => :'Array<HealthCheck>',
69
70
  :'status' => :'String',
70
71
  :'version' => :'String',
71
- :'commit' => :'String'
72
+ :'commit' => :'String',
72
73
  }
73
74
  end
74
75
 
76
+ # List of attributes with nullable: true
77
+ def self.openapi_nullable
78
+ Set.new([
79
+ ])
80
+ end
81
+
75
82
  # Initializes the object
76
83
  # @param [Hash] attributes Model attributes in the form of hash
77
84
  def initialize(attributes = {})
78
- return unless attributes.is_a?(Hash)
85
+ if (!attributes.is_a?(Hash))
86
+ fail ArgumentError, "The input argument (attributes) must be a hash in `InfluxDB2::HealthCheck` initialize method"
87
+ end
79
88
 
80
- # convert string to symbol for hash key
81
- attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
89
+ # check to see if the attribute exists and convert string to symbol for hash key
90
+ attributes = attributes.each_with_object({}) { |(k, v), h|
91
+ if (!self.class.attribute_map.key?(k.to_sym))
92
+ fail ArgumentError, "`#{k}` is not a valid attribute in `InfluxDB2::HealthCheck`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
93
+ end
94
+ h[k.to_sym] = v
95
+ }
82
96
 
83
- if attributes.has_key?(:'name')
97
+ if attributes.key?(:'name')
84
98
  self.name = attributes[:'name']
85
99
  end
86
100
 
87
- if attributes.has_key?(:'message')
101
+ if attributes.key?(:'message')
88
102
  self.message = attributes[:'message']
89
103
  end
90
104
 
91
- if attributes.has_key?(:'checks')
105
+ if attributes.key?(:'checks')
92
106
  if (value = attributes[:'checks']).is_a?(Array)
93
107
  self.checks = value
94
108
  end
95
109
  end
96
110
 
97
- if attributes.has_key?(:'status')
111
+ if attributes.key?(:'status')
98
112
  self.status = attributes[:'status']
99
113
  end
100
114
 
101
- if attributes.has_key?(:'version')
115
+ if attributes.key?(:'version')
102
116
  self.version = attributes[:'version']
103
117
  end
104
118
 
105
- if attributes.has_key?(:'commit')
119
+ if attributes.key?(:'commit')
106
120
  self.commit = attributes[:'commit']
107
121
  end
108
122
  end
@@ -127,7 +141,7 @@ module InfluxDB2
127
141
  def valid?
128
142
  return false if @name.nil?
129
143
  return false if @status.nil?
130
- status_validator = EnumAttributeValidator.new('String', ['pass', 'fail'])
144
+ status_validator = EnumAttributeValidator.new('String', ["pass", "fail"])
131
145
  return false unless status_validator.valid?(@status)
132
146
  true
133
147
  end
@@ -135,9 +149,9 @@ module InfluxDB2
135
149
  # Custom attribute writer method checking allowed values (enum).
136
150
  # @param [Object] status Object to be assigned
137
151
  def status=(status)
138
- validator = EnumAttributeValidator.new('String', ['pass', 'fail'])
152
+ validator = EnumAttributeValidator.new('String', ["pass", "fail"])
139
153
  unless validator.valid?(status)
140
- fail ArgumentError, 'invalid value for "status", must be one of #{validator.allowable_values}.'
154
+ fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}."
141
155
  end
142
156
  @status = status
143
157
  end
@@ -162,9 +176,16 @@ module InfluxDB2
162
176
  end
163
177
 
164
178
  # Calculates hash code according to all attributes.
165
- # @return [Fixnum] Hash code
179
+ # @return [Integer] Hash code
166
180
  def hash
167
- [name, message, checks, status, version, commit].hash
181
+ [name, message, checks, status, version, commit, ].hash
182
+ end
183
+
184
+ # Builds the object from hash
185
+ # @param [Hash] attributes Model attributes in the form of hash
186
+ # @return [Object] Returns the model itself
187
+ def self.build_from_hash(attributes)
188
+ new.build_from_hash(attributes)
168
189
  end
169
190
 
170
191
  # Builds the object from hash
@@ -173,15 +194,17 @@ module InfluxDB2
173
194
  def build_from_hash(attributes)
174
195
  return nil unless attributes.is_a?(Hash)
175
196
  self.class.openapi_types.each_pair do |key, type|
176
- if type =~ /\AArray<(.*)>/i
177
- # check to ensure the input is an array given that the the attribute
197
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
198
+ self.send("#{key}=", nil)
199
+ elsif type =~ /\AArray<(.*)>/i
200
+ # check to ensure the input is an array given that the attribute
178
201
  # is documented as an array but the input is not
179
202
  if attributes[self.class.attribute_map[key]].is_a?(Array)
180
203
  self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
181
204
  end
182
205
  elsif !attributes[self.class.attribute_map[key]].nil?
183
206
  self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
184
- end # or else data not found in attributes(hash), not an issue as the data can be optional
207
+ end
185
208
  end
186
209
 
187
210
  self
@@ -193,8 +216,8 @@ module InfluxDB2
193
216
  # @return [Object] Deserialized data
194
217
  def _deserialize(type, value)
195
218
  case type.to_sym
196
- when :DateTime
197
- DateTime.parse(value)
219
+ when :Time
220
+ Time.parse(value)
198
221
  when :Date
199
222
  Date.parse(value)
200
223
  when :String
@@ -203,7 +226,7 @@ module InfluxDB2
203
226
  value.to_i
204
227
  when :Float
205
228
  value.to_f
206
- when :BOOLEAN
229
+ when :Boolean
207
230
  if value.to_s =~ /\A(true|t|yes|y|1)\z/i
208
231
  true
209
232
  else
@@ -224,8 +247,7 @@ module InfluxDB2
224
247
  end
225
248
  end
226
249
  else # model
227
- temp_model = InfluxDB2.const_get(type).new
228
- temp_model.build_from_hash(value)
250
+ InfluxDB2.const_get(type).build_from_hash(value)
229
251
  end
230
252
  end
231
253
 
@@ -247,7 +269,11 @@ module InfluxDB2
247
269
  hash = {}
248
270
  self.class.attribute_map.each_pair do |attr, param|
249
271
  value = self.send(attr)
250
- next if value.nil?
272
+ if value.nil?
273
+ is_nullable = self.class.openapi_nullable.include?(attr)
274
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
275
+ end
276
+
251
277
  hash[param] = _to_hash(value)
252
278
  end
253
279
  hash
@@ -270,5 +296,6 @@ module InfluxDB2
270
296
  value
271
297
  end
272
298
  end
299
+
273
300
  end
274
301
  end
@@ -3,14 +3,15 @@
3
3
 
4
4
  #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
5
 
6
- OpenAPI spec version: 0.1.0
6
+ The version of the OpenAPI document: 0.1.0
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 3.3.4
9
+ OpenAPI Generator version: 5.0.0-beta3
10
10
 
11
11
  =end
12
12
 
13
13
  require 'date'
14
+ require 'time'
14
15
 
15
16
  module InfluxDB2
16
17
  # Query influx using the Flux language
@@ -21,7 +22,7 @@ module InfluxDB2
21
22
  attr_accessor :query
22
23
 
23
24
  # The type of query. Must be \"flux\".
24
- attr_accessor :type
25
+ attr_reader :type
25
26
 
26
27
  attr_accessor :dialect
27
28
 
@@ -50,14 +51,14 @@ module InfluxDB2
50
51
  end
51
52
  end
52
53
 
53
- # Attribute mapping from ruby-style variable name to JSON key.
54
+ # Attribute mapping from ruby-style variable name to JSON key
54
55
  def self.attribute_map
55
56
  {
56
57
  :'extern' => :'extern',
57
58
  :'query' => :'query',
58
59
  :'type' => :'type',
59
60
  :'dialect' => :'dialect',
60
- :'now' => :'now'
61
+ :'now' => :'now',
61
62
  }
62
63
  end
63
64
 
@@ -68,35 +69,48 @@ module InfluxDB2
68
69
  :'query' => :'String',
69
70
  :'type' => :'String',
70
71
  :'dialect' => :'Dialect',
71
- :'now' => :'DateTime'
72
+ :'now' => :'Time',
72
73
  }
73
74
  end
74
75
 
76
+ # List of attributes with nullable: true
77
+ def self.openapi_nullable
78
+ Set.new([
79
+ ])
80
+ end
81
+
75
82
  # Initializes the object
76
83
  # @param [Hash] attributes Model attributes in the form of hash
77
84
  def initialize(attributes = {})
78
- return unless attributes.is_a?(Hash)
85
+ if (!attributes.is_a?(Hash))
86
+ fail ArgumentError, "The input argument (attributes) must be a hash in `InfluxDB2::Query` initialize method"
87
+ end
79
88
 
80
- # convert string to symbol for hash key
81
- attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
89
+ # check to see if the attribute exists and convert string to symbol for hash key
90
+ attributes = attributes.each_with_object({}) { |(k, v), h|
91
+ if (!self.class.attribute_map.key?(k.to_sym))
92
+ fail ArgumentError, "`#{k}` is not a valid attribute in `InfluxDB2::Query`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
93
+ end
94
+ h[k.to_sym] = v
95
+ }
82
96
 
83
- if attributes.has_key?(:'extern')
97
+ if attributes.key?(:'extern')
84
98
  self.extern = attributes[:'extern']
85
99
  end
86
100
 
87
- if attributes.has_key?(:'query')
101
+ if attributes.key?(:'query')
88
102
  self.query = attributes[:'query']
89
103
  end
90
104
 
91
- if attributes.has_key?(:'type')
105
+ if attributes.key?(:'type')
92
106
  self.type = attributes[:'type']
93
107
  end
94
108
 
95
- if attributes.has_key?(:'dialect')
109
+ if attributes.key?(:'dialect')
96
110
  self.dialect = attributes[:'dialect']
97
111
  end
98
112
 
99
- if attributes.has_key?(:'now')
113
+ if attributes.key?(:'now')
100
114
  self.now = attributes[:'now']
101
115
  end
102
116
  end
@@ -116,7 +130,7 @@ module InfluxDB2
116
130
  # @return true if the model is valid
117
131
  def valid?
118
132
  return false if @query.nil?
119
- type_validator = EnumAttributeValidator.new('String', ['flux'])
133
+ type_validator = EnumAttributeValidator.new('String', ["flux"])
120
134
  return false unless type_validator.valid?(@type)
121
135
  true
122
136
  end
@@ -124,9 +138,9 @@ module InfluxDB2
124
138
  # Custom attribute writer method checking allowed values (enum).
125
139
  # @param [Object] type Object to be assigned
126
140
  def type=(type)
127
- validator = EnumAttributeValidator.new('String', ['flux'])
141
+ validator = EnumAttributeValidator.new('String', ["flux"])
128
142
  unless validator.valid?(type)
129
- fail ArgumentError, 'invalid value for "type", must be one of #{validator.allowable_values}.'
143
+ fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
130
144
  end
131
145
  @type = type
132
146
  end
@@ -150,9 +164,16 @@ module InfluxDB2
150
164
  end
151
165
 
152
166
  # Calculates hash code according to all attributes.
153
- # @return [Fixnum] Hash code
167
+ # @return [Integer] Hash code
154
168
  def hash
155
- [extern, query, type, dialect, now].hash
169
+ [extern, query, type, dialect, now, ].hash
170
+ end
171
+
172
+ # Builds the object from hash
173
+ # @param [Hash] attributes Model attributes in the form of hash
174
+ # @return [Object] Returns the model itself
175
+ def self.build_from_hash(attributes)
176
+ new.build_from_hash(attributes)
156
177
  end
157
178
 
158
179
  # Builds the object from hash
@@ -161,15 +182,17 @@ module InfluxDB2
161
182
  def build_from_hash(attributes)
162
183
  return nil unless attributes.is_a?(Hash)
163
184
  self.class.openapi_types.each_pair do |key, type|
164
- if type =~ /\AArray<(.*)>/i
165
- # check to ensure the input is an array given that the the attribute
185
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
186
+ self.send("#{key}=", nil)
187
+ elsif type =~ /\AArray<(.*)>/i
188
+ # check to ensure the input is an array given that the attribute
166
189
  # is documented as an array but the input is not
167
190
  if attributes[self.class.attribute_map[key]].is_a?(Array)
168
191
  self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
169
192
  end
170
193
  elsif !attributes[self.class.attribute_map[key]].nil?
171
194
  self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
172
- end # or else data not found in attributes(hash), not an issue as the data can be optional
195
+ end
173
196
  end
174
197
 
175
198
  self
@@ -181,8 +204,8 @@ module InfluxDB2
181
204
  # @return [Object] Deserialized data
182
205
  def _deserialize(type, value)
183
206
  case type.to_sym
184
- when :DateTime
185
- DateTime.parse(value)
207
+ when :Time
208
+ Time.parse(value)
186
209
  when :Date
187
210
  Date.parse(value)
188
211
  when :String
@@ -191,7 +214,7 @@ module InfluxDB2
191
214
  value.to_i
192
215
  when :Float
193
216
  value.to_f
194
- when :BOOLEAN
217
+ when :Boolean
195
218
  if value.to_s =~ /\A(true|t|yes|y|1)\z/i
196
219
  true
197
220
  else
@@ -212,8 +235,7 @@ module InfluxDB2
212
235
  end
213
236
  end
214
237
  else # model
215
- temp_model = InfluxDB2.const_get(type).new
216
- temp_model.build_from_hash(value)
238
+ InfluxDB2.const_get(type).build_from_hash(value)
217
239
  end
218
240
  end
219
241
 
@@ -235,7 +257,11 @@ module InfluxDB2
235
257
  hash = {}
236
258
  self.class.attribute_map.each_pair do |attr, param|
237
259
  value = self.send(attr)
238
- next if value.nil?
260
+ if value.nil?
261
+ is_nullable = self.class.openapi_nullable.include?(attr)
262
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
263
+ end
264
+
239
265
  hash[param] = _to_hash(value)
240
266
  end
241
267
  hash
@@ -258,5 +284,6 @@ module InfluxDB2
258
284
  value
259
285
  end
260
286
  end
287
+
261
288
  end
262
289
  end
@@ -19,5 +19,5 @@
19
19
  # THE SOFTWARE.
20
20
 
21
21
  module InfluxDB2
22
- VERSION = '1.11.0'.freeze
22
+ VERSION = '1.12.0'.freeze
23
23
  end
@@ -57,4 +57,33 @@ class DefaultApiTest < MiniTest::Test
57
57
 
58
58
  @api.log(:info, 'without error')
59
59
  end
60
+
61
+ def test_default_verify_mode
62
+ http_client = @api.send(:_prepare_http_client, URI.parse('https://localhost:8086'))
63
+
64
+ refute_nil http_client
65
+ assert_nil http_client.verify_mode
66
+
67
+ http_client.finish if http_client.started?
68
+ end
69
+
70
+ def test_default_verify_mode_none
71
+ @api = InfluxDB2::DefaultApi.new(options: { logger: @logger, verify_mode: OpenSSL::SSL::VERIFY_NONE })
72
+ http_client = @api.send(:_prepare_http_client, URI.parse('https://localhost:8086'))
73
+
74
+ refute_nil http_client
75
+ assert_equal OpenSSL::SSL::VERIFY_NONE, http_client.verify_mode
76
+
77
+ http_client.finish if http_client.started?
78
+ end
79
+
80
+ def test_default_verify_mode_peer
81
+ @api = InfluxDB2::DefaultApi.new(options: { logger: @logger, verify_mode: OpenSSL::SSL::VERIFY_PEER })
82
+ http_client = @api.send(:_prepare_http_client, URI.parse('https://localhost:8086'))
83
+
84
+ refute_nil http_client
85
+ assert_equal OpenSSL::SSL::VERIFY_PEER, http_client.verify_mode
86
+
87
+ http_client.finish if http_client.started?
88
+ end
60
89
  end