예제 #1
0
        private IEnumerator <IAsyncResult> GetTableServiceStatsImpl(IAccountIdentifier identifier, string ownerAccountName, TimeSpan timeout, RequestContext requestContext, AsyncIteratorContext <GeoReplicationStats> context)
        {
            Duration startingNow = Duration.StartingNow;

            if (identifier == null)
            {
                throw new ArgumentNullException("identifier");
            }
            if (string.IsNullOrEmpty(ownerAccountName))
            {
                throw new ArgumentException("ownerAccountName", "Cannot be null");
            }
            if (timeout <= TimeSpan.Zero)
            {
                throw new TimeoutException("Timed out in GetTableServiceStats");
            }
            if (identifier is TableSignedAccessAccountIdentifier)
            {
                throw new NephosUnauthorizedAccessException("Signed access not supported for this request", AuthorizationFailureReason.InvalidOperationSAS);
            }
            SASAuthorizationParameters sASAuthorizationParameter = new SASAuthorizationParameters()
            {
                SupportedSasTypes  = SasType.AccountSas,
                SignedResourceType = SasResourceType.Service,
                SignedPermission   = SASPermission.Read
            };
            SASAuthorizationParameters sASAuthorizationParameter1 = sASAuthorizationParameter;
            IAsyncResult asyncResult = this.authorizationManager.BeginCheckAccess(identifier, ownerAccountName, null, null, PermissionLevel.Read | PermissionLevel.Owner, sASAuthorizationParameter1, timeout, context.GetResumeCallback(), context.GetResumeState("TableManager.GetTableServiceStatsImpl"));

            yield return(asyncResult);

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

            storageAccount.Timeout = timeout;
            AccountCondition accountCondition = new AccountCondition(false, false, storageAccount.LastModificationTime, null);

            asyncResult = storageAccount.BeginGetProperties(new AccountPropertyNames(AccountLevelPropertyNames.None, (AccountServiceMetadataPropertyNames)((long)536870912)), accountCondition, context.GetResumeCallback(), context.GetResumeState("TableManager.GetTableServicePropertiesImpl"));
            yield return(asyncResult);

            storageAccount.EndGetProperties(asyncResult);
            context.ResultData = storageAccount.ServiceMetadata.TableGeoReplicationStats;
        }
예제 #2
0
        protected override IEnumerator <IAsyncResult> GetQueueServicePropertiesImpl(IAccountIdentifier identifier, string ownerAccountName, TimeSpan timeout, RequestContext requestContext, AsyncIteratorContext <AnalyticsSettings> context)
        {
            Duration startingNow = Duration.StartingNow;

            if (identifier == null)
            {
                throw new ArgumentNullException("identifier");
            }
            if (string.IsNullOrEmpty(ownerAccountName))
            {
                throw new ArgumentException("ownerAccountName", "Cannot be null");
            }
            if (timeout <= TimeSpan.Zero)
            {
                throw new TimeoutException("Timed out in GetQueueServiceProperties");
            }
            SASAuthorizationParameters sASAuthorizationParameter = new SASAuthorizationParameters()
            {
                SupportedSasTypes  = SasType.AccountSas,
                SignedResourceType = SasResourceType.Service,
                SignedPermission   = SASPermission.Read
            };
            SASAuthorizationParameters sASAuthorizationParameter1 = sASAuthorizationParameter;
            IAsyncResult asyncResult = this.authorizationManager.BeginCheckAccess(identifier, ownerAccountName, null, null, PermissionLevel.Read | PermissionLevel.Owner, sASAuthorizationParameter1, timeout, context.GetResumeCallback(), context.GetResumeState("RealQueueManager.GetQueueServicePropertiesImpl"));

            yield return(asyncResult);

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

            storageAccount.Timeout = timeout;
            AccountCondition accountCondition = new AccountCondition(false, false, storageAccount.LastModificationTime, null);

            asyncResult = storageAccount.BeginGetProperties(new AccountPropertyNames(AccountLevelPropertyNames.None, (AccountServiceMetadataPropertyNames)((long)65536)), accountCondition, context.GetResumeCallback(), context.GetResumeState("RealQueueManager.GetQueueServicePropertiesImpl"));
            yield return(asyncResult);

            storageAccount.EndGetProperties(asyncResult);
            context.ResultData = storageAccount.ServiceMetadata.QueueAnalyticsSettings;
        }