Deleting an Object
API Description
You can use this API to delete an object from a specified bucket.
Method Definition
func (obsClient ObsClient) DeleteObject(input *DeleteObjectInput) (output *DeleteObjectOutput, err error)
Method Definition If a Signed URL Is Used
func (obsClient ObsClient) DeleteObjectWithSignedUrl(signedUrl string, actualSignedRequestHeaders http.Header) (output *DeleteObjectOutput, err error)
Request Parameter
| Field | Type | Optional or Mandatory |
|---|---|---|
| input | Mandatory |
Returned Result
| Field | Type |
|---|---|
| output | |
| err | error |
Sample Code
func main() { input := &obs.DeleteObjectInput{} input.Bucket = "bucketname" input.Key = "objectkey" output, err := obsClient.DeleteObject(input) if err == nil { fmt.Printf("RequestId:%s\n", output.RequestId) } else { if obsError, ok := err.(obs.ObsError); ok { fmt.Println(obsError.Code) fmt.Println(obsError.Message) } else { fmt.Println(err) } } }
Last Article: Copying an Object
Next Article: Deleting Objects in a Batch
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.