(C++) Wasabi Delete Bucket Objects
Demonstrates how to delete one or more objects in a bucket.
#include <CkHttp.h>
#include <CkStringArray.h>
#include <CkHttpResponse.h>
void ChilkatSample(void)
{
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
CkHttp http;
bool success;
// Insert your access key here:
http.put_AwsAccessKey("access-key");
// Insert your secret key here:
http.put_AwsSecretKey("secret-key");
// Use the endpoint matching the bucket's region.
http.put_AwsEndpoint("s3.us-west-1.wasabisys.com");
const char *bucketName = "chilkattest";
const char *objectName1 = "seahorse.jpg";
const char *objectName2 = "seahorse2.jpg";
CkStringArray sa;
sa.Append(objectName1);
sa.Append(objectName2);
CkHttpResponse *resp = http.S3_DeleteMultipleObjects(bucketName,sa);
if (http.get_LastMethodSuccess() == false) {
std::cout << http.lastErrorText() << "\r\n";
return;
}
std::cout << "Response status code = " << http.get_LastStatus() << "\r\n";
// Display the XML response.
std::cout << resp->bodyStr() << "\r\n";
delete resp;
}
|