@Test public void testEmptyWithVersions() throws Exception { // enable versioning on the bucket SetBucketVersioningConfigurationRequest req = new SetBucketVersioningConfigurationRequest( bucketName, new BucketVersioningConfiguration(BucketVersioningConfiguration.ENABLED)); s3.setBucketVersioningConfiguration(req); // create some versions createVersionedObjects(); // empty the bucket of it's contents but leave the bucket itself S3Cleaner.emptyBucket(s3, bucketName, false, offlineContext); // check the bucket is still present but empty assertTrue("Bucket '" + bucketName + "' should still be present", s3.doesBucketExistV2(bucketName)); ObjectListing objects = s3.listObjects(bucketName); assertTrue("Bucket '" + bucketName + "' should be empty", objects.getObjectSummaries().isEmpty()); }
@Override public void setBucketVersioningConfiguration(SetBucketVersioningConfigurationRequest setBucketVersioningConfigurationRequest) throws SdkClientException, AmazonServiceException { setBucketVersioningConfigurationRequest = beforeClientExecution(setBucketVersioningConfigurationRequest); rejectNull(setBucketVersioningConfigurationRequest, "The SetBucketVersioningConfigurationRequest object must be specified when setting versioning configuration"); String bucketName = setBucketVersioningConfigurationRequest.getBucketName(); BucketVersioningConfiguration versioningConfiguration = setBucketVersioningConfigurationRequest.getVersioningConfiguration(); rejectNull(bucketName, "The bucket name parameter must be specified when setting versioning configuration"); rejectNull(versioningConfiguration, "The bucket versioning parameter must be specified when setting versioning configuration"); if (versioningConfiguration.isMfaDeleteEnabled() != null) { rejectNull(setBucketVersioningConfigurationRequest.getMfa(), "The MFA parameter must be specified when changing MFA Delete status in the versioning configuration"); } Request<SetBucketVersioningConfigurationRequest> request = createRequest(bucketName, null, setBucketVersioningConfigurationRequest, HttpMethodName.PUT); request.addParameter("versioning", null); if (versioningConfiguration.isMfaDeleteEnabled() != null) { if (setBucketVersioningConfigurationRequest.getMfa() != null) { populateRequestWithMfaDetails(request, setBucketVersioningConfigurationRequest.getMfa()); } } byte[] bytes = bucketConfigurationXmlFactory.convertToXmlByteArray(versioningConfiguration); request.setContent(new ByteArrayInputStream(bytes)); invoke(request, voidResponseHandler, bucketName, null); }
@Override public void setBucketVersioningConfiguration( SetBucketVersioningConfigurationRequest setBucketVersioningConfigurationRequest) throws AmazonClientException, AmazonServiceException { // TODO Auto-generated method stub }
@Override public void setBucketVersioningConfiguration(SetBucketVersioningConfigurationRequest setBucketVersioningConfigurationRequest) throws AmazonClientException, AmazonServiceException { delegate.setBucketVersioningConfiguration(setBucketVersioningConfigurationRequest); }
@Override public void setBucketVersioningConfiguration(SetBucketVersioningConfigurationRequest setBucketVersioningConfigurationRequest) throws AmazonClientException, AmazonServiceException { throw new UnsupportedOperationException(); }
@Override public void setBucketVersioningConfiguration(SetBucketVersioningConfigurationRequest setBucketVersioningConfigurationRequest) throws SdkClientException, AmazonServiceException { run(() -> getDelegate().setBucketVersioningConfiguration(setBucketVersioningConfigurationRequest)); }
@Override public void setBucketVersioningConfiguration(SetBucketVersioningConfigurationRequest setBucketVersioningConfigurationRequest) throws AmazonClientException { }