/** * 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 Json { class JsonValue; class JsonView; } // namespace Json } // namespace Utils namespace Lambda { namespace Model { /** *

The cross-origin * resource sharing (CORS) settings for your Lambda function URL. Use CORS to * grant access to your function URL from any origin. You can also use CORS to * control access for specific HTTP headers and methods in requests to your * function URL.

See Also:

AWS API * Reference

*/ class Cors { public: AWS_LAMBDA_API Cors(); AWS_LAMBDA_API Cors(Aws::Utils::Json::JsonView jsonValue); AWS_LAMBDA_API Cors& operator=(Aws::Utils::Json::JsonView jsonValue); AWS_LAMBDA_API Aws::Utils::Json::JsonValue Jsonize() const; /** *

Whether to allow cookies or other credentials in requests to your function * URL. The default is false.

*/ inline bool GetAllowCredentials() const{ return m_allowCredentials; } /** *

Whether to allow cookies or other credentials in requests to your function * URL. The default is false.

*/ inline bool AllowCredentialsHasBeenSet() const { return m_allowCredentialsHasBeenSet; } /** *

Whether to allow cookies or other credentials in requests to your function * URL. The default is false.

*/ inline void SetAllowCredentials(bool value) { m_allowCredentialsHasBeenSet = true; m_allowCredentials = value; } /** *

Whether to allow cookies or other credentials in requests to your function * URL. The default is false.

*/ inline Cors& WithAllowCredentials(bool value) { SetAllowCredentials(value); return *this;} /** *

The HTTP headers that origins can include in requests to your function URL. * For example: Date, Keep-Alive, * X-Custom-Header.

*/ inline const Aws::Vector& GetAllowHeaders() const{ return m_allowHeaders; } /** *

The HTTP headers that origins can include in requests to your function URL. * For example: Date, Keep-Alive, * X-Custom-Header.

*/ inline bool AllowHeadersHasBeenSet() const { return m_allowHeadersHasBeenSet; } /** *

The HTTP headers that origins can include in requests to your function URL. * For example: Date, Keep-Alive, * X-Custom-Header.

*/ inline void SetAllowHeaders(const Aws::Vector& value) { m_allowHeadersHasBeenSet = true; m_allowHeaders = value; } /** *

The HTTP headers that origins can include in requests to your function URL. * For example: Date, Keep-Alive, * X-Custom-Header.

*/ inline void SetAllowHeaders(Aws::Vector&& value) { m_allowHeadersHasBeenSet = true; m_allowHeaders = std::move(value); } /** *

The HTTP headers that origins can include in requests to your function URL. * For example: Date, Keep-Alive, * X-Custom-Header.

*/ inline Cors& WithAllowHeaders(const Aws::Vector& value) { SetAllowHeaders(value); return *this;} /** *

The HTTP headers that origins can include in requests to your function URL. * For example: Date, Keep-Alive, * X-Custom-Header.

*/ inline Cors& WithAllowHeaders(Aws::Vector&& value) { SetAllowHeaders(std::move(value)); return *this;} /** *

The HTTP headers that origins can include in requests to your function URL. * For example: Date, Keep-Alive, * X-Custom-Header.

*/ inline Cors& AddAllowHeaders(const Aws::String& value) { m_allowHeadersHasBeenSet = true; m_allowHeaders.push_back(value); return *this; } /** *

The HTTP headers that origins can include in requests to your function URL. * For example: Date, Keep-Alive, * X-Custom-Header.

*/ inline Cors& AddAllowHeaders(Aws::String&& value) { m_allowHeadersHasBeenSet = true; m_allowHeaders.push_back(std::move(value)); return *this; } /** *

The HTTP headers that origins can include in requests to your function URL. * For example: Date, Keep-Alive, * X-Custom-Header.

*/ inline Cors& AddAllowHeaders(const char* value) { m_allowHeadersHasBeenSet = true; m_allowHeaders.push_back(value); return *this; } /** *

The HTTP methods that are allowed when calling your function URL. For * example: GET, POST, DELETE, or the * wildcard character (*).

*/ inline const Aws::Vector& GetAllowMethods() const{ return m_allowMethods; } /** *

The HTTP methods that are allowed when calling your function URL. For * example: GET, POST, DELETE, or the * wildcard character (*).

*/ inline bool AllowMethodsHasBeenSet() const { return m_allowMethodsHasBeenSet; } /** *

The HTTP methods that are allowed when calling your function URL. For * example: GET, POST, DELETE, or the * wildcard character (*).

*/ inline void SetAllowMethods(const Aws::Vector& value) { m_allowMethodsHasBeenSet = true; m_allowMethods = value; } /** *

The HTTP methods that are allowed when calling your function URL. For * example: GET, POST, DELETE, or the * wildcard character (*).

*/ inline void SetAllowMethods(Aws::Vector&& value) { m_allowMethodsHasBeenSet = true; m_allowMethods = std::move(value); } /** *

The HTTP methods that are allowed when calling your function URL. For * example: GET, POST, DELETE, or the * wildcard character (*).

*/ inline Cors& WithAllowMethods(const Aws::Vector& value) { SetAllowMethods(value); return *this;} /** *

The HTTP methods that are allowed when calling your function URL. For * example: GET, POST, DELETE, or the * wildcard character (*).

*/ inline Cors& WithAllowMethods(Aws::Vector&& value) { SetAllowMethods(std::move(value)); return *this;} /** *

The HTTP methods that are allowed when calling your function URL. For * example: GET, POST, DELETE, or the * wildcard character (*).

*/ inline Cors& AddAllowMethods(const Aws::String& value) { m_allowMethodsHasBeenSet = true; m_allowMethods.push_back(value); return *this; } /** *

The HTTP methods that are allowed when calling your function URL. For * example: GET, POST, DELETE, or the * wildcard character (*).

*/ inline Cors& AddAllowMethods(Aws::String&& value) { m_allowMethodsHasBeenSet = true; m_allowMethods.push_back(std::move(value)); return *this; } /** *

The HTTP methods that are allowed when calling your function URL. For * example: GET, POST, DELETE, or the * wildcard character (*).

*/ inline Cors& AddAllowMethods(const char* value) { m_allowMethodsHasBeenSet = true; m_allowMethods.push_back(value); return *this; } /** *

The origins that can access your function URL. You can list any number of * specific origins, separated by a comma. For example: * https://www.example.com, http://localhost:60905.

*

Alternatively, you can grant access to all origins using the wildcard * character (*).

*/ inline const Aws::Vector& GetAllowOrigins() const{ return m_allowOrigins; } /** *

The origins that can access your function URL. You can list any number of * specific origins, separated by a comma. For example: * https://www.example.com, http://localhost:60905.

*

Alternatively, you can grant access to all origins using the wildcard * character (*).

*/ inline bool AllowOriginsHasBeenSet() const { return m_allowOriginsHasBeenSet; } /** *

The origins that can access your function URL. You can list any number of * specific origins, separated by a comma. For example: * https://www.example.com, http://localhost:60905.

*

Alternatively, you can grant access to all origins using the wildcard * character (*).

*/ inline void SetAllowOrigins(const Aws::Vector& value) { m_allowOriginsHasBeenSet = true; m_allowOrigins = value; } /** *

The origins that can access your function URL. You can list any number of * specific origins, separated by a comma. For example: * https://www.example.com, http://localhost:60905.

*

Alternatively, you can grant access to all origins using the wildcard * character (*).

*/ inline void SetAllowOrigins(Aws::Vector&& value) { m_allowOriginsHasBeenSet = true; m_allowOrigins = std::move(value); } /** *

The origins that can access your function URL. You can list any number of * specific origins, separated by a comma. For example: * https://www.example.com, http://localhost:60905.

*

Alternatively, you can grant access to all origins using the wildcard * character (*).

*/ inline Cors& WithAllowOrigins(const Aws::Vector& value) { SetAllowOrigins(value); return *this;} /** *

The origins that can access your function URL. You can list any number of * specific origins, separated by a comma. For example: * https://www.example.com, http://localhost:60905.

*

Alternatively, you can grant access to all origins using the wildcard * character (*).

*/ inline Cors& WithAllowOrigins(Aws::Vector&& value) { SetAllowOrigins(std::move(value)); return *this;} /** *

The origins that can access your function URL. You can list any number of * specific origins, separated by a comma. For example: * https://www.example.com, http://localhost:60905.

*

Alternatively, you can grant access to all origins using the wildcard * character (*).

*/ inline Cors& AddAllowOrigins(const Aws::String& value) { m_allowOriginsHasBeenSet = true; m_allowOrigins.push_back(value); return *this; } /** *

The origins that can access your function URL. You can list any number of * specific origins, separated by a comma. For example: * https://www.example.com, http://localhost:60905.

*

Alternatively, you can grant access to all origins using the wildcard * character (*).

*/ inline Cors& AddAllowOrigins(Aws::String&& value) { m_allowOriginsHasBeenSet = true; m_allowOrigins.push_back(std::move(value)); return *this; } /** *

The origins that can access your function URL. You can list any number of * specific origins, separated by a comma. For example: * https://www.example.com, http://localhost:60905.

*

Alternatively, you can grant access to all origins using the wildcard * character (*).

*/ inline Cors& AddAllowOrigins(const char* value) { m_allowOriginsHasBeenSet = true; m_allowOrigins.push_back(value); return *this; } /** *

The HTTP headers in your function response that you want to expose to origins * that call your function URL. For example: Date, * Keep-Alive, X-Custom-Header.

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

The HTTP headers in your function response that you want to expose to origins * that call your function URL. For example: Date, * Keep-Alive, X-Custom-Header.

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

The HTTP headers in your function response that you want to expose to origins * that call your function URL. For example: Date, * Keep-Alive, X-Custom-Header.

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

The HTTP headers in your function response that you want to expose to origins * that call your function URL. For example: Date, * Keep-Alive, X-Custom-Header.

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

The HTTP headers in your function response that you want to expose to origins * that call your function URL. For example: Date, * Keep-Alive, X-Custom-Header.

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

The HTTP headers in your function response that you want to expose to origins * that call your function URL. For example: Date, * Keep-Alive, X-Custom-Header.

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

The HTTP headers in your function response that you want to expose to origins * that call your function URL. For example: Date, * Keep-Alive, X-Custom-Header.

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

The HTTP headers in your function response that you want to expose to origins * that call your function URL. For example: Date, * Keep-Alive, X-Custom-Header.

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

The HTTP headers in your function response that you want to expose to origins * that call your function URL. For example: Date, * Keep-Alive, X-Custom-Header.

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

The maximum amount of time, in seconds, that web browsers can cache results * of a preflight request. By default, this is set to 0, which means * that the browser doesn't cache results.

*/ inline int GetMaxAge() const{ return m_maxAge; } /** *

The maximum amount of time, in seconds, that web browsers can cache results * of a preflight request. By default, this is set to 0, which means * that the browser doesn't cache results.

*/ inline bool MaxAgeHasBeenSet() const { return m_maxAgeHasBeenSet; } /** *

The maximum amount of time, in seconds, that web browsers can cache results * of a preflight request. By default, this is set to 0, which means * that the browser doesn't cache results.

*/ inline void SetMaxAge(int value) { m_maxAgeHasBeenSet = true; m_maxAge = value; } /** *

The maximum amount of time, in seconds, that web browsers can cache results * of a preflight request. By default, this is set to 0, which means * that the browser doesn't cache results.

*/ inline Cors& WithMaxAge(int value) { SetMaxAge(value); return *this;} private: bool m_allowCredentials; bool m_allowCredentialsHasBeenSet = false; Aws::Vector m_allowHeaders; bool m_allowHeadersHasBeenSet = false; Aws::Vector m_allowMethods; bool m_allowMethodsHasBeenSet = false; Aws::Vector m_allowOrigins; bool m_allowOriginsHasBeenSet = false; Aws::Vector m_exposeHeaders; bool m_exposeHeadersHasBeenSet = false; int m_maxAge; bool m_maxAgeHasBeenSet = false; }; } // namespace Model } // namespace Lambda } // namespace Aws