diplomat 2.6.3 → 2.6.5
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/README.md +7 -0
- data/lib/diplomat/agent.rb +1 -0
- data/lib/diplomat/raft.rb +29 -0
- data/lib/diplomat/service.rb +1 -0
- data/lib/diplomat/version.rb +1 -1
- data/lib/diplomat.rb +1 -1
- metadata +17 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 526878104b09fabb0aac9c64db3983485630855a429ee3283611bec330ae0f10
|
4
|
+
data.tar.gz: 81e7b2dab98f792a50438d86666393890ab3f44ff2b52669ab06487d108edd81
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bef9779ba03b2fd79cfcd64a6eb00e7296408bf9810acb1a205d62e2b0c14f8cf350f0c19fd33ef1d9e782e82d014fad9ac270e7bf860ba5cb77f4427e2af9b1
|
7
|
+
data.tar.gz: cae668418109f22ac81fdb15f121eb657e37dfee4db75f2429034c7b0dbde6253691eebcbe72947523099d4f0d5f91c4a70b50eab4c0758bb25e766f3143bb08
|
data/README.md
CHANGED
@@ -196,6 +196,13 @@ foo_service = Diplomat::Service.get('foo', :all, { :dc => 'My_Datacenter'})
|
|
196
196
|
# => [#<OpenStruct Node="hotel", Address="1.2.3.4", ServiceID="hotel_foo", ServiceName="foo", ServiceTags=["foo"], ServicePort=5432>,#<OpenStruct Node="indigo", Address="1.2.3.5", ServiceID="indigo_foo", ServiceName="foo", ServiceTags=["foo"], ServicePort=5432>]
|
197
197
|
```
|
198
198
|
|
199
|
+
Or if you want to filter services
|
200
|
+
|
201
|
+
```ruby
|
202
|
+
foo_service = Diplomat::Service.get('foo', :all, { :filter => 'ServiceID == "indigo_foo"'})
|
203
|
+
# => [#<OpenStruct Node="indigo", Address="1.2.3.5", ServiceID="indigo_foo", ServiceName="foo", ServiceTags=["foo"], ServicePort=5432>]
|
204
|
+
```
|
205
|
+
|
199
206
|
If you wish to list all the services on consul:
|
200
207
|
|
201
208
|
```ruby
|
data/lib/diplomat/agent.rb
CHANGED
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Diplomat
|
4
|
+
# Methods for interacting with the Consul operator raft API endpoint
|
5
|
+
class RaftOperator < Diplomat::RestClient
|
6
|
+
@access_methods = %i[get_configuration transfer_leader]
|
7
|
+
|
8
|
+
# Get raft configuration
|
9
|
+
# @param options [Hash] options parameter hash
|
10
|
+
# @return [OpenStruct] all data associated with the raft configuration
|
11
|
+
def get_configuration(options = {})
|
12
|
+
custom_params = []
|
13
|
+
custom_params << use_named_parameter('dc', options[:dc]) if options[:dc]
|
14
|
+
|
15
|
+
ret = send_get_request(@conn, ['/v1/operator/raft/configuration'], options, custom_params)
|
16
|
+
JSON.parse(ret.body)
|
17
|
+
end
|
18
|
+
|
19
|
+
# Transfer raft leadership
|
20
|
+
# @param options [Hash] options parameter hash
|
21
|
+
# @return [OpenStruct] all data associated with the transfer status
|
22
|
+
# with format {"Success": ["true"|"false"]}
|
23
|
+
def transfer_leader(options = {})
|
24
|
+
custom_params = options[:id] ? use_named_parameter('id', options[:id]) : nil
|
25
|
+
@raw = send_post_request(@conn, ['/v1/operator/raft/transfer-leader'], options, nil, custom_params)
|
26
|
+
JSON.parse(@raw.body)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/lib/diplomat/service.rb
CHANGED
@@ -17,6 +17,7 @@ module Diplomat
|
|
17
17
|
custom_params << use_named_parameter('wait', options[:wait]) if options[:wait]
|
18
18
|
custom_params << use_named_parameter('index', options[:index]) if options[:index]
|
19
19
|
custom_params << use_named_parameter('dc', options[:dc]) if options[:dc]
|
20
|
+
custom_params << use_named_parameter('filter', options[:filter]) if options[:filter]
|
20
21
|
custom_params += [*options[:tag]].map { |value| use_named_parameter('tag', value) } if options[:tag]
|
21
22
|
|
22
23
|
ret = send_get_request(@conn, ["/v1/catalog/service/#{key}"], options, custom_params)
|
data/lib/diplomat/version.rb
CHANGED
data/lib/diplomat.rb
CHANGED
@@ -31,7 +31,7 @@ module Diplomat
|
|
31
31
|
require_libs 'configuration', 'rest_client', 'kv', 'datacenter', 'service',
|
32
32
|
'members', 'node', 'nodes', 'check', 'health', 'session', 'lock',
|
33
33
|
'error', 'event', 'acl', 'maintenance', 'query', 'agent', 'status',
|
34
|
-
'policy', 'token', 'role', 'autopilot'
|
34
|
+
'policy', 'token', 'role', 'autopilot', 'raft'
|
35
35
|
self.configuration ||= Diplomat::Configuration.new
|
36
36
|
|
37
37
|
class << self
|
metadata
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: diplomat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.6.
|
4
|
+
version: 2.6.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Hamelink
|
8
8
|
- Trevor Wood
|
9
9
|
- Pierre Souchay
|
10
|
-
autorequire:
|
10
|
+
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2025-05-17 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bundler
|
@@ -130,14 +130,14 @@ dependencies:
|
|
130
130
|
requirements:
|
131
131
|
- - "~>"
|
132
132
|
- !ruby/object:Gem::Version
|
133
|
-
version:
|
133
|
+
version: 1.75.5
|
134
134
|
type: :development
|
135
135
|
prerelease: false
|
136
136
|
version_requirements: !ruby/object:Gem::Requirement
|
137
137
|
requirements:
|
138
138
|
- - "~>"
|
139
139
|
- !ruby/object:Gem::Version
|
140
|
-
version:
|
140
|
+
version: 1.75.5
|
141
141
|
- !ruby/object:Gem::Dependency
|
142
142
|
name: simplecov
|
143
143
|
requirement: !ruby/object:Gem::Requirement
|
@@ -187,9 +187,12 @@ dependencies:
|
|
187
187
|
- - ">="
|
188
188
|
- !ruby/object:Gem::Version
|
189
189
|
version: '0.9'
|
190
|
+
- - "!="
|
191
|
+
- !ruby/object:Gem::Version
|
192
|
+
version: 2.0.0
|
190
193
|
- - "<"
|
191
194
|
- !ruby/object:Gem::Version
|
192
|
-
version: '
|
195
|
+
version: '3.0'
|
193
196
|
type: :runtime
|
194
197
|
prerelease: false
|
195
198
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -197,9 +200,12 @@ dependencies:
|
|
197
200
|
- - ">="
|
198
201
|
- !ruby/object:Gem::Version
|
199
202
|
version: '0.9'
|
203
|
+
- - "!="
|
204
|
+
- !ruby/object:Gem::Version
|
205
|
+
version: 2.0.0
|
200
206
|
- - "<"
|
201
207
|
- !ruby/object:Gem::Version
|
202
|
-
version: '
|
208
|
+
version: '3.0'
|
203
209
|
description: Diplomat is a simple wrapper for Consul
|
204
210
|
email:
|
205
211
|
- john@johnhamelink.com
|
@@ -232,6 +238,7 @@ files:
|
|
232
238
|
- lib/diplomat/nodes.rb
|
233
239
|
- lib/diplomat/policy.rb
|
234
240
|
- lib/diplomat/query.rb
|
241
|
+
- lib/diplomat/raft.rb
|
235
242
|
- lib/diplomat/rest_client.rb
|
236
243
|
- lib/diplomat/role.rb
|
237
244
|
- lib/diplomat/service.rb
|
@@ -243,7 +250,7 @@ homepage: https://github.com/WeAreFarmGeek/diplomat
|
|
243
250
|
licenses:
|
244
251
|
- BSD-3-Clause
|
245
252
|
metadata: {}
|
246
|
-
post_install_message:
|
253
|
+
post_install_message:
|
247
254
|
rdoc_options: []
|
248
255
|
require_paths:
|
249
256
|
- lib
|
@@ -258,8 +265,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
258
265
|
- !ruby/object:Gem::Version
|
259
266
|
version: '0'
|
260
267
|
requirements: []
|
261
|
-
rubygems_version: 3.
|
262
|
-
signing_key:
|
268
|
+
rubygems_version: 3.4.19
|
269
|
+
signing_key:
|
263
270
|
specification_version: 4
|
264
271
|
summary: Diplomat is a simple wrapper for Consul
|
265
272
|
test_files: []
|