Exemplo n.º 1
0
        protected override IEnumerator <IAsyncResult> ListQueuesImpl(IAccountIdentifier identity, string account, string queuePrefix, string delimiter, string marker, int maxResults, TimeSpan?timeout, RequestContext requestContext, AsyncIteratorContext <IListQueuesResultCollection> context)
        {
            RemainingTime remainingTime = new RemainingTime(timeout);
            SASAuthorizationParameters sASAuthorizationParameter = new SASAuthorizationParameters()
            {
                SupportedSasTypes  = SasType.AccountSas,
                SignedResourceType = SasResourceType.Service,
                SignedPermission   = SASPermission.List
            };
            SASAuthorizationParameters sASAuthorizationParameter1 = sASAuthorizationParameter;
            IAsyncResult asyncResult = this.authorizationManager.BeginCheckAccess(identity, account, null, null, PermissionLevel.Read, sASAuthorizationParameter1, remainingTime, context.GetResumeCallback(), context.GetResumeState("QueueManager.ListQueuesImpl"));

            yield return(asyncResult);

            this.authorizationManager.EndCheckAccess(asyncResult);
            IStorageAccount storageAccount = this.storageManager.CreateAccountInstance(account);

            storageAccount.Timeout = remainingTime;
            asyncResult            = storageAccount.BeginListQueueContainers(queuePrefix, ContainerPropertyNames.ApplicationMetadata, delimiter, marker, null, maxResults, context.GetResumeCallback(), context.GetResumeState("QueueManager.ListQueuesImpl"));
            yield return(asyncResult);

            context.ResultData = new ListQueuesResult(storageAccount.EndListQueueContainers(asyncResult));
        }