OCISDK/OCISDK/ObjectStorage/ObjectStorageClientAsync.cs
/// <summary>
/// Efficiently checks to see if a bucket exists and gets the current entity tag (ETag) for the bucket.
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
Efficiently checks to see if a bucket exists and gets the current entity tag (ETag) for the bucket.
Efficiently checks to see if a bucket exists and gets the current entity tag ( ETag ) for the bucket .
public async Task<HeadBucketResponse> HeadBucket(HeadBucketRequest request)
        {
            var uri = new Uri($"{GetEndPointNoneVersion(ObjectStorageServices.Bucket(request.NamespaceName, request.BucketName), this.Region)}");
            var httpRequestHeaderParam = new HttpRequestHeaderParam()
            {
                IfMatch = request.IfMatch,
                IfNoneMatch = request.IfNoneMatch,
                OpcClientRequestId = request.OpcClientRequestId
            };
            using (var webResponse = await this.RestClientAsync.Head(uri, httpRequestHeaderParam))
            using (var stream = webResponse.GetResponseStream())
            using (var reader = new StreamReader(stream))
            {
                return new HeadBucketResponse()
                {
                    ETag = webResponse.Headers.Get("ETag"),
                    OpcRequestId = webResponse.Headers.Get("opc-request-id"),
                    OpcClientRequestId = webResponse.Headers.Get("opc-client-request-id")
                };
            }
        }
public async Task < HeadBucketResponse > HeadBucket ( HeadBucketRequest request ) { var uri = new Uri ( $" { GetEndPointNoneVersion ( ObjectStorageServices . Bucket ( request . NamespaceName , request . BucketName ) , this . Region ) } " ) ; var httpRequestHeaderParam = new HttpRequestHeaderParam ( ) { IfMatch = request . IfMatch , IfNoneMatch = request . IfNoneMatch , OpcClientRequestId = request . OpcClientRequestId } ; using ( var webResponse = await this . RestClientAsync . Head ( uri , httpRequestHeaderParam ) ) using ( var stream = webResponse . GetResponseStream ( ) ) using ( var reader = new StreamReader ( stream ) ) { return new HeadBucketResponse ( ) { ETag = webResponse . Headers . Get ( " " ) , OpcRequestId = webResponse . Headers . Get ( " " ) , OpcClientRequestId = webResponse . Headers . Get ( " " ) } ; } }
Efficiently checks to see if a bucket exists and gets the current entity tag (ETag) for the bucket.
Efficiently checks to see if a bucket exists and gets the current entity tag ( ETag ) for the bucket .
None
request
HeadBucketRequest
None