awspec 1.12.2 → 1.12.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/doc/resource_types.md +2 -0
- data/lib/awspec/generator/doc/type/acm.rb +1 -1
- data/lib/awspec/generator/spec/acm.rb +11 -2
- data/lib/awspec/helper/finder/acm.rb +26 -4
- data/lib/awspec/stub/acm.rb +13 -4
- data/lib/awspec/type/acm.rb +5 -0
- data/lib/awspec/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '041964ce50cedf17352bafd32bc143f586f8ac3496c80732ccb44ffa30dac6cd'
|
4
|
+
data.tar.gz: 8ba9b3557ea32878bdaf2023d778ef9f04bab50a8bf6d37b976c1b2fafa14055
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 45f7c9e672e463d7f2679bca302d75a3e369b156781c4dcc6da2d60849591f244f19d17df137dfd2392b55561dd733a8c091d9ced7f2c7e65499df9cd7ee3287
|
7
|
+
data.tar.gz: 41eb787850fa0ede4a07966f4f1d0ce5a55dde05b8c695c83196f21d37b9e4a69676b48811e76916671ee56d8c887a7e2d0a81c833df2be6b0f8735e4e189009
|
data/doc/resource_types.md
CHANGED
@@ -5,7 +5,7 @@ module Awspec::Generator
|
|
5
5
|
def initialize
|
6
6
|
super
|
7
7
|
@type_name = 'Acm'
|
8
|
-
@type = Awspec::Type::Acm.new('example.
|
8
|
+
@type = Awspec::Type::Acm.new('example.jp')
|
9
9
|
@ret = @type.resource_via_client
|
10
10
|
@matchers = [
|
11
11
|
Awspec::Type::Acm::STATUSES.map { |status| 'be_' + status.downcase }.join(', ')
|
@@ -16,12 +16,21 @@ describe acm('<%= certificate.domain_name %>') do
|
|
16
16
|
<%- if certificate.status == 'ISSUED' -%>
|
17
17
|
it { should be_issued }
|
18
18
|
<% end -%>
|
19
|
+
it { should have_domain_name('<%= certificate.domain_name %>') }
|
20
|
+
its(:certificate_arn) { should eq '<%= certificate.certificate_arn %>' }
|
19
21
|
its(:type) { should eq '<%= certificate.type %>' }
|
20
22
|
<%- certificate.domain_validation_options.each do |domain_validation_option| -%>
|
21
23
|
<%- unless domain_validation_option.validation_status.nil? -%>
|
22
|
-
it
|
24
|
+
it do
|
25
|
+
should have_domain_validation_option(domain_name: '<%= domain_validation_option.domain_name %>',
|
26
|
+
validation_method: '<%= domain_validation_option.validation_method%>',
|
27
|
+
validation_status: '<%= domain_validation_option.validation_status %>')
|
28
|
+
end
|
23
29
|
<%- else -%>
|
24
|
-
it
|
30
|
+
it do
|
31
|
+
should have_domain_validation_option(domain_name: '<%= domain_validation_option.domain_name %>',
|
32
|
+
validation_method: '<%= domain_validation_option.validation_method%>')
|
33
|
+
end
|
25
34
|
<%- end -%>
|
26
35
|
<%- end -%>
|
27
36
|
end
|
@@ -1,15 +1,37 @@
|
|
1
1
|
module Awspec::Helper
|
2
2
|
module Finder
|
3
3
|
module Acm
|
4
|
-
def find_certificate(
|
5
|
-
|
4
|
+
def find_certificate(id)
|
5
|
+
selected = []
|
6
|
+
loop do
|
7
|
+
req = {}
|
8
|
+
res = acm_client.list_certificates(req)
|
9
|
+
selected += res.certificate_summary_list.select do |c|
|
10
|
+
c.certificate_arn == id || c.domain_name == id
|
11
|
+
end
|
12
|
+
break if res.next_token.nil?
|
13
|
+
req[:next_token] = res.next_token
|
14
|
+
end
|
15
|
+
|
16
|
+
cert = selected.single_resource(id)
|
6
17
|
acm_client.describe_certificate({ certificate_arn: cert.certificate_arn }).certificate
|
7
18
|
end
|
8
19
|
|
9
20
|
def select_all_certificates
|
21
|
+
certs = []
|
22
|
+
loop do
|
23
|
+
req = {}
|
24
|
+
res = acm_client.list_certificates(req)
|
25
|
+
res.certificate_summary_list.each do |c|
|
26
|
+
certs << c.certificate_arn
|
27
|
+
end
|
28
|
+
break if res.next_token.nil?
|
29
|
+
req[:next_token] = res.next_token
|
30
|
+
end
|
31
|
+
|
10
32
|
certificates = []
|
11
|
-
|
12
|
-
certificates << acm_client.describe_certificate({ certificate_arn: cert
|
33
|
+
certs.each do |cert|
|
34
|
+
certificates << acm_client.describe_certificate({ certificate_arn: cert }).certificate
|
13
35
|
end
|
14
36
|
certificates
|
15
37
|
end
|
data/lib/awspec/stub/acm.rb
CHANGED
@@ -2,20 +2,29 @@ Aws.config[:acm] = {
|
|
2
2
|
stub_responses: {
|
3
3
|
list_certificates: {
|
4
4
|
certificate_summary_list: [
|
5
|
+
{
|
6
|
+
certificate_arn: 'arn:aws:acm:region:123456789010:certificate/12345678-1234-1234-1234-123456789000',
|
7
|
+
domain_name: 'example.jp'
|
8
|
+
},
|
5
9
|
{
|
6
10
|
certificate_arn: 'arn:aws:acm:region:123456789010:certificate/12345678-1234-1234-1234-123456789010',
|
7
11
|
domain_name: 'example.com'
|
12
|
+
},
|
13
|
+
{
|
14
|
+
certificate_arn: 'arn:aws:acm:region:123456789010:certificate/12345678-1234-1234-1234-123456789011',
|
15
|
+
domain_name: 'example.com'
|
8
16
|
}
|
9
|
-
]
|
17
|
+
],
|
18
|
+
next_token: nil
|
10
19
|
},
|
11
20
|
describe_certificate: {
|
12
21
|
certificate: {
|
13
|
-
certificate_arn: 'arn:aws:acm:region:123456789010:certificate/12345678-1234-1234-1234-
|
14
|
-
domain_name: 'example.
|
22
|
+
certificate_arn: 'arn:aws:acm:region:123456789010:certificate/12345678-1234-1234-1234-123456789000',
|
23
|
+
domain_name: 'example.jp',
|
15
24
|
status: 'ISSUED',
|
16
25
|
type: 'AMAZON_ISSUED',
|
17
26
|
domain_validation_options: [
|
18
|
-
domain_name: 'example.
|
27
|
+
domain_name: 'example.jp',
|
19
28
|
validation_status: 'SUCCESS',
|
20
29
|
validation_method: 'DNS'
|
21
30
|
]
|
data/lib/awspec/type/acm.rb
CHANGED
@@ -24,6 +24,11 @@ module Awspec::Type
|
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
|
+
def has_domain_name?(domain)
|
28
|
+
resource_via_client.domain_name == domain && \
|
29
|
+
resource_via_client.certificate_arn == id
|
30
|
+
end
|
31
|
+
|
27
32
|
def has_domain_validation_option?(domain_name:, validation_method:, validation_status: nil)
|
28
33
|
resource_via_client.domain_validation_options.find do |domain_validation_option|
|
29
34
|
validation_status ||= domain_validation_option.validation_status
|
data/lib/awspec/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: awspec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.12.
|
4
|
+
version: 1.12.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- k1LoW
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-11-
|
11
|
+
date: 2018-11-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk
|