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 +4 -4
- data/doc/_resource_types/s3_bucket.md +8 -0
- data/doc/_resource_types/sqs.md +0 -2
- data/doc/resource_types.md +10 -3
- data/lib/awspec/generator/doc/type/sqs.rb +1 -1
- data/lib/awspec/generator/spec/s3_bucket.rb +4 -0
- data/lib/awspec/helper/finder/s3.rb +12 -0
- data/lib/awspec/stub/s3_bucket.rb +8 -0
- data/lib/awspec/type/s3_bucket.rb +6 -0
- data/lib/awspec/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d2401b916fc27b0f0cef2c86130013680dd90c87
|
4
|
+
data.tar.gz: 5f64f72143349aac7ff5d07e85e728b1462c630c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e9cd315d2935b521bd8b30fa884bcdbf2f8a734e29acb974d2ad6c4df220ec94f02a184325d90ff968368fa881a05c07f6daef6c62e92d788b296e39ffb98977
|
7
|
+
data.tar.gz: 27158fbebec7c13aebf72b6fc9cd8bda7774e036c5f08e2390ee7a4d663ffd482012fe483ec832293a01ea9b2b8a3eddae841b65ad95f2a35174370d704a42da
|
data/doc/_resource_types/sqs.md
CHANGED
data/doc/resource_types.md
CHANGED
@@ -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.
|
@@ -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
|
@@ -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
|
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: 0.82.
|
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-
|
11
|
+
date: 2017-07-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|