You can use this operation to enable or suspend versioning for a bucket.
Versioning can be used to restore an object that is incorrectly overwritten or deleted. You can use versioning to save, query, and restore objects of different versions. Versioning allows you to easily recover data lost due to misoperations or program faults. Versioning can also be used for retaining and archiving data.
By default, versioning is disabled for a bucket.
After the versioning state is set to Enabled:
After the versioning state is set to Suspended:
Only the bucket owner can set the bucket versioning state.
PUT /?versioning HTTP/1.1 User-Agent: agnet Host: bucketname.obs.example.com Accept: */* Date: date Authorization: authorization Content-Length: length Expect: expect <VersioningConfiguration> <Status>status</Status> </VersioningConfiguration>
This request involves no parameters.
This request uses common headers. For details about common request headers, see section Common Request Headers.
This request contains elements to configure the bucket versioning in the XML format. Table 1 describes the elements.
Element |
Description |
Remarks |
---|---|---|
VersioningConfiguration |
Indicates the container for the versioning state configuration. Ancestor: None |
Mandatory |
Status |
Specifies the versioning state of the bucket. Type: Enumeration Ancestor: VersioningConfiguration Valid Values: Enabled, Suspended |
Mandatory |
HTTP/1.1 status_code Server: Server Name x-amz-request-id: request id x-amz-id-2: id x-reserved: amazon, aws and amazon web services are trademarks or registered trademarks of Amazon Technologies, Inc Date: date Content-Length: length
This response uses common headers. For details about common response headers, see section Common Response Headers.
This response involves no elements.
No special error responses are returned. For details about error responses, see Table 1.
PUT /?versioning HTTP/1.1 User-Agent: curl/7.29.0 Host: bucketname.obs.example.com Accept: */* Date: Mon, 13 Jan 2014 07:33:22 +0000 Authorization: AWS C5780CDE717D50F4CDAA:MxAazqX4BdUfCXpbNd1VpZqyDD4= Content-Length: 80 Expect: 100-continue <VersioningConfiguration> <Status>Enabled</Status> </VersioningConfiguration>
HTTP/1.1 200 OK Server: OBS x-amz-request-id: DCD2FC9CAB78000001438A84E693000F x-amz-id-2: iRQ+xOfSLXxasHqbPqqtDcXRKHXzrz9cNrrW4wjNum2DGHAgr359+tU6QCcwiT0y x-reserved: amazon, aws and amazon web services are trademarks or registered trademarks of Amazon Technologies, Inc Date: Mon, 13 Jan 2014 07:33:22 GMT Content-Length: 0