
software.amazon.awssdk.services.sagemaker.model.CreateAutoMlJobRequest 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 CreateAutoMlJobRequest extends SageMakerRequest implements
ToCopyableBuilder {
private static final SdkField AUTO_ML_JOB_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(CreateAutoMlJobRequest::autoMLJobName)).setter(setter(Builder::autoMLJobName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AutoMLJobName").build()).build();
private static final SdkField> INPUT_DATA_CONFIG_FIELD = SdkField
.> builder(MarshallingType.LIST)
.getter(getter(CreateAutoMlJobRequest::inputDataConfig))
.setter(setter(Builder::inputDataConfig))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("InputDataConfig").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(AutoMLChannel::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).getter(getter(CreateAutoMlJobRequest::outputDataConfig))
.setter(setter(Builder::outputDataConfig)).constructor(AutoMLOutputDataConfig::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("OutputDataConfig").build()).build();
private static final SdkField PROBLEM_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(CreateAutoMlJobRequest::problemTypeAsString)).setter(setter(Builder::problemType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ProblemType").build()).build();
private static final SdkField AUTO_ML_JOB_OBJECTIVE_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).getter(getter(CreateAutoMlJobRequest::autoMLJobObjective))
.setter(setter(Builder::autoMLJobObjective)).constructor(AutoMLJobObjective::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AutoMLJobObjective").build())
.build();
private static final SdkField AUTO_ML_JOB_CONFIG_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).getter(getter(CreateAutoMlJobRequest::autoMLJobConfig))
.setter(setter(Builder::autoMLJobConfig)).constructor(AutoMLJobConfig::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AutoMLJobConfig").build()).build();
private static final SdkField ROLE_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(CreateAutoMlJobRequest::roleArn)).setter(setter(Builder::roleArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("RoleArn").build()).build();
private static final SdkField GENERATE_CANDIDATE_DEFINITIONS_ONLY_FIELD = SdkField
. builder(MarshallingType.BOOLEAN)
.getter(getter(CreateAutoMlJobRequest::generateCandidateDefinitionsOnly))
.setter(setter(Builder::generateCandidateDefinitionsOnly))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("GenerateCandidateDefinitionsOnly")
.build()).build();
private static final SdkField> TAGS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.getter(getter(CreateAutoMlJobRequest::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 List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(AUTO_ML_JOB_NAME_FIELD,
INPUT_DATA_CONFIG_FIELD, OUTPUT_DATA_CONFIG_FIELD, PROBLEM_TYPE_FIELD, AUTO_ML_JOB_OBJECTIVE_FIELD,
AUTO_ML_JOB_CONFIG_FIELD, ROLE_ARN_FIELD, GENERATE_CANDIDATE_DEFINITIONS_ONLY_FIELD, TAGS_FIELD));
private final String autoMLJobName;
private final List inputDataConfig;
private final AutoMLOutputDataConfig outputDataConfig;
private final String problemType;
private final AutoMLJobObjective autoMLJobObjective;
private final AutoMLJobConfig autoMLJobConfig;
private final String roleArn;
private final Boolean generateCandidateDefinitionsOnly;
private final List tags;
private CreateAutoMlJobRequest(BuilderImpl builder) {
super(builder);
this.autoMLJobName = builder.autoMLJobName;
this.inputDataConfig = builder.inputDataConfig;
this.outputDataConfig = builder.outputDataConfig;
this.problemType = builder.problemType;
this.autoMLJobObjective = builder.autoMLJobObjective;
this.autoMLJobConfig = builder.autoMLJobConfig;
this.roleArn = builder.roleArn;
this.generateCandidateDefinitionsOnly = builder.generateCandidateDefinitionsOnly;
this.tags = builder.tags;
}
/**
*
* Identifies an Autopilot job. Must be unique to your account and is case-insensitive.
*
*
* @return Identifies an Autopilot job. Must be unique to your account and is case-insensitive.
*/
public String autoMLJobName() {
return autoMLJobName;
}
/**
* Returns true if the InputDataConfig property was specified by the sender (it may be empty), or false if the
* sender did not specify the value (it will be empty). For responses returned by the SDK, the sender is the AWS
* service.
*/
public boolean hasInputDataConfig() {
return inputDataConfig != null && !(inputDataConfig instanceof SdkAutoConstructList);
}
/**
*
* Similar to InputDataConfig supported by Tuning. Format(s) supported: CSV. Minimum of 1000 rows.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* You can use {@link #hasInputDataConfig()} to see if a value was sent in this field.
*
*
* @return Similar to InputDataConfig supported by Tuning. Format(s) supported: CSV. Minimum of 1000 rows.
*/
public List inputDataConfig() {
return inputDataConfig;
}
/**
*
* Similar to OutputDataConfig supported by Tuning. Format(s) supported: CSV.
*
*
* @return Similar to OutputDataConfig supported by Tuning. Format(s) supported: CSV.
*/
public AutoMLOutputDataConfig outputDataConfig() {
return outputDataConfig;
}
/**
*
* Defines the kind of preprocessing and algorithms intended for the candidates. Options include:
* BinaryClassification, MulticlassClassification, and Regression.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #problemType} will
* return {@link ProblemType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #problemTypeAsString}.
*
*
* @return Defines the kind of preprocessing and algorithms intended for the candidates. Options include:
* BinaryClassification, MulticlassClassification, and Regression.
* @see ProblemType
*/
public ProblemType problemType() {
return ProblemType.fromValue(problemType);
}
/**
*
* Defines the kind of preprocessing and algorithms intended for the candidates. Options include:
* BinaryClassification, MulticlassClassification, and Regression.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #problemType} will
* return {@link ProblemType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #problemTypeAsString}.
*
*
* @return Defines the kind of preprocessing and algorithms intended for the candidates. Options include:
* BinaryClassification, MulticlassClassification, and Regression.
* @see ProblemType
*/
public String problemTypeAsString() {
return problemType;
}
/**
*
* Defines the objective of a an AutoML job. You provide a AutoMLJobObjective$MetricName and Autopilot infers
* whether to minimize or maximize it. If a metric is not specified, the most commonly used ObjectiveMetric for
* problem type is automaically selected.
*
*
* @return Defines the objective of a an AutoML job. You provide a AutoMLJobObjective$MetricName and
* Autopilot infers whether to minimize or maximize it. If a metric is not specified, the most commonly used
* ObjectiveMetric for problem type is automaically selected.
*/
public AutoMLJobObjective autoMLJobObjective() {
return autoMLJobObjective;
}
/**
*
* Contains CompletionCriteria and SecurityConfig.
*
*
* @return Contains CompletionCriteria and SecurityConfig.
*/
public AutoMLJobConfig autoMLJobConfig() {
return autoMLJobConfig;
}
/**
*
* 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 String roleArn() {
return roleArn;
}
/**
*
* Generates possible candidates without training a model. A candidate is a combination of data preprocessors,
* algorithms, and algorithm parameter settings.
*
*
* @return Generates possible candidates without training a model. A candidate is a combination of data
* preprocessors, algorithms, and algorithm parameter settings.
*/
public Boolean generateCandidateDefinitionsOnly() {
return generateCandidateDefinitionsOnly;
}
/**
* Returns true if the Tags property was specified by the sender (it may be empty), or false if the sender did not
* specify the value (it will be empty). For responses returned by the SDK, the sender is the AWS service.
*/
public boolean hasTags() {
return tags != null && !(tags instanceof SdkAutoConstructList);
}
/**
*
* Each tag consists of a key and an optional value. Tag keys must be unique per resource.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* You can use {@link #hasTags()} to see if a value was sent in this field.
*
*
* @return Each tag consists of a key and an optional value. Tag keys must be unique per resource.
*/
public List tags() {
return tags;
}
@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 int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + super.hashCode();
hashCode = 31 * hashCode + Objects.hashCode(autoMLJobName());
hashCode = 31 * hashCode + Objects.hashCode(inputDataConfig());
hashCode = 31 * hashCode + Objects.hashCode(outputDataConfig());
hashCode = 31 * hashCode + Objects.hashCode(problemTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(autoMLJobObjective());
hashCode = 31 * hashCode + Objects.hashCode(autoMLJobConfig());
hashCode = 31 * hashCode + Objects.hashCode(roleArn());
hashCode = 31 * hashCode + Objects.hashCode(generateCandidateDefinitionsOnly());
hashCode = 31 * hashCode + Objects.hashCode(tags());
return hashCode;
}
@Override
public boolean equals(Object obj) {
return super.equals(obj) && equalsBySdkFields(obj);
}
@Override
public boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof CreateAutoMlJobRequest)) {
return false;
}
CreateAutoMlJobRequest other = (CreateAutoMlJobRequest) obj;
return Objects.equals(autoMLJobName(), other.autoMLJobName())
&& Objects.equals(inputDataConfig(), other.inputDataConfig())
&& Objects.equals(outputDataConfig(), other.outputDataConfig())
&& Objects.equals(problemTypeAsString(), other.problemTypeAsString())
&& Objects.equals(autoMLJobObjective(), other.autoMLJobObjective())
&& Objects.equals(autoMLJobConfig(), other.autoMLJobConfig()) && Objects.equals(roleArn(), other.roleArn())
&& Objects.equals(generateCandidateDefinitionsOnly(), other.generateCandidateDefinitionsOnly())
&& Objects.equals(tags(), other.tags());
}
/**
* 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 String toString() {
return ToString.builder("CreateAutoMlJobRequest").add("AutoMLJobName", autoMLJobName())
.add("InputDataConfig", inputDataConfig()).add("OutputDataConfig", outputDataConfig())
.add("ProblemType", problemTypeAsString()).add("AutoMLJobObjective", autoMLJobObjective())
.add("AutoMLJobConfig", autoMLJobConfig()).add("RoleArn", roleArn())
.add("GenerateCandidateDefinitionsOnly", generateCandidateDefinitionsOnly()).add("Tags", tags()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "AutoMLJobName":
return Optional.ofNullable(clazz.cast(autoMLJobName()));
case "InputDataConfig":
return Optional.ofNullable(clazz.cast(inputDataConfig()));
case "OutputDataConfig":
return Optional.ofNullable(clazz.cast(outputDataConfig()));
case "ProblemType":
return Optional.ofNullable(clazz.cast(problemTypeAsString()));
case "AutoMLJobObjective":
return Optional.ofNullable(clazz.cast(autoMLJobObjective()));
case "AutoMLJobConfig":
return Optional.ofNullable(clazz.cast(autoMLJobConfig()));
case "RoleArn":
return Optional.ofNullable(clazz.cast(roleArn()));
case "GenerateCandidateDefinitionsOnly":
return Optional.ofNullable(clazz.cast(generateCandidateDefinitionsOnly()));
case "Tags":
return Optional.ofNullable(clazz.cast(tags()));
default:
return Optional.empty();
}
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
private static Function