Class: AwsS3BucketObject
- Inherits:
-
Object
- Object
- AwsS3BucketObject
- Includes:
- AwsSingularResourceMixin
- Defined in:
- lib/resources/aws/aws_s3_bucket_object.rb
Overview
author: Matthew Dromazos
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.
14 15 16 |
# File 'lib/resources/aws/aws_s3_bucket_object.rb', line 14 def bucket_name @bucket_name end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
14 15 16 |
# File 'lib/resources/aws/aws_s3_bucket_object.rb', line 14 def key @key end |
Instance Method Details
#object_acl ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/resources/aws/aws_s3_bucket_object.rb', line 21 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
30 31 32 33 34 35 |
# File 'lib/resources/aws/aws_s3_bucket_object.rb', line 30 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
16 17 18 19 |
# File 'lib/resources/aws/aws_s3_bucket_object.rb', line 16 def to_s # keep the format that aws uses. "s3://#{@bucket_name}/#{@key}" end |