roadworker 0.5.9 → 0.5.10

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
  SHA256:
3
- metadata.gz: '0584ced787872dec8e0c24ab3ee26717ab0b601d6a1c46339f7cd980c75904ee'
4
- data.tar.gz: 50de8202bfd460e2128a761d9b58f9ea6e87d8d988901a1a3875973a48c74c31
3
+ metadata.gz: 2287d1ae8a74127c9f8f71d4e4a0275dc7c6173d8ab1c2b2eb3616cecf6fd810
4
+ data.tar.gz: 306329875040ef860bbbc3617cd338351a45b01a979711fd879fef1ebb69c93d
5
5
  SHA512:
6
- metadata.gz: afd98f432c91fe37c22e80ce92adc5f08ede715dd549dcc6e43b3ecc9b8b8f63b83be4bf534bec7e2b756cc4516c60bf08d23ccb8efa3d0041bbafa19cac8886
7
- data.tar.gz: a4cded703dfc46d56618587f7360ee4a8140762980f4938858adde87ec059a9f442528d87205317f11cf24f1387f78ba8fe1361c8843f79760aa3ec62c2505b7
6
+ metadata.gz: ac2d71629ae6793a17262eecddce58b7a0a72663d3a2395a28cfc114e903b275c749ae4695470f30eb827a7ca7a92b31b0aa7eda73dcb6c1664465d9da3cbc04
7
+ data.tar.gz: 5029bf6a42d78e37025aad78cfcfdec63bde9ab100e11da2969114529bd6b5e0c0a54047945da99ca9cae93ae11228f3fd0049ede8d6202e4e6e26b3c6e3e43b
data/README.md CHANGED
@@ -5,7 +5,7 @@ Roadworker is a tool to manage Route53.
5
5
  It defines the state of Route53 using DSL, and updates Route53 according to DSL.
6
6
 
