1 | /* |
2 | * Copyright 2010-2017 Amazon.com, Inc. or its affiliates. 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 | * A copy of the License is located at |
7 | * |
8 | * http://aws.amazon.com/apache2.0 |
9 | * |
10 | * or in the "license" file accompanying this file. This file is distributed |
11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either |
12 | * express or implied. See the License for the specific language governing |
13 | * permissions and limitations under the License. |
14 | */ |
15 | |
16 | #include <aws/s3/model/DeleteObjectRequest.h> |
17 | #include <aws/core/utils/xml/XmlSerializer.h> |
18 | #include <aws/core/utils/memory/stl/AWSStringStream.h> |
19 | #include <aws/core/http/URI.h> |
20 | #include <aws/core/utils/memory/stl/AWSStringStream.h> |
21 | |
22 | #include <utility> |
23 | |
24 | using namespace Aws::S3::Model; |
25 | using namespace Aws::Utils::Xml; |
26 | using namespace Aws::Utils; |
27 | using namespace Aws::Http; |
28 | |
29 | DeleteObjectRequest::DeleteObjectRequest() : |
30 | m_bucketHasBeenSet(false), |
31 | m_keyHasBeenSet(false), |
32 | m_mFAHasBeenSet(false), |
33 | m_versionIdHasBeenSet(false), |
34 | m_requestPayer(RequestPayer::NOT_SET), |
35 | m_requestPayerHasBeenSet(false), |
36 | m_bypassGovernanceRetention(false), |
37 | m_bypassGovernanceRetentionHasBeenSet(false), |
38 | m_customizedAccessLogTagHasBeenSet(false) |
39 | { |
40 | } |
41 | |
42 | Aws::String DeleteObjectRequest::SerializePayload() const |
43 | { |
44 | return {}; |
45 | } |
46 | |
47 | void DeleteObjectRequest::AddQueryStringParameters(URI& uri) const |
48 | { |
49 | Aws::StringStream ss; |
50 | if(m_versionIdHasBeenSet) |
51 | { |
52 | ss << m_versionId; |
53 | uri.AddQueryStringParameter("versionId" , ss.str()); |
54 | ss.str("" ); |
55 | } |
56 | |
57 | if(!m_customizedAccessLogTag.empty()) |
58 | { |
59 | // only accept customized LogTag which starts with "x-" |
60 | Aws::Map<Aws::String, Aws::String> collectedLogTags; |
61 | for(const auto& entry: m_customizedAccessLogTag) |
62 | { |
63 | if (!entry.first.empty() && !entry.second.empty() && entry.first.substr(0, 2) == "x-" ) |
64 | { |
65 | collectedLogTags.emplace(entry.first, entry.second); |
66 | } |
67 | } |
68 | |
69 | if (!collectedLogTags.empty()) |
70 | { |
71 | uri.AddQueryStringParameter(collectedLogTags); |
72 | } |
73 | } |
74 | } |
75 | |
76 | Aws::Http::HeaderValueCollection DeleteObjectRequest::() const |
77 | { |
78 | Aws::Http::HeaderValueCollection ; |
79 | Aws::StringStream ss; |
80 | if(m_mFAHasBeenSet) |
81 | { |
82 | ss << m_mFA; |
83 | headers.emplace("x-amz-mfa" , ss.str()); |
84 | ss.str("" ); |
85 | } |
86 | |
87 | if(m_requestPayerHasBeenSet) |
88 | { |
89 | headers.emplace("x-amz-request-payer" , RequestPayerMapper::GetNameForRequestPayer(m_requestPayer)); |
90 | } |
91 | |
92 | if(m_bypassGovernanceRetentionHasBeenSet) |
93 | { |
94 | ss << m_bypassGovernanceRetention; |
95 | headers.emplace("x-amz-bypass-governance-retention" , ss.str()); |
96 | ss.str("" ); |
97 | } |
98 | |
99 | return headers; |
100 | } |
101 | |