public McrStatusClient(HttpClient httpClient, string tenant, string clientId, string clientSecret, ILoggerService loggerService) { if (loggerService is null) { throw new ArgumentNullException(nameof(loggerService)); } this.httpClient = httpClient ?? throw new ArgumentNullException(nameof(httpClient)); this.tenant = tenant ?? throw new ArgumentNullException(nameof(tenant)); this.clientId = clientId ?? throw new ArgumentNullException(nameof(clientId)); this.clientSecret = clientSecret ?? throw new ArgumentNullException(nameof(clientSecret)); this.httpPolicy = HttpPolicyBuilder.Create() .WithMeteredRetryPolicy(loggerService) .WithRefreshAccessTokenPolicy(this.RefreshAccessTokenAsync, loggerService) .WithNotFoundRetryPolicy(TimeSpan.FromHours(1), TimeSpan.FromSeconds(10), loggerService) .Build(); }
private AcrClient(HttpClient httpClient, string acrName, string tenant, string aadAccessToken, ILoggerService loggerService) { _httpClient = httpClient; _acrName = acrName; _tenant = tenant; _aadAccessToken = aadAccessToken; _baseUrl = $"https://{acrName}"; _acrV1BaseUrl = $"{_baseUrl}/acr/v1"; _acrV2BaseUrl = $"{_baseUrl}/v2"; _acrRefreshToken = new AsyncLockedValue <string>(semaphore: _sharedSemaphore); _acrAccessToken = new AsyncLockedValue <string>(semaphore: _sharedSemaphore); _httpPolicy = HttpPolicyBuilder.Create() .WithMeteredRetryPolicy(loggerService) .WithRefreshAccessTokenPolicy(GetAcrRefreshTokenAsync, loggerService) .Build(); }