Java
Chilkat2 Java
S3 Delete Bucket
See more Amazon S3 Examples
Demonstrates how to delete a bucket.Chilkat Java Downloads
import com.chilkatsoft.chilkat2.ChilkatException;
import com.chilkatsoft.chilkat2.Http;
public class ChilkatExample {
public static void main(String[] args) {
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
Http http = new Http();
// Insert your access key here:
http.setAwsAccessKey("ABQXXABC83ABCDEFVQXX");
// Insert your secret key here:
http.setAwsSecretKey("XXXXYYYYabcdABCD12345678xxxxyyyyzzzz");
http.setKeepResponseBody(true);
try {
http.s3DeleteBucket("chilkattestbucket");
System.out.println("Bucket deleted.");
} catch (ChilkatException e) {
System.out.println(e.getLastErrorText());
// Also examine the error response body from AWS:
System.out.println(http.getLastResponseBody());
}
}
}