Restoring Archive Objects
API Description
You can use this API to restore an Archive object in a specified bucket.
Method Definition
func (obsClient ObsClient) RestoreObject(input *RestoreObjectInput) (output *BaseModel, err error)
Method Definition If a Signed URL Is Used
func (obsClient ObsClient) RestoreObjectWithSignedUrl(signedUrl string, actualSignedRequestHeaders http.Header, data io.Reader) (output *BaseModel, err error)
Request Parameter
| Field | Type | Optional or Mandatory |
|---|---|---|
| input | Mandatory |
Returned Results
| Field | Type |
|---|---|
| output | |
| err | error |
Sample Code
func main() { input := &obs.RestoreObjectInput{} input.Bucket = "bucketname" input.Key = "objectkey" input.Days = 1 input.Tier = obs.RestoreTierExpedited output, err := obsClient.RestoreObject(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) } } }
- The object specified in ObsClient.RestoreObject must be in the Archive storage class. Otherwise, an error will be reported when you call this API.
- RestoreObjectInput.Days is used to specify how long (1 to 30 days) the restored object will be retained and RestoreObjectInput.Tier is used to specify how fast the object will be restored.
Last Article: Processing an Image
Next Article: Modifying an Object
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.