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