Java 类com.amazonaws.services.s3.model.DeleteBucketRequest 实例源码

项目:aws    文件:DeleteObject.java   
public static void main(String[] args) throws Exception {
    DeleteBucketRequest deleteBucketRequest=new DeleteBucketRequest(AWSResources.S3_BUCKET_NAME);
    if(AWSResources.S3.doesBucketExist(AWSResources.S3_BUCKET_NAME))
        try {
                AWSResources.S3.deleteBucket(deleteBucketRequest);
                System.out.println("Bucket Deleted...");
        }
    catch (AmazonS3Exception ex) {
        if(!ex.getErrorCode().equals("BucketNotEmpty"))
            throw ex;
    }
    //List<KeyVersion> keys = new ArrayList<KeyVersion>();
    for(S3ObjectSummary obj : S3Objects.withPrefix(AWSResources.S3, AWSResources.S3_BUCKET_NAME, "")) {
    // Add the keys to our list of object.
    AWSResources.S3.deleteObject(AWSResources.S3_BUCKET_NAME, obj.getKey());
    }
    //DeleteObjectsRequest deleteObjectsRequest = new DeleteObjectsRequest(AWSResources.S3_BUCKET_NAME);
    //AWSResources.S3.deleteObjects(deleteObjectsRequest);
    AWSResources.S3.deleteBucket(deleteBucketRequest);
    if(!AWSResources.S3.doesBucketExist(AWSResources.S3_BUCKET_NAME))
        System.out.println("Deleted");
}
项目:ibm-cos-sdk-java    文件:AmazonS3Client.java   
@Override
public void deleteBucket(DeleteBucketRequest deleteBucketRequest)
        throws SdkClientException, AmazonServiceException {
    deleteBucketRequest = beforeClientExecution(deleteBucketRequest);
    rejectNull(deleteBucketRequest,
            "The DeleteBucketRequest parameter must be specified when deleting a bucket");

    String bucketName = deleteBucketRequest.getBucketName();
    rejectNull(bucketName,
            "The bucket name parameter must be specified when deleting a bucket");

    Request<DeleteBucketRequest> request = createRequest(bucketName, null, deleteBucketRequest, HttpMethodName.DELETE);
    invoke(request, voidResponseHandler, bucketName, null);
    bucketRegionCache.remove(bucketName);
}
项目:Scribengin    文件:S3Client.java   
public void deleteBucket(String bucketName, boolean recursive) throws AmazonClientException, AmazonServiceException {
  if(recursive) {
    deleteKeyWithPrefix(bucketName, "");
  }
  DeleteBucketRequest request = new DeleteBucketRequest(bucketName) ;
  s3Client.deleteBucket(request);
}
项目:elasticsearch_my    文件:AmazonS3Wrapper.java   
@Override
public void deleteBucket(DeleteBucketRequest deleteBucketRequest) throws AmazonClientException, AmazonServiceException {
    delegate.deleteBucket(deleteBucketRequest);
}
项目:syndesis    文件:AmazonS3ClientMock.java   
@Override
public void deleteBucket(DeleteBucketRequest deleteBucketRequest) throws AmazonClientException, AmazonServiceException {
    throw new UnsupportedOperationException();
}
项目:syndesis    文件:AmazonS3ClientMock.java   
@Override
public void deleteBucket(DeleteBucketRequest deleteBucketRequest) throws AmazonClientException, AmazonServiceException {
    throw new UnsupportedOperationException();
}
项目:syndesis    文件:AmazonS3ClientMock.java   
@Override
public void deleteBucket(DeleteBucketRequest deleteBucketRequest) throws AmazonClientException, AmazonServiceException {
    throw new UnsupportedOperationException();
}
项目:connectors    文件:AmazonS3ClientMock.java   
@Override
public void deleteBucket(DeleteBucketRequest deleteBucketRequest) throws AmazonClientException, AmazonServiceException {
    throw new UnsupportedOperationException();
}
项目:connectors    文件:AmazonS3ClientMock.java   
@Override
public void deleteBucket(DeleteBucketRequest deleteBucketRequest) throws AmazonClientException, AmazonServiceException {
    throw new UnsupportedOperationException();
}
项目:connectors    文件:AmazonS3ClientMock.java   
@Override
public void deleteBucket(DeleteBucketRequest deleteBucketRequest) throws AmazonClientException, AmazonServiceException {
    throw new UnsupportedOperationException();
}
项目:aws-photosharing-example    文件:ContentHelperTest.java   
@AfterClass
private void cleanUp() throws Exception {
    DeleteBucketRequest deleteBucketRequest = new DeleteBucketRequest(bucketName);

    s3Client.deleteBucket(deleteBucketRequest);
}
项目:ibm-cos-sdk-java    文件:AmazonS3Client.java   
@Override
public void deleteBucket(String bucketName)
        throws SdkClientException, AmazonServiceException {
    deleteBucket(new DeleteBucketRequest(bucketName));
}
项目:S3Decorators    文件:S3Decorator.java   
@Override
public void deleteBucket(DeleteBucketRequest deleteBucketRequest) throws SdkClientException, AmazonServiceException {
  run(() -> getDelegate().deleteBucket(deleteBucketRequest));
}
项目:Camel    文件:AmazonS3ClientMock.java   
@Override
public void deleteBucket(DeleteBucketRequest deleteBucketRequest) throws AmazonClientException, AmazonServiceException {
    throw new UnsupportedOperationException();
}
项目:presto    文件:MockAmazonS3.java   
@Override
public void deleteBucket(DeleteBucketRequest deleteBucketRequest)
        throws AmazonClientException
{
}
项目:cloudExplorer    文件:BucketClass.java   
String deleteBucket(String access_key, String secret_key,
        String bucket, String endpoint
) {
    String message = null;
    AWSCredentials credentials = new BasicAWSCredentials(access_key, secret_key);
    AmazonS3 s3Client = new AmazonS3Client(credentials,
            new ClientConfiguration());
    if (endpoint.contains("amazonaws.com")) {
        String aws_endpoint = s3Client.getBucketLocation(new GetBucketLocationRequest(bucket));
        if (aws_endpoint.contains("US")) {
            s3Client.setEndpoint("https://s3.amazonaws.com");
        } else if (aws_endpoint.contains("us-west")) {
            s3Client.setEndpoint("https://s3-" + aws_endpoint + ".amazonaws.com");
        } else if (aws_endpoint.contains("eu-west")) {
            s3Client.setEndpoint("https://s3-" + aws_endpoint + ".amazonaws.com");
        } else if (aws_endpoint.contains("ap-")) {
            s3Client.setEndpoint("https://s3-" + aws_endpoint + ".amazonaws.com");
        } else if (aws_endpoint.contains("sa-east-1")) {
            s3Client.setEndpoint("https://s3-" + aws_endpoint + ".amazonaws.com");
        } else {
            s3Client.setEndpoint("https://s3." + aws_endpoint + ".amazonaws.com");
        }
    } else {
        s3Client.setS3ClientOptions(S3ClientOptions.builder().setPathStyleAccess(true).build());
        s3Client.setEndpoint(endpoint);
    }
    message = ("\nDeleting bucket: " + bucket);
    try {
        s3Client.deleteBucket(new DeleteBucketRequest(bucket));
    } catch (Exception Delete) {
        if (terminal) {
            System.out.print("\n\n\n" + Delete.getMessage() + "\n\n\n");
        } else {
            message = message + "\n" + Delete.getMessage();
        }
    }

    if (message == null) {
        message = "\nDelete operation failed.";
    }

    return message;
}
项目:Scribengin    文件:AmazonS3Mock.java   
@Override
public void deleteBucket(DeleteBucketRequest deleteBucketRequest) throws AmazonClientException,
    AmazonServiceException {
  // TODO Auto-generated method stub

}
项目:s3tool    文件:Transporter.java   
/**
 * delete bucket
 * @param region
 * @param tableName
 * @throws ConfigException
 */
public static void deleteBucket(String region, String tableName) throws ConfigException {
    AmazonS3Client client = getClient(region);
    client.deleteBucket(new DeleteBucketRequest(tableName));
}