7
7
  [![Gem Version](https://badge.fury.io/rb/roadworker.svg)](http://badge.fury.io/rb/roadworker)
8
- [![Build Status](https://travis-ci.org/winebarrel/roadworker.svg?branch=master)](https://travis-ci.org/winebarrel/roadworker)
8
+ [![Build Status](https://travis-ci.org/codenize-tools/roadworker.svg?branch=master)](https://travis-ci.org/codenize-tools/roadworker)
9
9
  [![Coverage Status](https://coveralls.io/repos/winebarrel/roadworker/badge.svg?branch=master&service=github)](https://coveralls.io/github/winebarrel/roadworker?branch=master)
10
10
 
11
11
  **Notice**
@@ -19,6 +19,7 @@ module Aws
19
19
  's3-website-us-west-2.amazonaws.com' => 'Z3BJ6K6RIION7M',
20
20
  }
21
21
 
22
+ # https://docs.aws.amazon.com/general/latest/gr/rande.html#elb_region
22
23
  CANONICAL_HOSTED_ZONE_NAME_IDS = {
23
24
  'ap-northeast-1' => 'Z2YN17T5R711GT',
24
25
  #'ap-northeast-2' => '',
@@ -47,6 +48,29 @@ module Aws
47
48
  'us-west-2' => 'Z1H1FL5HABSF5',
48
49
  }
49
50
 
51
+ # https://docs.aws.amazon.com/general/latest/gr/rande.html#elb_region
52
+ NLB_CANONICAL_HOSTED_ZONE_NAME_IDS = {
53
+ 'us-east-2' => 'ZLMOA37VPKANP',
54
+ 'us-east-1' => 'Z26RNL4JYFTOTI',
55
+ 'us-west-1' => 'Z24FKFUX50B4VW',
56
+ 'us-west-2' => 'Z18D5FSROUN65G',
57
+ 'ap-south-1' => ' ZVDDRBQ08TROA',
58
+ # 'ap-northeast-3' => '',
59
+ 'ap-northeast-2' => 'ZIBE1TIR4HY56',
60
+ 'ap-southeast-1' => 'ZKVM4W9LS7TM',
61
+ 'ap-southeast-2' => 'ZCT6FZBF4DROD',
62
+ 'ap-northeast-1' => 'Z31USIVHYNEOWT',
63
+ 'ca-central-1' => 'Z2EPGBW3API2WT',
64
+ # 'cn-north-1' => '',
65
+ # 'cn-northwest-1' => '',
66
+ 'eu-central-1' => 'Z3F0SRJ5LGBH90',
67
+ 'eu-west-1' => 'Z2IFOLAFXWLO4F',
68
+ 'eu-west-2' => 'ZD4D7Y8KGAS4G',
69
+ 'eu-west-3' => 'Z1CMS0P5QUZ6D5',
70
+ 'eu-north-1' => 'Z1UDT6IFJ4EJM',
71
+ 'sa-east-1' => 'ZTK26PT1VY4CU',
72
+ }
73
+
50
74
  # http://docs.aws.amazon.com/Route53/latest/APIReference/API_ChangeResourceRecordSets.html
51
75
  CF_HOSTED_ZONE_ID = 'Z2FDTNDATAQYW2'
52
76
 
@@ -105,11 +129,16 @@ module Aws
105
129
  options ||= {}
106
130
 
107
131
  if name =~ /([^.]+)\.elb\.amazonaws.com\z/i
132
+ # CLB or ALB
108
133
  region = $1.downcase
109
134
  alias_target = elb_dns_name_to_alias_target(name, region, options)
110
135
 
111
136
  # XXX:
112
137
  alias_target.merge(options)
138
+ elsif name =~ /\.elb\.([^.]+)\.amazonaws\.com\z/i
139
+ # NLB
140
+ region = $1.downcase
141
+ alias_target = nlb_dns_name_to_alias_target(name, region, options)
113
142
  elsif (s3_hosted_zone_id = S3_WEBSITE_ENDPOINTS[name.downcase]) and name =~ /\As3-website-([^.]+)\.amazonaws\.com\z/i
114
143
  region = $1.downcase
115
144
  s3_dns_name_to_alias_target(name, region, s3_hosted_zone_id)
@@ -123,6 +152,9 @@ module Aws
123
152
  elsif name =~ /\.execute-api\.([^.]+)\.amazonaws\.com\z/i
124
153
  region = $1.downcase
125
154
  apigw_dns_name_to_alias_target(name, region, hosted_zone_id)
155
+ elsif name =~ /\.([^.]+)\.vpce\.amazonaws\.com\z/i
156
+ region = $1.downcase
157
+ vpce_dns_name_to_alias_target(name, region, hosted_zone_id)
126
158
  else
127
159
  raise "Invalid DNS Name: #{name}"
128
160
  end
@@ -158,6 +190,19 @@ module Aws
158
190
  end
159
191
  end
160
192
 
193
+ def nlb_dns_name_to_alias_target(name, region, options)
194
+ hosted_zone_id = options[:hosted_zone_id] || NLB_CANONICAL_HOSTED_ZONE_NAME_IDS[region]
195
+ unless hosted_zone_id
196
+ raise "Cannot find hosted zone id for `#{name}` (region: #{region}). Please pass :hosted_zone_id option"
197
+ end
198
+
199
+ {
200
+ hosted_zone_id: hosted_zone_id,
201
+ dns_name: name,
202
+ evaluate_target_health: false, # XXX:
203
+ }
204
+ end
205
+
161
206
  def s3_dns_name_to_alias_target(name, region, hosted_zone_id)
162
207
  {
163
208
  :hosted_zone_id => hosted_zone_id,
@@ -197,6 +242,14 @@ module Aws
197
242
  :evaluate_target_health => false, # XXX:
198
243
  }
199
244
  end
245
+
246
+ def vpce_dns_name_to_alias_target(name, region, hosted_zone_id)
247
+ {
248
+ :hosted_zone_id => hosted_zone_id,
249
+ :dns_name => name,
250
+ :evaluate_target_health => false, # XXX:
251
+ }
252
+ end
200
253
  end # of class method
201
254
 
202
255
  end # Route53
@@ -1,3 +1,3 @@
1
1
  module Roadworker
2
- VERSION = "0.5.9"
2
+ VERSION = "0.5.10"
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.9
4
+ version: 0.5.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - winebarrel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-01-10 00:00:00.000000000 Z
11
+ date: 2019-03-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-route53