protected override void ProcessRecord()
        {
            base.ProcessRecord();
            ListMultipartUploadPartsRequest request;

            try
            {
                request = new ListMultipartUploadPartsRequest
                {
                    NamespaceName      = NamespaceName,
                    BucketName         = BucketName,
                    ObjectName         = ObjectName,
                    UploadId           = UploadId,
                    Limit              = Limit,
                    Page               = Page,
                    OpcClientRequestId = OpcClientRequestId
                };
                IEnumerable <ListMultipartUploadPartsResponse> responses = GetRequestDelegate().Invoke(request);
                foreach (var item in responses)
                {
                    response = item;
                    WriteOutput(response, response.Items, true);
                }
                if (!ParameterSetName.Equals(AllPageSet) && !ParameterSetName.Equals(LimitSet) && response.OpcNextPage != null)
                {
                    WriteWarning("This operation supports pagination and not all resources were returned. Re-run using the -All option to auto paginate and list all resources.");
                }
                FinishProcessing(response);
            }
            catch (Exception ex)
            {
                TerminatingErrorDuringExecution(ex);
            }
        }
コード例 #2
0
        protected override void ProcessRecord()
        {
            base.ProcessRecord();
            ListMultipartUploadPartsRequest request;

            try
            {
                request = new ListMultipartUploadPartsRequest
                {
                    NamespaceName      = NamespaceName,
                    BucketName         = BucketName,
                    ObjectName         = ObjectName,
                    UploadId           = UploadId,
                    Limit              = Limit,
                    Page               = Page,
                    OpcClientRequestId = OpcClientRequestId
                };
                IEnumerable <ListMultipartUploadPartsResponse> responses = GetRequestDelegate().Invoke(request);
                foreach (var item in responses)
                {
                    response = item;
                    WriteOutput(response, response.Items, true);
                }
                FinishProcessing(response);
            }
            catch (Exception ex)
            {
                TerminatingErrorDuringExecution(ex);
            }
        }
コード例 #3
0
        /// <summary>
        /// Resumes an existing multi-part upload using the upload ID.
        /// </summary>
        /// <param name="uploadId"></param>
        /// <returns>MultipartManifest</returns>
        public async Task <MultipartManifest> ResumeUpload(string uploadId)
        {
            CheckInitialized();
            var multipartUpload = FindUpload(uploadId);

            if (multipartUpload == null)
            {
                _logger.Error($"No matching upload found for ${uploadId}");
                throw new ArgumentException($"Could not find existing upload with ID: {uploadId} in bucket: {_bucketName} and NamespaceName: {_namespaceName}");
            }

            var    multipartManifest = new MultipartManifest(uploadId);
            string nextPageToken     = null;

            do
            {
                var partsRequest = new ListMultipartUploadPartsRequest()
                {
                    BucketName         = _bucketName,
                    NamespaceName      = _namespaceName,
                    ObjectName         = _objectName,
                    UploadId           = uploadId,
                    Limit              = 100,
                    Page               = nextPageToken,
                    OpcClientRequestId = CreateClientRequestId("List")
                };

                var existingParts = await _service.ListMultipartUploadParts(partsRequest, _retryConfiguration).ConfigureAwait(false);

                nextPageToken = existingParts.OpcNextPage;

                foreach (var part in existingParts.Items)
                {
                    multipartManifest.RegisterExisting(part);
                }
            } while (nextPageToken != null);

            _multipartManifest = multipartManifest;
            _transferManager   = new MultipartTransferManager(_multipartManifest, _service, _executorServiceToUse, _tokenSource.Token, _retryConfiguration);
            _initialized       = true;

            return(multipartManifest);
        }
コード例 #4
0
 /// <summary>
 /// Creates a new enumerable which will iterate over the MultipartUploadPartSummary objects
 /// contained in responses from the ListMultipartUploadParts operation. This enumerable will fetch more data from the server as needed.
 /// </summary>
 /// <param name="request">The request object containing the details to send</param>
 /// <param name="retryConfiguration">The configuration for retrying, may be null</param>
 /// <param name="cancellationToken">The cancellation token object</param>
 /// <returns>The enumerator, which supports a simple iteration over a collection of a specified type</returns>
 public IEnumerable <MultipartUploadPartSummary> ListMultipartUploadPartsRecordEnumerator(ListMultipartUploadPartsRequest request, Common.Retry.RetryConfiguration retryConfiguration = null, CancellationToken cancellationToken = default)
 {
     return(new Common.Utils.ResponseRecordEnumerable <ListMultipartUploadPartsRequest, ListMultipartUploadPartsResponse, MultipartUploadPartSummary>(
                response => response.OpcNextPage,
                input =>
     {
         if (!string.IsNullOrEmpty(input))
         {
             request.Page = input;
         }
         return request;
     },
                request => client.ListMultipartUploadParts(request, retryConfiguration, cancellationToken),
                response => response.Items
                ));
 }