
software.amazon.awssdk.services.storagegateway.model.AttachVolumeRequest 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.storagegateway.model;
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.awscore.AwsRequestOverrideConfiguration;
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;
/**
*
* AttachVolumeInput
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class AttachVolumeRequest extends StorageGatewayRequest implements
ToCopyableBuilder {
private static final SdkField GATEWAY_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("GatewayARN").getter(getter(AttachVolumeRequest::gatewayARN)).setter(setter(Builder::gatewayARN))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("GatewayARN").build()).build();
private static final SdkField TARGET_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("TargetName").getter(getter(AttachVolumeRequest::targetName)).setter(setter(Builder::targetName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TargetName").build()).build();
private static final SdkField VOLUME_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("VolumeARN").getter(getter(AttachVolumeRequest::volumeARN)).setter(setter(Builder::volumeARN))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("VolumeARN").build()).build();
private static final SdkField NETWORK_INTERFACE_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("NetworkInterfaceId").getter(getter(AttachVolumeRequest::networkInterfaceId))
.setter(setter(Builder::networkInterfaceId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("NetworkInterfaceId").build())
.build();
private static final SdkField DISK_ID_FIELD = SdkField. builder(MarshallingType.STRING).memberName("DiskId")
.getter(getter(AttachVolumeRequest::diskId)).setter(setter(Builder::diskId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DiskId").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(GATEWAY_ARN_FIELD,
TARGET_NAME_FIELD, VOLUME_ARN_FIELD, NETWORK_INTERFACE_ID_FIELD, DISK_ID_FIELD));
private final String gatewayARN;
private final String targetName;
private final String volumeARN;
private final String networkInterfaceId;
private final String diskId;
private AttachVolumeRequest(BuilderImpl builder) {
super(builder);
this.gatewayARN = builder.gatewayARN;
this.targetName = builder.targetName;
this.volumeARN = builder.volumeARN;
this.networkInterfaceId = builder.networkInterfaceId;
this.diskId = builder.diskId;
}
/**
*
* The Amazon Resource Name (ARN) of the gateway that you want to attach the volume to.
*
*
* @return The Amazon Resource Name (ARN) of the gateway that you want to attach the volume to.
*/
public final String gatewayARN() {
return gatewayARN;
}
/**
*
* 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 final String targetName() {
return targetName;
}
/**
*
* The Amazon Resource Name (ARN) of the volume to attach to the specified gateway.
*
*
* @return The Amazon Resource Name (ARN) of the volume to attach to the specified gateway.
*/
public final String volumeARN() {
return volumeARN;
}
/**
*
* The network interface of the gateway on which to expose the iSCSI target. Only IPv4 addresses are accepted. Use
* DescribeGatewayInformation to get a list of the network interfaces available on a gateway.
*
*
* Valid Values: A valid IP address.
*
*
* @return The network interface of the gateway on which to expose the iSCSI target. Only IPv4 addresses are
* accepted. Use DescribeGatewayInformation to get a list of the network interfaces available on a
* gateway.
*
* Valid Values: A valid IP address.
*/
public final String networkInterfaceId() {
return networkInterfaceId;
}
/**
*
* The unique device ID or other distinguishing data that identifies the local disk used to create the volume. This
* value is only required when you are attaching a stored volume.
*
*
* @return The unique device ID or other distinguishing data that identifies the local disk used to create the
* volume. This value is only required when you are attaching a stored volume.
*/
public final String diskId() {
return diskId;
}
@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 final int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + super.hashCode();
hashCode = 31 * hashCode + Objects.hashCode(gatewayARN());
hashCode = 31 * hashCode + Objects.hashCode(targetName());
hashCode = 31 * hashCode + Objects.hashCode(volumeARN());
hashCode = 31 * hashCode + Objects.hashCode(networkInterfaceId());
hashCode = 31 * hashCode + Objects.hashCode(diskId());
return hashCode;
}
@Override
public final boolean equals(Object obj) {
return super.equals(obj) && equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof AttachVolumeRequest)) {
return false;
}
AttachVolumeRequest other = (AttachVolumeRequest) obj;
return Objects.equals(gatewayARN(), other.gatewayARN()) && Objects.equals(targetName(), other.targetName())
&& Objects.equals(volumeARN(), other.volumeARN())
&& Objects.equals(networkInterfaceId(), other.networkInterfaceId()) && Objects.equals(diskId(), other.diskId());
}
/**
* 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("AttachVolumeRequest").add("GatewayARN", gatewayARN()).add("TargetName", targetName())
.add("VolumeARN", volumeARN()).add("NetworkInterfaceId", networkInterfaceId()).add("DiskId", diskId()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "GatewayARN":
return Optional.ofNullable(clazz.cast(gatewayARN()));
case "TargetName":
return Optional.ofNullable(clazz.cast(targetName()));
case "VolumeARN":
return Optional.ofNullable(clazz.cast(volumeARN()));
case "NetworkInterfaceId":
return Optional.ofNullable(clazz.cast(networkInterfaceId()));
case "DiskId":
return Optional.ofNullable(clazz.cast(diskId()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function