Put Bucket Versioning
s3_put_bucket_versioning | R Documentation |
This operation is not supported by directory buckets¶
Description¶
This operation is not supported by directory buckets.
When you enable versioning on a bucket for the first time, it might take
a short amount of time for the change to be fully propagated. We
recommend that you wait for 15 minutes after enabling versioning before
issuing write operations (PUT
or DELETE
) on objects in the bucket.
Sets the versioning state of an existing bucket.
You can set the versioning state with one of the following values:
Enabled—Enables versioning for the objects in the bucket. All objects added to the bucket receive a unique version ID.
Suspended—Disables versioning for the objects in the bucket. All objects added to the bucket receive the version ID null.
If the versioning state has never been set on a bucket, it has no
versioning state; a get_bucket_versioning
request does not return a
versioning state value.
In order to enable MFA Delete, you must be the bucket owner. If you are
the bucket owner and want to enable MFA Delete in the bucket versioning
configuration, you must include the x-amz-mfa request
header and the
Status
and the MfaDelete
request elements in a request to set the
versioning state of the bucket.
If you have an object expiration lifecycle configuration in your non-versioned bucket and you want to maintain the same permanent delete behavior when you enable versioning, you must add a noncurrent expiration policy. The noncurrent expiration lifecycle configuration will manage the deletes of the noncurrent object versions in the version-enabled bucket. (A version-enabled bucket maintains one current and zero or more noncurrent object versions.) For more information, see Lifecycle and Versioning.
The following operations are related to put_bucket_versioning
:
-
create_bucket
-
delete_bucket
-
get_bucket_versioning
Usage¶
s3_put_bucket_versioning(Bucket, ContentMD5, ChecksumAlgorithm, MFA,
VersioningConfiguration, ExpectedBucketOwner)
Arguments¶
Bucket
[required] The bucket name.
ContentMD5
\>The base64-encoded 128-bit MD5 digest of the data. You must use this header as a message integrity check to verify that the request body was not corrupted in transit. For more information, see RFC 1864.
For requests made using the Amazon Web Services Command Line Interface (CLI) or Amazon Web Services SDKs, this field is calculated automatically.
ChecksumAlgorithm
Indicates the algorithm used to create the checksum for the object when you use the SDK. This header will not provide any additional functionality if you don't use the SDK. When you send this header, there must be a corresponding
x-amz-checksum
orx-amz-trailer
header sent. Otherwise, Amazon S3 fails the request with the HTTP status code400 Bad Request
. For more information, see Checking object integrity in the Amazon S3 User Guide.If you provide an individual checksum, Amazon S3 ignores any provided
ChecksumAlgorithm
parameter.MFA
The concatenation of the authentication device's serial number, a space, and the value that is displayed on your authentication device.
VersioningConfiguration
[required] Container for setting the versioning state.
ExpectedBucketOwner
The account ID of the expected bucket owner. If the account ID that you provide does not match the actual owner of the bucket, the request fails with the HTTP status code
403 Forbidden
(access denied).
Value¶
An empty list.
Request syntax¶
svc$put_bucket_versioning(
Bucket = "string",
ContentMD5 = "string",
ChecksumAlgorithm = "CRC32"|"CRC32C"|"SHA1"|"SHA256",
MFA = "string",
VersioningConfiguration = list(
MFADelete = "Enabled"|"Disabled",
Status = "Enabled"|"Suspended"
),
ExpectedBucketOwner = "string"
)