Learn R Programming

paws.storage (version 0.1.12)

s3_put_bucket_versioning: Sets the versioning state of an existing bucket

Description

Sets the versioning state of an existing bucket. To set the versioning state, you must be the bucket owner.

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.

If the bucket owner enables MFA Delete in the bucket versioning configuration, the bucket owner 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 policy 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 policy 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.

Related Resources

  • create_bucket

  • delete_bucket

  • get_bucket_versioning

Usage

s3_put_bucket_versioning(Bucket, ContentMD5, MFA,
  VersioningConfiguration, ExpectedBucketOwner)

Value

An empty list.

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 AWS Command Line Interface (CLI) or AWS SDKs, this field is calculated automatically.

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 bucket is owned by a different account, the request will fail with an HTTP 403 (Access Denied) error.

Request syntax

svc$put_bucket_versioning(
  Bucket = "string",
  ContentMD5 = "string",
  MFA = "string",
  VersioningConfiguration = list(
    MFADelete = "Enabled"|"Disabled",
    Status = "Enabled"|"Suspended"
  ),
  ExpectedBucketOwner = "string"
)

Examples

Run this code
if (FALSE) {
# The following example sets versioning configuration on bucket. The
# configuration enables versioning on the bucket.
svc$put_bucket_versioning(
  Bucket = "examplebucket",
  VersioningConfiguration = list(
    MFADelete = "Disabled",
    Status = "Enabled"
  )
)
}

Run the code above in your browser using DataLab