software.amazon.awssdk.services.sagemaker.model.ProcessingClusterConfig Maven / Gradle / Ivy
Show all versions of sagemaker Show documentation
/*
* 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;
/**
*
* Configuration for the cluster used to run a processing job.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class ProcessingClusterConfig implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField INSTANCE_COUNT_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("InstanceCount").getter(getter(ProcessingClusterConfig::instanceCount))
.setter(setter(Builder::instanceCount))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("InstanceCount").build()).build();
private static final SdkField INSTANCE_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("InstanceType").getter(getter(ProcessingClusterConfig::instanceTypeAsString))
.setter(setter(Builder::instanceType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("InstanceType").build()).build();
private static final SdkField VOLUME_SIZE_IN_GB_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("VolumeSizeInGB").getter(getter(ProcessingClusterConfig::volumeSizeInGB))
.setter(setter(Builder::volumeSizeInGB))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("VolumeSizeInGB").build()).build();
private static final SdkField VOLUME_KMS_KEY_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("VolumeKmsKeyId").getter(getter(ProcessingClusterConfig::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_COUNT_FIELD,
INSTANCE_TYPE_FIELD, VOLUME_SIZE_IN_GB_FIELD, VOLUME_KMS_KEY_ID_FIELD));
private static final long serialVersionUID = 1L;
private final Integer instanceCount;
private final String instanceType;
private final Integer volumeSizeInGB;
private final String volumeKmsKeyId;
private ProcessingClusterConfig(BuilderImpl builder) {
this.instanceCount = builder.instanceCount;
this.instanceType = builder.instanceType;
this.volumeSizeInGB = builder.volumeSizeInGB;
this.volumeKmsKeyId = builder.volumeKmsKeyId;
}
/**
*
* The number of ML compute instances to use in the processing job. For distributed processing jobs, specify a value
* greater than 1. The default value is 1.
*
*
* @return The number of ML compute instances to use in the processing job. For distributed processing jobs, specify
* a value greater than 1. The default value is 1.
*/
public final Integer instanceCount() {
return instanceCount;
}
/**
*
* The ML compute instance type for the processing job.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #instanceType} will
* return {@link ProcessingInstanceType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #instanceTypeAsString}.
*
*
* @return The ML compute instance type for the processing job.
* @see ProcessingInstanceType
*/
public final ProcessingInstanceType instanceType() {
return ProcessingInstanceType.fromValue(instanceType);
}
/**
*
* The ML compute instance type for the processing job.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #instanceType} will
* return {@link ProcessingInstanceType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #instanceTypeAsString}.
*
*
* @return The ML compute instance type for the processing job.
* @see ProcessingInstanceType
*/
public final String instanceTypeAsString() {
return instanceType;
}
/**
*
* The size of the ML storage volume in gigabytes that you want to provision. You must specify sufficient ML storage
* for your scenario.
*
*
*
* Certain Nitro-based instances include local storage with a fixed total size, dependent on the instance type. When
* using these instances for processing, Amazon SageMaker mounts the local instance storage instead of Amazon EBS
* gp2 storage. You can't request a VolumeSizeInGB
greater than the total size of the local instance
* storage.
*
*
* For a list of instance types that support local instance storage, including the total size per instance type, see
* Instance
* Store Volumes.
*
*
*
* @return The size of the ML storage volume in gigabytes that you want to provision. You must specify sufficient ML
* storage for your scenario.
*
* Certain Nitro-based instances include local storage with a fixed total size, dependent on the instance
* type. When using these instances for processing, Amazon SageMaker mounts the local instance storage
* instead of Amazon EBS gp2 storage. You can't request a VolumeSizeInGB
greater than the total
* size of the local instance storage.
*
*
* For a list of instance types that support local instance storage, including the total size per instance
* type, see Instance Store Volumes.
*
*/
public final Integer volumeSizeInGB() {
return volumeSizeInGB;
}
/**
*
* The Amazon Web Services Key Management Service (Amazon Web Services KMS) key that Amazon SageMaker uses to
* encrypt data on the storage volume attached to the ML compute instance(s) that run the processing 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.
*
*
*
* @return The Amazon Web Services Key Management Service (Amazon Web Services KMS) key that Amazon SageMaker uses
* to encrypt data on the storage volume attached to the ML compute instance(s) that run the processing 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.
*
*/
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(instanceCount());
hashCode = 31 * hashCode + Objects.hashCode(instanceTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(volumeSizeInGB());
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 ProcessingClusterConfig)) {
return false;
}
ProcessingClusterConfig other = (ProcessingClusterConfig) obj;
return Objects.equals(instanceCount(), other.instanceCount())
&& Objects.equals(instanceTypeAsString(), other.instanceTypeAsString())
&& Objects.equals(volumeSizeInGB(), other.volumeSizeInGB())
&& 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("ProcessingClusterConfig").add("InstanceCount", instanceCount())
.add("InstanceType", instanceTypeAsString()).add("VolumeSizeInGB", volumeSizeInGB())
.add("VolumeKmsKeyId", volumeKmsKeyId()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "InstanceCount":
return Optional.ofNullable(clazz.cast(instanceCount()));
case "InstanceType":
return Optional.ofNullable(clazz.cast(instanceTypeAsString()));
case "VolumeSizeInGB":
return Optional.ofNullable(clazz.cast(volumeSizeInGB()));
case "VolumeKmsKeyId":
return Optional.ofNullable(clazz.cast(volumeKmsKeyId()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function