Restoring a Versioning Archive Object
You can call OBSRestoreObjectRequest to pass the version ID (versionID) to restore a versioning Archive object. Sample code is as follows:
static OBSClient *client;
NSString *endPoint = @"your-endpoint";
NSString *SK = @"*** Provide your Secret Key ***";
NSString *AK = @"*** Provide your Access Key ***";
// Initialize identity authentication.
OBSStaticCredentialProvider *credentialProvider = [[OBSStaticCredentialProvider alloc] initWithAccessKey:AK secretKey:SK];
//Initialize service configuration.
OBSServiceConfiguration *conf = [[OBSServiceConfiguration alloc] initWithURLString:endPoint credentialProvider:credentialProvider];
// Initialize an instance of OBSClient.
client = [[OBSClient alloc] initWithConfiguration:conf];
// Restore an Archive object.
OBSRestoreObjectRequest *request = [[OBSRestoreObjectRequest alloc]initWithBucketName:@"bucketname" objectKey:@"objectname" storeDays:[NSNumber numberWithInt:30]];//1 to 30
request.restoreTier = OBSRestoreTierExpedited;
// Version ID of a versioning object
request.versionID = @"Version ID of a versioning object";
[client restoreObject:request completionHandler:^(OBSRestoreObjectResponse *response, NSError *error){
NSLog(@"%@",response);
}];
Last Article: Copying a Versioning Object
Next Article: Listing Versioning Objects
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.