
software.amazon.awssdk.services.sagemaker.model.TransformResources 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.sagemaker.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 the resources, including ML instance types and ML instance count, to use for transform job.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class TransformResources implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField INSTANCE_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("InstanceType").getter(getter(TransformResources::instanceTypeAsString))
.setter(setter(Builder::instanceType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("InstanceType").build()).build();
private static final SdkField INSTANCE_COUNT_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("InstanceCount").getter(getter(TransformResources::instanceCount)).setter(setter(Builder::instanceCount))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("InstanceCount").build()).build();
private static final SdkField VOLUME_KMS_KEY_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("VolumeKmsKeyId").getter(getter(TransformResources::volumeKmsKeyId))
.setter(setter(Builder::volumeKmsKeyId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("VolumeKmsKeyId").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(INSTANCE_TYPE_FIELD,
INSTANCE_COUNT_FIELD, VOLUME_KMS_KEY_ID_FIELD));
private static final long serialVersionUID = 1L;
private final String instanceType;
private final Integer instanceCount;
private final String volumeKmsKeyId;
private TransformResources(BuilderImpl builder) {
this.instanceType = builder.instanceType;
this.instanceCount = builder.instanceCount;
this.volumeKmsKeyId = builder.volumeKmsKeyId;
}
/**
*
* The ML compute instance type for the transform job. If you are using built-in algorithms to transform moderately
* sized datasets, we recommend using ml.m4.xlarge or ml.m5.large
instance types.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #instanceType} will
* return {@link TransformInstanceType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #instanceTypeAsString}.
*
*
* @return The ML compute instance type for the transform job. If you are using built-in algorithms to transform
* moderately sized datasets, we recommend using ml.m4.xlarge or ml.m5.large
instance types.
* @see TransformInstanceType
*/
public final TransformInstanceType instanceType() {
return TransformInstanceType.fromValue(instanceType);
}
/**
*
* The ML compute instance type for the transform job. If you are using built-in algorithms to transform moderately
* sized datasets, we recommend using ml.m4.xlarge or ml.m5.large
instance types.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #instanceType} will
* return {@link TransformInstanceType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #instanceTypeAsString}.
*
*
* @return The ML compute instance type for the transform job. If you are using built-in algorithms to transform
* moderately sized datasets, we recommend using ml.m4.xlarge or ml.m5.large
instance types.
* @see TransformInstanceType
*/
public final String instanceTypeAsString() {
return instanceType;
}
/**
*
* The number of ML compute instances to use in the transform job. The default value is 1
, and the
* maximum is 100
. For distributed transform jobs, specify a value greater than 1
.
*
*
* @return The number of ML compute instances to use in the transform job. The default value is 1
, and
* the maximum is 100
. For distributed transform jobs, specify a value greater than
* 1
.
*/
public final Integer instanceCount() {
return instanceCount;
}
/**
*
* The Amazon Web Services Key Management Service (Amazon Web Services KMS) key that Amazon SageMaker uses to
* encrypt model data on the storage volume attached to the ML compute instance(s) that run the batch transform job.
*
*
*
* Certain Nitro-based instances include local storage, dependent on the instance type. Local storage volumes are
* encrypted using a hardware module on the instance. You can't request a VolumeKmsKeyId
when using an
* instance type with local storage.
*
*
* For a list of instance types that support local instance storage, see Instance
* Store Volumes.
*
*
* For more information about local instance storage encryption, see SSD Instance Store
* Volumes.
*
*
*
* The VolumeKmsKeyId
can be any of the following formats:
*
*
* -
*
* Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab
*
*
* -
*
* Key ARN: arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab
*
*
* -
*
* Alias name: alias/ExampleAlias
*
*
* -
*
* Alias name ARN: arn:aws:kms:us-west-2:111122223333:alias/ExampleAlias
*
*
*
*
* @return The Amazon Web Services Key Management Service (Amazon Web Services KMS) key that Amazon SageMaker uses
* to encrypt model data on the storage volume attached to the ML compute instance(s) that run the batch
* transform job.
*
* Certain Nitro-based instances include local storage, dependent on the instance type. Local storage
* volumes are encrypted using a hardware module on the instance. You can't request a
* VolumeKmsKeyId
when using an instance type with local storage.
*
*
* For a list of instance types that support local instance storage, see Instance Store Volumes.
*
*
* For more information about local instance storage encryption, see SSD Instance Store
* Volumes.
*
*
*
* The VolumeKmsKeyId
can be any of the following formats:
*
*
* -
*
* Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab
*
*
* -
*
* Key ARN: arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab
*
*
* -
*
* Alias name: alias/ExampleAlias
*
*
* -
*
* Alias name ARN: arn:aws:kms:us-west-2:111122223333:alias/ExampleAlias
*
*
*/
public final String volumeKmsKeyId() {
return volumeKmsKeyId;
}
@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 + Objects.hashCode(instanceTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(instanceCount());
hashCode = 31 * hashCode + Objects.hashCode(volumeKmsKeyId());
return hashCode;
}
@Override
public final boolean equals(Object obj) {
return equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof TransformResources)) {
return false;
}
TransformResources other = (TransformResources) obj;
return Objects.equals(instanceTypeAsString(), other.instanceTypeAsString())
&& Objects.equals(instanceCount(), other.instanceCount())
&& Objects.equals(volumeKmsKeyId(), other.volumeKmsKeyId());
}
/**
* 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("TransformResources").add("InstanceType", instanceTypeAsString())
.add("InstanceCount", instanceCount()).add("VolumeKmsKeyId", volumeKmsKeyId()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "InstanceType":
return Optional.ofNullable(clazz.cast(instanceTypeAsString()));
case "InstanceCount":
return Optional.ofNullable(clazz.cast(instanceCount()));
case "VolumeKmsKeyId":
return Optional.ofNullable(clazz.cast(volumeKmsKeyId()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function