Exemple #1
0
        public async Task DropScopeAsync(string scopeName, DropScopeOptions options)
        {
            var uri = GetUri(scopeName);

            Logger.LogInformation($"Attempting drop scope {scopeName} - {uri}");

            try
            {
                // check scope exists
                var scopeExists =
                    await ScopeExistsAsync(scopeName, new ScopeExistsOptions { CancellationToken = options.CancellationToken })
                    .ConfigureAwait(false);

                if (!scopeExists)
                {
                    // throw not found
                    throw new ScopeNotFoundException(scopeName);
                }

                // drop scope
                var createResult = await _client.DeleteAsync(uri, options.CancellationToken).ConfigureAwait(false);

                createResult.EnsureSuccessStatusCode();
            }
            catch (Exception exception)
            {
                Logger.LogError(exception, $"Failed to drop scope {scopeName} - {uri}");
                throw;
            }
        }
Exemple #2
0
        public static Task DropScopeAsync(this ICollectionManager manager, string scopeName, Action <DropScopeOptions> configureOptions)
        {
            var options = new DropScopeOptions();

            configureOptions(options);

            return(manager.DropScopeAsync(scopeName, options));
        }
Exemple #3
0
        public async Task DropScopeAsync(string scopeName, DropScopeOptions options = null)
        {
            options ??= DropScopeOptions.Default;
            var uri = GetUri(scopeName);

            Logger.LogInformation($"Attempting drop scope {scopeName} - {uri}");

            try
            {
                // drop scope
                var createResult = await _client.DeleteAsync(uri, options.TokenValue).ConfigureAwait(false);

                createResult.EnsureSuccessStatusCode();
            }
            catch (Exception exception)
            {
                Logger.LogError(exception, $"Failed to drop scope {scopeName} - {uri}");
                throw;
            }
        }