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

software.amazon.awssdk.services.sagemaker.model.ClusterInstanceGroupSpecification Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Amazon SageMaker module holds the client classes that are used for communicating with Amazon SageMaker Service

There is a newer version: 2.30.1
Show newest version
/*
 * 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.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
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.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;

/**
 * 

* The specifications of an instance group that you need to define. *

*/ @Generated("software.amazon.awssdk:codegen") public final class ClusterInstanceGroupSpecification implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField INSTANCE_COUNT_FIELD = SdkField. builder(MarshallingType.INTEGER) .memberName("InstanceCount").getter(getter(ClusterInstanceGroupSpecification::instanceCount)) .setter(setter(Builder::instanceCount)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("InstanceCount").build()).build(); private static final SdkField INSTANCE_GROUP_NAME_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("InstanceGroupName").getter(getter(ClusterInstanceGroupSpecification::instanceGroupName)) .setter(setter(Builder::instanceGroupName)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("InstanceGroupName").build()).build(); private static final SdkField INSTANCE_TYPE_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("InstanceType").getter(getter(ClusterInstanceGroupSpecification::instanceTypeAsString)) .setter(setter(Builder::instanceType)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("InstanceType").build()).build(); private static final SdkField LIFE_CYCLE_CONFIG_FIELD = SdkField . builder(MarshallingType.SDK_POJO).memberName("LifeCycleConfig") .getter(getter(ClusterInstanceGroupSpecification::lifeCycleConfig)).setter(setter(Builder::lifeCycleConfig)) .constructor(ClusterLifeCycleConfig::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LifeCycleConfig").build()).build(); private static final SdkField EXECUTION_ROLE_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("ExecutionRole").getter(getter(ClusterInstanceGroupSpecification::executionRole)) .setter(setter(Builder::executionRole)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ExecutionRole").build()).build(); private static final SdkField THREADS_PER_CORE_FIELD = SdkField. builder(MarshallingType.INTEGER) .memberName("ThreadsPerCore").getter(getter(ClusterInstanceGroupSpecification::threadsPerCore)) .setter(setter(Builder::threadsPerCore)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ThreadsPerCore").build()).build(); private static final SdkField> INSTANCE_STORAGE_CONFIGS_FIELD = SdkField .> builder(MarshallingType.LIST) .memberName("InstanceStorageConfigs") .getter(getter(ClusterInstanceGroupSpecification::instanceStorageConfigs)) .setter(setter(Builder::instanceStorageConfigs)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("InstanceStorageConfigs").build(), ListTrait .builder() .memberLocationName(null) .memberFieldInfo( SdkField. builder(MarshallingType.SDK_POJO) .constructor(ClusterInstanceStorageConfig::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("member").build()).build()).build()).build(); private static final SdkField> ON_START_DEEP_HEALTH_CHECKS_FIELD = SdkField .> builder(MarshallingType.LIST) .memberName("OnStartDeepHealthChecks") .getter(getter(ClusterInstanceGroupSpecification::onStartDeepHealthChecksAsStrings)) .setter(setter(Builder::onStartDeepHealthChecksWithStrings)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("OnStartDeepHealthChecks").build(), ListTrait .builder() .memberLocationName(null) .memberFieldInfo( SdkField. builder(MarshallingType.STRING) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("member").build()).build()).build()).build(); private static final SdkField TRAINING_PLAN_ARN_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("TrainingPlanArn").getter(getter(ClusterInstanceGroupSpecification::trainingPlanArn)) .setter(setter(Builder::trainingPlanArn)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TrainingPlanArn").build()).build(); private static final SdkField OVERRIDE_VPC_CONFIG_FIELD = SdkField. builder(MarshallingType.SDK_POJO) .memberName("OverrideVpcConfig").getter(getter(ClusterInstanceGroupSpecification::overrideVpcConfig)) .setter(setter(Builder::overrideVpcConfig)).constructor(VpcConfig::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("OverrideVpcConfig").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(INSTANCE_COUNT_FIELD, INSTANCE_GROUP_NAME_FIELD, INSTANCE_TYPE_FIELD, LIFE_CYCLE_CONFIG_FIELD, EXECUTION_ROLE_FIELD, THREADS_PER_CORE_FIELD, INSTANCE_STORAGE_CONFIGS_FIELD, ON_START_DEEP_HEALTH_CHECKS_FIELD, TRAINING_PLAN_ARN_FIELD, OVERRIDE_VPC_CONFIG_FIELD)); private static final Map> SDK_NAME_TO_FIELD = memberNameToFieldInitializer(); private static final long serialVersionUID = 1L; private final Integer instanceCount; private final String instanceGroupName; private final String instanceType; private final ClusterLifeCycleConfig lifeCycleConfig; private final String executionRole; private final Integer threadsPerCore; private final List instanceStorageConfigs; private final List onStartDeepHealthChecks; private final String trainingPlanArn; private final VpcConfig overrideVpcConfig; private ClusterInstanceGroupSpecification(BuilderImpl builder) { this.instanceCount = builder.instanceCount; this.instanceGroupName = builder.instanceGroupName; this.instanceType = builder.instanceType; this.lifeCycleConfig = builder.lifeCycleConfig; this.executionRole = builder.executionRole; this.threadsPerCore = builder.threadsPerCore; this.instanceStorageConfigs = builder.instanceStorageConfigs; this.onStartDeepHealthChecks = builder.onStartDeepHealthChecks; this.trainingPlanArn = builder.trainingPlanArn; this.overrideVpcConfig = builder.overrideVpcConfig; } /** *

* Specifies the number of instances to add to the instance group of a SageMaker HyperPod cluster. *

* * @return Specifies the number of instances to add to the instance group of a SageMaker HyperPod cluster. */ public final Integer instanceCount() { return instanceCount; } /** *

* Specifies the name of the instance group. *

* * @return Specifies the name of the instance group. */ public final String instanceGroupName() { return instanceGroupName; } /** *

* Specifies the instance type of the instance group. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #instanceType} will * return {@link ClusterInstanceType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available * from {@link #instanceTypeAsString}. *

* * @return Specifies the instance type of the instance group. * @see ClusterInstanceType */ public final ClusterInstanceType instanceType() { return ClusterInstanceType.fromValue(instanceType); } /** *

* Specifies the instance type of the instance group. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #instanceType} will * return {@link ClusterInstanceType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available * from {@link #instanceTypeAsString}. *

* * @return Specifies the instance type of the instance group. * @see ClusterInstanceType */ public final String instanceTypeAsString() { return instanceType; } /** *

* Specifies the LifeCycle configuration for the instance group. *

* * @return Specifies the LifeCycle configuration for the instance group. */ public final ClusterLifeCycleConfig lifeCycleConfig() { return lifeCycleConfig; } /** *

* Specifies an IAM execution role to be assumed by the instance group. *

* * @return Specifies an IAM execution role to be assumed by the instance group. */ public final String executionRole() { return executionRole; } /** *

* Specifies the value for Threads per core. For instance types that support multithreading, you can specify * 1 for disabling multithreading and 2 for enabling multithreading. For instance types * that doesn't support multithreading, specify 1. For more information, see the reference table of CPU cores * and threads per CPU core per instance type in the Amazon Elastic Compute Cloud User Guide. *

* * @return Specifies the value for Threads per core. For instance types that support multithreading, you can * specify 1 for disabling multithreading and 2 for enabling multithreading. For * instance types that doesn't support multithreading, specify 1. For more information, see the * reference table of CPU cores and threads per CPU core per instance type in the Amazon Elastic Compute Cloud User * Guide. */ public final Integer threadsPerCore() { return threadsPerCore; } /** * For responses, this returns true if the service returned a value for the InstanceStorageConfigs 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 hasInstanceStorageConfigs() { return instanceStorageConfigs != null && !(instanceStorageConfigs instanceof SdkAutoConstructList); } /** *

* Specifies the additional storage configurations for the instances in the SageMaker HyperPod cluster instance * group. *

*

* 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 #hasInstanceStorageConfigs} method. *

* * @return Specifies the additional storage configurations for the instances in the SageMaker HyperPod cluster * instance group. */ public final List instanceStorageConfigs() { return instanceStorageConfigs; } /** *

* A flag indicating whether deep health checks should be performed when the cluster instance group is created or * updated. *

*

* 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 #hasOnStartDeepHealthChecks} method. *

* * @return A flag indicating whether deep health checks should be performed when the cluster instance group is * created or updated. */ public final List onStartDeepHealthChecks() { return OnStartDeepHealthChecksCopier.copyStringToEnum(onStartDeepHealthChecks); } /** * For responses, this returns true if the service returned a value for the OnStartDeepHealthChecks 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 hasOnStartDeepHealthChecks() { return onStartDeepHealthChecks != null && !(onStartDeepHealthChecks instanceof SdkAutoConstructList); } /** *

* A flag indicating whether deep health checks should be performed when the cluster instance group is created or * updated. *

*

* 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 #hasOnStartDeepHealthChecks} method. *

* * @return A flag indicating whether deep health checks should be performed when the cluster instance group is * created or updated. */ public final List onStartDeepHealthChecksAsStrings() { return onStartDeepHealthChecks; } /** *

* The Amazon Resource Name (ARN); of the training plan to use for this cluster instance group. *

*

* For more information about how to reserve GPU capacity for your SageMaker HyperPod clusters using Amazon * SageMaker Training Plan, see * CreateTrainingPlan * . *

* * @return The Amazon Resource Name (ARN); of the training plan to use for this cluster instance group.

*

* For more information about how to reserve GPU capacity for your SageMaker HyperPod clusters using Amazon * SageMaker Training Plan, see * CreateTrainingPlan . */ public final String trainingPlanArn() { return trainingPlanArn; } /** * Returns the value of the OverrideVpcConfig property for this object. * * @return The value of the OverrideVpcConfig property for this object. */ public final VpcConfig overrideVpcConfig() { return overrideVpcConfig; } @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 + Objects.hashCode(instanceCount()); hashCode = 31 * hashCode + Objects.hashCode(instanceGroupName()); hashCode = 31 * hashCode + Objects.hashCode(instanceTypeAsString()); hashCode = 31 * hashCode + Objects.hashCode(lifeCycleConfig()); hashCode = 31 * hashCode + Objects.hashCode(executionRole()); hashCode = 31 * hashCode + Objects.hashCode(threadsPerCore()); hashCode = 31 * hashCode + Objects.hashCode(hasInstanceStorageConfigs() ? instanceStorageConfigs() : null); hashCode = 31 * hashCode + Objects.hashCode(hasOnStartDeepHealthChecks() ? onStartDeepHealthChecksAsStrings() : null); hashCode = 31 * hashCode + Objects.hashCode(trainingPlanArn()); hashCode = 31 * hashCode + Objects.hashCode(overrideVpcConfig()); 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 ClusterInstanceGroupSpecification)) { return false; } ClusterInstanceGroupSpecification other = (ClusterInstanceGroupSpecification) obj; return Objects.equals(instanceCount(), other.instanceCount()) && Objects.equals(instanceGroupName(), other.instanceGroupName()) && Objects.equals(instanceTypeAsString(), other.instanceTypeAsString()) && Objects.equals(lifeCycleConfig(), other.lifeCycleConfig()) && Objects.equals(executionRole(), other.executionRole()) && Objects.equals(threadsPerCore(), other.threadsPerCore()) && hasInstanceStorageConfigs() == other.hasInstanceStorageConfigs() && Objects.equals(instanceStorageConfigs(), other.instanceStorageConfigs()) && hasOnStartDeepHealthChecks() == other.hasOnStartDeepHealthChecks() && Objects.equals(onStartDeepHealthChecksAsStrings(), other.onStartDeepHealthChecksAsStrings()) && Objects.equals(trainingPlanArn(), other.trainingPlanArn()) && Objects.equals(overrideVpcConfig(), other.overrideVpcConfig()); } /** * 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("ClusterInstanceGroupSpecification").add("InstanceCount", instanceCount()) .add("InstanceGroupName", instanceGroupName()).add("InstanceType", instanceTypeAsString()) .add("LifeCycleConfig", lifeCycleConfig()).add("ExecutionRole", executionRole()) .add("ThreadsPerCore", threadsPerCore()) .add("InstanceStorageConfigs", hasInstanceStorageConfigs() ? instanceStorageConfigs() : null) .add("OnStartDeepHealthChecks", hasOnStartDeepHealthChecks() ? onStartDeepHealthChecksAsStrings() : null) .add("TrainingPlanArn", trainingPlanArn()).add("OverrideVpcConfig", overrideVpcConfig()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "InstanceCount": return Optional.ofNullable(clazz.cast(instanceCount())); case "InstanceGroupName": return Optional.ofNullable(clazz.cast(instanceGroupName())); case "InstanceType": return Optional.ofNullable(clazz.cast(instanceTypeAsString())); case "LifeCycleConfig": return Optional.ofNullable(clazz.cast(lifeCycleConfig())); case "ExecutionRole": return Optional.ofNullable(clazz.cast(executionRole())); case "ThreadsPerCore": return Optional.ofNullable(clazz.cast(threadsPerCore())); case "InstanceStorageConfigs": return Optional.ofNullable(clazz.cast(instanceStorageConfigs())); case "OnStartDeepHealthChecks": return Optional.ofNullable(clazz.cast(onStartDeepHealthChecksAsStrings())); case "TrainingPlanArn": return Optional.ofNullable(clazz.cast(trainingPlanArn())); case "OverrideVpcConfig": return Optional.ofNullable(clazz.cast(overrideVpcConfig())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } @Override public final Map> sdkFieldNameToField() { return SDK_NAME_TO_FIELD; } private static Map> memberNameToFieldInitializer() { Map> map = new HashMap<>(); map.put("InstanceCount", INSTANCE_COUNT_FIELD); map.put("InstanceGroupName", INSTANCE_GROUP_NAME_FIELD); map.put("InstanceType", INSTANCE_TYPE_FIELD); map.put("LifeCycleConfig", LIFE_CYCLE_CONFIG_FIELD); map.put("ExecutionRole", EXECUTION_ROLE_FIELD); map.put("ThreadsPerCore", THREADS_PER_CORE_FIELD); map.put("InstanceStorageConfigs", INSTANCE_STORAGE_CONFIGS_FIELD); map.put("OnStartDeepHealthChecks", ON_START_DEEP_HEALTH_CHECKS_FIELD); map.put("TrainingPlanArn", TRAINING_PLAN_ARN_FIELD); map.put("OverrideVpcConfig", OVERRIDE_VPC_CONFIG_FIELD); return Collections.unmodifiableMap(map); } private static Function getter(Function g) { return obj -> g.apply((ClusterInstanceGroupSpecification) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* Specifies the number of instances to add to the instance group of a SageMaker HyperPod cluster. *

* * @param instanceCount * Specifies the number of instances to add to the instance group of a SageMaker HyperPod cluster. * @return Returns a reference to this object so that method calls can be chained together. */ Builder instanceCount(Integer instanceCount); /** *

* Specifies the name of the instance group. *

* * @param instanceGroupName * Specifies the name of the instance group. * @return Returns a reference to this object so that method calls can be chained together. */ Builder instanceGroupName(String instanceGroupName); /** *

* Specifies the instance type of the instance group. *

* * @param instanceType * Specifies the instance type of the instance group. * @see ClusterInstanceType * @return Returns a reference to this object so that method calls can be chained together. * @see ClusterInstanceType */ Builder instanceType(String instanceType); /** *

* Specifies the instance type of the instance group. *

* * @param instanceType * Specifies the instance type of the instance group. * @see ClusterInstanceType * @return Returns a reference to this object so that method calls can be chained together. * @see ClusterInstanceType */ Builder instanceType(ClusterInstanceType instanceType); /** *

* Specifies the LifeCycle configuration for the instance group. *

* * @param lifeCycleConfig * Specifies the LifeCycle configuration for the instance group. * @return Returns a reference to this object so that method calls can be chained together. */ Builder lifeCycleConfig(ClusterLifeCycleConfig lifeCycleConfig); /** *

* Specifies the LifeCycle configuration for the instance group. *

* This is a convenience method that creates an instance of the {@link ClusterLifeCycleConfig.Builder} avoiding * the need to create one manually via {@link ClusterLifeCycleConfig#builder()}. * *

* When the {@link Consumer} completes, {@link ClusterLifeCycleConfig.Builder#build()} is called immediately and * its result is passed to {@link #lifeCycleConfig(ClusterLifeCycleConfig)}. * * @param lifeCycleConfig * a consumer that will call methods on {@link ClusterLifeCycleConfig.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #lifeCycleConfig(ClusterLifeCycleConfig) */ default Builder lifeCycleConfig(Consumer lifeCycleConfig) { return lifeCycleConfig(ClusterLifeCycleConfig.builder().applyMutation(lifeCycleConfig).build()); } /** *

* Specifies an IAM execution role to be assumed by the instance group. *

* * @param executionRole * Specifies an IAM execution role to be assumed by the instance group. * @return Returns a reference to this object so that method calls can be chained together. */ Builder executionRole(String executionRole); /** *

* Specifies the value for Threads per core. For instance types that support multithreading, you can * specify 1 for disabling multithreading and 2 for enabling multithreading. For * instance types that doesn't support multithreading, specify 1. For more information, see the * reference table of CPU * cores and threads per CPU core per instance type in the Amazon Elastic Compute Cloud User Guide. *

* * @param threadsPerCore * Specifies the value for Threads per core. For instance types that support multithreading, you * can specify 1 for disabling multithreading and 2 for enabling * multithreading. For instance types that doesn't support multithreading, specify 1. For * more information, see the reference table of CPU * cores and threads per CPU core per instance type in the Amazon Elastic Compute Cloud User * Guide. * @return Returns a reference to this object so that method calls can be chained together. */ Builder threadsPerCore(Integer threadsPerCore); /** *

* Specifies the additional storage configurations for the instances in the SageMaker HyperPod cluster instance * group. *

* * @param instanceStorageConfigs * Specifies the additional storage configurations for the instances in the SageMaker HyperPod cluster * instance group. * @return Returns a reference to this object so that method calls can be chained together. */ Builder instanceStorageConfigs(Collection instanceStorageConfigs); /** *

* Specifies the additional storage configurations for the instances in the SageMaker HyperPod cluster instance * group. *

* * @param instanceStorageConfigs * Specifies the additional storage configurations for the instances in the SageMaker HyperPod cluster * instance group. * @return Returns a reference to this object so that method calls can be chained together. */ Builder instanceStorageConfigs(ClusterInstanceStorageConfig... instanceStorageConfigs); /** *

* Specifies the additional storage configurations for the instances in the SageMaker HyperPod cluster instance * group. *

* This is a convenience method that creates an instance of the * {@link software.amazon.awssdk.services.sagemaker.model.ClusterInstanceStorageConfig.Builder} avoiding the * need to create one manually via * {@link software.amazon.awssdk.services.sagemaker.model.ClusterInstanceStorageConfig#builder()}. * *

* When the {@link Consumer} completes, * {@link software.amazon.awssdk.services.sagemaker.model.ClusterInstanceStorageConfig.Builder#build()} is * called immediately and its result is passed to {@link * #instanceStorageConfigs(List)}. * * @param instanceStorageConfigs * a consumer that will call methods on * {@link software.amazon.awssdk.services.sagemaker.model.ClusterInstanceStorageConfig.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #instanceStorageConfigs(java.util.Collection) */ Builder instanceStorageConfigs(Consumer... instanceStorageConfigs); /** *

* A flag indicating whether deep health checks should be performed when the cluster instance group is created * or updated. *

* * @param onStartDeepHealthChecks * A flag indicating whether deep health checks should be performed when the cluster instance group is * created or updated. * @return Returns a reference to this object so that method calls can be chained together. */ Builder onStartDeepHealthChecksWithStrings(Collection onStartDeepHealthChecks); /** *

* A flag indicating whether deep health checks should be performed when the cluster instance group is created * or updated. *

* * @param onStartDeepHealthChecks * A flag indicating whether deep health checks should be performed when the cluster instance group is * created or updated. * @return Returns a reference to this object so that method calls can be chained together. */ Builder onStartDeepHealthChecksWithStrings(String... onStartDeepHealthChecks); /** *

* A flag indicating whether deep health checks should be performed when the cluster instance group is created * or updated. *

* * @param onStartDeepHealthChecks * A flag indicating whether deep health checks should be performed when the cluster instance group is * created or updated. * @return Returns a reference to this object so that method calls can be chained together. */ Builder onStartDeepHealthChecks(Collection onStartDeepHealthChecks); /** *

* A flag indicating whether deep health checks should be performed when the cluster instance group is created * or updated. *

* * @param onStartDeepHealthChecks * A flag indicating whether deep health checks should be performed when the cluster instance group is * created or updated. * @return Returns a reference to this object so that method calls can be chained together. */ Builder onStartDeepHealthChecks(DeepHealthCheckType... onStartDeepHealthChecks); /** *

* The Amazon Resource Name (ARN); of the training plan to use for this cluster instance group. *

*

* For more information about how to reserve GPU capacity for your SageMaker HyperPod clusters using Amazon * SageMaker Training Plan, see * CreateTrainingPlan * . *

* * @param trainingPlanArn * The Amazon Resource Name (ARN); of the training plan to use for this cluster instance group.

*

* For more information about how to reserve GPU capacity for your SageMaker HyperPod clusters using * Amazon SageMaker Training Plan, see * CreateTrainingPlan . * @return Returns a reference to this object so that method calls can be chained together. */ Builder trainingPlanArn(String trainingPlanArn); /** * Sets the value of the OverrideVpcConfig property for this object. * * @param overrideVpcConfig * The new value for the OverrideVpcConfig property for this object. * @return Returns a reference to this object so that method calls can be chained together. */ Builder overrideVpcConfig(VpcConfig overrideVpcConfig); /** * Sets the value of the OverrideVpcConfig property for this object. * * This is a convenience method that creates an instance of the {@link VpcConfig.Builder} avoiding the need to * create one manually via {@link VpcConfig#builder()}. * *

* When the {@link Consumer} completes, {@link VpcConfig.Builder#build()} is called immediately and its result * is passed to {@link #overrideVpcConfig(VpcConfig)}. * * @param overrideVpcConfig * a consumer that will call methods on {@link VpcConfig.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #overrideVpcConfig(VpcConfig) */ default Builder overrideVpcConfig(Consumer overrideVpcConfig) { return overrideVpcConfig(VpcConfig.builder().applyMutation(overrideVpcConfig).build()); } } static final class BuilderImpl implements Builder { private Integer instanceCount; private String instanceGroupName; private String instanceType; private ClusterLifeCycleConfig lifeCycleConfig; private String executionRole; private Integer threadsPerCore; private List instanceStorageConfigs = DefaultSdkAutoConstructList.getInstance(); private List onStartDeepHealthChecks = DefaultSdkAutoConstructList.getInstance(); private String trainingPlanArn; private VpcConfig overrideVpcConfig; private BuilderImpl() { } private BuilderImpl(ClusterInstanceGroupSpecification model) { instanceCount(model.instanceCount); instanceGroupName(model.instanceGroupName); instanceType(model.instanceType); lifeCycleConfig(model.lifeCycleConfig); executionRole(model.executionRole); threadsPerCore(model.threadsPerCore); instanceStorageConfigs(model.instanceStorageConfigs); onStartDeepHealthChecksWithStrings(model.onStartDeepHealthChecks); trainingPlanArn(model.trainingPlanArn); overrideVpcConfig(model.overrideVpcConfig); } public final Integer getInstanceCount() { return instanceCount; } public final void setInstanceCount(Integer instanceCount) { this.instanceCount = instanceCount; } @Override public final Builder instanceCount(Integer instanceCount) { this.instanceCount = instanceCount; return this; } public final String getInstanceGroupName() { return instanceGroupName; } public final void setInstanceGroupName(String instanceGroupName) { this.instanceGroupName = instanceGroupName; } @Override public final Builder instanceGroupName(String instanceGroupName) { this.instanceGroupName = instanceGroupName; return this; } public final String getInstanceType() { return instanceType; } public final void setInstanceType(String instanceType) { this.instanceType = instanceType; } @Override public final Builder instanceType(String instanceType) { this.instanceType = instanceType; return this; } @Override public final Builder instanceType(ClusterInstanceType instanceType) { this.instanceType(instanceType == null ? null : instanceType.toString()); return this; } public final ClusterLifeCycleConfig.Builder getLifeCycleConfig() { return lifeCycleConfig != null ? lifeCycleConfig.toBuilder() : null; } public final void setLifeCycleConfig(ClusterLifeCycleConfig.BuilderImpl lifeCycleConfig) { this.lifeCycleConfig = lifeCycleConfig != null ? lifeCycleConfig.build() : null; } @Override public final Builder lifeCycleConfig(ClusterLifeCycleConfig lifeCycleConfig) { this.lifeCycleConfig = lifeCycleConfig; return this; } public final String getExecutionRole() { return executionRole; } public final void setExecutionRole(String executionRole) { this.executionRole = executionRole; } @Override public final Builder executionRole(String executionRole) { this.executionRole = executionRole; return this; } public final Integer getThreadsPerCore() { return threadsPerCore; } public final void setThreadsPerCore(Integer threadsPerCore) { this.threadsPerCore = threadsPerCore; } @Override public final Builder threadsPerCore(Integer threadsPerCore) { this.threadsPerCore = threadsPerCore; return this; } public final List getInstanceStorageConfigs() { List result = ClusterInstanceStorageConfigsCopier .copyToBuilder(this.instanceStorageConfigs); if (result instanceof SdkAutoConstructList) { return null; } return result; } public final void setInstanceStorageConfigs(Collection instanceStorageConfigs) { this.instanceStorageConfigs = ClusterInstanceStorageConfigsCopier.copyFromBuilder(instanceStorageConfigs); } @Override public final Builder instanceStorageConfigs(Collection instanceStorageConfigs) { this.instanceStorageConfigs = ClusterInstanceStorageConfigsCopier.copy(instanceStorageConfigs); return this; } @Override @SafeVarargs public final Builder instanceStorageConfigs(ClusterInstanceStorageConfig... instanceStorageConfigs) { instanceStorageConfigs(Arrays.asList(instanceStorageConfigs)); return this; } @Override @SafeVarargs public final Builder instanceStorageConfigs(Consumer... instanceStorageConfigs) { instanceStorageConfigs(Stream.of(instanceStorageConfigs) .map(c -> ClusterInstanceStorageConfig.builder().applyMutation(c).build()).collect(Collectors.toList())); return this; } public final Collection getOnStartDeepHealthChecks() { if (onStartDeepHealthChecks instanceof SdkAutoConstructList) { return null; } return onStartDeepHealthChecks; } public final void setOnStartDeepHealthChecks(Collection onStartDeepHealthChecks) { this.onStartDeepHealthChecks = OnStartDeepHealthChecksCopier.copy(onStartDeepHealthChecks); } @Override public final Builder onStartDeepHealthChecksWithStrings(Collection onStartDeepHealthChecks) { this.onStartDeepHealthChecks = OnStartDeepHealthChecksCopier.copy(onStartDeepHealthChecks); return this; } @Override @SafeVarargs public final Builder onStartDeepHealthChecksWithStrings(String... onStartDeepHealthChecks) { onStartDeepHealthChecksWithStrings(Arrays.asList(onStartDeepHealthChecks)); return this; } @Override public final Builder onStartDeepHealthChecks(Collection onStartDeepHealthChecks) { this.onStartDeepHealthChecks = OnStartDeepHealthChecksCopier.copyEnumToString(onStartDeepHealthChecks); return this; } @Override @SafeVarargs public final Builder onStartDeepHealthChecks(DeepHealthCheckType... onStartDeepHealthChecks) { onStartDeepHealthChecks(Arrays.asList(onStartDeepHealthChecks)); return this; } public final String getTrainingPlanArn() { return trainingPlanArn; } public final void setTrainingPlanArn(String trainingPlanArn) { this.trainingPlanArn = trainingPlanArn; } @Override public final Builder trainingPlanArn(String trainingPlanArn) { this.trainingPlanArn = trainingPlanArn; return this; } public final VpcConfig.Builder getOverrideVpcConfig() { return overrideVpcConfig != null ? overrideVpcConfig.toBuilder() : null; } public final void setOverrideVpcConfig(VpcConfig.BuilderImpl overrideVpcConfig) { this.overrideVpcConfig = overrideVpcConfig != null ? overrideVpcConfig.build() : null; } @Override public final Builder overrideVpcConfig(VpcConfig overrideVpcConfig) { this.overrideVpcConfig = overrideVpcConfig; return this; } @Override public ClusterInstanceGroupSpecification build() { return new ClusterInstanceGroupSpecification(this); } @Override public List> sdkFields() { return SDK_FIELDS; } @Override public Map> sdkFieldNameToField() { return SDK_NAME_TO_FIELD; } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy