Updated on 2022-02-10 GMT+08:00
GET Object versions
API Description
You can use this API to list versioning objects in a bucket. By default, a maximum of 1000 versioning objects are listed.
Method Definition
func (obsClient ObsClient) ListVersions(input *ListVersionsInput) (output *ListVersionsOutput, err error)
Method Definition If a Signed URL Is Used
func (obsClient ObsClient) ListVersionsWithSignedUrl(signedUrl string, actualSignedRequestHeaders http.Header) (output *ListVersionsOutput, err error)
Request Parameter
Field |
Type |
Optional or Mandatory |
---|---|---|
input |
Mandatory |
Returned Result
Field |
Type |
---|---|
output |
|
err |
error |
Sample Code
func main() { input := &obs.ListVersionsInput{} input.Bucket = "bucketname" input.MaxKeys = 100 output, err := obsClient.ListVersions(input) if err == nil { fmt.Printf("RequestId:%s\n", output.RequestId) for index, val := range output.Versions { fmt.Printf("Version[%d]-OwnerId:%s, ETag:%s, Key:%s, VersionId:%s, LastModified:%s, Size:%d\n", index, val.Owner.ID, val.ETag, val.Key, val.VersionId, val.LastModified, val.Size) } for index, val := range output.DeleteMarkers { fmt.Printf("DeleteMarker[%d]-OwnerId:%s, Key:%s, VersionId:%s, LastModified:%s\n", index, val.Owner.ID, val.Key, val.VersionId, val.LastModified) } } else { if obsError, ok := err.(obs.ObsError); ok { fmt.Println(obsError.Code) fmt.Println(obsError.Message) } else { fmt.Println(err) } } }
Parent topic: Bucket-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