diplomat 2.0.4 → 2.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/diplomat/check.rb +24 -11
- data/lib/diplomat/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c67b8ac370c8b73bd37fea1bcdcca6f88cf75e789f58a2ebb7abe0b1a1da83c1
|
4
|
+
data.tar.gz: ec8ff0e996067dab3580d874961d30588b8015f6efdb0d133f0699a2501fd4ab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fa2eca5776b8652c1032e5d67348086e48a8f3f05adf1b18a1457754a460f8bcbfda561108124962e7da059155c60df19860dfae1baf24b559ecfd258bcdcd41
|
7
|
+
data.tar.gz: b429f5262c799f09f735d6821a772429c2a66e829b08facd55b9fbb1938f768545fae8b2eda2a222dedcf9f560e3c3b4be5e7c46afb1e35ccc8e0412e933902e
|
data/README.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# Diplomat
|
2
|
-
[![Gem Version](https://badge.fury.io/rb/diplomat.svg)](
|
2
|
+
[![Gem Version](https://badge.fury.io/rb/diplomat.svg)](https://rubygems.org/gems/diplomat) [![Gem](https://img.shields.io/gem/dt/diplomat.svg)](https://rubygems.org/gems/diplomat/versions/2.0.0) [![Build Status](https://travis-ci.org/WeAreFarmGeek/diplomat.svg?branch=master)](https://travis-ci.org/WeAreFarmGeek/diplomat) [![Code Climate](https://codeclimate.com/github/johnhamelink/diplomat.svg)](https://codeclimate.com/github/WeAreFarmGeek/diplomat) [![Inline docs](http://inch-ci.org/github/wearefarmgeek/diplomat.svg?branch=master)](http://inch-ci.org/github/wearefarmgeek/diplomat)
|
3
3
|
### A HTTP Ruby API for [Consul](http://www.consul.io/)
|
4
4
|
|
5
5
|
![Diplomacy Boad Game](http://i.imgur.com/Nkuy4b7.jpg)
|
data/lib/diplomat/check.rb
CHANGED
@@ -50,32 +50,45 @@ module Diplomat
|
|
50
50
|
# @param check_id [String] the unique id of the check
|
51
51
|
# @return [Integer] Status code
|
52
52
|
def deregister(check_id)
|
53
|
-
ret = @conn.
|
53
|
+
ret = @conn.put "/v1/agent/check/deregister/#{check_id}"
|
54
54
|
ret.status == 200
|
55
55
|
end
|
56
56
|
|
57
|
-
#
|
57
|
+
# Update a TTL check
|
58
58
|
# @param check_id [String] the unique id of the check
|
59
|
+
# @param status [String] status of the check. Valid values are "passing", "warning", and "critical"
|
60
|
+
# @param output [String] human-readable message will be passed through to the check's Output field
|
59
61
|
# @return [Integer] Status code
|
60
|
-
def
|
61
|
-
ret = @conn.
|
62
|
+
def update_ttl(check_id, status, output = nil)
|
63
|
+
ret = @conn.put do |req|
|
64
|
+
req.url "/v1/agent/check/update/#{check_id}"
|
65
|
+
req.body = JSON.generate('Status' => status, 'Output' => output)
|
66
|
+
end
|
62
67
|
ret.status == 200
|
63
68
|
end
|
64
69
|
|
65
|
-
#
|
70
|
+
# Pass a check
|
66
71
|
# @param check_id [String] the unique id of the check
|
72
|
+
# @param output [String] human-readable message will be passed through to the check's Output field
|
67
73
|
# @return [Integer] Status code
|
68
|
-
def
|
69
|
-
|
70
|
-
ret.status == 200
|
74
|
+
def pass(check_id, output = nil)
|
75
|
+
update_ttl(check_id, 'passing', output)
|
71
76
|
end
|
72
77
|
|
73
78
|
# Warn a check
|
74
79
|
# @param check_id [String] the unique id of the check
|
80
|
+
# @param output [String] human-readable message will be passed through to the check's Output field
|
75
81
|
# @return [Integer] Status code
|
76
|
-
def
|
77
|
-
|
78
|
-
|
82
|
+
def warn(check_id, output = nil)
|
83
|
+
update_ttl(check_id, 'warning', output)
|
84
|
+
end
|
85
|
+
|
86
|
+
# Fail a check
|
87
|
+
# @param check_id [String] the unique id of the check
|
88
|
+
# @param output [String] human-readable message will be passed through to the check's Output field
|
89
|
+
# @return [Integer] Status code
|
90
|
+
def fail(check_id, output = nil)
|
91
|
+
update_ttl(check_id, 'critical', output)
|
79
92
|
end
|
80
93
|
end
|
81
94
|
end
|
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.0.
|
4
|
+
version: 2.0.5
|
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: 2019-02-
|
12
|
+
date: 2019-02-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -224,7 +224,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
224
224
|
- !ruby/object:Gem::Version
|
225
225
|
version: '0'
|
226
226
|
requirements: []
|
227
|
-
|
227
|
+
rubyforge_project:
|
228
|
+
rubygems_version: 2.7.7
|
228
229
|
signing_key:
|
229
230
|
specification_version: 4
|
230
231
|
summary: Diplomat is a simple wrapper for Consul
|