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

software.amazon.awssdk.services.ec2.model.NetworkInterfaceAttachment Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Amazon EC2 module holds the client classes that are used for communicating with Amazon EC2 Service

The newest version!
/*
 * 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.ec2.model;

import java.io.Serializable;
import java.time.Instant;
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.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;

/**
 * 

* Describes a network interface attachment. *

*/ @Generated("software.amazon.awssdk:codegen") public final class NetworkInterfaceAttachment implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField ATTACH_TIME_FIELD = SdkField . builder(MarshallingType.INSTANT) .memberName("AttachTime") .getter(getter(NetworkInterfaceAttachment::attachTime)) .setter(setter(Builder::attachTime)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AttachTime") .unmarshallLocationName("attachTime").build()).build(); private static final SdkField ATTACHMENT_ID_FIELD = SdkField . builder(MarshallingType.STRING) .memberName("AttachmentId") .getter(getter(NetworkInterfaceAttachment::attachmentId)) .setter(setter(Builder::attachmentId)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AttachmentId") .unmarshallLocationName("attachmentId").build()).build(); private static final SdkField DELETE_ON_TERMINATION_FIELD = SdkField . builder(MarshallingType.BOOLEAN) .memberName("DeleteOnTermination") .getter(getter(NetworkInterfaceAttachment::deleteOnTermination)) .setter(setter(Builder::deleteOnTermination)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DeleteOnTermination") .unmarshallLocationName("deleteOnTermination").build()).build(); private static final SdkField DEVICE_INDEX_FIELD = SdkField . builder(MarshallingType.INTEGER) .memberName("DeviceIndex") .getter(getter(NetworkInterfaceAttachment::deviceIndex)) .setter(setter(Builder::deviceIndex)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DeviceIndex") .unmarshallLocationName("deviceIndex").build()).build(); private static final SdkField NETWORK_CARD_INDEX_FIELD = SdkField . builder(MarshallingType.INTEGER) .memberName("NetworkCardIndex") .getter(getter(NetworkInterfaceAttachment::networkCardIndex)) .setter(setter(Builder::networkCardIndex)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("NetworkCardIndex") .unmarshallLocationName("networkCardIndex").build()).build(); private static final SdkField INSTANCE_ID_FIELD = SdkField . builder(MarshallingType.STRING) .memberName("InstanceId") .getter(getter(NetworkInterfaceAttachment::instanceId)) .setter(setter(Builder::instanceId)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("InstanceId") .unmarshallLocationName("instanceId").build()).build(); private static final SdkField INSTANCE_OWNER_ID_FIELD = SdkField . builder(MarshallingType.STRING) .memberName("InstanceOwnerId") .getter(getter(NetworkInterfaceAttachment::instanceOwnerId)) .setter(setter(Builder::instanceOwnerId)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("InstanceOwnerId") .unmarshallLocationName("instanceOwnerId").build()).build(); private static final SdkField STATUS_FIELD = SdkField . builder(MarshallingType.STRING) .memberName("Status") .getter(getter(NetworkInterfaceAttachment::statusAsString)) .setter(setter(Builder::status)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Status") .unmarshallLocationName("status").build()).build(); private static final SdkField ENA_SRD_SPECIFICATION_FIELD = SdkField . builder(MarshallingType.SDK_POJO) .memberName("EnaSrdSpecification") .getter(getter(NetworkInterfaceAttachment::enaSrdSpecification)) .setter(setter(Builder::enaSrdSpecification)) .constructor(AttachmentEnaSrdSpecification::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EnaSrdSpecification") .unmarshallLocationName("enaSrdSpecification").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ATTACH_TIME_FIELD, ATTACHMENT_ID_FIELD, DELETE_ON_TERMINATION_FIELD, DEVICE_INDEX_FIELD, NETWORK_CARD_INDEX_FIELD, INSTANCE_ID_FIELD, INSTANCE_OWNER_ID_FIELD, STATUS_FIELD, ENA_SRD_SPECIFICATION_FIELD)); private static final Map> SDK_NAME_TO_FIELD = Collections .unmodifiableMap(new HashMap>() { { put("AttachTime", ATTACH_TIME_FIELD); put("AttachmentId", ATTACHMENT_ID_FIELD); put("DeleteOnTermination", DELETE_ON_TERMINATION_FIELD); put("DeviceIndex", DEVICE_INDEX_FIELD); put("NetworkCardIndex", NETWORK_CARD_INDEX_FIELD); put("InstanceId", INSTANCE_ID_FIELD); put("InstanceOwnerId", INSTANCE_OWNER_ID_FIELD); put("Status", STATUS_FIELD); put("EnaSrdSpecification", ENA_SRD_SPECIFICATION_FIELD); } }); private static final long serialVersionUID = 1L; private final Instant attachTime; private final String attachmentId; private final Boolean deleteOnTermination; private final Integer deviceIndex; private final Integer networkCardIndex; private final String instanceId; private final String instanceOwnerId; private final String status; private final AttachmentEnaSrdSpecification enaSrdSpecification; private NetworkInterfaceAttachment(BuilderImpl builder) { this.attachTime = builder.attachTime; this.attachmentId = builder.attachmentId; this.deleteOnTermination = builder.deleteOnTermination; this.deviceIndex = builder.deviceIndex; this.networkCardIndex = builder.networkCardIndex; this.instanceId = builder.instanceId; this.instanceOwnerId = builder.instanceOwnerId; this.status = builder.status; this.enaSrdSpecification = builder.enaSrdSpecification; } /** *

* The timestamp indicating when the attachment initiated. *

* * @return The timestamp indicating when the attachment initiated. */ public final Instant attachTime() { return attachTime; } /** *

* The ID of the network interface attachment. *

* * @return The ID of the network interface attachment. */ public final String attachmentId() { return attachmentId; } /** *

* Indicates whether the network interface is deleted when the instance is terminated. *

* * @return Indicates whether the network interface is deleted when the instance is terminated. */ public final Boolean deleteOnTermination() { return deleteOnTermination; } /** *

* The device index of the network interface attachment on the instance. *

* * @return The device index of the network interface attachment on the instance. */ public final Integer deviceIndex() { return deviceIndex; } /** *

* The index of the network card. *

* * @return The index of the network card. */ public final Integer networkCardIndex() { return networkCardIndex; } /** *

* The ID of the instance. *

* * @return The ID of the instance. */ public final String instanceId() { return instanceId; } /** *

* The Amazon Web Services account ID of the owner of the instance. *

* * @return The Amazon Web Services account ID of the owner of the instance. */ public final String instanceOwnerId() { return instanceOwnerId; } /** *

* The attachment state. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #status} will * return {@link AttachmentStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from * {@link #statusAsString}. *

* * @return The attachment state. * @see AttachmentStatus */ public final AttachmentStatus status() { return AttachmentStatus.fromValue(status); } /** *

* The attachment state. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #status} will * return {@link AttachmentStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from * {@link #statusAsString}. *

* * @return The attachment state. * @see AttachmentStatus */ public final String statusAsString() { return status; } /** *

* Configures ENA Express for the network interface that this action attaches to the instance. *

* * @return Configures ENA Express for the network interface that this action attaches to the instance. */ public final AttachmentEnaSrdSpecification enaSrdSpecification() { return enaSrdSpecification; } @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(attachTime()); hashCode = 31 * hashCode + Objects.hashCode(attachmentId()); hashCode = 31 * hashCode + Objects.hashCode(deleteOnTermination()); hashCode = 31 * hashCode + Objects.hashCode(deviceIndex()); hashCode = 31 * hashCode + Objects.hashCode(networkCardIndex()); hashCode = 31 * hashCode + Objects.hashCode(instanceId()); hashCode = 31 * hashCode + Objects.hashCode(instanceOwnerId()); hashCode = 31 * hashCode + Objects.hashCode(statusAsString()); hashCode = 31 * hashCode + Objects.hashCode(enaSrdSpecification()); 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 NetworkInterfaceAttachment)) { return false; } NetworkInterfaceAttachment other = (NetworkInterfaceAttachment) obj; return Objects.equals(attachTime(), other.attachTime()) && Objects.equals(attachmentId(), other.attachmentId()) && Objects.equals(deleteOnTermination(), other.deleteOnTermination()) && Objects.equals(deviceIndex(), other.deviceIndex()) && Objects.equals(networkCardIndex(), other.networkCardIndex()) && Objects.equals(instanceId(), other.instanceId()) && Objects.equals(instanceOwnerId(), other.instanceOwnerId()) && Objects.equals(statusAsString(), other.statusAsString()) && Objects.equals(enaSrdSpecification(), other.enaSrdSpecification()); } /** * 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("NetworkInterfaceAttachment").add("AttachTime", attachTime()).add("AttachmentId", attachmentId()) .add("DeleteOnTermination", deleteOnTermination()).add("DeviceIndex", deviceIndex()) .add("NetworkCardIndex", networkCardIndex()).add("InstanceId", instanceId()) .add("InstanceOwnerId", instanceOwnerId()).add("Status", statusAsString()) .add("EnaSrdSpecification", enaSrdSpecification()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "AttachTime": return Optional.ofNullable(clazz.cast(attachTime())); case "AttachmentId": return Optional.ofNullable(clazz.cast(attachmentId())); case "DeleteOnTermination": return Optional.ofNullable(clazz.cast(deleteOnTermination())); case "DeviceIndex": return Optional.ofNullable(clazz.cast(deviceIndex())); case "NetworkCardIndex": return Optional.ofNullable(clazz.cast(networkCardIndex())); case "InstanceId": return Optional.ofNullable(clazz.cast(instanceId())); case "InstanceOwnerId": return Optional.ofNullable(clazz.cast(instanceOwnerId())); case "Status": return Optional.ofNullable(clazz.cast(statusAsString())); case "EnaSrdSpecification": return Optional.ofNullable(clazz.cast(enaSrdSpecification())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } @Override public final Map> sdkFieldNameToField() { return SDK_NAME_TO_FIELD; } private static Function getter(Function g) { return obj -> g.apply((NetworkInterfaceAttachment) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The timestamp indicating when the attachment initiated. *

* * @param attachTime * The timestamp indicating when the attachment initiated. * @return Returns a reference to this object so that method calls can be chained together. */ Builder attachTime(Instant attachTime); /** *

* The ID of the network interface attachment. *

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

* Indicates whether the network interface is deleted when the instance is terminated. *

* * @param deleteOnTermination * Indicates whether the network interface is deleted when the instance is terminated. * @return Returns a reference to this object so that method calls can be chained together. */ Builder deleteOnTermination(Boolean deleteOnTermination); /** *

* The device index of the network interface attachment on the instance. *

* * @param deviceIndex * The device index of the network interface attachment on the instance. * @return Returns a reference to this object so that method calls can be chained together. */ Builder deviceIndex(Integer deviceIndex); /** *

* The index of the network card. *

* * @param networkCardIndex * The index of the network card. * @return Returns a reference to this object so that method calls can be chained together. */ Builder networkCardIndex(Integer networkCardIndex); /** *

* The ID of the instance. *

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

* The Amazon Web Services account ID of the owner of the instance. *

* * @param instanceOwnerId * The Amazon Web Services account ID of the owner of the instance. * @return Returns a reference to this object so that method calls can be chained together. */ Builder instanceOwnerId(String instanceOwnerId); /** *

* The attachment state. *

* * @param status * The attachment state. * @see AttachmentStatus * @return Returns a reference to this object so that method calls can be chained together. * @see AttachmentStatus */ Builder status(String status); /** *

* The attachment state. *

* * @param status * The attachment state. * @see AttachmentStatus * @return Returns a reference to this object so that method calls can be chained together. * @see AttachmentStatus */ Builder status(AttachmentStatus status); /** *

* Configures ENA Express for the network interface that this action attaches to the instance. *

* * @param enaSrdSpecification * Configures ENA Express for the network interface that this action attaches to the instance. * @return Returns a reference to this object so that method calls can be chained together. */ Builder enaSrdSpecification(AttachmentEnaSrdSpecification enaSrdSpecification); /** *

* Configures ENA Express for the network interface that this action attaches to the instance. *

* This is a convenience method that creates an instance of the {@link AttachmentEnaSrdSpecification.Builder} * avoiding the need to create one manually via {@link AttachmentEnaSrdSpecification#builder()}. * *

* When the {@link Consumer} completes, {@link AttachmentEnaSrdSpecification.Builder#build()} is called * immediately and its result is passed to {@link #enaSrdSpecification(AttachmentEnaSrdSpecification)}. * * @param enaSrdSpecification * a consumer that will call methods on {@link AttachmentEnaSrdSpecification.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #enaSrdSpecification(AttachmentEnaSrdSpecification) */ default Builder enaSrdSpecification(Consumer enaSrdSpecification) { return enaSrdSpecification(AttachmentEnaSrdSpecification.builder().applyMutation(enaSrdSpecification).build()); } } static final class BuilderImpl implements Builder { private Instant attachTime; private String attachmentId; private Boolean deleteOnTermination; private Integer deviceIndex; private Integer networkCardIndex; private String instanceId; private String instanceOwnerId; private String status; private AttachmentEnaSrdSpecification enaSrdSpecification; private BuilderImpl() { } private BuilderImpl(NetworkInterfaceAttachment model) { attachTime(model.attachTime); attachmentId(model.attachmentId); deleteOnTermination(model.deleteOnTermination); deviceIndex(model.deviceIndex); networkCardIndex(model.networkCardIndex); instanceId(model.instanceId); instanceOwnerId(model.instanceOwnerId); status(model.status); enaSrdSpecification(model.enaSrdSpecification); } public final Instant getAttachTime() { return attachTime; } public final void setAttachTime(Instant attachTime) { this.attachTime = attachTime; } @Override public final Builder attachTime(Instant attachTime) { this.attachTime = attachTime; return this; } public final String getAttachmentId() { return attachmentId; } public final void setAttachmentId(String attachmentId) { this.attachmentId = attachmentId; } @Override public final Builder attachmentId(String attachmentId) { this.attachmentId = attachmentId; return this; } public final Boolean getDeleteOnTermination() { return deleteOnTermination; } public final void setDeleteOnTermination(Boolean deleteOnTermination) { this.deleteOnTermination = deleteOnTermination; } @Override public final Builder deleteOnTermination(Boolean deleteOnTermination) { this.deleteOnTermination = deleteOnTermination; return this; } public final Integer getDeviceIndex() { return deviceIndex; } public final void setDeviceIndex(Integer deviceIndex) { this.deviceIndex = deviceIndex; } @Override public final Builder deviceIndex(Integer deviceIndex) { this.deviceIndex = deviceIndex; return this; } public final Integer getNetworkCardIndex() { return networkCardIndex; } public final void setNetworkCardIndex(Integer networkCardIndex) { this.networkCardIndex = networkCardIndex; } @Override public final Builder networkCardIndex(Integer networkCardIndex) { this.networkCardIndex = networkCardIndex; return this; } public final String getInstanceId() { return instanceId; } public final void setInstanceId(String instanceId) { this.instanceId = instanceId; } @Override public final Builder instanceId(String instanceId) { this.instanceId = instanceId; return this; } public final String getInstanceOwnerId() { return instanceOwnerId; } public final void setInstanceOwnerId(String instanceOwnerId) { this.instanceOwnerId = instanceOwnerId; } @Override public final Builder instanceOwnerId(String instanceOwnerId) { this.instanceOwnerId = instanceOwnerId; return this; } public final String getStatus() { return status; } public final void setStatus(String status) { this.status = status; } @Override public final Builder status(String status) { this.status = status; return this; } @Override public final Builder status(AttachmentStatus status) { this.status(status == null ? null : status.toString()); return this; } public final AttachmentEnaSrdSpecification.Builder getEnaSrdSpecification() { return enaSrdSpecification != null ? enaSrdSpecification.toBuilder() : null; } public final void setEnaSrdSpecification(AttachmentEnaSrdSpecification.BuilderImpl enaSrdSpecification) { this.enaSrdSpecification = enaSrdSpecification != null ? enaSrdSpecification.build() : null; } @Override public final Builder enaSrdSpecification(AttachmentEnaSrdSpecification enaSrdSpecification) { this.enaSrdSpecification = enaSrdSpecification; return this; } @Override public NetworkInterfaceAttachment build() { return new NetworkInterfaceAttachment(this); } @Override public List> sdkFields() { return SDK_FIELDS; } @Override public Map> sdkFieldNameToField() { return SDK_NAME_TO_FIELD; } } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy