influxdb-client 1.5.0.pre.858 → 1.6.0.pre.963
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/CHANGELOG.md +10 -1
- data/README.md +1 -1
- data/bin/swagger.yml +940 -750
- data/lib/influxdb2/client/models/health_check.rb +22 -4
- data/lib/influxdb2/client/models/query.rb +18 -40
- data/lib/influxdb2/client/point.rb +8 -3
- data/lib/influxdb2/client/version.rb +1 -1
- data/lib/influxdb2/client/worker.rb +1 -1
- data/test/influxdb/point_test.rb +21 -0
- metadata +2 -2
@@ -22,6 +22,10 @@ module InfluxDB2
|
|
22
22
|
|
23
23
|
attr_accessor :status
|
24
24
|
|
25
|
+
attr_accessor :version
|
26
|
+
|
27
|
+
attr_accessor :commit
|
28
|
+
|
25
29
|
class EnumAttributeValidator
|
26
30
|
attr_reader :datatype
|
27
31
|
attr_reader :allowable_values
|
@@ -50,7 +54,9 @@ module InfluxDB2
|
|
50
54
|
:'name' => :'name',
|
51
55
|
:'message' => :'message',
|
52
56
|
:'checks' => :'checks',
|
53
|
-
:'status' => :'status'
|
57
|
+
:'status' => :'status',
|
58
|
+
:'version' => :'version',
|
59
|
+
:'commit' => :'commit'
|
54
60
|
}
|
55
61
|
end
|
56
62
|
|
@@ -60,7 +66,9 @@ module InfluxDB2
|
|
60
66
|
:'name' => :'String',
|
61
67
|
:'message' => :'String',
|
62
68
|
:'checks' => :'Array<HealthCheck>',
|
63
|
-
:'status' => :'String'
|
69
|
+
:'status' => :'String',
|
70
|
+
:'version' => :'String',
|
71
|
+
:'commit' => :'String'
|
64
72
|
}
|
65
73
|
end
|
66
74
|
|
@@ -89,6 +97,14 @@ module InfluxDB2
|
|
89
97
|
if attributes.has_key?(:'status')
|
90
98
|
self.status = attributes[:'status']
|
91
99
|
end
|
100
|
+
|
101
|
+
if attributes.has_key?(:'version')
|
102
|
+
self.version = attributes[:'version']
|
103
|
+
end
|
104
|
+
|
105
|
+
if attributes.has_key?(:'commit')
|
106
|
+
self.commit = attributes[:'commit']
|
107
|
+
end
|
92
108
|
end
|
93
109
|
|
94
110
|
# Show invalid properties with the reasons. Usually used together with valid?
|
@@ -134,7 +150,9 @@ module InfluxDB2
|
|
134
150
|
name == o.name &&
|
135
151
|
message == o.message &&
|
136
152
|
checks == o.checks &&
|
137
|
-
status == o.status
|
153
|
+
status == o.status &&
|
154
|
+
version == o.version &&
|
155
|
+
commit == o.commit
|
138
156
|
end
|
139
157
|
|
140
158
|
# @see the `==` method
|
@@ -146,7 +164,7 @@ module InfluxDB2
|
|
146
164
|
# Calculates hash code according to all attributes.
|
147
165
|
# @return [Fixnum] Hash code
|
148
166
|
def hash
|
149
|
-
[name, message, checks, status].hash
|
167
|
+
[name, message, checks, status, version, commit].hash
|
150
168
|
end
|
151
169
|
|
152
170
|
# Builds the object from hash
|
@@ -13,27 +13,21 @@ OpenAPI Generator version: 3.3.4
|
|
13
13
|
require 'date'
|
14
14
|
|
15
15
|
module InfluxDB2
|
16
|
-
# Query influx
|
16
|
+
# Query influx using the Flux language
|
17
17
|
class Query
|
18
18
|
attr_accessor :extern
|
19
19
|
|
20
20
|
# Query script to execute.
|
21
21
|
attr_accessor :query
|
22
22
|
|
23
|
-
# The type of query.
|
23
|
+
# The type of query. Must be \"flux\".
|
24
24
|
attr_accessor :type
|
25
25
|
|
26
|
-
# Required for `influxql` type queries.
|
27
|
-
attr_accessor :db
|
28
|
-
|
29
|
-
# Required for `influxql` type queries.
|
30
|
-
attr_accessor :rp
|
31
|
-
|
32
|
-
# Required for `influxql` type queries.
|
33
|
-
attr_accessor :cluster
|
34
|
-
|
35
26
|
attr_accessor :dialect
|
36
27
|
|
28
|
+
# Specifies the time that should be reported as \"now\" in the query. Default is the server's now time.
|
29
|
+
attr_accessor :now
|
30
|
+
|
37
31
|
class EnumAttributeValidator
|
38
32
|
attr_reader :datatype
|
39
33
|
attr_reader :allowable_values
|
@@ -62,10 +56,8 @@ module InfluxDB2
|
|
62
56
|
:'extern' => :'extern',
|
63
57
|
:'query' => :'query',
|
64
58
|
:'type' => :'type',
|
65
|
-
:'
|
66
|
-
:'
|
67
|
-
:'cluster' => :'cluster',
|
68
|
-
:'dialect' => :'dialect'
|
59
|
+
:'dialect' => :'dialect',
|
60
|
+
:'now' => :'now'
|
69
61
|
}
|
70
62
|
end
|
71
63
|
|
@@ -75,10 +67,8 @@ module InfluxDB2
|
|
75
67
|
:'extern' => :'File',
|
76
68
|
:'query' => :'String',
|
77
69
|
:'type' => :'String',
|
78
|
-
:'
|
79
|
-
:'
|
80
|
-
:'cluster' => :'String',
|
81
|
-
:'dialect' => :'Dialect'
|
70
|
+
:'dialect' => :'Dialect',
|
71
|
+
:'now' => :'DateTime'
|
82
72
|
}
|
83
73
|
end
|
84
74
|
|
@@ -100,25 +90,15 @@ module InfluxDB2
|
|
100
90
|
|
101
91
|
if attributes.has_key?(:'type')
|
102
92
|
self.type = attributes[:'type']
|
103
|
-
else
|
104
|
-
self.type = 'flux'
|
105
|
-
end
|
106
|
-
|
107
|
-
if attributes.has_key?(:'db')
|
108
|
-
self.db = attributes[:'db']
|
109
|
-
end
|
110
|
-
|
111
|
-
if attributes.has_key?(:'rp')
|
112
|
-
self.rp = attributes[:'rp']
|
113
|
-
end
|
114
|
-
|
115
|
-
if attributes.has_key?(:'cluster')
|
116
|
-
self.cluster = attributes[:'cluster']
|
117
93
|
end
|
118
94
|
|
119
95
|
if attributes.has_key?(:'dialect')
|
120
96
|
self.dialect = attributes[:'dialect']
|
121
97
|
end
|
98
|
+
|
99
|
+
if attributes.has_key?(:'now')
|
100
|
+
self.now = attributes[:'now']
|
101
|
+
end
|
122
102
|
end
|
123
103
|
|
124
104
|
# Show invalid properties with the reasons. Usually used together with valid?
|
@@ -136,7 +116,7 @@ module InfluxDB2
|
|
136
116
|
# @return true if the model is valid
|
137
117
|
def valid?
|
138
118
|
return false if @query.nil?
|
139
|
-
type_validator = EnumAttributeValidator.new('String', ['flux'
|
119
|
+
type_validator = EnumAttributeValidator.new('String', ['flux'])
|
140
120
|
return false unless type_validator.valid?(@type)
|
141
121
|
true
|
142
122
|
end
|
@@ -144,7 +124,7 @@ module InfluxDB2
|
|
144
124
|
# Custom attribute writer method checking allowed values (enum).
|
145
125
|
# @param [Object] type Object to be assigned
|
146
126
|
def type=(type)
|
147
|
-
validator = EnumAttributeValidator.new('String', ['flux'
|
127
|
+
validator = EnumAttributeValidator.new('String', ['flux'])
|
148
128
|
unless validator.valid?(type)
|
149
129
|
fail ArgumentError, 'invalid value for "type", must be one of #{validator.allowable_values}.'
|
150
130
|
end
|
@@ -159,10 +139,8 @@ module InfluxDB2
|
|
159
139
|
extern == o.extern &&
|
160
140
|
query == o.query &&
|
161
141
|
type == o.type &&
|
162
|
-
|
163
|
-
|
164
|
-
cluster == o.cluster &&
|
165
|
-
dialect == o.dialect
|
142
|
+
dialect == o.dialect &&
|
143
|
+
now == o.now
|
166
144
|
end
|
167
145
|
|
168
146
|
# @see the `==` method
|
@@ -174,7 +152,7 @@ module InfluxDB2
|
|
174
152
|
# Calculates hash code according to all attributes.
|
175
153
|
# @return [Fixnum] Hash code
|
176
154
|
def hash
|
177
|
-
[extern, query, type,
|
155
|
+
[extern, query, type, dialect, now].hash
|
178
156
|
end
|
179
157
|
|
180
158
|
# Builds the object from hash
|
@@ -21,6 +21,8 @@
|
|
21
21
|
module InfluxDB2
|
22
22
|
DEFAULT_WRITE_PRECISION = WritePrecision::NANOSECOND
|
23
23
|
ESCAPE_KEY_LIST = ['\\'.freeze, ','.freeze, ' '.freeze, '='.freeze].freeze
|
24
|
+
ESCAPE_MEASUREMENT_LIST = ['\\'.freeze, ','.freeze, ' '.freeze].freeze
|
25
|
+
REPLACE_KEY_LIST = { "\n".freeze => '\n'.freeze, "\r".freeze => '\r'.freeze, "\t".freeze => '\t'.freeze }.freeze
|
24
26
|
ESCAPE_VALUE_LIST = ['\\'.freeze, '"'.freeze].freeze
|
25
27
|
|
26
28
|
# Point defines the values that will be written to the database.
|
@@ -113,7 +115,7 @@ module InfluxDB2
|
|
113
115
|
# @return a string representation of the point
|
114
116
|
def to_line_protocol
|
115
117
|
line_protocol = ''
|
116
|
-
measurement = _escape_key(@name || '')
|
118
|
+
measurement = _escape_key(@name || '', ESCAPE_MEASUREMENT_LIST)
|
117
119
|
|
118
120
|
line_protocol << measurement
|
119
121
|
|
@@ -161,11 +163,14 @@ module InfluxDB2
|
|
161
163
|
end.reject(&:nil?).join(','.freeze)
|
162
164
|
end
|
163
165
|
|
164
|
-
def _escape_key(value)
|
166
|
+
def _escape_key(value, escape_list = ESCAPE_KEY_LIST)
|
165
167
|
result = value.dup
|
166
|
-
|
168
|
+
escape_list.each do |ch|
|
167
169
|
result = result.gsub(ch) { "\\#{ch}" }
|
168
170
|
end
|
171
|
+
REPLACE_KEY_LIST.keys.each do |ch|
|
172
|
+
result = result.gsub(ch) { REPLACE_KEY_LIST[ch] }
|
173
|
+
end
|
169
174
|
result
|
170
175
|
end
|
171
176
|
|
data/test/influxdb/point_test.rb
CHANGED
@@ -218,4 +218,25 @@ class PointTest < MiniTest::Test
|
|
218
218
|
|
219
219
|
assert_equal 'h2o level=2i 123', point.to_line_protocol
|
220
220
|
end
|
221
|
+
|
222
|
+
def test_tag_escaping
|
223
|
+
point = InfluxDB2::Point.new(name: "h\n2\ro\t_data")
|
224
|
+
.add_tag("new\nline", "new\nline")
|
225
|
+
.add_tag("carriage\rreturn", "carriage\nreturn")
|
226
|
+
.add_tag("t\tab", "t\tab")
|
227
|
+
.add_field('level', 2)
|
228
|
+
|
229
|
+
puts point.to_line_protocol
|
230
|
+
|
231
|
+
assert_equal 'h\\n2\\ro\\t_data,carriage\\rreturn=carriage\\nreturn,new\\nline=new\\nline,t\\tab=t\\tab level=2i',
|
232
|
+
point.to_line_protocol
|
233
|
+
end
|
234
|
+
|
235
|
+
def test_equal_sign_escaping
|
236
|
+
point = InfluxDB2::Point.new(name: 'h=2o')
|
237
|
+
.add_tag('l=ocation', 'e=urope')
|
238
|
+
.add_field('l=evel', 2)
|
239
|
+
|
240
|
+
assert_equal 'h=2o,l\\=ocation=e\\=urope l\\=evel=2i', point.to_line_protocol
|
241
|
+
end
|
221
242
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: influxdb-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.6.0.pre.963
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jakub Bednar
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-07-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|