Petabox
  • Introduction
  • Petabox FAQ
  • Concepts
    • Bucket versioning
    • Logging actions with a bucket
    • Object Lock
  • Tools
    • Supported tools
      • CyberDuck S3 Client
      • Mountain Duck
      • S3 Browser
      • RClone
      • AWS CLI Console client
      • SDKs for different languages
        • JavaScript SDK
        • AWS SDK for Java
        • Python SDK (boto)
  • S3 Compatible API
    • How to use the API
    • Signing Requests
    • API Reference
      • Bucket
        • HeadBucket
        • ListObjects/ListObjectsV2
        • PutBucketVersioning
        • PutBucketLogging
        • ListBuckets
        • RenameBucket
        • GetBucketLocation
      • Object
        • PutObject
        • GetObject
        • HeadObject
        • RenameObject
        • PutObjectAcl
      • Multipart upload
        • General multipart upload order
        • CreateMultipartUpload
        • UploadPart
        • CompleteMultipartUpload
        • ListMultipartUploads
      • Analytics
        • GetStatistics
        • GetBandwidthAnalytics
        • GetStorageAnalytics
      • Common request headers
      • Common response headers
      • Responses
      • GetObjectTagging
      • GetObjectAcl
      • GetBucketAcl
      • ListObjectVersions
      • GetBucketRequestPayment
      • GetBucketReplication
      • GetBucketTagging
      • GetBucketLocation
      • GetBucketVersioning
      • GetBucketLifecycle
      • GetObjectLockConfiguration
      • PutObjectLockConfiguration
      • GetObjectRetention
      • GetObjectLegalHold
      • PutObjectRetention
      • PutObjectLegalHold
      • PutObjectAcl
      • PutBucketAcl
      • PutBucketVersioning
      • CopyObject
      • DeleteObjects
      • AbortMultipartUpload
      • DeleteObject
      • DeleteBucket
      • PutBucketTagging
      • PutObjectTagging
      • DeleteBucketTagging
      • DeleteObjectTagging
      • PutBucketLogging
      • GetBucketLogging
      • ListParts
      • UploadPartCopy
      • PutBucketPolicy
      • GetBucketPolicy
      • DeleteBucketPolicy
Powered by GitBook
On this page
  • Request Syntax
  • URI Request Parameters
  • Request Body
  • Response Syntax
  • Response Elements
  • Examples
  • Sample Request
  • Sample Response
  • Sample Request
  • Sample Response
  1. S3 Compatible API
  2. API Reference

PutBucketVersioning

Sets the versioning state of an existing bucket

PreviousPutBucketAclNextCopyObject

Last updated 1 year ago

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 request does not return a versioning state value.

Important

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.)

Request Syntax

PUT /?versioning HTTP/1.1
Host: Bucket.s3.petabox.io
Content-MD5: ContentMD5
x-amz-expected-bucket-owner: ExpectedBucketOwner
<?xml version="1.0" encoding="UTF-8"?>
<VersioningConfiguration xmlns="http://s3.petabox.io/doc/2006-03-01/">
   <Status>string</Status>
</VersioningConfiguration>

URI Request Parameters

The request uses the following URI parameters.

Bucket

The bucket name.

Required: Yes

Content-MD5

For requests made using the AWS Command Line Interface (CLI) or AWS SDKs, this field is calculated automatically.

x-amz-expected-bucket-owner

The account ID of the expected bucket owner. If the bucket is owned by a different account, the request fails with the HTTP status code 403 Forbidden (access denied).

x-amz-mfa

The concatenation of the authentication device's serial number, a space, and the value that is displayed on your authentication device.

Request Body

The request accepts the following data in XML format.

VersioningConfiguration

Root level tag for the VersioningConfiguration parameters.

Required: Yes

Status

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 specified bucket.

PUT /?versioning HTTP/1.1
Host: bucket.s3.<Region>.petabox.io
Date: Wed, 01 Mar  2006 12:00:00 GMT
Authorization: authorization string
Content-Type: text/plain
Content-Length: 124
 
<VersioningConfiguration xmlns="http://s3.petabox.io/doc/2006-03-01/"> 
  <Status>Enabled</Status> 
</VersioningConfiguration>

Sample Response

This example illustrates one usage of PutBucketVersioning.

HTTP/1.1 200 OK
x-amz-id-2: YgIPIfBiKa2bj0KMg95r/0zo3emzU4dzsD4rcKCHQUAdQkf3ShJTOOpXUueF6QKo
x-amz-request-id: 236A8905248E5A01
Date: Wed, 01 Mar  2006 12:00:00 GMT3

Sample Request

The following request suspends versioning for the specified bucket.

PUT /?versioning HTTP/1.1
Host: bucket.s3.<Region>.petabox.io
Date: Wed, 12 Oct 2009 17:50:00 GMT
Authorization: authorization string
Content-Type: text/plain
Content-Length: 124
 
<VersioningConfiguration xmlns="http://s3.petabox.io/doc/2006-03-01/"> 
   <Status>Suspended</Status> 
</VersioningConfiguration>

Sample Response

This example illustrates one usage of PutBucketVersioning.

HTTP/1.1 200 OK
x-amz-id-2: YgIPIfBiKa2bj0KMg95r/0zo3emzU4dzsD4rcKCHQUAdQkf3ShJTOOpXUueF6QKo
x-amz-request-id: 236A8905248E5A01
Date: Wed, 01 Mar  2006 12:00:00 GMT

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 .

GetBucketVersioning
RFC 1864