Request object for downloading a directory with the TransferUtility.
        private void DownloadDirectoryHelper(string bucketName, string s3Directory, string localDirectory)
        {
            TransferUtilityDownloadDirectoryRequest request = new TransferUtilityDownloadDirectoryRequest()
            {
                BucketName = bucketName,
                S3Directory = s3Directory,
                LocalDirectory = localDirectory
            };


            DownloadDirectoryHelper(request);
        }
        /// <summary>
        ///     Downloads the objects in Amazon S3 that have a key that starts with the value
        ///     specified by the <c>S3Directory</c>
        ///     property of the passed in <c>TransferUtilityDownloadDirectoryRequest</c> object.
        /// </summary>
        /// <param name="request">
        ///     Contains all the parameters required to download objects from Amazon S3
        ///     into a local directory.
        /// </param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        /// <returns>The task object representing the asynchronous operation.</returns>
        public Task DownloadDirectoryAsync(TransferUtilityDownloadDirectoryRequest request, CancellationToken cancellationToken = default(CancellationToken))
        {
            var command = new DownloadDirectoryCommand(this._s3Client, request, this._config);

            command.DownloadFilesConcurrently = request.DownloadFilesConcurrently;
            return(command.ExecuteAsync(cancellationToken));
        }
        /// <summary>
        /// Initiates the asynchronous execution of the DownloadDirectory operation.
        /// <seealso cref="M:Amazon.S3.Transfer.TransferUtility.DownloadDirectory"/>
        /// </summary>
        /// <param name="bucketName">
        ///     The name of the bucket containing the Amazon S3 objects to download.
        /// </param>
        /// <param name="s3Directory">
        ///     The directory in Amazon S3 to download.
        /// </param>
        /// <param name="localDirectory">
        ///     The local directory to download the objects to.
        /// </param>
        /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
        /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback procedure using the AsyncState property.</param>
        /// <exception cref="T:System.ArgumentNullException"></exception>
        /// <exception cref="T:System.Net.WebException"></exception>
        /// <exception cref="T:Amazon.S3.AmazonS3Exception"></exception>
        /// <returns>An IAsyncResult that can be used to poll, or wait for results, or both.
        /// This values is also needed when invoking EndDownloadDirectory.</returns>
        public IAsyncResult BeginDownloadDirectory(string bucketName, string s3Directory, string localDirectory, AsyncCallback callback, object state)
        {
            TransferUtilityDownloadDirectoryRequest request = new TransferUtilityDownloadDirectoryRequest()
                                                              .WithBucketName(bucketName)
                                                              .WithS3Directory(s3Directory)
                                                              .WithLocalDirectory(localDirectory);

            return(BeginDownloadDirectory(request, callback, state));
        }
        /// <summary>
        ///     Downloads the objects in Amazon S3 that have a key that starts with the value
        ///     specified by <c>s3Directory</c>.
        /// </summary>
        /// <param name="bucketName">
        ///     The name of the bucket containing the Amazon S3 objects to download.
        /// </param>
        /// <param name="s3Directory">
        ///     The directory in Amazon S3 to download.
        /// </param>
        /// <param name="localDirectory">
        ///     The local directory to download the objects to.
        /// </param>
        public void DownloadDirectory(string bucketName, string s3Directory, string localDirectory)
        {
            TransferUtilityDownloadDirectoryRequest request = new TransferUtilityDownloadDirectoryRequest()
                                                              .WithBucketName(bucketName)
                                                              .WithS3Directory(s3Directory)
                                                              .WithLocalDirectory(localDirectory);


            DownloadDirectory(request);
        }
        /// <summary>
        /// Initiates the asynchronous execution of the DownloadDirectory operation.
        /// <seealso cref="M:Amazon.S3.Transfer.TransferUtility.DownloadDirectory"/>
        /// </summary>
        /// <param name="bucketName">
        ///     The name of the bucket containing the Amazon S3 objects to download.
        /// </param>
        /// <param name="s3Directory">
        ///     The directory in Amazon S3 to download.
        /// </param>
        /// <param name="localDirectory">
        ///     The local directory to download the objects to.
        /// </param>
        /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
        /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback procedure using the AsyncState property.</param>
        /// <exception cref="T:System.ArgumentNullException"></exception>
        /// <exception cref="T:System.Net.WebException"></exception>
        /// <exception cref="T:Amazon.S3.AmazonS3Exception"></exception>
        /// <returns>An IAsyncResult that can be used to poll, or wait for results, or both.
        /// This values is also needed when invoking EndDownloadDirectory.</returns>
        public IAsyncResult BeginDownloadDirectory(string bucketName, string s3Directory, string localDirectory, AsyncCallback callback, object state)
        {
            TransferUtilityDownloadDirectoryRequest request = new TransferUtilityDownloadDirectoryRequest
            {
                BucketName     = bucketName,
                S3Directory    = s3Directory,
                LocalDirectory = localDirectory
            };

            return(BeginDownloadDirectory(request, callback, state));
        }
