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

A custom response to send to the client. You can define a custom response for * rule actions and default web ACL actions that are set to BlockAction. *

For information about customizing web requests and responses, see Customizing * web requests and responses in WAF in the WAF Developer Guide. *

See Also:

AWS * API Reference

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

The HTTP status code to return to the client.

For a list of status * codes that you can use in your custom responses, see Supported * status codes for custom response in the WAF Developer Guide.

*/ inline int GetResponseCode() const{ return m_responseCode; } /** *

The HTTP status code to return to the client.

For a list of status * codes that you can use in your custom responses, see Supported * status codes for custom response in the WAF Developer Guide.

*/ inline bool ResponseCodeHasBeenSet() const { return m_responseCodeHasBeenSet; } /** *

The HTTP status code to return to the client.

For a list of status * codes that you can use in your custom responses, see Supported * status codes for custom response in the WAF Developer Guide.

*/ inline void SetResponseCode(int value) { m_responseCodeHasBeenSet = true; m_responseCode = value; } /** *

The HTTP status code to return to the client.

For a list of status * codes that you can use in your custom responses, see Supported * status codes for custom response in the WAF Developer Guide.

*/ inline CustomResponse& WithResponseCode(int value) { SetResponseCode(value); return *this;} /** *

References the response body that you want WAF to return to the web request * client. You can define a custom response for a rule action or a default web ACL * action that is set to block. To do this, you first define the response body key * and value in the CustomResponseBodies setting for the WebACL * or RuleGroup where you want to use it. Then, in the rule action or web * ACL default action BlockAction setting, you reference the response * body using this key.

*/ inline const Aws::String& GetCustomResponseBodyKey() const{ return m_customResponseBodyKey; } /** *

References the response body that you want WAF to return to the web request * client. You can define a custom response for a rule action or a default web ACL * action that is set to block. To do this, you first define the response body key * and value in the CustomResponseBodies setting for the WebACL * or RuleGroup where you want to use it. Then, in the rule action or web * ACL default action BlockAction setting, you reference the response * body using this key.

*/ inline bool CustomResponseBodyKeyHasBeenSet() const { return m_customResponseBodyKeyHasBeenSet; } /** *

References the response body that you want WAF to return to the web request * client. You can define a custom response for a rule action or a default web ACL * action that is set to block. To do this, you first define the response body key * and value in the CustomResponseBodies setting for the WebACL * or RuleGroup where you want to use it. Then, in the rule action or web * ACL default action BlockAction setting, you reference the response * body using this key.

*/ inline void SetCustomResponseBodyKey(const Aws::String& value) { m_customResponseBodyKeyHasBeenSet = true; m_customResponseBodyKey = value; } /** *

References the response body that you want WAF to return to the web request * client. You can define a custom response for a rule action or a default web ACL * action that is set to block. To do this, you first define the response body key * and value in the CustomResponseBodies setting for the WebACL * or RuleGroup where you want to use it. Then, in the rule action or web * ACL default action BlockAction setting, you reference the response * body using this key.

*/ inline void SetCustomResponseBodyKey(Aws::String&& value) { m_customResponseBodyKeyHasBeenSet = true; m_customResponseBodyKey = std::move(value); } /** *

References the response body that you want WAF to return to the web request * client. You can define a custom response for a rule action or a default web ACL * action that is set to block. To do this, you first define the response body key * and value in the CustomResponseBodies setting for the WebACL * or RuleGroup where you want to use it. Then, in the rule action or web * ACL default action BlockAction setting, you reference the response * body using this key.

*/ inline void SetCustomResponseBodyKey(const char* value) { m_customResponseBodyKeyHasBeenSet = true; m_customResponseBodyKey.assign(value); } /** *

References the response body that you want WAF to return to the web request * client. You can define a custom response for a rule action or a default web ACL * action that is set to block. To do this, you first define the response body key * and value in the CustomResponseBodies setting for the WebACL * or RuleGroup where you want to use it. Then, in the rule action or web * ACL default action BlockAction setting, you reference the response * body using this key.

*/ inline CustomResponse& WithCustomResponseBodyKey(const Aws::String& value) { SetCustomResponseBodyKey(value); return *this;} /** *

References the response body that you want WAF to return to the web request * client. You can define a custom response for a rule action or a default web ACL * action that is set to block. To do this, you first define the response body key * and value in the CustomResponseBodies setting for the WebACL * or RuleGroup where you want to use it. Then, in the rule action or web * ACL default action BlockAction setting, you reference the response * body using this key.

*/ inline CustomResponse& WithCustomResponseBodyKey(Aws::String&& value) { SetCustomResponseBodyKey(std::move(value)); return *this;} /** *

References the response body that you want WAF to return to the web request * client. You can define a custom response for a rule action or a default web ACL * action that is set to block. To do this, you first define the response body key * and value in the CustomResponseBodies setting for the WebACL * or RuleGroup where you want to use it. Then, in the rule action or web * ACL default action BlockAction setting, you reference the response * body using this key.

*/ inline CustomResponse& WithCustomResponseBodyKey(const char* value) { SetCustomResponseBodyKey(value); return *this;} /** *

The HTTP headers to use in the response. Duplicate header names are not * allowed.

For information about the limits on count and size for custom * request and response settings, see WAF * quotas in the WAF Developer Guide.

*/ inline const Aws::Vector& GetResponseHeaders() const{ return m_responseHeaders; } /** *

The HTTP headers to use in the response. Duplicate header names are not * allowed.

For information about the limits on count and size for custom * request and response settings, see WAF * quotas in the WAF Developer Guide.

*/ inline bool ResponseHeadersHasBeenSet() const { return m_responseHeadersHasBeenSet; } /** *

The HTTP headers to use in the response. Duplicate header names are not * allowed.

For information about the limits on count and size for custom * request and response settings, see WAF * quotas in the WAF Developer Guide.

*/ inline void SetResponseHeaders(const Aws::Vector& value) { m_responseHeadersHasBeenSet = true; m_responseHeaders = value; } /** *

The HTTP headers to use in the response. Duplicate header names are not * allowed.

For information about the limits on count and size for custom * request and response settings, see WAF * quotas in the WAF Developer Guide.

*/ inline void SetResponseHeaders(Aws::Vector&& value) { m_responseHeadersHasBeenSet = true; m_responseHeaders = std::move(value); } /** *

The HTTP headers to use in the response. Duplicate header names are not * allowed.

For information about the limits on count and size for custom * request and response settings, see WAF * quotas in the WAF Developer Guide.

*/ inline CustomResponse& WithResponseHeaders(const Aws::Vector& value) { SetResponseHeaders(value); return *this;} /** *

The HTTP headers to use in the response. Duplicate header names are not * allowed.

For information about the limits on count and size for custom * request and response settings, see WAF * quotas in the WAF Developer Guide.

*/ inline CustomResponse& WithResponseHeaders(Aws::Vector&& value) { SetResponseHeaders(std::move(value)); return *this;} /** *

The HTTP headers to use in the response. Duplicate header names are not * allowed.

For information about the limits on count and size for custom * request and response settings, see WAF * quotas in the WAF Developer Guide.

*/ inline CustomResponse& AddResponseHeaders(const CustomHTTPHeader& value) { m_responseHeadersHasBeenSet = true; m_responseHeaders.push_back(value); return *this; } /** *

The HTTP headers to use in the response. Duplicate header names are not * allowed.

For information about the limits on count and size for custom * request and response settings, see WAF * quotas in the WAF Developer Guide.

*/ inline CustomResponse& AddResponseHeaders(CustomHTTPHeader&& value) { m_responseHeadersHasBeenSet = true; m_responseHeaders.push_back(std::move(value)); return *this; } private: int m_responseCode; bool m_responseCodeHasBeenSet = false; Aws::String m_customResponseBodyKey; bool m_customResponseBodyKeyHasBeenSet = false; Aws::Vector m_responseHeaders; bool m_responseHeadersHasBeenSet = false; }; } // namespace Model } // namespace WAFV2 } // namespace Aws