Amazon.EC2.Import.DiskImageImporter.StartInstanceConversion C# (CSharp) Метод

StartInstanceConversion() публичный Метод

Initiates a conversion task to yield a new Amazon EC2 instance for a set of image file artifacts uploaded previously to Amazon S3.
public StartInstanceConversion ( ImportLaunchConfiguration launchConfiguration ) : ImportInstanceResponse
launchConfiguration ImportLaunchConfiguration Launch configuration settings for the imported instance
Результат Amazon.EC2.Model.ImportInstanceResponse
        public ImportInstanceResponse StartInstanceConversion(ImportLaunchConfiguration launchConfiguration)
        {
            if (string.IsNullOrEmpty(ManifestFileKey))
                throw new InvalidOperationException("No Amazon S3 object key available; have the image artifacts been uploaded?");

            var diskImage = PopulateDiskImage(ManifestFileKey, launchConfiguration.Description);
            var launchSpecification = PopulateLaunchSpecificationInstance(launchConfiguration);

            var request = new ImportInstanceRequest
            {
                Description = string.IsNullOrEmpty(launchConfiguration.Description) ? null : launchConfiguration.Description,
                LaunchSpecification = launchSpecification,
                Platform = string.IsNullOrEmpty(launchConfiguration.Platform) ? null : launchConfiguration.Platform
            };

            request.DiskImages.Add(diskImage);

            // allow any exception to propagate to the caller; this allows the calling tool to 
            // assist the user with re-executing the command by showing the appropriate command line
            // or remediation needed to avoid re-uploading the artifacts
            try
            {
                return EC2Client.ImportInstance(request);
            }
            catch (Exception e)
            {
                throw new DiskImageImporterException(DiskImportErrorStage.SendingImportRequest, e);
            }
        }