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     class ALIBABACLOUD_OSS_EXPORT UploadPartCopyRequest: public OssObjectRequest
28     {
29     public:
30         UploadPartCopyRequest(const std::string& bucket, const std::string& key);
31         UploadPartCopyRequest(const std::string& bucket, const std::string& key,
32                               const std::string& srcBucket, const std::string& srcKey);
33         UploadPartCopyRequest(const std::string& bucket, const std::string& key,
34                               const std::string& srcBucket, const std::string& srcKey,
35                               const std::string& uploadId, int partNumber);
36         UploadPartCopyRequest(const std::string& bucket, const std::string& key,
37                               const std::string& srcBucket, const std::string& srcKey,
38                               const std::string& uploadId, int partNumber,
39                               const std::string& sourceIfMatchETag,
40                               const std::string& sourceIfNotMatchETag,
41                               const std::string& sourceIfModifiedSince,
42                               const std::string& sourceIfUnModifiedSince);
43 
44         void setPartNumber(uint32_t partNumber);
45         void setUploadId(const std::string& uploadId);
46         void SetCopySource(const std::string& srcBucket, const std::string& srcKey);
47         void setCopySourceRange(uint64_t begin, uint64_t end);
48         void SetSourceIfMatchETag(const std::string& value);
49         void SetSourceIfNotMatchETag(const std::string& value);
50         void SetSourceIfModifiedSince(const std::string& value);
51         void SetSourceIfUnModifiedSince(const std::string& value);
52         void setTrafficLimit(uint64_t value);
53     protected:
54         virtual ParameterCollection specialParameters() const;
55         virtual HeaderCollection specialHeaders() const;
56         virtual int validate() const;
57     private:
58         std::string uploadId_;
59         std::string sourceBucket_;
60         std::string sourceKey_;
61         uint32_t partNumber_;
62         uint64_t sourceRange_[2];
63         bool sourceRangeIsSet_;
64         std::string sourceIfMatchETag_;
65         bool sourceIfMatchETagIsSet_;
66         std::string sourceIfNotMatchETag_;
67         bool sourceIfNotMatchETagIsSet_;
68         std::string sourceIfModifiedSince_;
69         bool sourceIfModifiedSinceIsSet_;
70         std::string sourceIfUnModifiedSince_;
71         bool sourceIfUnModifiedSinceIsSet_;
72         uint64_t trafficLimit_;
73     };
74 }
75 }
76