Class: AwsS3BucketObject
- Inherits:
-
Object
- Object
- AwsS3BucketObject
- Includes:
- AwsSingularResourceMixin
- Defined in:
- lib/resources/aws/aws_s3_bucket_object.rb
Defined Under Namespace
Classes: Backend
Instance Attribute Summary collapse
-
#bucket_name ⇒ Object
readonly
Returns the value of attribute bucket_name.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
Instance Method Summary collapse
- #object_acl ⇒ Object
-
#public? ⇒ Boolean
RSpec will alias this to be_public.
- #to_s ⇒ Object
Methods included from AwsSingularResourceMixin
Methods included from AwsResourceMixin
#catch_aws_errors, #check_resource_param_names, #initialize, #inspec_runner
Instance Attribute Details
#bucket_name ⇒ Object (readonly)
Returns the value of attribute bucket_name.
17 18 19 |
# File 'lib/resources/aws/aws_s3_bucket_object.rb', line 17 def bucket_name @bucket_name end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
17 18 19 |
# File 'lib/resources/aws/aws_s3_bucket_object.rb', line 17 def key @key end |
Instance Method Details
#object_acl ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'lib/resources/aws/aws_s3_bucket_object.rb', line 24 def object_acl return @object_acl if defined? @object_acl catch_aws_errors do @object_acl = BackendFactory.create(inspec_runner).get_object_acl(bucket: bucket_name, key: key).grants end @object_acl end |
#public? ⇒ Boolean
RSpec will alias this to be_public
34 35 36 37 38 39 |
# File 'lib/resources/aws/aws_s3_bucket_object.rb', line 34 def public? # first line just for formatting false || \ object_acl.any? { |g| g.grantee.type == "Group" && g.grantee.uri =~ /AllUsers/ } || \ object_acl.any? { |g| g.grantee.type == "Group" && g.grantee.uri =~ /AuthenticatedUsers/ } end |
#to_s ⇒ Object
19 20 21 22 |
# File 'lib/resources/aws/aws_s3_bucket_object.rb', line 19 def to_s # keep the format that aws uses. "s3://#{@bucket_name}/#{@key}" end |