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

software.amazon.awssdk.services.ec2.model.ScheduledInstancesBlockDeviceMapping 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.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 block device mapping for a Scheduled Instance. *

*/ @Generated("software.amazon.awssdk:codegen") public final class ScheduledInstancesBlockDeviceMapping implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField DEVICE_NAME_FIELD = SdkField . builder(MarshallingType.STRING) .memberName("DeviceName") .getter(getter(ScheduledInstancesBlockDeviceMapping::deviceName)) .setter(setter(Builder::deviceName)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DeviceName") .unmarshallLocationName("DeviceName").build()).build(); private static final SdkField EBS_FIELD = SdkField . builder(MarshallingType.SDK_POJO) .memberName("Ebs") .getter(getter(ScheduledInstancesBlockDeviceMapping::ebs)) .setter(setter(Builder::ebs)) .constructor(ScheduledInstancesEbs::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Ebs").unmarshallLocationName("Ebs") .build()).build(); private static final SdkField NO_DEVICE_FIELD = SdkField . builder(MarshallingType.STRING) .memberName("NoDevice") .getter(getter(ScheduledInstancesBlockDeviceMapping::noDevice)) .setter(setter(Builder::noDevice)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("NoDevice") .unmarshallLocationName("NoDevice").build()).build(); private static final SdkField VIRTUAL_NAME_FIELD = SdkField . builder(MarshallingType.STRING) .memberName("VirtualName") .getter(getter(ScheduledInstancesBlockDeviceMapping::virtualName)) .setter(setter(Builder::virtualName)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("VirtualName") .unmarshallLocationName("VirtualName").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(DEVICE_NAME_FIELD, EBS_FIELD, NO_DEVICE_FIELD, VIRTUAL_NAME_FIELD)); private static final long serialVersionUID = 1L; private final String deviceName; private final ScheduledInstancesEbs ebs; private final String noDevice; private final String virtualName; private ScheduledInstancesBlockDeviceMapping(BuilderImpl builder) { this.deviceName = builder.deviceName; this.ebs = builder.ebs; this.noDevice = builder.noDevice; this.virtualName = builder.virtualName; } /** *

* The device name (for example, /dev/sdh or xvdh). *

* * @return The device name (for example, /dev/sdh or xvdh). */ public String deviceName() { return deviceName; } /** *

* Parameters used to set up EBS volumes automatically when the instance is launched. *

* * @return Parameters used to set up EBS volumes automatically when the instance is launched. */ public ScheduledInstancesEbs ebs() { return ebs; } /** *

* Suppresses the specified device included in the block device mapping of the AMI. *

* * @return Suppresses the specified device included in the block device mapping of the AMI. */ public String noDevice() { return noDevice; } /** *

* The virtual device name (ephemeralN). Instance store volumes are numbered starting from 0. An * instance type with two available instance store volumes can specify mappings for ephemeral0 and * ephemeral1. The number of available instance store volumes depends on the instance type. After you * connect to the instance, you must mount the volume. *

*

* Constraints: For M3 instances, you must specify instance store volumes in the block device mapping for the * instance. When you launch an M3 instance, we ignore any instance store volumes specified in the block device * mapping for the AMI. *

* * @return The virtual device name (ephemeralN). Instance store volumes are numbered starting from 0. * An instance type with two available instance store volumes can specify mappings for * ephemeral0 and ephemeral1. The number of available instance store volumes * depends on the instance type. After you connect to the instance, you must mount the volume.

*

* Constraints: For M3 instances, you must specify instance store volumes in the block device mapping for * the instance. When you launch an M3 instance, we ignore any instance store volumes specified in the block * device mapping for the AMI. */ public String virtualName() { return virtualName; } @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(deviceName()); hashCode = 31 * hashCode + Objects.hashCode(ebs()); hashCode = 31 * hashCode + Objects.hashCode(noDevice()); hashCode = 31 * hashCode + Objects.hashCode(virtualName()); 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 ScheduledInstancesBlockDeviceMapping)) { return false; } ScheduledInstancesBlockDeviceMapping other = (ScheduledInstancesBlockDeviceMapping) obj; return Objects.equals(deviceName(), other.deviceName()) && Objects.equals(ebs(), other.ebs()) && Objects.equals(noDevice(), other.noDevice()) && Objects.equals(virtualName(), other.virtualName()); } /** * 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("ScheduledInstancesBlockDeviceMapping").add("DeviceName", deviceName()).add("Ebs", ebs()) .add("NoDevice", noDevice()).add("VirtualName", virtualName()).build(); } public Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "DeviceName": return Optional.ofNullable(clazz.cast(deviceName())); case "Ebs": return Optional.ofNullable(clazz.cast(ebs())); case "NoDevice": return Optional.ofNullable(clazz.cast(noDevice())); case "VirtualName": return Optional.ofNullable(clazz.cast(virtualName())); default: return Optional.empty(); } } @Override public List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((ScheduledInstancesBlockDeviceMapping) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The device name (for example, /dev/sdh or xvdh). *

* * @param deviceName * The device name (for example, /dev/sdh or xvdh). * @return Returns a reference to this object so that method calls can be chained together. */ Builder deviceName(String deviceName); /** *

* Parameters used to set up EBS volumes automatically when the instance is launched. *

* * @param ebs * Parameters used to set up EBS volumes automatically when the instance is launched. * @return Returns a reference to this object so that method calls can be chained together. */ Builder ebs(ScheduledInstancesEbs ebs); /** *

* Parameters used to set up EBS volumes automatically when the instance is launched. *

* This is a convenience that creates an instance of the {@link ScheduledInstancesEbs.Builder} avoiding the need * to create one manually via {@link ScheduledInstancesEbs#builder()}. * * When the {@link Consumer} completes, {@link ScheduledInstancesEbs.Builder#build()} is called immediately and * its result is passed to {@link #ebs(ScheduledInstancesEbs)}. * * @param ebs * a consumer that will call methods on {@link ScheduledInstancesEbs.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #ebs(ScheduledInstancesEbs) */ default Builder ebs(Consumer ebs) { return ebs(ScheduledInstancesEbs.builder().applyMutation(ebs).build()); } /** *

* Suppresses the specified device included in the block device mapping of the AMI. *

* * @param noDevice * Suppresses the specified device included in the block device mapping of the AMI. * @return Returns a reference to this object so that method calls can be chained together. */ Builder noDevice(String noDevice); /** *

* The virtual device name (ephemeralN). Instance store volumes are numbered starting from 0. An * instance type with two available instance store volumes can specify mappings for ephemeral0 and * ephemeral1. The number of available instance store volumes depends on the instance type. After * you connect to the instance, you must mount the volume. *

*

* Constraints: For M3 instances, you must specify instance store volumes in the block device mapping for the * instance. When you launch an M3 instance, we ignore any instance store volumes specified in the block device * mapping for the AMI. *

* * @param virtualName * The virtual device name (ephemeralN). Instance store volumes are numbered starting from * 0. An instance type with two available instance store volumes can specify mappings for * ephemeral0 and ephemeral1. The number of available instance store volumes * depends on the instance type. After you connect to the instance, you must mount the volume.

*

* Constraints: For M3 instances, you must specify instance store volumes in the block device mapping for * the instance. When you launch an M3 instance, we ignore any instance store volumes specified in the * block device mapping for the AMI. * @return Returns a reference to this object so that method calls can be chained together. */ Builder virtualName(String virtualName); } static final class BuilderImpl implements Builder { private String deviceName; private ScheduledInstancesEbs ebs; private String noDevice; private String virtualName; private BuilderImpl() { } private BuilderImpl(ScheduledInstancesBlockDeviceMapping model) { deviceName(model.deviceName); ebs(model.ebs); noDevice(model.noDevice); virtualName(model.virtualName); } public final String getDeviceName() { return deviceName; } @Override public final Builder deviceName(String deviceName) { this.deviceName = deviceName; return this; } public final void setDeviceName(String deviceName) { this.deviceName = deviceName; } public final ScheduledInstancesEbs.Builder getEbs() { return ebs != null ? ebs.toBuilder() : null; } @Override public final Builder ebs(ScheduledInstancesEbs ebs) { this.ebs = ebs; return this; } public final void setEbs(ScheduledInstancesEbs.BuilderImpl ebs) { this.ebs = ebs != null ? ebs.build() : null; } public final String getNoDevice() { return noDevice; } @Override public final Builder noDevice(String noDevice) { this.noDevice = noDevice; return this; } public final void setNoDevice(String noDevice) { this.noDevice = noDevice; } public final String getVirtualName() { return virtualName; } @Override public final Builder virtualName(String virtualName) { this.virtualName = virtualName; return this; } public final void setVirtualName(String virtualName) { this.virtualName = virtualName; } @Override public ScheduledInstancesBlockDeviceMapping build() { return new ScheduledInstancesBlockDeviceMapping(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy