Amazon.Glacier.Transfer.ArchiveTransferManager.Upload C# (CSharp) Метод

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

Uploads the specified file to Amazon Glacier for archival storage in the specified vault in the specified user's account. For small archives, this method uploads the archive directly to Glacier. For larger archives, this method uses Glacier's multipart upload API to split the upload into multiple parts for better error recovery if any errors are encountered while streaming the data to Amazon Glacier.
public Upload ( string vaultName, string archiveDescription, string filepath ) : UploadResult
vaultName string The name of the vault to upload the file to.
archiveDescription string A description for the archive.
filepath string The file path to the file to upload.
Результат UploadResult
        public UploadResult Upload(string vaultName, string archiveDescription, string filepath)
        {
            return Upload(vaultName, archiveDescription, filepath, new UploadOptions());
        }
        /// <summary>

Same methods

ArchiveTransferManager::Upload ( string vaultName, string archiveDescription, string filepath, UploadOptions options ) : UploadResult

Usage Example

Пример #1
0
        static void Main(string[] args)
        {
            if (CheckRequiredFields())
            {                
                using (manager = new ArchiveTransferManager(RegionEndpoint.USWest2))
                {
                    try
                    {
                        // Creates a new Vault
                        Console.WriteLine("Create Vault");
                        manager.CreateVault(vaultName);

                        // Uploads the specified file to Glacier.
                        Console.WriteLine("Upload a Archive");
                        var uploadResult = manager.Upload(vaultName, "Archive Description", filePath);
                        archiveId = uploadResult.ArchiveId;
                        Console.WriteLine("Upload successful. Archive Id : {0}  Checksum : {1}",
                            uploadResult.ArchiveId, uploadResult.Checksum);

                        // Downloads the file from Glacier 
                        // This operation can take a long time to complete. 
                        // The ArchiveTransferManager.Download() method creates an Amazon SNS topic, 
                        // and an Amazon SQS queue that is subscribed to that topic. 
                        // It then initiates the archive retrieval job and polls the queue for the 
                        // archive to be available. This polling takes about 4 hours.
                        // Once the archive is available, download will begin.
                        Console.WriteLine("Download the Archive");
                        var options = new DownloadOptions();
                        options.StreamTransferProgress += OnProgress;
                        manager.Download(vaultName, archiveId, downloadFilePath, options);

                        Console.WriteLine("Delete the Archive");
                        manager.DeleteArchive(vaultName, archiveId);

                    }
                    catch (AmazonGlacierException e)
                    {
                        Console.WriteLine(e.Message);
                    }
                    catch (AmazonServiceException e)
                    {
                        Console.WriteLine(e.Message);
                    }
                }
            }
        }
All Usage Examples Of Amazon.Glacier.Transfer.ArchiveTransferManager::Upload