PutBucketVersioning
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 GetBucketVersioning request does not return a versioning state value.
The following operations are related to PutBucketVersioning
:
Request Syntax
PUT /Bucket?versioning HTTP/1.1
Host: <partition>.s3.astran.io
<?xml version="1.0" encoding="UTF-8"?>
<VersioningConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<Status>string</Status>
</VersioningConfiguration>
URI Request Parameters
The request uses the following URI parameters.
The bucket name.
Required: Yes
Request Body
The request accepts the following data in XML format.
Root level tag for the VersioningConfiguration parameters.
Required: Yes
The versioning state of the bucket.
Type: String
Valid Values: Enabled | Suspended
Required: No
Response Syntax
HTTP/1.1 200
Response Elements
If the action is successful, the service sends back an HTTP 200 response with an empty HTTP body.
Examples
Sample Request
The following request enables versioning for the bucket mybucket
.
PUT /mybucket?versioning HTTP/1.1
Host: <partition>.s3.astran.io
Authorization: authorization string
Content-Type: application/xml
Content-Length: 124
<VersioningConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<Status>Enabled</Status>
</VersioningConfiguration>
Sample Response
This example illustrates one usage of PutBucketVersioning.
HTTP/1.1 200 OK
x-request-id: 236A8905248E5A01
Date: Mon, 25 Sep 2024 09:09:17 GMT
Sample Request
The following request suspends versioning for the specified bucket.
PUT /mybucket?versioning HTTP/1.1
Host: <partition>.s3.astran.io
Authorization: authorization string
Content-Type: application/xml
Content-Length: 122
<VersioningConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<Status>Suspended</Status>
</VersioningConfiguration>
Sample Response
This example illustrates one usage of PutBucketVersioning.
HTTP/1.1 200 OK
x-request-id: 236A8905248E5A01
Date: Mon, 25 Sep 2024 09:09:17 GMT
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following: