software.amazon.awssdk.services.opsworks.model.Volume Maven / Gradle / Ivy
Show all versions of opsworks Show documentation
/*
* 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.opsworks.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 an instance's Amazon EBS volume.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class Volume implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField VOLUME_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("VolumeId").getter(getter(Volume::volumeId)).setter(setter(Builder::volumeId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("VolumeId").build()).build();
private static final SdkField EC2_VOLUME_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("Ec2VolumeId").getter(getter(Volume::ec2VolumeId)).setter(setter(Builder::ec2VolumeId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Ec2VolumeId").build()).build();
private static final SdkField NAME_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Name")
.getter(getter(Volume::name)).setter(setter(Builder::name))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Name").build()).build();
private static final SdkField RAID_ARRAY_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("RaidArrayId").getter(getter(Volume::raidArrayId)).setter(setter(Builder::raidArrayId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("RaidArrayId").build()).build();
private static final SdkField INSTANCE_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("InstanceId").getter(getter(Volume::instanceId)).setter(setter(Builder::instanceId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("InstanceId").build()).build();
private static final SdkField STATUS_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Status")
.getter(getter(Volume::status)).setter(setter(Builder::status))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Status").build()).build();
private static final SdkField SIZE_FIELD = SdkField. builder(MarshallingType.INTEGER).memberName("Size")
.getter(getter(Volume::size)).setter(setter(Builder::size))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Size").build()).build();
private static final SdkField DEVICE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Device")
.getter(getter(Volume::device)).setter(setter(Builder::device))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Device").build()).build();
private static final SdkField MOUNT_POINT_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("MountPoint").getter(getter(Volume::mountPoint)).setter(setter(Builder::mountPoint))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MountPoint").build()).build();
private static final SdkField REGION_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Region")
.getter(getter(Volume::region)).setter(setter(Builder::region))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Region").build()).build();
private static final SdkField AVAILABILITY_ZONE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("AvailabilityZone").getter(getter(Volume::availabilityZone)).setter(setter(Builder::availabilityZone))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AvailabilityZone").build()).build();
private static final SdkField VOLUME_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("VolumeType").getter(getter(Volume::volumeType)).setter(setter(Builder::volumeType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("VolumeType").build()).build();
private static final SdkField IOPS_FIELD = SdkField. builder(MarshallingType.INTEGER).memberName("Iops")
.getter(getter(Volume::iops)).setter(setter(Builder::iops))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Iops").build()).build();
private static final SdkField ENCRYPTED_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("Encrypted").getter(getter(Volume::encrypted)).setter(setter(Builder::encrypted))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Encrypted").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(VOLUME_ID_FIELD,
EC2_VOLUME_ID_FIELD, NAME_FIELD, RAID_ARRAY_ID_FIELD, INSTANCE_ID_FIELD, STATUS_FIELD, SIZE_FIELD, DEVICE_FIELD,
MOUNT_POINT_FIELD, REGION_FIELD, AVAILABILITY_ZONE_FIELD, VOLUME_TYPE_FIELD, IOPS_FIELD, ENCRYPTED_FIELD));
private static final long serialVersionUID = 1L;
private final String volumeId;
private final String ec2VolumeId;
private final String name;
private final String raidArrayId;
private final String instanceId;
private final String status;
private final Integer size;
private final String device;
private final String mountPoint;
private final String region;
private final String availabilityZone;
private final String volumeType;
private final Integer iops;
private final Boolean encrypted;
private Volume(BuilderImpl builder) {
this.volumeId = builder.volumeId;
this.ec2VolumeId = builder.ec2VolumeId;
this.name = builder.name;
this.raidArrayId = builder.raidArrayId;
this.instanceId = builder.instanceId;
this.status = builder.status;
this.size = builder.size;
this.device = builder.device;
this.mountPoint = builder.mountPoint;
this.region = builder.region;
this.availabilityZone = builder.availabilityZone;
this.volumeType = builder.volumeType;
this.iops = builder.iops;
this.encrypted = builder.encrypted;
}
/**
*
* The volume ID.
*
*
* @return The volume ID.
*/
public final String volumeId() {
return volumeId;
}
/**
*
* The Amazon EC2 volume ID.
*
*
* @return The Amazon EC2 volume ID.
*/
public final String ec2VolumeId() {
return ec2VolumeId;
}
/**
*
* The volume name. Volume names are a maximum of 128 characters.
*
*
* @return The volume name. Volume names are a maximum of 128 characters.
*/
public final String name() {
return name;
}
/**
*
* The RAID array ID.
*
*
* @return The RAID array ID.
*/
public final String raidArrayId() {
return raidArrayId;
}
/**
*
* The instance ID.
*
*
* @return The instance ID.
*/
public final String instanceId() {
return instanceId;
}
/**
*
* The value returned by DescribeVolumes.
*
*
* @return The value returned by DescribeVolumes.
*/
public final String status() {
return status;
}
/**
*
* The volume size.
*
*
* @return The volume size.
*/
public final Integer size() {
return size;
}
/**
*
* The device name.
*
*
* @return The device name.
*/
public final String device() {
return device;
}
/**
*
* The volume mount point. For example, "/mnt/disk1".
*
*
* @return The volume mount point. For example, "/mnt/disk1".
*/
public final String mountPoint() {
return mountPoint;
}
/**
*
* The Amazon Web Services Region. For more information about Amazon Web Services Regions, see Regions and Endpoints.
*
*
* @return The Amazon Web Services Region. For more information about Amazon Web Services Regions, see Regions and Endpoints.
*/
public final String region() {
return region;
}
/**
*
* The volume Availability Zone. For more information, see Regions and Endpoints.
*
*
* @return The volume Availability Zone. For more information, see Regions and Endpoints.
*/
public final String availabilityZone() {
return availabilityZone;
}
/**
*
* The volume type. For more information, see Amazon EBS Volume Types.
*
*
* -
*
* standard
- Magnetic. Magnetic volumes must have a minimum size of 1 GiB and a maximum size of 1024
* GiB.
*
*
* -
*
* io1
- Provisioned IOPS (SSD). PIOPS volumes must have a minimum size of 4 GiB and a maximum size of
* 16384 GiB.
*
*
* -
*
* gp2
- General Purpose (SSD). General purpose volumes must have a minimum size of 1 GiB and a maximum
* size of 16384 GiB.
*
*
* -
*
* st1
- Throughput Optimized hard disk drive (HDD). Throughput optimized HDD volumes must have a
* minimum size of 125 GiB and a maximum size of 16384 GiB.
*
*
* -
*
* sc1
- Cold HDD. Cold HDD volumes must have a minimum size of 125 GiB and a maximum size of 16384
* GiB.
*
*
*
*
* @return The volume type. For more information, see Amazon EBS Volume
* Types.
*
* -
*
* standard
- Magnetic. Magnetic volumes must have a minimum size of 1 GiB and a maximum size
* of 1024 GiB.
*
*
* -
*
* io1
- Provisioned IOPS (SSD). PIOPS volumes must have a minimum size of 4 GiB and a maximum
* size of 16384 GiB.
*
*
* -
*
* gp2
- General Purpose (SSD). General purpose volumes must have a minimum size of 1 GiB and a
* maximum size of 16384 GiB.
*
*
* -
*
* st1
- Throughput Optimized hard disk drive (HDD). Throughput optimized HDD volumes must have
* a minimum size of 125 GiB and a maximum size of 16384 GiB.
*
*
* -
*
* sc1
- Cold HDD. Cold HDD volumes must have a minimum size of 125 GiB and a maximum size of
* 16384 GiB.
*
*
*/
public final String volumeType() {
return volumeType;
}
/**
*
* For PIOPS volumes, the IOPS per disk.
*
*
* @return For PIOPS volumes, the IOPS per disk.
*/
public final Integer iops() {
return iops;
}
/**
*
* Specifies whether an Amazon EBS volume is encrypted. For more information, see Amazon EBS Encryption.
*
*
* @return Specifies whether an Amazon EBS volume is encrypted. For more information, see Amazon EBS Encryption.
*/
public final Boolean encrypted() {
return encrypted;
}
@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(volumeId());
hashCode = 31 * hashCode + Objects.hashCode(ec2VolumeId());
hashCode = 31 * hashCode + Objects.hashCode(name());
hashCode = 31 * hashCode + Objects.hashCode(raidArrayId());
hashCode = 31 * hashCode + Objects.hashCode(instanceId());
hashCode = 31 * hashCode + Objects.hashCode(status());
hashCode = 31 * hashCode + Objects.hashCode(size());
hashCode = 31 * hashCode + Objects.hashCode(device());
hashCode = 31 * hashCode + Objects.hashCode(mountPoint());
hashCode = 31 * hashCode + Objects.hashCode(region());
hashCode = 31 * hashCode + Objects.hashCode(availabilityZone());
hashCode = 31 * hashCode + Objects.hashCode(volumeType());
hashCode = 31 * hashCode + Objects.hashCode(iops());
hashCode = 31 * hashCode + Objects.hashCode(encrypted());
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 Volume)) {
return false;
}
Volume other = (Volume) obj;
return Objects.equals(volumeId(), other.volumeId()) && Objects.equals(ec2VolumeId(), other.ec2VolumeId())
&& Objects.equals(name(), other.name()) && Objects.equals(raidArrayId(), other.raidArrayId())
&& Objects.equals(instanceId(), other.instanceId()) && Objects.equals(status(), other.status())
&& Objects.equals(size(), other.size()) && Objects.equals(device(), other.device())
&& Objects.equals(mountPoint(), other.mountPoint()) && Objects.equals(region(), other.region())
&& Objects.equals(availabilityZone(), other.availabilityZone())
&& Objects.equals(volumeType(), other.volumeType()) && Objects.equals(iops(), other.iops())
&& Objects.equals(encrypted(), other.encrypted());
}
/**
* 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("Volume").add("VolumeId", volumeId()).add("Ec2VolumeId", ec2VolumeId()).add("Name", name())
.add("RaidArrayId", raidArrayId()).add("InstanceId", instanceId()).add("Status", status()).add("Size", size())
.add("Device", device()).add("MountPoint", mountPoint()).add("Region", region())
.add("AvailabilityZone", availabilityZone()).add("VolumeType", volumeType()).add("Iops", iops())
.add("Encrypted", encrypted()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "VolumeId":
return Optional.ofNullable(clazz.cast(volumeId()));
case "Ec2VolumeId":
return Optional.ofNullable(clazz.cast(ec2VolumeId()));
case "Name":
return Optional.ofNullable(clazz.cast(name()));
case "RaidArrayId":
return Optional.ofNullable(clazz.cast(raidArrayId()));
case "InstanceId":
return Optional.ofNullable(clazz.cast(instanceId()));
case "Status":
return Optional.ofNullable(clazz.cast(status()));
case "Size":
return Optional.ofNullable(clazz.cast(size()));
case "Device":
return Optional.ofNullable(clazz.cast(device()));
case "MountPoint":
return Optional.ofNullable(clazz.cast(mountPoint()));
case "Region":
return Optional.ofNullable(clazz.cast(region()));
case "AvailabilityZone":
return Optional.ofNullable(clazz.cast(availabilityZone()));
case "VolumeType":
return Optional.ofNullable(clazz.cast(volumeType()));
case "Iops":
return Optional.ofNullable(clazz.cast(iops()));
case "Encrypted":
return Optional.ofNullable(clazz.cast(encrypted()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function