awspec 0.82.1 → 0.82.2

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
  SHA1:
3
- metadata.gz: 8248bcc51c59953143120a15cfa9ede3b8c50655
4
- data.tar.gz: 70ce22f4b30d81fbb0b993fe18e540434a0c9af8
3
+ metadata.gz: d2401b916fc27b0f0cef2c86130013680dd90c87
4
+ data.tar.gz: 5f64f72143349aac7ff5d07e85e728b1462c630c
5
5
  SHA512:
6
- metadata.gz: 31a14dd7941207ccc3aa27dc39d29807846e6889a242b1cc28c2690bebefa7c3e7ac6f60ea8dcb5a688562c5b14b04cf351152e67fb5d78b7922719842520149
7
- data.tar.gz: 619e8cc58c5fcf36facac4ab468efe433619772b8294322184be5813faf7474e2d74cd060d82968b371b8442eff374216e9e4b9ff05e7df3aa89bf49bd84f3ba
6
+ metadata.gz: e9cd315d2935b521bd8b30fa884bcdbf2f8a734e29acb974d2ad6c4df220ec94f02a184325d90ff968368fa881a05c07f6daef6c62e92d788b296e39ffb98977
7
+ data.tar.gz: 27158fbebec7c13aebf72b6fc9cd8bda7774e036c5f08e2390ee7a4d663ffd482012fe483ec832293a01ea9b2b8a3eddae841b65ad95f2a35174370d704a42da
@@ -95,6 +95,14 @@ describe s3_bucket('my-bucket') do
95
95
  end
96
96
  ```
97
97
 
98
+ ### have_tag
99
+
100
+ ```ruby
101
+ describe s3_bucket('my-bucket') do
102
+ it { should have_tag('env').value('dev') }
103
+ end
104
+ ```
105
+
98
106
  ### have_versioning_enabled
99
107
 
100
108
  ```ruby
@@ -3,7 +3,5 @@
3
3
  ```ruby
4
4
  describe sqs('my-queue') do
5
5
  it { should exist }
6
- its(:queue_url) { should eq 'https://sqs.ap-northeast-1.amazonaws.com/123456789012/my-queue' }
7
- its(:queue_arn) { should eq 'arn:aws:sqs:ap-northeast-1:123456789012:my-queue' }
8
6
  end
9
7
  ```
@@ -2115,6 +2115,15 @@ end
2115
2115
  ```
2116
2116
 
2117
2117
 
2118
+ ### have_tag
2119
+
2120
+ ```ruby
2121
+ describe s3_bucket('my-bucket') do
2122
+ it { should have_tag('env').value('dev') }
2123
+ end
2124
+ ```
2125
+
2126
+
2118
2127
  ### have_versioning_enabled
2119
2128
 
2120
2129
  ```ruby
@@ -2236,12 +2245,10 @@ SQS resource type.
2236
2245
  ```ruby
2237
2246
  describe sqs('my-queue') do
2238
2247
  it { should exist }
2239
- its(:queue_url) { should eq 'https://sqs.ap-northeast-1.amazonaws.com/123456789012/my-queue' }
2240
- its(:queue_arn) { should eq 'arn:aws:sqs:ap-northeast-1:123456789012:my-queue' }
2241
2248
  end
2242
2249
  ```
2243
2250
 
2244
-
2251
+ ### its(:queue_arn), its(:approximate_number_of_messages), its(:approximate_number_of_messages_not_visible), its(:approximate_number_of_messages_delayed), its(:created_timestamp), its(:last_modified_timestamp), its(:visibility_timeout), its(:maximum_message_size), its(:message_retention_period), its(:delay_seconds), its(:receive_message_wait_time_seconds), its(:queue_url)
2245
2252
  ## <a name="subnet">subnet</a>
2246
2253
 
2247
2254
  Subnet resource type.
@@ -9,7 +9,7 @@ module Awspec::Generator
9
9
  @ret = @type.resource_via_client
10
10
  @matchers = []
11
11
  @ignore_matchers = []
12
- @describes = []
12
+ @describes = @type.resource_via_client.keys
13
13
  end
14
14
  end
15
15
  end
@@ -47,6 +47,9 @@ describe s3_bucket('<%= bucket.name %>') do
47
47
  <%- if bucket_policy -%>
48
48
  it { should have_policy('<%= bucket_policy %>') }
49
49
  <%- end -%>
50
+ <%- if tag -%>
51
+ it { should have_tag('env').value('dev') }
52
+ <%- end -%>
50
53
  end
51
54
  EOF
52
55
  template
@@ -57,6 +60,7 @@ EOF
57
60
  def content(bucket)
58
61
  acl = find_bucket_acl(bucket.name)
59
62
  grant_specs = generate_grant_specs(acl)
63
+ tag = find_bucket_tag(bucket.name, 'env')
60
64
  policy = find_bucket_policy(bucket.name)
61
65
  bucket_policy = policy.policy.read if policy
62
66
  ERB.new(bucket_spec_template, nil, '-').result(binding).gsub(/^\n/, '')
@@ -32,6 +32,18 @@ module Awspec::Helper
32
32
  nil
33
33
  end
34
34
 
35
+ def find_bucket_tag(id, tag_key)
36
+ tag = nil
37
+ begin
38
+ bucket_tagging = s3_client.get_bucket_tagging(bucket: id)
39
+ tag_set = bucket_tagging.tag_set
40
+ tag = tag_set.find { |tag_obj| tag_obj.key == tag_key }
41
+ rescue Aws::S3::Errors::ServiceError
42
+ nil
43
+ end
44
+ return tag if tag
45
+ end
46
+
35
47
  def find_bucket_versioning(id)
36
48
  s3_client.get_bucket_versioning(bucket: id)
37
49
  rescue Aws::S3::Errors::ServiceError
@@ -67,6 +67,14 @@ Aws.config[:s3] = {
67
67
  get_bucket_versioning: {
68
68
  status: 'Enabled',
69
69
  mfa_delete: 'Enabled'
70
+ },
71
+ get_bucket_tagging: {
72
+ tag_set: [
73
+ {
74
+ key: 'env',
75
+ value: 'dev'
76
+ }
77
+ ]
70
78
  }
71
79
  }
72
80
  }
@@ -65,6 +65,12 @@ module Awspec::Type
65
65
  end
66
66
  end
67
67
 
68
+ def has_tag?(key, value)
69
+ tag = find_bucket_tag(id, key)
70
+ return nil if tag.value != value
71
+ tag
72
+ end
73
+
68
74
  def has_logging_enabled?(target_bucket: nil, target_prefix: nil)
69
75
  bl = find_bucket_logging(id)
70
76
  le = bl ? bl.logging_enabled : nil
@@ -1,3 +1,3 @@
1
1
  module Awspec
2
- VERSION = '0.82.1'
2
+ VERSION = '0.82.2'
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: 0.82.1
4
+ version: 0.82.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - k1LoW
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-07-18 00:00:00.000000000 Z
11
+ date: 2017-07-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec