
software.amazon.awssdk.services.sagemaker.model.CreateAutoMlJobV2Request 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.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 CreateAutoMlJobV2Request extends SageMakerRequest implements
ToCopyableBuilder {
private static final SdkField AUTO_ML_JOB_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("AutoMLJobName").getter(getter(CreateAutoMlJobV2Request::autoMLJobName))
.setter(setter(Builder::autoMLJobName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AutoMLJobName").build()).build();
private static final SdkField> AUTO_ML_JOB_INPUT_DATA_CONFIG_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("AutoMLJobInputDataConfig")
.getter(getter(CreateAutoMlJobV2Request::autoMLJobInputDataConfig))
.setter(setter(Builder::autoMLJobInputDataConfig))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AutoMLJobInputDataConfig").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(AutoMLJobChannel::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField OUTPUT_DATA_CONFIG_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("OutputDataConfig")
.getter(getter(CreateAutoMlJobV2Request::outputDataConfig)).setter(setter(Builder::outputDataConfig))
.constructor(AutoMLOutputDataConfig::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("OutputDataConfig").build()).build();
private static final SdkField AUTO_ML_PROBLEM_TYPE_CONFIG_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("AutoMLProblemTypeConfig")
.getter(getter(CreateAutoMlJobV2Request::autoMLProblemTypeConfig)).setter(setter(Builder::autoMLProblemTypeConfig))
.constructor(AutoMLProblemTypeConfig::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AutoMLProblemTypeConfig").build())
.build();
private static final SdkField ROLE_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("RoleArn").getter(getter(CreateAutoMlJobV2Request::roleArn)).setter(setter(Builder::roleArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("RoleArn").build()).build();
private static final SdkField> TAGS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("Tags")
.getter(getter(CreateAutoMlJobV2Request::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 SdkField SECURITY_CONFIG_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("SecurityConfig")
.getter(getter(CreateAutoMlJobV2Request::securityConfig)).setter(setter(Builder::securityConfig))
.constructor(AutoMLSecurityConfig::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SecurityConfig").build()).build();
private static final SdkField AUTO_ML_JOB_OBJECTIVE_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("AutoMLJobObjective")
.getter(getter(CreateAutoMlJobV2Request::autoMLJobObjective)).setter(setter(Builder::autoMLJobObjective))
.constructor(AutoMLJobObjective::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AutoMLJobObjective").build())
.build();
private static final SdkField MODEL_DEPLOY_CONFIG_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("ModelDeployConfig")
.getter(getter(CreateAutoMlJobV2Request::modelDeployConfig)).setter(setter(Builder::modelDeployConfig))
.constructor(ModelDeployConfig::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ModelDeployConfig").build()).build();
private static final SdkField DATA_SPLIT_CONFIG_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("DataSplitConfig")
.getter(getter(CreateAutoMlJobV2Request::dataSplitConfig)).setter(setter(Builder::dataSplitConfig))
.constructor(AutoMLDataSplitConfig::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DataSplitConfig").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(AUTO_ML_JOB_NAME_FIELD,
AUTO_ML_JOB_INPUT_DATA_CONFIG_FIELD, OUTPUT_DATA_CONFIG_FIELD, AUTO_ML_PROBLEM_TYPE_CONFIG_FIELD, ROLE_ARN_FIELD,
TAGS_FIELD, SECURITY_CONFIG_FIELD, AUTO_ML_JOB_OBJECTIVE_FIELD, MODEL_DEPLOY_CONFIG_FIELD, DATA_SPLIT_CONFIG_FIELD));
private final String autoMLJobName;
private final List autoMLJobInputDataConfig;
private final AutoMLOutputDataConfig outputDataConfig;
private final AutoMLProblemTypeConfig autoMLProblemTypeConfig;
private final String roleArn;
private final List tags;
private final AutoMLSecurityConfig securityConfig;
private final AutoMLJobObjective autoMLJobObjective;
private final ModelDeployConfig modelDeployConfig;
private final AutoMLDataSplitConfig dataSplitConfig;
private CreateAutoMlJobV2Request(BuilderImpl builder) {
super(builder);
this.autoMLJobName = builder.autoMLJobName;
this.autoMLJobInputDataConfig = builder.autoMLJobInputDataConfig;
this.outputDataConfig = builder.outputDataConfig;
this.autoMLProblemTypeConfig = builder.autoMLProblemTypeConfig;
this.roleArn = builder.roleArn;
this.tags = builder.tags;
this.securityConfig = builder.securityConfig;
this.autoMLJobObjective = builder.autoMLJobObjective;
this.modelDeployConfig = builder.modelDeployConfig;
this.dataSplitConfig = builder.dataSplitConfig;
}
/**
*
* Identifies an Autopilot job. The name must be unique to your account and is case insensitive.
*
*
* @return Identifies an Autopilot job. The name must be unique to your account and is case insensitive.
*/
public final String autoMLJobName() {
return autoMLJobName;
}
/**
* For responses, this returns true if the service returned a value for the AutoMLJobInputDataConfig 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 hasAutoMLJobInputDataConfig() {
return autoMLJobInputDataConfig != null && !(autoMLJobInputDataConfig instanceof SdkAutoConstructList);
}
/**
*
* An array of channel objects describing the input data and their location. Each channel is a named input source.
* Similar to the InputDataConfig attribute in the CreateAutoMLJob
input parameters. The supported formats depend
* on the problem type:
*
*
* -
*
* For tabular problem types: S3Prefix
, ManifestFile
.
*
*
* -
*
* For image classification: S3Prefix
, ManifestFile
, AugmentedManifestFile
.
*
*
* -
*
* For text classification: S3Prefix
.
*
*
* -
*
* For time-series forecasting: S3Prefix
.
*
*
*
*
* 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 #hasAutoMLJobInputDataConfig} method.
*
*
* @return An array of channel objects describing the input data and their location. Each channel is a named input
* source. Similar to the InputDataConfig attribute in the CreateAutoMLJob
input parameters. The supported
* formats depend on the problem type:
*
* -
*
* For tabular problem types: S3Prefix
, ManifestFile
.
*
*
* -
*
* For image classification: S3Prefix
, ManifestFile
,
* AugmentedManifestFile
.
*
*
* -
*
* For text classification: S3Prefix
.
*
*
* -
*
* For time-series forecasting: S3Prefix
.
*
*
*/
public final List autoMLJobInputDataConfig() {
return autoMLJobInputDataConfig;
}
/**
*
* Provides information about encryption and the Amazon S3 output path needed to store artifacts from an AutoML job.
*
*
* @return Provides information about encryption and the Amazon S3 output path needed to store artifacts from an
* AutoML job.
*/
public final AutoMLOutputDataConfig outputDataConfig() {
return outputDataConfig;
}
/**
*
* Defines the configuration settings of one of the supported problem types.
*
*
* @return Defines the configuration settings of one of the supported problem types.
*/
public final AutoMLProblemTypeConfig autoMLProblemTypeConfig() {
return autoMLProblemTypeConfig;
}
/**
*
* The ARN of the role that is used to access the data.
*
*
* @return The ARN of the role that is used to access the data.
*/
public final String roleArn() {
return roleArn;
}
/**
* 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);
}
/**
*
* An array of key-value pairs. You can use tags to categorize your Amazon Web Services resources in different ways,
* such as by purpose, owner, or environment. For more information, see Tagging Amazon Web ServicesResources.
* Tag keys must be unique per resource.
*
*
* 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 An array of key-value pairs. You can use tags to categorize your Amazon Web Services resources in
* different ways, such as by purpose, owner, or environment. For more information, see Tagging Amazon Web
* ServicesResources. Tag keys must be unique per resource.
*/
public final List tags() {
return tags;
}
/**
*
* The security configuration for traffic encryption or Amazon VPC settings.
*
*
* @return The security configuration for traffic encryption or Amazon VPC settings.
*/
public final AutoMLSecurityConfig securityConfig() {
return securityConfig;
}
/**
*
* Specifies a metric to minimize or maximize as the objective of a job. If not specified, the default objective
* metric depends on the problem type. For the list of default values per problem type, see AutoMLJobObjective.
*
*
*
* For tabular problem types, you must either provide both the AutoMLJobObjective
and indicate the type
* of supervised learning problem in AutoMLProblemTypeConfig
(TabularJobConfig.ProblemType
* ), or none at all.
*
*
*
* @return Specifies a metric to minimize or maximize as the objective of a job. If not specified, the default
* objective metric depends on the problem type. For the list of default values per problem type, see
* AutoMLJobObjective.
*
* For tabular problem types, you must either provide both the AutoMLJobObjective
and indicate
* the type of supervised learning problem in AutoMLProblemTypeConfig
(
* TabularJobConfig.ProblemType
), or none at all.
*
*/
public final AutoMLJobObjective autoMLJobObjective() {
return autoMLJobObjective;
}
/**
*
* Specifies how to generate the endpoint name for an automatic one-click Autopilot model deployment.
*
*
* @return Specifies how to generate the endpoint name for an automatic one-click Autopilot model deployment.
*/
public final ModelDeployConfig modelDeployConfig() {
return modelDeployConfig;
}
/**
*
* This structure specifies how to split the data into train and validation datasets.
*
*
* The validation and training datasets must contain the same headers. For jobs created by calling
* CreateAutoMLJob
, the validation dataset must be less than 2 GB in size.
*
*
*
* This attribute must not be set for the time-series forecasting problem type, as Autopilot automatically splits
* the input dataset into training and validation sets.
*
*
*
* @return This structure specifies how to split the data into train and validation datasets.
*
* The validation and training datasets must contain the same headers. For jobs created by calling
* CreateAutoMLJob
, the validation dataset must be less than 2 GB in size.
*
*
*
* This attribute must not be set for the time-series forecasting problem type, as Autopilot automatically
* splits the input dataset into training and validation sets.
*
*/
public final AutoMLDataSplitConfig dataSplitConfig() {
return dataSplitConfig;
}
@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(autoMLJobName());
hashCode = 31 * hashCode + Objects.hashCode(hasAutoMLJobInputDataConfig() ? autoMLJobInputDataConfig() : null);
hashCode = 31 * hashCode + Objects.hashCode(outputDataConfig());
hashCode = 31 * hashCode + Objects.hashCode(autoMLProblemTypeConfig());
hashCode = 31 * hashCode + Objects.hashCode(roleArn());
hashCode = 31 * hashCode + Objects.hashCode(hasTags() ? tags() : null);
hashCode = 31 * hashCode + Objects.hashCode(securityConfig());
hashCode = 31 * hashCode + Objects.hashCode(autoMLJobObjective());
hashCode = 31 * hashCode + Objects.hashCode(modelDeployConfig());
hashCode = 31 * hashCode + Objects.hashCode(dataSplitConfig());
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 CreateAutoMlJobV2Request)) {
return false;
}
CreateAutoMlJobV2Request other = (CreateAutoMlJobV2Request) obj;
return Objects.equals(autoMLJobName(), other.autoMLJobName())
&& hasAutoMLJobInputDataConfig() == other.hasAutoMLJobInputDataConfig()
&& Objects.equals(autoMLJobInputDataConfig(), other.autoMLJobInputDataConfig())
&& Objects.equals(outputDataConfig(), other.outputDataConfig())
&& Objects.equals(autoMLProblemTypeConfig(), other.autoMLProblemTypeConfig())
&& Objects.equals(roleArn(), other.roleArn()) && hasTags() == other.hasTags()
&& Objects.equals(tags(), other.tags()) && Objects.equals(securityConfig(), other.securityConfig())
&& Objects.equals(autoMLJobObjective(), other.autoMLJobObjective())
&& Objects.equals(modelDeployConfig(), other.modelDeployConfig())
&& Objects.equals(dataSplitConfig(), other.dataSplitConfig());
}
/**
* 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("CreateAutoMlJobV2Request").add("AutoMLJobName", autoMLJobName())
.add("AutoMLJobInputDataConfig", hasAutoMLJobInputDataConfig() ? autoMLJobInputDataConfig() : null)
.add("OutputDataConfig", outputDataConfig()).add("AutoMLProblemTypeConfig", autoMLProblemTypeConfig())
.add("RoleArn", roleArn()).add("Tags", hasTags() ? tags() : null).add("SecurityConfig", securityConfig())
.add("AutoMLJobObjective", autoMLJobObjective()).add("ModelDeployConfig", modelDeployConfig())
.add("DataSplitConfig", dataSplitConfig()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "AutoMLJobName":
return Optional.ofNullable(clazz.cast(autoMLJobName()));
case "AutoMLJobInputDataConfig":
return Optional.ofNullable(clazz.cast(autoMLJobInputDataConfig()));
case "OutputDataConfig":
return Optional.ofNullable(clazz.cast(outputDataConfig()));
case "AutoMLProblemTypeConfig":
return Optional.ofNullable(clazz.cast(autoMLProblemTypeConfig()));
case "RoleArn":
return Optional.ofNullable(clazz.cast(roleArn()));
case "Tags":
return Optional.ofNullable(clazz.cast(tags()));
case "SecurityConfig":
return Optional.ofNullable(clazz.cast(securityConfig()));
case "AutoMLJobObjective":
return Optional.ofNullable(clazz.cast(autoMLJobObjective()));
case "ModelDeployConfig":
return Optional.ofNullable(clazz.cast(modelDeployConfig()));
case "DataSplitConfig":
return Optional.ofNullable(clazz.cast(dataSplitConfig()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function