awspec 1.5.0 → 1.5.1

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: 2aaeb6e4dc658f764f20bec8fdac89d45a084797
4
- data.tar.gz: e02bd3450a6008edef4b22b79a66cd798a8a0f1d
3
+ metadata.gz: 6fe998760f93b86dc7701a60a93fd32aac29c022
4
+ data.tar.gz: 6b2dc3d9ebaf9dbc759ae5cde264d0e415505ed5
5
5
  SHA512:
6
- metadata.gz: a9778ec751b40035b38ed973b86aad9efeedb766da6e002bf1bcafbd7b5afb43e4094ce361c79acf25c0a231c00d7de440f7463adb26a277362ca5d51ae8901d
7
- data.tar.gz: c4b2e854c8bf2f6e954496030332bbb8a19c8ba671c5702f42054b1cea85041692d56ce757410f7f975fb8f3defdd8a8e829c994f0a36e770a96677e92439472
6
+ metadata.gz: 7fdd812ac8a0f340376f246f1051f91e14f0924d7c17496eaf207160a332023e5249945b1589c958a537b3582412f6d84a5e714c9452d798105db0f82d9c633c
7
+ data.tar.gz: 2ed5eaf23ece386af5b1293aaf5243698f6677f669b2eaef5fa9088d7b984259c1c6e7927b077c21aec938bb1320223f031c5cc610a819ef6009d7034469d5a9
data/doc/contributing.md CHANGED
@@ -17,7 +17,7 @@
17
17
  3. Fill files with code.
18
18
  4. Generate [doc/resource_types.md](doc/resource_types.md) (`bundle exec bin/toolbox docgen > doc/resource_types.md`)
19
19
  5. Run test (`bundle exec rake spec`)
20
- 6. Push to the branch (`git push origin add-type-redshift`)
20
+ 6. Push to the branch (`git push origin add-type-cf-limit`)
21
21
  7. Create a new Pull Request
22
22
 
23
23
  ## Append resource type document (ex. VPC resource `be_available`)
@@ -74,7 +74,7 @@ end
74
74
 
75
75
  ### be_pending_validation, be_issued, be_inactive, be_expired, be_validation_timed_out, be_revoked, be_failed
76
76
 
77
- ### its(:certificate_arn), its(:domain_name), its(:subject_alternative_names), its(:domain_validation_options), its(:serial), its(:subject), its(:issuer), its(:created_at), its(:issued_at), its(:imported_at), its(:status), its(:revoked_at), its(:revocation_reason), its(:not_before), its(:not_after), its(:key_algorithm), its(:signature_algorithm), its(:in_use_by), its(:failure_reason), its(:type), its(:renewal_summary), its(:key_usages), its(:extended_key_usages)
77
+ ### its(:certificate_arn), its(:domain_name), its(:subject_alternative_names), its(:domain_validation_options), its(:serial), its(:subject), its(:issuer), its(:created_at), its(:issued_at), its(:imported_at), its(:status), its(:revoked_at), its(:revocation_reason), its(:not_before), its(:not_after), its(:key_algorithm), its(:signature_algorithm), its(:in_use_by), its(:failure_reason), its(:type), its(:renewal_summary), its(:key_usages), its(:extended_key_usages), its(:certificate_authority_arn), its(:renewal_eligibility), its(:options)
78
78
  ## <a name="alb">alb</a>
79
79
 
80
80
  ALB resource type.
@@ -1209,7 +1209,7 @@ end
1209
1209
  ```
1210
1210
 
1211
1211
 
1212
- ### its(:domain_id), its(:domain_name), its(:arn), its(:created), its(:deleted), its(:endpoint), its(:endpoints), its(:processing), its(:elasticsearch_version), its(:access_policies), its(:snapshot_options), its(:vpc_options), its(:encryption_at_rest_options), its(:advanced_options), its(:log_publishing_options)
1212
+ ### its(:domain_id), its(:domain_name), its(:arn), its(:created), its(:deleted), its(:endpoint), its(:endpoints), its(:processing), its(:elasticsearch_version), its(:access_policies), its(:snapshot_options), its(:vpc_options), its(:cognito_options), its(:encryption_at_rest_options), its(:advanced_options), its(:log_publishing_options)
1213
1213
  ## <a name="elastictranscoder_pipeline">elastictranscoder_pipeline</a>
1214
1214
 
1215
1215
  ElastictranscoderPipeline resource type.
@@ -1467,7 +1467,7 @@ end
1467
1467
  ```
1468
1468
 
1469
1469
 
1470
- ### its(:path), its(:role_name), its(:role_id), its(:arn), its(:create_date), its(:assume_role_policy_document), its(:description)
1470
+ ### its(:path), its(:role_name), its(:role_id), its(:arn), its(:create_date), its(:assume_role_policy_document), its(:description), its(:max_session_duration)
1471
1471
  ### :unlock: Advanced use
1472
1472
 
