/// <summary>
        ///     Uploads the file or stream specified by the request.
        ///     To track the progress of the upload,
        ///     add an event listener to the request's <c>UploadProgressEvent</c>.
        ///     For large uploads, the file will be divided and uploaded in parts using
        ///     Amazon S3's multipart API.  The parts will be reassembled as one object in
        ///     Amazon S3.
        /// </summary>
        /// <param name="request">
        ///     Contains all the parameters required to upload to Amazon S3.
        /// </param>
        public void Upload(TransferUtilityUploadRequest request)
        {
            validate(request);
            BaseCommand command;

            if (request.ContentLength < this._config.MinSizeBeforePartUpload)
            {
                command = new SimpleUploadCommand(this._s3Client, this._config, request);
            }
            else
            {
                command = new MultipartUploadCommand(this._s3Client, this._config, request);
            }

            command.Execute();
        }
 internal BaseCommand GetUploadCommand(TransferUtilityUploadRequest request, SemaphoreSlim asyncThrottler)
 {
     validate(request);
     if (IsMultipartUpload(request))
     {
         var command = new MultipartUploadCommand(this._s3Client, this._config, request);
         command.AsyncThrottler = asyncThrottler;
         return(command);
     }
     else
     {
         var command = new SimpleUploadCommand(this._s3Client, this._config, request);
         command.AsyncThrottler = asyncThrottler;
         return(command);
     }
 }
        /// <summary>
        /// Initiates the asynchronous execution of the Upload operation.
        /// <seealso cref="M:Amazon.S3.Transfer.TransferUtility.Upload"/>
        /// </summary>
        /// <param name="request">
        ///     Contains all the parameters required to upload to Amazon S3.
        /// </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 EndUpload.</returns>
        public IAsyncResult BeginUpload(TransferUtilityUploadRequest request, AsyncCallback callback, object state)
        {
            validate(request);
            BaseCommand command;

            if (request.ContentLength < this._config.MinSizeBeforePartUpload)
            {
                command = new SimpleUploadCommand(this._s3Client, this._config, request);
            }
            else
            {
                command = new MultipartUploadCommand(this._s3Client, this._config, request);
            }

            return(beginOperation(command, callback, state));
        }