All Downloads are FREE. Search and download functionalities are using the official Maven repository.

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 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 getter(Function g) { return obj -> g.apply((VirtualInterfaceTestHistory) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The ID of the virtual interface failover test. *

* * @param testId * The ID of the virtual interface failover test. * @return Returns a reference to this object so that method calls can be chained together. */ Builder testId(String testId); /** *

* The ID of the tested virtual interface. *

* * @param virtualInterfaceId * The ID of the tested virtual interface. * @return Returns a reference to this object so that method calls can be chained together. */ Builder virtualInterfaceId(String virtualInterfaceId); /** *

* The BGP peers that were put in the DOWN state as part of the virtual interface failover test. *

* * @param bgpPeers * The BGP peers that were put in the DOWN state as part of the virtual interface failover test. * @return Returns a reference to this object so that method calls can be chained together. */ Builder bgpPeers(Collection bgpPeers); /** *

* The BGP peers that were put in the DOWN state as part of the virtual interface failover test. *

* * @param bgpPeers * The BGP peers that were put in the DOWN state as part of the virtual interface failover test. * @return Returns a reference to this object so that method calls can be chained together. */ Builder bgpPeers(String... bgpPeers); /** *

* The status of the virtual interface failover test. *

* * @param status * The status of the virtual interface failover test. * @return Returns a reference to this object so that method calls can be chained together. */ Builder status(String status); /** *

* The owner ID of the tested virtual interface. *

* * @param ownerAccount * The owner ID of the tested virtual interface. * @return Returns a reference to this object so that method calls can be chained together. */ Builder ownerAccount(String ownerAccount); /** *

* The time that the virtual interface failover test ran in minutes. *

* * @param testDurationInMinutes * The time that the virtual interface failover test ran in minutes. * @return Returns a reference to this object so that method calls can be chained together. */ Builder testDurationInMinutes(Integer testDurationInMinutes); /** *

* The time that the virtual interface moves to the DOWN state. *

* * @param startTime * The time that the virtual interface moves to the DOWN state. * @return Returns a reference to this object so that method calls can be chained together. */ Builder startTime(Instant startTime); /** *

* The time that the virtual interface moves out of the DOWN state. *

* * @param endTime * The time that the virtual interface moves out of the DOWN state. * @return Returns a reference to this object so that method calls can be chained together. */ Builder endTime(Instant endTime); } static final class BuilderImpl implements Builder { private String testId; private String virtualInterfaceId; private List bgpPeers = DefaultSdkAutoConstructList.getInstance(); private String status; private String ownerAccount; private Integer testDurationInMinutes; private Instant startTime; private Instant endTime; private BuilderImpl() { } private BuilderImpl(VirtualInterfaceTestHistory model) { testId(model.testId); virtualInterfaceId(model.virtualInterfaceId); bgpPeers(model.bgpPeers); status(model.status); ownerAccount(model.ownerAccount); testDurationInMinutes(model.testDurationInMinutes); startTime(model.startTime); endTime(model.endTime); } public final String getTestId() { return testId; } @Override public final Builder testId(String testId) { this.testId = testId; return this; } public final void setTestId(String testId) { this.testId = testId; } public final String getVirtualInterfaceId() { return virtualInterfaceId; } @Override public final Builder virtualInterfaceId(String virtualInterfaceId) { this.virtualInterfaceId = virtualInterfaceId; return this; } public final void setVirtualInterfaceId(String virtualInterfaceId) { this.virtualInterfaceId = virtualInterfaceId; } public final Collection getBgpPeers() { if (bgpPeers instanceof SdkAutoConstructList) { return null; } return bgpPeers; } @Override public final Builder bgpPeers(Collection bgpPeers) { this.bgpPeers = BGPPeerIdListCopier.copy(bgpPeers); return this; } @Override @SafeVarargs public final Builder bgpPeers(String... bgpPeers) { bgpPeers(Arrays.asList(bgpPeers)); return this; } public final void setBgpPeers(Collection bgpPeers) { this.bgpPeers = BGPPeerIdListCopier.copy(bgpPeers); } public final String getStatus() { return status; } @Override public final Builder status(String status) { this.status = status; return this; } public final void setStatus(String status) { this.status = status; } public final String getOwnerAccount() { return ownerAccount; } @Override public final Builder ownerAccount(String ownerAccount) { this.ownerAccount = ownerAccount; return this; } public final void setOwnerAccount(String ownerAccount) { this.ownerAccount = ownerAccount; } public final Integer getTestDurationInMinutes() { return testDurationInMinutes; } @Override public final Builder testDurationInMinutes(Integer testDurationInMinutes) { this.testDurationInMinutes = testDurationInMinutes; return this; } public final void setTestDurationInMinutes(Integer testDurationInMinutes) { this.testDurationInMinutes = testDurationInMinutes; } public final Instant getStartTime() { return startTime; } @Override public final Builder startTime(Instant startTime) { this.startTime = startTime; return this; } public final void setStartTime(Instant startTime) { this.startTime = startTime; } public final Instant getEndTime() { return endTime; } @Override public final Builder endTime(Instant endTime) { this.endTime = endTime; return this; } public final void setEndTime(Instant endTime) { this.endTime = endTime; } @Override public VirtualInterfaceTestHistory build() { return new VirtualInterfaceTestHistory(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy