public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.S3.Model.RestoreObjectRequest(); if (cmdletContext.BucketName != null) { request.BucketName = cmdletContext.BucketName; } if (cmdletContext.Key != null) { request.Key = cmdletContext.Key; } if (cmdletContext.CopyLifetimeInDays != null) { request.Days = cmdletContext.CopyLifetimeInDays.Value; } if (cmdletContext.VersionId != null) { request.VersionId = cmdletContext.VersionId; } if (cmdletContext.RequestPayer != null) { request.RequestPayer = cmdletContext.RequestPayer; } if (cmdletContext.Tier != null) { request.Tier = cmdletContext.Tier; } if (cmdletContext.RetrievalTier != null) { request.RetrievalTier = cmdletContext.RetrievalTier; } if (cmdletContext.RestoreRequestType != null) { request.RestoreRequestType = cmdletContext.RestoreRequestType; } if (cmdletContext.Description != null) { request.Description = cmdletContext.Description; } if (cmdletContext.SelectParameter != null) { request.SelectParameters = cmdletContext.SelectParameter; } // populate OutputLocation var requestOutputLocationIsNull = true; request.OutputLocation = new Amazon.S3.Model.OutputLocation(); Amazon.S3.Model.S3Location requestOutputLocation_outputLocation_S3 = null; // populate S3 var requestOutputLocation_outputLocation_S3IsNull = true; requestOutputLocation_outputLocation_S3 = new Amazon.S3.Model.S3Location(); System.String requestOutputLocation_outputLocation_S3_s3_BucketName = null; if (cmdletContext.S3_BucketName != null) { requestOutputLocation_outputLocation_S3_s3_BucketName = cmdletContext.S3_BucketName; } if (requestOutputLocation_outputLocation_S3_s3_BucketName != null) { requestOutputLocation_outputLocation_S3.BucketName = requestOutputLocation_outputLocation_S3_s3_BucketName; requestOutputLocation_outputLocation_S3IsNull = false; } System.String requestOutputLocation_outputLocation_S3_s3_Prefix = null; if (cmdletContext.S3_Prefix != null) { requestOutputLocation_outputLocation_S3_s3_Prefix = cmdletContext.S3_Prefix; } if (requestOutputLocation_outputLocation_S3_s3_Prefix != null) { requestOutputLocation_outputLocation_S3.Prefix = requestOutputLocation_outputLocation_S3_s3_Prefix; requestOutputLocation_outputLocation_S3IsNull = false; } Amazon.S3.S3CannedACL requestOutputLocation_outputLocation_S3_s3_CannedACL = null; if (cmdletContext.S3_CannedACL != null) { requestOutputLocation_outputLocation_S3_s3_CannedACL = cmdletContext.S3_CannedACL; } if (requestOutputLocation_outputLocation_S3_s3_CannedACL != null) { requestOutputLocation_outputLocation_S3.CannedACL = requestOutputLocation_outputLocation_S3_s3_CannedACL; requestOutputLocation_outputLocation_S3IsNull = false; } Amazon.S3.Model.MetadataCollection requestOutputLocation_outputLocation_S3_s3_UserMetadata = null; if (cmdletContext.S3_UserMetadata != null) { requestOutputLocation_outputLocation_S3_s3_UserMetadata = cmdletContext.S3_UserMetadata; } if (requestOutputLocation_outputLocation_S3_s3_UserMetadata != null) { requestOutputLocation_outputLocation_S3.UserMetadata = requestOutputLocation_outputLocation_S3_s3_UserMetadata; requestOutputLocation_outputLocation_S3IsNull = false; } Amazon.S3.S3StorageClass requestOutputLocation_outputLocation_S3_s3_StorageClass = null; if (cmdletContext.S3_StorageClass != null) { requestOutputLocation_outputLocation_S3_s3_StorageClass = cmdletContext.S3_StorageClass; } if (requestOutputLocation_outputLocation_S3_s3_StorageClass != null) { requestOutputLocation_outputLocation_S3.StorageClass = requestOutputLocation_outputLocation_S3_s3_StorageClass; requestOutputLocation_outputLocation_S3IsNull = false; } Amazon.S3.Model.Tagging requestOutputLocation_outputLocation_S3_outputLocation_S3_Tagging = null; // populate Tagging var requestOutputLocation_outputLocation_S3_outputLocation_S3_TaggingIsNull = true; requestOutputLocation_outputLocation_S3_outputLocation_S3_Tagging = new Amazon.S3.Model.Tagging(); List <Amazon.S3.Model.Tag> requestOutputLocation_outputLocation_S3_outputLocation_S3_Tagging_tagging_TagSet = null; if (cmdletContext.Tagging_TagSet != null) { requestOutputLocation_outputLocation_S3_outputLocation_S3_Tagging_tagging_TagSet = cmdletContext.Tagging_TagSet; } if (requestOutputLocation_outputLocation_S3_outputLocation_S3_Tagging_tagging_TagSet != null) { requestOutputLocation_outputLocation_S3_outputLocation_S3_Tagging.TagSet = requestOutputLocation_outputLocation_S3_outputLocation_S3_Tagging_tagging_TagSet; requestOutputLocation_outputLocation_S3_outputLocation_S3_TaggingIsNull = false; } // determine if requestOutputLocation_outputLocation_S3_outputLocation_S3_Tagging should be set to null if (requestOutputLocation_outputLocation_S3_outputLocation_S3_TaggingIsNull) { requestOutputLocation_outputLocation_S3_outputLocation_S3_Tagging = null; } if (requestOutputLocation_outputLocation_S3_outputLocation_S3_Tagging != null) { requestOutputLocation_outputLocation_S3.Tagging = requestOutputLocation_outputLocation_S3_outputLocation_S3_Tagging; requestOutputLocation_outputLocation_S3IsNull = false; } Amazon.S3.Model.S3AccessControlList requestOutputLocation_outputLocation_S3_outputLocation_S3_AccessControlList = null; // populate AccessControlList var requestOutputLocation_outputLocation_S3_outputLocation_S3_AccessControlListIsNull = true; requestOutputLocation_outputLocation_S3_outputLocation_S3_AccessControlList = new Amazon.S3.Model.S3AccessControlList(); List <Amazon.S3.Model.S3Grant> requestOutputLocation_outputLocation_S3_outputLocation_S3_AccessControlList_accessControlList_Grant = null; if (cmdletContext.AccessControlList_Grant != null) { requestOutputLocation_outputLocation_S3_outputLocation_S3_AccessControlList_accessControlList_Grant = cmdletContext.AccessControlList_Grant; } if (requestOutputLocation_outputLocation_S3_outputLocation_S3_AccessControlList_accessControlList_Grant != null) { requestOutputLocation_outputLocation_S3_outputLocation_S3_AccessControlList.Grants = requestOutputLocation_outputLocation_S3_outputLocation_S3_AccessControlList_accessControlList_Grant; requestOutputLocation_outputLocation_S3_outputLocation_S3_AccessControlListIsNull = false; } Amazon.S3.Model.Owner requestOutputLocation_outputLocation_S3_outputLocation_S3_AccessControlList_outputLocation_S3_AccessControlList_Owner = null; // populate Owner var requestOutputLocation_outputLocation_S3_outputLocation_S3_AccessControlList_outputLocation_S3_AccessControlList_OwnerIsNull = true; requestOutputLocation_outputLocation_S3_outputLocation_S3_AccessControlList_outputLocation_S3_AccessControlList_Owner = new Amazon.S3.Model.Owner(); System.String requestOutputLocation_outputLocation_S3_outputLocation_S3_AccessControlList_outputLocation_S3_AccessControlList_Owner_owner_DisplayName = null; if (cmdletContext.Owner_DisplayName != null) { requestOutputLocation_outputLocation_S3_outputLocation_S3_AccessControlList_outputLocation_S3_AccessControlList_Owner_owner_DisplayName = cmdletContext.Owner_DisplayName; } if (requestOutputLocation_outputLocation_S3_outputLocation_S3_AccessControlList_outputLocation_S3_AccessControlList_Owner_owner_DisplayName != null) { requestOutputLocation_outputLocation_S3_outputLocation_S3_AccessControlList_outputLocation_S3_AccessControlList_Owner.DisplayName = requestOutputLocation_outputLocation_S3_outputLocation_S3_AccessControlList_outputLocation_S3_AccessControlList_Owner_owner_DisplayName; requestOutputLocation_outputLocation_S3_outputLocation_S3_AccessControlList_outputLocation_S3_AccessControlList_OwnerIsNull = false; } System.String requestOutputLocation_outputLocation_S3_outputLocation_S3_AccessControlList_outputLocation_S3_AccessControlList_Owner_owner_Id = null; if (cmdletContext.Owner_Id != null) { requestOutputLocation_outputLocation_S3_outputLocation_S3_AccessControlList_outputLocation_S3_AccessControlList_Owner_owner_Id = cmdletContext.Owner_Id; } if (requestOutputLocation_outputLocation_S3_outputLocation_S3_AccessControlList_outputLocation_S3_AccessControlList_Owner_owner_Id != null) { requestOutputLocation_outputLocation_S3_outputLocation_S3_AccessControlList_outputLocation_S3_AccessControlList_Owner.Id = requestOutputLocation_outputLocation_S3_outputLocation_S3_AccessControlList_outputLocation_S3_AccessControlList_Owner_owner_Id; requestOutputLocation_outputLocation_S3_outputLocation_S3_AccessControlList_outputLocation_S3_AccessControlList_OwnerIsNull = false; } // determine if requestOutputLocation_outputLocation_S3_outputLocation_S3_AccessControlList_outputLocation_S3_AccessControlList_Owner should be set to null if (requestOutputLocation_outputLocation_S3_outputLocation_S3_AccessControlList_outputLocation_S3_AccessControlList_OwnerIsNull) { requestOutputLocation_outputLocation_S3_outputLocation_S3_AccessControlList_outputLocation_S3_AccessControlList_Owner = null; } if (requestOutputLocation_outputLocation_S3_outputLocation_S3_AccessControlList_outputLocation_S3_AccessControlList_Owner != null) { requestOutputLocation_outputLocation_S3_outputLocation_S3_AccessControlList.Owner = requestOutputLocation_outputLocation_S3_outputLocation_S3_AccessControlList_outputLocation_S3_AccessControlList_Owner; requestOutputLocation_outputLocation_S3_outputLocation_S3_AccessControlListIsNull = false; } // determine if requestOutputLocation_outputLocation_S3_outputLocation_S3_AccessControlList should be set to null if (requestOutputLocation_outputLocation_S3_outputLocation_S3_AccessControlListIsNull) { requestOutputLocation_outputLocation_S3_outputLocation_S3_AccessControlList = null; } if (requestOutputLocation_outputLocation_S3_outputLocation_S3_AccessControlList != null) { requestOutputLocation_outputLocation_S3.AccessControlList = requestOutputLocation_outputLocation_S3_outputLocation_S3_AccessControlList; requestOutputLocation_outputLocation_S3IsNull = false; } Amazon.S3.Model.S3Encryption requestOutputLocation_outputLocation_S3_outputLocation_S3_Encryption = null; // populate Encryption var requestOutputLocation_outputLocation_S3_outputLocation_S3_EncryptionIsNull = true; requestOutputLocation_outputLocation_S3_outputLocation_S3_Encryption = new Amazon.S3.Model.S3Encryption(); Amazon.S3.ServerSideEncryptionMethod requestOutputLocation_outputLocation_S3_outputLocation_S3_Encryption_encryption_EncryptionType = null; if (cmdletContext.Encryption_EncryptionType != null) { requestOutputLocation_outputLocation_S3_outputLocation_S3_Encryption_encryption_EncryptionType = cmdletContext.Encryption_EncryptionType; } if (requestOutputLocation_outputLocation_S3_outputLocation_S3_Encryption_encryption_EncryptionType != null) { requestOutputLocation_outputLocation_S3_outputLocation_S3_Encryption.EncryptionType = requestOutputLocation_outputLocation_S3_outputLocation_S3_Encryption_encryption_EncryptionType; requestOutputLocation_outputLocation_S3_outputLocation_S3_EncryptionIsNull = false; } System.String requestOutputLocation_outputLocation_S3_outputLocation_S3_Encryption_encryption_KMSKeyId = null; if (cmdletContext.Encryption_KMSKeyId != null) { requestOutputLocation_outputLocation_S3_outputLocation_S3_Encryption_encryption_KMSKeyId = cmdletContext.Encryption_KMSKeyId; } if (requestOutputLocation_outputLocation_S3_outputLocation_S3_Encryption_encryption_KMSKeyId != null) { requestOutputLocation_outputLocation_S3_outputLocation_S3_Encryption.KMSKeyId = requestOutputLocation_outputLocation_S3_outputLocation_S3_Encryption_encryption_KMSKeyId; requestOutputLocation_outputLocation_S3_outputLocation_S3_EncryptionIsNull = false; } System.String requestOutputLocation_outputLocation_S3_outputLocation_S3_Encryption_encryption_KMSContext = null; if (cmdletContext.Encryption_KMSContext != null) { requestOutputLocation_outputLocation_S3_outputLocation_S3_Encryption_encryption_KMSContext = cmdletContext.Encryption_KMSContext; } if (requestOutputLocation_outputLocation_S3_outputLocation_S3_Encryption_encryption_KMSContext != null) { requestOutputLocation_outputLocation_S3_outputLocation_S3_Encryption.KMSContext = requestOutputLocation_outputLocation_S3_outputLocation_S3_Encryption_encryption_KMSContext; requestOutputLocation_outputLocation_S3_outputLocation_S3_EncryptionIsNull = false; } // determine if requestOutputLocation_outputLocation_S3_outputLocation_S3_Encryption should be set to null if (requestOutputLocation_outputLocation_S3_outputLocation_S3_EncryptionIsNull) { requestOutputLocation_outputLocation_S3_outputLocation_S3_Encryption = null; } if (requestOutputLocation_outputLocation_S3_outputLocation_S3_Encryption != null) { requestOutputLocation_outputLocation_S3.Encryption = requestOutputLocation_outputLocation_S3_outputLocation_S3_Encryption; requestOutputLocation_outputLocation_S3IsNull = false; } // determine if requestOutputLocation_outputLocation_S3 should be set to null if (requestOutputLocation_outputLocation_S3IsNull) { requestOutputLocation_outputLocation_S3 = null; } if (requestOutputLocation_outputLocation_S3 != null) { request.OutputLocation.S3 = requestOutputLocation_outputLocation_S3; requestOutputLocationIsNull = false; } // determine if request.OutputLocation should be set to null if (requestOutputLocationIsNull) { request.OutputLocation = null; } CmdletOutput output; // issue call var client = Client ?? CreateClient(_CurrentCredentials, _RegionEndpoint); try { var response = CallAWSServiceOperation(client, request); object pipelineOutput = null; pipelineOutput = cmdletContext.Select(response, this); output = new CmdletOutput { PipelineOutput = pipelineOutput, ServiceResponse = response }; } catch (Exception e) { output = new CmdletOutput { ErrorResponse = e }; } return(output); }
private Amazon.S3.Model.RestoreObjectResponse CallAWSServiceOperation(IAmazonS3 client, Amazon.S3.Model.RestoreObjectRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Simple Storage Service (S3)", "RestoreObject"); try { #if DESKTOP return(client.RestoreObject(request)); #elif CORECLR return(client.RestoreObjectAsync(request).GetAwaiter().GetResult()); #else #error "Unknown build edition" #endif } catch (AmazonServiceException exc) { var webException = exc.InnerException as System.Net.WebException; if (webException != null) { throw new Exception(Utils.Common.FormatNameResolutionFailureMessage(client.Config, webException.Message), webException); } throw; } }
/// <summary> /// Initiates the asynchronous execution of the RestoreObject operation. /// <seealso cref="Amazon.S3.IAmazonS3.RestoreObject"/> /// </summary> /// /// <param name="restoreObjectRequest">Container for the necessary parameters to execute the RestoreObject operation on AmazonS3.</param> /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param> /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback /// procedure using the AsyncState property.</param> public IAsyncResult BeginRestoreObject(RestoreObjectRequest restoreObjectRequest, AsyncCallback callback, object state) { return invokeRestoreObject(restoreObjectRequest, callback, state, false); }
IAsyncResult invokeRestoreObject(RestoreObjectRequest restoreObjectRequest, AsyncCallback callback, object state, bool synchronized) { IRequest irequest = new RestoreObjectRequestMarshaller().Marshall(restoreObjectRequest); var unmarshaller = RestoreObjectResponseUnmarshaller.GetInstance(); AsyncResult result = new AsyncResult(irequest, callback, state, synchronized, signer, unmarshaller); Invoke(result); return result; }
/// <summary> /// Initiates the asynchronous execution of the RestoreObject operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the RestoreObject operation on AmazonS3Client.</param> /// <param name="callback">An Action delegate that is invoked when the operation completes.</param> /// <param name="options">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback /// procedure using the AsyncState property.</param> public void RestoreObjectAsync(RestoreObjectRequest request, AmazonServiceCallback<RestoreObjectRequest, RestoreObjectResponse> callback, AsyncOptions options = null) { options = options == null?new AsyncOptions():options; var marshaller = new RestoreObjectRequestMarshaller(); var unmarshaller = RestoreObjectResponseUnmarshaller.Instance; Action<AmazonWebServiceRequest, AmazonWebServiceResponse, Exception, AsyncOptions> callbackHelper = null; if(callback !=null ) callbackHelper = (AmazonWebServiceRequest req, AmazonWebServiceResponse res, Exception ex, AsyncOptions ao) => { AmazonServiceResult<RestoreObjectRequest,RestoreObjectResponse> responseObject = new AmazonServiceResult<RestoreObjectRequest,RestoreObjectResponse>((RestoreObjectRequest)req, (RestoreObjectResponse)res, ex , ao.State); callback(responseObject); }; BeginInvoke<RestoreObjectRequest>(request, marshaller, unmarshaller, options, callbackHelper); }
/// <summary> /// <para>Restores an archived copy of an object back into Amazon S3</para> /// </summary> /// /// <param name="restoreObjectRequest">Container for the necessary parameters to execute the RestoreObject service method on AmazonS3.</param> /// public RestoreObjectResponse RestoreObject(RestoreObjectRequest restoreObjectRequest) { IAsyncResult asyncResult = invokeRestoreObject(restoreObjectRequest, null, null, true); return EndRestoreObject(asyncResult); }
/// <summary> /// Restores an archived copy of an object back into Amazon S3 /// </summary> /// <param name="bucketName">A property of RestoreObjectRequest used to execute the RestoreObject service method.</param> /// <param name="key">A property of RestoreObjectRequest used to execute the RestoreObject service method.</param> /// <param name="versionId">A property of RestoreObjectRequest used to execute the RestoreObject service method.</param> /// <param name="days">A property of RestoreObjectRequest used to execute the RestoreObject service method.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// /// <returns>The response from the RestoreObject service method, as returned by S3.</returns> public Task<RestoreObjectResponse> RestoreObjectAsync(string bucketName, string key, string versionId, int days, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var request = new RestoreObjectRequest(); request.BucketName = bucketName; request.Key = key; request.VersionId = versionId; request.Days = days; return RestoreObjectAsync(request, cancellationToken); }
/// <summary> /// <para>Restores an archived copy of an object back into Amazon S3</para> /// </summary> /// /// <param name="restoreObjectRequest">Container for the necessary parameters to execute the RestoreObject service method on AmazonS3.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> public async Task<RestoreObjectResponse> RestoreObjectAsync(RestoreObjectRequest restoreObjectRequest, CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new RestoreObjectRequestMarshaller(); var unmarshaller = RestoreObjectResponseUnmarshaller.GetInstance(); var response = await Invoke<IRequest, RestoreObjectRequest, RestoreObjectResponse>(restoreObjectRequest, marshaller, unmarshaller, signer, cancellationToken) .ConfigureAwait(continueOnCapturedContext: false); return response; }
/// <summary> /// Restores an archived copy of an object back into Amazon S3 /// </summary> /// <param name="bucketName">A property of RestoreObjectRequest used to execute the RestoreObject service method.</param> /// <param name="key">A property of RestoreObjectRequest used to execute the RestoreObject service method.</param> /// /// <returns>The response from the RestoreObject service method, as returned by S3.</returns> public RestoreObjectResponse RestoreObject(string bucketName, string key) { var request = new RestoreObjectRequest(); request.BucketName = bucketName; request.Key = key; return RestoreObject(request); }
/// <summary> /// Restores an archived copy of an object back into Amazon S3 /// </summary> /// <param name="bucketName">A property of RestoreObjectRequest used to execute the RestoreObject service method.</param> /// <param name="key">A property of RestoreObjectRequest used to execute the RestoreObject service method.</param> /// <param name="versionId">A property of RestoreObjectRequest used to execute the RestoreObject service method.</param> /// <param name="days">A property of RestoreObjectRequest used to execute the RestoreObject service method.</param> /// /// <returns>The response from the RestoreObject service method, as returned by S3.</returns> public RestoreObjectResponse RestoreObject(string bucketName, string key, string versionId, int days) { var request = new RestoreObjectRequest(); request.BucketName = bucketName; request.Key = key; request.VersionId = versionId; request.Days = days; return RestoreObject(request); }
/// <summary> /// Initiates the asynchronous execution of the RestoreObject operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the RestoreObject operation on AmazonS3Client.</param> /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param> /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback /// procedure using the AsyncState property.</param> /// /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndRestoreObject /// operation.</returns> public IAsyncResult BeginRestoreObject(RestoreObjectRequest request, AsyncCallback callback, object state) { var marshaller = new RestoreObjectRequestMarshaller(); var unmarshaller = RestoreObjectResponseUnmarshaller.Instance; return BeginInvoke<RestoreObjectRequest>(request, marshaller, unmarshaller, callback, state); }
/// <summary> /// Initiates the asynchronous execution of the RestoreObject operation. /// <seealso cref="Amazon.S3.IAmazonS3.RestoreObject"/> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the RestoreObject operation.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// <returns>The task object representing the asynchronous operation.</returns> public Task<RestoreObjectResponse> RestoreObjectAsync(RestoreObjectRequest request, CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new RestoreObjectRequestMarshaller(); var unmarshaller = RestoreObjectResponseUnmarshaller.GetInstance(); return Invoke<IRequest, RestoreObjectRequest, RestoreObjectResponse>(request, marshaller, unmarshaller, signer, cancellationToken); }
/// <summary> /// <para>Restores an archived copy of an object back into Amazon S3</para> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the RestoreObject service method on AmazonS3.</param> public RestoreObjectResponse RestoreObject(RestoreObjectRequest request) { var task = RestoreObjectAsync(request); try { return task.Result; } catch(AggregateException e) { throw e.InnerException; } }
internal RestoreObjectResponse RestoreObject(RestoreObjectRequest request) { var marshaller = new RestoreObjectRequestMarshaller(); var unmarshaller = RestoreObjectResponseUnmarshaller.Instance; return Invoke<RestoreObjectRequest,RestoreObjectResponse>(request, marshaller, unmarshaller); }
/// <summary> /// Restores an archived copy of an object back into Amazon S3 /// </summary> /// <param name="bucketName">A property of RestoreObjectRequest used to execute the RestoreObject service method.</param> /// <param name="key">A property of RestoreObjectRequest used to execute the RestoreObject service method.</param> /// <param name="versionId">A property of RestoreObjectRequest used to execute the RestoreObject service method.</param> /// <param name="days">A property of RestoreObjectRequest used to execute the RestoreObject service method.</param> /// <param name="callback">An Action delegate that is invoked when the operation completes.</param> /// <param name="options"> /// A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback /// procedure using the AsyncState property. /// </param> /// /// <returns>The response from the RestoreObject service method, as returned by S3.</returns> public void RestoreObjectAsync(string bucketName, string key, string versionId, int days, AmazonServiceCallback<RestoreObjectRequest, RestoreObjectResponse> callback, AsyncOptions options = null) { var request = new RestoreObjectRequest(); request.BucketName = bucketName; request.Key = key; request.VersionId = versionId; request.Days = days; RestoreObjectAsync(request, callback, options); }
/// <summary> /// Initiates the asynchronous execution of the RestoreObject operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the RestoreObject operation.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// <returns>The task object representing the asynchronous operation.</returns> public Task<RestoreObjectResponse> RestoreObjectAsync(RestoreObjectRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new RestoreObjectRequestMarshaller(); var unmarshaller = RestoreObjectResponseUnmarshaller.Instance; return InvokeAsync<RestoreObjectRequest,RestoreObjectResponse>(request, marshaller, unmarshaller, cancellationToken); }
/// <summary> /// <para>Restores an archived copy of an object back into Amazon S3</para> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the RestoreObject service method on AmazonS3.</param> public RestoreObjectResponse RestoreObject(RestoreObjectRequest request) { var task = RestoreObjectAsync(request); try { return task.Result; } catch(AggregateException e) { ExceptionDispatchInfo.Capture(e.InnerException).Throw(); return null; } }