diplomat 2.6.1 → 2.6.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3a7d8de13c2c322771e2077560a34336a92744122540db247dc5ee8f4c97a7f1
4
- data.tar.gz: a13421e5a4c9672f8f8410065ee5f4ab38833acc027f8cfb0edc6c2c0bfd30fd
3
+ metadata.gz: 602c9e392d4e521d6b749aa0b9cfb46cead8e1a16547c6e62f480e12230bbde5
4
+ data.tar.gz: 67fac5cfa5529c346e3a7deb2108dda46aeda3c728b4376b347a34b9781edded
5
5
  SHA512:
6
- metadata.gz: c1f93bed5e1bf7d1ebd3a62dc3fb0a869c34ce774ae0e992bd0efdbb6a0004ab57e757e5e8d850456032c739bc86ae86bbc1e9b1cd3e7a64e8d5635402f7d851
7
- data.tar.gz: 332e033972fc6e8aed716800553edcab761320eea3d2353647102310e199a0eadcdba85a926b2dedbfdc8f4348b7cc3a1d0ed94562dffeacc24251d852d2f698
6
+ metadata.gz: e75b590b288dec5984484dca08ae682459fae2855cad9e09566b9d6f5cff151a53522b698e19542d986a8b1a6682f57f567e353f17d1c8166212d92e19f41a6c
7
+ data.tar.gz: 1d0f7b3878d1431a2e45525cd9ac74d11965a051141ef245e4fd884a8848ee8f1bf09ab356daa10914392152f5be7b10c81880ce934f0a6775a8e91e54163870
data/README.md CHANGED
@@ -331,6 +331,40 @@ Get the health status from autopilot
331
331
  Diplomat::Autopilot.get_health()
332
332
  ```
333
333
 
334
+ ### Health
335
+
336
+ Retrieve health of a node
337
+
338
+ ```ruby
339
+ Diplomat::Health.node('fooNode', :dc => 'abc')
340
+ ```
341
+
342
+ Retrieve health of a given check
343
+
344
+ ```ruby
345
+ Diplomat::Health.checks('fooCheck', :dc => 'abc')
346
+ ```
347
+
348
+ Retrieve health of a given service
349
+
350
+ ```ruby
351
+ Diplomat::Health.service('fooService', :dc => 'abc')
352
+ ```
353
+
354
+ Retrieve a list of anything that correspond to the state ("any", "passing", "warning", or "critical")
355
+ You can use filters too !
356
+
357
+ ```ruby
358
+ Diplomat::Health.state("critical", {:dc => 'abc', :filter => 'Node==foo'})
359
+ ```
360
+
361
+ You also have some convenience method (`any`, `passing`, `warning`, `critical`)
362
+ That can be filtered
363
+
364
+ ```ruby
365
+ Diplomat::Health.critical({:dc => 'abc', :filter => 'Service==foo'})
366
+ ```
367
+
334
368
  ### Maintenance mode
335
369
 
336
370
  Enable maintenance mode on a host, with optional reason and DC (requires access to local agent)
@@ -59,35 +59,44 @@ module Diplomat
59
59
 
60
60
  # Get service health
61
61
  # @param s [String] the state ("any", "passing", "warning", or "critical")
62
- # @param options [Hash] :dc string for dc specific query
62
+ # @param options [Hash] :dc, :near, :filter string for specific query
63
63
  # @return [OpenStruct] all data associated with the node
64
64
  def state(s, options = {})
65
65
  custom_params = []
66
66
  custom_params << use_named_parameter('dc', options[:dc]) if options[:dc]
67
67
  custom_params << use_named_parameter('near', options[:near]) if options[:near]
68
+ custom_params << use_named_parameter('filter', options[:filter]) if options[:filter]
68
69
 
69
70
  ret = send_get_request(@conn, ["/v1/health/state/#{s}"], options, custom_params)
70
71
  JSON.parse(ret.body).map { |status| OpenStruct.new status }
71
72
  end
72
73
 
73
74
  # Convenience method to get services in any state
74
- def any
75
- state('any')
75
+ # @param options [Hash] :dc, :near, :filter string for specific query
76
+ # @return [OpenStruct] all data associated with the node
77
+ def any(options = {})
78
+ state('any', options)
76
79
  end
77
80
 
78
81
  # Convenience method to get services in passing state
79
- def passing
80
- state('passing')
82
+ # @param options [Hash] :dc, :near, :filter string for specific query
83
+ # @return [OpenStruct] all data associated with the node
84
+ def passing(options = {})
85
+ state('passing', options)
81
86
  end
82
87
 
83
88
  # Convenience method to get services in warning state
84
- def warning
85
- state('warning')
89
+ # @param options [Hash] :dc, :near, :filter string for specific query
90
+ # @return [OpenStruct] all data associated with the node
91
+ def warning(options = {})
92
+ state('warning', options)
86
93
  end
87
94
 
88
95
  # Convenience method to get services in critical state
89
- def critical
90
- state('critical')
96
+ # @param options [Hash] :dc, :near, :filter string for specific query
97
+ # @return [OpenStruct] all data associated with the node
98
+ def critical(options = {})
99
+ state('critical', options)
91
100
  end
92
101
  end
93
102
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Diplomat
4
- VERSION = '2.6.1'
4
+ VERSION = '2.6.2'
5
5
  end
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.6.1
4
+ version: 2.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Hamelink
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2022-01-05 00:00:00.000000000 Z
13
+ date: 2022-02-11 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler