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

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 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 getter(Function g) { return obj -> g.apply((AttachVolumeRequest) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends StorageGatewayRequest.Builder, SdkPojo, CopyableBuilder { /** *

* The Amazon Resource Name (ARN) of the gateway that you want to attach the volume to. *

* * @param gatewayARN * The Amazon Resource Name (ARN) of the gateway that you want to attach the volume to. * @return Returns a reference to this object so that method calls can be chained together. */ Builder gatewayARN(String 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. *

* * @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); /** *

* The Amazon Resource Name (ARN) of the volume to attach to the specified gateway. *

* * @param volumeARN * The Amazon Resource Name (ARN) of the volume to attach to the specified gateway. * @return Returns a reference to this object so that method calls can be chained together. */ Builder volumeARN(String 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. *

* * @param networkInterfaceId * 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 Returns a reference to this object so that method calls can be chained together. */ Builder networkInterfaceId(String 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. *

* * @param diskId * 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 Returns a reference to this object so that method calls can be chained together. */ Builder diskId(String diskId); @Override Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration); @Override Builder overrideConfiguration(Consumer builderConsumer); } static final class BuilderImpl extends StorageGatewayRequest.BuilderImpl implements Builder { private String gatewayARN; private String targetName; private String volumeARN; private String networkInterfaceId; private String diskId; private BuilderImpl() { } private BuilderImpl(AttachVolumeRequest model) { super(model); gatewayARN(model.gatewayARN); targetName(model.targetName); volumeARN(model.volumeARN); networkInterfaceId(model.networkInterfaceId); diskId(model.diskId); } public final String getGatewayARN() { return gatewayARN; } public final void setGatewayARN(String gatewayARN) { this.gatewayARN = gatewayARN; } @Override public final Builder gatewayARN(String gatewayARN) { this.gatewayARN = gatewayARN; return this; } public final String getTargetName() { return targetName; } public final void setTargetName(String targetName) { this.targetName = targetName; } @Override public final Builder targetName(String targetName) { this.targetName = targetName; return this; } public final String getVolumeARN() { return volumeARN; } public final void setVolumeARN(String volumeARN) { this.volumeARN = volumeARN; } @Override public final Builder volumeARN(String volumeARN) { this.volumeARN = volumeARN; return this; } public final String getNetworkInterfaceId() { return networkInterfaceId; } public final void setNetworkInterfaceId(String networkInterfaceId) { this.networkInterfaceId = networkInterfaceId; } @Override public final Builder networkInterfaceId(String networkInterfaceId) { this.networkInterfaceId = networkInterfaceId; return this; } public final String getDiskId() { return diskId; } public final void setDiskId(String diskId) { this.diskId = diskId; } @Override public final Builder diskId(String diskId) { this.diskId = diskId; return this; } @Override public Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration) { super.overrideConfiguration(overrideConfiguration); return this; } @Override public Builder overrideConfiguration(Consumer builderConsumer) { super.overrideConfiguration(builderConsumer); return this; } @Override public AttachVolumeRequest build() { return new AttachVolumeRequest(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy