software.amazon.awssdk.services.waf.model.RuleGroup Maven / Gradle / Ivy
Show all versions of waf Show documentation
/*
* 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.waf.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.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;
/**
*
*
* This is AWS WAF Classic documentation. For more information, see AWS WAF Classic in the
* developer guide.
*
*
* For the latest version of AWS WAF, use the AWS WAFV2 API and see the AWS WAF Developer Guide. With the
* latest version, AWS WAF has a single set of endpoints for regional and global use.
*
*
*
* A collection of predefined rules that you can add to a web ACL.
*
*
* Rule groups are subject to the following limits:
*
*
* -
*
* Three rule groups per account. You can request an increase to this limit by contacting customer support.
*
*
* -
*
* One rule group per web ACL.
*
*
* -
*
* Ten rules per rule group.
*
*
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class RuleGroup implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField RULE_GROUP_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("RuleGroupId").getter(getter(RuleGroup::ruleGroupId)).setter(setter(Builder::ruleGroupId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("RuleGroupId").build()).build();
private static final SdkField NAME_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Name")
.getter(getter(RuleGroup::name)).setter(setter(Builder::name))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Name").build()).build();
private static final SdkField METRIC_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("MetricName").getter(getter(RuleGroup::metricName)).setter(setter(Builder::metricName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MetricName").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(RULE_GROUP_ID_FIELD,
NAME_FIELD, METRIC_NAME_FIELD));
private static final long serialVersionUID = 1L;
private final String ruleGroupId;
private final String name;
private final String metricName;
private RuleGroup(BuilderImpl builder) {
this.ruleGroupId = builder.ruleGroupId;
this.name = builder.name;
this.metricName = builder.metricName;
}
/**
*
* A unique identifier for a RuleGroup
. You use RuleGroupId
to get more information about
* a RuleGroup
(see GetRuleGroup), update a RuleGroup
(see UpdateRuleGroup),
* insert a RuleGroup
into a WebACL
or delete a one from a WebACL
(see
* UpdateWebACL), or delete a RuleGroup
from AWS WAF (see DeleteRuleGroup).
*
*
* RuleGroupId
is returned by CreateRuleGroup and by ListRuleGroups.
*
*
* @return A unique identifier for a RuleGroup
. You use RuleGroupId
to get more
* information about a RuleGroup
(see GetRuleGroup), update a RuleGroup
* (see UpdateRuleGroup), insert a RuleGroup
into a WebACL
or delete a one
* from a WebACL
(see UpdateWebACL), or delete a RuleGroup
from AWS WAF
* (see DeleteRuleGroup).
*
* RuleGroupId
is returned by CreateRuleGroup and by ListRuleGroups.
*/
public final String ruleGroupId() {
return ruleGroupId;
}
/**
*
* The friendly name or description for the RuleGroup
. You can't change the name of a
* RuleGroup
after you create it.
*
*
* @return The friendly name or description for the RuleGroup
. You can't change the name of a
* RuleGroup
after you create it.
*/
public final String name() {
return name;
}
/**
*
* A friendly name or description for the metrics for this RuleGroup
. The name can contain only
* alphanumeric characters (A-Z, a-z, 0-9), with maximum length 128 and minimum length one. It can't contain
* whitespace or metric names reserved for AWS WAF, including "All" and "Default_Action." You can't change the name
* of the metric after you create the RuleGroup
.
*
*
* @return A friendly name or description for the metrics for this RuleGroup
. The name can contain only
* alphanumeric characters (A-Z, a-z, 0-9), with maximum length 128 and minimum length one. It can't contain
* whitespace or metric names reserved for AWS WAF, including "All" and "Default_Action." You can't change
* the name of the metric after you create the RuleGroup
.
*/
public final String metricName() {
return metricName;
}
@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(ruleGroupId());
hashCode = 31 * hashCode + Objects.hashCode(name());
hashCode = 31 * hashCode + Objects.hashCode(metricName());
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 RuleGroup)) {
return false;
}
RuleGroup other = (RuleGroup) obj;
return Objects.equals(ruleGroupId(), other.ruleGroupId()) && Objects.equals(name(), other.name())
&& Objects.equals(metricName(), other.metricName());
}
/**
* 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("RuleGroup").add("RuleGroupId", ruleGroupId()).add("Name", name())
.add("MetricName", metricName()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "RuleGroupId":
return Optional.ofNullable(clazz.cast(ruleGroupId()));
case "Name":
return Optional.ofNullable(clazz.cast(name()));
case "MetricName":
return Optional.ofNullable(clazz.cast(metricName()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function