(Swift) Backblaze S3 Delete Bucket Objects
Demonstrates how to delete 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()!
// keyID = Access Key ID or Access Key
http.awsAccessKey = "access-key"
// applicationKey = Secret Access Key or Secret Key
http.awsSecretKey = "secret-key"
// Region is the 2nd part of your S3 Endpoint
http.awsEndpoint = "s3.us-west-002.backblazeb2.com"
var bucketName: String? = "chilkat-test"
var objectName1: String? = "seahorse.jpg"
var objectName2: String? = "orchard.json"
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!)")
}
|