/// <summary> /// Returns current policy stored on the server for this bucket /// </summary> /// <param name="bucketName">Bucket name.</param> /// <param name="cancellationToken">Optional cancellation token to cancel the operation</param> /// <returns>Task that returns the Bucket policy as a json string</returns> public async Task <string> GetPolicyAsync(string bucketName, CancellationToken cancellationToken = default(CancellationToken)) { GetPolicyArgs args = new GetPolicyArgs() .WithBucket(bucketName); return(await this.GetPolicyAsync(args, cancellationToken)); }
/// <summary> /// Returns current policy stored on the server for this bucket /// </summary> /// <param name="args">GetPolicyArgs object has information like Bucket name.</param> /// <param name="cancellationToken">Optional cancellation token to cancel the operation</param> /// <returns>Task that returns the Bucket policy as a json string</returns> /// <exception cref="InvalidBucketNameException">When bucketName is invalid</exception> /// <exception cref="UnexpectedMinioException">When a policy is not set</exception> public async Task <string> GetPolicyAsync(GetPolicyArgs args, CancellationToken cancellationToken = default(CancellationToken)) { RestRequest request = await this.CreateRequest(args).ConfigureAwait(false); IRestResponse response = await this.ExecuteTaskAsync(this.NoErrorHandlers, request, cancellationToken).ConfigureAwait(false); GetPolicyResponse getPolicyResponse = new GetPolicyResponse(response.StatusCode, response.Content); return(getPolicyResponse.PolicyJsonString); }