route53 0.2.2 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +1 -0
- data/.rspec +2 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/.travis.yml +7 -0
- data/Gemfile +3 -0
- data/Rakefile +5 -0
- data/lib/route53.rb +5 -411
- data/lib/route53/aws_response.rb +83 -0
- data/lib/route53/connection.rb +93 -0
- data/lib/route53/dns_record.rb +99 -0
- data/lib/route53/version.rb +1 -1
- data/lib/route53/zone.rb +134 -0
- data/route53.gemspec +9 -2
- data/spec/fixtures/vcr_cassettes/aws_zone.yml +198 -0
- data/spec/fixtures/vcr_cassettes/aws_zone_delete.yml +110 -0
- data/spec/fixtures/vcr_cassettes/aws_zone_records.yml +73 -0
- data/spec/fixtures/vcr_cassettes/aws_zones.yml +71 -0
- data/spec/lib/route53/aws_response_spec.rb +10 -0
- data/spec/lib/route53/connection_spec.rb +62 -0
- data/spec/lib/route53/dns_record_spec.rb +4 -0
- data/spec/lib/route53/zone_spec.rb +71 -0
- data/spec/spec_helper.rb +20 -0
- metadata +162 -80
@@ -0,0 +1,110 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: head
|
5
|
+
uri: https://route53.amazonaws.com/date
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- '*/*'
|
12
|
+
User-Agent:
|
13
|
+
- Ruby
|
14
|
+
response:
|
15
|
+
status:
|
16
|
+
code: 200
|
17
|
+
message: OK
|
18
|
+
headers:
|
19
|
+
X-Amzn-Requestid:
|
20
|
+
- 9eebd6a5-87a0-11e3-b239-49b331f5c62c
|
21
|
+
Content-Type:
|
22
|
+
- content/unknown
|
23
|
+
Content-Length:
|
24
|
+
- '2'
|
25
|
+
Date:
|
26
|
+
- Mon, 27 Jan 2014 22:16:07 GMT
|
27
|
+
body:
|
28
|
+
encoding: UTF-8
|
29
|
+
string: ''
|
30
|
+
http_version:
|
31
|
+
recorded_at: Mon, 27 Jan 2014 22:16:08 GMT
|
32
|
+
- request:
|
33
|
+
method: delete
|
34
|
+
uri: https://route53.amazonaws.com/2012-12-12/hostedzone/Z3E84CELCS8770?
|
35
|
+
body:
|
36
|
+
encoding: US-ASCII
|
37
|
+
string: ''
|
38
|
+
headers:
|
39
|
+
Date:
|
40
|
+
- Mon, 27 Jan 2014 22:16:07 GMT
|
41
|
+
X-Amzn-Authorization:
|
42
|
+
- AWS3-HTTPS AWSAccessKeyId=AKIAIK7CBPSH72TVCGBA,Algorithm=HmacSHA256,Signature=BSeUb4ZKEBrwpG/Tp/1zoge9sHX7PTdctJVU2beO/G4=
|
43
|
+
Content-Type:
|
44
|
+
- text/xml; charset=UTF-8
|
45
|
+
Accept-Encoding:
|
46
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
47
|
+
Accept:
|
48
|
+
- '*/*'
|
49
|
+
User-Agent:
|
50
|
+
- Ruby
|
51
|
+
response:
|
52
|
+
status:
|
53
|
+
code: 200
|
54
|
+
message: OK
|
55
|
+
headers:
|
56
|
+
X-Amzn-Requestid:
|
57
|
+
- 9f04411c-87a0-11e3-bf8c-1f13207fd337
|
58
|
+
Content-Type:
|
59
|
+
- text/xml
|
60
|
+
Content-Length:
|
61
|
+
- '259'
|
62
|
+
Date:
|
63
|
+
- Mon, 27 Jan 2014 22:16:07 GMT
|
64
|
+
body:
|
65
|
+
encoding: UTF-8
|
66
|
+
string: |-
|
67
|
+
<?xml version="1.0"?>
|
68
|
+
<DeleteHostedZoneResponse xmlns="https://route53.amazonaws.com/doc/2012-12-12/"><ChangeInfo><Id>/change/CCVCCM8EFB4P8</Id><Status>PENDING</Status><SubmittedAt>2014-01-27T22:16:08.408Z</SubmittedAt></ChangeInfo></DeleteHostedZoneResponse>
|
69
|
+
http_version:
|
70
|
+
recorded_at: Mon, 27 Jan 2014 22:16:09 GMT
|
71
|
+
- request:
|
72
|
+
method: get
|
73
|
+
uri: https://route53.amazonaws.com/2012-12-12/change/CCVCCM8EFB4P8?
|
74
|
+
body:
|
75
|
+
encoding: US-ASCII
|
76
|
+
string: ''
|
77
|
+
headers:
|
78
|
+
Date:
|
79
|
+
- Mon, 27 Jan 2014 22:16:07 GMT
|
80
|
+
X-Amzn-Authorization:
|
81
|
+
- AWS3-HTTPS AWSAccessKeyId=AKIAIK7CBPSH72TVCGBA,Algorithm=HmacSHA256,Signature=BSeUb4ZKEBrwpG/Tp/1zoge9sHX7PTdctJVU2beO/G4=
|
82
|
+
Content-Type:
|
83
|
+
- text/xml; charset=UTF-8
|
84
|
+
Accept-Encoding:
|
85
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
86
|
+
Accept:
|
87
|
+
- '*/*'
|
88
|
+
User-Agent:
|
89
|
+
- Ruby
|
90
|
+
response:
|
91
|
+
status:
|
92
|
+
code: 200
|
93
|
+
message: OK
|
94
|
+
headers:
|
95
|
+
X-Amzn-Requestid:
|
96
|
+
- 9f7a0d33-87a0-11e3-ad32-ed3fdad9cbb6
|
97
|
+
Content-Type:
|
98
|
+
- text/xml
|
99
|
+
Content-Length:
|
100
|
+
- '245'
|
101
|
+
Date:
|
102
|
+
- Mon, 27 Jan 2014 22:16:08 GMT
|
103
|
+
body:
|
104
|
+
encoding: UTF-8
|
105
|
+
string: |-
|
106
|
+
<?xml version="1.0"?>
|
107
|
+
<GetChangeResponse xmlns="https://route53.amazonaws.com/doc/2012-12-12/"><ChangeInfo><Id>/change/CCVCCM8EFB4P8</Id><Status>PENDING</Status><SubmittedAt>2014-01-27T22:16:08.408Z</SubmittedAt></ChangeInfo></GetChangeResponse>
|
108
|
+
http_version:
|
109
|
+
recorded_at: Mon, 27 Jan 2014 22:16:09 GMT
|
110
|
+
recorded_with: VCR 2.8.0
|
@@ -0,0 +1,73 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: head
|
5
|
+
uri: https://route53.amazonaws.com/date
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- '*/*'
|
12
|
+
User-Agent:
|
13
|
+
- Ruby
|
14
|
+
response:
|
15
|
+
status:
|
16
|
+
code: 200
|
17
|
+
message: OK
|
18
|
+
headers:
|
19
|
+
X-Amzn-Requestid:
|
20
|
+
- 634efeeb-87a2-11e3-bf8c-1f13207fd337
|
21
|
+
Content-Type:
|
22
|
+
- content/unknown
|
23
|
+
Content-Length:
|
24
|
+
- '2'
|
25
|
+
Date:
|
26
|
+
- Mon, 27 Jan 2014 22:28:46 GMT
|
27
|
+
body:
|
28
|
+
encoding: UTF-8
|
29
|
+
string: ''
|
30
|
+
http_version:
|
31
|
+
recorded_at: Mon, 27 Jan 2014 22:28:47 GMT
|
32
|
+
- request:
|
33
|
+
method: get
|
34
|
+
uri: https://route53.amazonaws.com/2012-12-12/hostedzone/Z3HXUG22R8JWBK/rrset?
|
35
|
+
body:
|
36
|
+
encoding: US-ASCII
|
37
|
+
string: ''
|
38
|
+
headers:
|
39
|
+
Date:
|
40
|
+
- Mon, 27 Jan 2014 22:28:46 GMT
|
41
|
+
X-Amzn-Authorization:
|
42
|
+
- AWS3-HTTPS AWSAccessKeyId=AKIAIK7CBPSH72TVCGBA,Algorithm=HmacSHA256,Signature=APVNFJA9XYDYwKsrPuBwP2jYLz/P8+tIGRRfGewPerk=
|
43
|
+
Content-Type:
|
44
|
+
- text/xml; charset=UTF-8
|
45
|
+
Accept-Encoding:
|
46
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
47
|
+
Accept:
|
48
|
+
- '*/*'
|
49
|
+
User-Agent:
|
50
|
+
- Ruby
|
51
|
+
response:
|
52
|
+
status:
|
53
|
+
code: 200
|
54
|
+
message: OK
|
55
|
+
headers:
|
56
|
+
X-Amzn-Requestid:
|
57
|
+
- 6364aa49-87a2-11e3-ad32-ed3fdad9cbb6
|
58
|
+
Content-Type:
|
59
|
+
- text/xml
|
60
|
+
Transfer-Encoding:
|
61
|
+
- chunked
|
62
|
+
Vary:
|
63
|
+
- Accept-Encoding
|
64
|
+
Date:
|
65
|
+
- Mon, 27 Jan 2014 22:28:47 GMT
|
66
|
+
body:
|
67
|
+
encoding: UTF-8
|
68
|
+
string: |-
|
69
|
+
<?xml version="1.0"?>
|
70
|
+
<ListResourceRecordSetsResponse xmlns="https://route53.amazonaws.com/doc/2012-12-12/"><ResourceRecordSets><ResourceRecordSet><Name>50projects.com.</Name><Type>A</Type><AliasTarget><HostedZoneId>Z3DZXE0Q79N41H</HostedZoneId><DNSName>my-load-balancer-498104842.us-east-1.elb.amazonaws.com.</DNSName><EvaluateTargetHealth>false</EvaluateTargetHealth></AliasTarget></ResourceRecordSet><ResourceRecordSet><Name>50projects.com.</Name><Type>MX</Type><TTL>3600</TTL><ResourceRecords><ResourceRecord><Value>20 ALT1.ASPMX.L.GOOGLE.com.</Value></ResourceRecord><ResourceRecord><Value>10 ASPMX.L.GOOGLE.com.</Value></ResourceRecord><ResourceRecord><Value>30 ALT2.ASPMX.L.GOOGLE.com.</Value></ResourceRecord><ResourceRecord><Value>40 ASPMX2.GOOGLEMAIL.com.</Value></ResourceRecord><ResourceRecord><Value>50 ASPMX3.GOOGLEMAIL.com.</Value></ResourceRecord></ResourceRecords></ResourceRecordSet><ResourceRecordSet><Name>50projects.com.</Name><Type>NS</Type><TTL>172800</TTL><ResourceRecords><ResourceRecord><Value>ns-535.awsdns-02.net.</Value></ResourceRecord><ResourceRecord><Value>ns-1725.awsdns-23.co.uk.</Value></ResourceRecord><ResourceRecord><Value>ns-308.awsdns-38.com.</Value></ResourceRecord><ResourceRecord><Value>ns-1452.awsdns-53.org.</Value></ResourceRecord></ResourceRecords></ResourceRecordSet><ResourceRecordSet><Name>50projects.com.</Name><Type>SOA</Type><TTL>900</TTL><ResourceRecords><ResourceRecord><Value>ns-535.awsdns-02.net. awsdns-hostmaster.amazon.com. 1 7200 900 1209600 86400</Value></ResourceRecord></ResourceRecords></ResourceRecordSet><ResourceRecordSet><Name>50projects.com.</Name><Type>TXT</Type><TTL>3600</TTL><ResourceRecords><ResourceRecord><Value>"foo"</Value></ResourceRecord><ResourceRecord><Value>"barr"</Value></ResourceRecord><ResourceRecord><Value>"fubar"</Value></ResourceRecord></ResourceRecords></ResourceRecordSet><ResourceRecordSet><Name>\052.50projects.com.</Name><Type>CNAME</Type><TTL>3600</TTL><ResourceRecords><ResourceRecord><Value>www.google.com</Value></ResourceRecord></ResourceRecords></ResourceRecordSet><ResourceRecordSet><Name>arecord.50projects.com.</Name><Type>A</Type><TTL>3600</TTL><ResourceRecords><ResourceRecord><Value>8.8.8.8</Value></ResourceRecord></ResourceRecords></ResourceRecordSet><ResourceRecordSet><Name>bar.50projects.com.</Name><Type>CNAME</Type><TTL>3600</TTL><ResourceRecords><ResourceRecord><Value>www.google.com</Value></ResourceRecord></ResourceRecords></ResourceRecordSet><ResourceRecordSet><Name>bar2.50projects.com.</Name><Type>CNAME</Type><SetIdentifier>5</SetIdentifier><Weight>5</Weight><TTL>3600</TTL><ResourceRecords><ResourceRecord><Value>www.google.com</Value></ResourceRecord></ResourceRecords></ResourceRecordSet><ResourceRecordSet><Name>bar2.50projects.com.</Name><Type>CNAME</Type><SetIdentifier>Second</SetIdentifier><Weight>11</Weight><TTL>3600</TTL><ResourceRecords><ResourceRecord><Value>www.yahoo.com</Value></ResourceRecord></ResourceRecords></ResourceRecordSet><ResourceRecordSet><Name>foo.50projects.com.</Name><Type>CNAME</Type><TTL>999</TTL><ResourceRecords><ResourceRecord><Value>www.groupon.com</Value></ResourceRecord></ResourceRecords></ResourceRecordSet><ResourceRecordSet><Name>\052.foo.50projects.com.</Name><Type>CNAME</Type><TTL>3600</TTL><ResourceRecords><ResourceRecord><Value>www.google.com</Value></ResourceRecord></ResourceRecords></ResourceRecordSet><ResourceRecordSet><Name>foo2.50projects.com.</Name><Type>CNAME</Type><TTL>999</TTL><ResourceRecords><ResourceRecord><Value>www.yahoo.com</Value></ResourceRecord></ResourceRecords></ResourceRecordSet><ResourceRecordSet><Name>modify-test.50projects.com.</Name><Type>A</Type><TTL>3600</TTL><ResourceRecords><ResourceRecord><Value>10.146.15.27</Value></ResourceRecord></ResourceRecords></ResourceRecordSet><ResourceRecordSet><Name>philctest.50projects.com.</Name><Type>CNAME</Type><TTL>3600</TTL><ResourceRecords><ResourceRecord><Value>50projects.com.</Value></ResourceRecord></ResourceRecords></ResourceRecordSet><ResourceRecordSet><Name>philctest2.50projects.com.</Name><Type>CNAME</Type><TTL>3600</TTL><ResourceRecords><ResourceRecord><Value>foo.50projects.com.</Value></ResourceRecord></ResourceRecords></ResourceRecordSet><ResourceRecordSet><Name>philctest3.50projects.com.</Name><Type>CNAME</Type><TTL>3600</TTL><ResourceRecords><ResourceRecord><Value>example.com.</Value></ResourceRecord></ResourceRecords></ResourceRecordSet><ResourceRecordSet><Name>rubyhead.50projects.com.</Name><Type>CNAME</Type><TTL>3600</TTL><ResourceRecords><ResourceRecord><Value>www.google.com</Value></ResourceRecord></ResourceRecords></ResourceRecordSet><ResourceRecordSet><Name>text.50projects.com.</Name><Type>TXT</Type><TTL>3600</TTL><ResourceRecords><ResourceRecord><Value>"foo"</Value></ResourceRecord><ResourceRecord><Value>"bar"</Value></ResourceRecord><ResourceRecord><Value>"***"</Value></ResourceRecord></ResourceRecords></ResourceRecordSet><ResourceRecordSet><Name>text2.50projects.com.</Name><Type>TXT</Type><TTL>3600</TTL><ResourceRecords><ResourceRecord><Value>"foo"</Value></ResourceRecord><ResourceRecord><Value>"bar"</Value></ResourceRecord></ResourceRecords></ResourceRecordSet><ResourceRecordSet><Name>text3.50projects.com.</Name><Type>TXT</Type><TTL>3600</TTL><ResourceRecords><ResourceRecord><Value>"bar"</Value></ResourceRecord><ResourceRecord><Value>"foo"</Value></ResourceRecord></ResourceRecords></ResourceRecordSet><ResourceRecordSet><Name>www.50projects.com.</Name><Type>CNAME</Type><SetIdentifier>25 percent of traffic to pool2</SetIdentifier><Weight>5</Weight><TTL>3600</TTL><ResourceRecords><ResourceRecord><Value>pool2.50projects.com.</Value></ResourceRecord></ResourceRecords></ResourceRecordSet><ResourceRecordSet><Name>www.50projects.com.</Name><Type>CNAME</Type><SetIdentifier>75 percent of traffic to pool1</SetIdentifier><Weight>15</Weight><TTL>3600</TTL><ResourceRecords><ResourceRecord><Value>pool1.50projects.com.</Value></ResourceRecord></ResourceRecords></ResourceRecordSet></ResourceRecordSets><IsTruncated>false</IsTruncated><MaxItems>100</MaxItems></ListResourceRecordSetsResponse>
|
71
|
+
http_version:
|
72
|
+
recorded_at: Mon, 27 Jan 2014 22:28:47 GMT
|
73
|
+
recorded_with: VCR 2.8.0
|
@@ -0,0 +1,71 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: head
|
5
|
+
uri: https://route53.amazonaws.com/date
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- '*/*'
|
12
|
+
User-Agent:
|
13
|
+
- Ruby
|
14
|
+
response:
|
15
|
+
status:
|
16
|
+
code: 200
|
17
|
+
message: OK
|
18
|
+
headers:
|
19
|
+
X-Amzn-Requestid:
|
20
|
+
- 67ee6ab3-879d-11e3-98d7-73059d19e8a2
|
21
|
+
Content-Type:
|
22
|
+
- content/unknown
|
23
|
+
Content-Length:
|
24
|
+
- '2'
|
25
|
+
Date:
|
26
|
+
- Mon, 27 Jan 2014 21:53:06 GMT
|
27
|
+
body:
|
28
|
+
encoding: UTF-8
|
29
|
+
string: ''
|
30
|
+
http_version:
|
31
|
+
recorded_at: Mon, 27 Jan 2014 21:53:07 GMT
|
32
|
+
- request:
|
33
|
+
method: get
|
34
|
+
uri: https://route53.amazonaws.com/2012-12-12/hostedzone?
|
35
|
+
body:
|
36
|
+
encoding: US-ASCII
|
37
|
+
string: ''
|
38
|
+
headers:
|
39
|
+
Date:
|
40
|
+
- Mon, 27 Jan 2014 21:53:06 GMT
|
41
|
+
X-Amzn-Authorization:
|
42
|
+
- AWS3-HTTPS AWSAccessKeyId=AKIAIK7CBPSH72TVCGBA,Algorithm=HmacSHA256,Signature=R4f+9b2CnE/AEx6CPlvMGM3plJr4rgYZo8VLw2ZaIMc=
|
43
|
+
Content-Type:
|
44
|
+
- text/xml; charset=UTF-8
|
45
|
+
Accept-Encoding:
|
46
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
47
|
+
Accept:
|
48
|
+
- '*/*'
|
49
|
+
User-Agent:
|
50
|
+
- Ruby
|
51
|
+
response:
|
52
|
+
status:
|
53
|
+
code: 200
|
54
|
+
message: OK
|
55
|
+
headers:
|
56
|
+
X-Amzn-Requestid:
|
57
|
+
- 680b684c-879d-11e3-8adc-c709b31246ca
|
58
|
+
Content-Type:
|
59
|
+
- text/xml
|
60
|
+
Content-Length:
|
61
|
+
- '401'
|
62
|
+
Date:
|
63
|
+
- Mon, 27 Jan 2014 21:53:06 GMT
|
64
|
+
body:
|
65
|
+
encoding: UTF-8
|
66
|
+
string: |-
|
67
|
+
<?xml version="1.0"?>
|
68
|
+
<ListHostedZonesResponse xmlns="https://route53.amazonaws.com/doc/2012-12-12/"><HostedZones><HostedZone><Id>/hostedzone/Z3HXUG22R8JWBK</Id><Name>50projects.com.</Name><CallerReference>a9f6b14e</CallerReference><Config/><ResourceRecordSetCount>22</ResourceRecordSetCount></HostedZone></HostedZones><IsTruncated>false</IsTruncated><MaxItems>100</MaxItems></ListHostedZonesResponse>
|
69
|
+
http_version:
|
70
|
+
recorded_at: Mon, 27 Jan 2014 21:53:07 GMT
|
71
|
+
recorded_with: VCR 2.8.0
|
@@ -0,0 +1,62 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Route53::Connection do
|
4
|
+
describe "#initialize" do
|
5
|
+
it "sets the base_url to the endpoint plus the api" do
|
6
|
+
conn = Route53::Connection.new('access_key', 'secret', '1999-01-01', 'https://www.example.com/')
|
7
|
+
expect(conn.base_url).to eq('https://www.example.com/1999-01-01')
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
describe "#request"
|
12
|
+
|
13
|
+
describe "#get_zones" do
|
14
|
+
it "gets back a list of zones" do
|
15
|
+
VCR.use_cassette("aws_zones", :record => :none) do
|
16
|
+
conn = Route53::Connection.new(credentials('access_key'), credentials('secret_key'))
|
17
|
+
expect(conn.get_zones.map(&:name)).to eq(['50projects.com.'])
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
it "handles truncated responses"
|
22
|
+
it "handles subqueries based on the hostedzone"
|
23
|
+
end
|
24
|
+
|
25
|
+
describe "#get_date" do
|
26
|
+
let(:conn) { Route53::Connection.new(credentials('access_key'), credentials('secret_key')) }
|
27
|
+
let(:expected_date) { "Mon, 27 Jan 2014 20:43:36 GMT" }
|
28
|
+
|
29
|
+
before do
|
30
|
+
VCR.turn_off!
|
31
|
+
stub_request(:head, "https://route53.amazonaws.com/date").to_return(
|
32
|
+
:headers => { 'Date' => expected_date }
|
33
|
+
)
|
34
|
+
end
|
35
|
+
|
36
|
+
after do
|
37
|
+
VCR.turn_on!
|
38
|
+
end
|
39
|
+
|
40
|
+
it "makes a request to amazon's /date endpoint" do
|
41
|
+
expect(conn.get_date).to eq(expected_date)
|
42
|
+
end
|
43
|
+
|
44
|
+
it "doesn't make extra calls to the network after the first request" do
|
45
|
+
expect(conn.get_date).to eq(expected_date)
|
46
|
+
stub_request(:head, "https://route53.amazonaws.com/date").to_return(
|
47
|
+
:headers => { 'Date' => 'Mon, 27 Jan 2014 23:59:59 GMT' }
|
48
|
+
)
|
49
|
+
expect(conn.get_date).to eq(expected_date)
|
50
|
+
end
|
51
|
+
|
52
|
+
it "makes a new call if the first date call was made longer than 30 seconds ago" do
|
53
|
+
expect(conn.get_date).to eq(expected_date)
|
54
|
+
current_time = Time.now
|
55
|
+
Time.stub(:now => current_time + 31)
|
56
|
+
stub_request(:head, "https://route53.amazonaws.com/date").to_return(
|
57
|
+
:headers => { 'Date' => 'Mon, 27 Jan 2014 23:59:59 GMT' }
|
58
|
+
)
|
59
|
+
expect(conn.get_date).to eq('Mon, 27 Jan 2014 23:59:59 GMT')
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Route53::Zone do
|
4
|
+
let(:conn) {
|
5
|
+
Route53::Connection.new(
|
6
|
+
credentials('access_key'),
|
7
|
+
credentials('secret_key')
|
8
|
+
)
|
9
|
+
}
|
10
|
+
let(:sample_zone) { Route53::Zone.new("50projects.com.", "/hostedzone/Z3HXUG22R8JWBK", conn) }
|
11
|
+
|
12
|
+
describe "#initialize" do
|
13
|
+
it "auto sets the name to end with a '.'" do
|
14
|
+
zone = Route53::Zone.new('foo', '/hostedzone/bar', conn)
|
15
|
+
expect(zone.name).to eq('foo.')
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
describe "#nameservers" do
|
20
|
+
it "returns the name servers assigned to a zone" do
|
21
|
+
VCR.use_cassette("aws_zone", :record => :none) do
|
22
|
+
expected_nameservers = ["ns-535.awsdns-02.net", "ns-1725.awsdns-23.co.uk", "ns-308.awsdns-38.com", "ns-1452.awsdns-53.org"]
|
23
|
+
expect(sample_zone.nameservers).to eq(expected_nameservers)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
describe "#delete_zone" do
|
29
|
+
it "deletes a zone" do
|
30
|
+
VCR.use_cassette("aws_zone_delete", :record => :none) do
|
31
|
+
zone = Route53::Zone.new("example.com.", '/hostedzone/Z3E84CELCS8770', conn)
|
32
|
+
resp = zone.delete_zone
|
33
|
+
expect(resp.pending?).to be_true
|
34
|
+
expect(resp.error?).to be_false
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
describe "#create_zone" do
|
40
|
+
it "creates a zone" do
|
41
|
+
VCR.use_cassette("aws_zone", :record => :none) do
|
42
|
+
new_zone = Route53::Zone.new("example.com.", nil, conn)
|
43
|
+
resp = new_zone.create_zone
|
44
|
+
expect(resp.pending?).to be_true
|
45
|
+
expect(resp.error?).to be_false
|
46
|
+
expect(new_zone.host_url).to eq('/hostedzone/Z3E84CELCS8770')
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
describe "#get_records" do
|
52
|
+
it "pulls records" do
|
53
|
+
VCR.use_cassette("aws_zone_records", :record => :none) do
|
54
|
+
zone_records = sample_zone.get_records
|
55
|
+
bar_50_proj = zone_records.detect { |r| r.name == 'bar.50projects.com.' }
|
56
|
+
foo_50_proj = zone_records.detect { |r| r.name == 'foo.50projects.com.' }
|
57
|
+
expect(bar_50_proj.values).to eq(['www.google.com'])
|
58
|
+
expect(foo_50_proj.values).to eq(['www.groupon.com'])
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
it "filters by type" do
|
63
|
+
VCR.use_cassette("aws_zone_records", :record => :none) do
|
64
|
+
a_records = sample_zone.get_records('A')
|
65
|
+
sample_a_record = a_records.detect { |r| r.name == 'arecord.50projects.com.' }
|
66
|
+
expect(a_records.map(&:type).uniq).to eq(['A'])
|
67
|
+
expect(sample_a_record.values).to eq(['8.8.8.8'])
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'route53'
|
2
|
+
require 'vcr'
|
3
|
+
require 'webmock/rspec'
|
4
|
+
|
5
|
+
VCR.configure do |c|
|
6
|
+
c.cassette_library_dir = 'spec/fixtures/vcr_cassettes'
|
7
|
+
c.hook_into :webmock
|
8
|
+
end
|
9
|
+
|
10
|
+
RSpec.configure do |config|
|
11
|
+
config.treat_symbols_as_metadata_keys_with_true_values = true
|
12
|
+
config.run_all_when_everything_filtered = true
|
13
|
+
config.filter_run :focus
|
14
|
+
config.order = 'random'
|
15
|
+
end
|
16
|
+
|
17
|
+
def credentials(key)
|
18
|
+
credentials_file = File.join(ENV['HOME'], '.route53')
|
19
|
+
File.exist?(credentials_file) ? YAML.load_file(credentials_file)[key] : ''
|
20
|
+
end
|
metadata
CHANGED
@@ -1,115 +1,197 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: route53
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 2
|
9
|
-
- 2
|
10
|
-
version: 0.2.2
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.3.0
|
11
5
|
platform: ruby
|
12
|
-
authors:
|
6
|
+
authors:
|
13
7
|
- Philip Corliss
|
14
8
|
autorequire:
|
15
9
|
bindir: bin
|
16
10
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
- !ruby/object:Gem::Dependency
|
11
|
+
date: 2014-01-27 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
21
14
|
name: ruby-hmac
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
hash: 3
|
29
|
-
segments:
|
30
|
-
- 0
|
31
|
-
version: "0"
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
32
20
|
type: :runtime
|
33
|
-
version_requirements: *id001
|
34
|
-
- !ruby/object:Gem::Dependency
|
35
|
-
name: hpricot
|
36
21
|
prerelease: false
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: nokogiri
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.5.10
|
46
34
|
type: :runtime
|
47
|
-
version_requirements: *id002
|
48
|
-
- !ruby/object:Gem::Dependency
|
49
|
-
name: builder
|
50
35
|
prerelease: false
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 1.5.10
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: builder
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
60
48
|
type: :runtime
|
61
|
-
|
62
|
-
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: vcr
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: webmock
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ~>
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 1.15.0
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ~>
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 1.15.0
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: pry
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - '>='
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - '>='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: wirble
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - '>='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - '>='
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: rake
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - '>='
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - '>='
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
description: Provides CRUD and list operations for records and zones as part of Amazon's
|
140
|
+
Route 53 service.
|
63
141
|
email: pcorlis@50projects.com
|
64
|
-
executables:
|
142
|
+
executables:
|
65
143
|
- route53
|
66
144
|
extensions: []
|
67
|
-
|
68
145
|
extra_rdoc_files: []
|
69
|
-
|
70
|
-
files:
|
146
|
+
files:
|
71
147
|
- .gitignore
|
148
|
+
- .rspec
|
149
|
+
- .ruby-gemset
|
150
|
+
- .ruby-version
|
151
|
+
- .travis.yml
|
152
|
+
- Gemfile
|
72
153
|
- LICENSE
|
73
154
|
- README.markdown
|
155
|
+
- Rakefile
|
74
156
|
- bin/route53
|
75
157
|
- lib/route53.rb
|
158
|
+
- lib/route53/aws_response.rb
|
76
159
|
- lib/route53/cli.rb
|
160
|
+
- lib/route53/connection.rb
|
161
|
+
- lib/route53/dns_record.rb
|
77
162
|
- lib/route53/version.rb
|
163
|
+
- lib/route53/zone.rb
|
78
164
|
- route53.gemspec
|
165
|
+
- spec/fixtures/vcr_cassettes/aws_zone.yml
|
166
|
+
- spec/fixtures/vcr_cassettes/aws_zone_delete.yml
|
167
|
+
- spec/fixtures/vcr_cassettes/aws_zone_records.yml
|
168
|
+
- spec/fixtures/vcr_cassettes/aws_zones.yml
|
169
|
+
- spec/lib/route53/aws_response_spec.rb
|
170
|
+
- spec/lib/route53/connection_spec.rb
|
171
|
+
- spec/lib/route53/dns_record_spec.rb
|
172
|
+
- spec/lib/route53/zone_spec.rb
|
173
|
+
- spec/spec_helper.rb
|
79
174
|
homepage: http://github.com/pcorliss/ruby_route_53
|
80
175
|
licenses: []
|
81
|
-
|
176
|
+
metadata: {}
|
82
177
|
post_install_message:
|
83
178
|
rdoc_options: []
|
84
|
-
|
85
|
-
require_paths:
|
179
|
+
require_paths:
|
86
180
|
- lib
|
87
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
|
-
requirements:
|
99
|
-
- - ">="
|
100
|
-
- !ruby/object:Gem::Version
|
101
|
-
hash: 17
|
102
|
-
segments:
|
103
|
-
- 1
|
104
|
-
- 3
|
105
|
-
- 5
|
181
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
182
|
+
requirements:
|
183
|
+
- - '>='
|
184
|
+
- !ruby/object:Gem::Version
|
185
|
+
version: '0'
|
186
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
187
|
+
requirements:
|
188
|
+
- - '>='
|
189
|
+
- !ruby/object:Gem::Version
|
106
190
|
version: 1.3.5
|
107
191
|
requirements: []
|
108
|
-
|
109
192
|
rubyforge_project:
|
110
|
-
rubygems_version:
|
193
|
+
rubygems_version: 2.2.1
|
111
194
|
signing_key:
|
112
|
-
specification_version:
|
195
|
+
specification_version: 4
|
113
196
|
summary: Library for Amazon's Route 53 service
|
114
197
|
test_files: []
|
115
|
-
|