(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.
; This example requires the Chilkat API to have been previously unlocked.
; See Global Unlock Sample for sample code.
$oHttp = ObjCreate("Chilkat.Http")
Local $bSuccess
; 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"
$oSa = ObjCreate("Chilkat.StringArray")
$oSa.Append($sObjectName1)
$oSa.Append($sObjectName2)
Local $oResp = $oHttp.S3_DeleteMultipleObjects($sBucketName,$oSa)
If ($oHttp.LastMethodSuccess = False) Then
ConsoleWrite($oHttp.LastErrorText & @CRLF)
Exit
EndIf
ConsoleWrite("Response status code = " & $oHttp.LastStatus & @CRLF)
; Display the XML response.
ConsoleWrite($oResp.BodyStr & @CRLF)
|