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 #include <alibabacloud/oss/model/SetObjectAclRequest.h>
18 #include <alibabacloud/oss/http/HttpType.h>
19 #include "utils/Utils.h"
20 using namespace AlibabaCloud::OSS;
21
SetObjectAclRequest(const std::string & bucket,const std::string & key)22 SetObjectAclRequest::SetObjectAclRequest(const std::string &bucket, const std::string &key) :
23 OssObjectRequest(bucket,key),
24 hasSetAcl_(false)
25 {
26 }
27
SetObjectAclRequest(const std::string & bucket,const std::string & key,CannedAccessControlList acl)28 SetObjectAclRequest::SetObjectAclRequest(const std::string &bucket
29 ,const std::string &key, CannedAccessControlList acl) :
30 OssObjectRequest(bucket,key),
31 acl_(acl),
32 hasSetAcl_(true)
33 {
34 }
35
36
setAcl(CannedAccessControlList acl)37 void SetObjectAclRequest::setAcl(CannedAccessControlList acl)
38 {
39 acl_ = acl;
40 hasSetAcl_ = true;
41 }
42
specialHeaders() const43 HeaderCollection SetObjectAclRequest::specialHeaders() const
44 {
45 auto headers = OssObjectRequest::specialHeaders();
46 if (hasSetAcl_) {
47 headers["x-oss-object-acl"] = ToAclName(acl_);
48 }
49 return headers;
50 }
51
specialParameters() const52 ParameterCollection SetObjectAclRequest::specialParameters() const
53 {
54 auto parameters = OssObjectRequest::specialParameters();
55 parameters["acl"] = "";
56 return parameters;
57 }
58
59
60
61
62