roadworker 0.5.8 → 0.5.9.beta

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d4cb03b4b9dc0f8864788b033a1a5c732f7df6ec
4
- data.tar.gz: 979f70b0266f221c5883f32d81f173b9e6decf22
3
+ metadata.gz: 2afcbd25c22d7b95ec5fdcb8e95e264440218938
4
+ data.tar.gz: 05c461631556e21c101c4e2a35eacc7116e84372
5
5
  SHA512:
6
- metadata.gz: e48a2676f367cf503826c24549de719e0bca579f1c2c83f5da9a918e63d74d373100d1ef42fde693c26ecbf00c730d220d3174250bb60cd786deb10e84615f21
7
- data.tar.gz: 39ccb859d6c36958c8ac2cbec01903c046969ae029307f07b4e8d9bf0315042f50e86bff7ff135fd93965734ca608e94b15d87a0f3f4c82c242f8f2436a85f93
6
+ metadata.gz: 56f9e98bf00daaea24502faea1648390794cef2d18fecc7f83c4229e66896698bab1f2c0d5c8563a26545e1ba6e82bc55ff70e0c8c2ab1803f4bfd2a61ce33eb
7
+ data.tar.gz: 1ad2394fe42cf8dac72bd551eb9e14f630b91629de84c0efcd6d078d364a4393e7f06180061ba76e94c71b3f505e596d8899bd8b87afd6f7ff9ee64a7a70bdad
data/README.md CHANGED
@@ -24,6 +24,8 @@ It defines the state of Route53 using DSL, and updates Route53 according to DSL.
24
24
  * `>= 0.5.7`
25
25
  * Fix for `dualstack` prefix
26
26
  * Use constant for CanonicalHostedZoneNameID
27
+ * `>= 0.5.9`
28
+ * Support CloudWatch Metrics Health Check
27
29
 
28
30
  ## Installation
29
31
 
@@ -163,6 +165,21 @@ rrset "zzz.info.winebarrel.jp", "A" do
163
165
  end
164
166
  ```
165
167
 
168
+ ### Cloudwatch Metric Health Checks
169
+
170
+ ```ruby
171
+ rrset "zzz.info.winebarrel.jp", "A" do
172
+ set_identifier "Secondary"
173
+ failover "SECONDARY"
174
+ health_check :cloudwatch_metric => {:region=>"ap-northeast-1", :name=>"MyCheck"}, :inverted => false, :insufficient_data_health_status => "LastKnownStatus"
175
+ ttl 456
176
+ resource_records(
177
+ "127.0.0.3",
178
+ "127.0.0.4"
179
+ )
180
+ end
181
+ ```
182
+
166
183
  ### Dynamic private DNS example
167
184
 
168
185
  ```ruby
@@ -36,6 +36,8 @@ module Roadworker
36
36
 
37
37
  if config[:calculated]
38
38
  hc_args = ":calculated => #{config[:calculated].inspect}"
39
+ elsif config[:cloudwatch_metric]
40
+ hc_args = ":cloudwatch_metric => #{config[:cloudwatch_metric].inspect}"
39
41
  else
40
42
  hc_args = config[:url].sub(/\A(https?)_str_match:/) { $1 + ':' }.inspect
41
43
  end
@@ -49,6 +51,7 @@ module Roadworker
49
51
  :measure_latency,
50
52
  :inverted,
51
53
  :enable_sni,
54
+ :insufficient_data_health_status,
52
55
  ].each do |key|
53
56
  unless config[key].nil?
54
57
  hc_args << ", :#{key} => #{config[key].inspect}"
@@ -178,6 +178,12 @@ module Roadworker
178
178
  config[:type] = 'CALCULATED'
179
179
  config[:child_health_checks] = url.delete(:calculated)
180
180
  options = url
181
+ elsif url.include?(:cloudwatch_metric)
182
+ config = Aws::Route53::Types::HealthCheckConfig.new
183
+ config[:type] = 'CLOUDWATCH_METRIC'
184
+ config[:alarm_identifier] = url.delete(:cloudwatch_metric)
185
+ config[:child_health_checks] = []
186
+ options = url
181
187
  else
