Example #1
0
        protected override IEnumerator <IAsyncResult> SetQueueMetadataImpl(IAccountIdentifier identity, string account, string queue, NameValueCollection metadata, TimeSpan?timeout, RequestContext requestContext, AsyncIteratorContext <NoResults> context)
        {
            RemainingTime remainingTime = new RemainingTime(timeout);
            SASAuthorizationParameters sASAuthorizationParameter = new SASAuthorizationParameters()
            {
                SupportedSasTypes  = SasType.AccountSas,
                SignedResourceType = SasResourceType.Container,
                SignedPermission   = SASPermission.Write
            };
            SASAuthorizationParameters sASAuthorizationParameter1 = sASAuthorizationParameter;
            IAsyncResult asyncResult = this.BeginGetQueue(identity, account, queue, PermissionLevel.Write, sASAuthorizationParameter1, remainingTime, requestContext, context.GetResumeCallback(), context.GetResumeState("QueueManager.SetQueueMetadataImpl"));

            yield return(asyncResult);

            IQueueContainer operationStatus = this.EndGetQueue(asyncResult);

            if (requestContext != null)
            {
                operationStatus.OperationStatus = requestContext.OperationStatus;
            }
            operationStatus.ApplicationMetadata = QueueHelpers.SerializeMetadata(metadata);
            operationStatus.Timeout             = remainingTime;
            asyncResult = operationStatus.BeginSetProperties(ContainerPropertyNames.ApplicationMetadata, null, context.GetResumeCallback(), context.GetResumeState("QueueManager.SetQueueMetadataImpl"));
            yield return(asyncResult);

            operationStatus.EndSetProperties(asyncResult);
        }
Example #2
0
        protected override IEnumerator <IAsyncResult> SetQueueAclImpl(IAccountIdentifier identifier, string account, string queue, ContainerAclSettings acl, TimeSpan timeout, RequestContext requestContext, AsyncIteratorContext <NoResults> context)
        {
            byte[]   numArray;
            Duration startingNow = Duration.StartingNow;

            if (identifier == null)
            {
                throw new ArgumentNullException("identifier");
            }
            if (string.IsNullOrEmpty(account))
            {
                throw new ArgumentException("account", "Cannot be null or empty");
            }
            if (string.IsNullOrEmpty(queue))
            {
                throw new ArgumentException("queue", "Cannot be null or empty");
            }
            if (acl == null)
            {
                throw new ArgumentNullException("acl");
            }
            if (acl.SASIdentifiers == null)
            {
                throw new ArgumentNullException("sasidentifiers");
            }
            if (timeout <= TimeSpan.Zero)
            {
                throw new TimeoutException("Timed out in SetQueueAcl");
            }
            RemainingTime remainingTime = new RemainingTime(timeout);
            IAsyncResult  asyncResult   = this.BeginGetQueue(identifier, account, queue, PermissionLevel.WriteAcl, remainingTime, requestContext, context.GetResumeCallback(), context.GetResumeState("QueueManager.SetQueueAclImpl"));

            yield return(asyncResult);

            IQueueContainer operationStatus = this.EndGetQueue(asyncResult);

            if (requestContext != null)
            {
                operationStatus.OperationStatus = requestContext.OperationStatus;
            }
            acl.EncodeToServiceMetadata(out numArray);
            operationStatus.ServiceMetadata = numArray;
            operationStatus.Timeout         = remainingTime;
            asyncResult = operationStatus.BeginSetProperties(ContainerPropertyNames.ServiceMetadata, null, context.GetResumeCallback(), context.GetResumeState("QueueManager.SetQueueAclImpl"));
            yield return(asyncResult);

            operationStatus.EndSetProperties(asyncResult);
        }