API | Operation | Description |
Setting versioning | Sets the versioning configuration of a bucket | |
Querying versioning | Queries the versioning configuration of a bucket |
public void setBucketVersioningConfiguration(SetBucketVersioningConfigurationRequest setBucketVersioningConfigurationRequest)throws CosClientException, CosServiceException;
Parameter | Description | Type |
setBucketVersioningConfigurationRequest | Versioning configuration | SetBucketVersioningConfigurationRequest |
CosClientException
or CosServiceException
exception thrown. For more information, please see Troubleshooting.String bucketName = "examplebucket-1250000000";// Enable versioningcosClient.setBucketVersioningConfiguration(new SetBucketVersioningConfigurationRequest(bucketName,new BucketVersioningConfiguration(BucketVersioningConfiguration.ENABLED)));
String bucketName = "examplebucket-1250000000";// Suspend versioningcosClient.setBucketVersioningConfiguration(new SetBucketVersioningConfigurationRequest(bucketName,new BucketVersioningConfiguration(BucketVersioningConfiguration.SUSPENDED)));
// Method 1: enter the bucket namepublic BucketVersioningConfiguration getBucketVersioningConfiguration(String bucketName)throws CosClientException, CosServiceException;// Method 2: get the configuration through GetBucketVersioningConfigurationRequestpublic BucketVersioningConfiguration getBucketVersioningConfiguration(GetBucketVersioningConfigurationRequest getBucketVersioningConfigurationRequest)throws CosClientException, CosServiceException;
String bucketName = "examplebucket-1250000000";// Get versioning informationBucketVersioningConfiguration bvc =cosClient.getBucketVersioningConfiguration(bucketName);// Get versioning informationBucketVersioningConfiguration bvc2 = cosClient.getBucketVersioningConfiguration(new GetBucketVersioningConfigurationRequest(bucketName));
Parameter | Description | Type |
bucketName | String | |
getBucketVersioningConfigurationRequest | Request to get the versioning configuration | GetBucketVersioningConfigurationRequest |
CosClientException
or CosServiceException
exception thrown. For more information, please see Troubleshooting.
Apakah halaman ini membantu?