(Swift 3,4,5...) Wasabi Delete Bucket Objects
Demonstrates how to delete one or more objects in a bucket.
func chilkatTest() {
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
let http = CkoHttp()!
var success: Bool
// 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 sa = CkoStringArray()!
sa.append(objectName1)
sa.append(objectName2)
var resp: CkoHttpResponse? = http.s3_DeleteMultipleObjects(bucketName, objectNames: sa)
if http.lastMethodSuccess == false {
print("\(http.lastErrorText!)")
return
}
print("Response status code = \(http.lastStatus.intValue)")
// Display the XML response.
print("\(resp!.bodyStr!)")
resp = nil
}
|