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

CreateImportManifest() приватный Метод

Constructs the object hierarchy that will be serialized to a single manifest file describing the import.
private CreateImportManifest ( string fileFormat, long volumeSize ) : ImportManifestRoot
fileFormat string /// The file format of the image file. If not specified, it will be inferred from the image /// file extension. Valid values: VMDK | RAW | VHD. ///
volumeSize long /// The requested size, in GiB, of the resulting volume in EC2. If not specified a suitable /// value will be used based on the size of the supplied image file. ///
Результат ImportManifestRoot
        ImportManifestRoot CreateImportManifest(string fileFormat,
                                                long? volumeSize)
        {
            try
            {
                var urlExpiration = AWSSDKUtils.CorrectedUtcNow.AddDays(UrlExpiryPeriod);
                ConstructManifestArtifactKey(ImageFilePath);

                var format = fileFormat;
                if (string.IsNullOrEmpty(format))
                {
                    var ext = AWSSDKUtils.GetExtension(ImageFilePath);
                    if (string.IsNullOrEmpty(ext))
                        throw new ArgumentException("The image filename does not have an exception, so file format cannot be inferred.");

                    format = ext.TrimStart('.');
                }

                var manifest = new ImportManifestRoot
                {
                    Version = ManifestFileVersion,
                    FileFormat = format.ToUpper(CultureInfo.InvariantCulture), 
                    ImporterField = new ImporterInfo
                    {
                        Name = ManifestFileImporterName,
                        Version = ManifestFileImporterVersion,
                        Release = ManifestFileImporterRelease
                    },

                    SelfDestructUrl = S3Client.GeneratePreSignedURL(
                        BucketName, 
                        ManifestFileKey, 
                        urlExpiration, 
                        new Dictionary<string, object>{{"Verb", "DELETE"}}),

                    ImportData = ConstructImportPartsList(volumeSize, urlExpiration)
                };

                return manifest;
            }
            catch (Exception e)
            {
                throw new DiskImageImporterException(DiskImportErrorStage.GeneratingManifest, e);
            }
        }