Exemple #6
0
 /// <summary>
 ///     Downloads the objects in Amazon S3 that have a key that starts with the value
 ///     specified by the <c>S3Directory</c>
 ///     property of the passed in <c>TransferUtilityDownloadDirectoryRequest</c> object.
 /// </summary>
 /// <param name="request">
 ///     Contains all the parameters required to download objects from Amazon S3
 ///     into a local directory.
 /// </param>
 public void DownloadDirectory(TransferUtilityDownloadDirectoryRequest request)
 {
     try
     {
         DownloadDirectoryAsync(request).Wait();
     }
     catch (AggregateException e)
     {
         ExceptionDispatchInfo.Capture(e.InnerException).Throw();
     }
 }
        /// <summary>
        ///     Downloads the objects in Amazon S3 that have a key that starts with the value
        ///     specified by <c>s3Directory</c>.
        /// </summary>
        /// <param name="bucketName">
        ///     The name of the bucket containing the Amazon S3 objects to download.
        /// </param>
        /// <param name="s3Directory">
        ///     The directory in Amazon S3 to download.
        /// </param>
        /// <param name="localDirectory">
        ///     The local directory to download the objects to.
        /// </param>
        public void DownloadDirectory(string bucketName, string s3Directory, string localDirectory)
        {
            TransferUtilityDownloadDirectoryRequest request = new TransferUtilityDownloadDirectoryRequest
            {
                BucketName     = bucketName,
                S3Directory    = s3Directory,
                LocalDirectory = localDirectory
            };


            DownloadDirectory(request);
        }
        private void DownloadDirectoryHelper(string bucketName, string s3Directory, string localDirectory)
        {
            TransferUtilityDownloadDirectoryRequest request = new TransferUtilityDownloadDirectoryRequest()
            {
                BucketName     = bucketName,
                S3Directory    = s3Directory,
                LocalDirectory = localDirectory
            };


            DownloadDirectoryHelper(request);
        }
 /// <summary>
 /// 	Downloads the objects in Amazon S3 that have a key that starts with the value 
 /// 	specified by the <c>S3Directory</c>
 /// 	property of the passed in <c>TransferUtilityDownloadDirectoryRequest</c> object.
 /// </summary>
 /// <param name="request">
 /// 	Contains all the parameters required to download objects from Amazon S3 
 /// 	into a local directory.
 /// </param>
 public void DownloadDirectory(TransferUtilityDownloadDirectoryRequest request)
 {
     DownloadDirectoryHelper(request);
 }
 /// <summary>
 /// 	Downloads the objects in Amazon S3 that have a key that starts with the value 
 /// 	specified by the <c>S3Directory</c>
 /// 	property of the passed in <c>TransferUtilityDownloadDirectoryRequest</c> object.
 /// </summary>
 /// <param name="request">
 /// 	Contains all the parameters required to download objects from Amazon S3 
 /// 	into a local directory.
 /// </param>
 /// <param name="cancellationToken">
 ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
 /// </param>
 /// <returns>The task object representing the asynchronous operation.</returns>
 public Task DownloadDirectoryAsync(TransferUtilityDownloadDirectoryRequest request, CancellationToken cancellationToken = default(CancellationToken))
 {
     var command = new DownloadDirectoryCommand(this._s3Client, request, this._config);
     command.DownloadFilesConcurrently = request.DownloadFilesConcurrently;
     return command.ExecuteAsync(cancellationToken);
 }
        /// <summary>
        /// Initiates the asynchronous execution of the DownloadDirectory operation. 
        /// <seealso cref="M:Amazon.S3.Transfer.TransferUtility.DownloadDirectory"/>
        /// </summary>
        /// <param name="request">
        /// 	Contains all the parameters required to download objects from a directory in Amazon S3 
        /// 	to a local directory.
        /// </param>
        /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
        /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback procedure using the AsyncState property.</param>
        /// <exception cref="T:System.ArgumentNullException"></exception>
        /// <exception cref="T:System.Net.WebException"></exception>
        /// <exception cref="T:Amazon.S3.AmazonS3Exception"></exception>
        /// <returns>An IAsyncResult that can be used to poll, or wait for results, or both. 
        /// This values is also needed when invoking EndDownload.</returns>
        public IAsyncResult BeginDownloadDirectory(TransferUtilityDownloadDirectoryRequest request, AsyncCallback callback, object state)
        {
            BaseCommand command = new DownloadDirectoryCommand(this._s3Client, request);
            return beginOperation(command, callback, state);

        }
 /// <summary>
 ///     Downloads the objects in Amazon S3 that have a key that starts with the value
 ///     specified by the <c>S3Directory</c>
 ///     property of the passed in <c>TransferUtilityDownloadDirectoryRequest</c> object.
 /// </summary>
 /// <param name="request">
 ///     Contains all the parameters required to download objects from Amazon S3
 ///     into a local directory.
 /// </param>
 public void DownloadDirectory(TransferUtilityDownloadDirectoryRequest request)
 {
     DownloadDirectoryHelper(request);
 }
 /// <summary>
 /// 	Downloads the objects in Amazon S3 that have a key that starts with the value 
 /// 	specified by the <c>S3Directory</c>
 /// 	property of the passed in <c>TransferUtilityDownloadDirectoryRequest</c> object.
 /// </summary>
 /// <param name="request">
 /// 	Contains all the parameters required to download objects from Amazon S3 
 /// 	into a local directory.
 /// </param>
 public void DownloadDirectory(TransferUtilityDownloadDirectoryRequest request)
 {
     try
     {
         DownloadDirectoryAsync(request).Wait();
     }
     catch (AggregateException e)
     {
         ExceptionDispatchInfo.Capture(e.InnerException).Throw();
     }
 }
        /// <summary>
        /// Initiates the asynchronous execution of the DownloadDirectory operation. 
        /// <seealso cref="M:Amazon.S3.Transfer.TransferUtility.DownloadDirectory"/>
        /// </summary>
        /// <param name="bucketName">
        /// 	The name of the bucket containing the Amazon S3 objects to download.
        /// </param>
        /// <param name="s3Directory">
        /// 	The directory in Amazon S3 to download.
        /// </param>
        /// <param name="localDirectory">
        /// 	The local directory to download the objects to.
        /// </param>
        /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
        /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback procedure using the AsyncState property.</param>
        /// <exception cref="T:System.ArgumentNullException"></exception>
        /// <exception cref="T:System.Net.WebException"></exception>
        /// <exception cref="T:Amazon.S3.AmazonS3Exception"></exception>
        /// <returns>An IAsyncResult that can be used to poll, or wait for results, or both. 
        /// This values is also needed when invoking EndDownloadDirectory.</returns>
        public IAsyncResult BeginDownloadDirectory(string bucketName, string s3Directory, string localDirectory, AsyncCallback callback, object state)
        {
            TransferUtilityDownloadDirectoryRequest request = new TransferUtilityDownloadDirectoryRequest()
            {
                BucketName = bucketName,
                S3Directory = s3Directory,
                LocalDirectory = localDirectory
            };

            return BeginDownloadDirectory(request, callback, state);
        }
        /// <summary>
        /// 	Downloads the objects in Amazon S3 that have a key that starts with the value 
        /// 	specified by <c>s3Directory</c>.
        /// </summary>
        /// <param name="bucketName">
        /// 	The name of the bucket containing the Amazon S3 objects to download.
        /// </param>
        /// <param name="s3Directory">
        /// 	The directory in Amazon S3 to download.
        /// </param>
        /// <param name="localDirectory">
        /// 	The local directory to download the objects to.
        /// </param>
        public void DownloadDirectory(string bucketName, string s3Directory, string localDirectory)
        {
            TransferUtilityDownloadDirectoryRequest request = new TransferUtilityDownloadDirectoryRequest
            {
                BucketName = bucketName,
                S3Directory = s3Directory,
                LocalDirectory = localDirectory
            };

            DownloadDirectory(request);
        }
 /// <summary>
 /// 	Downloads the objects in Amazon S3 that have a key that starts with the value 
 /// 	specified by the <c>S3Directory</c>
 /// 	property of the passed in <c>TransferUtilityDownloadDirectoryRequest</c> object.
 /// </summary>
 /// <param name="request">
 /// 	Contains all the parameters required to download objects from Amazon S3 
 /// 	into a local directory.
 /// </param>
 public void DownloadDirectory(TransferUtilityDownloadDirectoryRequest request)
 {
     BaseCommand command = new DownloadDirectoryCommand(this._s3Client, request);
     command.Execute();
 }
        /// <summary>
        /// 	Downloads the objects in Amazon S3 that have a key that starts with the value 
        /// 	specified by <c>s3Directory</c>.
        /// </summary>
        /// <param name="bucketName">
        /// 	The name of the bucket containing the Amazon S3 objects to download.
        /// </param>
        /// <param name="s3Directory">
        /// 	The directory in Amazon S3 to download.
        /// </param>
        /// <param name="localDirectory">
        /// 	The local directory to download the objects to.
        /// </param>
        public void DownloadDirectory(string bucketName, string s3Directory, string localDirectory)
        {
            TransferUtilityDownloadDirectoryRequest request = new TransferUtilityDownloadDirectoryRequest()
                .WithBucketName(bucketName)
                .WithS3Directory(s3Directory)
                .WithLocalDirectory(localDirectory);

            DownloadDirectory(request);
        }
        /// <summary>
        /// Initiates the asynchronous execution of the DownloadDirectory operation. 
        /// <seealso cref="M:Amazon.S3.Transfer.TransferUtility.DownloadDirectory"/>
        /// </summary>
        /// <param name="bucketName">
        /// 	The name of the bucket containing the Amazon S3 objects to download.
        /// </param>
        /// <param name="s3Directory">
        /// 	The directory in Amazon S3 to download.
        /// </param>
        /// <param name="localDirectory">
        /// 	The local directory to download the objects to.
        /// </param>
        /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
        /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback procedure using the AsyncState property.</param>
        /// <exception cref="T:System.ArgumentNullException"></exception>
        /// <exception cref="T:System.Net.WebException"></exception>
        /// <exception cref="T:Amazon.S3.AmazonS3Exception"></exception>
        /// <returns>An IAsyncResult that can be used to poll, or wait for results, or both. 
        /// This values is also needed when invoking EndDownloadDirectory.</returns>
        public IAsyncResult BeginDownloadDirectory(string bucketName, string s3Directory, string localDirectory, AsyncCallback callback, object state)
        {
            TransferUtilityDownloadDirectoryRequest request = new TransferUtilityDownloadDirectoryRequest()
                .WithBucketName(bucketName)
                .WithS3Directory(s3Directory)
                .WithLocalDirectory(localDirectory);

            return BeginDownloadDirectory(request, callback, state);
        }
        /// <summary>
        /// Initiates the asynchronous execution of the DownloadDirectory operation.
        /// <seealso cref="M:Amazon.S3.Transfer.TransferUtility.DownloadDirectory"/>
        /// </summary>
        /// <param name="request">
        ///     Contains all the parameters required to download objects from a directory in Amazon S3
        ///     to a local directory.
        /// </param>
        /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
        /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback procedure using the AsyncState property.</param>
        /// <exception cref="T:System.ArgumentNullException"></exception>
        /// <exception cref="T:System.Net.WebException"></exception>
        /// <exception cref="T:Amazon.S3.AmazonS3Exception"></exception>
        /// <returns>An IAsyncResult that can be used to poll, or wait for results, or both.
        /// This values is also needed when invoking EndDownload.</returns>
        public IAsyncResult BeginDownloadDirectory(TransferUtilityDownloadDirectoryRequest request, AsyncCallback callback, object state)
        {
            BaseCommand command = new DownloadDirectoryCommand(this._s3Client, request);

            return(beginOperation(command, callback, state));
        }
        /// <summary>
        ///     Downloads the objects in Amazon S3 that have a key that starts with the value
        ///     specified by the <c>S3Directory</c>
        ///     property of the passed in <c>TransferUtilityDownloadDirectoryRequest</c> object.
        /// </summary>
        /// <param name="request">
        ///     Contains all the parameters required to download objects from Amazon S3
        ///     into a local directory.
        /// </param>
        public void DownloadDirectory(TransferUtilityDownloadDirectoryRequest request)
        {
            BaseCommand command = new DownloadDirectoryCommand(this._s3Client, request);

            command.Execute();
        }
 /// <summary>
 /// Initiates the asynchronous execution of the DownloadDirectory operation.
 /// <seealso cref="Amazon.S3.IAmazonS3.AbortMultipartUpload"/>
 /// </summary>
 /// <param name="request">
 ///     Contains all the parameters required to download objects from Amazon S3
 ///     into a local directory.
 /// </param>
 /// <param name="cancellationToken">
 ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
 /// </param>
 /// <returns>The task object representing the asynchronous operation.</returns>
 public Task DownloadDirectoryAsync(TransferUtilityDownloadDirectoryRequest request, CancellationToken cancellationToken = default(CancellationToken))
 {
     return(ExecuteAsync(() => DownloadDirectoryHelper(request), cancellationToken));
 }