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

Downloads an archive from Amazon Glacier from the specified vault for the current user's account. Saves the archive to the specified file.

This 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.

Additional options can be set using the UploadDirectoryOptions object. For example, you can set the FilesTransferProgress property to a delegate to track progress.

public Download ( string vaultName, string archiveId, string filePath ) : void
vaultName string The name of the vault to download the archive from.
archiveId string The unique ID of the archive to download.
filePath string The file path to save the archive at.
Результат void
Пример #1
0
        public void runDownload()
        {
            try
            {

                //var manager = new ArchiveTransferManager(Amazon.RegionEndpoint.USWest2);

                //var options = new DownloadOptions();
                //options.StreamTransferProgress += ArchiveDownloadHighLevel.progress;
                //// Download an archive.
                //Console.WriteLine("Intiating the archive retrieval job and then polling SQS queue for the archive to be available.");
                //Console.WriteLine("This polling takes about 4 hours. Once the archive is available, downloading will begin.");
                //manager.Download(vaultName, archiveId, downloadFilePath, options);
                //Console.WriteLine("To continue, press Enter");
                //Console.ReadKey();

                var manager = new ArchiveTransferManager(Amazon.RegionEndpoint.USEast1);
                var options = new DownloadOptions();
                options.StreamTransferProgress += DownloadFile.progress;
                Console.WriteLine("Intiating the archive retrieval job and then polling SQS queue for the archive to be available.");
                Console.WriteLine("This polling takes about 4 hours. Once the archive is available, downloading will begin.");
                manager.Download(vaultName, archiveToDownload, downloadFilePath, options);
                manager.Download(vaultName, archiveToDownload2, downloadFilePath2, options);

                Console.WriteLine("To continue, press Enter");
                Console.ReadKey();
            }
            catch (AmazonGlacierException e) { Console.WriteLine(e.Message); }
            catch (AmazonServiceException e) { Console.WriteLine(e.Message); }
            catch (Exception e) { Console.WriteLine(e.Message); }
            Console.WriteLine("To continue, press Enter");
            Console.ReadKey();
        }
Пример #2
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);
                    }
                }
            }
        }