Esempio n. 1
0
        public static async Task <QuotaOperationResult> AcquireQuotaAsync(
            string engagementAccount,
            string quotaName,
            int required)
        {
            Validator.ArgumentNotNullOrEmpty(engagementAccount, nameof(engagementAccount));
            Validator.ArgumentNotNullOrEmpty(quotaName, nameof(quotaName));

            EnsureService();

            var result = await service.AcquireQuotaAsync(
                engagementAccount,
                quotaName,
                required);

            if (result.Status != HttpStatusCode.OK)
            {
                throw new QuotaExceededException(
                          engagementAccount,
                          quotaName,
                          result.Remaining);
            }

            return(result);
        }