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
18 #include <alibabacloud/oss/model/GetObjectResult.h>
19 #include <alibabacloud/oss/http/HttpType.h>
20 #include "utils/Utils.h"
21
22 using namespace AlibabaCloud::OSS;
23
GetObjectResult()24 GetObjectResult::GetObjectResult() :
25 OssObjectResult()
26 {
27 }
28
GetObjectResult(const std::string & bucket,const std::string & key,const std::shared_ptr<std::iostream> & content,const HeaderCollection & headers)29 GetObjectResult::GetObjectResult(
30 const std::string &bucket,
31 const std::string &key,
32 const std::shared_ptr<std::iostream> &content,
33 const HeaderCollection &headers):
34 OssObjectResult(headers),
35 bucket_(bucket),
36 key_(key),
37 content_(content)
38 {
39 metaData_ = headers;
40 std::string etag = metaData_.HttpMetaData()[Http::ETAG];
41 metaData_.HttpMetaData()[Http::ETAG] = TrimQuotes(etag.c_str());
42 }
43
GetObjectResult(const std::string & bucket,const std::string & key,const ObjectMetaData & metaData)44 GetObjectResult::GetObjectResult(
45 const std::string& bucket, const std::string& key,
46 const ObjectMetaData& metaData) :
47 bucket_(bucket),
48 key_(key)
49 {
50 metaData_ = metaData;
51 requestId_ = metaData_.HttpMetaData()["x-oss-request-id"];
52 versionId_ = metaData_.HttpMetaData()["x-oss-version-id"];
53 }