API | Operation | Description |
Setting versioning | Sets versioning configuration of a bucket | |
Querying versioning | Queries the versioning configuration of a bucket |
1. If you have never enabled versioning for the bucket, GET Bucket versioning will not return a versioning status.2. Once enabled, versioning can only be suspended but cannot be disabled.3. Set the versioning state value toEnabled
orSuspended
to enable or suspend versioning, respectively.4. To set versioning for a bucket, you need to have write permission for the bucket.
cos.putBucketVersioning({Bucket: 'examplebucket-1250000000', /*Required*/Region: 'COS_REGION', /* Bucket region. Required */VersioningConfiguration: {Status: "Enabled"}}, function (err, data) {console.log(err || data);});
Parameter Name | Description | Type | Required |
Bucket | Bucket for which versioning is enabled or suspended in the format: BucketName-APPID | String | Yes |
Region | Bucket region. For the enumerated values, see Regions and Access Domain Names | String | Yes |
VersioningConfiguration | Defines the versioning configuration of the bucket | Object | Yes |
- Status | Versioning status; enumerated values: Enabled , Suspended | String | No |
function(err, data) { ... }
Parameter Name | Description | Type |
err | Object returned when an error (network error or service error) occurs. If the request is successful, this is null. For more information, see Error Codes | Object |
- statusCode | HTTP status code returned by the request, such as 200 , 403 , and 404 | Number |
- headers | Header information returned by the request | Object |
data | Data returned when the request is successful. If the request fails, this is null | Object |
- statusCode | HTTP status code returned by the request, such as 200 , 403 , and 404 | Number |
- headers | Header information returned by the request | Object |
cos.getBucketVersioning({Bucket: 'examplebucket-1250000000', /*Required*/Region: 'COS_REGION', /* Bucket region. Required */}, function (err, data) {console.log(err || data);});
Parameter Name | Description | Type | Required |
Bucket | Bucket for which versioning is queried in the format: BucketName-APPID | String | Yes |
Region | Bucket region. For the enumerated values, see Regions and Access Domain Names | String | Yes |
function(err, data) { ... }
Parameter Name | Description | Type |
err | Object returned when an error (network error or service error) occurs. If the request is successful, this is null. For more information, see Error Codes | Object |
- statusCode | HTTP status code returned by the request, such as 200 , 403 , and 404 | Number |
- headers | Header information returned by the request | Object |
data | Data returned when the request is successful. If the request fails, this is null | Object |
- statusCode | HTTP status code returned by the request, such as 200 , 403 , and 404 | Number |
- headers | Header information returned by the request | Object |
- VersioningConfiguration | Versioning configuration of the bucket | Object |
- - Status | Versioning status; enumerated values: Enabled , Suspended | String |
Apakah halaman ini membantu?