1 /* 2 * Copyright 2009-2018 Alibaba Cloud All rights reserved. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #pragma once 18 #include <alibabacloud/oss/Export.h> 19 #include <alibabacloud/oss/OssRequest.h> 20 #include <sstream> 21 #include <iostream> 22 23 namespace AlibabaCloud 24 { 25 namespace OSS 26 { 27 28 class ALIBABACLOUD_OSS_EXPORT UploadPartRequest: public OssObjectRequest 29 { 30 public: 31 UploadPartRequest(const std::string& bucket, const std::string& key, 32 const std::shared_ptr<std::iostream>& content); 33 UploadPartRequest(const std::string &bucket, const std::string& key, 34 int partNumber, const std::string& uploadId, 35 const std::shared_ptr<std::iostream>& content); 36 virtual std::shared_ptr<std::iostream> Body() const; 37 void setPartNumber(int partNumber); 38 void setUploadId(const std::string& uploadId); 39 void setConetent(const std::shared_ptr<std::iostream>& content); 40 void setContentLength(uint64_t length); 41 void setTrafficLimit(uint64_t value); 42 void setUserAgent(const std::string& ua); 43 int PartNumber() const; 44 protected: 45 virtual HeaderCollection specialHeaders() const; 46 virtual ParameterCollection specialParameters() const; 47 virtual int validate() const; 48 private: 49 int partNumber_; 50 std::string uploadId_; 51 std::shared_ptr<std::iostream> content_; 52 uint64_t contentLength_; 53 bool contentLengthIsSet_; 54 uint64_t trafficLimit_; 55 std::string userAgent_; 56 }; 57 } 58 } 59