
software.amazon.awssdk.services.directconnect.model.VirtualInterfaceTestHistory 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.directconnect.model;
import java.io.Serializable;
import java.time.Instant;
import java.util.Arrays;
import java.util.Collection;
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.ListTrait;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.core.util.SdkAutoConstructList;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* Information about the virtual interface failover test.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class VirtualInterfaceTestHistory implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField TEST_ID_FIELD = SdkField. builder(MarshallingType.STRING).memberName("testId")
.getter(getter(VirtualInterfaceTestHistory::testId)).setter(setter(Builder::testId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("testId").build()).build();
private static final SdkField VIRTUAL_INTERFACE_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("virtualInterfaceId").getter(getter(VirtualInterfaceTestHistory::virtualInterfaceId))
.setter(setter(Builder::virtualInterfaceId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("virtualInterfaceId").build())
.build();
private static final SdkField> BGP_PEERS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("bgpPeers")
.getter(getter(VirtualInterfaceTestHistory::bgpPeers))
.setter(setter(Builder::bgpPeers))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("bgpPeers").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.STRING)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField STATUS_FIELD = SdkField. builder(MarshallingType.STRING).memberName("status")
.getter(getter(VirtualInterfaceTestHistory::status)).setter(setter(Builder::status))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("status").build()).build();
private static final SdkField OWNER_ACCOUNT_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ownerAccount").getter(getter(VirtualInterfaceTestHistory::ownerAccount))
.setter(setter(Builder::ownerAccount))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ownerAccount").build()).build();
private static final SdkField TEST_DURATION_IN_MINUTES_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("testDurationInMinutes").getter(getter(VirtualInterfaceTestHistory::testDurationInMinutes))
.setter(setter(Builder::testDurationInMinutes))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("testDurationInMinutes").build())
.build();
private static final SdkField START_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("startTime").getter(getter(VirtualInterfaceTestHistory::startTime)).setter(setter(Builder::startTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("startTime").build()).build();
private static final SdkField END_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("endTime").getter(getter(VirtualInterfaceTestHistory::endTime)).setter(setter(Builder::endTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("endTime").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(TEST_ID_FIELD,
VIRTUAL_INTERFACE_ID_FIELD, BGP_PEERS_FIELD, STATUS_FIELD, OWNER_ACCOUNT_FIELD, TEST_DURATION_IN_MINUTES_FIELD,
START_TIME_FIELD, END_TIME_FIELD));
private static final long serialVersionUID = 1L;
private final String testId;
private final String virtualInterfaceId;
private final List bgpPeers;
private final String status;
private final String ownerAccount;
private final Integer testDurationInMinutes;
private final Instant startTime;
private final Instant endTime;
private VirtualInterfaceTestHistory(BuilderImpl builder) {
this.testId = builder.testId;
this.virtualInterfaceId = builder.virtualInterfaceId;
this.bgpPeers = builder.bgpPeers;
this.status = builder.status;
this.ownerAccount = builder.ownerAccount;
this.testDurationInMinutes = builder.testDurationInMinutes;
this.startTime = builder.startTime;
this.endTime = builder.endTime;
}
/**
*
* The ID of the virtual interface failover test.
*
*
* @return The ID of the virtual interface failover test.
*/
public final String testId() {
return testId;
}
/**
*
* The ID of the tested virtual interface.
*
*
* @return The ID of the tested virtual interface.
*/
public final String virtualInterfaceId() {
return virtualInterfaceId;
}
/**
* Returns true if the BgpPeers property was specified by the sender (it may be empty), or false if the sender did
* not specify the value (it will be empty). For responses returned by the SDK, the sender is the AWS service.
*/
public final boolean hasBgpPeers() {
return bgpPeers != null && !(bgpPeers instanceof SdkAutoConstructList);
}
/**
*
* The BGP peers that were put in the DOWN state as part of the virtual interface failover test.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* You can use {@link #hasBgpPeers()} to see if a value was sent in this field.
*
*
* @return The BGP peers that were put in the DOWN state as part of the virtual interface failover test.
*/
public final List bgpPeers() {
return bgpPeers;
}
/**
*
* The status of the virtual interface failover test.
*
*
* @return The status of the virtual interface failover test.
*/
public final String status() {
return status;
}
/**
*
* The owner ID of the tested virtual interface.
*
*
* @return The owner ID of the tested virtual interface.
*/
public final String ownerAccount() {
return ownerAccount;
}
/**
*
* The time that the virtual interface failover test ran in minutes.
*
*
* @return The time that the virtual interface failover test ran in minutes.
*/
public final Integer testDurationInMinutes() {
return testDurationInMinutes;
}
/**
*
* The time that the virtual interface moves to the DOWN state.
*
*
* @return The time that the virtual interface moves to the DOWN state.
*/
public final Instant startTime() {
return startTime;
}
/**
*
* The time that the virtual interface moves out of the DOWN state.
*
*
* @return The time that the virtual interface moves out of the DOWN state.
*/
public final Instant endTime() {
return endTime;
}
@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(testId());
hashCode = 31 * hashCode + Objects.hashCode(virtualInterfaceId());
hashCode = 31 * hashCode + Objects.hashCode(hasBgpPeers() ? bgpPeers() : null);
hashCode = 31 * hashCode + Objects.hashCode(status());
hashCode = 31 * hashCode + Objects.hashCode(ownerAccount());
hashCode = 31 * hashCode + Objects.hashCode(testDurationInMinutes());
hashCode = 31 * hashCode + Objects.hashCode(startTime());
hashCode = 31 * hashCode + Objects.hashCode(endTime());
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 VirtualInterfaceTestHistory)) {
return false;
}
VirtualInterfaceTestHistory other = (VirtualInterfaceTestHistory) obj;
return Objects.equals(testId(), other.testId()) && Objects.equals(virtualInterfaceId(), other.virtualInterfaceId())
&& hasBgpPeers() == other.hasBgpPeers() && Objects.equals(bgpPeers(), other.bgpPeers())
&& Objects.equals(status(), other.status()) && Objects.equals(ownerAccount(), other.ownerAccount())
&& Objects.equals(testDurationInMinutes(), other.testDurationInMinutes())
&& Objects.equals(startTime(), other.startTime()) && Objects.equals(endTime(), other.endTime());
}
/**
* 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("VirtualInterfaceTestHistory").add("TestId", testId())
.add("VirtualInterfaceId", virtualInterfaceId()).add("BgpPeers", hasBgpPeers() ? bgpPeers() : null)
.add("Status", status()).add("OwnerAccount", ownerAccount())
.add("TestDurationInMinutes", testDurationInMinutes()).add("StartTime", startTime()).add("EndTime", endTime())
.build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "testId":
return Optional.ofNullable(clazz.cast(testId()));
case "virtualInterfaceId":
return Optional.ofNullable(clazz.cast(virtualInterfaceId()));
case "bgpPeers":
return Optional.ofNullable(clazz.cast(bgpPeers()));
case "status":
return Optional.ofNullable(clazz.cast(status()));
case "ownerAccount":
return Optional.ofNullable(clazz.cast(ownerAccount()));
case "testDurationInMinutes":
return Optional.ofNullable(clazz.cast(testDurationInMinutes()));
case "startTime":
return Optional.ofNullable(clazz.cast(startTime()));
case "endTime":
return Optional.ofNullable(clazz.cast(endTime()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function