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

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

Constructs the import manifest for the image and then uploads it and the virtual machine image or disk image to Amazon S3. The S3 key to the uploaded manifest file is returned.

If an error occurs during upload of the image file the RetainArtifactsOnUploadError property governs whether the partially uploaded content is deleted or retained. If the content is retained, the import can be resumed. By default the RetainArtifactsOnUploadError property is false and the content deleted, avoiding storage charges for potentially orphaned content if the command is not re-run.

public Upload ( string imageFilepath, string fileFormat, long volumeSize, string keyPrefix, ImportProgressCallback progressCallback, bool resumeUpload ) : string
imageFilepath string The full path to the image file to be processed
fileFormat string /// The format of the image file (VMDK | RAW | VHD). If not specified, it will be inferred /// from the extension of the image file. ///
volumeSize long /// The requested size (in GiB) for the resulting image volume. If not specified a suitable /// value based on the size of the image file is used. Note that if importing a disk image that /// will be used as an EC2 instance, the minimum required boot volume size is 8GB. ///
keyPrefix string /// Optional root-level key prefix that will be applied to the uploaded artifacts in S3. /// The artifacts will be placed beneath this (or the root if not set) in a key composed /// of a GUID. ///
progressCallback ImportProgressCallback Optional callback delegate for upload progress reporting
resumeUpload bool /// Set this to true if a previous upload failed part-way through processing and RetainArtifactsOnUploadError /// was set to true so the partially uploaded content was retained. The existing manifest will /// be inspected and uploads will resume of the retaining content. ///
Результат string
        public string Upload(string imageFilepath,
                             string fileFormat,
                             long? volumeSize,
                             string keyPrefix,
                             ImportProgressCallback progressCallback,
                             bool resumeUpload)
        {
            ImageFilePath = imageFilepath;

            if (!resumeUpload)
            {
                var guidPart = Guid.NewGuid().ToString("D");
                ArtifactsKeyPrefix 
                    = string.IsNullOrEmpty(keyPrefix) 
                        ? guidPart 
                        : string.Format(CultureInfo.InvariantCulture, "{0}/{1}", keyPrefix, guidPart);

                ImportManifest = CreateImportManifest(fileFormat, volumeSize);

                if (!S3Client.DoesS3BucketExist(BucketName))
                    S3Client.EnsureBucketExists(this.BucketName);

                UploadManifest(progressCallback);
            }

            UploadImageParts(progressCallback);
            return ManifestFileKey;
        }

Same methods

DiskImageImporter::Upload ( string imageFilepath ) : string