Container for the parameters to the DescribeConversionTasks operation. Describes one or more of your conversion tasks. For more information, see the VM Import/Export User Guide.

For information about the import manifest referenced by this API action, see VM Import Manifest.

Inheritance: AmazonEC2Request
        /// <summary>
        /// Describes one or more of your conversion tasks. For more information, see <a href="http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/UploadingYourInstancesandVolumes.html">Using
        /// the Command Line Tools to Import Your Virtual Machine to Amazon EC2</a> in the <i>Amazon
        /// Elastic Compute Cloud User Guide</i>.
        /// </summary>
        /// <param name="request">Container for the necessary parameters to execute the DescribeConversionTasks service method.</param>
        /// 
        /// <returns>The response from the DescribeConversionTasks service method, as returned by EC2.</returns>
        public DescribeConversionTasksResponse DescribeConversionTasks(DescribeConversionTasksRequest request)
        {
            var marshaller = new DescribeConversionTasksRequestMarshaller();
            var unmarshaller = DescribeConversionTasksResponseUnmarshaller.Instance;

            return Invoke<DescribeConversionTasksRequest,DescribeConversionTasksResponse>(request, marshaller, unmarshaller);
        }
        /// <summary>
        /// Initiates the asynchronous execution of the DescribeConversionTasks operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the DescribeConversionTasks 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<DescribeConversionTasksResponse> DescribeConversionTasksAsync(DescribeConversionTasksRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new DescribeConversionTasksRequestMarshaller();
            var unmarshaller = DescribeConversionTasksResponseUnmarshaller.Instance;

            return InvokeAsync<DescribeConversionTasksRequest,DescribeConversionTasksResponse>(request, marshaller, 
                unmarshaller, cancellationToken);
        }
Example #3
0
 IAsyncResult invokeDescribeConversionTasks(DescribeConversionTasksRequest describeConversionTasksRequest, AsyncCallback callback, object state, bool synchronized)
 {
     IRequest irequest = new DescribeConversionTasksRequestMarshaller().Marshall(describeConversionTasksRequest);
     var unmarshaller = DescribeConversionTasksResponseUnmarshaller.GetInstance();
     AsyncResult result = new AsyncResult(irequest, callback, state, synchronized, signer, unmarshaller);
     Invoke(result);
     return result;
 }
Example #4
0
        /// <summary>
        /// Initiates the asynchronous execution of the DescribeConversionTasks operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the DescribeConversionTasks 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 EndDescribeConversionTasks
        ///         operation.</returns>
        public IAsyncResult BeginDescribeConversionTasks(DescribeConversionTasksRequest request, AsyncCallback callback, object state)
        {
            var marshaller = new DescribeConversionTasksRequestMarshaller();
            var unmarshaller = DescribeConversionTasksResponseUnmarshaller.Instance;

            return BeginInvoke<DescribeConversionTasksRequest>(request, marshaller, unmarshaller,
                callback, state);
        }
Example #5
0
 /// <summary>
 /// <para>Describes one or more of your conversion tasks. For more information, see <a
 /// href="http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/UploadingYourInstancesandVolumes.html" >Using the Command Line Tools to Import Your
 /// Virtual Machine to Amazon EC2</a> in the <i>Amazon Elastic Compute Cloud User Guide</i> .</para>
 /// </summary>
 /// 
 /// <param name="describeConversionTasksRequest">Container for the necessary parameters to execute the DescribeConversionTasks service method on
 ///          AmazonEC2.</param>
 /// 
 /// <returns>The response from the DescribeConversionTasks service method, as returned by AmazonEC2.</returns>
 /// 
 public DescribeConversionTasksResponse DescribeConversionTasks(DescribeConversionTasksRequest describeConversionTasksRequest)
 {
     IAsyncResult asyncResult = invokeDescribeConversionTasks(describeConversionTasksRequest, null, null, true);
     return EndDescribeConversionTasks(asyncResult);
 }
Example #6
0
 /// <summary>
 /// Initiates the asynchronous execution of the DescribeConversionTasks operation.
 /// <seealso cref="Amazon.EC2.IAmazonEC2.DescribeConversionTasks"/>
 /// </summary>
 /// 
 /// <param name="describeConversionTasksRequest">Container for the necessary parameters to execute the DescribeConversionTasks 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
 ///         EndDescribeConversionTasks operation.</returns>
 public IAsyncResult BeginDescribeConversionTasks(DescribeConversionTasksRequest describeConversionTasksRequest, AsyncCallback callback, object state)
 {
     return invokeDescribeConversionTasks(describeConversionTasksRequest, callback, state, false);
 }