1473
1473
  `iam_role` can use `Aws::IAM::Role` resource (see http://docs.aws.amazon.com/sdkforruby/api/Aws/IAM/Role.html).
@@ -48,10 +48,10 @@ describe rds('<%= instance_id %>') do
48
48
  <%- end -%>
49
49
  it { should belong_to_db_subnet_group('<%= db_instance.db_subnet_group.db_subnet_group_name %>') }
50
50
  <% db_instance.db_parameter_groups.each do |pg| %>
51
- it { should have_db_parameter_group('<%= pg.db_parameter_group_name %>') }
51
+ it { should have_db_parameter_group('<%= pg.db_parameter_group_name %>').parameter_apply_status('<%= pg.parameter_apply_status %>') }
52
52
  <% end %>
53
53
  <% db_instance.option_group_memberships.each do |og| %>
54
- it { should have_option_group('<%= og.option_group_name %>') }
54
+ it { should have_option_group('<%= og.option_group_name %>').status('<%= og.status %>') }
55
55
  <% end %>
56
56
  end
57
57
  EOF
@@ -33,6 +33,53 @@ it { should have_acl_grant(grantee: '<%= #{grantee} %>', permission: '<%= grant.
33
33
  template
34
34
  end
35
35
 
36
+ def generate_lifecycle_rule_transitions_spec(transitions_rule)
37
+ rules = []
38
+ transitions_rule.each do |line|
39
+ elements = []
40
+ line.each do |k, v|
41
+ elements << case v
42
+ when Numeric
43
+ "#{k}: #{v}"
44
+ when String
45
+ "#{k}: '#{v}'"
46
+ else
47
+ "#{k}: '#{v.inspect}'"
48
+ end
49
+ end
50
+ rules << '{ ' + elements.join(', ') + ' }'
51
+ end
52
+ '[' + rules.join(', ') + ']'
53
+ end
54
+
55
+ def generate_lifecycle_rule_specs(lifecycle_rule)
56
+ return [] unless lifecycle_rule
57
+ linespecs = []
58
+ lifecycle_rule.rules.each do |rule|
59
+ transitions = generate_lifecycle_rule_transitions_spec(rule.transitions.map(&:to_h))
60
+ template = <<-EOF
61
+ it do
62
+ should have_lifecycle_rule(
63
+ id: '<%= rule.id %>',
64
+ <%- if rule.prefix -%>
65
+ prefix: '<%= rule.prefix %>',
66
+ <%- end -%>
67
+ <%- rule.noncurrent_version_expiration.to_h.each do |k, v| -%>
68
+ noncurrent_version_expiration: { <%= k %>: <%= v %> },
69
+ <%- end -%>
70
+ <%- rule.expiration.to_h.each do |k, v| -%>
71
+ expiration: { <%= k %>: <%= v %> },
72
+ <%- end -%>
73
+ transitions: <%= transitions %>,
74
+ status: '<%= rule.status %>'
75
+ )
76
+ end
77
+ EOF
78
+ linespecs.push(ERB.new(template, nil, '-').result(binding))
79
+ end
80
+ linespecs
81
+ end
82
+
36
83
  def bucket_spec_template
37
84
  template = <<-'EOF'
38
85
  describe s3_bucket('<%= bucket.name %>') do
@@ -50,6 +97,11 @@ describe s3_bucket('<%= bucket.name %>') do
50
97
  <%- if tag -%>
51
98
  it { should have_tag('env').value('dev') }
52
99
  <%- end -%>
100
+ <%- if lifecycle_rule -%>
101
+ <% lifecycle_specs.each do |line| %>
102
+ <%= line %>
103
+ <% end %>
104
+ <%- end -%>
53
105
  end
54
106
  EOF
55
107
  template
@@ -63,6 +115,8 @@ EOF
63
115
  tag = find_bucket_tag(bucket.name, 'env')
64
116
  policy = find_bucket_policy(bucket.name)
65
117
  bucket_policy = policy.policy.read if policy
118
+ lifecycle_rule = find_bucket_lifecycle_configuration(bucket.name)
119
+ lifecycle_specs = generate_lifecycle_rule_specs(lifecycle_rule) if lifecycle_rule
66
120
  ERB.new(bucket_spec_template, nil, '-').result(binding).gsub(/^\n/, '')
67
121
  end
68
122
  end
@@ -13,7 +13,7 @@ module Awspec::Type
13
13
  end
14
14
 
15
15
  def has_record_set?(name, type, value, options = {})
16
- name.gsub!(/\*/, '\\\052') # wildcard support
16
+ name = name.gsub(/\*/, '\\\052') # wildcard support
17
17
  ret = resource_via_client_record_sets.find do |record_set|
18
18
  # next if record_set.type != type.upcase
19
19
  next unless record_set.type.casecmp(type) == 0
@@ -1,3 +1,3 @@
1
1
  module Awspec
2
- VERSION = '1.5.0'
2
+ VERSION = '1.5.1'
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.5.0
4
+ version: 1.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - k1LoW
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-03-26 00:00:00.000000000 Z
11
+ date: 2018-04-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk