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

software.amazon.awssdk.services.sagemaker.model.DebugRuleConfiguration 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.28.4
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.Collections;
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.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.core.traits.MapTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructMap;
import software.amazon.awssdk.core.util.SdkAutoConstructMap;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;

/**
 * 

* Configuration information for SageMaker Debugger rules for debugging. To learn more about how to configure the * DebugRuleConfiguration parameter, see Use the SageMaker and * Debugger Configuration API Operations to Create, Update, and Debug Your Training Job. *

*/ @Generated("software.amazon.awssdk:codegen") public final class DebugRuleConfiguration implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField RULE_CONFIGURATION_NAME_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("RuleConfigurationName").getter(getter(DebugRuleConfiguration::ruleConfigurationName)) .setter(setter(Builder::ruleConfigurationName)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("RuleConfigurationName").build()) .build(); private static final SdkField LOCAL_PATH_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("LocalPath").getter(getter(DebugRuleConfiguration::localPath)).setter(setter(Builder::localPath)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LocalPath").build()).build(); private static final SdkField S3_OUTPUT_PATH_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("S3OutputPath").getter(getter(DebugRuleConfiguration::s3OutputPath)) .setter(setter(Builder::s3OutputPath)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("S3OutputPath").build()).build(); private static final SdkField RULE_EVALUATOR_IMAGE_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("RuleEvaluatorImage").getter(getter(DebugRuleConfiguration::ruleEvaluatorImage)) .setter(setter(Builder::ruleEvaluatorImage)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("RuleEvaluatorImage").build()) .build(); private static final SdkField INSTANCE_TYPE_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("InstanceType").getter(getter(DebugRuleConfiguration::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(DebugRuleConfiguration::volumeSizeInGB)) .setter(setter(Builder::volumeSizeInGB)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("VolumeSizeInGB").build()).build(); private static final SdkField> RULE_PARAMETERS_FIELD = SdkField .> builder(MarshallingType.MAP) .memberName("RuleParameters") .getter(getter(DebugRuleConfiguration::ruleParameters)) .setter(setter(Builder::ruleParameters)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("RuleParameters").build(), MapTrait.builder() .keyLocationName("key") .valueLocationName("value") .valueFieldInfo( SdkField. builder(MarshallingType.STRING) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("value").build()).build()).build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(RULE_CONFIGURATION_NAME_FIELD, LOCAL_PATH_FIELD, S3_OUTPUT_PATH_FIELD, RULE_EVALUATOR_IMAGE_FIELD, INSTANCE_TYPE_FIELD, VOLUME_SIZE_IN_GB_FIELD, RULE_PARAMETERS_FIELD)); private static final long serialVersionUID = 1L; private final String ruleConfigurationName; private final String localPath; private final String s3OutputPath; private final String ruleEvaluatorImage; private final String instanceType; private final Integer volumeSizeInGB; private final Map ruleParameters; private DebugRuleConfiguration(BuilderImpl builder) { this.ruleConfigurationName = builder.ruleConfigurationName; this.localPath = builder.localPath; this.s3OutputPath = builder.s3OutputPath; this.ruleEvaluatorImage = builder.ruleEvaluatorImage; this.instanceType = builder.instanceType; this.volumeSizeInGB = builder.volumeSizeInGB; this.ruleParameters = builder.ruleParameters; } /** *

* The name of the rule configuration. It must be unique relative to other rule configuration names. *

* * @return The name of the rule configuration. It must be unique relative to other rule configuration names. */ public final String ruleConfigurationName() { return ruleConfigurationName; } /** *

* Path to local storage location for output of rules. Defaults to /opt/ml/processing/output/rule/. *

* * @return Path to local storage location for output of rules. Defaults to * /opt/ml/processing/output/rule/. */ public final String localPath() { return localPath; } /** *

* Path to Amazon S3 storage location for rules. *

* * @return Path to Amazon S3 storage location for rules. */ public final String s3OutputPath() { return s3OutputPath; } /** *

* The Amazon Elastic Container (ECR) Image for the managed rule evaluation. *

* * @return The Amazon Elastic Container (ECR) Image for the managed rule evaluation. */ public final String ruleEvaluatorImage() { return ruleEvaluatorImage; } /** *

* The instance type to deploy a custom rule for debugging a training 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 instance type to deploy a custom rule for debugging a training job. * @see ProcessingInstanceType */ public final ProcessingInstanceType instanceType() { return ProcessingInstanceType.fromValue(instanceType); } /** *

* The instance type to deploy a custom rule for debugging a training 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 instance type to deploy a custom rule for debugging a training job. * @see ProcessingInstanceType */ public final String instanceTypeAsString() { return instanceType; } /** *

* The size, in GB, of the ML storage volume attached to the processing instance. *

* * @return The size, in GB, of the ML storage volume attached to the processing instance. */ public final Integer volumeSizeInGB() { return volumeSizeInGB; } /** * For responses, this returns true if the service returned a value for the RuleParameters 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 hasRuleParameters() { return ruleParameters != null && !(ruleParameters instanceof SdkAutoConstructMap); } /** *

* Runtime configuration for rule container. *

*

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

* * @return Runtime configuration for rule container. */ public final Map ruleParameters() { return ruleParameters; } @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(ruleConfigurationName()); hashCode = 31 * hashCode + Objects.hashCode(localPath()); hashCode = 31 * hashCode + Objects.hashCode(s3OutputPath()); hashCode = 31 * hashCode + Objects.hashCode(ruleEvaluatorImage()); hashCode = 31 * hashCode + Objects.hashCode(instanceTypeAsString()); hashCode = 31 * hashCode + Objects.hashCode(volumeSizeInGB()); hashCode = 31 * hashCode + Objects.hashCode(hasRuleParameters() ? ruleParameters() : null); 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 DebugRuleConfiguration)) { return false; } DebugRuleConfiguration other = (DebugRuleConfiguration) obj; return Objects.equals(ruleConfigurationName(), other.ruleConfigurationName()) && Objects.equals(localPath(), other.localPath()) && Objects.equals(s3OutputPath(), other.s3OutputPath()) && Objects.equals(ruleEvaluatorImage(), other.ruleEvaluatorImage()) && Objects.equals(instanceTypeAsString(), other.instanceTypeAsString()) && Objects.equals(volumeSizeInGB(), other.volumeSizeInGB()) && hasRuleParameters() == other.hasRuleParameters() && Objects.equals(ruleParameters(), other.ruleParameters()); } /** * 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("DebugRuleConfiguration").add("RuleConfigurationName", ruleConfigurationName()) .add("LocalPath", localPath()).add("S3OutputPath", s3OutputPath()) .add("RuleEvaluatorImage", ruleEvaluatorImage()).add("InstanceType", instanceTypeAsString()) .add("VolumeSizeInGB", volumeSizeInGB()).add("RuleParameters", hasRuleParameters() ? ruleParameters() : null) .build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "RuleConfigurationName": return Optional.ofNullable(clazz.cast(ruleConfigurationName())); case "LocalPath": return Optional.ofNullable(clazz.cast(localPath())); case "S3OutputPath": return Optional.ofNullable(clazz.cast(s3OutputPath())); case "RuleEvaluatorImage": return Optional.ofNullable(clazz.cast(ruleEvaluatorImage())); case "InstanceType": return Optional.ofNullable(clazz.cast(instanceTypeAsString())); case "VolumeSizeInGB": return Optional.ofNullable(clazz.cast(volumeSizeInGB())); case "RuleParameters": return Optional.ofNullable(clazz.cast(ruleParameters())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((DebugRuleConfiguration) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The name of the rule configuration. It must be unique relative to other rule configuration names. *

* * @param ruleConfigurationName * The name of the rule configuration. It must be unique relative to other rule configuration names. * @return Returns a reference to this object so that method calls can be chained together. */ Builder ruleConfigurationName(String ruleConfigurationName); /** *

* Path to local storage location for output of rules. Defaults to /opt/ml/processing/output/rule/. *

* * @param localPath * Path to local storage location for output of rules. Defaults to * /opt/ml/processing/output/rule/. * @return Returns a reference to this object so that method calls can be chained together. */ Builder localPath(String localPath); /** *

* Path to Amazon S3 storage location for rules. *

* * @param s3OutputPath * Path to Amazon S3 storage location for rules. * @return Returns a reference to this object so that method calls can be chained together. */ Builder s3OutputPath(String s3OutputPath); /** *

* The Amazon Elastic Container (ECR) Image for the managed rule evaluation. *

* * @param ruleEvaluatorImage * The Amazon Elastic Container (ECR) Image for the managed rule evaluation. * @return Returns a reference to this object so that method calls can be chained together. */ Builder ruleEvaluatorImage(String ruleEvaluatorImage); /** *

* The instance type to deploy a custom rule for debugging a training job. *

* * @param instanceType * The instance type to deploy a custom rule for debugging a training job. * @see ProcessingInstanceType * @return Returns a reference to this object so that method calls can be chained together. * @see ProcessingInstanceType */ Builder instanceType(String instanceType); /** *

* The instance type to deploy a custom rule for debugging a training job. *

* * @param instanceType * The instance type to deploy a custom rule for debugging a training job. * @see ProcessingInstanceType * @return Returns a reference to this object so that method calls can be chained together. * @see ProcessingInstanceType */ Builder instanceType(ProcessingInstanceType instanceType); /** *

* The size, in GB, of the ML storage volume attached to the processing instance. *

* * @param volumeSizeInGB * The size, in GB, of the ML storage volume attached to the processing instance. * @return Returns a reference to this object so that method calls can be chained together. */ Builder volumeSizeInGB(Integer volumeSizeInGB); /** *

* Runtime configuration for rule container. *

* * @param ruleParameters * Runtime configuration for rule container. * @return Returns a reference to this object so that method calls can be chained together. */ Builder ruleParameters(Map ruleParameters); } static final class BuilderImpl implements Builder { private String ruleConfigurationName; private String localPath; private String s3OutputPath; private String ruleEvaluatorImage; private String instanceType; private Integer volumeSizeInGB; private Map ruleParameters = DefaultSdkAutoConstructMap.getInstance(); private BuilderImpl() { } private BuilderImpl(DebugRuleConfiguration model) { ruleConfigurationName(model.ruleConfigurationName); localPath(model.localPath); s3OutputPath(model.s3OutputPath); ruleEvaluatorImage(model.ruleEvaluatorImage); instanceType(model.instanceType); volumeSizeInGB(model.volumeSizeInGB); ruleParameters(model.ruleParameters); } public final String getRuleConfigurationName() { return ruleConfigurationName; } public final void setRuleConfigurationName(String ruleConfigurationName) { this.ruleConfigurationName = ruleConfigurationName; } @Override public final Builder ruleConfigurationName(String ruleConfigurationName) { this.ruleConfigurationName = ruleConfigurationName; return this; } public final String getLocalPath() { return localPath; } public final void setLocalPath(String localPath) { this.localPath = localPath; } @Override public final Builder localPath(String localPath) { this.localPath = localPath; return this; } public final String getS3OutputPath() { return s3OutputPath; } public final void setS3OutputPath(String s3OutputPath) { this.s3OutputPath = s3OutputPath; } @Override public final Builder s3OutputPath(String s3OutputPath) { this.s3OutputPath = s3OutputPath; return this; } public final String getRuleEvaluatorImage() { return ruleEvaluatorImage; } public final void setRuleEvaluatorImage(String ruleEvaluatorImage) { this.ruleEvaluatorImage = ruleEvaluatorImage; } @Override public final Builder ruleEvaluatorImage(String ruleEvaluatorImage) { this.ruleEvaluatorImage = ruleEvaluatorImage; 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(ProcessingInstanceType instanceType) { this.instanceType(instanceType == null ? null : instanceType.toString()); return this; } public final Integer getVolumeSizeInGB() { return volumeSizeInGB; } public final void setVolumeSizeInGB(Integer volumeSizeInGB) { this.volumeSizeInGB = volumeSizeInGB; } @Override public final Builder volumeSizeInGB(Integer volumeSizeInGB) { this.volumeSizeInGB = volumeSizeInGB; return this; } public final Map getRuleParameters() { if (ruleParameters instanceof SdkAutoConstructMap) { return null; } return ruleParameters; } public final void setRuleParameters(Map ruleParameters) { this.ruleParameters = RuleParametersCopier.copy(ruleParameters); } @Override public final Builder ruleParameters(Map ruleParameters) { this.ruleParameters = RuleParametersCopier.copy(ruleParameters); return this; } @Override public DebugRuleConfiguration build() { return new DebugRuleConfiguration(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy