Exemple #1
0
        public static Task UpsertAsync(this IBucketManager bucketManager, BucketSettings settings, Action <UpsertBucketOptions> configureOptions)
        {
            var options = new UpsertBucketOptions();

            configureOptions(options);

            return(bucketManager.UpsertAsync(settings, options));
        }
Exemple #2
0
        public async Task UpsertAsync(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;
            }
        }