Container for the parameters to the CreateInstanceExportTask operation.

Exports a running or stopped instance to an Amazon S3 bucket.

For information about the supported operating systems, image formats, and known limitations for the types of instances you can export, see Exporting EC2 Instances in the Amazon Elastic Compute Cloud User Guide .

Inheritance: AmazonEC2Request
        /// <summary>
        /// Initiates the asynchronous execution of the CreateInstanceExportTask operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the CreateInstanceExportTask 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<CreateInstanceExportTaskResponse> CreateInstanceExportTaskAsync(CreateInstanceExportTaskRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new CreateInstanceExportTaskRequestMarshaller();
            var unmarshaller = CreateInstanceExportTaskResponseUnmarshaller.Instance;

            return InvokeAsync<CreateInstanceExportTaskRequest,CreateInstanceExportTaskResponse>(request, marshaller, 
                unmarshaller, cancellationToken);
        }
Exemple #2
0
        /// <summary>
        /// Initiates the asynchronous execution of the CreateInstanceExportTask operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the CreateInstanceExportTask operation on AmazonEC2Client.</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 EndCreateInstanceExportTask
        ///         operation.</returns>
        public IAsyncResult BeginCreateInstanceExportTask(CreateInstanceExportTaskRequest request, AsyncCallback callback, object state)
        {
            var marshaller = new CreateInstanceExportTaskRequestMarshaller();
            var unmarshaller = CreateInstanceExportTaskResponseUnmarshaller.Instance;

            return BeginInvoke<CreateInstanceExportTaskRequest>(request, marshaller, unmarshaller,
                callback, state);
        }
        /// <summary>
        /// Exports a running or stopped instance to an S3 bucket.
        /// 
        ///  
        /// <para>
        /// For information about the supported operating systems, image formats, and known limitations
        /// for the types of instances you can export, see <a href="http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ExportingEC2Instances.html">Exporting
        /// EC2 Instances</a> in the <i>Amazon Elastic Compute Cloud User Guide</i>.
        /// </para>
        /// </summary>
        /// <param name="request">Container for the necessary parameters to execute the CreateInstanceExportTask service method.</param>
        /// 
        /// <returns>The response from the CreateInstanceExportTask service method, as returned by EC2.</returns>
        public CreateInstanceExportTaskResponse CreateInstanceExportTask(CreateInstanceExportTaskRequest request)
        {
            var marshaller = new CreateInstanceExportTaskRequestMarshaller();
            var unmarshaller = CreateInstanceExportTaskResponseUnmarshaller.Instance;

            return Invoke<CreateInstanceExportTaskRequest,CreateInstanceExportTaskResponse>(request, marshaller, unmarshaller);
        }
 /// <summary>
 /// Initiates the asynchronous execution of the CreateInstanceExportTask operation.
 /// <seealso cref="Amazon.EC2.IAmazonEC2.CreateInstanceExportTask"/>
 /// </summary>
 /// 
 /// <param name="createInstanceExportTaskRequest">Container for the necessary parameters to execute the CreateInstanceExportTask operation on
 ///          AmazonEC2.</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
 ///         EndCreateInstanceExportTask operation.</returns>
 public IAsyncResult BeginCreateInstanceExportTask(CreateInstanceExportTaskRequest createInstanceExportTaskRequest, AsyncCallback callback, object state)
 {
     return invokeCreateInstanceExportTask(createInstanceExportTaskRequest, callback, state, false);
 }
 IAsyncResult invokeCreateInstanceExportTask(CreateInstanceExportTaskRequest createInstanceExportTaskRequest, AsyncCallback callback, object state, bool synchronized)
 {
     IRequest irequest = new CreateInstanceExportTaskRequestMarshaller().Marshall(createInstanceExportTaskRequest);
     var unmarshaller = CreateInstanceExportTaskResponseUnmarshaller.GetInstance();
     AsyncResult result = new AsyncResult(irequest, callback, state, synchronized, signer, unmarshaller);
     Invoke(result);
     return result;
 }
        /// <summary>
        /// <para>Exports a running or stopped instance to an Amazon S3 bucket.</para> <para>For information about the supported operating systems,
        /// image formats, and known limitations for the types of instances you can export, see <a href="http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ExportingEC2Instances.html">Exporting EC2 Instances</a> in the <i>Amazon Elastic
        /// Compute Cloud User Guide</i> .</para>
        /// </summary>
        /// 
        /// <param name="createInstanceExportTaskRequest">Container for the necessary parameters to execute the CreateInstanceExportTask service method
        /// on AmazonEC2.</param>
        /// 
        /// <returns>The response from the CreateInstanceExportTask service method, as returned by AmazonEC2.</returns>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
		public Task<CreateInstanceExportTaskResponse> CreateInstanceExportTaskAsync(CreateInstanceExportTaskRequest createInstanceExportTaskRequest, CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new CreateInstanceExportTaskRequestMarshaller();
            var unmarshaller = CreateInstanceExportTaskResponseUnmarshaller.GetInstance();
            return Invoke<IRequest, CreateInstanceExportTaskRequest, CreateInstanceExportTaskResponse>(createInstanceExportTaskRequest, marshaller, unmarshaller, signer, cancellationToken);
        }
 /// <summary>
 /// <para>Exports a running or stopped instance to an Amazon S3 bucket.</para> <para>For information about the supported operating systems,
 /// image formats, and known limitations for the types of instances you can export, see <a
 /// href="http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ExportingEC2Instances.html" >Exporting EC2 Instances</a> in the <i>Amazon Elastic
 /// Compute Cloud User Guide</i> .</para>
 /// </summary>
 /// 
 /// <param name="createInstanceExportTaskRequest">Container for the necessary parameters to execute the CreateInstanceExportTask service method
 ///          on AmazonEC2.</param>
 /// 
 /// <returns>The response from the CreateInstanceExportTask service method, as returned by AmazonEC2.</returns>
 /// 
 public CreateInstanceExportTaskResponse CreateInstanceExportTask(CreateInstanceExportTaskRequest createInstanceExportTaskRequest)
 {
     IAsyncResult asyncResult = invokeCreateInstanceExportTask(createInstanceExportTaskRequest, null, null, true);
     return EndCreateInstanceExportTask(asyncResult);
 }
		internal CreateInstanceExportTaskResponse CreateInstanceExportTask(CreateInstanceExportTaskRequest request)
        {
            var task = CreateInstanceExportTaskAsync(request);
            try
            {
                return task.Result;
            }
            catch(AggregateException e)
            {
                ExceptionDispatchInfo.Capture(e.InnerException).Throw();
                return null;
            }
        }
        /// <summary>
        /// Initiates the asynchronous execution of the CreateInstanceExportTask operation.
        /// <seealso cref="Amazon.EC2.IAmazonEC2.CreateInstanceExportTask"/>
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the CreateInstanceExportTask 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 async Task<CreateInstanceExportTaskResponse> CreateInstanceExportTaskAsync(CreateInstanceExportTaskRequest request, CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new CreateInstanceExportTaskRequestMarshaller();
            var unmarshaller = CreateInstanceExportTaskResponseUnmarshaller.GetInstance();
            var response = await Invoke<IRequest, CreateInstanceExportTaskRequest, CreateInstanceExportTaskResponse>(request, marshaller, unmarshaller, signer, cancellationToken)
                .ConfigureAwait(continueOnCapturedContext: false);
            return response;
        }
        /// <summary>
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the CreateInstanceExportTask service method
        /// on AmazonEC2.</param>
        /// 
        /// <returns>The response from the CreateInstanceExportTask service method, as returned by AmazonEC2.</returns>
		public CreateInstanceExportTaskResponse CreateInstanceExportTask(CreateInstanceExportTaskRequest request)
        {
            var task = CreateInstanceExportTaskAsync(request);
            try
            {
                return task.Result;
            }
            catch(AggregateException e)
            {
                throw e.InnerException;
            }
        }
