
software.amazon.awssdk.services.storagegateway.model.CreateCachediScsiVolumeRequest 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.Collection;
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 java.util.stream.Collectors;
import java.util.stream.Stream;
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.ListTrait;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.core.util.SdkAutoConstructList;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*/
@Generated("software.amazon.awssdk:codegen")
public final class CreateCachediScsiVolumeRequest extends StorageGatewayRequest implements
ToCopyableBuilder {
private static final SdkField GATEWAY_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("GatewayARN").getter(getter(CreateCachediScsiVolumeRequest::gatewayARN))
.setter(setter(Builder::gatewayARN))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("GatewayARN").build()).build();
private static final SdkField VOLUME_SIZE_IN_BYTES_FIELD = SdkField. builder(MarshallingType.LONG)
.memberName("VolumeSizeInBytes").getter(getter(CreateCachediScsiVolumeRequest::volumeSizeInBytes))
.setter(setter(Builder::volumeSizeInBytes))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("VolumeSizeInBytes").build()).build();
private static final SdkField SNAPSHOT_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("SnapshotId").getter(getter(CreateCachediScsiVolumeRequest::snapshotId))
.setter(setter(Builder::snapshotId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SnapshotId").build()).build();
private static final SdkField TARGET_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("TargetName").getter(getter(CreateCachediScsiVolumeRequest::targetName))
.setter(setter(Builder::targetName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TargetName").build()).build();
private static final SdkField SOURCE_VOLUME_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("SourceVolumeARN").getter(getter(CreateCachediScsiVolumeRequest::sourceVolumeARN))
.setter(setter(Builder::sourceVolumeARN))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SourceVolumeARN").build()).build();
private static final SdkField NETWORK_INTERFACE_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("NetworkInterfaceId").getter(getter(CreateCachediScsiVolumeRequest::networkInterfaceId))
.setter(setter(Builder::networkInterfaceId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("NetworkInterfaceId").build())
.build();
private static final SdkField CLIENT_TOKEN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ClientToken").getter(getter(CreateCachediScsiVolumeRequest::clientToken))
.setter(setter(Builder::clientToken))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ClientToken").build()).build();
private static final SdkField KMS_ENCRYPTED_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("KMSEncrypted").getter(getter(CreateCachediScsiVolumeRequest::kmsEncrypted))
.setter(setter(Builder::kmsEncrypted))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("KMSEncrypted").build()).build();
private static final SdkField KMS_KEY_FIELD = SdkField. builder(MarshallingType.STRING).memberName("KMSKey")
.getter(getter(CreateCachediScsiVolumeRequest::kmsKey)).setter(setter(Builder::kmsKey))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("KMSKey").build()).build();
private static final SdkField> TAGS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("Tags")
.getter(getter(CreateCachediScsiVolumeRequest::tags))
.setter(setter(Builder::tags))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Tags").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(Tag::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(GATEWAY_ARN_FIELD,
VOLUME_SIZE_IN_BYTES_FIELD, SNAPSHOT_ID_FIELD, TARGET_NAME_FIELD, SOURCE_VOLUME_ARN_FIELD,
NETWORK_INTERFACE_ID_FIELD, CLIENT_TOKEN_FIELD, KMS_ENCRYPTED_FIELD, KMS_KEY_FIELD, TAGS_FIELD));
private final String gatewayARN;
private final Long volumeSizeInBytes;
private final String snapshotId;
private final String targetName;
private final String sourceVolumeARN;
private final String networkInterfaceId;
private final String clientToken;
private final Boolean kmsEncrypted;
private final String kmsKey;
private final List tags;
private CreateCachediScsiVolumeRequest(BuilderImpl builder) {
super(builder);
this.gatewayARN = builder.gatewayARN;
this.volumeSizeInBytes = builder.volumeSizeInBytes;
this.snapshotId = builder.snapshotId;
this.targetName = builder.targetName;
this.sourceVolumeARN = builder.sourceVolumeARN;
this.networkInterfaceId = builder.networkInterfaceId;
this.clientToken = builder.clientToken;
this.kmsEncrypted = builder.kmsEncrypted;
this.kmsKey = builder.kmsKey;
this.tags = builder.tags;
}
/**
* Returns the value of the GatewayARN property for this object.
*
* @return The value of the GatewayARN property for this object.
*/
public final String gatewayARN() {
return gatewayARN;
}
/**
*
* The size of the volume in bytes.
*
*
* @return The size of the volume in bytes.
*/
public final Long volumeSizeInBytes() {
return volumeSizeInBytes;
}
/**
*
* The snapshot ID (e.g. "snap-1122aabb") of the snapshot to restore as the new cached volume. Specify this field if
* you want to create the iSCSI storage volume from a snapshot; otherwise, do not include this field. To list
* snapshots for your account use DescribeSnapshots in the Amazon Elastic Compute Cloud API Reference.
*
*
* @return The snapshot ID (e.g. "snap-1122aabb") of the snapshot to restore as the new cached volume. Specify this
* field if you want to create the iSCSI storage volume from a snapshot; otherwise, do not include this
* field. To list snapshots for your account use DescribeSnapshots in the Amazon Elastic Compute Cloud API Reference.
*/
public final String snapshotId() {
return snapshotId;
}
/**
*
* 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 ARN for an existing volume. Specifying this ARN makes the new volume into an exact copy of the specified
* existing volume's latest recovery point. The VolumeSizeInBytes
value for this new volume must be
* equal to or larger than the size of the existing volume, in bytes.
*
*
* @return The ARN for an existing volume. Specifying this ARN makes the new volume into an exact copy of the
* specified existing volume's latest recovery point. The VolumeSizeInBytes
value for this new
* volume must be equal to or larger than the size of the existing volume, in bytes.
*/
public final String sourceVolumeARN() {
return sourceVolumeARN;
}
/**
*
* 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;
}
/**
*
* A unique identifier that you use to retry a request. If you retry a request, use the same
* ClientToken
you specified in the initial request.
*
*
* @return A unique identifier that you use to retry a request. If you retry a request, use the same
* ClientToken
you specified in the initial request.
*/
public final String clientToken() {
return clientToken;
}
/**
*
* Set to true
to use Amazon S3 server-side encryption with your own KMS key, or false
to
* use a key managed by Amazon S3. Optional.
*
*
* Valid Values: true
| false
*
*
* @return Set to true
to use Amazon S3 server-side encryption with your own KMS key, or
* false
to use a key managed by Amazon S3. Optional.
*
* Valid Values: true
| false
*/
public final Boolean kmsEncrypted() {
return kmsEncrypted;
}
/**
*
* The Amazon Resource Name (ARN) of a symmetric customer master key (CMK) used for Amazon S3 server-side
* encryption. Storage Gateway does not support asymmetric CMKs. This value can only be set when
* KMSEncrypted
is true
. Optional.
*
*
* @return The Amazon Resource Name (ARN) of a symmetric customer master key (CMK) used for Amazon S3 server-side
* encryption. Storage Gateway does not support asymmetric CMKs. This value can only be set when
* KMSEncrypted
is true
. Optional.
*/
public final String kmsKey() {
return kmsKey;
}
/**
* For responses, this returns true if the service returned a value for the Tags property. This DOES NOT check that
* the value is non-empty (for which, you should check the {@code isEmpty()} method on the property). This is useful
* because the SDK will never return a null collection or map, but you may need to differentiate between the service
* returning nothing (or null) and the service returning an empty collection or map. For requests, this returns true
* if a value for the property was specified in the request builder, and false if a value was not specified.
*/
public final boolean hasTags() {
return tags != null && !(tags instanceof SdkAutoConstructList);
}
/**
*
* A list of up to 50 tags that you can assign to a cached volume. Each tag is a key-value pair.
*
*
*
* Valid characters for key and value are letters, spaces, and numbers that you can represent in UTF-8 format, and
* the following special characters: + - = . _ : / @. The maximum length of a tag's key is 128 characters, and the
* maximum length for a tag's value is 256 characters.
*
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* This method will never return null. If you would like to know whether the service returned this field (so that
* you can differentiate between null and empty), you can use the {@link #hasTags} method.
*
*
* @return A list of up to 50 tags that you can assign to a cached volume. Each tag is a key-value pair.
*
* Valid characters for key and value are letters, spaces, and numbers that you can represent in UTF-8
* format, and the following special characters: + - = . _ : / @. The maximum length of a tag's key is 128
* characters, and the maximum length for a tag's value is 256 characters.
*
*/
public final List tags() {
return tags;
}
@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(volumeSizeInBytes());
hashCode = 31 * hashCode + Objects.hashCode(snapshotId());
hashCode = 31 * hashCode + Objects.hashCode(targetName());
hashCode = 31 * hashCode + Objects.hashCode(sourceVolumeARN());
hashCode = 31 * hashCode + Objects.hashCode(networkInterfaceId());
hashCode = 31 * hashCode + Objects.hashCode(clientToken());
hashCode = 31 * hashCode + Objects.hashCode(kmsEncrypted());
hashCode = 31 * hashCode + Objects.hashCode(kmsKey());
hashCode = 31 * hashCode + Objects.hashCode(hasTags() ? tags() : null);
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 CreateCachediScsiVolumeRequest)) {
return false;
}
CreateCachediScsiVolumeRequest other = (CreateCachediScsiVolumeRequest) obj;
return Objects.equals(gatewayARN(), other.gatewayARN()) && Objects.equals(volumeSizeInBytes(), other.volumeSizeInBytes())
&& Objects.equals(snapshotId(), other.snapshotId()) && Objects.equals(targetName(), other.targetName())
&& Objects.equals(sourceVolumeARN(), other.sourceVolumeARN())
&& Objects.equals(networkInterfaceId(), other.networkInterfaceId())
&& Objects.equals(clientToken(), other.clientToken()) && Objects.equals(kmsEncrypted(), other.kmsEncrypted())
&& Objects.equals(kmsKey(), other.kmsKey()) && hasTags() == other.hasTags()
&& Objects.equals(tags(), other.tags());
}
/**
* 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("CreateCachediScsiVolumeRequest").add("GatewayARN", gatewayARN())
.add("VolumeSizeInBytes", volumeSizeInBytes()).add("SnapshotId", snapshotId()).add("TargetName", targetName())
.add("SourceVolumeARN", sourceVolumeARN()).add("NetworkInterfaceId", networkInterfaceId())
.add("ClientToken", clientToken()).add("KMSEncrypted", kmsEncrypted()).add("KMSKey", kmsKey())
.add("Tags", hasTags() ? tags() : null).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "GatewayARN":
return Optional.ofNullable(clazz.cast(gatewayARN()));
case "VolumeSizeInBytes":
return Optional.ofNullable(clazz.cast(volumeSizeInBytes()));
case "SnapshotId":
return Optional.ofNullable(clazz.cast(snapshotId()));
case "TargetName":
return Optional.ofNullable(clazz.cast(targetName()));
case "SourceVolumeARN":
return Optional.ofNullable(clazz.cast(sourceVolumeARN()));
case "NetworkInterfaceId":
return Optional.ofNullable(clazz.cast(networkInterfaceId()));
case "ClientToken":
return Optional.ofNullable(clazz.cast(clientToken()));
case "KMSEncrypted":
return Optional.ofNullable(clazz.cast(kmsEncrypted()));
case "KMSKey":
return Optional.ofNullable(clazz.cast(kmsKey()));
case "Tags":
return Optional.ofNullable(clazz.cast(tags()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function