182
188
  raise ArgumentError, "wrong arguments: #{url.inspect}"
183
189
  end
@@ -196,6 +202,7 @@ module Roadworker
196
202
  :inverted => :inverted,
197
203
  :enable_sni => :enable_sni,
198
204
  :regions => :regions,
205
+ :insufficient_data_health_status => :insufficient_data_health_status,
199
206
  }.each do |option_key, config_key|
200
207
  config[config_key] = options[option_key] unless options[option_key].nil?
201
208
  end
@@ -206,7 +213,13 @@ module Roadworker
206
213
  config.type += '_STR_MATCH'
207
214
  end
208
215
 
209
- if config[:type] != 'CALCULATED'
216
+ case config[:type]
217
+ when 'CALCULATED'
218
+ # nothing to do
219
+ when 'CLOUDWATCH_METRIC'
220
+ config[:inverted] ||= false
221
+ config[:insufficient_data_health_status] ||= 'LastKnownStatus'
222
+ else
210
223
  config[:request_interval] ||= 30
211
224
  config[:failure_threshold] ||= 3
212
225
  config[:measure_latency] ||= false
@@ -13,8 +13,11 @@ module Roadworker
13
13
  def config_to_hash(config)
14
14
  type = config[:type].downcase
15
15
 
16
- if type == 'calculated'
16
+ case type
17
+ when 'calculated'
17
18
  hash = {:calculated => config[:child_health_checks]}
19
+ when 'cloudwatch_metric'
20
+ hash = {:cloudwatch_metric => config[:alarm_identifier].to_h}
18
21
  else
19
22
  ipaddr = config[:ip_address]
20
23
  port = config[:port]
@@ -45,6 +48,7 @@ module Roadworker
45
48
  :measure_latency,
46
49
  :inverted,
47
50
  :enable_sni,
51
+ :insufficient_data_health_status,
48
52
  ].each do |key|
49
53
  hash[key] = config[key] unless config[key].nil?
50
54
  end
@@ -222,6 +222,10 @@ module Roadworker
222
222
  true
223
223
  elsif expected and actual
224
224
  case attribute
225
+ when :health_check
226
+ if actual[:alarm_identifier]
227
+ actual[:alarm_identifier] = actual[:alarm_identifier].to_h
228
+ end
225
229
  when :dns_name
226
230
  expected[0] = expected[0].downcase.sub(/\.\z/, '')
227
231
  actual[0] = actual[0].downcase.sub(/\.\z/, '')
@@ -264,11 +268,11 @@ module Roadworker
264
268
 
265
269
  # XXX: Fix for diff
266
270
  if attribute == :health_check and actual
267
- if actual[:child_health_checks].empty?
271
+ if (actual[:child_health_checks] || []).empty?
268
272
  actual[:child_health_checks] = []
269
273
  end
270
274
 
271
- if actual[:regions].empty?
275
+ if (actual[:regions] || []).empty?
272
276
  actual[:regions] = []
273
277
  end
274
278
  end
@@ -1,3 +1,3 @@
1
1
  module Roadworker
2
- VERSION = "0.5.8"
2
+ VERSION = "0.5.9.beta"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: roadworker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.8
4
+ version: 0.5.9.beta
5
5
  platform: ruby
6
6
  authors:
7
7
  - winebarrel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-21 00:00:00.000000000 Z
11
+ date: 2017-02-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk
@@ -247,9 +247,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
247
247
  version: '0'
248
248
  required_rubygems_version: !ruby/object:Gem::Requirement
249
249
  requirements:
250
- - - ">="
250
+ - - ">"
251
251
  - !ruby/object:Gem::Version
252
- version: '0'
252
+ version: 1.3.1
253
253
  requirements: []
254
254
  rubyforge_project:
255
255
  rubygems_version: 2.5.2