Ejemplo n.º 1
0
        /// <summary>
        /// Returns an enumerable collection of the queues in the storage account whose names begin with the specified prefix and that are retrieved lazily.
        /// </summary>
        /// <param name="prefix">The queue name prefix.</param>
        /// <param name="queueListingDetails">An enumeration value that indicates which details to include in the listing.</param>
        /// <param name="options">An object that specifies any additional options for the request.</param>
        /// <param name="operationContext">An <see cref="OperationContext"/> object that represents the context for the current operation. This object is used to track requests, and to provide additional runtime information about the operation.</param>
        /// <returns>An enumerable collection of objects that implement <see cref="CloudQueue"/> and are retrieved lazily.</returns>
        public IEnumerable<CloudQueue> ListQueues(string prefix, QueueListingDetails queueListingDetails = QueueListingDetails.None, QueueRequestOptions options = null, OperationContext operationContext = null)
        {
            QueueRequestOptions modifiedOptions = QueueRequestOptions.ApplyDefaults(options, this);
            operationContext = operationContext ?? new OperationContext();

            return General.LazyEnumerable((token) => this.ListQueuesSegmentedCore(prefix, queueListingDetails, 0, token as QueueContinuationToken, modifiedOptions, operationContext), long.MaxValue, operationContext);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Begins an asynchronous operation to return a result segment containing a collection of queue items.
        /// </summary>
        /// <param name="prefix">The queue name prefix.</param>
        /// <param name="blobListingDetails">A <see cref="QueueListingDetails"/> enumeration describing which items to include in the listing.</param>
        /// <param name="maxResults">A non-negative integer value that indicates the maximum number of results to be returned at a time, up to the
        /// per-operation limit of 5000. If this value is zero, the maximum possible number of results will be returned, up to 5000.</param>
        /// <param name="currentToken">A <see cref="QueueContinuationToken"/> returned by a previous listing operation.</param>
        /// <param name="options">An object that specifies any additional options for the request.</param>
        /// <param name="operationContext">An <see cref="OperationContext"/> object that represents the context for the current operation. This object is used to track requests, and to provide additional runtime information about the operation.</param>
        /// <param name="callback">The callback delegate that will receive notification when the asynchronous operation completes.</param>
        /// <param name="state">A user-defined object that will be passed to the callback delegate.</param>
        /// <returns>An <see cref="ICancellableAsyncResult"/> that references the asynchronous operation.</returns>
        public ICancellableAsyncResult BeginListQueuesSegmented(string prefix, QueueListingDetails blobListingDetails, int maxResults, QueueContinuationToken currentToken, QueueRequestOptions options, OperationContext operationContext, AsyncCallback callback, object state)
        {
            QueueRequestOptions modifiedOptions = QueueRequestOptions.ApplyDefaults(options, this);

            operationContext = operationContext ?? new OperationContext();

            return(Executor.BeginExecuteAsync(
                       this.ListQueuesImpl(prefix, maxResults, blobListingDetails, modifiedOptions, currentToken),
                       modifiedOptions.RetryPolicy,
                       operationContext,
                       callback,
                       state));
        }
        /// <summary>
        /// list azure queues by prefix
        /// </summary>
        /// <param name="prefix">queue prefix</param>
        /// <returns>An enumerable collection of CloudQueue objects</returns>
        internal IEnumerable <CloudQueue> ListQueuesByPrefix(string prefix)
        {
            List <CloudQueue>   queueList           = new List <CloudQueue>();
            QueueListingDetails queueListingDetails = QueueListingDetails.All;
            QueueRequestOptions requestOptions      = RequestOptions;

            if (!NameUtil.IsValidQueuePrefix(prefix))
            {
                throw new ArgumentException(String.Format(Resources.InvalidQueueName, prefix));
            }

            return(Channel.ListQueues(prefix, queueListingDetails, requestOptions, OperationContext));
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Lists the queues impl core.
        /// </summary>
        /// <param name="prefix">The prefix.</param>
        /// <param name="detailsIncluded">The details included.</param>
        /// <param name="continuationToken">The continuation token.</param>
        /// <param name="pagination">The pagination.</param>
        /// <param name="setResult">The set result.</param>
        /// <returns>A <see cref="TaskSequence"/> for listing the queues.</returns>
        private TaskSequence ListQueuesImplCore(
            string prefix,
            QueueListingDetails detailsIncluded,
            ResultContinuation continuationToken,
            ResultPagination pagination,
            Action <ResultSegment <CloudQueue> > setResult)
        {
            CommonUtils.AssertContinuationType(continuationToken, ResultContinuation.ContinuationType.Queue);

            ListingContext listingContext = new ListingContext(prefix, pagination.GetNextRequestPageSize())
            {
                Marker = continuationToken != null ? continuationToken.NextMarker : null
            };

            var queueList = new List <CloudQueue>();

            var webRequest = QueueRequest.List(this.BaseUri, this.Timeout.RoundUpToSeconds(), listingContext, detailsIncluded);

            this.Credentials.SignRequest(webRequest);

            var listTask = webRequest.GetResponseAsyncWithTimeout(this, this.Timeout);

            yield return(listTask);

            string nextMarker;

            using (var response = listTask.Result as HttpWebResponse)
            {
                var parsedResponse = QueueResponse.List(response);

                // Materialize the results so that we can close the response
                queueList.AddRange(parsedResponse.Queues.Select((Func <QueueEntry, CloudQueue>) this.SelectResponse));

                nextMarker = parsedResponse.NextMarker;
            }

            ResultContinuation newContinuationToken = new ResultContinuation()
            {
                NextMarker = nextMarker, Type = ResultContinuation.ContinuationType.Queue
            };

            ResultSegment.CreateResultSegment(
                setResult,
                queueList,
                newContinuationToken,
                pagination,
                this.RetryPolicy,
                (paginationArg, continuationArg, resultSegment) =>
                this.ListQueuesImplCore(prefix, detailsIncluded, continuationArg, paginationArg, resultSegment));
        }
        /// <summary>
        /// List storage queues
        /// </summary>
        /// <param name="prefix">Queue name prefix</param>
        /// <param name="queueListingDetails">Queue listing details</param>
        /// <param name="options">Queue request options</param>
        /// <param name="operationContext">Operation context</param>
        /// <returns>An enumerable collection of the queues in the storage account.</returns>
        public IEnumerable <CloudQueue> ListQueues(string prefix, QueueListingDetails queueListingDetails,
                                                   QueueRequestOptions options, OperationContext operationContext)
        {
            //https://ahmet.im/blog/azure-listblobssegmentedasync-listcontainerssegmentedasync-how-to/
            QueueContinuationToken continuationToken = null;
            var results = new List <CloudQueue>();

            do
            {
                var response = queueClient.ListQueuesSegmentedAsync(prefix, queueListingDetails, null, continuationToken, options, operationContext).Result;
                continuationToken = response.ContinuationToken;
                results.AddRange(response.Results);
            } while (continuationToken != null);
            return(results);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Lists the queues impl.
        /// </summary>
        /// <param name="prefix">The prefix.</param>
        /// <param name="detailsIncluded">The details included.</param>
        /// <param name="continuationToken">The continuation token.</param>
        /// <param name="maxResults">The max results.</param>
        /// <param name="setResult">The set result.</param>
        /// <returns>A <see cref="TaskSequence"/> for listing the queues.</returns>
        private TaskSequence ListQueuesImpl(
            string prefix,
            QueueListingDetails detailsIncluded,
            ResultContinuation continuationToken,
            int?maxResults,
            Action <ResultSegment <CloudQueue> > setResult)
        {
            ResultPagination pagination = new ResultPagination(maxResults.GetValueOrDefault());

            return(this.ListQueuesImplCore(
                       prefix,
                       detailsIncluded,
                       continuationToken,
                       pagination,
                       setResult));
        }
        /// <summary>
        /// Returns a result segment containing a collection of queues
        /// whose names begin with the specified prefix.
        /// </summary>
        /// <param name="prefix">The queue name prefix.</param>
        /// <param name="detailsIncluded">A value that indicates whether to return queue 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 <c>null</c>, the maximum possible number of results will be returned, up to 5000.</param>
        /// <param name="currentToken">A <see cref="QueueContinuationToken"/> token returned by a previous listing operation.</param>
        /// <param name="options">An 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>
        /// <param name="cancellationToken">A <see cref="CancellationToken"/> to observe while waiting for a task to complete.</param>
        /// <returns>A result segment of queues.</returns>
        public Task <QueueResultSegment> ListQueuesSegmentedAsync(string prefix, QueueListingDetails detailsIncluded, int?maxResults, QueueContinuationToken currentToken, QueueRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken)
        {
            QueueRequestOptions modifiedOptions = QueueRequestOptions.ApplyDefaults(options, this);

            operationContext = operationContext ?? new OperationContext();

            return(Task.Run(async() =>
            {
                ResultSegment <CloudQueue> resultSegment = await Executor.ExecuteAsync(
                    this.ListQueuesImpl(prefix, maxResults, detailsIncluded, modifiedOptions, currentToken),
                    modifiedOptions.RetryPolicy,
                    operationContext,
                    cancellationToken);

                return new QueueResultSegment(resultSegment.Results, (QueueContinuationToken)resultSegment.ContinuationToken);
            }, cancellationToken));
        }
        /// <summary>
        /// list azure queues by name
        /// </summary>
        /// <param name="name">queue name</param>
        /// <returns>An enumerable collection of CloudQueue objects</returns>
        internal IEnumerable <CloudQueue> ListQueuesByName(string name)
        {
            string prefix = String.Empty;
            QueueListingDetails queueListingDetails = QueueListingDetails.All;
            QueueRequestOptions requestOptions      = RequestOptions;

            if (String.IsNullOrEmpty(name) || WildcardPattern.ContainsWildcardCharacters(name))
            {
                IEnumerable <CloudQueue> queues = Channel.ListQueues(prefix, queueListingDetails, requestOptions, OperationContext);

                WildcardOptions options  = WildcardOptions.IgnoreCase | WildcardOptions.Compiled;
                WildcardPattern wildcard = null;

                if (!string.IsNullOrEmpty(name))
                {
                    wildcard = new WildcardPattern(name, options);
                }

                foreach (CloudQueue queue in queues)
                {
                    if (wildcard == null || wildcard.IsMatch(queue.Name))
                    {
                        yield return(queue);
                    }
                }
            }
            else
            {
                if (!NameUtil.IsValidQueueName(name))
                {
                    throw new ArgumentException(String.Format(Resources.InvalidQueueName, name));
                }

                CloudQueue queue = Channel.GetQueueReference(name);

                if (Channel.DoesQueueExist(queue, requestOptions, OperationContext))
                {
                    yield return(queue);
                }
                else
                {
                    throw new ResourceNotFoundException(String.Format(Resources.QueueNotFound, name));
                }
            }
        }
 /// <summary>
 /// List storage queues
 /// </summary>
 /// <param name="prefix">Queue name prefix</param>
 /// <param name="queueListingDetails">Queue listing details</param>
 /// <param name="options">Queue request options</param>
 /// <param name="operationContext">Operation context</param>
 /// <returns>An enumerable collection of the queues in the storage account.</returns>
 public IEnumerable<CloudQueue> ListQueues(string prefix, QueueListingDetails queueListingDetails, QueueRequestOptions options, OperationContext operationContext)
 {
     if(string.IsNullOrEmpty(prefix))
     {
         return queueList;
     }
     else
     {
         List<CloudQueue> prefixQueues = new List<CloudQueue>();
         foreach(CloudQueue queue in queueList)
         {
             if(queue.Name.StartsWith(prefix))
             {
                 prefixQueues.Add(queue);
             }
         }
         return prefixQueues;
     }
 }
 /// <summary>
 /// List storage queues
 /// </summary>
 /// <param name="prefix">Queue name prefix</param>
 /// <param name="queueListingDetails">Queue listing details</param>
 /// <param name="options">Queue request options</param>
 /// <param name="operationContext">Operation context</param>
 /// <returns>An enumerable collection of the queues in the storage account.</returns>
 public IEnumerable <CloudQueue> ListQueues(string prefix, QueueListingDetails queueListingDetails, QueueRequestOptions options, OperationContext operationContext)
 {
     if (string.IsNullOrEmpty(prefix))
     {
         return(queueList);
     }
     else
     {
         List <CloudQueue> prefixQueues = new List <CloudQueue>();
         foreach (CloudQueue queue in queueList)
         {
             if (queue.Name.StartsWith(prefix))
             {
                 prefixQueues.Add(queue);
             }
         }
         return(prefixQueues);
     }
 }
 /// <summary>
 /// Constructs a web request to return a listing of all queues in this storage account.
 /// </summary>
 /// <param name="uri">A <see cref="System.Uri"/> specifying the Queue service endpoint.</param>
 /// <param name="timeout">An integer specifying the server timeout interval.</param>
 /// <param name="listingContext">A <see cref="ListingContext"/> object.</param>
 /// <param name="detailsIncluded">A <see cref="QueueListingDetails"/> enumeration value that indicates whether to return queue metadata with the listing.</param>
 /// <param name="operationContext">An <see cref="OperationContext"/> object that represents the context for the current operation.</param>
 /// <returns>A <see cref="System.Net.HttpWebRequest"/> object.</returns>
 public static HttpWebRequest List(Uri uri, int? timeout, ListingContext listingContext, QueueListingDetails detailsIncluded, OperationContext operationContext)
 {
     return QueueHttpWebRequestFactory.List(uri, timeout, listingContext, detailsIncluded, true /* useVersionHeader */, operationContext);
 }
Ejemplo n.º 12
0
        /// <summary>
        /// Core implementation for the ListQueues method.
        /// </summary>
        /// <param name="prefix">The queue 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 at a time, up to the 
        /// per-operation limit of 5000. If this value is <c>null</c>, the maximum possible number of results will be returned, up to 5000.</param>
        /// <returns>A <see cref="TaskSequence"/> that lists the queues.</returns>
        private RESTCommand<ResultSegment<CloudQueue>> ListQueuesImpl(string prefix, QueueListingDetails detailsIncluded, QueueContinuationToken currentToken, int? maxResults)
        {
            ListingContext listingContext = new ListingContext(prefix, maxResults)
            {
                Marker = currentToken != null ? currentToken.NextMarker : null
            };

            RESTCommand<ResultSegment<CloudQueue>> getCmd = new RESTCommand<ResultSegment<CloudQueue>>(this.Credentials, this.BaseUri);

            getCmd.RetrieveResponseStream = true;
            getCmd.Handler = this.AuthenticationHandler;
            getCmd.BuildClient = HttpClientFactory.BuildHttpClient;
            getCmd.BuildRequest = (cmd, cnt, ctx) => QueueHttpRequestMessageFactory.List(cmd.Uri, cmd.ServerTimeoutInSeconds, listingContext, detailsIncluded, cnt, ctx);
            getCmd.PreProcessResponse = (cmd, resp, ex, ctx) => HttpResponseParsers.ProcessExpectedStatusCodeNoException(HttpStatusCode.OK, resp, null /* retVal */, cmd, ex, ctx);
            getCmd.PostProcessResponse = (cmd, resp, ex, ctx) =>
            {
                return Task.Factory.StartNew(() =>
                {
                    ListQueuesResponse listQueuesResponse = new ListQueuesResponse(cmd.ResponseStream);

                    List<CloudQueue> queuesList = new List<CloudQueue>(
                        listQueuesResponse.Queues.Select(item => new CloudQueue(item.Name, this)));

                    QueueContinuationToken continuationToken = null;
                    if (listQueuesResponse.NextMarker != null)
                    {
                        continuationToken = new QueueContinuationToken()
                        {
                            NextMarker = listQueuesResponse.NextMarker,
                        };
                    }

                    return new ResultSegment<CloudQueue>(queuesList)
                    {
                        ContinuationToken = continuationToken,
                    };
                });
            };

            return getCmd;
        }
        public virtual async Task <QueueResultSegment> ListQueuesSegmentedAsync(string prefix, QueueListingDetails queueListingDetails, int?maxResults, QueueContinuationToken currentToken, QueueRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken)
        {
            QueueRequestOptions modifiedOptions = QueueRequestOptions.ApplyDefaults(options, this);

            operationContext = operationContext ?? new OperationContext();

            ResultSegment <CloudQueue> resultSegment = await Executor.ExecuteAsync(
                this.ListQueuesImpl(prefix, maxResults, queueListingDetails, modifiedOptions, currentToken),
                modifiedOptions.RetryPolicy,
                operationContext,
                cancellationToken).ConfigureAwait(false);

            return(new QueueResultSegment(resultSegment.Results, (QueueContinuationToken)resultSegment.ContinuationToken));
        }
 /// <summary>
 /// List storage queues
 /// </summary>
 /// <param name="prefix">Queue name prefix</param>
 /// <param name="queueListingDetails">Queue listing details</param>
 /// <param name="options">Queue request options</param>
 /// <param name="operationContext">Operation context</param>
 /// <returns>An enumerable collection of the queues in the storage account.</returns>
 public IEnumerable <CloudQueue> ListQueues(string prefix, QueueListingDetails queueListingDetails,
                                            QueueRequestOptions options, OperationContext operationContext)
 {
     return(queueClient.ListQueues(prefix, queueListingDetails, options, operationContext));
 }
Ejemplo n.º 15
0
 /// <summary>
 /// Begins an asynchronous operation to return a result segment containing a collection of queues
 /// whose names begin with the specified prefix.
 /// </summary>
 /// <param name="prefix">The queue name prefix.</param>
 /// <param name="detailsIncluded">One of the enumeration values that indicates which details to include in the listing.</param>
 /// <param name="callback">The callback delegate that will receive notification when the asynchronous operation completes.</param>
 /// <param name="state">A user-defined object that will be passed to the callback delegate.</param>
 /// <returns>An <see cref="IAsyncResult"/> that references the asynchronous operation.</returns>
 public IAsyncResult BeginListQueuesSegmented(string prefix, QueueListingDetails detailsIncluded, AsyncCallback callback, object state)
 {
     return(this.BeginListQueuesSegmented(prefix, detailsIncluded, 0, null, callback, state));
 }
Ejemplo n.º 16
0
        /// <summary>
        /// Core implementation for the ListQueues method.
        /// </summary>
        /// <param name="prefix">The queue 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 at a time, up to the
        /// per-operation limit of 5000. If this value is <c>null</c>, the maximum possible number of results will be returned, up to 5000.</param>
        /// <returns>A <see cref="TaskSequence"/> that lists the queues.</returns>
        private RESTCommand <ResultSegment <CloudQueue> > ListQueuesImpl(string prefix, int?maxResults, QueueListingDetails detailsIncluded, QueueRequestOptions options, QueueContinuationToken currentToken)
        {
            ListingContext listingContext = new ListingContext(prefix, maxResults)
            {
                Marker = currentToken != null ? currentToken.NextMarker : null
            };

            RESTCommand <ResultSegment <CloudQueue> > getCmd = new RESTCommand <ResultSegment <CloudQueue> >(this.Credentials, this.BaseUri);

            getCmd.ApplyRequestOptions(options);
            getCmd.RetrieveResponseStream = true;
            getCmd.Handler             = this.AuthenticationHandler;
            getCmd.BuildClient         = HttpClientFactory.BuildHttpClient;
            getCmd.BuildRequest        = (cmd, cnt, ctx) => QueueHttpRequestMessageFactory.List(cmd.Uri, cmd.ServerTimeoutInSeconds, listingContext, detailsIncluded, cnt, ctx);
            getCmd.PreProcessResponse  = (cmd, resp, ex, ctx) => HttpResponseParsers.ProcessExpectedStatusCodeNoException(HttpStatusCode.OK, resp, null /* retVal */, cmd, ex);
            getCmd.PostProcessResponse = (cmd, resp, ctx) =>
            {
                return(Task.Factory.StartNew(() =>
                {
                    ListQueuesResponse listQueuesResponse = new ListQueuesResponse(cmd.ResponseStream);

                    List <CloudQueue> queuesList = new List <CloudQueue>(
                        listQueuesResponse.Queues.Select(item => new CloudQueue(item.Name, this)));

                    QueueContinuationToken continuationToken = null;
                    if (listQueuesResponse.NextMarker != null)
                    {
                        continuationToken = new QueueContinuationToken()
                        {
                            NextMarker = listQueuesResponse.NextMarker,
                        };
                    }

                    return new ResultSegment <CloudQueue>(queuesList)
                    {
                        ContinuationToken = continuationToken,
                    };
                }));
            };

            return(getCmd);
        }
Ejemplo n.º 17
0
        /// <summary>
        /// Lists the queues impl.
        /// </summary>
        /// <param name="prefix">The prefix.</param>
        /// <param name="detailsIncluded">The details included.</param>
        /// <param name="continuationToken">The continuation token.</param>
        /// <param name="maxResults">The max results.</param>
        /// <param name="setResult">The set result.</param>
        /// <returns>A <see cref="TaskSequence"/> for listing the queues.</returns>
        private TaskSequence ListQueuesImpl(
            string prefix,
            QueueListingDetails detailsIncluded,
            ResultContinuation continuationToken,
            int? maxResults,
            Action<ResultSegment<CloudQueue>> setResult)
        {
            ResultPagination pagination = new ResultPagination(maxResults.GetValueOrDefault());

            return this.ListQueuesImplCore(
                prefix,
                detailsIncluded,
                continuationToken,
                pagination,
                setResult);
        }
Ejemplo n.º 18
0
        /// <summary>
        /// Lists the queues impl core.
        /// </summary>
        /// <param name="prefix">The prefix.</param>
        /// <param name="detailsIncluded">The details included.</param>
        /// <param name="continuationToken">The continuation token.</param>
        /// <param name="pagination">The pagination.</param>
        /// <param name="setResult">The set result.</param>
        /// <returns>A <see cref="TaskSequence"/> for listing the queues.</returns>
        private TaskSequence ListQueuesImplCore(
            string prefix,
            QueueListingDetails detailsIncluded,
            ResultContinuation continuationToken,
            ResultPagination pagination,
            Action<ResultSegment<CloudQueue>> setResult)
        {
            CommonUtils.AssertContinuationType(continuationToken, ResultContinuation.ContinuationType.Queue);

            ListingContext listingContext = new ListingContext(prefix, pagination.GetNextRequestPageSize())
            {
                Marker = continuationToken != null ? continuationToken.NextMarker : null
            };

            var queueList = new List<CloudQueue>();

            var webRequest = QueueRequest.List(this.BaseUri, this.Timeout.RoundUpToSeconds(), listingContext, detailsIncluded);
            this.Credentials.SignRequest(webRequest);

            var listTask = webRequest.GetResponseAsyncWithTimeout(this, this.Timeout);
            yield return listTask;

            string nextMarker;

            using (var response = listTask.Result as HttpWebResponse)
            {
                var parsedResponse = QueueResponse.List(response);

                // Materialize the results so that we can close the response
                queueList.AddRange(parsedResponse.Queues.Select((Func<QueueEntry, CloudQueue>)this.SelectResponse));

                nextMarker = parsedResponse.NextMarker;
            }

            ResultContinuation newContinuationToken = new ResultContinuation() { NextMarker = nextMarker, Type = ResultContinuation.ContinuationType.Queue };

            ResultSegment.CreateResultSegment(
                setResult,
                queueList,
                newContinuationToken,
                pagination,
                this.RetryPolicy,
                (paginationArg, continuationArg, resultSegment) =>
                    this.ListQueuesImplCore(prefix, detailsIncluded, continuationArg, paginationArg, resultSegment));
        }
Ejemplo n.º 19
0
 /// <summary>
 /// Returns a result segment containing a collection of queues
 /// in the storage account. 
 /// </summary>
 /// <param name="prefix">The queue name prefix.</param>
 /// <param name="detailsIncluded">One of the enumeration values that indicates which details to include in the listing.</param>
 /// <returns>A result segment containing a collection of queues.</returns>
 public ResultSegment<CloudQueue> ListQueuesSegmented(string prefix, QueueListingDetails detailsIncluded)
 {
     return this.ListQueuesSegmented(prefix, detailsIncluded, 0, null);
 }
Ejemplo n.º 20
0
 /// <summary>
 /// Returns a result segment containing a collection of queues
 /// whose names begin with the specified prefix. 
 /// </summary>
 /// <param name="prefix">The queue name prefix.</param>
 /// <param name="detailsIncluded">One of the enumeration values that indicates which details to include in the listing.</param>
 /// <param name="maxResults">A non-negative integer value that indicates the maximum number of results to be returned at a time, up to the 
 /// per-operation limit of 5000. If this value is zero, the maximum possible number of results will be returned, up to 5000.</param>         
 /// <param name="continuationToken">A continuation token returned by a previous listing operation.</param> 
 /// <returns>A result segment containing a collection of queues.</returns>
 public ResultSegment<CloudQueue> ListQueuesSegmented(string prefix, QueueListingDetails detailsIncluded, int maxResults, ResultContinuation continuationToken)
 {
     return TaskImplHelper.ExecuteImplWithRetry<ResultSegment<CloudQueue>>(
         (setResult) => this.ListQueuesImpl(prefix, detailsIncluded, continuationToken, maxResults, setResult),
         this.RetryPolicy);
 }
Ejemplo n.º 21
0
 /// <summary>
 /// Returns an enumerable collection of the queues in the storage account whose names begin with the specified prefix and that are retrieved lazily.
 /// </summary>
 /// <param name="prefix">The queue name prefix.</param>
 /// <param name="detailsIncluded">One of the enumeration values that indicates which details to include in the listing.</param>
 /// <returns>An enumerable collection of queues that are retrieved lazily.</returns>
 public IEnumerable<CloudQueue> ListQueues(string prefix, QueueListingDetails detailsIncluded)
 {
     return CommonUtils.LazyEnumerateSegmented<CloudQueue>(
         (setResult) => this.ListQueuesImpl(prefix, detailsIncluded, null, null, setResult),
         this.RetryPolicy);
 }
Ejemplo n.º 22
0
 /// <summary>
 /// Begins an asynchronous operation to return a result segment containing a collection of queues
 /// whose names begin with the specified prefix.
 /// </summary>
 /// <param name="prefix">The queue name prefix.</param>
 /// <param name="detailsIncluded">One of the enumeration values that indicates which details to include in the listing.</param>
 /// <param name="maxResults">A non-negative integer value that indicates the maximum number of results to be returned at a time, up to the 
 /// per-operation limit of 5000. If this value is zero, the maximum possible number of results will be returned, up to 5000.</param>         
 /// <param name="continuationToken">A continuation token returned by a previous listing operation.</param> 
 /// <param name="callback">The callback delegate that will receive notification when the asynchronous operation completes.</param>
 /// <param name="state">A user-defined object that will be passed to the callback delegate.</param>
 /// <returns>An <see cref="IAsyncResult"/> that references the asynchronous operation.</returns>
 public IAsyncResult BeginListQueuesSegmented(string prefix, QueueListingDetails detailsIncluded, int maxResults, ResultContinuation continuationToken, AsyncCallback callback, object state)
 {
     return TaskImplHelper.BeginImplWithRetry<ResultSegment<CloudQueue>>(
         (setResult) => this.ListQueuesImpl(prefix, detailsIncluded, continuationToken, maxResults, setResult),
         this.RetryPolicy,
         callback,
         state);
 }
Ejemplo n.º 23
0
 /// <summary>
 /// Begins an asynchronous operation to return a result segment containing a collection of queues
 /// whose names begin with the specified prefix.
 /// </summary>
 /// <param name="prefix">The queue name prefix.</param>
 /// <param name="detailsIncluded">One of the enumeration values that indicates which details to include in the listing.</param>
 /// <param name="callback">The callback delegate that will receive notification when the asynchronous operation completes.</param>
 /// <param name="state">A user-defined object that will be passed to the callback delegate.</param>
 /// <returns>An <see cref="IAsyncResult"/> that references the asynchronous operation.</returns>
 public IAsyncResult BeginListQueuesSegmented(string prefix, QueueListingDetails detailsIncluded, AsyncCallback callback, object state)
 {
     return this.BeginListQueuesSegmented(prefix, detailsIncluded, 0, null, callback, state);
 }
        /// <summary>
        /// Constructs a web request to return a listing of all queues in this storage account.
        /// </summary>
        /// <param name="uri">A <see cref="System.Uri"/> specifying the Queue service endpoint.</param>
        /// <param name="timeout">An integer specifying the server timeout interval.</param>
        /// <param name="listingContext">A <see cref="ListingContext"/> object.</param>
        /// <param name="detailsIncluded">A <see cref="QueueListingDetails"/> enumeration value that indicates whether to return queue metadata with the listing.</param>
        /// <param name="useVersionHeader">A boolean value indicating whether to set the <i>x-ms-version</i> HTTP header.</param>
        /// <param name="operationContext">An <see cref="OperationContext"/> object that represents the context for the current operation.</param>
        /// <returns>A <see cref="System.Net.HttpWebRequest"/> object.</returns>
        public static HttpWebRequest List(Uri uri, int?timeout, ListingContext listingContext, QueueListingDetails detailsIncluded, bool useVersionHeader, OperationContext operationContext)
        {
            UriQueryBuilder builder = new UriQueryBuilder();

            builder.Add(Constants.QueryConstants.Component, "list");

            if (listingContext != null)
            {
                if (listingContext.Prefix != null)
                {
                    builder.Add("prefix", listingContext.Prefix);
                }

                if (listingContext.Marker != null)
                {
                    builder.Add("marker", listingContext.Marker);
                }

                if (listingContext.MaxResults.HasValue)
                {
                    builder.Add("maxresults", listingContext.MaxResults.ToString());
                }
            }

            if ((detailsIncluded & QueueListingDetails.Metadata) != 0)
            {
                builder.Add("include", "metadata");
            }

            HttpWebRequest request = HttpWebRequestFactory.CreateWebRequest(WebRequestMethods.Http.Get, uri, timeout, builder, useVersionHeader, operationContext);

            return(request);
        }
Ejemplo n.º 25
0
        /// <summary>
        /// Returns a result segment containing a collection of queues in the storage account.
        /// </summary>
        /// <param name="prefix">The queue name prefix.</param>
        /// <param name="queueListingDetails">A <see cref="QueueListingDetails"/> enumeration describing which items to include in the listing.</param>
        /// <param name="maxResults">A non-negative integer value that indicates the maximum number of results to be returned at a time, up to the 
        /// per-operation limit of 5000. If this value is <c>null</c>, the maximum possible number of results will be returned, up to 5000.</param>         
        /// <param name="currentToken">A <see cref="QueueContinuationToken"/> returned by a previous listing operation.</param> 
        /// <param name="options">An 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. This object is used to track requests, and to provide additional runtime information about the operation.</param>
        /// <returns>A result segment containing objects that implement <see cref="CloudQueue"/>.</returns>
        public QueueResultSegment ListQueuesSegmented(string prefix, QueueListingDetails queueListingDetails, int? maxResults, QueueContinuationToken currentToken, QueueRequestOptions options = null, OperationContext operationContext = null)
        {
            QueueRequestOptions modifiedOptions = QueueRequestOptions.ApplyDefaults(options, this);
            operationContext = operationContext ?? new OperationContext();

            ResultSegment<CloudQueue> resultSegment = this.ListQueuesSegmentedCore(prefix, queueListingDetails, maxResults, currentToken, modifiedOptions, operationContext);
            return new QueueResultSegment(resultSegment.Results, (QueueContinuationToken)resultSegment.ContinuationToken);
        }
Ejemplo n.º 26
0
 /// <summary>
 /// Returns a result segment containing a collection of queues
 /// in the storage account.
 /// </summary>
 /// <param name="prefix">The queue name prefix.</param>
 /// <param name="detailsIncluded">One of the enumeration values that indicates which details to include in the listing.</param>
 /// <returns>A result segment containing a collection of queues.</returns>
 public ResultSegment <CloudQueue> ListQueuesSegmented(string prefix, QueueListingDetails detailsIncluded)
 {
     return(this.ListQueuesSegmented(prefix, detailsIncluded, 0, null));
 }
Ejemplo n.º 27
0
        /// <summary>
        /// Begins an asynchronous operation to return a result segment containing a collection of queue items.
        /// </summary>
        /// <param name="prefix">The queue name prefix.</param>
        /// <param name="queueListingDetails">A <see cref="QueueListingDetails"/> enumeration describing which items to include in the listing.</param>
        /// <param name="maxResults">A non-negative integer value that indicates the maximum number of results to be returned at a time, up to the 
        /// per-operation limit of 5000. If this value is <c>null</c>, the maximum possible number of results will be returned, up to 5000.</param>         
        /// <param name="currentToken">A <see cref="QueueContinuationToken"/> returned by a previous listing operation.</param> 
        /// <param name="options">An 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. This object is used to track requests, and to provide additional runtime information about the operation.</param>
        /// <param name="callback">The callback delegate that will receive notification when the asynchronous operation completes.</param>
        /// <param name="state">A user-defined object that will be passed to the callback delegate.</param>
        /// <returns>An <see cref="ICancellableAsyncResult"/> that references the asynchronous operation.</returns>
        public ICancellableAsyncResult BeginListQueuesSegmented(string prefix, QueueListingDetails queueListingDetails, int? maxResults, QueueContinuationToken currentToken, QueueRequestOptions options, OperationContext operationContext, AsyncCallback callback, object state)
        {
            QueueRequestOptions modifiedOptions = QueueRequestOptions.ApplyDefaults(options, this);

            operationContext = operationContext ?? new OperationContext();

            return Executor.BeginExecuteAsync(
                this.ListQueuesImpl(prefix, maxResults, queueListingDetails, modifiedOptions, currentToken),
                modifiedOptions.RetryPolicy,
                operationContext,
                callback,
                state);
        }
Ejemplo n.º 28
0
        /// <summary>
        /// Returns an enumerable collection of QueueStorage.
        /// </summary>
        /// <param name="prefix">A string containing the queue name prefix.</param>
        /// <param name="queueListingDetails">A Microsoft.WindowsAzure.Storage.Queue.Protocol.QueueListingDetails enumeration value that indicates which details to include in the listing.</param>
        /// <returns>List of QueueStorage.</returns>
        public List <QueueStorage> ListQueues(string prefix = null, QueueListingDetails queueListingDetails = QueueListingDetails.None)
        {
            var queues = this._cloudQueueClient.ListQueues(prefix, queueListingDetails);

            return(queues.Select(i => new QueueStorage(i)).ToList());
        }
Ejemplo n.º 29
0
 public Task<QueueResultSegment> ListQueuesSegmentedAsync(string prefix, QueueListingDetails queueListingDetails, int? maxResults, QueueContinuationToken currentToken, QueueRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken)
 {
     return AsyncExtensions.TaskFromApm(this.BeginListQueuesSegmented, this.EndListQueuesSegmented, prefix, queueListingDetails, maxResults, currentToken, options, operationContext, cancellationToken);
 }
 /// <summary>
 /// Begins an asynchronous operation to return a result segment containing a collection of queues.
 /// </summary>
 /// <param name="prefix">A string containing the queue name prefix.</param>
 /// <param name="queueListingDetails">A <see cref="QueueListingDetails"/> enumeration describing which items to include in the listing.</param>
 /// <param name="maxResults">A non-negative integer value that indicates the maximum number of results to be returned at a time, up to the
 /// per-operation limit of 5000. If this value is <c>null</c>, the maximum possible number of results will be returned, up to 5000.</param>
 /// <param name="currentToken">A <see cref="QueueContinuationToken"/> returned by a previous listing operation.</param>
 /// <param name="options">A <see cref="QueueRequestOptions"/> 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>
 /// <param name="callback">An <see cref="AsyncCallback"/> delegate that will receive notification when the asynchronous operation completes.</param>
 /// <param name="state">A user-defined object that will be passed to the callback delegate.</param>
 /// <returns>An <see cref="ICancellableAsyncResult"/> that references the asynchronous operation.</returns>
 public virtual ICancellableAsyncResult BeginListQueuesSegmented(string prefix, QueueListingDetails queueListingDetails, int?maxResults, QueueContinuationToken currentToken, QueueRequestOptions options, OperationContext operationContext, AsyncCallback callback, object state)
 {
     return(CancellableAsyncResultTaskWrapper.Create(token => this.ListQueuesSegmentedAsync(prefix, queueListingDetails, maxResults, currentToken, options, operationContext, token), callback, state));
 }
Ejemplo n.º 31
0
        /// <summary>
        /// Core implementation for the ListQueues method.
        /// </summary>
        /// <param name="prefix">The queue 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 at a time, up to the 
        /// per-operation limit of 5000. If this value is <c>null</c>, the maximum possible number of results will be returned, up to 5000.</param>
        /// <returns>A <see cref="TaskSequence"/> that lists the queues.</returns>
        private RESTCommand<ResultSegment<CloudQueue>> ListQueuesImpl(string prefix, int? maxResults, QueueListingDetails detailsIncluded, QueueRequestOptions options, QueueContinuationToken currentToken)
        {
            ListingContext listingContext = new ListingContext(prefix, maxResults)
            {
                Marker = currentToken != null ? currentToken.NextMarker : null
            };

            RESTCommand<ResultSegment<CloudQueue>> getCmd = new RESTCommand<ResultSegment<CloudQueue>>(this.Credentials, this.StorageUri);

            options.ApplyToStorageCommand(getCmd);
            getCmd.CommandLocationMode = CommonUtility.GetListingLocationMode(currentToken);
            getCmd.RetrieveResponseStream = true;
            getCmd.BuildRequest = (cmd, uri, builder, cnt, serverTimeout, ctx) => QueueHttpRequestMessageFactory.List(uri, serverTimeout, listingContext, detailsIncluded, cnt, ctx, this.GetCanonicalizer(), this.Credentials);
            getCmd.PreProcessResponse = (cmd, resp, ex, ctx) => HttpResponseParsers.ProcessExpectedStatusCodeNoException(HttpStatusCode.OK, resp, null /* retVal */, cmd, ex);
            getCmd.PostProcessResponse = (cmd, resp, ctx) =>
            {
                return Task.Factory.StartNew(() =>
                {
                    ListQueuesResponse listQueuesResponse = new ListQueuesResponse(cmd.ResponseStream);

                    List<CloudQueue> queuesList = listQueuesResponse.Queues.Select(item => new CloudQueue(item.Metadata, item.Name, this)).ToList();

                    QueueContinuationToken continuationToken = null;
                    if (listQueuesResponse.NextMarker != null)
                    {
                        continuationToken = new QueueContinuationToken()
                        {
                            NextMarker = listQueuesResponse.NextMarker,
                            TargetLocation = cmd.CurrentResult.TargetLocation,
                        };
                    }

                    return new ResultSegment<CloudQueue>(queuesList)
                    {
                        ContinuationToken = continuationToken,
                    };
                });
            };

            return getCmd;
        }
Ejemplo n.º 32
0
 /// <summary>
 /// Returns a result segment containing a collection of queues in the storage account.
 /// </summary>
 /// <param name="prefix">The queue name prefix.</param>
 /// <param name="queueListingDetails">A <see cref="QueueListingDetails"/> enumeration describing which items to include in the listing.</param>
 /// <param name="maxResults">A non-negative integer value that indicates the maximum number of results to be returned at a time, up to the 
 /// per-operation limit of 5000. If this value is <c>null</c>, the maximum possible number of results will be returned, up to 5000.</param>         
 /// <param name="currentToken">A <see cref="QueueContinuationToken"/> returned by a previous listing operation.</param> 
 /// <param name="options">An 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. This object is used to track requests, and to provide additional runtime information about the operation.</param>
 /// <returns>A result segment.</returns>
 private ResultSegment<CloudQueue> ListQueuesSegmentedCore(string prefix, QueueListingDetails queueListingDetails, int? maxResults, QueueContinuationToken currentToken, QueueRequestOptions options, OperationContext operationContext)
 {
     return Executor.ExecuteSync(
         this.ListQueuesImpl(prefix, maxResults, queueListingDetails, options, currentToken),
         options.RetryPolicy,
         operationContext);
 }
        /// <summary>
        /// Constructs a web request to return a listing of all queues in this storage account.
        /// </summary>
        /// <param name="uri">The absolute URI for the account.</param>
        /// <param name="timeout">The server timeout interval.</param>
        /// <param name="listingContext">A set of parameters for the listing operation.</param>
        /// <param name="detailsIncluded">Additional details to return with the listing.</param>
        /// <returns>A web request for the specified operation.</returns>
        public static HttpRequestMessage List(Uri uri, int?timeout, ListingContext listingContext, QueueListingDetails detailsIncluded, HttpContent content, OperationContext operationContext)
        {
            UriQueryBuilder builder = new UriQueryBuilder();

            builder.Add(Constants.QueryConstants.Component, "list");

            if (listingContext != null)
            {
                if (listingContext.Prefix != null)
                {
                    builder.Add("prefix", listingContext.Prefix);
                }

                if (listingContext.Marker != null)
                {
                    builder.Add("marker", listingContext.Marker);
                }

                if (listingContext.MaxResults != null)
                {
                    builder.Add("maxresults", listingContext.MaxResults.ToString());
                }
            }

            if ((detailsIncluded & QueueListingDetails.Metadata) != 0)
            {
                builder.Add("include", "metadata");
            }

            HttpRequestMessage request = HttpRequestMessageFactory.CreateRequestMessage(HttpMethod.Get, uri, timeout, builder, content, operationContext);

            return(request);
        }
Ejemplo n.º 34
0
 public Task<QueueResultSegment> ListQueuesSegmentedAsync(string prefix, QueueListingDetails queueListingDetails, int? maxResults, QueueContinuationToken currentToken, QueueRequestOptions options, OperationContext operationContext)
 {
     return this.ListQueuesSegmentedAsync(prefix, queueListingDetails, maxResults, currentToken, options, operationContext, CancellationToken.None);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="QueueListingContext"/> class.
 /// </summary>
 /// <param name="prefix">The queue prefix.</param>
 /// <param name="maxResults">The maximum number of results to return.</param>
 /// <param name="include">The include parameter.</param>
 public QueueListingContext(string prefix, int? maxResults, QueueListingDetails include)
     : base(prefix, maxResults)
 {
     this.Include = include;
 }
Ejemplo n.º 36
0
        /// <summary>
        /// Core implementation of the ListQueues method.
        /// </summary>
        /// <param name="prefix">The queue name prefix.</param>
        /// <param name="maxResults">A non-negative integer value that indicates the maximum number of results to be returned at a time, up to the 
        /// per-operation limit of 5000. If this value is <c>null</c>, the maximum possible number of results will be returned, up to 5000.</param>
        /// <param name="queueListingDetails">A <see cref="QueueListingDetails"/> enumeration describing which items to include in the listing.</param>
        /// <param name="options">An object that specifies additional options for the request.</param>
        /// <param name="currentToken">The continuation token.</param>
        /// <returns>A <see cref="RESTCommand{T}"/> that lists the queues.</returns>
        private RESTCommand<ResultSegment<CloudQueue>> ListQueuesImpl(string prefix, int? maxResults, QueueListingDetails queueListingDetails, QueueRequestOptions options, QueueContinuationToken currentToken)
        {
            QueueListingContext listingContext = new QueueListingContext(prefix, maxResults, queueListingDetails)
            {
                Marker = currentToken != null ? currentToken.NextMarker : null
            };

            RESTCommand<ResultSegment<CloudQueue>> getCmd = new RESTCommand<ResultSegment<CloudQueue>>(this.Credentials, this.BaseUri);

            getCmd.ApplyRequestOptions(options);
            getCmd.RetrieveResponseStream = true;
            getCmd.BuildRequestDelegate = (uri, builder, serverTimeout, ctx) => QueueHttpWebRequestFactory.List(uri, serverTimeout, listingContext, queueListingDetails, ctx);
            getCmd.SignRequest = this.AuthenticationHandler.SignRequest;
            getCmd.PreProcessResponse = (cmd, resp, ex, ctx) => HttpResponseParsers.ProcessExpectedStatusCodeNoException(HttpStatusCode.OK, resp, null /* retVal */, cmd, ex);
            getCmd.PostProcessResponse = (cmd, resp, ctx) =>
            {
                ListQueuesResponse listQueuesResponse = new ListQueuesResponse(cmd.ResponseStream);

                List<CloudQueue> queuesList = new List<CloudQueue>(
                    listQueuesResponse.Queues.Select(item => new CloudQueue(item.Name, this)));

                QueueContinuationToken continuationToken = null;
                if (listQueuesResponse.NextMarker != null)
                {
                    continuationToken = new QueueContinuationToken()
                    {
                        NextMarker = listQueuesResponse.NextMarker,
                    };
                }

                return new ResultSegment<CloudQueue>(queuesList)
                {
                    ContinuationToken = continuationToken,
                };
            };

            return getCmd;
        }
Ejemplo n.º 37
0
 public virtual Task <QueueResultSegment> ListQueuesSegmentedAsync(string prefix, QueueListingDetails detailsIncluded, int?maxResults, QueueContinuationToken currentToken, QueueRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken)
 {
     throw new System.NotImplementedException();
 }
 /// <summary>
 /// List storage queues
 /// </summary>
 /// <param name="prefix">Queue name prefix</param>
 /// <param name="queueListingDetails">Queue listing details</param>
 /// <param name="options">Queue request options</param>
 /// <param name="operationContext">Operation context</param>
 /// <returns>An enumerable collection of the queues in the storage account.</returns>
 public IEnumerable<CloudQueue> ListQueues(string prefix, QueueListingDetails queueListingDetails,
     QueueRequestOptions options, OperationContext operationContext)
 {
     return queueClient.ListQueues(prefix, queueListingDetails, options, operationContext);
 }
Ejemplo n.º 39
0
 private RESTCommand <ResultSegment <CloudQueue> > ListQueuesImpl(string prefix, int?maxResults, QueueListingDetails detailsIncluded, QueueRequestOptions options, QueueContinuationToken currentToken)
 {
     throw new System.NotImplementedException();
 }
        /// <summary>
        /// Constructs a web request to return a listing of all queues in this storage account.
        /// </summary>
        /// <param name="uri">A <see cref="System.Uri"/> specifying the Queue service endpoint.</param>
        /// <param name="timeout">An integer specifying the server timeout interval.</param>
        /// <param name="listingContext">A <see cref="ListingContext"/> object.</param>
        /// <param name="detailsIncluded">A <see cref="QueueListingDetails"/> enumeration value that indicates whether to return queue metadata with the listing.</param>
        /// <param name="useVersionHeader">A flag indicating whether to set the x-ms-version HTTP header.</param>
        /// <param name="operationContext">An <see cref="OperationContext"/> object that represents the context for the current operation.</param>
        /// <returns>A <see cref="System.Net.HttpWebRequest"/> object.</returns>
        public static HttpWebRequest List(Uri uri, int? timeout, ListingContext listingContext, QueueListingDetails detailsIncluded, bool useVersionHeader, OperationContext operationContext)
        {
            UriQueryBuilder builder = new UriQueryBuilder();
            builder.Add(Constants.QueryConstants.Component, "list");

            if (listingContext != null)
            {
                if (listingContext.Prefix != null)
                {
                    builder.Add("prefix", listingContext.Prefix);
                }

                if (listingContext.Marker != null)
                {
                    builder.Add("marker", listingContext.Marker);
                }

                if (listingContext.MaxResults.HasValue)
                {
                    builder.Add("maxresults", listingContext.MaxResults.ToString());
                }
            }

            if ((detailsIncluded & QueueListingDetails.Metadata) != 0)
            {
                builder.Add("include", "metadata");
            }

            HttpWebRequest request = HttpWebRequestFactory.CreateWebRequest(WebRequestMethods.Http.Get, uri, timeout, builder, useVersionHeader, operationContext);
            return request;
        }
Ejemplo n.º 41
0
 /// <summary>
 /// Initializes a new instance of the <see cref="QueueListingContext"/> class.
 /// </summary>
 /// <param name="prefix">The queue prefix.</param>
 /// <param name="maxResults">The maximum number of results to return.</param>
 /// <param name="include">The include parameter.</param>
 public QueueListingContext(string prefix, int?maxResults, QueueListingDetails include)
     : base(prefix, maxResults)
 {
     this.Include = include;
 }
Ejemplo n.º 42
0
        /// <summary>
        /// Returns a result segment containing a collection of queues
        /// whose names begin with the specified prefix.
        /// </summary>
        /// <param name="prefix">The queue name prefix.</param>
        /// <param name="detailsIncluded">A value that indicates whether to return queue 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 <c>null</c>, the maximum possible number of results will be returned, up to 5000.</param>         
        /// <param name="currentToken">A <see cref="QueueContinuationToken"/> token returned by a previous listing operation.</param>
        /// <param name="operationContext">An <see cref="OperationContext"/> object that represents the context for the current operation.</param>
        /// <returns>A result segment of queues.</returns>
        public IAsyncOperation<QueueResultSegment> ListQueuesSegmentedAsync(string prefix, QueueListingDetails detailsIncluded, int? maxResults, QueueContinuationToken currentToken, OperationContext operationContext)
        {
            return AsyncInfo.Run(async (token) =>
            {
                ResultSegment<CloudQueue> resultSegment = await Executor.ExecuteAsync(
                    this.ListQueuesImpl(prefix, detailsIncluded, currentToken, maxResults),
                    this.RetryPolicy,
                    operationContext,
                    token);

                return new QueueResultSegment(resultSegment.Results, (QueueContinuationToken)resultSegment.ContinuationToken);
            });
        }
Ejemplo n.º 43
0
 public QueueListingContext(string prefix, int?maxResults, QueueListingDetails include)
     : base(prefix, maxResults)
 {
     throw new System.NotImplementedException();
 }
 /// <summary>
 /// Constructs a web request to return a listing of all queues in this storage account.
 /// </summary>
 /// <param name="uri">A <see cref="System.Uri"/> specifying the Queue service endpoint.</param>
 /// <param name="timeout">An integer specifying the server timeout interval.</param>
 /// <param name="listingContext">A <see cref="ListingContext"/> object.</param>
 /// <param name="detailsIncluded">A <see cref="QueueListingDetails"/> enumeration value that indicates whether to return queue metadata with the listing.</param>
 /// <param name="operationContext">An <see cref="OperationContext"/> object that represents the context for the current operation.</param>
 /// <returns>A <see cref="System.Net.HttpWebRequest"/> object.</returns>
 public static HttpWebRequest List(Uri uri, int?timeout, ListingContext listingContext, QueueListingDetails detailsIncluded, OperationContext operationContext)
 {
     return(QueueHttpWebRequestFactory.List(uri, timeout, listingContext, detailsIncluded, true /* useVersionHeader */, operationContext));
 }
Ejemplo n.º 45
0
 public Task <QueueResultSegment> ListQueuesSegmentedAsync(string prefix, QueueListingDetails queueListingDetails, int?maxResults, QueueContinuationToken currentToken, QueueRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken)
 {
     return(AsyncExtensions.TaskFromApm(this.BeginListQueuesSegmented, this.EndListQueuesSegmented, prefix, queueListingDetails, maxResults, currentToken, options, operationContext, cancellationToken));
 }
Ejemplo n.º 46
0
 /// <summary>
 /// Returns an enumerable collection of the queues in the storage account whose names begin with the specified prefix and that are retrieved lazily.
 /// </summary>
 /// <param name="prefix">The queue name prefix.</param>
 /// <param name="detailsIncluded">One of the enumeration values that indicates which details to include in the listing.</param>
 /// <returns>An enumerable collection of queues that are retrieved lazily.</returns>
 public IEnumerable <CloudQueue> ListQueues(string prefix, QueueListingDetails detailsIncluded)
 {
     return(CommonUtils.LazyEnumerateSegmented <CloudQueue>(
                (setResult) => this.ListQueuesImpl(prefix, detailsIncluded, null, null, setResult),
                this.RetryPolicy));
 }
Ejemplo n.º 47
0
        /// <summary>
        /// Constructs a web request to return a listing of all queues in the storage account.
        /// </summary>
        /// <param name="uri">The absolute URI to the queue.</param>
        /// <param name="timeout">The server timeout interval.</param>
        /// <param name="listingContext">A set of parameters for the listing operation.</param>
        /// <param name="detailsIncluded">One of the enumeration values indicating which details to include in the listing.</param>
        /// <returns>A web request to use to perform the operation.</returns>
        public static HttpWebRequest List(Uri uri, int timeout, ListingContext listingContext, QueueListingDetails detailsIncluded)
        {
            UriQueryBuilder builder = new UriQueryBuilder();
            builder.Add(Constants.QueryConstants.Component, "list");

            if (listingContext != null)
            {
                if (listingContext.Prefix != null)
                {
                    builder.Add("prefix", listingContext.Prefix);
                }

                if (listingContext.Marker != null)
                {
                    builder.Add("marker", listingContext.Marker);
                }

                if (listingContext.MaxResults != null)
                {
                    builder.Add("maxresults", listingContext.MaxResults.ToString());
                }
            }

            if ((detailsIncluded & QueueListingDetails.Metadata) != 0)
            {
                builder.Add("include", "metadata");
            }

            HttpWebRequest request = CreateWebRequest(uri, timeout, builder);

            request.Method = "GET";

            return request;
        }
Ejemplo n.º 48
0
 /// <summary>
 /// Returns a result segment containing a collection of queues
 /// whose names begin with the specified prefix.
 /// </summary>
 /// <param name="prefix">The queue name prefix.</param>
 /// <param name="detailsIncluded">One of the enumeration values that indicates which details to include in the listing.</param>
 /// <param name="maxResults">A non-negative integer value that indicates the maximum number of results to be returned at a time, up to the
 /// per-operation limit of 5000. If this value is zero, the maximum possible number of results will be returned, up to 5000.</param>
 /// <param name="continuationToken">A continuation token returned by a previous listing operation.</param>
 /// <returns>A result segment containing a collection of queues.</returns>
 public ResultSegment <CloudQueue> ListQueuesSegmented(string prefix, QueueListingDetails detailsIncluded, int maxResults, ResultContinuation continuationToken)
 {
     return(TaskImplHelper.ExecuteImplWithRetry <ResultSegment <CloudQueue> >(
                (setResult) => this.ListQueuesImpl(prefix, detailsIncluded, continuationToken, maxResults, setResult),
                this.RetryPolicy));
 }
Ejemplo n.º 49
0
        /// <summary>
        /// Returns a result segment containing a collection of queues
        /// whose names begin with the specified prefix.
        /// </summary>
        /// <param name="prefix">The queue name prefix.</param>
        /// <param name="detailsIncluded">A value that indicates whether to return queue 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 <c>null</c>, the maximum possible number of results will be returned, up to 5000.</param>         
        /// <param name="currentToken">A <see cref="QueueContinuationToken"/> token returned by a previous listing operation.</param>
        /// <param name="options">An 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 queues.</returns>
        public IAsyncOperation<QueueResultSegment> ListQueuesSegmentedAsync(string prefix, QueueListingDetails detailsIncluded, int? maxResults, QueueContinuationToken currentToken, QueueRequestOptions options, OperationContext operationContext)
        {
            QueueRequestOptions modifiedOptions = QueueRequestOptions.ApplyDefaults(options, this);
            operationContext = operationContext ?? new OperationContext();

            return AsyncInfo.Run(async (token) =>
            {
                ResultSegment<CloudQueue> resultSegment = await Executor.ExecuteAsync(
                    this.ListQueuesImpl(prefix, maxResults, detailsIncluded, modifiedOptions, currentToken),
                    this.RetryPolicy,
                    operationContext,
                    token);

                return new QueueResultSegment(resultSegment.Results, (QueueContinuationToken)resultSegment.ContinuationToken);
            });
        }
Ejemplo n.º 50
0
 public override Task <QueueResultSegment> ListQueuesSegmentedAsync(string prefix, QueueListingDetails detailsIncluded, int?maxResults, QueueContinuationToken currentToken, QueueRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken)
 {
     throw new NotImplementedException();
     // return base.ListQueuesSegmentedAsync(prefix, detailsIncluded, maxResults, currentToken, options, operationContext, cancellationToken);
 }
Ejemplo n.º 51
0
        /// <summary>
        /// Returns a result segment containing a collection of queues
        /// whose names begin with the specified prefix.
        /// </summary>
        /// <param name="prefix">The queue name prefix.</param>
        /// <param name="detailsIncluded">A value that indicates whether to return queue 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 <c>null</c>, the maximum possible number of results will be returned, up to 5000.</param>
        /// <param name="currentToken">A <see cref="QueueContinuationToken"/> token returned by a previous listing operation.</param>
        /// <param name="operationContext">An <see cref="OperationContext"/> object that represents the context for the current operation.</param>
        /// <returns>A result segment of queues.</returns>
        public IAsyncOperation <QueueResultSegment> ListQueuesSegmentedAsync(string prefix, QueueListingDetails detailsIncluded, int?maxResults, QueueContinuationToken currentToken, OperationContext operationContext)
        {
            return(AsyncInfo.Run(async(token) =>
            {
                ResultSegment <CloudQueue> resultSegment = await Executor.ExecuteAsync(
                    this.ListQueuesImpl(prefix, detailsIncluded, currentToken, maxResults),
                    this.RetryPolicy,
                    operationContext,
                    token);

                return new QueueResultSegment(resultSegment.Results, (QueueContinuationToken)resultSegment.ContinuationToken);
            }));
        }
Ejemplo n.º 52
0
 public Task <QueueResultSegment> ListQueuesSegmentedAsync(string prefix, QueueListingDetails queueListingDetails, int?maxResults, QueueContinuationToken currentToken, QueueRequestOptions options, OperationContext operationContext)
 {
     return(this.ListQueuesSegmentedAsync(prefix, queueListingDetails, maxResults, currentToken, options, operationContext, CancellationToken.None));
 }
        /// <summary>
        /// Constructs a web request to return a listing of all queues in this storage account.
        /// </summary>
        /// <param name="uri">The absolute URI for the account.</param>
        /// <param name="timeout">The server timeout interval.</param>
        /// <param name="listingContext">A set of parameters for the listing operation.</param>
        /// <param name="detailsIncluded">Additional details to return with the listing.</param>
        /// <returns>A web request for the specified operation.</returns>
        public static HttpRequestMessage List(Uri uri, int? timeout, ListingContext listingContext, QueueListingDetails detailsIncluded, HttpContent content, OperationContext operationContext)
        {
            UriQueryBuilder builder = new UriQueryBuilder();
            builder.Add(Constants.QueryConstants.Component, "list");

            if (listingContext != null)
            {
                if (listingContext.Prefix != null)
                {
                    builder.Add("prefix", listingContext.Prefix);
                }

                if (listingContext.Marker != null)
                {
                    builder.Add("marker", listingContext.Marker);
                }

                if (listingContext.MaxResults != null)
                {
                    builder.Add("maxresults", listingContext.MaxResults.ToString());
                }
            }

            if ((detailsIncluded & QueueListingDetails.Metadata) != 0)
            {
                builder.Add("include", "metadata");
            }

            HttpRequestMessage request = HttpRequestMessageFactory.CreateRequestMessage(HttpMethod.Get, uri, timeout, builder, content, operationContext);
            return request;
        }
Ejemplo n.º 54
0
        /// <summary>
        /// Core implementation of the ListQueues method.
        /// </summary>
        /// <param name="prefix">A string containing the queue name prefix.</param>
        /// <param name="maxResults">A non-negative integer value that indicates the maximum number of results to be returned at a time, up to the
        /// per-operation limit of 5000. If this value is <c>null</c>, the maximum possible number of results will be returned, up to 5000.</param>
        /// <param name="queueListingDetails">A <see cref="QueueListingDetails"/> enumeration describing which items to include in the listing.</param>
        /// <param name="options">A <see cref="QueueRequestOptions"/> object that specifies additional options for the request.</param>
        /// <param name="currentToken">The continuation token.</param>
        /// <returns>A <see cref="RESTCommand{T}"/> that lists the queues.</returns>
        private RESTCommand <ResultSegment <CloudQueue> > ListQueuesImpl(string prefix, int?maxResults, QueueListingDetails queueListingDetails, QueueRequestOptions options, QueueContinuationToken currentToken)
        {
            QueueListingContext listingContext = new QueueListingContext(prefix, maxResults, queueListingDetails)
            {
                Marker = currentToken != null ? currentToken.NextMarker : null
            };

            RESTCommand <ResultSegment <CloudQueue> > getCmd = new RESTCommand <ResultSegment <CloudQueue> >(this.Credentials, this.StorageUri);

            options.ApplyToStorageCommand(getCmd);
            getCmd.CommandLocationMode    = CommonUtility.GetListingLocationMode(currentToken);
            getCmd.RetrieveResponseStream = true;
            getCmd.BuildRequestDelegate   = (uri, builder, serverTimeout, ctx) => QueueHttpWebRequestFactory.List(uri, serverTimeout, listingContext, queueListingDetails, ctx);
            getCmd.SignRequest            = this.AuthenticationHandler.SignRequest;
            getCmd.PreProcessResponse     = (cmd, resp, ex, ctx) => HttpResponseParsers.ProcessExpectedStatusCodeNoException(HttpStatusCode.OK, resp, null /* retVal */, cmd, ex);
            getCmd.PostProcessResponse    = (cmd, resp, ctx) =>
            {
                ListQueuesResponse listQueuesResponse = new ListQueuesResponse(cmd.ResponseStream);

                List <CloudQueue> queuesList = listQueuesResponse.Queues.Select(item => new CloudQueue(item.Name, this)).ToList();

                QueueContinuationToken continuationToken = null;
                if (listQueuesResponse.NextMarker != null)
                {
                    continuationToken = new QueueContinuationToken()
                    {
                        NextMarker     = listQueuesResponse.NextMarker,
                        TargetLocation = cmd.CurrentResult.TargetLocation,
                    };
                }

                return(new ResultSegment <CloudQueue>(queuesList)
                {
                    ContinuationToken = continuationToken,
                });
            };

            return(getCmd);
        }
        /// <summary>
        /// Core implementation for the ListQueues method.
        /// </summary>
        /// <param name="prefix">The queue 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 at a time, up to the
        /// per-operation limit of 5000. If this value is <c>null</c>, the maximum possible number of results will be returned, up to 5000.</param>
        /// <returns>A <see cref="TaskSequence"/> that lists the queues.</returns>
        private RESTCommand <ResultSegment <CloudQueue> > ListQueuesImpl(string prefix, int?maxResults, QueueListingDetails detailsIncluded, QueueRequestOptions options, QueueContinuationToken currentToken)
        {
            ListingContext listingContext = new ListingContext(prefix, maxResults)
            {
                Marker = currentToken != null ? currentToken.NextMarker : null
            };

            RESTCommand <ResultSegment <CloudQueue> > getCmd = new RESTCommand <ResultSegment <CloudQueue> >(this.Credentials, this.StorageUri, this.HttpClient);

            options.ApplyToStorageCommand(getCmd);
            getCmd.CommandLocationMode      = CommonUtility.GetListingLocationMode(currentToken);
            getCmd.RetrieveResponseStream   = true;
            getCmd.BuildRequest             = (cmd, uri, builder, cnt, serverTimeout, ctx) => QueueHttpRequestMessageFactory.List(uri, serverTimeout, listingContext, detailsIncluded, cnt, ctx, this.GetCanonicalizer(), this.Credentials);
            getCmd.PreProcessResponse       = (cmd, resp, ex, ctx) => HttpResponseParsers.ProcessExpectedStatusCodeNoException(HttpStatusCode.OK, resp, null /* retVal */, cmd, ex);
            getCmd.PostProcessResponseAsync = async(cmd, resp, ctx, ct) =>
            {
                ListQueuesResponse listQueuesResponse = await ListQueuesResponse.ParseAsync(cmd.ResponseStream, ct).ConfigureAwait(false);

                List <CloudQueue> queuesList = listQueuesResponse.Queues.Select(item => new CloudQueue(item.Metadata, item.Name, this)).ToList();

                QueueContinuationToken continuationToken = null;
                if (listQueuesResponse.NextMarker != null)
                {
                    continuationToken = new QueueContinuationToken()
                    {
                        NextMarker     = listQueuesResponse.NextMarker,
                        TargetLocation = cmd.CurrentResult.TargetLocation,
                    };
                }

                return(new ResultSegment <CloudQueue>(queuesList)
                {
                    ContinuationToken = continuationToken,
                });
            };

            return(getCmd);
        }