
software.amazon.awssdk.services.storagegateway.model.CachediSCSIVolume Maven / Gradle / Ivy
/*
* Copyright 2014-2019 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.storagegateway.model;
import java.io.Serializable;
import java.time.Instant;
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 an iSCSI cached volume.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class CachediSCSIVolume implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField VOLUME_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(CachediSCSIVolume::volumeARN)).setter(setter(Builder::volumeARN))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("VolumeARN").build()).build();
private static final SdkField VOLUME_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(CachediSCSIVolume::volumeId)).setter(setter(Builder::volumeId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("VolumeId").build()).build();
private static final SdkField VOLUME_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(CachediSCSIVolume::volumeType)).setter(setter(Builder::volumeType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("VolumeType").build()).build();
private static final SdkField VOLUME_STATUS_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(CachediSCSIVolume::volumeStatus)).setter(setter(Builder::volumeStatus))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("VolumeStatus").build()).build();
private static final SdkField VOLUME_ATTACHMENT_STATUS_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(CachediSCSIVolume::volumeAttachmentStatus)).setter(setter(Builder::volumeAttachmentStatus))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("VolumeAttachmentStatus").build())
.build();
private static final SdkField VOLUME_SIZE_IN_BYTES_FIELD = SdkField. builder(MarshallingType.LONG)
.getter(getter(CachediSCSIVolume::volumeSizeInBytes)).setter(setter(Builder::volumeSizeInBytes))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("VolumeSizeInBytes").build()).build();
private static final SdkField VOLUME_PROGRESS_FIELD = SdkField. builder(MarshallingType.DOUBLE)
.getter(getter(CachediSCSIVolume::volumeProgress)).setter(setter(Builder::volumeProgress))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("VolumeProgress").build()).build();
private static final SdkField SOURCE_SNAPSHOT_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(CachediSCSIVolume::sourceSnapshotId)).setter(setter(Builder::sourceSnapshotId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SourceSnapshotId").build()).build();
private static final SdkField VOLUMEI_SCSI_ATTRIBUTES_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).getter(getter(CachediSCSIVolume::volumeiSCSIAttributes))
.setter(setter(Builder::volumeiSCSIAttributes)).constructor(VolumeiSCSIAttributes::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("VolumeiSCSIAttributes").build())
.build();
private static final SdkField CREATED_DATE_FIELD = SdkField. builder(MarshallingType.INSTANT)
.getter(getter(CachediSCSIVolume::createdDate)).setter(setter(Builder::createdDate))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CreatedDate").build()).build();
private static final SdkField VOLUME_USED_IN_BYTES_FIELD = SdkField. builder(MarshallingType.LONG)
.getter(getter(CachediSCSIVolume::volumeUsedInBytes)).setter(setter(Builder::volumeUsedInBytes))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("VolumeUsedInBytes").build()).build();
private static final SdkField KMS_KEY_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(CachediSCSIVolume::kmsKey)).setter(setter(Builder::kmsKey))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("KMSKey").build()).build();
private static final SdkField TARGET_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(CachediSCSIVolume::targetName)).setter(setter(Builder::targetName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TargetName").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(VOLUME_ARN_FIELD,
VOLUME_ID_FIELD, VOLUME_TYPE_FIELD, VOLUME_STATUS_FIELD, VOLUME_ATTACHMENT_STATUS_FIELD, VOLUME_SIZE_IN_BYTES_FIELD,
VOLUME_PROGRESS_FIELD, SOURCE_SNAPSHOT_ID_FIELD, VOLUMEI_SCSI_ATTRIBUTES_FIELD, CREATED_DATE_FIELD,
VOLUME_USED_IN_BYTES_FIELD, KMS_KEY_FIELD, TARGET_NAME_FIELD));
private static final long serialVersionUID = 1L;
private final String volumeARN;
private final String volumeId;
private final String volumeType;
private final String volumeStatus;
private final String volumeAttachmentStatus;
private final Long volumeSizeInBytes;
private final Double volumeProgress;
private final String sourceSnapshotId;
private final VolumeiSCSIAttributes volumeiSCSIAttributes;
private final Instant createdDate;
private final Long volumeUsedInBytes;
private final String kmsKey;
private final String targetName;
private CachediSCSIVolume(BuilderImpl builder) {
this.volumeARN = builder.volumeARN;
this.volumeId = builder.volumeId;
this.volumeType = builder.volumeType;
this.volumeStatus = builder.volumeStatus;
this.volumeAttachmentStatus = builder.volumeAttachmentStatus;
this.volumeSizeInBytes = builder.volumeSizeInBytes;
this.volumeProgress = builder.volumeProgress;
this.sourceSnapshotId = builder.sourceSnapshotId;
this.volumeiSCSIAttributes = builder.volumeiSCSIAttributes;
this.createdDate = builder.createdDate;
this.volumeUsedInBytes = builder.volumeUsedInBytes;
this.kmsKey = builder.kmsKey;
this.targetName = builder.targetName;
}
/**
*
* The Amazon Resource Name (ARN) of the storage volume.
*
*
* @return The Amazon Resource Name (ARN) of the storage volume.
*/
public String volumeARN() {
return volumeARN;
}
/**
*
* The unique identifier of the volume, e.g. vol-AE4B946D.
*
*
* @return The unique identifier of the volume, e.g. vol-AE4B946D.
*/
public String volumeId() {
return volumeId;
}
/**
*
* One of the VolumeType enumeration values that describes the type of the volume.
*
*
* @return One of the VolumeType enumeration values that describes the type of the volume.
*/
public String volumeType() {
return volumeType;
}
/**
*
* One of the VolumeStatus values that indicates the state of the storage volume.
*
*
* @return One of the VolumeStatus values that indicates the state of the storage volume.
*/
public String volumeStatus() {
return volumeStatus;
}
/**
*
* A value that indicates whether a storage volume is attached to or detached from a gateway. For more information,
* see Moving Your Volumes to a Different Gateway.
*
*
* @return A value that indicates whether a storage volume is attached to or detached from a gateway. For more
* information, see Moving Your Volumes to a Different Gateway.
*/
public String volumeAttachmentStatus() {
return volumeAttachmentStatus;
}
/**
*
* The size, in bytes, of the volume capacity.
*
*
* @return The size, in bytes, of the volume capacity.
*/
public Long volumeSizeInBytes() {
return volumeSizeInBytes;
}
/**
*
* Represents the percentage complete if the volume is restoring or bootstrapping that represents the percent of
* data transferred. This field does not appear in the response if the cached volume is not restoring or
* bootstrapping.
*
*
* @return Represents the percentage complete if the volume is restoring or bootstrapping that represents the
* percent of data transferred. This field does not appear in the response if the cached volume is not
* restoring or bootstrapping.
*/
public Double volumeProgress() {
return volumeProgress;
}
/**
*
* If the cached volume was created from a snapshot, this field contains the snapshot ID used, e.g. snap-78e22663.
* Otherwise, this field is not included.
*
*
* @return If the cached volume was created from a snapshot, this field contains the snapshot ID used, e.g.
* snap-78e22663. Otherwise, this field is not included.
*/
public String sourceSnapshotId() {
return sourceSnapshotId;
}
/**
*
* An VolumeiSCSIAttributes object that represents a collection of iSCSI attributes for one stored volume.
*
*
* @return An VolumeiSCSIAttributes object that represents a collection of iSCSI attributes for one stored
* volume.
*/
public VolumeiSCSIAttributes volumeiSCSIAttributes() {
return volumeiSCSIAttributes;
}
/**
*
* The date the volume was created. Volumes created prior to March 28, 2017 don’t have this time stamp.
*
*
* @return The date the volume was created. Volumes created prior to March 28, 2017 don’t have this time stamp.
*/
public Instant createdDate() {
return createdDate;
}
/**
*
* The size of the data stored on the volume in bytes. This value is calculated based on the number of blocks that
* are touched, instead of the actual amount of data written. This value can be useful for sequential write patterns
* but less accurate for random write patterns. VolumeUsedInBytes
is different from the compressed size
* of the volume, which is the value that is used to calculate your bill.
*
*
*
* This value is not available for volumes created prior to May 13, 2015, until you store data on the volume.
*
*
*
* @return The size of the data stored on the volume in bytes. This value is calculated based on the number of
* blocks that are touched, instead of the actual amount of data written. This value can be useful for
* sequential write patterns but less accurate for random write patterns. VolumeUsedInBytes
is
* different from the compressed size of the volume, which is the value that is used to calculate your
* bill.
*
* This value is not available for volumes created prior to May 13, 2015, until you store data on the
* volume.
*
*/
public Long volumeUsedInBytes() {
return volumeUsedInBytes;
}
/**
* Returns the value of the KMSKey property for this object.
*
* @return The value of the KMSKey property for this object.
*/
public String kmsKey() {
return kmsKey;
}
/**
*
* The name of the iSCSI target used by an initiator to connect to a volume and used as a suffix for the target ARN.
* For example, specifying TargetName
as myvolume results in the target ARN of
* arn:aws:storagegateway:us-east-2:111122223333:gateway/sgw-12A3456B/target/iqn.1997-05.com.amazon:myvolume
* . The target name must be unique across all volumes on a gateway.
*
*
* If you don't specify a value, Storage Gateway uses the value that was previously used for this volume as the new
* target name.
*
*
* @return The name of the iSCSI target used by an initiator to connect to a volume and used as a suffix for the
* target ARN. For example, specifying TargetName
as myvolume results in the target ARN
* of
* arn:aws:storagegateway:us-east-2:111122223333:gateway/sgw-12A3456B/target/iqn.1997-05.com.amazon:myvolume
* . The target name must be unique across all volumes on a gateway.
*
* If you don't specify a value, Storage Gateway uses the value that was previously used for this volume as
* the new target name.
*/
public String targetName() {
return targetName;
}
@Override
public Builder toBuilder() {
return new BuilderImpl(this);
}
public static Builder builder() {
return new BuilderImpl();
}
public static Class extends Builder> serializableBuilderClass() {
return BuilderImpl.class;
}
@Override
public int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(volumeARN());
hashCode = 31 * hashCode + Objects.hashCode(volumeId());
hashCode = 31 * hashCode + Objects.hashCode(volumeType());
hashCode = 31 * hashCode + Objects.hashCode(volumeStatus());
hashCode = 31 * hashCode + Objects.hashCode(volumeAttachmentStatus());
hashCode = 31 * hashCode + Objects.hashCode(volumeSizeInBytes());
hashCode = 31 * hashCode + Objects.hashCode(volumeProgress());
hashCode = 31 * hashCode + Objects.hashCode(sourceSnapshotId());
hashCode = 31 * hashCode + Objects.hashCode(volumeiSCSIAttributes());
hashCode = 31 * hashCode + Objects.hashCode(createdDate());
hashCode = 31 * hashCode + Objects.hashCode(volumeUsedInBytes());
hashCode = 31 * hashCode + Objects.hashCode(kmsKey());
hashCode = 31 * hashCode + Objects.hashCode(targetName());
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 CachediSCSIVolume)) {
return false;
}
CachediSCSIVolume other = (CachediSCSIVolume) obj;
return Objects.equals(volumeARN(), other.volumeARN()) && Objects.equals(volumeId(), other.volumeId())
&& Objects.equals(volumeType(), other.volumeType()) && Objects.equals(volumeStatus(), other.volumeStatus())
&& Objects.equals(volumeAttachmentStatus(), other.volumeAttachmentStatus())
&& Objects.equals(volumeSizeInBytes(), other.volumeSizeInBytes())
&& Objects.equals(volumeProgress(), other.volumeProgress())
&& Objects.equals(sourceSnapshotId(), other.sourceSnapshotId())
&& Objects.equals(volumeiSCSIAttributes(), other.volumeiSCSIAttributes())
&& Objects.equals(createdDate(), other.createdDate())
&& Objects.equals(volumeUsedInBytes(), other.volumeUsedInBytes()) && Objects.equals(kmsKey(), other.kmsKey())
&& Objects.equals(targetName(), other.targetName());
}
/**
* 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("CachediSCSIVolume").add("VolumeARN", volumeARN()).add("VolumeId", volumeId())
.add("VolumeType", volumeType()).add("VolumeStatus", volumeStatus())
.add("VolumeAttachmentStatus", volumeAttachmentStatus()).add("VolumeSizeInBytes", volumeSizeInBytes())
.add("VolumeProgress", volumeProgress()).add("SourceSnapshotId", sourceSnapshotId())
.add("VolumeiSCSIAttributes", volumeiSCSIAttributes()).add("CreatedDate", createdDate())
.add("VolumeUsedInBytes", volumeUsedInBytes()).add("KMSKey", kmsKey()).add("TargetName", targetName()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "VolumeARN":
return Optional.ofNullable(clazz.cast(volumeARN()));
case "VolumeId":
return Optional.ofNullable(clazz.cast(volumeId()));
case "VolumeType":
return Optional.ofNullable(clazz.cast(volumeType()));
case "VolumeStatus":
return Optional.ofNullable(clazz.cast(volumeStatus()));
case "VolumeAttachmentStatus":
return Optional.ofNullable(clazz.cast(volumeAttachmentStatus()));
case "VolumeSizeInBytes":
return Optional.ofNullable(clazz.cast(volumeSizeInBytes()));
case "VolumeProgress":
return Optional.ofNullable(clazz.cast(volumeProgress()));
case "SourceSnapshotId":
return Optional.ofNullable(clazz.cast(sourceSnapshotId()));
case "VolumeiSCSIAttributes":
return Optional.ofNullable(clazz.cast(volumeiSCSIAttributes()));
case "CreatedDate":
return Optional.ofNullable(clazz.cast(createdDate()));
case "VolumeUsedInBytes":
return Optional.ofNullable(clazz.cast(volumeUsedInBytes()));
case "KMSKey":
return Optional.ofNullable(clazz.cast(kmsKey()));
case "TargetName":
return Optional.ofNullable(clazz.cast(targetName()));
default:
return Optional.empty();
}
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
private static Function
*
* This value is not available for volumes created prior to May 13, 2015, until you store data on the
* volume.
*
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder volumeUsedInBytes(Long volumeUsedInBytes);
/**
* Sets the value of the KMSKey property for this object.
*
* @param kmsKey
* The new value for the KMSKey property for this object.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder kmsKey(String kmsKey);
/**
*
* The name of the iSCSI target used by an initiator to connect to a volume and used as a suffix for the target
* ARN. For example, specifying TargetName
as myvolume results in the target ARN of
* arn:aws:storagegateway:us-east-2:111122223333:gateway/sgw-12A3456B/target/iqn.1997-05.com.amazon:myvolume
* . The target name must be unique across all volumes on a gateway.
*
*
* If you don't specify a value, Storage Gateway uses the value that was previously used for this volume as the
* new target name.
*
*
* @param targetName
* The name of the iSCSI target used by an initiator to connect to a volume and used as a suffix for the
* target ARN. For example, specifying TargetName
as myvolume results in the target
* ARN of
* arn:aws:storagegateway:us-east-2:111122223333:gateway/sgw-12A3456B/target/iqn.1997-05.com.amazon:myvolume
* . The target name must be unique across all volumes on a gateway.
*
* If you don't specify a value, Storage Gateway uses the value that was previously used for this volume
* as the new target name.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder targetName(String targetName);
}
static final class BuilderImpl implements Builder {
private String volumeARN;
private String volumeId;
private String volumeType;
private String volumeStatus;
private String volumeAttachmentStatus;
private Long volumeSizeInBytes;
private Double volumeProgress;
private String sourceSnapshotId;
private VolumeiSCSIAttributes volumeiSCSIAttributes;
private Instant createdDate;
private Long volumeUsedInBytes;
private String kmsKey;
private String targetName;
private BuilderImpl() {
}
private BuilderImpl(CachediSCSIVolume model) {
volumeARN(model.volumeARN);
volumeId(model.volumeId);
volumeType(model.volumeType);
volumeStatus(model.volumeStatus);
volumeAttachmentStatus(model.volumeAttachmentStatus);
volumeSizeInBytes(model.volumeSizeInBytes);
volumeProgress(model.volumeProgress);
sourceSnapshotId(model.sourceSnapshotId);
volumeiSCSIAttributes(model.volumeiSCSIAttributes);
createdDate(model.createdDate);
volumeUsedInBytes(model.volumeUsedInBytes);
kmsKey(model.kmsKey);
targetName(model.targetName);
}
public final String getVolumeARN() {
return volumeARN;
}
@Override
public final Builder volumeARN(String volumeARN) {
this.volumeARN = volumeARN;
return this;
}
public final void setVolumeARN(String volumeARN) {
this.volumeARN = volumeARN;
}
public final String getVolumeId() {
return volumeId;
}
@Override
public final Builder volumeId(String volumeId) {
this.volumeId = volumeId;
return this;
}
public final void setVolumeId(String volumeId) {
this.volumeId = volumeId;
}
public final String getVolumeType() {
return volumeType;
}
@Override
public final Builder volumeType(String volumeType) {
this.volumeType = volumeType;
return this;
}
public final void setVolumeType(String volumeType) {
this.volumeType = volumeType;
}
public final String getVolumeStatus() {
return volumeStatus;
}
@Override
public final Builder volumeStatus(String volumeStatus) {
this.volumeStatus = volumeStatus;
return this;
}
public final void setVolumeStatus(String volumeStatus) {
this.volumeStatus = volumeStatus;
}
public final String getVolumeAttachmentStatus() {
return volumeAttachmentStatus;
}
@Override
public final Builder volumeAttachmentStatus(String volumeAttachmentStatus) {
this.volumeAttachmentStatus = volumeAttachmentStatus;
return this;
}
public final void setVolumeAttachmentStatus(String volumeAttachmentStatus) {
this.volumeAttachmentStatus = volumeAttachmentStatus;
}
public final Long getVolumeSizeInBytes() {
return volumeSizeInBytes;
}
@Override
public final Builder volumeSizeInBytes(Long volumeSizeInBytes) {
this.volumeSizeInBytes = volumeSizeInBytes;
return this;
}
public final void setVolumeSizeInBytes(Long volumeSizeInBytes) {
this.volumeSizeInBytes = volumeSizeInBytes;
}
public final Double getVolumeProgress() {
return volumeProgress;
}
@Override
public final Builder volumeProgress(Double volumeProgress) {
this.volumeProgress = volumeProgress;
return this;
}
public final void setVolumeProgress(Double volumeProgress) {
this.volumeProgress = volumeProgress;
}
public final String getSourceSnapshotId() {
return sourceSnapshotId;
}
@Override
public final Builder sourceSnapshotId(String sourceSnapshotId) {
this.sourceSnapshotId = sourceSnapshotId;
return this;
}
public final void setSourceSnapshotId(String sourceSnapshotId) {
this.sourceSnapshotId = sourceSnapshotId;
}
public final VolumeiSCSIAttributes.Builder getVolumeiSCSIAttributes() {
return volumeiSCSIAttributes != null ? volumeiSCSIAttributes.toBuilder() : null;
}
@Override
public final Builder volumeiSCSIAttributes(VolumeiSCSIAttributes volumeiSCSIAttributes) {
this.volumeiSCSIAttributes = volumeiSCSIAttributes;
return this;
}
public final void setVolumeiSCSIAttributes(VolumeiSCSIAttributes.BuilderImpl volumeiSCSIAttributes) {
this.volumeiSCSIAttributes = volumeiSCSIAttributes != null ? volumeiSCSIAttributes.build() : null;
}
public final Instant getCreatedDate() {
return createdDate;
}
@Override
public final Builder createdDate(Instant createdDate) {
this.createdDate = createdDate;
return this;
}
public final void setCreatedDate(Instant createdDate) {
this.createdDate = createdDate;
}
public final Long getVolumeUsedInBytes() {
return volumeUsedInBytes;
}
@Override
public final Builder volumeUsedInBytes(Long volumeUsedInBytes) {
this.volumeUsedInBytes = volumeUsedInBytes;
return this;
}
public final void setVolumeUsedInBytes(Long volumeUsedInBytes) {
this.volumeUsedInBytes = volumeUsedInBytes;
}
public final String getKmsKey() {
return kmsKey;
}
@Override
public final Builder kmsKey(String kmsKey) {
this.kmsKey = kmsKey;
return this;
}
public final void setKmsKey(String kmsKey) {
this.kmsKey = kmsKey;
}
public final String getTargetName() {
return targetName;
}
@Override
public final Builder targetName(String targetName) {
this.targetName = targetName;
return this;
}
public final void setTargetName(String targetName) {
this.targetName = targetName;
}
@Override
public CachediSCSIVolume build() {
return new CachediSCSIVolume(this);
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
}
}