awspec 0.41.0 → 0.42.0
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.md +9 -0
- data/lib/awspec/helper/finder/s3.rb +6 -0
- data/lib/awspec/stub/s3_bucket.rb +9 -4
- data/lib/awspec/type/s3_bucket.rb +11 -2
- 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: 269db3afd477e7b97500b7fa382400c9619b565c
|
4
|
+
data.tar.gz: 3968c5248b90648e277fa1c104b097ee7a31e9bc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 709a0207a1dfe54c95e75b7e5143207c6b1aca6eb97aa13edbed729940979617d6459974da673cf87973a231b15d34f420693a85743075b5faac2948995c788a
|
7
|
+
data.tar.gz: a914e74d80c93295e185770f22e978089819e4f051fb134ef7190fb3110ce957b835c08b966342b2e168214351283c71e34f982f8100c5a6d912edcb567b8f11
|
@@ -70,6 +70,14 @@ describe s3_bucket('my-bucket') do
|
|
70
70
|
end
|
71
71
|
```
|
72
72
|
|
73
|
+
### have_logging_enabled
|
74
|
+
|
75
|
+
```ruby
|
76
|
+
describe s3_bucket('my-bucket') do
|
77
|
+
it { should have_logging_enabled(target_bukcet: 'my-log-bucket', target_prefix: 'logs/') }
|
78
|
+
end
|
79
|
+
```
|
80
|
+
|
73
81
|
### advanced
|
74
82
|
|
75
83
|
`s3_bucket` can use `Aws::S3::Bucket` resource (see http://docs.aws.amazon.com/sdkforruby/api/Aws/S3/Bucket.html).
|
data/doc/resource_types.md
CHANGED
@@ -1293,6 +1293,15 @@ end
|
|
1293
1293
|
```
|
1294
1294
|
|
1295
1295
|
|
1296
|
+
### have_logging_enabled
|
1297
|
+
|
1298
|
+
```ruby
|
1299
|
+
describe s3_bucket('my-bucket') do
|
1300
|
+
it { should have_logging_enabled(target_bukcet: 'my-log-bucket', target_prefix: 'logs/') }
|
1301
|
+
end
|
1302
|
+
```
|
1303
|
+
|
1304
|
+
|
1296
1305
|
### have_object
|
1297
1306
|
|
1298
1307
|
```ruby
|
@@ -54,10 +54,15 @@ Aws.config[:s3] = {
|
|
54
54
|
]
|
55
55
|
},
|
56
56
|
get_bucket_policy: {
|
57
|
-
policy: '{"Version":"2012-10-17","Statement":' \
|
58
|
-
'
|
59
|
-
'"
|
60
|
-
|
57
|
+
policy: '{"Version":"2012-10-17","Statement":[{"Sid":"","Effect":"Allow","Principal":' \
|
58
|
+
'{"AWS":"arn:aws:iam::cloudfront:user/CloudFront Origin Access Identity XXXXX"},' \
|
59
|
+
'"Action":"s3:GetObject","Resource":"arn:aws:s3:::my-bucket/*"}]}'
|
60
|
+
},
|
61
|
+
get_bucket_logging: {
|
62
|
+
logging_enabled: {
|
63
|
+
target_bucket: 'my-log-bucket',
|
64
|
+
target_prefix: 'logs/'
|
65
|
+
}
|
61
66
|
}
|
62
67
|
}
|
63
68
|
}
|
@@ -56,8 +56,17 @@ module Awspec::Type
|
|
56
56
|
|
57
57
|
def has_policy?(policy)
|
58
58
|
bp = find_bucket_policy(@id)
|
59
|
-
|
60
|
-
|
59
|
+
bp ? (JSON.parse(bp.policy.read) == JSON.parse(policy)) : false
|
60
|
+
end
|
61
|
+
|
62
|
+
def has_logging_enabled?(target_bucket: nil, target_prefix: nil)
|
63
|
+
bl = find_bucket_logging(@id)
|
64
|
+
le = bl ? bl.logging_enabled : nil
|
65
|
+
|
66
|
+
return false if le.nil?
|
67
|
+
return false if target_bucket && target_bucket != le.target_bucket
|
68
|
+
return false if target_prefix && target_prefix != le.target_prefix
|
69
|
+
true
|
61
70
|
end
|
62
71
|
|
63
72
|
private
|
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.
|
4
|
+
version: 0.42.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- k1LoW
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-06-
|
11
|
+
date: 2016-06-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|