cos:PostObjectRestore. For more information on authorization, see CAM-supported business APIs.Feature Name | Description | Example code |
Recovering Archived Objects | Restore (thaw) an object of the ARCHIVE or DEEP_ARCHIVE storage class to read its content. |
// A bucket name consists of bucketname-appid. You must include the appid. You can view bucket names in the COS console. https://console.tencentcloud.com/cos5/bucketString bucket = "examplebucket-1250000000";String cosPath = "exampleobject"; // The location identifier of the object in the bucket, i.e., the object key.RestoreRequest restoreRequest = new RestoreRequest(bucket, cosPath);restoreRequest.setExpireDays(5); // Retain for 5 daysrestoreRequest.setTier(RestoreConfigure.Tier.Standard); // Standard restore modecosXmlService.restoreObjectAsync(restoreRequest, new CosXmlResultListener() {@Overridepublic void onSuccess(CosXmlRequest request, CosXmlResult result) {RestoreResult restoreResult = (RestoreResult) result;}// If you call the API using kotlin, note that the exception in the callback method must be nullable. Otherwise, the onFail method will not be called, as follows:// The type of clientException is CosXmlClientException?, and the type of serviceException is CosXmlServiceException?@Overridepublic void onFail(CosXmlRequest cosXmlRequest,@Nullable CosXmlClientException clientException,@Nullable CosXmlServiceException serviceException) {if (clientException != null) {clientException.printStackTrace();} else {serviceException.printStackTrace();}}});
Esta página foi útil?
Você também pode entrar em contato com a Equipe de vendas ou Enviar um tíquete em caso de ajuda.
comentários