OCISDK/OCISDK/ObjectStorage/ObjectStorageClientAsync.cs
/// <summary>
/// Deletes a bucket if the bucket is already empty. 
/// If the bucket is not empty, use DeleteObject first. 
/// In addition, you cannot delete a bucket that has a multipart upload in progress or a pre-authenticated request associated with that bucket.
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
Deletes a bucket if the bucket is already empty.
If the bucket is not empty, use DeleteObject first.
In addition, you cannot delete a bucket that has a multipart upload in progress or a pre-authenticated request associated with that bucket.
Deletes a bucket if the bucket is already empty . If the bucket is not empty use DeleteObject first . In addition you cannot delete a bucket that has a multipart upload in progress or a pre - authenticated request associated with that bucket .
public async Task<DeleteBucketResponse> DeleteBucket(DeleteBucketRequest request)
        {
            var uri = new Uri(GetEndPointNoneVersion(ObjectStorageServices.Bucket(request.NamespaceName, request.BucketName), this.Region));
            using (var webResponse = await this.RestClientAsync.Delete(uri, new HttpRequestHeaderParam() { IfMatch = request.IfMatch }))
            using (var stream = webResponse.GetResponseStream())
            using (var reader = new StreamReader(stream))
            {
                var response = reader.ReadToEnd();
                return new DeleteBucketResponse()
                {
                    OpcRequestId = webResponse.Headers.Get("opc-request-id"),
                    OpcClientRequestId = webResponse.Headers.Get("opc-client-request-id")
                };
            }
        }
public async Task < DeleteBucketResponse > DeleteBucket ( DeleteBucketRequest request ) { var uri = new Uri ( GetEndPointNoneVersion ( ObjectStorageServices . Bucket ( request . NamespaceName , request . BucketName ) , this . Region ) ) ; using ( var webResponse = await this . RestClientAsync . Delete ( uri , new HttpRequestHeaderParam ( ) { IfMatch = request . IfMatch } ) ) using ( var stream = webResponse . GetResponseStream ( ) ) using ( var reader = new StreamReader ( stream ) ) { var response = reader . ReadToEnd ( ) ; return new DeleteBucketResponse ( ) { OpcRequestId = webResponse . Headers . Get ( " " ) , OpcClientRequestId = webResponse . Headers . Get ( " " ) } ; } }
Deletes a bucket if the bucket is already empty.
Deletes a bucket if the bucket is already empty .
None
request
DeleteBucketRequest
None