OCISDK/OCISDK/ObjectStorage/ObjectStorageClientAsync.cs
/// <summary>
/// Gets the current representation of the given bucket in the given Object Storage namespace.
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
Gets the current representation of the given bucket in the given Object Storage namespace.
Gets the current representation of the given bucket in the given Object Storage namespace .
public async Task<GetBucketResponse> GetBucket(GetBucketRequest request)
        {
            var uri = new Uri($"{GetEndPointNoneVersion(ObjectStorageServices.Bucket(request.NamespaceName), this.Region)}/{request.BucketName}/");
            var httpRequestHeaderParam = new HttpRequestHeaderParam() {
                IfMatch = request.IfMatch,
                IfNoneMatch = request.IfNoneMatch,
                OpcClientRequestId = request.OpcClientRequestId
            };
            using (var webResponse = await this.RestClientAsync.Get(uri, httpRequestHeaderParam, request.Fields))
            using (var stream = webResponse.GetResponseStream())
            using (var reader = new StreamReader(stream))
            {
                var response = reader.ReadToEnd();
                return new GetBucketResponse()
                {
                    Bucket = JsonSerializer.Deserialize<Bucket>(response),
                    ETag = webResponse.Headers.Get("ETag"),
                    OpcRequestId = webResponse.Headers.Get("opc-request-id"),
                    OpcClientRequestId = webResponse.Headers.Get("opc-client-request-id")
                };
            }
        }
public async Task < GetBucketResponse > GetBucket ( GetBucketRequest request ) { var uri = new Uri ( $" { GetEndPointNoneVersion ( ObjectStorageServices . Bucket ( request . NamespaceName ) , this . Region ) } / { request . BucketName } / " ) ; var httpRequestHeaderParam = new HttpRequestHeaderParam ( ) { IfMatch = request . IfMatch , IfNoneMatch = request . IfNoneMatch , OpcClientRequestId = request . OpcClientRequestId } ; using ( var webResponse = await this . RestClientAsync . Get ( uri , httpRequestHeaderParam , request . Fields ) ) using ( var stream = webResponse . GetResponseStream ( ) ) using ( var reader = new StreamReader ( stream ) ) { var response = reader . ReadToEnd ( ) ; return new GetBucketResponse ( ) { Bucket = JsonSerializer . Deserialize < Bucket > ( response ) , ETag = webResponse . Headers . Get ( " " ) , OpcRequestId = webResponse . Headers . Get ( " " ) , OpcClientRequestId = webResponse . Headers . Get ( " " ) } ; } }
Gets the current representation of the given bucket in the given Object Storage namespace.
Gets the current representation of the given bucket in the given Object Storage namespace .
None
request
GetBucketRequest
None