
software.amazon.awssdk.services.storagegateway.model.VolumeInfo 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.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 storage volume object.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class VolumeInfo implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField VOLUME_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(VolumeInfo::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(VolumeInfo::volumeId)).setter(setter(Builder::volumeId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("VolumeId").build()).build();
private static final SdkField GATEWAY_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(VolumeInfo::gatewayARN)).setter(setter(Builder::gatewayARN))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("GatewayARN").build()).build();
private static final SdkField GATEWAY_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(VolumeInfo::gatewayId)).setter(setter(Builder::gatewayId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("GatewayId").build()).build();
private static final SdkField VOLUME_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(VolumeInfo::volumeType)).setter(setter(Builder::volumeType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("VolumeType").build()).build();
private static final SdkField VOLUME_SIZE_IN_BYTES_FIELD = SdkField. builder(MarshallingType.LONG)
.getter(getter(VolumeInfo::volumeSizeInBytes)).setter(setter(Builder::volumeSizeInBytes))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("VolumeSizeInBytes").build()).build();
private static final SdkField VOLUME_ATTACHMENT_STATUS_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(VolumeInfo::volumeAttachmentStatus)).setter(setter(Builder::volumeAttachmentStatus))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("VolumeAttachmentStatus").build())
.build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(VOLUME_ARN_FIELD,
VOLUME_ID_FIELD, GATEWAY_ARN_FIELD, GATEWAY_ID_FIELD, VOLUME_TYPE_FIELD, VOLUME_SIZE_IN_BYTES_FIELD,
VOLUME_ATTACHMENT_STATUS_FIELD));
private static final long serialVersionUID = 1L;
private final String volumeARN;
private final String volumeId;
private final String gatewayARN;
private final String gatewayId;
private final String volumeType;
private final Long volumeSizeInBytes;
private final String volumeAttachmentStatus;
private VolumeInfo(BuilderImpl builder) {
this.volumeARN = builder.volumeARN;
this.volumeId = builder.volumeId;
this.gatewayARN = builder.gatewayARN;
this.gatewayId = builder.gatewayId;
this.volumeType = builder.volumeType;
this.volumeSizeInBytes = builder.volumeSizeInBytes;
this.volumeAttachmentStatus = builder.volumeAttachmentStatus;
}
/**
*
* The Amazon Resource Name (ARN) for the storage volume. For example, the following is a valid ARN:
*
*
* arn:aws:storagegateway:us-east-2:111122223333:gateway/sgw-12A3456B/volume/vol-1122AABB
*
*
* Valid Values: 50 to 500 lowercase letters, numbers, periods (.), and hyphens (-).
*
*
* @return The Amazon Resource Name (ARN) for the storage volume. For example, the following is a valid ARN:
*
* arn:aws:storagegateway:us-east-2:111122223333:gateway/sgw-12A3456B/volume/vol-1122AABB
*
*
* Valid Values: 50 to 500 lowercase letters, numbers, periods (.), and hyphens (-).
*/
public String volumeARN() {
return volumeARN;
}
/**
*
* The unique identifier assigned to the volume. This ID becomes part of the volume Amazon Resource Name (ARN),
* which you use as input for other operations.
*
*
* Valid Values: 50 to 500 lowercase letters, numbers, periods (.), and hyphens (-).
*
*
* @return The unique identifier assigned to the volume. This ID becomes part of the volume Amazon Resource Name
* (ARN), which you use as input for other operations.
*
* Valid Values: 50 to 500 lowercase letters, numbers, periods (.), and hyphens (-).
*/
public String volumeId() {
return volumeId;
}
/**
* Returns the value of the GatewayARN property for this object.
*
* @return The value of the GatewayARN property for this object.
*/
public String gatewayARN() {
return gatewayARN;
}
/**
*
* The unique identifier assigned to your gateway during activation. This ID becomes part of the gateway Amazon
* Resource Name (ARN), which you use as input for other operations.
*
*
* Valid Values: 50 to 500 lowercase letters, numbers, periods (.), and hyphens (-).
*
*
* @return The unique identifier assigned to your gateway during activation. This ID becomes part of the gateway
* Amazon Resource Name (ARN), which you use as input for other operations.
*
* Valid Values: 50 to 500 lowercase letters, numbers, periods (.), and hyphens (-).
*/
public String gatewayId() {
return gatewayId;
}
/**
*
* One of the VolumeType enumeration values describing the type of the volume.
*
*
* @return One of the VolumeType enumeration values describing the type of the volume.
*/
public String volumeType() {
return volumeType;
}
/**
*
* The size of the volume in bytes.
*
*
* Valid Values: 50 to 500 lowercase letters, numbers, periods (.), and hyphens (-).
*
*
* @return The size of the volume in bytes.
*
* Valid Values: 50 to 500 lowercase letters, numbers, periods (.), and hyphens (-).
*/
public Long volumeSizeInBytes() {
return volumeSizeInBytes;
}
/**
*
* 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 volumeAttachmentStatus() {
return volumeAttachmentStatus;
}
@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(gatewayARN());
hashCode = 31 * hashCode + Objects.hashCode(gatewayId());
hashCode = 31 * hashCode + Objects.hashCode(volumeType());
hashCode = 31 * hashCode + Objects.hashCode(volumeSizeInBytes());
hashCode = 31 * hashCode + Objects.hashCode(volumeAttachmentStatus());
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 VolumeInfo)) {
return false;
}
VolumeInfo other = (VolumeInfo) obj;
return Objects.equals(volumeARN(), other.volumeARN()) && Objects.equals(volumeId(), other.volumeId())
&& Objects.equals(gatewayARN(), other.gatewayARN()) && Objects.equals(gatewayId(), other.gatewayId())
&& Objects.equals(volumeType(), other.volumeType())
&& Objects.equals(volumeSizeInBytes(), other.volumeSizeInBytes())
&& Objects.equals(volumeAttachmentStatus(), other.volumeAttachmentStatus());
}
/**
* 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("VolumeInfo").add("VolumeARN", volumeARN()).add("VolumeId", volumeId())
.add("GatewayARN", gatewayARN()).add("GatewayId", gatewayId()).add("VolumeType", volumeType())
.add("VolumeSizeInBytes", volumeSizeInBytes()).add("VolumeAttachmentStatus", volumeAttachmentStatus()).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 "GatewayARN":
return Optional.ofNullable(clazz.cast(gatewayARN()));
case "GatewayId":
return Optional.ofNullable(clazz.cast(gatewayId()));
case "VolumeType":
return Optional.ofNullable(clazz.cast(volumeType()));
case "VolumeSizeInBytes":
return Optional.ofNullable(clazz.cast(volumeSizeInBytes()));
case "VolumeAttachmentStatus":
return Optional.ofNullable(clazz.cast(volumeAttachmentStatus()));
default:
return Optional.empty();
}
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
private static Function