/// <summary> /// Sets the notification configuration for this bucket /// </summary> /// <param name="bucketName">Bucket name</param> /// <param name="notification">Notification object with configuration to be set on the server</param> /// <param name="cancellationToken">Optional cancellation token to cancel the operation</param> /// <returns></returns> public async Task SetBucketNotificationsAsync(string bucketName, BucketNotification notification, CancellationToken cancellationToken = default(CancellationToken)) { utils.ValidateBucketName(bucketName); var request = await this.CreateRequest(Method.PUT, bucketName).ConfigureAwait(false); request.AddQueryParameter("notification", ""); var bodyString = notification.ToString(); var body = System.Text.Encoding.UTF8.GetBytes(bodyString); request.AddParameter("application/xml", body, RestSharp.ParameterType.RequestBody); IRestResponse response = await this.ExecuteTaskAsync(this.NoErrorHandlers, request, cancellationToken).ConfigureAwait(false); }
/// <summary> /// Sets the notification configuration for this bucket /// </summary> /// <param name="bucketName">Bucket name</param> /// <param name="notification">Notification object with configuration to be set on the server</param> /// <param name="cancellationToken">Optional cancellation token to cancel the operation</param> /// <returns></returns> public async Task SetBucketNotificationsAsync(string bucketName, BucketNotification notification, CancellationToken cancellationToken = default(CancellationToken)) { utils.ValidateBucketName(bucketName); var request = await this.CreateRequest(HttpMethod.Put, bucketName) .ConfigureAwait(false); request.AddQueryParameter("notification", ""); var bodyString = notification.ToString(); request.AddXmlBody(bodyString); _ = await this.ExecuteTaskAsync(this.NoErrorHandlers, request, cancellationToken).ConfigureAwait(false); }