OCISDK/OCISDK/ObjectStorage/ObjectStorageClientAsync.cs
/// <summary>
/// Uploads a single part of a multipart upload.
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
Uploads a single part of a multipart upload.
Uploads a single part of a multipart upload .
public async Task<UploadPartResponse> UploadPart(UploadPartRequest request)
        {
            var uri = new Uri(
                $"{GetEndPointNoneVersion(ObjectStorageServices.Bucket(request.NamespaceName, request.BucketName), this.Region)}/u/{request.ObjectName}?" +
                $"uploadId={request.UploadId}&uploadPartNum={request.UploadPartNum}");
            HttpRequestHeaderParam HttpRequestHeaderParam = new HttpRequestHeaderParam()
            {
                IfMatch = request.IfMatch,
                OpcClientRequestId = request.OpcClientRequestId
            };
            using (var webResponse = await this.RestClientAsync.Put(uri, request.UploadPartBody, HttpRequestHeaderParam))
            using (var stream = webResponse.GetResponseStream())
            using (var reader = new StreamReader(stream))
            {
                var response = reader.ReadToEnd();
                return new UploadPartResponse()
                {
                    ETag = webResponse.Headers.Get("ETag"),
                    OpcRequestId = webResponse.Headers.Get("opc-request-id"),
                    OpcClientRequestId = webResponse.Headers.Get("opc-client-request-id"),
                    OpcContentMd5 = webResponse.Headers.Get("opc-content-md5")
                };
            }
        }
public async Task < UploadPartResponse > UploadPart ( UploadPartRequest request ) { var uri = new Uri ( $" { GetEndPointNoneVersion ( ObjectStorageServices . Bucket ( request . NamespaceName , request . BucketName ) , this . Region ) } /u/ { request . ObjectName } ? " + $" uploadId= { request . UploadId } &uploadPartNum= { request . UploadPartNum } " ) ; HttpRequestHeaderParam HttpRequestHeaderParam = new HttpRequestHeaderParam ( ) { IfMatch = request . IfMatch , OpcClientRequestId = request . OpcClientRequestId } ; using ( var webResponse = await this . RestClientAsync . Put ( uri , request . UploadPartBody , HttpRequestHeaderParam ) ) using ( var stream = webResponse . GetResponseStream ( ) ) using ( var reader = new StreamReader ( stream ) ) { var response = reader . ReadToEnd ( ) ; return new UploadPartResponse ( ) { ETag = webResponse . Headers . Get ( " " ) , OpcRequestId = webResponse . Headers . Get ( " " ) , OpcClientRequestId = webResponse . Headers . Get ( " " ) , OpcContentMd5 = webResponse . Headers . Get ( " " ) } ; } }
Uploads a single part of a multipart upload.
Uploads a single part of a multipart upload .
None
request
UploadPartRequest
None