software.amazon.awssdk.services.applicationdiscovery.model.NeighborConnectionDetail 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.applicationdiscovery.model;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
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;
/**
*
* Details about neighboring servers.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class NeighborConnectionDetail implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField SOURCE_SERVER_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("sourceServerId").getter(getter(NeighborConnectionDetail::sourceServerId))
.setter(setter(Builder::sourceServerId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("sourceServerId").build()).build();
private static final SdkField DESTINATION_SERVER_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("destinationServerId").getter(getter(NeighborConnectionDetail::destinationServerId))
.setter(setter(Builder::destinationServerId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("destinationServerId").build())
.build();
private static final SdkField DESTINATION_PORT_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("destinationPort").getter(getter(NeighborConnectionDetail::destinationPort))
.setter(setter(Builder::destinationPort))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("destinationPort").build()).build();
private static final SdkField TRANSPORT_PROTOCOL_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("transportProtocol").getter(getter(NeighborConnectionDetail::transportProtocol))
.setter(setter(Builder::transportProtocol))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("transportProtocol").build()).build();
private static final SdkField CONNECTIONS_COUNT_FIELD = SdkField. builder(MarshallingType.LONG)
.memberName("connectionsCount").getter(getter(NeighborConnectionDetail::connectionsCount))
.setter(setter(Builder::connectionsCount))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("connectionsCount").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(SOURCE_SERVER_ID_FIELD,
DESTINATION_SERVER_ID_FIELD, DESTINATION_PORT_FIELD, TRANSPORT_PROTOCOL_FIELD, CONNECTIONS_COUNT_FIELD));
private static final Map> SDK_NAME_TO_FIELD = memberNameToFieldInitializer();
private static final long serialVersionUID = 1L;
private final String sourceServerId;
private final String destinationServerId;
private final Integer destinationPort;
private final String transportProtocol;
private final Long connectionsCount;
private NeighborConnectionDetail(BuilderImpl builder) {
this.sourceServerId = builder.sourceServerId;
this.destinationServerId = builder.destinationServerId;
this.destinationPort = builder.destinationPort;
this.transportProtocol = builder.transportProtocol;
this.connectionsCount = builder.connectionsCount;
}
/**
*
* The ID of the server that opened the network connection.
*
*
* @return The ID of the server that opened the network connection.
*/
public final String sourceServerId() {
return sourceServerId;
}
/**
*
* The ID of the server that accepted the network connection.
*
*
* @return The ID of the server that accepted the network connection.
*/
public final String destinationServerId() {
return destinationServerId;
}
/**
*
* The destination network port for the connection.
*
*
* @return The destination network port for the connection.
*/
public final Integer destinationPort() {
return destinationPort;
}
/**
*
* The network protocol used for the connection.
*
*
* @return The network protocol used for the connection.
*/
public final String transportProtocol() {
return transportProtocol;
}
/**
*
* The number of open network connections with the neighboring server.
*
*
* @return The number of open network connections with the neighboring server.
*/
public final Long connectionsCount() {
return connectionsCount;
}
@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(sourceServerId());
hashCode = 31 * hashCode + Objects.hashCode(destinationServerId());
hashCode = 31 * hashCode + Objects.hashCode(destinationPort());
hashCode = 31 * hashCode + Objects.hashCode(transportProtocol());
hashCode = 31 * hashCode + Objects.hashCode(connectionsCount());
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 NeighborConnectionDetail)) {
return false;
}
NeighborConnectionDetail other = (NeighborConnectionDetail) obj;
return Objects.equals(sourceServerId(), other.sourceServerId())
&& Objects.equals(destinationServerId(), other.destinationServerId())
&& Objects.equals(destinationPort(), other.destinationPort())
&& Objects.equals(transportProtocol(), other.transportProtocol())
&& Objects.equals(connectionsCount(), other.connectionsCount());
}
/**
* 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("NeighborConnectionDetail").add("SourceServerId", sourceServerId())
.add("DestinationServerId", destinationServerId()).add("DestinationPort", destinationPort())
.add("TransportProtocol", transportProtocol()).add("ConnectionsCount", connectionsCount()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "sourceServerId":
return Optional.ofNullable(clazz.cast(sourceServerId()));
case "destinationServerId":
return Optional.ofNullable(clazz.cast(destinationServerId()));
case "destinationPort":
return Optional.ofNullable(clazz.cast(destinationPort()));
case "transportProtocol":
return Optional.ofNullable(clazz.cast(transportProtocol()));
case "connectionsCount":
return Optional.ofNullable(clazz.cast(connectionsCount()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
@Override
public final Map> sdkFieldNameToField() {
return SDK_NAME_TO_FIELD;
}
private static Map> memberNameToFieldInitializer() {
Map> map = new HashMap<>();
map.put("sourceServerId", SOURCE_SERVER_ID_FIELD);
map.put("destinationServerId", DESTINATION_SERVER_ID_FIELD);
map.put("destinationPort", DESTINATION_PORT_FIELD);
map.put("transportProtocol", TRANSPORT_PROTOCOL_FIELD);
map.put("connectionsCount", CONNECTIONS_COUNT_FIELD);
return Collections.unmodifiableMap(map);
}
private static Function
© 2015 - 2025 Weber Informatics LLC | Privacy Policy