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

software.amazon.awssdk.services.sagemaker.model.CreateCompilationJobRequest 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.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 CreateCompilationJobRequest extends SageMakerRequest implements
        ToCopyableBuilder {
    private static final SdkField COMPILATION_JOB_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("CompilationJobName").getter(getter(CreateCompilationJobRequest::compilationJobName))
            .setter(setter(Builder::compilationJobName))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CompilationJobName").build())
            .build();

    private static final SdkField ROLE_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("RoleArn").getter(getter(CreateCompilationJobRequest::roleArn)).setter(setter(Builder::roleArn))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("RoleArn").build()).build();

    private static final SdkField INPUT_CONFIG_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
            .memberName("InputConfig").getter(getter(CreateCompilationJobRequest::inputConfig))
            .setter(setter(Builder::inputConfig)).constructor(InputConfig::builder)
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("InputConfig").build()).build();

    private static final SdkField OUTPUT_CONFIG_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
            .memberName("OutputConfig").getter(getter(CreateCompilationJobRequest::outputConfig))
            .setter(setter(Builder::outputConfig)).constructor(OutputConfig::builder)
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("OutputConfig").build()).build();

    private static final SdkField STOPPING_CONDITION_FIELD = SdkField
            . builder(MarshallingType.SDK_POJO).memberName("StoppingCondition")
            .getter(getter(CreateCompilationJobRequest::stoppingCondition)).setter(setter(Builder::stoppingCondition))
            .constructor(StoppingCondition::builder)
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("StoppingCondition").build()).build();

    private static final SdkField> TAGS_FIELD = SdkField
            .> builder(MarshallingType.LIST)
            .memberName("Tags")
            .getter(getter(CreateCompilationJobRequest::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(COMPILATION_JOB_NAME_FIELD,
            ROLE_ARN_FIELD, INPUT_CONFIG_FIELD, OUTPUT_CONFIG_FIELD, STOPPING_CONDITION_FIELD, TAGS_FIELD));

    private final String compilationJobName;

    private final String roleArn;

    private final InputConfig inputConfig;

    private final OutputConfig outputConfig;

    private final StoppingCondition stoppingCondition;

    private final List tags;

    private CreateCompilationJobRequest(BuilderImpl builder) {
        super(builder);
        this.compilationJobName = builder.compilationJobName;
        this.roleArn = builder.roleArn;
        this.inputConfig = builder.inputConfig;
        this.outputConfig = builder.outputConfig;
        this.stoppingCondition = builder.stoppingCondition;
        this.tags = builder.tags;
    }

    /**
     * 

* A name for the model compilation job. The name must be unique within the AWS Region and within your AWS account. *

* * @return A name for the model compilation job. The name must be unique within the AWS Region and within your AWS * account. */ public final String compilationJobName() { return compilationJobName; } /** *

* The Amazon Resource Name (ARN) of an IAM role that enables Amazon SageMaker to perform tasks on your behalf. *

*

* During model compilation, Amazon SageMaker needs your permission to: *

*
    *
  • *

    * Read input data from an S3 bucket *

    *
  • *
  • *

    * Write model artifacts to an S3 bucket *

    *
  • *
  • *

    * Write logs to Amazon CloudWatch Logs *

    *
  • *
  • *

    * Publish metrics to Amazon CloudWatch *

    *
  • *
*

* You grant permissions for all of these tasks to an IAM role. To pass this role to Amazon SageMaker, the caller of * this API must have the iam:PassRole permission. For more information, see Amazon SageMaker Roles. *

* * @return The Amazon Resource Name (ARN) of an IAM role that enables Amazon SageMaker to perform tasks on your * behalf.

*

* During model compilation, Amazon SageMaker needs your permission to: *

*
    *
  • *

    * Read input data from an S3 bucket *

    *
  • *
  • *

    * Write model artifacts to an S3 bucket *

    *
  • *
  • *

    * Write logs to Amazon CloudWatch Logs *

    *
  • *
  • *

    * Publish metrics to Amazon CloudWatch *

    *
  • *
*

* You grant permissions for all of these tasks to an IAM role. To pass this role to Amazon SageMaker, the * caller of this API must have the iam:PassRole permission. For more information, see Amazon SageMaker Roles. */ public final String roleArn() { return roleArn; } /** *

* Provides information about the location of input model artifacts, the name and shape of the expected data inputs, * and the framework in which the model was trained. *

* * @return Provides information about the location of input model artifacts, the name and shape of the expected data * inputs, and the framework in which the model was trained. */ public final InputConfig inputConfig() { return inputConfig; } /** *

* Provides information about the output location for the compiled model and the target device the model runs on. *

* * @return Provides information about the output location for the compiled model and the target device the model * runs on. */ public final OutputConfig outputConfig() { return outputConfig; } /** *

* Specifies a limit to how long a model compilation job can run. When the job reaches the time limit, Amazon * SageMaker ends the compilation job. Use this API to cap model training costs. *

* * @return Specifies a limit to how long a model compilation job can run. When the job reaches the time limit, * Amazon SageMaker ends the compilation job. Use this API to cap model training costs. */ public final StoppingCondition stoppingCondition() { return stoppingCondition; } /** * 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 final boolean hasTags() { return tags != null && !(tags instanceof SdkAutoConstructList); } /** *

* An array of key-value pairs. You can use tags to categorize your AWS resources in different ways, for example, by * purpose, owner, or environment. For more information, see Tagging AWS Resources. *

*

* 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 An array of key-value pairs. You can use tags to categorize your AWS resources in different ways, for * example, by purpose, owner, or environment. For more information, see Tagging AWS Resources. */ public final List tags() { return tags; } @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 + super.hashCode(); hashCode = 31 * hashCode + Objects.hashCode(compilationJobName()); hashCode = 31 * hashCode + Objects.hashCode(roleArn()); hashCode = 31 * hashCode + Objects.hashCode(inputConfig()); hashCode = 31 * hashCode + Objects.hashCode(outputConfig()); hashCode = 31 * hashCode + Objects.hashCode(stoppingCondition()); hashCode = 31 * hashCode + Objects.hashCode(hasTags() ? tags() : null); 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 CreateCompilationJobRequest)) { return false; } CreateCompilationJobRequest other = (CreateCompilationJobRequest) obj; return Objects.equals(compilationJobName(), other.compilationJobName()) && Objects.equals(roleArn(), other.roleArn()) && Objects.equals(inputConfig(), other.inputConfig()) && Objects.equals(outputConfig(), other.outputConfig()) && Objects.equals(stoppingCondition(), other.stoppingCondition()) && hasTags() == other.hasTags() && 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 final String toString() { return ToString.builder("CreateCompilationJobRequest").add("CompilationJobName", compilationJobName()) .add("RoleArn", roleArn()).add("InputConfig", inputConfig()).add("OutputConfig", outputConfig()) .add("StoppingCondition", stoppingCondition()).add("Tags", hasTags() ? tags() : null).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "CompilationJobName": return Optional.ofNullable(clazz.cast(compilationJobName())); case "RoleArn": return Optional.ofNullable(clazz.cast(roleArn())); case "InputConfig": return Optional.ofNullable(clazz.cast(inputConfig())); case "OutputConfig": return Optional.ofNullable(clazz.cast(outputConfig())); case "StoppingCondition": return Optional.ofNullable(clazz.cast(stoppingCondition())); case "Tags": return Optional.ofNullable(clazz.cast(tags())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((CreateCompilationJobRequest) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SageMakerRequest.Builder, SdkPojo, CopyableBuilder { /** *

* A name for the model compilation job. The name must be unique within the AWS Region and within your AWS * account. *

* * @param compilationJobName * A name for the model compilation job. The name must be unique within the AWS Region and within your * AWS account. * @return Returns a reference to this object so that method calls can be chained together. */ Builder compilationJobName(String compilationJobName); /** *

* The Amazon Resource Name (ARN) of an IAM role that enables Amazon SageMaker to perform tasks on your behalf. *

*

* During model compilation, Amazon SageMaker needs your permission to: *

*
    *
  • *

    * Read input data from an S3 bucket *

    *
  • *
  • *

    * Write model artifacts to an S3 bucket *

    *
  • *
  • *

    * Write logs to Amazon CloudWatch Logs *

    *
  • *
  • *

    * Publish metrics to Amazon CloudWatch *

    *
  • *
*

* You grant permissions for all of these tasks to an IAM role. To pass this role to Amazon SageMaker, the * caller of this API must have the iam:PassRole permission. For more information, see Amazon SageMaker Roles. *

* * @param roleArn * The Amazon Resource Name (ARN) of an IAM role that enables Amazon SageMaker to perform tasks on your * behalf.

*

* During model compilation, Amazon SageMaker needs your permission to: *

*
    *
  • *

    * Read input data from an S3 bucket *

    *
  • *
  • *

    * Write model artifacts to an S3 bucket *

    *
  • *
  • *

    * Write logs to Amazon CloudWatch Logs *

    *
  • *
  • *

    * Publish metrics to Amazon CloudWatch *

    *
  • *
*

* You grant permissions for all of these tasks to an IAM role. To pass this role to Amazon SageMaker, * the caller of this API must have the iam:PassRole permission. For more information, see * Amazon SageMaker * Roles. * @return Returns a reference to this object so that method calls can be chained together. */ Builder roleArn(String roleArn); /** *

* Provides information about the location of input model artifacts, the name and shape of the expected data * inputs, and the framework in which the model was trained. *

* * @param inputConfig * Provides information about the location of input model artifacts, the name and shape of the expected * data inputs, and the framework in which the model was trained. * @return Returns a reference to this object so that method calls can be chained together. */ Builder inputConfig(InputConfig inputConfig); /** *

* Provides information about the location of input model artifacts, the name and shape of the expected data * inputs, and the framework in which the model was trained. *

* This is a convenience that creates an instance of the {@link InputConfig.Builder} avoiding the need to create * one manually via {@link InputConfig#builder()}. * * When the {@link Consumer} completes, {@link InputConfig.Builder#build()} is called immediately and its result * is passed to {@link #inputConfig(InputConfig)}. * * @param inputConfig * a consumer that will call methods on {@link InputConfig.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #inputConfig(InputConfig) */ default Builder inputConfig(Consumer inputConfig) { return inputConfig(InputConfig.builder().applyMutation(inputConfig).build()); } /** *

* Provides information about the output location for the compiled model and the target device the model runs * on. *

* * @param outputConfig * Provides information about the output location for the compiled model and the target device the model * runs on. * @return Returns a reference to this object so that method calls can be chained together. */ Builder outputConfig(OutputConfig outputConfig); /** *

* Provides information about the output location for the compiled model and the target device the model runs * on. *

* This is a convenience that creates an instance of the {@link OutputConfig.Builder} avoiding the need to * create one manually via {@link OutputConfig#builder()}. * * When the {@link Consumer} completes, {@link OutputConfig.Builder#build()} is called immediately and its * result is passed to {@link #outputConfig(OutputConfig)}. * * @param outputConfig * a consumer that will call methods on {@link OutputConfig.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #outputConfig(OutputConfig) */ default Builder outputConfig(Consumer outputConfig) { return outputConfig(OutputConfig.builder().applyMutation(outputConfig).build()); } /** *

* Specifies a limit to how long a model compilation job can run. When the job reaches the time limit, Amazon * SageMaker ends the compilation job. Use this API to cap model training costs. *

* * @param stoppingCondition * Specifies a limit to how long a model compilation job can run. When the job reaches the time limit, * Amazon SageMaker ends the compilation job. Use this API to cap model training costs. * @return Returns a reference to this object so that method calls can be chained together. */ Builder stoppingCondition(StoppingCondition stoppingCondition); /** *

* Specifies a limit to how long a model compilation job can run. When the job reaches the time limit, Amazon * SageMaker ends the compilation job. Use this API to cap model training costs. *

* This is a convenience that creates an instance of the {@link StoppingCondition.Builder} avoiding the need to * create one manually via {@link StoppingCondition#builder()}. * * When the {@link Consumer} completes, {@link StoppingCondition.Builder#build()} is called immediately and its * result is passed to {@link #stoppingCondition(StoppingCondition)}. * * @param stoppingCondition * a consumer that will call methods on {@link StoppingCondition.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #stoppingCondition(StoppingCondition) */ default Builder stoppingCondition(Consumer stoppingCondition) { return stoppingCondition(StoppingCondition.builder().applyMutation(stoppingCondition).build()); } /** *

* An array of key-value pairs. You can use tags to categorize your AWS resources in different ways, for * example, by purpose, owner, or environment. For more information, see Tagging AWS Resources. *

* * @param tags * An array of key-value pairs. You can use tags to categorize your AWS resources in different ways, for * example, by purpose, owner, or environment. For more information, see Tagging AWS Resources. * @return Returns a reference to this object so that method calls can be chained together. */ Builder tags(Collection tags); /** *

* An array of key-value pairs. You can use tags to categorize your AWS resources in different ways, for * example, by purpose, owner, or environment. For more information, see Tagging AWS Resources. *

* * @param tags * An array of key-value pairs. You can use tags to categorize your AWS resources in different ways, for * example, by purpose, owner, or environment. For more information, see Tagging AWS Resources. * @return Returns a reference to this object so that method calls can be chained together. */ Builder tags(Tag... tags); /** *

* An array of key-value pairs. You can use tags to categorize your AWS resources in different ways, for * example, by purpose, owner, or environment. For more information, see Tagging AWS Resources. *

* This is a convenience that creates an instance of the {@link List.Builder} avoiding the need to create * one manually via {@link List#builder()}. * * When the {@link Consumer} completes, {@link List.Builder#build()} is called immediately and its result * is passed to {@link #tags(List)}. * * @param tags * a consumer that will call methods on {@link List.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #tags(List) */ Builder tags(Consumer... tags); @Override Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration); @Override Builder overrideConfiguration(Consumer builderConsumer); } static final class BuilderImpl extends SageMakerRequest.BuilderImpl implements Builder { private String compilationJobName; private String roleArn; private InputConfig inputConfig; private OutputConfig outputConfig; private StoppingCondition stoppingCondition; private List tags = DefaultSdkAutoConstructList.getInstance(); private BuilderImpl() { } private BuilderImpl(CreateCompilationJobRequest model) { super(model); compilationJobName(model.compilationJobName); roleArn(model.roleArn); inputConfig(model.inputConfig); outputConfig(model.outputConfig); stoppingCondition(model.stoppingCondition); tags(model.tags); } public final String getCompilationJobName() { return compilationJobName; } @Override public final Builder compilationJobName(String compilationJobName) { this.compilationJobName = compilationJobName; return this; } public final void setCompilationJobName(String compilationJobName) { this.compilationJobName = compilationJobName; } public final String getRoleArn() { return roleArn; } @Override public final Builder roleArn(String roleArn) { this.roleArn = roleArn; return this; } public final void setRoleArn(String roleArn) { this.roleArn = roleArn; } public final InputConfig.Builder getInputConfig() { return inputConfig != null ? inputConfig.toBuilder() : null; } @Override public final Builder inputConfig(InputConfig inputConfig) { this.inputConfig = inputConfig; return this; } public final void setInputConfig(InputConfig.BuilderImpl inputConfig) { this.inputConfig = inputConfig != null ? inputConfig.build() : null; } public final OutputConfig.Builder getOutputConfig() { return outputConfig != null ? outputConfig.toBuilder() : null; } @Override public final Builder outputConfig(OutputConfig outputConfig) { this.outputConfig = outputConfig; return this; } public final void setOutputConfig(OutputConfig.BuilderImpl outputConfig) { this.outputConfig = outputConfig != null ? outputConfig.build() : null; } public final StoppingCondition.Builder getStoppingCondition() { return stoppingCondition != null ? stoppingCondition.toBuilder() : null; } @Override public final Builder stoppingCondition(StoppingCondition stoppingCondition) { this.stoppingCondition = stoppingCondition; return this; } public final void setStoppingCondition(StoppingCondition.BuilderImpl stoppingCondition) { this.stoppingCondition = stoppingCondition != null ? stoppingCondition.build() : null; } public final Collection getTags() { if (tags instanceof SdkAutoConstructList) { return null; } return tags != null ? tags.stream().map(Tag::toBuilder).collect(Collectors.toList()) : null; } @Override public final Builder tags(Collection tags) { this.tags = TagListCopier.copy(tags); return this; } @Override @SafeVarargs public final Builder tags(Tag... tags) { tags(Arrays.asList(tags)); return this; } @Override @SafeVarargs public final Builder tags(Consumer... tags) { tags(Stream.of(tags).map(c -> Tag.builder().applyMutation(c).build()).collect(Collectors.toList())); return this; } public final void setTags(Collection tags) { this.tags = TagListCopier.copyFromBuilder(tags); } @Override public Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration) { super.overrideConfiguration(overrideConfiguration); return this; } @Override public Builder overrideConfiguration(Consumer builderConsumer) { super.overrideConfiguration(builderConsumer); return this; } @Override public CreateCompilationJobRequest build() { return new CreateCompilationJobRequest(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy