本文整理汇总了Java中com.amazonaws.services.s3.model.DeleteBucketRequest类的典型用法代码示例。如果您正苦于以下问题:Java DeleteBucketRequest类的具体用法?Java DeleteBucketRequest怎么用?Java DeleteBucketRequest使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DeleteBucketRequest类属于com.amazonaws.services.s3.model包,在下文中一共展示了DeleteBucketRequest类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import com.amazonaws.services.s3.model.DeleteBucketRequest; //导入依赖的package包/类
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");
}
示例2: deleteBucket
import com.amazonaws.services.s3.model.DeleteBucketRequest; //导入依赖的package包/类
@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);
}
示例3: deleteBucket
import com.amazonaws.services.s3.model.DeleteBucketRequest; //导入依赖的package包/类
public void deleteBucket(String bucketName, boolean recursive) throws AmazonClientException, AmazonServiceException {
if(recursive) {
deleteKeyWithPrefix(bucketName, "");
}
DeleteBucketRequest request = new DeleteBucketRequest(bucketName) ;
s3Client.deleteBucket(request);
}
示例4: deleteBucket
import com.amazonaws.services.s3.model.DeleteBucketRequest; //导入依赖的package包/类
@Override
public void deleteBucket(DeleteBucketRequest deleteBucketRequest) throws AmazonClientException, AmazonServiceException {
delegate.deleteBucket(deleteBucketRequest);
}
示例5: deleteBucket
import com.amazonaws.services.s3.model.DeleteBucketRequest; //导入依赖的package包/类
@Override
public void deleteBucket(DeleteBucketRequest deleteBucketRequest) throws AmazonClientException, AmazonServiceException {
throw new UnsupportedOperationException();
}
示例6: cleanUp
import com.amazonaws.services.s3.model.DeleteBucketRequest; //导入依赖的package包/类
@AfterClass
private void cleanUp() throws Exception {
DeleteBucketRequest deleteBucketRequest = new DeleteBucketRequest(bucketName);
s3Client.deleteBucket(deleteBucketRequest);
}
示例7: deleteBucket
import com.amazonaws.services.s3.model.DeleteBucketRequest; //导入依赖的package包/类
@Override
public void deleteBucket(DeleteBucketRequest deleteBucketRequest) throws SdkClientException, AmazonServiceException {
run(() -> getDelegate().deleteBucket(deleteBucketRequest));
}
示例8: deleteBucket
import com.amazonaws.services.s3.model.DeleteBucketRequest; //导入依赖的package包/类
@Override
public void deleteBucket(DeleteBucketRequest deleteBucketRequest)
throws AmazonClientException
{
}
示例9: deleteBucket
import com.amazonaws.services.s3.model.DeleteBucketRequest; //导入依赖的package包/类
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;
}
示例10: deleteBucket
import com.amazonaws.services.s3.model.DeleteBucketRequest; //导入依赖的package包/类
@Override
public void deleteBucket(DeleteBucketRequest deleteBucketRequest) throws AmazonClientException,
AmazonServiceException {
// TODO Auto-generated method stub
}
示例11: deleteBucket
import com.amazonaws.services.s3.model.DeleteBucketRequest; //导入依赖的package包/类
/**
* 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));
}