1 /*
2  * Copyright 2009-2017 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 <alibabacloud/oss/Types.h>
21 #include <vector>
22 #include <map>
23 
24 namespace AlibabaCloud
25 {
26 namespace OSS
27 {
28     class ALIBABACLOUD_OSS_EXPORT GetObjectRequest: public OssObjectRequest
29     {
30     public:
31         GetObjectRequest(const std::string& bucket, const std::string& key);
32         GetObjectRequest(const std::string& bucket, const std::string& key,
33             const std::string& process);
34         GetObjectRequest(const std::string &bucket, const std::string &key,
35             const std::string &modifiedSince, const std::string &unmodifiedSince,
36             const std::vector<std::string> &matchingETags, const std::vector<std::string> &nonmatchingETags,
37             const std::map<std::string, std::string> &responseHeaderParameters_);
38         void setRange(int64_t start, int64_t end);
39         void setRange(int64_t start, int64_t end, bool standard);
40         void setModifiedSinceConstraint(const std::string& gmt);
41         void setUnmodifiedSinceConstraint(const std::string& gmt);
42         void setMatchingETagConstraints(const std::vector<std::string>& match);
43         void addMatchingETagConstraint(const std::string& match);
44         void setNonmatchingETagConstraints(const std::vector<std::string>& match);
45         void addNonmatchingETagConstraint(const std::string& match);
46         void setProcess(const std::string& process);
47         void addResponseHeaders(RequestResponseHeader header, const std::string& value);
48         void setTrafficLimit(uint64_t value);
49         void setUserAgent(const std::string& ua);
50 
51         std::pair<int64_t, int64_t> Range() const;
52     protected:
53         virtual HeaderCollection specialHeaders() const ;
54         virtual ParameterCollection specialParameters() const;
55         virtual int validate() const;
56     private:
57         int64_t range_[2];
58         bool rangeIsSet_;
59         std::string modifiedSince_;
60         std::string unmodifiedSince_;
61         std::vector<std::string> matchingETags_;
62         std::vector<std::string> nonmatchingETags_;
63         std::string process_;
64         std::map<std::string, std::string> responseHeaderParameters_;
65         uint64_t trafficLimit_;
66         bool rangeIsStandardMode_;
67         std::string userAgent_;
68     };
69 }
70 }
71