Пример #1
0
        /// <summary>
        /// Sets the current bucket policy
        /// </summary>
        /// <param name="bucketName">Bucket Name</param>
        /// <param name="policyJson">Policy json as string </param>
        /// <param name="cancellationToken">Optional cancellation token to cancel the operation</param>
        /// <returns>Task to set a policy</returns>
        public async Task SetPolicyAsync(string bucketName, string policyJson, CancellationToken cancellationToken = default(CancellationToken))
        {
            SetPolicyArgs args = new SetPolicyArgs()
                                 .WithBucket(bucketName)
                                 .WithPolicy(policyJson);

            await this.SetPolicyAsync(args, cancellationToken);
        }
Пример #2
0
        /// <summary>
        /// Sets the current bucket policy
        /// </summary>
        /// <param name="args">SetPolicyArgs object has information like Bucket name and the policy to set in Json format</param>
        /// <param name="cancellationToken">Optional cancellation token to cancel the operation</param>
        /// <returns>Task to set a policy</returns>
        public async Task SetPolicyAsync(SetPolicyArgs args, CancellationToken cancellationToken = default(CancellationToken))
        {
            RestRequest request = await this.CreateRequest(args).ConfigureAwait(false);

            await this.ExecuteTaskAsync(this.NoErrorHandlers, request, cancellationToken).ConfigureAwait(false);
        }