/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #pragma once #include #include #include #include namespace Aws { namespace Utils { namespace Xml { class XmlNode; } // namespace Xml } // namespace Utils namespace S3 { namespace Model { /** *

Specifies a cross-origin access rule for an Amazon S3 bucket.

See * Also:

AWS API * Reference

*/ class AWS_S3_API CORSRule { public: CORSRule(); CORSRule(const Aws::Utils::Xml::XmlNode& xmlNode); CORSRule& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); void AddToNode(Aws::Utils::Xml::XmlNode& parentNode) const; /** *

Unique identifier for the rule. The value cannot be longer than 255 * characters.

*/ inline const Aws::String& GetID() const{ return m_iD; } /** *

Unique identifier for the rule. The value cannot be longer than 255 * characters.

*/ inline bool IDHasBeenSet() const { return m_iDHasBeenSet; } /** *

Unique identifier for the rule. The value cannot be longer than 255 * characters.

*/ inline void SetID(const Aws::String& value) { m_iDHasBeenSet = true; m_iD = value; } /** *

Unique identifier for the rule. The value cannot be longer than 255 * characters.

*/ inline void SetID(Aws::String&& value) { m_iDHasBeenSet = true; m_iD = std::move(value); } /** *

Unique identifier for the rule. The value cannot be longer than 255 * characters.

*/ inline void SetID(const char* value) { m_iDHasBeenSet = true; m_iD.assign(value); } /** *

Unique identifier for the rule. The value cannot be longer than 255 * characters.

*/ inline CORSRule& WithID(const Aws::String& value) { SetID(value); return *this;} /** *

Unique identifier for the rule. The value cannot be longer than 255 * characters.

*/ inline CORSRule& WithID(Aws::String&& value) { SetID(std::move(value)); return *this;} /** *

Unique identifier for the rule. The value cannot be longer than 255 * characters.

*/ inline CORSRule& WithID(const char* value) { SetID(value); return *this;} /** *

Headers that are specified in the Access-Control-Request-Headers * header. These headers are allowed in a preflight OPTIONS request. In response to * any preflight OPTIONS request, Amazon S3 returns any requested headers that are * allowed.

*/ inline const Aws::Vector& GetAllowedHeaders() const{ return m_allowedHeaders; } /** *

Headers that are specified in the Access-Control-Request-Headers * header. These headers are allowed in a preflight OPTIONS request. In response to * any preflight OPTIONS request, Amazon S3 returns any requested headers that are * allowed.

*/ inline bool AllowedHeadersHasBeenSet() const { return m_allowedHeadersHasBeenSet; } /** *

Headers that are specified in the Access-Control-Request-Headers * header. These headers are allowed in a preflight OPTIONS request. In response to * any preflight OPTIONS request, Amazon S3 returns any requested headers that are * allowed.

*/ inline void SetAllowedHeaders(const Aws::Vector& value) { m_allowedHeadersHasBeenSet = true; m_allowedHeaders = value; } /** *

Headers that are specified in the Access-Control-Request-Headers * header. These headers are allowed in a preflight OPTIONS request. In response to * any preflight OPTIONS request, Amazon S3 returns any requested headers that are * allowed.

*/ inline void SetAllowedHeaders(Aws::Vector&& value) { m_allowedHeadersHasBeenSet = true; m_allowedHeaders = std::move(value); } /** *

Headers that are specified in the Access-Control-Request-Headers * header. These headers are allowed in a preflight OPTIONS request. In response to * any preflight OPTIONS request, Amazon S3 returns any requested headers that are * allowed.

*/ inline CORSRule& WithAllowedHeaders(const Aws::Vector& value) { SetAllowedHeaders(value); return *this;} /** *

Headers that are specified in the Access-Control-Request-Headers * header. These headers are allowed in a preflight OPTIONS request. In response to * any preflight OPTIONS request, Amazon S3 returns any requested headers that are * allowed.

*/ inline CORSRule& WithAllowedHeaders(Aws::Vector&& value) { SetAllowedHeaders(std::move(value)); return *this;} /** *

Headers that are specified in the Access-Control-Request-Headers * header. These headers are allowed in a preflight OPTIONS request. In response to * any preflight OPTIONS request, Amazon S3 returns any requested headers that are * allowed.

*/ inline CORSRule& AddAllowedHeaders(const Aws::String& value) { m_allowedHeadersHasBeenSet = true; m_allowedHeaders.push_back(value); return *this; } /** *

Headers that are specified in the Access-Control-Request-Headers * header. These headers are allowed in a preflight OPTIONS request. In response to * any preflight OPTIONS request, Amazon S3 returns any requested headers that are * allowed.

*/ inline CORSRule& AddAllowedHeaders(Aws::String&& value) { m_allowedHeadersHasBeenSet = true; m_allowedHeaders.push_back(std::move(value)); return *this; } /** *

Headers that are specified in the Access-Control-Request-Headers * header. These headers are allowed in a preflight OPTIONS request. In response to * any preflight OPTIONS request, Amazon S3 returns any requested headers that are * allowed.

*/ inline CORSRule& AddAllowedHeaders(const char* value) { m_allowedHeadersHasBeenSet = true; m_allowedHeaders.push_back(value); return *this; } /** *

An HTTP method that you allow the origin to execute. Valid values are * GET, PUT, HEAD, POST, and * DELETE.

*/ inline const Aws::Vector& GetAllowedMethods() const{ return m_allowedMethods; } /** *

An HTTP method that you allow the origin to execute. Valid values are * GET, PUT, HEAD, POST, and * DELETE.

*/ inline bool AllowedMethodsHasBeenSet() const { return m_allowedMethodsHasBeenSet; } /** *

An HTTP method that you allow the origin to execute. Valid values are * GET, PUT, HEAD, POST, and * DELETE.

*/ inline void SetAllowedMethods(const Aws::Vector& value) { m_allowedMethodsHasBeenSet = true; m_allowedMethods = value; } /** *

An HTTP method that you allow the origin to execute. Valid values are * GET, PUT, HEAD, POST, and * DELETE.

*/ inline void SetAllowedMethods(Aws::Vector&& value) { m_allowedMethodsHasBeenSet = true; m_allowedMethods = std::move(value); } /** *

An HTTP method that you allow the origin to execute. Valid values are * GET, PUT, HEAD, POST, and * DELETE.

*/ inline CORSRule& WithAllowedMethods(const Aws::Vector& value) { SetAllowedMethods(value); return *this;} /** *

An HTTP method that you allow the origin to execute. Valid values are * GET, PUT, HEAD, POST, and * DELETE.

*/ inline CORSRule& WithAllowedMethods(Aws::Vector&& value) { SetAllowedMethods(std::move(value)); return *this;} /** *

An HTTP method that you allow the origin to execute. Valid values are * GET, PUT, HEAD, POST, and * DELETE.

*/ inline CORSRule& AddAllowedMethods(const Aws::String& value) { m_allowedMethodsHasBeenSet = true; m_allowedMethods.push_back(value); return *this; } /** *

An HTTP method that you allow the origin to execute. Valid values are * GET, PUT, HEAD, POST, and * DELETE.

*/ inline CORSRule& AddAllowedMethods(Aws::String&& value) { m_allowedMethodsHasBeenSet = true; m_allowedMethods.push_back(std::move(value)); return *this; } /** *

An HTTP method that you allow the origin to execute. Valid values are * GET, PUT, HEAD, POST, and * DELETE.

*/ inline CORSRule& AddAllowedMethods(const char* value) { m_allowedMethodsHasBeenSet = true; m_allowedMethods.push_back(value); return *this; } /** *

One or more origins you want customers to be able to access the bucket * from.

*/ inline const Aws::Vector& GetAllowedOrigins() const{ return m_allowedOrigins; } /** *

One or more origins you want customers to be able to access the bucket * from.

*/ inline bool AllowedOriginsHasBeenSet() const { return m_allowedOriginsHasBeenSet; } /** *

One or more origins you want customers to be able to access the bucket * from.

*/ inline void SetAllowedOrigins(const Aws::Vector& value) { m_allowedOriginsHasBeenSet = true; m_allowedOrigins = value; } /** *

One or more origins you want customers to be able to access the bucket * from.

*/ inline void SetAllowedOrigins(Aws::Vector&& value) { m_allowedOriginsHasBeenSet = true; m_allowedOrigins = std::move(value); } /** *

One or more origins you want customers to be able to access the bucket * from.

*/ inline CORSRule& WithAllowedOrigins(const Aws::Vector& value) { SetAllowedOrigins(value); return *this;} /** *

One or more origins you want customers to be able to access the bucket * from.

*/ inline CORSRule& WithAllowedOrigins(Aws::Vector&& value) { SetAllowedOrigins(std::move(value)); return *this;} /** *

One or more origins you want customers to be able to access the bucket * from.

*/ inline CORSRule& AddAllowedOrigins(const Aws::String& value) { m_allowedOriginsHasBeenSet = true; m_allowedOrigins.push_back(value); return *this; } /** *

One or more origins you want customers to be able to access the bucket * from.

*/ inline CORSRule& AddAllowedOrigins(Aws::String&& value) { m_allowedOriginsHasBeenSet = true; m_allowedOrigins.push_back(std::move(value)); return *this; } /** *

One or more origins you want customers to be able to access the bucket * from.

*/ inline CORSRule& AddAllowedOrigins(const char* value) { m_allowedOriginsHasBeenSet = true; m_allowedOrigins.push_back(value); return *this; } /** *

One or more headers in the response that you want customers to be able to * access from their applications (for example, from a JavaScript * XMLHttpRequest object).

*/ inline const Aws::Vector& GetExposeHeaders() const{ return m_exposeHeaders; } /** *

One or more headers in the response that you want customers to be able to * access from their applications (for example, from a JavaScript * XMLHttpRequest object).

*/ inline bool ExposeHeadersHasBeenSet() const { return m_exposeHeadersHasBeenSet; } /** *

One or more headers in the response that you want customers to be able to * access from their applications (for example, from a JavaScript * XMLHttpRequest object).

*/ inline void SetExposeHeaders(const Aws::Vector& value) { m_exposeHeadersHasBeenSet = true; m_exposeHeaders = value; } /** *

One or more headers in the response that you want customers to be able to * access from their applications (for example, from a JavaScript * XMLHttpRequest object).

*/ inline void SetExposeHeaders(Aws::Vector&& value) { m_exposeHeadersHasBeenSet = true; m_exposeHeaders = std::move(value); } /** *

One or more headers in the response that you want customers to be able to * access from their applications (for example, from a JavaScript * XMLHttpRequest object).

*/ inline CORSRule& WithExposeHeaders(const Aws::Vector& value) { SetExposeHeaders(value); return *this;} /** *

One or more headers in the response that you want customers to be able to * access from their applications (for example, from a JavaScript * XMLHttpRequest object).

*/ inline CORSRule& WithExposeHeaders(Aws::Vector&& value) { SetExposeHeaders(std::move(value)); return *this;} /** *

One or more headers in the response that you want customers to be able to * access from their applications (for example, from a JavaScript * XMLHttpRequest object).

*/ inline CORSRule& AddExposeHeaders(const Aws::String& value) { m_exposeHeadersHasBeenSet = true; m_exposeHeaders.push_back(value); return *this; } /** *

One or more headers in the response that you want customers to be able to * access from their applications (for example, from a JavaScript * XMLHttpRequest object).

*/ inline CORSRule& AddExposeHeaders(Aws::String&& value) { m_exposeHeadersHasBeenSet = true; m_exposeHeaders.push_back(std::move(value)); return *this; } /** *

One or more headers in the response that you want customers to be able to * access from their applications (for example, from a JavaScript * XMLHttpRequest object).

*/ inline CORSRule& AddExposeHeaders(const char* value) { m_exposeHeadersHasBeenSet = true; m_exposeHeaders.push_back(value); return *this; } /** *

The time in seconds that your browser is to cache the preflight response for * the specified resource.

*/ inline int GetMaxAgeSeconds() const{ return m_maxAgeSeconds; } /** *

The time in seconds that your browser is to cache the preflight response for * the specified resource.

*/ inline bool MaxAgeSecondsHasBeenSet() const { return m_maxAgeSecondsHasBeenSet; } /** *

The time in seconds that your browser is to cache the preflight response for * the specified resource.

*/ inline void SetMaxAgeSeconds(int value) { m_maxAgeSecondsHasBeenSet = true; m_maxAgeSeconds = value; } /** *

The time in seconds that your browser is to cache the preflight response for * the specified resource.

*/ inline CORSRule& WithMaxAgeSeconds(int value) { SetMaxAgeSeconds(value); return *this;} private: Aws::String m_iD; bool m_iDHasBeenSet; Aws::Vector m_allowedHeaders; bool m_allowedHeadersHasBeenSet; Aws::Vector m_allowedMethods; bool m_allowedMethodsHasBeenSet; Aws::Vector m_allowedOrigins; bool m_allowedOriginsHasBeenSet; Aws::Vector m_exposeHeaders; bool m_exposeHeadersHasBeenSet; int m_maxAgeSeconds; bool m_maxAgeSecondsHasBeenSet; }; } // namespace Model } // namespace S3 } // namespace Aws