(AutoIt) OSS Delete Bucket Objects (Alibaba Cloud)
Demonstrates how to delete objects in a bucket.
The Chilkat S3 functions in the HTTP class are compatible with Alibaba Cloud's OSS service. Note: This example requires Chilkat v11.0.0 or greater.
Local $bSuccess = False
; This example requires the Chilkat API to have been previously unlocked.
; See Global Unlock Sample for sample code.
$oHttp = ObjCreate("Chilkat.Http")
; Insert your AccessKey ID here:
$oHttp.AwsAccessKey = "access-key"
; Insert your AccessKey Secret here:
$oHttp.AwsSecretKey = "secret-key"
; To delete objects from a bucket located in a different region, use the domain for that region, such as "oss-cn-hangzhou.aliyuncs.com "
; See Alibaba Object Storage Service Regions and Endpoints
$oHttp.AwsEndpoint = "oss-us-east-1.aliyuncs.com"
Local $sBucketName = "chilkat"
Local $sObjectName1 = "seahorse.jpg"
Local $sObjectName2 = "orchard.json"
$oSt = ObjCreate("Chilkat.StringTable")
$oSt.Append($sObjectName1)
$oSt.Append($sObjectName2)
$oResp = ObjCreate("Chilkat.HttpResponse")
$bSuccess = $oHttp.S3_DeleteObjects($sBucketName,$oSt,$oResp)
If ($bSuccess = False) Then
ConsoleWrite($oHttp.LastErrorText & @CRLF)
Exit
EndIf
ConsoleWrite("Response status code = " & $oHttp.LastStatus & @CRLF)
; Display the XML response.
ConsoleWrite($oResp.BodyStr & @CRLF)
|