/// <summary> /// Core implementation for the ListShares method. /// </summary> /// <param name="prefix">The share prefix.</param> /// <param name="detailsIncluded">The details included.</param> /// <param name="currentToken">The continuation token.</param> /// <param name="maxResults">A non-negative integer value that indicates the maximum number of results to be returned /// in the result segment, up to the per-operation limit of 5000. If this value is null, the maximum possible number of results will be returned, up to 5000.</param> /// <param name="options">A <see cref="FileRequestOptions"/> object that specifies additional options for the request.</param> /// <returns>A <see cref="RESTCommand{T}"/> that lists the shares.</returns> private RESTCommand <ResultSegment <CloudFileShare> > ListSharesImpl(string prefix, ShareListingDetails detailsIncluded, FileContinuationToken currentToken, int?maxResults, FileRequestOptions options) { ListingContext listingContext = new ListingContext(prefix, maxResults) { Marker = currentToken != null ? currentToken.NextMarker : null }; RESTCommand <ResultSegment <CloudFileShare> > getCmd = new RESTCommand <ResultSegment <CloudFileShare> >(this.Credentials, this.StorageUri); options.ApplyToStorageCommand(getCmd); getCmd.CommandLocationMode = CommonUtility.GetListingLocationMode(currentToken); getCmd.RetrieveResponseStream = true; getCmd.BuildRequestDelegate = (uri, builder, serverTimeout, useVersionHeader, ctx) => ShareHttpWebRequestFactory.List(uri, serverTimeout, listingContext, detailsIncluded, useVersionHeader, ctx); getCmd.SignRequest = this.AuthenticationHandler.SignRequest; getCmd.PreProcessResponse = (cmd, resp, ex, ctx) => HttpResponseParsers.ProcessExpectedStatusCodeNoException(HttpStatusCode.OK, resp, null, cmd, ex); getCmd.PostProcessResponse = (cmd, resp, ctx) => { ListSharesResponse listSharesResponse = new ListSharesResponse(cmd.ResponseStream); List <CloudFileShare> sharesList = new List <CloudFileShare>( listSharesResponse.Shares.Select(item => new CloudFileShare(item.Properties, item.Metadata, item.Name, item.SnapshotTime, this))); FileContinuationToken continuationToken = null; if (listSharesResponse.NextMarker != null) { continuationToken = new FileContinuationToken() { NextMarker = listSharesResponse.NextMarker, TargetLocation = cmd.CurrentResult.TargetLocation, }; } return(new ResultSegment <CloudFileShare>(sharesList) { ContinuationToken = continuationToken, }); }; return(getCmd); }
internal FileResultSegment(IEnumerable <IListFileItem> files, FileContinuationToken continuationToken) { this.Results = files; this.ContinuationToken = continuationToken; }
public virtual Task <ShareResultSegment> ListSharesSegmentedAsync(string prefix, ShareListingDetails detailsIncluded, int?maxResults, FileContinuationToken currentToken, FileRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken) { return(AsyncExtensions.TaskFromApm(this.BeginListSharesSegmented, this.EndListSharesSegmented, prefix, detailsIncluded, maxResults, currentToken, options, operationContext, cancellationToken)); }
public virtual Task <ShareResultSegment> ListSharesSegmentedAsync(string prefix, FileContinuationToken currentToken, CancellationToken cancellationToken) { return(AsyncExtensions.TaskFromApm(this.BeginListSharesSegmented, this.EndListSharesSegmented, prefix, currentToken, cancellationToken)); }
public virtual Task <ShareResultSegment> ListSharesSegmentedAsync(string prefix, ShareListingDetails detailsIncluded, int?maxResults, FileContinuationToken currentToken, FileRequestOptions options, OperationContext operationContext) { return(this.ListSharesSegmentedAsync(prefix, detailsIncluded, maxResults, currentToken, options, operationContext, CancellationToken.None)); }
public virtual ICancellableAsyncResult BeginListSharesSegmented(string prefix, ShareListingDetails detailsIncluded, int?maxResults, FileContinuationToken currentToken, FileRequestOptions options, OperationContext operationContext, AsyncCallback callback, object state) { FileRequestOptions modifiedOptions = FileRequestOptions.ApplyDefaults(options, this); return(Executor.BeginExecuteAsync( this.ListSharesImpl(prefix, detailsIncluded, currentToken, maxResults, modifiedOptions), modifiedOptions.RetryPolicy, operationContext, callback, state)); }
public virtual Task <ShareResultSegment> ListSharesSegmentedAsync(string prefix, FileContinuationToken currentToken) { return(this.ListSharesSegmentedAsync(prefix, currentToken, CancellationToken.None)); }
public virtual ICancellableAsyncResult BeginListSharesSegmented(string prefix, FileContinuationToken currentToken, AsyncCallback callback, object state) { return(this.BeginListSharesSegmented(prefix, ShareListingDetails.None, null, currentToken, null, null, callback, state)); }
/// <summary> /// Returns a result segment containing a collection of shares /// whose names begin with the specified prefix. /// </summary> /// <param name="prefix">The share name prefix.</param> /// <param name="detailsIncluded">A value that indicates whether to return share metadata with the listing.</param> /// <param name="maxResults">A non-negative integer value that indicates the maximum number of results to be returned /// in the result segment, up to the per-operation limit of 5000. If this value is null, the maximum possible number of results will be returned, up to 5000.</param> /// <param name="currentToken">A continuation token returned by a previous listing operation.</param> /// <param name="options">A <see cref="FileRequestOptions"/> object that specifies additional options for the request.</param> /// <param name="operationContext">An <see cref="OperationContext"/> object that represents the context for the current operation.</param> /// <returns>A result segment of shares.</returns> private ResultSegment <CloudFileShare> ListSharesSegmentedCore(string prefix, ShareListingDetails detailsIncluded, int?maxResults, FileContinuationToken currentToken, FileRequestOptions options, OperationContext operationContext) { return(Executor.ExecuteSync( this.ListSharesImpl(prefix, detailsIncluded, currentToken, maxResults, options), options.RetryPolicy, operationContext)); }
public virtual ShareResultSegment ListSharesSegmented(string prefix, ShareListingDetails detailsIncluded, int?maxResults, FileContinuationToken currentToken, FileRequestOptions options = null, OperationContext operationContext = null) { FileRequestOptions modifiedOptions = FileRequestOptions.ApplyDefaults(options, this); ResultSegment <CloudFileShare> resultSegment = this.ListSharesSegmentedCore(prefix, detailsIncluded, maxResults, currentToken, modifiedOptions, operationContext); return(new ShareResultSegment(resultSegment.Results, (FileContinuationToken)resultSegment.ContinuationToken)); }
public virtual ShareResultSegment ListSharesSegmented(string prefix, FileContinuationToken currentToken) { return(this.ListSharesSegmented(prefix, ShareListingDetails.None, null, currentToken, null, null)); }
internal ShareResultSegment(IEnumerable <CloudFileShare> shares, FileContinuationToken continuationToken) { this.Results = shares; this.ContinuationToken = continuationToken; }