software.amazon.awssdk.services.directory.model.IpRouteInfo Maven / Gradle / Ivy
Show all versions of directory 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.directory.model;
import java.beans.Transient;
import java.io.Serializable;
import java.time.Instant;
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;
/**
*
* Information about one or more IP address blocks.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class IpRouteInfo implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField DIRECTORY_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("DirectoryId").getter(getter(IpRouteInfo::directoryId)).setter(setter(Builder::directoryId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DirectoryId").build()).build();
private static final SdkField CIDR_IP_FIELD = SdkField. builder(MarshallingType.STRING).memberName("CidrIp")
.getter(getter(IpRouteInfo::cidrIp)).setter(setter(Builder::cidrIp))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CidrIp").build()).build();
private static final SdkField IP_ROUTE_STATUS_MSG_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("IpRouteStatusMsg").getter(getter(IpRouteInfo::ipRouteStatusMsgAsString))
.setter(setter(Builder::ipRouteStatusMsg))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("IpRouteStatusMsg").build()).build();
private static final SdkField ADDED_DATE_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("AddedDateTime").getter(getter(IpRouteInfo::addedDateTime)).setter(setter(Builder::addedDateTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AddedDateTime").build()).build();
private static final SdkField IP_ROUTE_STATUS_REASON_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("IpRouteStatusReason").getter(getter(IpRouteInfo::ipRouteStatusReason))
.setter(setter(Builder::ipRouteStatusReason))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("IpRouteStatusReason").build())
.build();
private static final SdkField DESCRIPTION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("Description").getter(getter(IpRouteInfo::description)).setter(setter(Builder::description))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Description").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(DIRECTORY_ID_FIELD,
CIDR_IP_FIELD, IP_ROUTE_STATUS_MSG_FIELD, ADDED_DATE_TIME_FIELD, IP_ROUTE_STATUS_REASON_FIELD, DESCRIPTION_FIELD));
private static final long serialVersionUID = 1L;
private final String directoryId;
private final String cidrIp;
private final String ipRouteStatusMsg;
private final Instant addedDateTime;
private final String ipRouteStatusReason;
private final String description;
private IpRouteInfo(BuilderImpl builder) {
this.directoryId = builder.directoryId;
this.cidrIp = builder.cidrIp;
this.ipRouteStatusMsg = builder.ipRouteStatusMsg;
this.addedDateTime = builder.addedDateTime;
this.ipRouteStatusReason = builder.ipRouteStatusReason;
this.description = builder.description;
}
/**
*
* Identifier (ID) of the directory associated with the IP addresses.
*
*
* @return Identifier (ID) of the directory associated with the IP addresses.
*/
public final String directoryId() {
return directoryId;
}
/**
*
* IP address block in the IpRoute.
*
*
* @return IP address block in the IpRoute.
*/
public final String cidrIp() {
return cidrIp;
}
/**
*
* The status of the IP address block.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #ipRouteStatusMsg}
* will return {@link IpRouteStatusMsg#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #ipRouteStatusMsgAsString}.
*
*
* @return The status of the IP address block.
* @see IpRouteStatusMsg
*/
public final IpRouteStatusMsg ipRouteStatusMsg() {
return IpRouteStatusMsg.fromValue(ipRouteStatusMsg);
}
/**
*
* The status of the IP address block.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #ipRouteStatusMsg}
* will return {@link IpRouteStatusMsg#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #ipRouteStatusMsgAsString}.
*
*
* @return The status of the IP address block.
* @see IpRouteStatusMsg
*/
public final String ipRouteStatusMsgAsString() {
return ipRouteStatusMsg;
}
/**
*
* The date and time the address block was added to the directory.
*
*
* @return The date and time the address block was added to the directory.
*/
public final Instant addedDateTime() {
return addedDateTime;
}
/**
*
* The reason for the IpRouteStatusMsg.
*
*
* @return The reason for the IpRouteStatusMsg.
*/
public final String ipRouteStatusReason() {
return ipRouteStatusReason;
}
/**
*
* Description of the IpRouteInfo.
*
*
* @return Description of the IpRouteInfo.
*/
public final String description() {
return description;
}
@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(directoryId());
hashCode = 31 * hashCode + Objects.hashCode(cidrIp());
hashCode = 31 * hashCode + Objects.hashCode(ipRouteStatusMsgAsString());
hashCode = 31 * hashCode + Objects.hashCode(addedDateTime());
hashCode = 31 * hashCode + Objects.hashCode(ipRouteStatusReason());
hashCode = 31 * hashCode + Objects.hashCode(description());
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 IpRouteInfo)) {
return false;
}
IpRouteInfo other = (IpRouteInfo) obj;
return Objects.equals(directoryId(), other.directoryId()) && Objects.equals(cidrIp(), other.cidrIp())
&& Objects.equals(ipRouteStatusMsgAsString(), other.ipRouteStatusMsgAsString())
&& Objects.equals(addedDateTime(), other.addedDateTime())
&& Objects.equals(ipRouteStatusReason(), other.ipRouteStatusReason())
&& Objects.equals(description(), other.description());
}
/**
* 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("IpRouteInfo").add("DirectoryId", directoryId()).add("CidrIp", cidrIp())
.add("IpRouteStatusMsg", ipRouteStatusMsgAsString()).add("AddedDateTime", addedDateTime())
.add("IpRouteStatusReason", ipRouteStatusReason()).add("Description", description()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "DirectoryId":
return Optional.ofNullable(clazz.cast(directoryId()));
case "CidrIp":
return Optional.ofNullable(clazz.cast(cidrIp()));
case "IpRouteStatusMsg":
return Optional.ofNullable(clazz.cast(ipRouteStatusMsgAsString()));
case "AddedDateTime":
return Optional.ofNullable(clazz.cast(addedDateTime()));
case "IpRouteStatusReason":
return Optional.ofNullable(clazz.cast(ipRouteStatusReason()));
case "Description":
return Optional.ofNullable(clazz.cast(description()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function