diplomat 2.2.6 → 2.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/features/step_definitions/setup_diplomat.rb +2 -0
- data/features/step_definitions/test_key_value.rb +2 -0
- data/lib/diplomat.rb +2 -0
- data/lib/diplomat/acl.rb +4 -2
- data/lib/diplomat/agent.rb +2 -0
- data/lib/diplomat/check.rb +4 -2
- data/lib/diplomat/configuration.rb +2 -0
- data/lib/diplomat/datacenter.rb +2 -0
- data/lib/diplomat/error.rb +2 -0
- data/lib/diplomat/event.rb +4 -2
- data/lib/diplomat/health.rb +4 -2
- data/lib/diplomat/kv.rb +6 -4
- data/lib/diplomat/lock.rb +4 -2
- data/lib/diplomat/maintenance.rb +2 -0
- data/lib/diplomat/members.rb +2 -0
- data/lib/diplomat/node.rb +2 -0
- data/lib/diplomat/nodes.rb +2 -0
- data/lib/diplomat/policy.rb +6 -4
- data/lib/diplomat/query.rb +4 -2
- data/lib/diplomat/rest_client.rb +10 -8
- data/lib/diplomat/role.rb +8 -6
- data/lib/diplomat/service.rb +4 -2
- data/lib/diplomat/session.rb +2 -0
- data/lib/diplomat/status.rb +2 -0
- data/lib/diplomat/token.rb +4 -2
- data/lib/diplomat/version.rb +3 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c1484b11f450e8df4d3220d2ea3112682afd20848f43f9bc84f3be07629edd2f
|
4
|
+
data.tar.gz: b676fcde876ba6ecb17404436aa3a8c6730a68ec1d07bab51bbfa0e21473bfb8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c5b5db54f6e827ccfeb79a5906f731d68865a506d176dbb6b7a2c45a3f1096f2a4699c5ee4fd3885ab98d8d14b93752f137b32f4159895cafdbfe7157972f865
|
7
|
+
data.tar.gz: 8b7a2db51a0a83d9f01149d4251713d8097477688a4b84eb323c84857aa7a2c1449d365292aa2d73be46f756457547de5ce9ff2fbe703550500b707ec02eeaa6
|
data/lib/diplomat.rb
CHANGED
data/lib/diplomat/acl.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Diplomat
|
2
4
|
# Methods for interacting with the Consul ACL API endpoint
|
3
5
|
class Acl < Diplomat::RestClient
|
@@ -8,7 +10,7 @@ module Diplomat
|
|
8
10
|
# @param id [String] ID of the Acl to get
|
9
11
|
# @param options [Hash] options parameter hash
|
10
12
|
# @return [Hash]
|
11
|
-
# rubocop:disable PerceivedComplexity
|
13
|
+
# rubocop:disable Metrics/PerceivedComplexity
|
12
14
|
def info(id, options = {}, not_found = :reject, found = :return)
|
13
15
|
@id = id
|
14
16
|
@options = options
|
@@ -36,7 +38,7 @@ module Diplomat
|
|
36
38
|
raise Diplomat::UnknownStatus, "status #{raw.status}: #{raw.body}"
|
37
39
|
end
|
38
40
|
end
|
39
|
-
# rubocop:enable PerceivedComplexity
|
41
|
+
# rubocop:enable Metrics/PerceivedComplexity
|
40
42
|
|
41
43
|
# List all Acls
|
42
44
|
# @param options [Hash] options parameter hash
|
data/lib/diplomat/agent.rb
CHANGED
data/lib/diplomat/check.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Diplomat
|
2
4
|
# Methods for interacting with the Consul check API endpoint
|
3
5
|
class Check < Diplomat::RestClient
|
@@ -19,7 +21,7 @@ module Diplomat
|
|
19
21
|
# @param interval [String] frequency (with units) of the check execution
|
20
22
|
# @param options [Hash] options parameter hash
|
21
23
|
# @return [Integer] Status code
|
22
|
-
# rubocop:disable ParameterLists
|
24
|
+
# rubocop:disable Metrics/ParameterLists
|
23
25
|
def register_script(check_id, name, notes, args, interval, options = {})
|
24
26
|
unless args.is_a?(Array)
|
25
27
|
raise(Diplomat::DeprecatedArgument, 'Script usage is deprecated, replace by an array of args')
|
@@ -35,7 +37,7 @@ module Diplomat
|
|
35
37
|
ret = send_put_request(@conn, ['/v1/agent/check/register'], options, definition)
|
36
38
|
ret.status == 200
|
37
39
|
end
|
38
|
-
# rubocop:enable ParameterLists
|
40
|
+
# rubocop:enable Metrics/ParameterLists
|
39
41
|
|
40
42
|
# Register a TTL check
|
41
43
|
# @param check_id [String] the unique id of the check
|
data/lib/diplomat/datacenter.rb
CHANGED
data/lib/diplomat/error.rb
CHANGED
data/lib/diplomat/event.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Diplomat
|
2
4
|
# Methods for interacting with the Consul event API endpoint
|
3
5
|
class Event < Diplomat::RestClient
|
@@ -102,7 +104,7 @@ module Diplomat
|
|
102
104
|
# middle, though these can only be identified relative to the preceding
|
103
105
|
# event. However, this is ideal for iterating through the sequence of
|
104
106
|
# events (while being sure that none are missed).
|
105
|
-
# rubocop:disable PerceivedComplexity
|
107
|
+
# rubocop:disable Metrics/PerceivedComplexity
|
106
108
|
def get(name = nil, token = :last, not_found = :wait, found = :return, options = {})
|
107
109
|
@raw = send_get_request(@conn, ['/v1/event/list'], options, use_named_parameter('name', name))
|
108
110
|
body = JSON.parse(@raw.body)
|
@@ -148,7 +150,7 @@ module Diplomat
|
|
148
150
|
token: event_token
|
149
151
|
}
|
150
152
|
end
|
151
|
-
# rubocop:enable PerceivedComplexity
|
153
|
+
# rubocop:enable Metrics/PerceivedComplexity
|
152
154
|
|
153
155
|
private
|
154
156
|
|
data/lib/diplomat/health.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Diplomat
|
2
4
|
# Methods for interacting with the Consul health API endpoint
|
3
5
|
class Health < Diplomat::RestClient
|
@@ -32,7 +34,7 @@ module Diplomat
|
|
32
34
|
# @param s [String] the service
|
33
35
|
# @param options [Hash] options parameter hash
|
34
36
|
# @return [OpenStruct] all data associated with the node
|
35
|
-
# rubocop:disable PerceivedComplexity
|
37
|
+
# rubocop:disable Metrics/PerceivedComplexity
|
36
38
|
def service(s, options = {})
|
37
39
|
custom_params = []
|
38
40
|
custom_params << use_named_parameter('dc', options[:dc]) if options[:dc]
|
@@ -43,7 +45,7 @@ module Diplomat
|
|
43
45
|
ret = send_get_request(@conn, ["/v1/health/service/#{s}"], options, custom_params)
|
44
46
|
JSON.parse(ret.body).map { |service| OpenStruct.new service }
|
45
47
|
end
|
46
|
-
# rubocop:enable PerceivedComplexity
|
48
|
+
# rubocop:enable Metrics/PerceivedComplexity
|
47
49
|
|
48
50
|
# Get service health
|
49
51
|
# @param s [String] the state ("any", "passing", "warning", or "critical")
|
data/lib/diplomat/kv.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Diplomat
|
2
4
|
# Methods for interacting with the Consul KV API endpoint
|
3
5
|
class Kv < Diplomat::RestClient
|
@@ -40,7 +42,7 @@ module Diplomat
|
|
40
42
|
# - W R - get the first or current value; always return something, but
|
41
43
|
# block only when necessary
|
42
44
|
# - W W - get the first or next value; wait until there is an update
|
43
|
-
# rubocop:disable PerceivedComplexity, MethodLength, LineLength, CyclomaticComplexity
|
45
|
+
# rubocop:disable Metrics/PerceivedComplexity, Metrics/MethodLength, Layout/LineLength, Metrics/CyclomaticComplexity
|
44
46
|
def get(key, options = {}, not_found = :reject, found = :return)
|
45
47
|
@options = options
|
46
48
|
return_nil_values = @options && @options[:nil_values]
|
@@ -81,7 +83,7 @@ module Diplomat
|
|
81
83
|
@raw = parse_body
|
82
84
|
return_value(return_nil_values, transformation)
|
83
85
|
end
|
84
|
-
# rubocop:enable PerceivedComplexity, LineLength, MethodLength, CyclomaticComplexity
|
86
|
+
# rubocop:enable Metrics/PerceivedComplexity, Layout/LineLength, Metrics/MethodLength, Metrics/CyclomaticComplexity
|
85
87
|
|
86
88
|
# Get all keys recursively, potentially blocking for the first or next value
|
87
89
|
# @param key [String] the key
|
@@ -100,7 +102,7 @@ module Diplomat
|
|
100
102
|
# @param found [Symbol] behaviour if the key does exist;
|
101
103
|
# :reject with exception, :return its current value, or :wait for its next value
|
102
104
|
# @return [List] List of hashes, one hash for each key-value returned
|
103
|
-
# rubocop:disable PerceivedComplexity, MethodLength, LineLength, CyclomaticComplexity
|
105
|
+
# rubocop:disable Metrics/PerceivedComplexity, Metrics/MethodLength, Layout/LineLength, Metrics/CyclomaticComplexity
|
104
106
|
def get_all(key, options = {}, not_found = :reject, found = :return)
|
105
107
|
@options = options
|
106
108
|
@options[:recurse] = true
|
@@ -140,7 +142,7 @@ module Diplomat
|
|
140
142
|
@raw = parse_body
|
141
143
|
return_value(return_nil_values, transformation, true)
|
142
144
|
end
|
143
|
-
# rubocop:enable PerceivedComplexity, MethodLength, LineLength, CyclomaticComplexity
|
145
|
+
# rubocop:enable Metrics/PerceivedComplexity, Metrics/MethodLength, Layout/LineLength, Metrics/CyclomaticComplexity
|
144
146
|
|
145
147
|
# Associate a value with a key
|
146
148
|
# @param key [String] the key
|
data/lib/diplomat/lock.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Diplomat
|
2
4
|
# Methods for interacting with the Consul lock API endpoint
|
3
5
|
class Lock < Diplomat::RestClient
|
@@ -41,7 +43,7 @@ module Diplomat
|
|
41
43
|
# @param session [String] the session, generated from Diplomat::Session.create
|
42
44
|
# @param options [Hash] :dc string for dc specific query
|
43
45
|
# @return [nil]
|
44
|
-
# rubocop:disable AbcSize
|
46
|
+
# rubocop:disable Metrics/AbcSize
|
45
47
|
def release(key, session, options = {})
|
46
48
|
key = normalize_key_for_uri(key)
|
47
49
|
custom_params = []
|
@@ -51,6 +53,6 @@ module Diplomat
|
|
51
53
|
raw = send_put_request(@conn, ["/v1/kv/#{key}"], options, nil, custom_params)
|
52
54
|
raw.body
|
53
55
|
end
|
54
|
-
# rubocop:enable AbcSize
|
56
|
+
# rubocop:enable Metrics/AbcSize
|
55
57
|
end
|
56
58
|
end
|
data/lib/diplomat/maintenance.rb
CHANGED
data/lib/diplomat/members.rb
CHANGED
data/lib/diplomat/node.rb
CHANGED
data/lib/diplomat/nodes.rb
CHANGED
data/lib/diplomat/policy.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Diplomat
|
2
4
|
# Methods for interacting with the Consul ACL Policy API endpoint
|
3
5
|
class Policy < Diplomat::RestClient
|
@@ -8,7 +10,7 @@ module Diplomat
|
|
8
10
|
# @param id [String] UUID of the ACL policy to read
|
9
11
|
# @param options [Hash] options parameter hash
|
10
12
|
# @return [Hash] existing ACL policy
|
11
|
-
# rubocop:disable PerceivedComplexity
|
13
|
+
# rubocop:disable Metrics/PerceivedComplexity
|
12
14
|
def read(id, options = {}, not_found = :reject, found = :return)
|
13
15
|
@options = options
|
14
16
|
custom_params = []
|
@@ -41,7 +43,7 @@ module Diplomat
|
|
41
43
|
raise Diplomat::UnknownStatus, "status #{@raw.status}: #{@raw.body}"
|
42
44
|
end
|
43
45
|
end
|
44
|
-
# rubocop:enable PerceivedComplexity
|
46
|
+
# rubocop:enable Metrics/PerceivedComplexity
|
45
47
|
|
46
48
|
# List all the ACL policies
|
47
49
|
# @param options [Hash] options parameter hash
|
@@ -89,7 +91,7 @@ module Diplomat
|
|
89
91
|
custom_params = use_cas(@options)
|
90
92
|
@raw = send_put_request(@conn, ['/v1/acl/policy'], options, value, custom_params)
|
91
93
|
|
92
|
-
# rubocop:disable GuardClause
|
94
|
+
# rubocop:disable Style/GuardClause
|
93
95
|
if @raw.status == 200
|
94
96
|
return parse_body
|
95
97
|
elsif @raw.status == 500 && @raw.body.chomp.include?('already exists')
|
@@ -98,7 +100,7 @@ module Diplomat
|
|
98
100
|
raise Diplomat::UnknownStatus, "status #{@raw.status}: #{@raw.body}"
|
99
101
|
end
|
100
102
|
end
|
101
|
-
# rubocop:enable GuardClause
|
103
|
+
# rubocop:enable Style/GuardClause
|
102
104
|
|
103
105
|
# Delete an ACL policy by its UUID
|
104
106
|
# @param id [String] UUID of the ACL policy to delete
|
data/lib/diplomat/query.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Diplomat
|
2
4
|
# Methods for interacting with the Consul query API endpoint
|
3
5
|
class Query < Diplomat::RestClient
|
@@ -63,7 +65,7 @@ module Diplomat
|
|
63
65
|
# estimated round trip time from that node
|
64
66
|
# @option limit [Integer] to limit the size of the return list to the given number of results
|
65
67
|
# @return [OpenStruct] the list of results from the prepared query or prepared query template
|
66
|
-
# rubocop:disable PerceivedComplexity
|
68
|
+
# rubocop:disable Metrics/PerceivedComplexity
|
67
69
|
def execute(key, options = {})
|
68
70
|
custom_params = []
|
69
71
|
custom_params << use_named_parameter('dc', options[:dc]) if options[:dc]
|
@@ -72,7 +74,7 @@ module Diplomat
|
|
72
74
|
ret = send_get_request(@conn, ["/v1/query/#{key}/execute"], options, custom_params)
|
73
75
|
OpenStruct.new JSON.parse(ret.body)
|
74
76
|
end
|
75
|
-
# rubocop:enable PerceivedComplexity
|
77
|
+
# rubocop:enable Metrics/PerceivedComplexity
|
76
78
|
|
77
79
|
# Get the fully rendered query template
|
78
80
|
# @param key [String] the prepared query ID or name
|
data/lib/diplomat/rest_client.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'deep_merge'
|
2
4
|
|
3
5
|
module Diplomat
|
@@ -172,7 +174,7 @@ module Diplomat
|
|
172
174
|
end
|
173
175
|
|
174
176
|
# Get the key/value(s) from the raw output
|
175
|
-
# rubocop:disable PerceivedComplexity
|
177
|
+
# rubocop:disable Metrics/PerceivedComplexity
|
176
178
|
def return_value(nil_values = false, transformation = nil, return_hash = false)
|
177
179
|
@value = decode_values
|
178
180
|
return @value if @value.first.is_a? String
|
@@ -188,7 +190,7 @@ module Diplomat
|
|
188
190
|
end.compact
|
189
191
|
end
|
190
192
|
end
|
191
|
-
# rubocop:enable PerceivedComplexity
|
193
|
+
# rubocop:enable Metrics/PerceivedComplexity
|
192
194
|
|
193
195
|
# Get the name and payload(s) from the raw output
|
194
196
|
def return_payload
|
@@ -206,7 +208,7 @@ module Diplomat
|
|
206
208
|
options[:consistency] ? [options[:consistency].to_s] : []
|
207
209
|
end
|
208
210
|
|
209
|
-
# rubocop:disable PerceivedComplexity
|
211
|
+
# rubocop:disable Metrics/PerceivedComplexity
|
210
212
|
# TODO: Migrate all custom params in options
|
211
213
|
def parse_options(options)
|
212
214
|
headers = nil
|
@@ -228,7 +230,7 @@ module Diplomat
|
|
228
230
|
url_prefix = options[:http_addr] if options[:http_addr]
|
229
231
|
{ query_params: query_params, headers: headers, url_prefix: url_prefix }
|
230
232
|
end
|
231
|
-
# rubocop:enable PerceivedComplexity
|
233
|
+
# rubocop:enable Metrics/PerceivedComplexity
|
232
234
|
|
233
235
|
def send_get_request(connection, url, options, custom_params = nil)
|
234
236
|
rest_options = parse_options(options)
|
@@ -238,7 +240,7 @@ module Diplomat
|
|
238
240
|
connection.get do |req|
|
239
241
|
req.options[:params_encoder] = options[:params_encoder] if options[:params_encoder]
|
240
242
|
req.url rest_options[:url_prefix] ? rest_options[:url_prefix] + concat_url(url) : concat_url(url)
|
241
|
-
rest_options[:headers]
|
243
|
+
rest_options[:headers]&.map { |k, v| req.headers[k.to_sym] = v }
|
242
244
|
req.options.timeout = options[:timeout] if options[:timeout]
|
243
245
|
end
|
244
246
|
rescue Faraday::ClientError, Faraday::ServerError => e
|
@@ -256,7 +258,7 @@ module Diplomat
|
|
256
258
|
url += custom_params unless custom_params.nil?
|
257
259
|
connection.put do |req|
|
258
260
|
req.url rest_options[:url_prefix] ? rest_options[:url_prefix] + concat_url(url) : concat_url(url)
|
259
|
-
rest_options[:headers]
|
261
|
+
rest_options[:headers]&.map { |k, v| req.headers[k.to_sym] = v }
|
260
262
|
unless data.nil?
|
261
263
|
(req.headers || {})['Content-Type'] = mime
|
262
264
|
req.body = if mime == 'application/json' && !data.is_a?(String)
|
@@ -274,7 +276,7 @@ module Diplomat
|
|
274
276
|
url += custom_params unless custom_params.nil?
|
275
277
|
connection.post do |req|
|
276
278
|
req.url rest_options[:url_prefix] ? rest_options[:url_prefix] + concat_url(url) : concat_url(url)
|
277
|
-
rest_options[:headers]
|
279
|
+
rest_options[:headers]&.map { |k, v| req.headers[k.to_sym] = v }
|
278
280
|
req.body = JSON.dump(data) unless data.nil?
|
279
281
|
end
|
280
282
|
end
|
@@ -285,7 +287,7 @@ module Diplomat
|
|
285
287
|
url += custom_params unless custom_params.nil?
|
286
288
|
connection.delete do |req|
|
287
289
|
req.url rest_options[:url_prefix] ? rest_options[:url_prefix] + concat_url(url) : concat_url(url)
|
288
|
-
rest_options[:headers]
|
290
|
+
rest_options[:headers]&.map { |k, v| req.headers[k.to_sym] = v }
|
289
291
|
end
|
290
292
|
end
|
291
293
|
|
data/lib/diplomat/role.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Diplomat
|
2
4
|
# Methods for interacting with the Consul ACL Role API endpoint
|
3
5
|
class Role < Diplomat::RestClient
|
@@ -8,7 +10,7 @@ module Diplomat
|
|
8
10
|
# @param id [String] UUID or name of the ACL role to read
|
9
11
|
# @param options [Hash] options parameter hash
|
10
12
|
# @return [Hash] existing ACL role
|
11
|
-
# rubocop:disable PerceivedComplexity
|
13
|
+
# rubocop:disable Metrics/PerceivedComplexity
|
12
14
|
def read(id, options = {}, not_found = :reject, found = :return)
|
13
15
|
@options = options
|
14
16
|
custom_params = []
|
@@ -41,13 +43,13 @@ module Diplomat
|
|
41
43
|
raise Diplomat::UnknownStatus, "status #{@raw.status}: #{@raw.body}"
|
42
44
|
end
|
43
45
|
end
|
44
|
-
# rubocop:enable PerceivedComplexity
|
46
|
+
# rubocop:enable Metrics/PerceivedComplexity
|
45
47
|
|
46
48
|
# Read ACL role with the given name
|
47
49
|
# @param name [String] name of the ACL role to read
|
48
50
|
# @param options [Hash] options parameter hash
|
49
51
|
# @return [Hash] existing ACL role
|
50
|
-
# rubocop:disable PerceivedComplexity
|
52
|
+
# rubocop:disable Metrics/PerceivedComplexity
|
51
53
|
def read_name(name, options = {}, not_found = :reject, found = :return)
|
52
54
|
@options = options
|
53
55
|
custom_params = []
|
@@ -80,7 +82,7 @@ module Diplomat
|
|
80
82
|
raise Diplomat::UnknownStatus, "status #{@raw.status}: #{@raw.body}"
|
81
83
|
end
|
82
84
|
end
|
83
|
-
# rubocop:enable PerceivedComplexity
|
85
|
+
# rubocop:enable Metrics/PerceivedComplexity
|
84
86
|
|
85
87
|
# List all the ACL roles
|
86
88
|
# @param options [Hash] options parameter hash
|
@@ -128,7 +130,7 @@ module Diplomat
|
|
128
130
|
custom_params = use_cas(@options)
|
129
131
|
@raw = send_put_request(@conn, ['/v1/acl/role'], options, value, custom_params)
|
130
132
|
|
131
|
-
# rubocop:disable GuardClause
|
133
|
+
# rubocop:disable Style/GuardClause
|
132
134
|
if @raw.status == 200
|
133
135
|
return parse_body
|
134
136
|
elsif @raw.status == 500 && @raw.body.chomp.include?('already exists')
|
@@ -137,7 +139,7 @@ module Diplomat
|
|
137
139
|
raise Diplomat::UnknownStatus, "status #{@raw.status}: #{@raw.body}"
|
138
140
|
end
|
139
141
|
end
|
140
|
-
# rubocop:enable GuardClause
|
142
|
+
# rubocop:enable Style/GuardClause
|
141
143
|
|
142
144
|
# Delete an ACL role by its UUID
|
143
145
|
# @param id [String] UUID of the ACL role to delete
|
data/lib/diplomat/service.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Diplomat
|
2
4
|
# Methods for interacting with the Consul service API endpoint.
|
3
5
|
class Service < Diplomat::RestClient
|
@@ -9,7 +11,7 @@ module Diplomat
|
|
9
11
|
# @param options [Hash] options parameter hash
|
10
12
|
# @param meta [Hash] output structure containing header information about the request (index)
|
11
13
|
# @return [OpenStruct] all data associated with the service
|
12
|
-
# rubocop:disable PerceivedComplexity
|
14
|
+
# rubocop:disable Metrics/PerceivedComplexity
|
13
15
|
def get(key, scope = :first, options = {}, meta = nil)
|
14
16
|
custom_params = []
|
15
17
|
custom_params << use_named_parameter('wait', options[:wait]) if options[:wait]
|
@@ -44,7 +46,7 @@ module Diplomat
|
|
44
46
|
OpenStruct.new JSON.parse(ret.body).first
|
45
47
|
end
|
46
48
|
end
|
47
|
-
# rubocop:enable PerceivedComplexity
|
49
|
+
# rubocop:enable Metrics/PerceivedComplexity
|
48
50
|
|
49
51
|
# Get all the services
|
50
52
|
# @param options [Hash] :dc Consul datacenter to query
|
data/lib/diplomat/session.rb
CHANGED
data/lib/diplomat/status.rb
CHANGED
data/lib/diplomat/token.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Diplomat
|
2
4
|
# Methods for interacting with the Consul ACL Policy API endpoint
|
3
5
|
class Token < Diplomat::RestClient
|
@@ -8,7 +10,7 @@ module Diplomat
|
|
8
10
|
# @param id [String] accessor ID of the ACL token to read
|
9
11
|
# @param options [Hash] options parameter hash
|
10
12
|
# @return [Hash] existing ACL token
|
11
|
-
# rubocop:disable PerceivedComplexity
|
13
|
+
# rubocop:disable Metrics/PerceivedComplexity
|
12
14
|
def read(id, options = {}, not_found = :reject, found = :return)
|
13
15
|
@options = options
|
14
16
|
custom_params = []
|
@@ -34,7 +36,7 @@ module Diplomat
|
|
34
36
|
raise Diplomat::UnknownStatus, "status #{@raw.status}: #{@raw.body}"
|
35
37
|
end
|
36
38
|
end
|
37
|
-
# rubocop:enable PerceivedComplexity
|
39
|
+
# rubocop:enable Metrics/PerceivedComplexity
|
38
40
|
|
39
41
|
# List all the ACL tokens
|
40
42
|
# @param policy [String] filters the token list matching the specific policy ID
|
data/lib/diplomat/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: diplomat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Hamelink
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2020-02-
|
12
|
+
date: 2020-02-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -149,14 +149,14 @@ dependencies:
|
|
149
149
|
requirements:
|
150
150
|
- - "~>"
|
151
151
|
- !ruby/object:Gem::Version
|
152
|
-
version: 0.
|
152
|
+
version: 0.80.0
|
153
153
|
type: :development
|
154
154
|
prerelease: false
|
155
155
|
version_requirements: !ruby/object:Gem::Requirement
|
156
156
|
requirements:
|
157
157
|
- - "~>"
|
158
158
|
- !ruby/object:Gem::Version
|
159
|
-
version: 0.
|
159
|
+
version: 0.80.0
|
160
160
|
- !ruby/object:Gem::Dependency
|
161
161
|
name: webmock
|
162
162
|
requirement: !ruby/object:Gem::Requirement
|