
software.amazon.awssdk.services.securityhub.model.NetworkPathComponent 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.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;
/**
*
* Information about a network path component.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class NetworkPathComponent implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField COMPONENT_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ComponentId").getter(getter(NetworkPathComponent::componentId)).setter(setter(Builder::componentId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ComponentId").build()).build();
private static final SdkField COMPONENT_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ComponentType").getter(getter(NetworkPathComponent::componentType))
.setter(setter(Builder::componentType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ComponentType").build()).build();
private static final SdkField EGRESS_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.memberName("Egress").getter(getter(NetworkPathComponent::egress)).setter(setter(Builder::egress))
.constructor(NetworkHeader::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Egress").build()).build();
private static final SdkField INGRESS_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.memberName("Ingress").getter(getter(NetworkPathComponent::ingress)).setter(setter(Builder::ingress))
.constructor(NetworkHeader::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Ingress").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(COMPONENT_ID_FIELD,
COMPONENT_TYPE_FIELD, EGRESS_FIELD, INGRESS_FIELD));
private static final long serialVersionUID = 1L;
private final String componentId;
private final String componentType;
private final NetworkHeader egress;
private final NetworkHeader ingress;
private NetworkPathComponent(BuilderImpl builder) {
this.componentId = builder.componentId;
this.componentType = builder.componentType;
this.egress = builder.egress;
this.ingress = builder.ingress;
}
/**
*
* The identifier of a component in the network path.
*
*
* Length Constraints: Minimum of 1. Maximum of 32.
*
*
* @return The identifier of a component in the network path.
*
* Length Constraints: Minimum of 1. Maximum of 32.
*/
public final String componentId() {
return componentId;
}
/**
*
* The type of component.
*
*
* Length Constraints: Minimum of 1. Maximum of 32.
*
*
* @return The type of component.
*
* Length Constraints: Minimum of 1. Maximum of 32.
*/
public final String componentType() {
return componentType;
}
/**
*
* Information about the component that comes after the current component in the network path.
*
*
* @return Information about the component that comes after the current component in the network path.
*/
public final NetworkHeader egress() {
return egress;
}
/**
*
* Information about the component that comes before the current node in the network path.
*
*
* @return Information about the component that comes before the current node in the network path.
*/
public final NetworkHeader ingress() {
return ingress;
}
@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(componentId());
hashCode = 31 * hashCode + Objects.hashCode(componentType());
hashCode = 31 * hashCode + Objects.hashCode(egress());
hashCode = 31 * hashCode + Objects.hashCode(ingress());
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 NetworkPathComponent)) {
return false;
}
NetworkPathComponent other = (NetworkPathComponent) obj;
return Objects.equals(componentId(), other.componentId()) && Objects.equals(componentType(), other.componentType())
&& Objects.equals(egress(), other.egress()) && Objects.equals(ingress(), other.ingress());
}
/**
* 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("NetworkPathComponent").add("ComponentId", componentId()).add("ComponentType", componentType())
.add("Egress", egress()).add("Ingress", ingress()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "ComponentId":
return Optional.ofNullable(clazz.cast(componentId()));
case "ComponentType":
return Optional.ofNullable(clazz.cast(componentType()));
case "Egress":
return Optional.ofNullable(clazz.cast(egress()));
case "Ingress":
return Optional.ofNullable(clazz.cast(ingress()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function