public static Task <bool> ScopeExistsAsync(this ICollectionManager manager, string scopeName, Action <ScopeExistsOptions> configureOptions) { var options = new ScopeExistsOptions(); configureOptions(options); return(manager.ScopeExistsAsync(scopeName, options)); }
public async Task <bool> ScopeExistsAsync(string scopeName, ScopeExistsOptions options) { var uri = GetUri(); Logger.LogInformation($"Attempting to verify if scope {scopeName} exists - {uri}"); try { // get all scopes var scopes = await GetAllScopesAsync(new GetAllScopesOptions { CancellationToken = options.CancellationToken }) .ConfigureAwait(false); // try find scope return(scopes.Any(scope => scope.Name == scopeName)); } catch (Exception exception) { Logger.LogError(exception, $"Failed to verify if scope {scopeName} exists - {uri}"); throw; } }