Amazon Simple Storage Service

2020/10/02 - Amazon Simple Storage Service - 3 new api methods

Changes  Amazon S3 Object Ownership is a new S3 feature that enables bucket owners to automatically assume ownership of objects that are uploaded to their buckets by other AWS Accounts.

PutBucketOwnershipControls (new) Link ¶

Creates or modifies OwnershipControls for an Amazon S3 bucket. To use this operation, you must have the s3:GetBucketOwnershipControls permission. For more information about Amazon S3 permissions, see Specifying Permissions in a Policy .

For information about Amazon S3 Object Ownership, see Using Object Ownership .

The following operations are related to GetBucketOwnershipControls :

  • GetBucketOwnershipControls

  • DeleteBucketOwnershipControls

See also: AWS API Documentation

Request Syntax

client.put_bucket_ownership_controls(
    Bucket='string',
    ContentMD5='string',
    ExpectedBucketOwner='string',
    OwnershipControls={
        'Rules': [
            {
                'ObjectOwnership': 'BucketOwnerPreferred'|'ObjectWriter'
            },
        ]
    }
)
type Bucket

string

param Bucket

[REQUIRED]

The name of the Amazon S3 bucket whose OwnershipControls you want to set.

type ContentMD5

string

param ContentMD5

The MD5 hash of the OwnershipControls request body.

type ExpectedBucketOwner

string

param ExpectedBucketOwner

type OwnershipControls

dict

param OwnershipControls

[REQUIRED]

The OwnershipControls (BucketOwnerPreferred or ObjectWriter) that you want to apply to this Amazon S3 bucket.

  • Rules (list) -- [REQUIRED]

    The container element for an ownership control rule.

    • (dict) --

      The container element for an ownership control rule.

      • ObjectOwnership (string) -- [REQUIRED]

        The container element for object ownership for a bucket's ownership controls.

        BucketOwnerPreferred - Objects uploaded to the bucket change ownership to the bucket owner if the objects are uploaded with the bucket-owner-full-control canned ACL.

        ObjectWriter - The uploading account will own the object if the object is uploaded with the bucket-owner-full-control canned ACL.

returns

None

DeleteBucketOwnershipControls (new) Link ¶

Removes OwnershipControls for an Amazon S3 bucket. To use this operation, you must have the s3:PutBucketOwnershipControls permission. For more information about Amazon S3 permissions, see Specifying Permissions in a Policy .

For information about Amazon S3 Object Ownership, see Using Object Ownership .

The following operations are related to DeleteBucketOwnershipControls :

  • GetBucketOwnershipControls

  • PutBucketOwnershipControls

See also: AWS API Documentation

Request Syntax

client.delete_bucket_ownership_controls(
    Bucket='string',
    ExpectedBucketOwner='string'
)
type Bucket

string

param Bucket

[REQUIRED]

The Amazon S3 bucket whose OwnershipControls you want to delete.

type ExpectedBucketOwner

string

param ExpectedBucketOwner

returns

None

GetBucketOwnershipControls (new) Link ¶

Retrieves OwnershipControls for an Amazon S3 bucket. To use this operation, you must have the s3:GetBucketOwnershipControls permission. For more information about Amazon S3 permissions, see Specifying Permissions in a Policy .

For information about Amazon S3 Object Ownership, see Using Object Ownership .

The following operations are related to GetBucketOwnershipControls :

  • PutBucketOwnershipControls

  • DeleteBucketOwnershipControls

See also: AWS API Documentation

Request Syntax

client.get_bucket_ownership_controls(
    Bucket='string',
    ExpectedBucketOwner='string'
)
type Bucket

string

param Bucket

[REQUIRED]

The name of the Amazon S3 bucket whose OwnershipControls you want to retrieve.

type ExpectedBucketOwner

string

param ExpectedBucketOwner

rtype

dict

returns

Response Syntax

{
    'OwnershipControls': {
        'Rules': [
            {
                'ObjectOwnership': 'BucketOwnerPreferred'|'ObjectWriter'
            },
        ]
    }
}

Response Structure

  • (dict) --

    • OwnershipControls (dict) --

      The OwnershipControls (BucketOwnerPreferred or ObjectWriter) currently in effect for this Amazon S3 bucket.

      • Rules (list) --

        The container element for an ownership control rule.

        • (dict) --

          The container element for an ownership control rule.

          • ObjectOwnership (string) --

            The container element for object ownership for a bucket's ownership controls.

            BucketOwnerPreferred - Objects uploaded to the bucket change ownership to the bucket owner if the objects are uploaded with the bucket-owner-full-control canned ACL.

            ObjectWriter - The uploading account will own the object if the object is uploaded with the bucket-owner-full-control canned ACL.