Updated on 2022-02-10 GMT+08:00
DELETE Objects
API Description
You can use this API to batch delete objects from a specified bucket.
Method Definition
func (obsClient ObsClient) DeleteObjects(input *DeleteObjectsInput) (output *DeleteObjectsOutput, err error)
Method Definition If a Signed URL Is Used
func (obsClient ObsClient) DeleteObjectsWithSignedUrl(signedUrl string, actualSignedRequestHeaders http.Header, data io.Reader) (output *DeleteObjectsOutput, err error)
Request Parameter
Field |
Type |
Optional or Mandatory |
---|---|---|
input |
Mandatory |
Returned Result
Field |
Type |
---|---|
output |
|
err |
error |
Sample Code
func main() { input := &obs.DeleteObjectsInput{} input.Bucket = "bucketname" var objects [3]obs.ObjectToDelete objects[0] = obs.ObjectToDelete{Key: "key1"} objects[1] = obs.ObjectToDelete{Key: "key2"} objects[2] = obs.ObjectToDelete{Key: "key3"} input.Objects = objects[:] output, err := obsClient.DeleteObjects(input) if err == nil { fmt.Printf("RequestId:%s\n", output.RequestId) for index, deleted := range output.Deleteds { fmt.Printf("Deleted[%d]-Key:%s, VersionId:%s\n", index, deleted.Key, deleted.VersionId) } for index, err := range output.Errors { fmt.Printf("Error[%d]-Key:%s, Code:%s\n", index, err.Key, err.Code) } } else { if obsError, ok := err.(obs.ObsError); ok { fmt.Println(obsError.Code) fmt.Println(obsError.Message) } else { fmt.Println(err) } } }
Parent topic: Objects-Related APIs
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
The system is busy. Please try again later.
For any further questions, feel free to contact us through the chatbot.
Chatbot