(Swift) Wasabi Delete Bucket Objects
Demonstrates how to delete one or more objects in a bucket.Note: This example requires Chilkat v11.0.0 or greater.
func chilkatTest() {
var success: Bool = false
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
let http = CkoHttp()!
// Insert your access key here:
http.awsAccessKey = "access-key"
// Insert your secret key here:
http.awsSecretKey = "secret-key"
// Use the endpoint matching the bucket's region.
http.awsEndpoint = "s3.us-west-1.wasabisys.com"
var bucketName: String? = "chilkattest"
var objectName1: String? = "seahorse.jpg"
var objectName2: String? = "seahorse2.jpg"
let st = CkoStringTable()!
st.append(objectName1)
st.append(objectName2)
let resp = CkoHttpResponse()!
success = http.s3_DeleteObjects(bucketName, objectNames: st, jsonResponse: resp)
if success == false {
print("\(http.lastErrorText!)")
return
}
print("Response status code = \(http.lastStatus.intValue)")
// Display the XML response.
print("\(resp.bodyStr!)")
}
|