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#pragma once
17#include <aws/s3/S3_EXPORTS.h>
18#include <aws/core/utils/memory/stl/AWSVector.h>
19#include <aws/core/utils/memory/stl/AWSString.h>
20#include <utility>
21
22namespace Aws
23{
24namespace Utils
25{
26namespace Xml
27{
28 class XmlNode;
29} // namespace Xml
30} // namespace Utils
31namespace S3
32{
33namespace Model
34{
35
36 /**
37 * <p>Specifies a cross-origin access rule for an Amazon S3 bucket.</p><p><h3>See
38 * Also:</h3> <a
39 * href="http://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/CORSRule">AWS API
40 * Reference</a></p>
41 */
42 class AWS_S3_API CORSRule
43 {
44 public:
45 CORSRule();
46 CORSRule(const Aws::Utils::Xml::XmlNode& xmlNode);
47 CORSRule& operator=(const Aws::Utils::Xml::XmlNode& xmlNode);
48
49 void AddToNode(Aws::Utils::Xml::XmlNode& parentNode) const;
50
51
52 /**
53 * <p>Headers that are specified in the <code>Access-Control-Request-Headers</code>
54 * header. These headers are allowed in a preflight OPTIONS request. In response to
55 * any preflight OPTIONS request, Amazon S3 returns any requested headers that are
56 * allowed.</p>
57 */
58 inline const Aws::Vector<Aws::String>& GetAllowedHeaders() const{ return m_allowedHeaders; }
59
60 /**
61 * <p>Headers that are specified in the <code>Access-Control-Request-Headers</code>
62 * header. These headers are allowed in a preflight OPTIONS request. In response to
63 * any preflight OPTIONS request, Amazon S3 returns any requested headers that are
64 * allowed.</p>
65 */
66 inline bool AllowedHeadersHasBeenSet() const { return m_allowedHeadersHasBeenSet; }
67
68 /**
69 * <p>Headers that are specified in the <code>Access-Control-Request-Headers</code>
70 * header. These headers are allowed in a preflight OPTIONS request. In response to
71 * any preflight OPTIONS request, Amazon S3 returns any requested headers that are
72 * allowed.</p>
73 */
74 inline void SetAllowedHeaders(const Aws::Vector<Aws::String>& value) { m_allowedHeadersHasBeenSet = true; m_allowedHeaders = value; }
75
76 /**
77 * <p>Headers that are specified in the <code>Access-Control-Request-Headers</code>
78 * header. These headers are allowed in a preflight OPTIONS request. In response to
79 * any preflight OPTIONS request, Amazon S3 returns any requested headers that are
80 * allowed.</p>
81 */
82 inline void SetAllowedHeaders(Aws::Vector<Aws::String>&& value) { m_allowedHeadersHasBeenSet = true; m_allowedHeaders = std::move(value); }
83
84 /**
85 * <p>Headers that are specified in the <code>Access-Control-Request-Headers</code>
86 * header. These headers are allowed in a preflight OPTIONS request. In response to
87 * any preflight OPTIONS request, Amazon S3 returns any requested headers that are
88 * allowed.</p>
89 */
90 inline CORSRule& WithAllowedHeaders(const Aws::Vector<Aws::String>& value) { SetAllowedHeaders(value); return *this;}
91
92 /**
93 * <p>Headers that are specified in the <code>Access-Control-Request-Headers</code>
94 * header. These headers are allowed in a preflight OPTIONS request. In response to
95 * any preflight OPTIONS request, Amazon S3 returns any requested headers that are
96 * allowed.</p>
97 */
98 inline CORSRule& WithAllowedHeaders(Aws::Vector<Aws::String>&& value) { SetAllowedHeaders(std::move(value)); return *this;}
99
100 /**
101 * <p>Headers that are specified in the <code>Access-Control-Request-Headers</code>
102 * header. These headers are allowed in a preflight OPTIONS request. In response to
103 * any preflight OPTIONS request, Amazon S3 returns any requested headers that are
104 * allowed.</p>
105 */
106 inline CORSRule& AddAllowedHeaders(const Aws::String& value) { m_allowedHeadersHasBeenSet = true; m_allowedHeaders.push_back(value); return *this; }
107
108 /**
109 * <p>Headers that are specified in the <code>Access-Control-Request-Headers</code>
110 * header. These headers are allowed in a preflight OPTIONS request. In response to
111 * any preflight OPTIONS request, Amazon S3 returns any requested headers that are
112 * allowed.</p>
113 */
114 inline CORSRule& AddAllowedHeaders(Aws::String&& value) { m_allowedHeadersHasBeenSet = true; m_allowedHeaders.push_back(std::move(value)); return *this; }
115
116 /**
117 * <p>Headers that are specified in the <code>Access-Control-Request-Headers</code>
118 * header. These headers are allowed in a preflight OPTIONS request. In response to
119 * any preflight OPTIONS request, Amazon S3 returns any requested headers that are
120 * allowed.</p>
121 */
122 inline CORSRule& AddAllowedHeaders(const char* value) { m_allowedHeadersHasBeenSet = true; m_allowedHeaders.push_back(value); return *this; }
123
124
125 /**
126 * <p>An HTTP method that you allow the origin to execute. Valid values are
127 * <code>GET</code>, <code>PUT</code>, <code>HEAD</code>, <code>POST</code>, and
128 * <code>DELETE</code>.</p>
129 */
130 inline const Aws::Vector<Aws::String>& GetAllowedMethods() const{ return m_allowedMethods; }
131
132 /**
133 * <p>An HTTP method that you allow the origin to execute. Valid values are
134 * <code>GET</code>, <code>PUT</code>, <code>HEAD</code>, <code>POST</code>, and
135 * <code>DELETE</code>.</p>
136 */
137 inline bool AllowedMethodsHasBeenSet() const { return m_allowedMethodsHasBeenSet; }
138
139 /**
140 * <p>An HTTP method that you allow the origin to execute. Valid values are
141 * <code>GET</code>, <code>PUT</code>, <code>HEAD</code>, <code>POST</code>, and
142 * <code>DELETE</code>.</p>
143 */
144 inline void SetAllowedMethods(const Aws::Vector<Aws::String>& value) { m_allowedMethodsHasBeenSet = true; m_allowedMethods = value; }
145
146 /**
147 * <p>An HTTP method that you allow the origin to execute. Valid values are
148 * <code>GET</code>, <code>PUT</code>, <code>HEAD</code>, <code>POST</code>, and
149 * <code>DELETE</code>.</p>
150 */
151 inline void SetAllowedMethods(Aws::Vector<Aws::String>&& value) { m_allowedMethodsHasBeenSet = true; m_allowedMethods = std::move(value); }
152
153 /**
154 * <p>An HTTP method that you allow the origin to execute. Valid values are
155 * <code>GET</code>, <code>PUT</code>, <code>HEAD</code>, <code>POST</code>, and
156 * <code>DELETE</code>.</p>
157 */
158 inline CORSRule& WithAllowedMethods(const Aws::Vector<Aws::String>& value) { SetAllowedMethods(value); return *this;}
159
160 /**
161 * <p>An HTTP method that you allow the origin to execute. Valid values are
162 * <code>GET</code>, <code>PUT</code>, <code>HEAD</code>, <code>POST</code>, and
163 * <code>DELETE</code>.</p>
164 */
165 inline CORSRule& WithAllowedMethods(Aws::Vector<Aws::String>&& value) { SetAllowedMethods(std::move(value)); return *this;}
166
167 /**
168 * <p>An HTTP method that you allow the origin to execute. Valid values are
169 * <code>GET</code>, <code>PUT</code>, <code>HEAD</code>, <code>POST</code>, and
170 * <code>DELETE</code>.</p>
171 */
172 inline CORSRule& AddAllowedMethods(const Aws::String& value) { m_allowedMethodsHasBeenSet = true; m_allowedMethods.push_back(value); return *this; }
173
174 /**
175 * <p>An HTTP method that you allow the origin to execute. Valid values are
176 * <code>GET</code>, <code>PUT</code>, <code>HEAD</code>, <code>POST</code>, and
177 * <code>DELETE</code>.</p>
178 */
179 inline CORSRule& AddAllowedMethods(Aws::String&& value) { m_allowedMethodsHasBeenSet = true; m_allowedMethods.push_back(std::move(value)); return *this; }
180
181 /**
182 * <p>An HTTP method that you allow the origin to execute. Valid values are
183 * <code>GET</code>, <code>PUT</code>, <code>HEAD</code>, <code>POST</code>, and
184 * <code>DELETE</code>.</p>
185 */
186 inline CORSRule& AddAllowedMethods(const char* value) { m_allowedMethodsHasBeenSet = true; m_allowedMethods.push_back(value); return *this; }
187
188
189 /**
190 * <p>One or more origins you want customers to be able to access the bucket
191 * from.</p>
192 */
193 inline const Aws::Vector<Aws::String>& GetAllowedOrigins() const{ return m_allowedOrigins; }
194
195 /**
196 * <p>One or more origins you want customers to be able to access the bucket
197 * from.</p>
198 */
199 inline bool AllowedOriginsHasBeenSet() const { return m_allowedOriginsHasBeenSet; }
200
201 /**
202 * <p>One or more origins you want customers to be able to access the bucket
203 * from.</p>
204 */
205 inline void SetAllowedOrigins(const Aws::Vector<Aws::String>& value) { m_allowedOriginsHasBeenSet = true; m_allowedOrigins = value; }
206
207 /**
208 * <p>One or more origins you want customers to be able to access the bucket
209 * from.</p>
210 */
211 inline void SetAllowedOrigins(Aws::Vector<Aws::String>&& value) { m_allowedOriginsHasBeenSet = true; m_allowedOrigins = std::move(value); }
212
213 /**
214 * <p>One or more origins you want customers to be able to access the bucket
215 * from.</p>
216 */
217 inline CORSRule& WithAllowedOrigins(const Aws::Vector<Aws::String>& value) { SetAllowedOrigins(value); return *this;}
218
219 /**
220 * <p>One or more origins you want customers to be able to access the bucket
221 * from.</p>
222 */
223 inline CORSRule& WithAllowedOrigins(Aws::Vector<Aws::String>&& value) { SetAllowedOrigins(std::move(value)); return *this;}
224
225 /**
226 * <p>One or more origins you want customers to be able to access the bucket
227 * from.</p>
228 */
229 inline CORSRule& AddAllowedOrigins(const Aws::String& value) { m_allowedOriginsHasBeenSet = true; m_allowedOrigins.push_back(value); return *this; }
230
231 /**
232 * <p>One or more origins you want customers to be able to access the bucket
233 * from.</p>
234 */
235 inline CORSRule& AddAllowedOrigins(Aws::String&& value) { m_allowedOriginsHasBeenSet = true; m_allowedOrigins.push_back(std::move(value)); return *this; }
236
237 /**
238 * <p>One or more origins you want customers to be able to access the bucket
239 * from.</p>
240 */
241 inline CORSRule& AddAllowedOrigins(const char* value) { m_allowedOriginsHasBeenSet = true; m_allowedOrigins.push_back(value); return *this; }
242
243
244 /**
245 * <p>One or more headers in the response that you want customers to be able to
246 * access from their applications (for example, from a JavaScript
247 * <code>XMLHttpRequest</code> object).</p>
248 */
249 inline const Aws::Vector<Aws::String>& GetExposeHeaders() const{ return m_exposeHeaders; }
250
251 /**
252 * <p>One or more headers in the response that you want customers to be able to
253 * access from their applications (for example, from a JavaScript
254 * <code>XMLHttpRequest</code> object).</p>
255 */
256 inline bool ExposeHeadersHasBeenSet() const { return m_exposeHeadersHasBeenSet; }
257
258 /**
259 * <p>One or more headers in the response that you want customers to be able to
260 * access from their applications (for example, from a JavaScript
261 * <code>XMLHttpRequest</code> object).</p>
262 */
263 inline void SetExposeHeaders(const Aws::Vector<Aws::String>& value) { m_exposeHeadersHasBeenSet = true; m_exposeHeaders = value; }
264
265 /**
266 * <p>One or more headers in the response that you want customers to be able to
267 * access from their applications (for example, from a JavaScript
268 * <code>XMLHttpRequest</code> object).</p>
269 */
270 inline void SetExposeHeaders(Aws::Vector<Aws::String>&& value) { m_exposeHeadersHasBeenSet = true; m_exposeHeaders = std::move(value); }
271
272 /**
273 * <p>One or more headers in the response that you want customers to be able to
274 * access from their applications (for example, from a JavaScript
275 * <code>XMLHttpRequest</code> object).</p>
276 */
277 inline CORSRule& WithExposeHeaders(const Aws::Vector<Aws::String>& value) { SetExposeHeaders(value); return *this;}
278
279 /**
280 * <p>One or more headers in the response that you want customers to be able to
281 * access from their applications (for example, from a JavaScript
282 * <code>XMLHttpRequest</code> object).</p>
283 */
284 inline CORSRule& WithExposeHeaders(Aws::Vector<Aws::String>&& value) { SetExposeHeaders(std::move(value)); return *this;}
285
286 /**
287 * <p>One or more headers in the response that you want customers to be able to
288 * access from their applications (for example, from a JavaScript
289 * <code>XMLHttpRequest</code> object).</p>
290 */
291 inline CORSRule& AddExposeHeaders(const Aws::String& value) { m_exposeHeadersHasBeenSet = true; m_exposeHeaders.push_back(value); return *this; }
292
293 /**
294 * <p>One or more headers in the response that you want customers to be able to
295 * access from their applications (for example, from a JavaScript
296 * <code>XMLHttpRequest</code> object).</p>
297 */
298 inline CORSRule& AddExposeHeaders(Aws::String&& value) { m_exposeHeadersHasBeenSet = true; m_exposeHeaders.push_back(std::move(value)); return *this; }
299
300 /**
301 * <p>One or more headers in the response that you want customers to be able to
302 * access from their applications (for example, from a JavaScript
303 * <code>XMLHttpRequest</code> object).</p>
304 */
305 inline CORSRule& AddExposeHeaders(const char* value) { m_exposeHeadersHasBeenSet = true; m_exposeHeaders.push_back(value); return *this; }
306
307
308 /**
309 * <p>The time in seconds that your browser is to cache the preflight response for
310 * the specified resource.</p>
311 */
312 inline int GetMaxAgeSeconds() const{ return m_maxAgeSeconds; }
313
314 /**
315 * <p>The time in seconds that your browser is to cache the preflight response for
316 * the specified resource.</p>
317 */
318 inline bool MaxAgeSecondsHasBeenSet() const { return m_maxAgeSecondsHasBeenSet; }
319
320 /**
321 * <p>The time in seconds that your browser is to cache the preflight response for
322 * the specified resource.</p>
323 */
324 inline void SetMaxAgeSeconds(int value) { m_maxAgeSecondsHasBeenSet = true; m_maxAgeSeconds = value; }
325
326 /**
327 * <p>The time in seconds that your browser is to cache the preflight response for
328 * the specified resource.</p>
329 */
330 inline CORSRule& WithMaxAgeSeconds(int value) { SetMaxAgeSeconds(value); return *this;}
331
332 private:
333
334 Aws::Vector<Aws::String> m_allowedHeaders;
335 bool m_allowedHeadersHasBeenSet;
336
337 Aws::Vector<Aws::String> m_allowedMethods;
338 bool m_allowedMethodsHasBeenSet;
339
340 Aws::Vector<Aws::String> m_allowedOrigins;
341 bool m_allowedOriginsHasBeenSet;
342
343 Aws::Vector<Aws::String> m_exposeHeaders;
344 bool m_exposeHeadersHasBeenSet;
345
346 int m_maxAgeSeconds;
347 bool m_maxAgeSecondsHasBeenSet;
348 };
349
350} // namespace Model
351} // namespace S3
352} // namespace Aws
353