Common options used for download methods.
Inheritance: CommonOptions
        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();
        }
Esempio n. 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);
                    }
                }
            }
        }
Esempio n. 3
0
        private void download_Click(object sender, EventArgs e)
        {
            SaveFileDialog savefile = new SaveFileDialog();
            if (savefile.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            try
            {
                ArchiveTransferManager manager = this.getManager();

                DownloadOptions options = new DownloadOptions();
                options.StreamTransferProgress += this.progress;
                progressBar1.Value = 0;

                manager.Download(vaultName.Text, archiveId.Text, savefile.FileName, options);
                MessageBox.Show("download complete" + savefile.FileName);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Esempio n. 4
0
 /// <summary>
 /// <para>
 /// Downloads the results from a completed archive retrieval.  Saves the job output
 /// to the specified file.
 /// </para>
 /// <para>
 /// If there is an error during download the download will be retried from the last point read.
 /// Once the download is complete the checksum will be compared.
 /// </para>
 /// </summary>
 /// <param name="vaultName">The name of the vault to download the job output from.</param>
 /// <param name="jobId">The unique job ID for an archive retrieval job.</param>
 /// <param name="filePath">The file path to save the job output at.</param>
 /// <param name="options">Additional options that can be used for the download.</param>
 public void DownloadJob(string vaultName, string jobId, string filePath, DownloadOptions options)
 {
     var command = new DownloadJobCommand(this, vaultName, jobId, filePath, options);
     command.Execute();
 }
Esempio n. 5
0
 /// <summary>
 /// <para>
 /// Downloads an archive from Amazon Glacier from the specified vault for the
 /// current user's account. Saves the archive to the specified file. 
 /// </para>
 ///
 /// <para>
 /// 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.
 /// </para>
 ///
 /// <para>
 /// Additional options can be set using the UploadDirectoryOptions object. For example, you
 /// can set the FilesTransferProgress property to a delegate to track progress.  
 /// </para>
 /// </summary>
 /// <param name="filePath">The file path to save the archive at.</param>
 /// <param name="vaultName">The name of the vault to download the archive from.</param>
 /// <param name="archiveId">The unique ID of the archive to download.</param>
 /// <param name="options">Additional options that can be used for the download.</param>
 public void Download(string vaultName, string archiveId, string filePath, DownloadOptions options)
 {
     var command = new DownloadFileCommand(this, vaultName, archiveId, filePath, options);
     command.Execute();
 }
        /// <summary>
        /// <para>
        /// Downloads an archive from Amazon Glacier from the specified vault for the
        /// current user's account. Saves the archive to the specified file.
        /// </para>
        ///
        /// <para>
        /// 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.
        /// </para>
        ///
        /// <para>
        /// Additional options can be set using the UploadDirectoryOptions object. For example, you
        /// can set the FilesTransferProgress property to a delegate to track progress.
        /// </para>
        /// </summary>
        /// <param name="filePath">The file path to save the archive at.</param>
        /// <param name="vaultName">The name of the vault to download the archive from.</param>
        /// <param name="archiveId">The unique ID of the archive to download.</param>
        /// <param name="options">Additional options that can be used for the download.</param>
        public void Download(string vaultName, string archiveId, string filePath, DownloadOptions options)
        {
            var command = new DownloadFileCommand(this, vaultName, archiveId, filePath, options);

            command.Execute();
        }
        /// <summary>
        /// <para>
        /// Downloads the results from a completed archive retrieval.  Saves the job output
        /// to the specified file.
        /// </para>
        /// <para>
        /// If there is an error during download the download will be retried from the last point read.
        /// Once the download is complete the checksum will be compared.
        /// </para>
        /// </summary>
        /// <param name="vaultName">The name of the vault to download the job output from.</param>
        /// <param name="jobId">The unique job ID for an archive retrieval job.</param>
        /// <param name="filePath">The file path to save the job output at.</param>
        /// <param name="options">Additional options that can be used for the download.</param>
        public void DownloadJob(string vaultName, string jobId, string filePath, DownloadOptions options)
        {
            var command = new DownloadJobCommand(this, vaultName, jobId, filePath, options);

            command.Execute();
        }
        /// <summary>
        /// <para>
        /// Downloads the results from a completed archive retrieval.  Saves the job output
        /// to the specified file.
        /// </para>
        /// <para>
        /// If there is an error during download the download will be retried from the last point read.
        /// Once the download is complete the checksum will be compared.
        /// </para>
        /// </summary>
        /// <param name="vaultName">The name of the vault to download the job output from.</param>
        /// <param name="jobId">The unique job ID for an archive retrieval job.</param>
        /// <param name="filePath">The file path to save the job output at.</param>
        /// <param name="options">Additional options that can be used for the download.</param>
        public Task DownloadJobAsync(string vaultName, string jobId, string filePath, DownloadOptions options)
        {
            var command = new DownloadJobCommand(this, vaultName, jobId, filePath, options);

            return(command.ExecuteAsync());
        }
        /// <summary>
        /// <para>
        /// Downloads an archive from Amazon Glacier from the specified vault for the
        /// current user's account. Saves the archive to the specified file.
        /// </para>
        ///
        /// <para>
        /// 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.
        /// </para>
        ///
        /// <para>
        /// Additional options can be set using the UploadDirectoryOptions object. For example, you
        /// can set the FilesTransferProgress property to a delegate to track progress.
        /// </para>
        /// </summary>
        /// <param name="filePath">The file path to save the archive at.</param>
        /// <param name="vaultName">The name of the vault to download the archive from.</param>
        /// <param name="archiveId">The unique ID of the archive to download.</param>
        /// <param name="options">Additional options that can be used for the download.</param>
        public Task DownloadAsync(string vaultName, string archiveId, string filePath, DownloadOptions options)
        {
            var command = new DownloadFileCommand(this, vaultName, archiveId, filePath, options);

            return(command.ExecuteAsync());
        }
 /// <summary>
 /// <para>
 /// Downloads the results from a completed archive retrieval.  Saves the job output
 /// to the specified file.
 /// </para>
 /// <para>
 /// If there is an error during download the download will be retried from the last point read.
 /// Once the download is complete the checksum will be compared.
 /// </para>
 /// </summary>
 /// <param name="vaultName">The name of the vault to download the job output from.</param>
 /// <param name="jobId">The unique job ID for an archive retrieval job.</param>
 /// <param name="filePath">The file path to save the job output at.</param>
 /// <param name="options">Additional options that can be used for the download.</param>
 public Task DownloadJobAsync(string vaultName, string jobId, string filePath, DownloadOptions options)
 {
     var command = new DownloadJobCommand(this, vaultName, jobId, filePath, options);
     return command.ExecuteAsync();
 }
 /// <summary>
 /// <para>
 /// Downloads an archive from Amazon Glacier from the specified vault for the
 /// current user's account. Saves the archive to the specified file. 
 /// </para>
 ///
 /// <para>
 /// 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.
 /// </para>
 ///
 /// <para>
 /// Additional options can be set using the UploadDirectoryOptions object. For example, you
 /// can set the FilesTransferProgress property to a delegate to track progress.  
 /// </para>
 /// </summary>
 /// <param name="filePath">The file path to save the archive at.</param>
 /// <param name="vaultName">The name of the vault to download the archive from.</param>
 /// <param name="archiveId">The unique ID of the archive to download.</param>
 /// <param name="options">Additional options that can be used for the download.</param>
 public Task DownloadAsync(string vaultName, string archiveId, string filePath, DownloadOptions options)
 {
     var command = new DownloadFileCommand(this, vaultName, archiveId, filePath, options);
     return command.ExecuteAsync();
 }
Esempio n. 12
0
        public FDGlacier(FDUserSettings settings, FDOperationLog oplog, string optype)
        {
            this.vaultName = settings.AWSGlacierVaultName;
            log = oplog;

            switch (settings.AWSRegion) {
            case FDUserSettings.AWSRegionIndex.USWest1:
                region = RegionEndpoint.USWest1;
                break;
            case FDUserSettings.AWSRegionIndex.USWest2:
                region = RegionEndpoint.USWest2;
                break;
            case FDUserSettings.AWSRegionIndex.USEast1:
                region = RegionEndpoint.USEast1;
                break;
            case FDUserSettings.AWSRegionIndex.EUWest1:
                region = RegionEndpoint.EUWest1;
                break;
            case FDUserSettings.AWSRegionIndex.APNortheast1:
                region = RegionEndpoint.APNortheast1;
                break;
            default:
                region = RegionEndpoint.USEast1;
                break;
            }

            //Instantiate the glacier config with our settins (for future move to AmazonGlacierClient)
            glacierConfig = new AmazonGlacierConfig();
            glacierConfig.RegionEndpoint = region;

            //Instantiate AWS Credentials
            awsCredentials = new BasicAWSCredentials(settings.AWSAccessKey, settings.AWSSecretKey);

            //Instantiate the transfer manager with our settings
            //TODO: Switch to glacier client so we can abort this damn thing
            //glacierClient = new AmazonGlacierClient(appConfig["AWSAccessKey"], appConfig["AWSSecretKey"], region);
            transferManager = new ArchiveTransferManager(awsCredentials, region);

            upOptions = new UploadOptions();
            downOptions = new DownloadOptions();
            progress = 0;
            upOptions.StreamTransferProgress = downOptions.StreamTransferProgress = this.onProgress;

            OperationType = optype;
        }