You are viewing documentation for version 2 of the AWS SDK for Ruby. Version 3 documentation can be found here.

Class: Aws::S3::BucketPolicy

Inherits:
Resources::Resource show all
Defined in:
(unknown)

Instance Attribute Summary collapse

Attributes inherited from Resources::Resource

#client, #identifiers

Instance Method Summary collapse

Methods inherited from Resources::Resource

add_data_attribute, add_identifier, #data, data_attributes, #data_loaded?, identifiers, #load, #wait_until

Methods included from Resources::OperationMethods

#add_batch_operation, #add_operation, #batch_operation, #batch_operation_names, #batch_operations, #operation, #operation_names, #operations

Constructor Details

#initialize(bucket_name, options = {}) ⇒ Object #initialize(options = {}) ⇒ Object

Overloads:

  • #initialize(bucket_name, options = {}) ⇒ Object

    Parameters:

    • bucket_name (String)

    Options Hash (options):

    • :client (Client)

      When `:client is not given, the options hash is used to construct a new Client object.

  • #initialize(options = {}) ⇒ Object

    Options Hash (options):

    • :bucket_name (required, String)
    • :client (Client)

      When `:client is not given, the options hash is used to construct a new Client object.

Instance Attribute Details

#bucket_nameString (readonly)

Returns:

  • (String)

#policyString (readonly)

The bucket policy as a JSON document.

Returns:

  • (String)

    The bucket policy as a JSON document.

Instance Method Details

#bucketBucket

Returns:

#delete(options = {}) ⇒ Struct

Deletes the policy from the bucket.

Examples:

Request syntax example with placeholder values


bucketpolicy.delete({
  use_accelerate_endpoint: false,
})

Options Hash (options):

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#put(options = {}) ⇒ Struct

Replaces a policy on a bucket. If the bucket already has a policy, the one in this request completely replaces it.

Examples:

Request syntax example with placeholder values


bucketpolicy.put({
  content_md5: "ContentMD5",
  confirm_remove_self_bucket_access: false,
  policy: "Policy", # required
  use_accelerate_endpoint: false,
})

Options Hash (options):

  • :content_md5 (String)
  • :confirm_remove_self_bucket_access (Boolean)

    Set this parameter to true to confirm that you want to remove your permissions to change this bucket policy in the future.

  • :policy (required, String)

    The bucket policy as a JSON document.

  • :use_accelerate_endpoint (Boolean)

    When true, the "https://BUCKETNAME.s3-accelerate.amazonaws.com" endpoint will be used.

Returns:

  • (Struct)

    Returns an empty response.

See Also: