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

software.amazon.awssdk.services.ec2.model.LaunchTemplateEbsBlockDevice 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.ec2.model;

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

/**
 * 

* Describes a block device for an EBS volume. *

*/ @Generated("software.amazon.awssdk:codegen") public final class LaunchTemplateEbsBlockDevice implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField ENCRYPTED_FIELD = SdkField . builder(MarshallingType.BOOLEAN) .memberName("Encrypted") .getter(getter(LaunchTemplateEbsBlockDevice::encrypted)) .setter(setter(Builder::encrypted)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Encrypted") .unmarshallLocationName("encrypted").build()).build(); private static final SdkField DELETE_ON_TERMINATION_FIELD = SdkField . builder(MarshallingType.BOOLEAN) .memberName("DeleteOnTermination") .getter(getter(LaunchTemplateEbsBlockDevice::deleteOnTermination)) .setter(setter(Builder::deleteOnTermination)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DeleteOnTermination") .unmarshallLocationName("deleteOnTermination").build()).build(); private static final SdkField IOPS_FIELD = SdkField . builder(MarshallingType.INTEGER) .memberName("Iops") .getter(getter(LaunchTemplateEbsBlockDevice::iops)) .setter(setter(Builder::iops)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Iops") .unmarshallLocationName("iops").build()).build(); private static final SdkField KMS_KEY_ID_FIELD = SdkField . builder(MarshallingType.STRING) .memberName("KmsKeyId") .getter(getter(LaunchTemplateEbsBlockDevice::kmsKeyId)) .setter(setter(Builder::kmsKeyId)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("KmsKeyId") .unmarshallLocationName("kmsKeyId").build()).build(); private static final SdkField SNAPSHOT_ID_FIELD = SdkField . builder(MarshallingType.STRING) .memberName("SnapshotId") .getter(getter(LaunchTemplateEbsBlockDevice::snapshotId)) .setter(setter(Builder::snapshotId)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SnapshotId") .unmarshallLocationName("snapshotId").build()).build(); private static final SdkField VOLUME_SIZE_FIELD = SdkField . builder(MarshallingType.INTEGER) .memberName("VolumeSize") .getter(getter(LaunchTemplateEbsBlockDevice::volumeSize)) .setter(setter(Builder::volumeSize)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("VolumeSize") .unmarshallLocationName("volumeSize").build()).build(); private static final SdkField VOLUME_TYPE_FIELD = SdkField . builder(MarshallingType.STRING) .memberName("VolumeType") .getter(getter(LaunchTemplateEbsBlockDevice::volumeTypeAsString)) .setter(setter(Builder::volumeType)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("VolumeType") .unmarshallLocationName("volumeType").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ENCRYPTED_FIELD, DELETE_ON_TERMINATION_FIELD, IOPS_FIELD, KMS_KEY_ID_FIELD, SNAPSHOT_ID_FIELD, VOLUME_SIZE_FIELD, VOLUME_TYPE_FIELD)); private static final long serialVersionUID = 1L; private final Boolean encrypted; private final Boolean deleteOnTermination; private final Integer iops; private final String kmsKeyId; private final String snapshotId; private final Integer volumeSize; private final String volumeType; private LaunchTemplateEbsBlockDevice(BuilderImpl builder) { this.encrypted = builder.encrypted; this.deleteOnTermination = builder.deleteOnTermination; this.iops = builder.iops; this.kmsKeyId = builder.kmsKeyId; this.snapshotId = builder.snapshotId; this.volumeSize = builder.volumeSize; this.volumeType = builder.volumeType; } /** *

* Indicates whether the EBS volume is encrypted. *

* * @return Indicates whether the EBS volume is encrypted. */ public Boolean encrypted() { return encrypted; } /** *

* Indicates whether the EBS volume is deleted on instance termination. *

* * @return Indicates whether the EBS volume is deleted on instance termination. */ public Boolean deleteOnTermination() { return deleteOnTermination; } /** *

* The number of I/O operations per second (IOPS) that the volume supports. *

* * @return The number of I/O operations per second (IOPS) that the volume supports. */ public Integer iops() { return iops; } /** *

* The ARN of the AWS Key Management Service (AWS KMS) CMK used for encryption. *

* * @return The ARN of the AWS Key Management Service (AWS KMS) CMK used for encryption. */ public String kmsKeyId() { return kmsKeyId; } /** *

* The ID of the snapshot. *

* * @return The ID of the snapshot. */ public String snapshotId() { return snapshotId; } /** *

* The size of the volume, in GiB. *

* * @return The size of the volume, in GiB. */ public Integer volumeSize() { return volumeSize; } /** *

* The volume type. *

*

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

* * @return The volume type. * @see VolumeType */ public VolumeType volumeType() { return VolumeType.fromValue(volumeType); } /** *

* The volume type. *

*

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

* * @return The volume type. * @see VolumeType */ public String volumeTypeAsString() { return volumeType; } @Override public Builder toBuilder() { return new BuilderImpl(this); } public static Builder builder() { return new BuilderImpl(); } public static Class serializableBuilderClass() { return BuilderImpl.class; } @Override public int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + Objects.hashCode(encrypted()); hashCode = 31 * hashCode + Objects.hashCode(deleteOnTermination()); hashCode = 31 * hashCode + Objects.hashCode(iops()); hashCode = 31 * hashCode + Objects.hashCode(kmsKeyId()); hashCode = 31 * hashCode + Objects.hashCode(snapshotId()); hashCode = 31 * hashCode + Objects.hashCode(volumeSize()); hashCode = 31 * hashCode + Objects.hashCode(volumeTypeAsString()); return hashCode; } @Override public boolean equals(Object obj) { return equalsBySdkFields(obj); } @Override public boolean equalsBySdkFields(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof LaunchTemplateEbsBlockDevice)) { return false; } LaunchTemplateEbsBlockDevice other = (LaunchTemplateEbsBlockDevice) obj; return Objects.equals(encrypted(), other.encrypted()) && Objects.equals(deleteOnTermination(), other.deleteOnTermination()) && Objects.equals(iops(), other.iops()) && Objects.equals(kmsKeyId(), other.kmsKeyId()) && Objects.equals(snapshotId(), other.snapshotId()) && Objects.equals(volumeSize(), other.volumeSize()) && Objects.equals(volumeTypeAsString(), other.volumeTypeAsString()); } /** * 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 String toString() { return ToString.builder("LaunchTemplateEbsBlockDevice").add("Encrypted", encrypted()) .add("DeleteOnTermination", deleteOnTermination()).add("Iops", iops()).add("KmsKeyId", kmsKeyId()) .add("SnapshotId", snapshotId()).add("VolumeSize", volumeSize()).add("VolumeType", volumeTypeAsString()).build(); } public Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "Encrypted": return Optional.ofNullable(clazz.cast(encrypted())); case "DeleteOnTermination": return Optional.ofNullable(clazz.cast(deleteOnTermination())); case "Iops": return Optional.ofNullable(clazz.cast(iops())); case "KmsKeyId": return Optional.ofNullable(clazz.cast(kmsKeyId())); case "SnapshotId": return Optional.ofNullable(clazz.cast(snapshotId())); case "VolumeSize": return Optional.ofNullable(clazz.cast(volumeSize())); case "VolumeType": return Optional.ofNullable(clazz.cast(volumeTypeAsString())); default: return Optional.empty(); } } @Override public List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((LaunchTemplateEbsBlockDevice) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* Indicates whether the EBS volume is encrypted. *

* * @param encrypted * Indicates whether the EBS volume is encrypted. * @return Returns a reference to this object so that method calls can be chained together. */ Builder encrypted(Boolean encrypted); /** *

* Indicates whether the EBS volume is deleted on instance termination. *

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

* The number of I/O operations per second (IOPS) that the volume supports. *

* * @param iops * The number of I/O operations per second (IOPS) that the volume supports. * @return Returns a reference to this object so that method calls can be chained together. */ Builder iops(Integer iops); /** *

* The ARN of the AWS Key Management Service (AWS KMS) CMK used for encryption. *

* * @param kmsKeyId * The ARN of the AWS Key Management Service (AWS KMS) CMK used for encryption. * @return Returns a reference to this object so that method calls can be chained together. */ Builder kmsKeyId(String kmsKeyId); /** *

* The ID of the snapshot. *

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

* The size of the volume, in GiB. *

* * @param volumeSize * The size of the volume, in GiB. * @return Returns a reference to this object so that method calls can be chained together. */ Builder volumeSize(Integer volumeSize); /** *

* The volume type. *

* * @param volumeType * The volume type. * @see VolumeType * @return Returns a reference to this object so that method calls can be chained together. * @see VolumeType */ Builder volumeType(String volumeType); /** *

* The volume type. *

* * @param volumeType * The volume type. * @see VolumeType * @return Returns a reference to this object so that method calls can be chained together. * @see VolumeType */ Builder volumeType(VolumeType volumeType); } static final class BuilderImpl implements Builder { private Boolean encrypted; private Boolean deleteOnTermination; private Integer iops; private String kmsKeyId; private String snapshotId; private Integer volumeSize; private String volumeType; private BuilderImpl() { } private BuilderImpl(LaunchTemplateEbsBlockDevice model) { encrypted(model.encrypted); deleteOnTermination(model.deleteOnTermination); iops(model.iops); kmsKeyId(model.kmsKeyId); snapshotId(model.snapshotId); volumeSize(model.volumeSize); volumeType(model.volumeType); } public final Boolean getEncrypted() { return encrypted; } @Override public final Builder encrypted(Boolean encrypted) { this.encrypted = encrypted; return this; } public final void setEncrypted(Boolean encrypted) { this.encrypted = encrypted; } public final Boolean getDeleteOnTermination() { return deleteOnTermination; } @Override public final Builder deleteOnTermination(Boolean deleteOnTermination) { this.deleteOnTermination = deleteOnTermination; return this; } public final void setDeleteOnTermination(Boolean deleteOnTermination) { this.deleteOnTermination = deleteOnTermination; } public final Integer getIops() { return iops; } @Override public final Builder iops(Integer iops) { this.iops = iops; return this; } public final void setIops(Integer iops) { this.iops = iops; } public final String getKmsKeyId() { return kmsKeyId; } @Override public final Builder kmsKeyId(String kmsKeyId) { this.kmsKeyId = kmsKeyId; return this; } public final void setKmsKeyId(String kmsKeyId) { this.kmsKeyId = kmsKeyId; } public final String getSnapshotId() { return snapshotId; } @Override public final Builder snapshotId(String snapshotId) { this.snapshotId = snapshotId; return this; } public final void setSnapshotId(String snapshotId) { this.snapshotId = snapshotId; } public final Integer getVolumeSize() { return volumeSize; } @Override public final Builder volumeSize(Integer volumeSize) { this.volumeSize = volumeSize; return this; } public final void setVolumeSize(Integer volumeSize) { this.volumeSize = volumeSize; } public final String getVolumeType() { return volumeType; } @Override public final Builder volumeType(String volumeType) { this.volumeType = volumeType; return this; } @Override public final Builder volumeType(VolumeType volumeType) { this.volumeType(volumeType == null ? null : volumeType.toString()); return this; } public final void setVolumeType(String volumeType) { this.volumeType = volumeType; } @Override public LaunchTemplateEbsBlockDevice build() { return new LaunchTemplateEbsBlockDevice(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy