Gcloud::Storage::Bucket::DefaultAcl

Bucket Default Access Control List

Represents a Bucket's Default Access Control List.

require "gcloud"

gcloud = Gcloud.new
storage = gcloud.storage

bucket = storage.bucket "my-bucket"

bucket.default_acl.readers.each { |reader| puts reader }

Methods

Public Instance Methods

add_owner(entity)

Grants default owner permission to files in the bucket.

Parameters

entity

The entity holding the permission, in one of the following forms: (String)

  • user-userId

  • user-email

  • group-groupId

  • group-email

  • domain-domain

  • project-team-projectId

  • allUsers

  • allAuthenticatedUsers

Examples

Access to a bucket can be granted to a user by appending +“user-”+ to the email address:

require "gcloud"

gcloud = Gcloud.new
storage = gcloud.storage

bucket = storage.bucket "my-bucket"

email = "heidi@example.net"
bucket.default_acl.add_owner "user-#{email}"

Access to a bucket can be granted to a group by appending +“group-”+ to the email address:

require "gcloud"

gcloud = Gcloud.new
storage = gcloud.storage

bucket = storage.bucket "my-bucket"

email = "authors@example.net"
bucket.default_acl.add_owner "group-#{email}"

add_reader(entity)

Grants default reader permission to files in the bucket.

Parameters

entity

The entity holding the permission, in one of the following forms: (String)

  • user-userId

  • user-email

  • group-groupId

  • group-email

  • domain-domain

  • project-team-projectId

  • allUsers

  • allAuthenticatedUsers

Examples

Access to a bucket can be granted to a user by appending +“user-”+ to the email address:

require "gcloud"

gcloud = Gcloud.new
storage = gcloud.storage

bucket = storage.bucket "my-bucket"

email = "heidi@example.net"
bucket.default_acl.add_reader "user-#{email}"

Access to a bucket can be granted to a group by appending +“group-”+ to the email address:

require "gcloud"

gcloud = Gcloud.new
storage = gcloud.storage

bucket = storage.bucket "my-bucket"

email = "authors@example.net"
bucket.default_acl.add_reader "group-#{email}"

add_writer(entity)

Grants default writer permission to files in the bucket.

Parameters

entity

The entity holding the permission, in one of the following forms: (String)

  • user-userId

  • user-email

  • group-groupId

  • group-email

  • domain-domain

  • project-team-projectId

  • allUsers

  • allAuthenticatedUsers

Examples

Access to a bucket can be granted to a user by appending +“user-”+ to the email address:

require "gcloud"

gcloud = Gcloud.new
storage = gcloud.storage

bucket = storage.bucket "my-bucket"

email = "heidi@example.net"
bucket.default_acl.add_writer "user-#{email}"

Access to a bucket can be granted to a group by appending +“group-”+ to the email address:

require "gcloud"

gcloud = Gcloud.new
storage = gcloud.storage

bucket = storage.bucket "my-bucket"

email = "authors@example.net"
bucket.default_acl.add_writer "group-#{email}"

auth!()

Convenience method to apply the default authenticatedRead predefined ACL rule to files in the bucket.

Example

require "gcloud"

gcloud = Gcloud.new
storage = gcloud.storage

bucket = storage.bucket "my-bucket"

bucket.acl.auth!

auth_read!()

Alias for: auth!

authenticated!()

Alias for: auth!

authenticatedRead!()

Alias for: auth!

authenticated_read!()

Alias for: auth!

bucketOwnerFullControl!()

Alias for: owner_full!

bucketOwnerRead!()

Alias for: owner_read!

delete(entity)

Permenently deletes the entity from the bucket's default access control list for files.

Parameters

entity

The entity holding the permission, in one of the following forms: (String)

  • user-userId

  • user-email

  • group-groupId

  • group-email

  • domain-domain

  • project-team-projectId

  • allUsers

  • allAuthenticatedUsers

Example

require "gcloud"

gcloud = Gcloud.new
storage = gcloud.storage

bucket = storage.bucket "my-bucket"

email = "heidi@example.net"
bucket.default_acl.delete "user-#{email}"

owner_full!()

Convenience method to apply the default bucketOwnerFullControl predefined ACL rule to files in the bucket.

Example

require "gcloud"

gcloud = Gcloud.new
storage = gcloud.storage

bucket = storage.bucket "my-bucket"

bucket.acl.owner_full!
Also aliased as: bucketOwnerFullControl!

owner_read!()

Convenience method to apply the default bucketOwnerRead predefined ACL rule to files in the bucket.

Example

require "gcloud"

gcloud = Gcloud.new
storage = gcloud.storage

bucket = storage.bucket "my-bucket"

bucket.acl.owner_read!
Also aliased as: bucketOwnerRead!

owners()

Lists the default owners for files in the bucket.

Returns

Array of Strings

Example

require "gcloud"

gcloud = Gcloud.new
storage = gcloud.storage

bucket = storage.bucket "my-bucket"

bucket.default_acl.owners.each { |owner| puts owner }

private!()

Convenience method to apply the default private predefined ACL rule to files in the bucket.

Example

require "gcloud"

gcloud = Gcloud.new
storage = gcloud.storage

bucket = storage.bucket "my-bucket"

bucket.acl.private!

projectPrivate!()

Alias for: project_private!

project_private!()

Convenience method to apply the default projectPrivate predefined ACL rule to files in the bucket.

Example

require "gcloud"

gcloud = Gcloud.new
storage = gcloud.storage

bucket = storage.bucket "my-bucket"

bucket.acl.project_private!
Also aliased as: projectPrivate!

public!()

Convenience method to apply the default publicRead predefined ACL rule to files in the bucket.

Example

require "gcloud"

gcloud = Gcloud.new
storage = gcloud.storage

bucket = storage.bucket "my-bucket"

bucket.acl.public!
Also aliased as: publicRead!, public_read!

publicRead!()

Alias for: public!

public_read!()

Alias for: public!

readers()

Lists the default readers for files in the bucket.

Returns

Array of Strings

Example

require "gcloud"

gcloud = Gcloud.new
storage = gcloud.storage

bucket = storage.bucket "my-bucket"

bucket.default_acl.readers.each { |reader| puts reader }

refresh!()

Alias for: reload!

reload!()

Reloads all Default Access Control List data for the bucket.

Example

require "gcloud"

gcloud = Gcloud.new
storage = gcloud.storage

bucket = storage.bucket "my-bucket"

bucket.default_acl.reload!
Also aliased as: refresh!

writers()

Lists the default writers for files in the bucket.

Returns

Array of Strings

Example

require "gcloud"

gcloud = Gcloud.new
storage = gcloud.storage

bucket = storage.bucket "my-bucket"

bucket.default_acl.writers.each { |writer| puts writer }