
software.amazon.awssdk.services.securityhub.model.RuleGroupSourceStatefulRulesHeaderDetails 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.securityhub.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;
/**
*
* The inspection criteria for a stateful rule.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class RuleGroupSourceStatefulRulesHeaderDetails implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField DESTINATION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("Destination").getter(getter(RuleGroupSourceStatefulRulesHeaderDetails::destination))
.setter(setter(Builder::destination))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Destination").build()).build();
private static final SdkField DESTINATION_PORT_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("DestinationPort").getter(getter(RuleGroupSourceStatefulRulesHeaderDetails::destinationPort))
.setter(setter(Builder::destinationPort))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DestinationPort").build()).build();
private static final SdkField DIRECTION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("Direction").getter(getter(RuleGroupSourceStatefulRulesHeaderDetails::direction))
.setter(setter(Builder::direction))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Direction").build()).build();
private static final SdkField PROTOCOL_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("Protocol").getter(getter(RuleGroupSourceStatefulRulesHeaderDetails::protocol))
.setter(setter(Builder::protocol))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Protocol").build()).build();
private static final SdkField SOURCE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Source")
.getter(getter(RuleGroupSourceStatefulRulesHeaderDetails::source)).setter(setter(Builder::source))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Source").build()).build();
private static final SdkField SOURCE_PORT_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("SourcePort").getter(getter(RuleGroupSourceStatefulRulesHeaderDetails::sourcePort))
.setter(setter(Builder::sourcePort))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SourcePort").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(DESTINATION_FIELD,
DESTINATION_PORT_FIELD, DIRECTION_FIELD, PROTOCOL_FIELD, SOURCE_FIELD, SOURCE_PORT_FIELD));
private static final long serialVersionUID = 1L;
private final String destination;
private final String destinationPort;
private final String direction;
private final String protocol;
private final String source;
private final String sourcePort;
private RuleGroupSourceStatefulRulesHeaderDetails(BuilderImpl builder) {
this.destination = builder.destination;
this.destinationPort = builder.destinationPort;
this.direction = builder.direction;
this.protocol = builder.protocol;
this.source = builder.source;
this.sourcePort = builder.sourcePort;
}
/**
*
* The destination IP address or address range to inspect for, in CIDR notation. To match with any address, specify
* ANY
.
*
*
* @return The destination IP address or address range to inspect for, in CIDR notation. To match with any address,
* specify ANY
.
*/
public final String destination() {
return destination;
}
/**
*
* The destination port to inspect for. You can specify an individual port, such as 1994
. You also can
* specify a port range, such as 1990:1994
. To match with any port, specify ANY
.
*
*
* @return The destination port to inspect for. You can specify an individual port, such as 1994
. You
* also can specify a port range, such as 1990:1994
. To match with any port, specify
* ANY
.
*/
public final String destinationPort() {
return destinationPort;
}
/**
*
* The direction of traffic flow to inspect. If set to ANY
, the inspection matches bidirectional
* traffic, both from the source to the destination and from the destination to the source. If set to
* FORWARD
, the inspection only matches traffic going from the source to the destination.
*
*
* @return The direction of traffic flow to inspect. If set to ANY
, the inspection matches
* bidirectional traffic, both from the source to the destination and from the destination to the source. If
* set to FORWARD
, the inspection only matches traffic going from the source to the
* destination.
*/
public final String direction() {
return direction;
}
/**
*
* The protocol to inspect for. To inspector for all protocols, use IP
.
*
*
* @return The protocol to inspect for. To inspector for all protocols, use IP
.
*/
public final String protocol() {
return protocol;
}
/**
*
* The source IP address or address range to inspect for, in CIDR notation. To match with any address, specify
* ANY
.
*
*
* @return The source IP address or address range to inspect for, in CIDR notation. To match with any address,
* specify ANY
.
*/
public final String source() {
return source;
}
/**
*
* The source port to inspect for. You can specify an individual port, such as 1994
. You also can
* specify a port range, such as 1990:1994
. To match with any port, specify ANY
.
*
*
* @return The source port to inspect for. You can specify an individual port, such as 1994
. You also
* can specify a port range, such as 1990:1994
. To match with any port, specify
* ANY
.
*/
public final String sourcePort() {
return sourcePort;
}
@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(destination());
hashCode = 31 * hashCode + Objects.hashCode(destinationPort());
hashCode = 31 * hashCode + Objects.hashCode(direction());
hashCode = 31 * hashCode + Objects.hashCode(protocol());
hashCode = 31 * hashCode + Objects.hashCode(source());
hashCode = 31 * hashCode + Objects.hashCode(sourcePort());
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 RuleGroupSourceStatefulRulesHeaderDetails)) {
return false;
}
RuleGroupSourceStatefulRulesHeaderDetails other = (RuleGroupSourceStatefulRulesHeaderDetails) obj;
return Objects.equals(destination(), other.destination()) && Objects.equals(destinationPort(), other.destinationPort())
&& Objects.equals(direction(), other.direction()) && Objects.equals(protocol(), other.protocol())
&& Objects.equals(source(), other.source()) && Objects.equals(sourcePort(), other.sourcePort());
}
/**
* 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("RuleGroupSourceStatefulRulesHeaderDetails").add("Destination", destination())
.add("DestinationPort", destinationPort()).add("Direction", direction()).add("Protocol", protocol())
.add("Source", source()).add("SourcePort", sourcePort()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "Destination":
return Optional.ofNullable(clazz.cast(destination()));
case "DestinationPort":
return Optional.ofNullable(clazz.cast(destinationPort()));
case "Direction":
return Optional.ofNullable(clazz.cast(direction()));
case "Protocol":
return Optional.ofNullable(clazz.cast(protocol()));
case "Source":
return Optional.ofNullable(clazz.cast(source()));
case "SourcePort":
return Optional.ofNullable(clazz.cast(sourcePort()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function