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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bea4be54a18a5fb915b47cdeef3174dc314feb94a2a193e82f463b50c54e91c6
4
- data.tar.gz: 346800faf49554d1b01c8bacd82bf0a967dd602699291f62e53e7fc1e5f9a481
3
+ metadata.gz: '041964ce50cedf17352bafd32bc143f586f8ac3496c80732ccb44ffa30dac6cd'
4
+ data.tar.gz: 8ba9b3557ea32878bdaf2023d778ef9f04bab50a8bf6d37b976c1b2fafa14055
5
5
  SHA512:
6
- metadata.gz: 8383e825eef4f83551d0fd18b476b453a927df08955686c9bd3558f1657784409b9a9781ad54b2a029040172d885c1c2fbbed2ab1231d687cd21f7688852e85d
7
- data.tar.gz: 628351ed78a11d1f4cbb3d7a9317b92302f7513ca7cd81403344e49462af19ca3d60503dd8cdc288c189e0484735194616c1fe363ffdf671122af80345c7d2c1
6
+ metadata.gz: 45f7c9e672e463d7f2679bca302d75a3e369b156781c4dcc6da2d60849591f244f19d17df137dfd2392b55561dd733a8c091d9ced7f2c7e65499df9cd7ee3287
7
+ data.tar.gz: 41eb787850fa0ede4a07966f4f1d0ce5a55dde05b8c695c83196f21d37b9e4a69676b48811e76916671ee56d8c887a7e2d0a81c833df2be6b0f8735e4e189009
@@ -85,6 +85,8 @@ end
85
85
 
86
86
  ### be_pending_validation, be_issued, be_inactive, be_expired, be_validation_timed_out, be_revoked, be_failed
87
87
 
88
+ ### have_domain_name
89
+
88
90
  ### have_domain_validation_option
89
91
 
90
92
  ```ruby
@@ -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.com')
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 { should have_domain_validation_option(domain_name: '<%= domain_validation_option.domain_name %>', validation_method: '<%= domain_validation_option.validation_method%>', validation_status: '<%= domain_validation_option.validation_status %>') }
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 { should have_domain_validation_option(domain_name: '<%= domain_validation_option.domain_name %>', validation_method: '<%= domain_validation_option.validation_method%>') }
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(domain)
5
- cert = acm_client.list_certificates.certificate_summary_list.find { |c| c[:domain_name] == domain }
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
- acm_client.list_certificates.certificate_summary_list.each do |cert|
12
- certificates << acm_client.describe_certificate({ certificate_arn: cert.certificate_arn }).certificate
33
+ certs.each do |cert|
34
+ certificates << acm_client.describe_certificate({ certificate_arn: cert }).certificate
13
35
  end
14
36
  certificates
15
37
  end
@@ -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-123456789010',
14
- domain_name: 'example.com',
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.com',
27
+ domain_name: 'example.jp',
19
28
  validation_status: 'SUCCESS',
20
29
  validation_method: 'DNS'
21
30
  ]
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Awspec
2
- VERSION = '1.12.2'
2
+ VERSION = '1.12.3'
3
3
  end
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.2
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-21 00:00:00.000000000 Z
11
+ date: 2018-11-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk