
software.amazon.awssdk.services.wafv2.model.ManagedRuleGroupConfig Maven / Gradle / Ivy
/*
* Copyright 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 software.amazon.awssdk.services.wafv2.model;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.function.Function;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.core.SdkField;
import software.amazon.awssdk.core.SdkPojo;
import software.amazon.awssdk.core.protocol.MarshallLocation;
import software.amazon.awssdk.core.protocol.MarshallingType;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* Additional information that's used by a managed rule group. Many managed rule groups don't require this.
*
*
* The rule groups used for intelligent threat mitigation require additional configuration:
*
*
* -
*
* Use the AWSManagedRulesACFPRuleSet
configuration object to configure the account creation fraud
* prevention managed rule group. The configuration includes the registration and sign-up pages of your application and
* the locations in the account creation request payload of data, such as the user email and phone number fields.
*
*
* -
*
* Use the AWSManagedRulesATPRuleSet
configuration object to configure the account takeover prevention
* managed rule group. The configuration includes the sign-in page of your application and the locations in the login
* request payload of data such as the username and password.
*
*
* -
*
* Use the AWSManagedRulesBotControlRuleSet
configuration object to configure the protection level that you
* want the Bot Control rule group to use.
*
*
*
*
* For example specifications, see the examples section of CreateWebACL.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class ManagedRuleGroupConfig implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField LOGIN_PATH_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("LoginPath").getter(getter(ManagedRuleGroupConfig::loginPath)).setter(setter(Builder::loginPath))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LoginPath").build()).build();
private static final SdkField PAYLOAD_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("PayloadType").getter(getter(ManagedRuleGroupConfig::payloadTypeAsString))
.setter(setter(Builder::payloadType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("PayloadType").build()).build();
private static final SdkField USERNAME_FIELD_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("UsernameField")
.getter(getter(ManagedRuleGroupConfig::usernameField)).setter(setter(Builder::usernameField))
.constructor(UsernameField::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("UsernameField").build()).build();
private static final SdkField PASSWORD_FIELD_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("PasswordField")
.getter(getter(ManagedRuleGroupConfig::passwordField)).setter(setter(Builder::passwordField))
.constructor(PasswordField::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("PasswordField").build()).build();
private static final SdkField AWS_MANAGED_RULES_BOT_CONTROL_RULE_SET_FIELD = SdkField
. builder(MarshallingType.SDK_POJO)
.memberName("AWSManagedRulesBotControlRuleSet")
.getter(getter(ManagedRuleGroupConfig::awsManagedRulesBotControlRuleSet))
.setter(setter(Builder::awsManagedRulesBotControlRuleSet))
.constructor(AWSManagedRulesBotControlRuleSet::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AWSManagedRulesBotControlRuleSet")
.build()).build();
private static final SdkField AWS_MANAGED_RULES_ATP_RULE_SET_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("AWSManagedRulesATPRuleSet")
.getter(getter(ManagedRuleGroupConfig::awsManagedRulesATPRuleSet)).setter(setter(Builder::awsManagedRulesATPRuleSet))
.constructor(AWSManagedRulesATPRuleSet::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AWSManagedRulesATPRuleSet").build())
.build();
private static final SdkField AWS_MANAGED_RULES_ACFP_RULE_SET_FIELD = SdkField
. builder(MarshallingType.SDK_POJO)
.memberName("AWSManagedRulesACFPRuleSet")
.getter(getter(ManagedRuleGroupConfig::awsManagedRulesACFPRuleSet))
.setter(setter(Builder::awsManagedRulesACFPRuleSet))
.constructor(AWSManagedRulesACFPRuleSet::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AWSManagedRulesACFPRuleSet").build())
.build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(LOGIN_PATH_FIELD,
PAYLOAD_TYPE_FIELD, USERNAME_FIELD_FIELD, PASSWORD_FIELD_FIELD, AWS_MANAGED_RULES_BOT_CONTROL_RULE_SET_FIELD,
AWS_MANAGED_RULES_ATP_RULE_SET_FIELD, AWS_MANAGED_RULES_ACFP_RULE_SET_FIELD));
private static final long serialVersionUID = 1L;
private final String loginPath;
private final String payloadType;
private final UsernameField usernameField;
private final PasswordField passwordField;
private final AWSManagedRulesBotControlRuleSet awsManagedRulesBotControlRuleSet;
private final AWSManagedRulesATPRuleSet awsManagedRulesATPRuleSet;
private final AWSManagedRulesACFPRuleSet awsManagedRulesACFPRuleSet;
private ManagedRuleGroupConfig(BuilderImpl builder) {
this.loginPath = builder.loginPath;
this.payloadType = builder.payloadType;
this.usernameField = builder.usernameField;
this.passwordField = builder.passwordField;
this.awsManagedRulesBotControlRuleSet = builder.awsManagedRulesBotControlRuleSet;
this.awsManagedRulesATPRuleSet = builder.awsManagedRulesATPRuleSet;
this.awsManagedRulesACFPRuleSet = builder.awsManagedRulesACFPRuleSet;
}
/**
*
*
* Instead of this setting, provide your configuration under AWSManagedRulesATPRuleSet
.
*
*
*
* @return
* Instead of this setting, provide your configuration under AWSManagedRulesATPRuleSet
.
*
* @deprecated Deprecated. Use AWSManagedRulesATPRuleSet LoginPath
*/
@Deprecated
public final String loginPath() {
return loginPath;
}
/**
*
*
* Instead of this setting, provide your configuration under the request inspection configuration for
* AWSManagedRulesATPRuleSet
or AWSManagedRulesACFPRuleSet
.
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #payloadType} will
* return {@link PayloadType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #payloadTypeAsString}.
*
*
* @return
* Instead of this setting, provide your configuration under the request inspection configuration for
* AWSManagedRulesATPRuleSet
or AWSManagedRulesACFPRuleSet
.
*
* @see PayloadType
* @deprecated Deprecated. Use AWSManagedRulesATPRuleSet RequestInspection PayloadType
*/
@Deprecated
public final PayloadType payloadType() {
return PayloadType.fromValue(payloadType);
}
/**
*
*
* Instead of this setting, provide your configuration under the request inspection configuration for
* AWSManagedRulesATPRuleSet
or AWSManagedRulesACFPRuleSet
.
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #payloadType} will
* return {@link PayloadType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #payloadTypeAsString}.
*
*
* @return
* Instead of this setting, provide your configuration under the request inspection configuration for
* AWSManagedRulesATPRuleSet
or AWSManagedRulesACFPRuleSet
.
*
* @see PayloadType
* @deprecated Deprecated. Use AWSManagedRulesATPRuleSet RequestInspection PayloadType
*/
@Deprecated
public final String payloadTypeAsString() {
return payloadType;
}
/**
*
*
* Instead of this setting, provide your configuration under the request inspection configuration for
* AWSManagedRulesATPRuleSet
or AWSManagedRulesACFPRuleSet
.
*
*
*
* @return
* Instead of this setting, provide your configuration under the request inspection configuration for
* AWSManagedRulesATPRuleSet
or AWSManagedRulesACFPRuleSet
.
*
* @deprecated Deprecated. Use AWSManagedRulesATPRuleSet RequestInspection UsernameField
*/
@Deprecated
public final UsernameField usernameField() {
return usernameField;
}
/**
*
*
* Instead of this setting, provide your configuration under the request inspection configuration for
* AWSManagedRulesATPRuleSet
or AWSManagedRulesACFPRuleSet
.
*
*
*
* @return
* Instead of this setting, provide your configuration under the request inspection configuration for
* AWSManagedRulesATPRuleSet
or AWSManagedRulesACFPRuleSet
.
*
* @deprecated Deprecated. Use AWSManagedRulesATPRuleSet RequestInspection PasswordField
*/
@Deprecated
public final PasswordField passwordField() {
return passwordField;
}
/**
*
* Additional configuration for using the Bot Control managed rule group. Use this to specify the inspection level
* that you want to use. For information about using the Bot Control managed rule group, see WAF Bot Control
* rule group and WAF Bot
* Control in the WAF Developer Guide.
*
*
* @return Additional configuration for using the Bot Control managed rule group. Use this to specify the inspection
* level that you want to use. For information about using the Bot Control managed rule group, see WAF Bot
* Control rule group and WAF Bot Control in
* the WAF Developer Guide.
*/
public final AWSManagedRulesBotControlRuleSet awsManagedRulesBotControlRuleSet() {
return awsManagedRulesBotControlRuleSet;
}
/**
*
* Additional configuration for using the account takeover prevention (ATP) managed rule group,
* AWSManagedRulesATPRuleSet
. Use this to provide login request information to the rule group. For web
* ACLs that protect CloudFront distributions, use this to also provide the information about how your distribution
* responds to login requests.
*
*
* This configuration replaces the individual configuration fields in ManagedRuleGroupConfig
and
* provides additional feature configuration.
*
*
* For information about using the ATP managed rule group, see WAF Fraud Control
* account takeover prevention (ATP) rule group and WAF Fraud Control account takeover
* prevention (ATP) in the WAF Developer Guide.
*
*
* @return Additional configuration for using the account takeover prevention (ATP) managed rule group,
* AWSManagedRulesATPRuleSet
. Use this to provide login request information to the rule group.
* For web ACLs that protect CloudFront distributions, use this to also provide the information about how
* your distribution responds to login requests.
*
* This configuration replaces the individual configuration fields in ManagedRuleGroupConfig
* and provides additional feature configuration.
*
*
* For information about using the ATP managed rule group, see WAF Fraud
* Control account takeover prevention (ATP) rule group and WAF Fraud Control account
* takeover prevention (ATP) in the WAF Developer Guide.
*/
public final AWSManagedRulesATPRuleSet awsManagedRulesATPRuleSet() {
return awsManagedRulesATPRuleSet;
}
/**
*
* Additional configuration for using the account creation fraud prevention (ACFP) managed rule group,
* AWSManagedRulesACFPRuleSet
. Use this to provide account creation request information to the rule
* group. For web ACLs that protect CloudFront distributions, use this to also provide the information about how
* your distribution responds to account creation requests.
*
*
* For information about using the ACFP managed rule group, see WAF Fraud Control
* account creation fraud prevention (ACFP) rule group and WAF Fraud Control account creation
* fraud prevention (ACFP) in the WAF Developer Guide.
*
*
* @return Additional configuration for using the account creation fraud prevention (ACFP) managed rule group,
* AWSManagedRulesACFPRuleSet
. Use this to provide account creation request information to the
* rule group. For web ACLs that protect CloudFront distributions, use this to also provide the information
* about how your distribution responds to account creation requests.
*
* For information about using the ACFP managed rule group, see WAF Fraud
* Control account creation fraud prevention (ACFP) rule group and WAF Fraud Control account
* creation fraud prevention (ACFP) in the WAF Developer Guide.
*/
public final AWSManagedRulesACFPRuleSet awsManagedRulesACFPRuleSet() {
return awsManagedRulesACFPRuleSet;
}
@Override
public Builder toBuilder() {
return new BuilderImpl(this);
}
public static Builder builder() {
return new BuilderImpl();
}
public static Class extends Builder> serializableBuilderClass() {
return BuilderImpl.class;
}
@Override
public final int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(loginPath());
hashCode = 31 * hashCode + Objects.hashCode(payloadTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(usernameField());
hashCode = 31 * hashCode + Objects.hashCode(passwordField());
hashCode = 31 * hashCode + Objects.hashCode(awsManagedRulesBotControlRuleSet());
hashCode = 31 * hashCode + Objects.hashCode(awsManagedRulesATPRuleSet());
hashCode = 31 * hashCode + Objects.hashCode(awsManagedRulesACFPRuleSet());
return hashCode;
}
@Override
public final boolean equals(Object obj) {
return equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof ManagedRuleGroupConfig)) {
return false;
}
ManagedRuleGroupConfig other = (ManagedRuleGroupConfig) obj;
return Objects.equals(loginPath(), other.loginPath())
&& Objects.equals(payloadTypeAsString(), other.payloadTypeAsString())
&& Objects.equals(usernameField(), other.usernameField())
&& Objects.equals(passwordField(), other.passwordField())
&& Objects.equals(awsManagedRulesBotControlRuleSet(), other.awsManagedRulesBotControlRuleSet())
&& Objects.equals(awsManagedRulesATPRuleSet(), other.awsManagedRulesATPRuleSet())
&& Objects.equals(awsManagedRulesACFPRuleSet(), other.awsManagedRulesACFPRuleSet());
}
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*/
@Override
public final String toString() {
return ToString.builder("ManagedRuleGroupConfig").add("LoginPath", loginPath()).add("PayloadType", payloadTypeAsString())
.add("UsernameField", usernameField()).add("PasswordField", passwordField())
.add("AWSManagedRulesBotControlRuleSet", awsManagedRulesBotControlRuleSet())
.add("AWSManagedRulesATPRuleSet", awsManagedRulesATPRuleSet())
.add("AWSManagedRulesACFPRuleSet", awsManagedRulesACFPRuleSet()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "LoginPath":
return Optional.ofNullable(clazz.cast(loginPath()));
case "PayloadType":
return Optional.ofNullable(clazz.cast(payloadTypeAsString()));
case "UsernameField":
return Optional.ofNullable(clazz.cast(usernameField()));
case "PasswordField":
return Optional.ofNullable(clazz.cast(passwordField()));
case "AWSManagedRulesBotControlRuleSet":
return Optional.ofNullable(clazz.cast(awsManagedRulesBotControlRuleSet()));
case "AWSManagedRulesATPRuleSet":
return Optional.ofNullable(clazz.cast(awsManagedRulesATPRuleSet()));
case "AWSManagedRulesACFPRuleSet":
return Optional.ofNullable(clazz.cast(awsManagedRulesACFPRuleSet()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function