Example #7
0
        /// <summary>
        /// <para>Describes one or more of your conversion tasks. For more information, see <a href="http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/UploadingYourInstancesandVolumes.html">Using the Command Line Tools to Import Your
        /// Virtual Machine to Amazon EC2</a> in the <i>Amazon Elastic Compute Cloud User Guide</i> .</para>
        /// </summary>
        /// 
        /// <param name="describeConversionTasksRequest">Container for the necessary parameters to execute the DescribeConversionTasks service method on
        /// AmazonEC2.</param>
        /// 
        /// <returns>The response from the DescribeConversionTasks 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<DescribeConversionTasksResponse> DescribeConversionTasksAsync(DescribeConversionTasksRequest describeConversionTasksRequest, CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new DescribeConversionTasksRequestMarshaller();
            var unmarshaller = DescribeConversionTasksResponseUnmarshaller.GetInstance();
            return Invoke<IRequest, DescribeConversionTasksRequest, DescribeConversionTasksResponse>(describeConversionTasksRequest, marshaller, unmarshaller, signer, cancellationToken);
        }
Example #8
0
		internal DescribeConversionTasksResponse DescribeConversionTasks(DescribeConversionTasksRequest request)
        {
            var task = DescribeConversionTasksAsync(request);
            try
            {
                return task.Result;
            }
            catch(AggregateException e)
            {
                ExceptionDispatchInfo.Capture(e.InnerException).Throw();
                return null;
            }
        }
        /// <summary>
        /// Initiates the asynchronous execution of the DescribeConversionTasks operation.
        /// <seealso cref="Amazon.EC2.IAmazonEC2.DescribeConversionTasks"/>
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the DescribeConversionTasks 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<DescribeConversionTasksResponse> DescribeConversionTasksAsync(DescribeConversionTasksRequest request, CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new DescribeConversionTasksRequestMarshaller();
            var unmarshaller = DescribeConversionTasksResponseUnmarshaller.GetInstance();
            var response = await Invoke<IRequest, DescribeConversionTasksRequest, DescribeConversionTasksResponse>(request, marshaller, unmarshaller, signer, cancellationToken)
                .ConfigureAwait(continueOnCapturedContext: false);
            return response;
        }
Example #10
0
        /// <summary>
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the DescribeConversionTasks service method on
        /// AmazonEC2.</param>
        /// 
        /// <returns>The response from the DescribeConversionTasks service method, as returned by AmazonEC2.</returns>
		public DescribeConversionTasksResponse DescribeConversionTasks(DescribeConversionTasksRequest request)
        {
            var task = DescribeConversionTasksAsync(request);
            try
            {
                return task.Result;
            }
            catch(AggregateException e)
            {
                throw e.InnerException;
            }
        }
Example #11
0
        /// <summary>
        /// Deletes the image file artifacts associated with the specified conversion task.
        /// If the task is still active, ignoreActiveTask must be set true to enable artifact
        /// deletion, which will cause the task to fail. Use this option at your own risk.
        /// </summary>
        /// <param name="ec2Client">
        /// Amazon EC2 client to use in the process. This should have been instantiated
        /// with credentials that have access to the conversion task and the region in
        /// which the import was performed.
        /// </param>
        /// <param name="s3Client">
        /// Amazon S3 client to use use in the process. This should have been instantiated
        /// with credentials that have access to the bucket containing the image file artifacts
        /// and the region in which the bucket exists.
        /// </param>
        /// <param name="conversionTaskId">
        /// The ID of the conversion task that used the image file
        /// </param>
        /// <param name="ignoreActiveTask">
        /// If true the artifacts are deleted even if the conversion task is still in progress
        /// </param>
        /// <param name="progressCallback">Optional progress callback</param>
        public static void DeleteImageArtifacts(IAmazonEC2 ec2Client, 
                                                ICoreAmazonS3 s3Client, 
                                                string conversionTaskId, 
                                                bool ignoreActiveTask,
                                                CleanupProgressCallback progressCallback)
        {
            if (string.IsNullOrEmpty(conversionTaskId))
                throw new ArgumentException("Missing conversion task id", "conversionTaskId");

            SendProgressNotification(progressCallback, "Inspecting conversion task", null);

            var request = new DescribeConversionTasksRequest();
            request.ConversionTaskIds.Add(conversionTaskId);
            try
            {
                var response = ec2Client.DescribeConversionTasks(request);
                if (response.ConversionTasks.Count == 0)
                    throw new ArgumentException("Invalid conversion task id", "conversionTaskId");

                var conversionTask = response.ConversionTasks[0];

                if (!ignoreActiveTask && conversionTask.State.Equals(ConversionTaskState.Active))
                    throw new InvalidOperationException(string.Format(CultureInfo.InvariantCulture, 
                                                                      "Import task '{0}' is still active.", 
                                                                      conversionTaskId));

                string manifestUrl = null;
                try
                {
                    // At this time only one disk image per task
                    if (conversionTask.IsSetImportInstance())
                        manifestUrl = conversionTask.ImportInstance.Volumes[0].Image.ImportManifestUrl;
                    else if (conversionTask.IsSetImportVolume())
                        manifestUrl = conversionTask.ImportVolume.Image.ImportManifestUrl;
                }
                finally
                {
                    if (string.IsNullOrEmpty(manifestUrl))
                        throw new ArgumentException("Unable to obtain import manifest url from conversion task instance.");
                }

                DeleteImageArtifacts(s3Client, manifestUrl, progressCallback);
            }
            catch (AmazonEC2Exception e)
            {
                throw new ArgumentException("Expected the id of a valid conversion task", "conversionTaskId", e);
            }
        }