public static Task UpsertBucketAsync(this IBucketManager bucketManager, BucketSettings settings, Action <UpsertBucketOptions> configureOptions)
        {
            var options = new UpsertBucketOptions();

            configureOptions(options);

            return(bucketManager.UpsertBucketAsync(settings, options));
        }
        public async Task UpsertBucketAsync(BucketSettings settings, UpsertBucketOptions options)
        {
            var uri = GetUri(settings.Name);

            Logger.LogInformation($"Attempting to upsert bucket with name {settings.Name} - {uri}");

            try
            {
                // upsert bucket
                var content = new FormUrlEncodedContent(GetBucketSettingAsFormValues(settings));
                var result  = await _client.PostAsync(uri, content, options.CancellationToken).ConfigureAwait(false);

                result.EnsureSuccessStatusCode();
            }
            catch (Exception exception)
            {
                Logger.LogError(exception, $"Failed to upsert bucket with name {settings.Name} - {uri}");
                throw;
            }
        }