Exemple #11
0
 private Amazon.EC2.Model.CreateInstanceExportTaskResponse CallAWSServiceOperation(IAmazonEC2 client, Amazon.EC2.Model.CreateInstanceExportTaskRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Elastic Compute Cloud (EC2)", "CreateInstanceExportTask");
     try
     {
         #if DESKTOP
         return(client.CreateInstanceExportTask(request));
         #elif CORECLR
         return(client.CreateInstanceExportTaskAsync(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;
     }
 }
Exemple #12
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.EC2.Model.CreateInstanceExportTaskRequest();

            if (cmdletContext.Description != null)
            {
                request.Description = cmdletContext.Description;
            }

            // populate ExportToS3Task
            var requestExportToS3TaskIsNull = true;

            request.ExportToS3Task = new Amazon.EC2.Model.ExportToS3TaskSpecification();
            Amazon.EC2.ContainerFormat requestExportToS3Task_exportToS3Task_ContainerFormat = null;
            if (cmdletContext.ExportToS3Task_ContainerFormat != null)
            {
                requestExportToS3Task_exportToS3Task_ContainerFormat = cmdletContext.ExportToS3Task_ContainerFormat;
            }
            if (requestExportToS3Task_exportToS3Task_ContainerFormat != null)
            {
                request.ExportToS3Task.ContainerFormat = requestExportToS3Task_exportToS3Task_ContainerFormat;
                requestExportToS3TaskIsNull            = false;
            }
            Amazon.EC2.DiskImageFormat requestExportToS3Task_exportToS3Task_DiskImageFormat = null;
            if (cmdletContext.ExportToS3Task_DiskImageFormat != null)
            {
                requestExportToS3Task_exportToS3Task_DiskImageFormat = cmdletContext.ExportToS3Task_DiskImageFormat;
            }
            if (requestExportToS3Task_exportToS3Task_DiskImageFormat != null)
            {
                request.ExportToS3Task.DiskImageFormat = requestExportToS3Task_exportToS3Task_DiskImageFormat;
                requestExportToS3TaskIsNull            = false;
            }
            System.String requestExportToS3Task_exportToS3Task_S3Bucket = null;
            if (cmdletContext.ExportToS3Task_S3Bucket != null)
            {
                requestExportToS3Task_exportToS3Task_S3Bucket = cmdletContext.ExportToS3Task_S3Bucket;
            }
            if (requestExportToS3Task_exportToS3Task_S3Bucket != null)
            {
                request.ExportToS3Task.S3Bucket = requestExportToS3Task_exportToS3Task_S3Bucket;
                requestExportToS3TaskIsNull     = false;
            }
            System.String requestExportToS3Task_exportToS3Task_S3Prefix = null;
            if (cmdletContext.ExportToS3Task_S3Prefix != null)
            {
                requestExportToS3Task_exportToS3Task_S3Prefix = cmdletContext.ExportToS3Task_S3Prefix;
            }
            if (requestExportToS3Task_exportToS3Task_S3Prefix != null)
            {
                request.ExportToS3Task.S3Prefix = requestExportToS3Task_exportToS3Task_S3Prefix;
                requestExportToS3TaskIsNull     = false;
            }
            // determine if request.ExportToS3Task should be set to null
            if (requestExportToS3TaskIsNull)
            {
                request.ExportToS3Task = null;
            }
            if (cmdletContext.InstanceId != null)
            {
                request.InstanceId = cmdletContext.InstanceId;
            }
            if (cmdletContext.TagSpecification != null)
            {
                request.TagSpecifications = cmdletContext.TagSpecification;
            }
            if (cmdletContext.TargetEnvironment != null)
            {
                request.TargetEnvironment = cmdletContext.TargetEnvironment;
            }

            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);
        }