/* * Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ package com.amazonaws.services.wafv2.model; import java.io.Serializable; import javax.annotation.Generated; import com.amazonaws.protocol.StructuredPojo; import com.amazonaws.protocol.ProtocolMarshaller; /** *
* 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 AWS API * Documentation */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class CustomResponse implements Serializable, Cloneable, StructuredPojo { /** ** 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. *
*/ private Integer responseCode; /** *
* 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.
*
* 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. *
*/ private java.util.List* 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. *
* * @param 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. */ public void setResponseCode(Integer responseCode) { this.responseCode = 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. *
* * @return 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. */ public Integer getResponseCode() { return this.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. *
* * @param 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. * @return Returns a reference to this object so that method calls can be chained together. */ public CustomResponse withResponseCode(Integer responseCode) { setResponseCode(responseCode); 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.
*
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.
*/
public void setCustomResponseBodyKey(String customResponseBodyKey) {
this.customResponseBodyKey = 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.
*
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.
*/
public String getCustomResponseBodyKey() {
return this.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.
*
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.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CustomResponse withCustomResponseBodyKey(String customResponseBodyKey) {
setCustomResponseBodyKey(customResponseBodyKey);
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. *
* * @return 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.
*/
public java.util.List
* 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.
*
* For information about the limits on count and size for custom request and response settings, see WAF quotas in the WAF
* Developer Guide.
*/
public void setResponseHeaders(java.util.Collection
* 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.
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setResponseHeaders(java.util.Collection)} or {@link #withResponseHeaders(java.util.Collection)} if you
* want to override the existing values.
*
* For information about the limits on count and size for custom request and response settings, see WAF quotas in the WAF
* Developer Guide.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CustomResponse withResponseHeaders(CustomHTTPHeader... responseHeaders) {
if (this.responseHeaders == null) {
setResponseHeaders(new java.util.ArrayList
* 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.
*
* For information about the limits on count and size for custom request and response settings, see WAF quotas in the WAF
* Developer Guide.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CustomResponse withResponseHeaders(java.util.Collection