Class: AWS::S3::AccessControlList
- Inherits:
-
Object
- Object
- AWS::S3::AccessControlList
- Includes:
- ACLObject
- Defined in:
- lib/aws/s3/access_control_list.rb
Overview
Represents an access control list for S3 objects and buckets. For example:
acl = AccessControlList.new
acl.grant(:full_control).
to(:canonical_user_id => "8a6925ce4adf588a4f21c32aa379004fef")
acl.to_xml # => '<AccessControlPolicy>...'
You can also construct an AccessControlList from a hash:
AccessControlList.new(
:owner => { :id => "8a6925ce4adf588a4f21c32aa379004fef" },
:grants => [{ :grantee => {
:canonical_user_id => "8a6925ce4adf588a4f21c32aa379004fef",
},
:permission => :full_control }]
)
Defined Under Namespace
Classes: Grant, GrantBuilder, Grantee, Owner, Permission
Instance Attribute Summary collapse
-
#grants ⇒ list of AccessControlList::Grant
The list of grants.
-
#owner ⇒ AccessControlList::Owner
The owner of the access control list.
Instance Method Summary collapse
-
#grant(permission) ⇒ GrantBuilder
Convenience method for constructing a new grant and adding it to the ACL.
Methods included from ACLObject
#to_s, #to_xml, #valid?, #validate!
Instance Attribute Details
#grants ⇒ list of AccessControlList::Grant
The list of grants. You can set this as a list of hashes, for example:
acl.grants = [{ :grantee => { :canonical_user_id =>
"8a6925ce4adf588a4f21c32aa379004fef" },
:permission => :full_control }]
48 49 50 |
# File 'lib/aws/s3/access_control_list.rb', line 48 def grants @grants end |
#owner ⇒ AccessControlList::Owner
The owner of the access control list. You can set this as a hash, for example:
acl.owner = { :id => '8a6925ce4adf588a4f21c32aa379004fef' }
This attribute is required when setting an ACL.
48 49 50 |
# File 'lib/aws/s3/access_control_list.rb', line 48 def owner @owner end |
Instance Method Details
#grant(permission) ⇒ GrantBuilder
Convenience method for constructing a new grant and adding it to the ACL. Example usage:
acl.grants.size # => 0
acl.grant(:full_control).
to(:canonical_user_id => "8a6925ce4adf588a4f21c32aa379004fef")
acl.grants.size # => 1
241 242 243 |
# File 'lib/aws/s3/access_control_list.rb', line 241 def grant() GrantBuilder.new(self, Grant.new(:permission => )) end |