![JAR search and dependency download from the Maven repository](/logo.png)
io.cloudshiftdev.awscdk.services.stepfunctions.tasks.SageMakerCreateModel.kt Maven / Gradle / Ivy
@file:Suppress("RedundantVisibilityModifier","RedundantUnitReturnType","RemoveRedundantQualifierName","unused","UnusedImport","ClassName","REDUNDANT_PROJECTION","DEPRECATION")
package io.cloudshiftdev.awscdk.services.stepfunctions.tasks
import io.cloudshiftdev.awscdk.Duration
import io.cloudshiftdev.awscdk.common.CdkDslMarker
import io.cloudshiftdev.awscdk.common.CdkObjectWrappers
import io.cloudshiftdev.awscdk.services.ec2.Connections
import io.cloudshiftdev.awscdk.services.ec2.IConnectable
import io.cloudshiftdev.awscdk.services.ec2.ISecurityGroup
import io.cloudshiftdev.awscdk.services.ec2.IVpc
import io.cloudshiftdev.awscdk.services.ec2.SubnetSelection
import io.cloudshiftdev.awscdk.services.iam.IGrantable
import io.cloudshiftdev.awscdk.services.iam.IPrincipal
import io.cloudshiftdev.awscdk.services.iam.IRole
import io.cloudshiftdev.awscdk.services.stepfunctions.Credentials
import io.cloudshiftdev.awscdk.services.stepfunctions.IntegrationPattern
import io.cloudshiftdev.awscdk.services.stepfunctions.TaskInput
import io.cloudshiftdev.awscdk.services.stepfunctions.TaskStateBase
import io.cloudshiftdev.awscdk.services.stepfunctions.Timeout
import kotlin.Any
import kotlin.Boolean
import kotlin.Deprecated
import kotlin.String
import kotlin.Unit
import kotlin.collections.List
import kotlin.collections.Map
import kotlin.jvm.JvmName
import io.cloudshiftdev.constructs.Construct as CloudshiftdevConstructsConstruct
import software.constructs.Construct as SoftwareConstructsConstruct
/**
* A Step Functions Task to create a SageMaker model.
*
* Example:
*
* ```
* SageMakerCreateModel.Builder.create(this, "Sagemaker")
* .modelName("MyModel")
* .primaryContainer(ContainerDefinition.Builder.create()
* .image(DockerImage.fromJsonExpression(JsonPath.stringAt("$.Model.imageName")))
* .mode(Mode.SINGLE_MODEL)
* .modelS3Location(S3Location.fromJsonExpression("$.TrainingJob.ModelArtifacts.S3ModelArtifacts"))
* .build())
* .build();
* ```
*
* [Documentation](https://docs.aws.amazon.com/step-functions/latest/dg/connect-sagemaker.html)
*/
public open class SageMakerCreateModel(
cdkObject: software.amazon.awscdk.services.stepfunctions.tasks.SageMakerCreateModel,
) : TaskStateBase(cdkObject),
IGrantable,
IConnectable {
public constructor(
scope: CloudshiftdevConstructsConstruct,
id: String,
props: SageMakerCreateModelProps,
) :
this(software.amazon.awscdk.services.stepfunctions.tasks.SageMakerCreateModel(scope.let(CloudshiftdevConstructsConstruct.Companion::unwrap),
id, props.let(SageMakerCreateModelProps.Companion::unwrap))
)
public constructor(
scope: CloudshiftdevConstructsConstruct,
id: String,
props: SageMakerCreateModelProps.Builder.() -> Unit,
) : this(scope, id, SageMakerCreateModelProps(props)
)
/**
* Add the security group to all instances via the launch configuration security groups array.
*
* @param securityGroup : The security group to add.
*/
public open fun addSecurityGroup(securityGroup: ISecurityGroup) {
unwrap(this).addSecurityGroup(securityGroup.let(ISecurityGroup.Companion::unwrap))
}
/**
* Allows specify security group connections for instances of this fleet.
*/
public override fun connections(): Connections =
unwrap(this).getConnections().let(Connections::wrap)
/**
* The principal to grant permissions to.
*/
public override fun grantPrincipal(): IPrincipal =
unwrap(this).getGrantPrincipal().let(IPrincipal::wrap)
/**
* The execution role for the Sagemaker Create Model API.
*/
public open fun role(): IRole = unwrap(this).getRole().let(IRole::wrap)
/**
* A fluent builder for
* [io.cloudshiftdev.awscdk.services.stepfunctions.tasks.SageMakerCreateModel].
*/
@CdkDslMarker
public interface Builder {
/**
* An optional description for this state.
*
* Default: - No comment
*
* @param comment An optional description for this state.
*/
public fun comment(comment: String)
/**
* Specifies the containers in the inference pipeline.
*
* Default: - None
*
* @param containers Specifies the containers in the inference pipeline.
*/
public fun containers(containers: List)
/**
* Specifies the containers in the inference pipeline.
*
* Default: - None
*
* @param containers Specifies the containers in the inference pipeline.
*/
public fun containers(vararg containers: IContainerDefinition)
/**
* Credentials for an IAM Role that the State Machine assumes for executing the task.
*
* This enables cross-account resource invocations.
*
* Default: - None (Task is executed using the State Machine's execution role)
*
* [Documentation](https://docs.aws.amazon.com/step-functions/latest/dg/concepts-access-cross-acct-resources.html)
* @param credentials Credentials for an IAM Role that the State Machine assumes for executing
* the task.
*/
public fun credentials(credentials: Credentials)
/**
* Credentials for an IAM Role that the State Machine assumes for executing the task.
*
* This enables cross-account resource invocations.
*
* Default: - None (Task is executed using the State Machine's execution role)
*
* [Documentation](https://docs.aws.amazon.com/step-functions/latest/dg/concepts-access-cross-acct-resources.html)
* @param credentials Credentials for an IAM Role that the State Machine assumes for executing
* the task.
*/
@kotlin.Suppress("INAPPLICABLE_JVM_NAME")
@JvmName("d67268899f25eaf065c4a5e6389fa26809a812a52c07457d2befb6b858ff8f3c")
public fun credentials(credentials: Credentials.Builder.() -> Unit)
/**
* Isolates the model container.
*
* No inbound or outbound network calls can be made to or from the model container.
*
* Default: false
*
* @param enableNetworkIsolation Isolates the model container.
*/
public fun enableNetworkIsolation(enableNetworkIsolation: Boolean)
/**
* (deprecated) Timeout for the heartbeat.
*
* Default: - None
*
* @deprecated use `heartbeatTimeout`
* @param heartbeat Timeout for the heartbeat.
*/
@Deprecated(message = "deprecated in CDK")
public fun heartbeat(heartbeat: Duration)
/**
* Timeout for the heartbeat.
*
* [disable-awslint:duration-prop-type] is needed because all props interface in
* aws-stepfunctions-tasks extend this interface
*
* Default: - None
*
* @param heartbeatTimeout Timeout for the heartbeat.
*/
public fun heartbeatTimeout(heartbeatTimeout: Timeout)
/**
* JSONPath expression to select part of the state to be the input to this state.
*
* May also be the special value JsonPath.DISCARD, which will cause the effective
* input to be the empty object {}.
*
* Default: - The entire task input (JSON path '$')
*
* @param inputPath JSONPath expression to select part of the state to be the input to this
* state.
*/
public fun inputPath(inputPath: String)
/**
* AWS Step Functions integrates with services directly in the Amazon States Language.
*
* You can control these AWS services using service integration patterns.
*
* Depending on the AWS Service, the Service Integration Pattern availability will vary.
*
* Default: - `IntegrationPattern.REQUEST_RESPONSE` for most tasks.
* `IntegrationPattern.RUN_JOB` for the following exceptions:
* `BatchSubmitJob`, `EmrAddStep`, `EmrCreateCluster`, `EmrTerminationCluster`, and
* `EmrContainersStartJobRun`.
*
* [Documentation](https://docs.aws.amazon.com/step-functions/latest/dg/connect-supported-services.html)
* @param integrationPattern AWS Step Functions integrates with services directly in the Amazon
* States Language.
*/
public fun integrationPattern(integrationPattern: IntegrationPattern)
/**
* The name of the new model.
*
* @param modelName The name of the new model.
*/
public fun modelName(modelName: String)
/**
* JSONPath expression to select select a portion of the state output to pass to the next state.
*
* May also be the special value JsonPath.DISCARD, which will cause the effective
* output to be the empty object {}.
*
* Default: - The entire JSON node determined by the state input, the task result,
* and resultPath is passed to the next state (JSON path '$')
*
* @param outputPath JSONPath expression to select select a portion of the state output to pass
* to the next state.
*/
public fun outputPath(outputPath: String)
/**
* The definition of the primary docker image containing inference code, associated artifacts,
* and custom environment map that the inference code uses when the model is deployed for
* predictions.
*
* @param primaryContainer The definition of the primary docker image containing inference code,
* associated artifacts, and custom environment map that the inference code uses when the model is
* deployed for predictions.
*/
public fun primaryContainer(primaryContainer: IContainerDefinition)
/**
* JSONPath expression to indicate where to inject the state's output.
*
* May also be the special value JsonPath.DISCARD, which will cause the state's
* input to become its output.
*
* Default: - Replaces the entire input with the result (JSON path '$')
*
* @param resultPath JSONPath expression to indicate where to inject the state's output.
*/
public fun resultPath(resultPath: String)
/**
* The JSON that will replace the state's raw result and become the effective result before
* ResultPath is applied.
*
* You can use ResultSelector to create a payload with values that are static
* or selected from the state's raw result.
*
* Default: - None
*
* [Documentation](https://docs.aws.amazon.com/step-functions/latest/dg/input-output-inputpath-params.html#input-output-resultselector)
* @param resultSelector The JSON that will replace the state's raw result and become the
* effective result before ResultPath is applied.
*/
public fun resultSelector(resultSelector: Map)
/**
* An execution role that you can pass in a CreateModel API request.
*
* Default: - a role will be created.
*
* @param role An execution role that you can pass in a CreateModel API request.
*/
public fun role(role: IRole)
/**
* Optional name for this state.
*
* Default: - The construct ID will be used as state name
*
* @param stateName Optional name for this state.
*/
public fun stateName(stateName: String)
/**
* The subnets of the VPC to which the hosted model is connected (Note this parameter is only
* used when VPC is provided).
*
* Default: - Private Subnets are selected
*
* @param subnetSelection The subnets of the VPC to which the hosted model is connected (Note
* this parameter is only used when VPC is provided).
*/
public fun subnetSelection(subnetSelection: SubnetSelection)
/**
* The subnets of the VPC to which the hosted model is connected (Note this parameter is only
* used when VPC is provided).
*
* Default: - Private Subnets are selected
*
* @param subnetSelection The subnets of the VPC to which the hosted model is connected (Note
* this parameter is only used when VPC is provided).
*/
@kotlin.Suppress("INAPPLICABLE_JVM_NAME")
@JvmName("67e5dfda72939e998d3a70c474e672759c4137aa680a47bcf097c78126229078")
public fun subnetSelection(subnetSelection: SubnetSelection.Builder.() -> Unit)
/**
* Tags to be applied to the model.
*
* Default: - No tags
*
* @param tags Tags to be applied to the model.
*/
public fun tags(tags: TaskInput)
/**
* Timeout for the task.
*
* [disable-awslint:duration-prop-type] is needed because all props interface in
* aws-stepfunctions-tasks extend this interface
*
* Default: - None
*
* @param taskTimeout Timeout for the task.
*/
public fun taskTimeout(taskTimeout: Timeout)
/**
* (deprecated) Timeout for the task.
*
* Default: - None
*
* @deprecated use `taskTimeout`
* @param timeout Timeout for the task.
*/
@Deprecated(message = "deprecated in CDK")
public fun timeout(timeout: Duration)
/**
* The VPC that is accessible by the hosted model.
*
* Default: - None
*
* @param vpc The VPC that is accessible by the hosted model.
*/
public fun vpc(vpc: IVpc)
}
private class BuilderImpl(
scope: SoftwareConstructsConstruct,
id: String,
) : Builder {
private val cdkBuilder:
software.amazon.awscdk.services.stepfunctions.tasks.SageMakerCreateModel.Builder =
software.amazon.awscdk.services.stepfunctions.tasks.SageMakerCreateModel.Builder.create(scope,
id)
/**
* An optional description for this state.
*
* Default: - No comment
*
* @param comment An optional description for this state.
*/
override fun comment(comment: String) {
cdkBuilder.comment(comment)
}
/**
* Specifies the containers in the inference pipeline.
*
* Default: - None
*
* @param containers Specifies the containers in the inference pipeline.
*/
override fun containers(containers: List) {
cdkBuilder.containers(containers.map(IContainerDefinition.Companion::unwrap))
}
/**
* Specifies the containers in the inference pipeline.
*
* Default: - None
*
* @param containers Specifies the containers in the inference pipeline.
*/
override fun containers(vararg containers: IContainerDefinition): Unit =
containers(containers.toList())
/**
* Credentials for an IAM Role that the State Machine assumes for executing the task.
*
* This enables cross-account resource invocations.
*
* Default: - None (Task is executed using the State Machine's execution role)
*
* [Documentation](https://docs.aws.amazon.com/step-functions/latest/dg/concepts-access-cross-acct-resources.html)
* @param credentials Credentials for an IAM Role that the State Machine assumes for executing
* the task.
*/
override fun credentials(credentials: Credentials) {
cdkBuilder.credentials(credentials.let(Credentials.Companion::unwrap))
}
/**
* Credentials for an IAM Role that the State Machine assumes for executing the task.
*
* This enables cross-account resource invocations.
*
* Default: - None (Task is executed using the State Machine's execution role)
*
* [Documentation](https://docs.aws.amazon.com/step-functions/latest/dg/concepts-access-cross-acct-resources.html)
* @param credentials Credentials for an IAM Role that the State Machine assumes for executing
* the task.
*/
@kotlin.Suppress("INAPPLICABLE_JVM_NAME")
@JvmName("d67268899f25eaf065c4a5e6389fa26809a812a52c07457d2befb6b858ff8f3c")
override fun credentials(credentials: Credentials.Builder.() -> Unit): Unit =
credentials(Credentials(credentials))
/**
* Isolates the model container.
*
* No inbound or outbound network calls can be made to or from the model container.
*
* Default: false
*
* @param enableNetworkIsolation Isolates the model container.
*/
override fun enableNetworkIsolation(enableNetworkIsolation: Boolean) {
cdkBuilder.enableNetworkIsolation(enableNetworkIsolation)
}
/**
* (deprecated) Timeout for the heartbeat.
*
* Default: - None
*
* @deprecated use `heartbeatTimeout`
* @param heartbeat Timeout for the heartbeat.
*/
@Deprecated(message = "deprecated in CDK")
override fun heartbeat(heartbeat: Duration) {
cdkBuilder.heartbeat(heartbeat.let(Duration.Companion::unwrap))
}
/**
* Timeout for the heartbeat.
*
* [disable-awslint:duration-prop-type] is needed because all props interface in
* aws-stepfunctions-tasks extend this interface
*
* Default: - None
*
* @param heartbeatTimeout Timeout for the heartbeat.
*/
override fun heartbeatTimeout(heartbeatTimeout: Timeout) {
cdkBuilder.heartbeatTimeout(heartbeatTimeout.let(Timeout.Companion::unwrap))
}
/**
* JSONPath expression to select part of the state to be the input to this state.
*
* May also be the special value JsonPath.DISCARD, which will cause the effective
* input to be the empty object {}.
*
* Default: - The entire task input (JSON path '$')
*
* @param inputPath JSONPath expression to select part of the state to be the input to this
* state.
*/
override fun inputPath(inputPath: String) {
cdkBuilder.inputPath(inputPath)
}
/**
* AWS Step Functions integrates with services directly in the Amazon States Language.
*
* You can control these AWS services using service integration patterns.
*
* Depending on the AWS Service, the Service Integration Pattern availability will vary.
*
* Default: - `IntegrationPattern.REQUEST_RESPONSE` for most tasks.
* `IntegrationPattern.RUN_JOB` for the following exceptions:
* `BatchSubmitJob`, `EmrAddStep`, `EmrCreateCluster`, `EmrTerminationCluster`, and
* `EmrContainersStartJobRun`.
*
* [Documentation](https://docs.aws.amazon.com/step-functions/latest/dg/connect-supported-services.html)
* @param integrationPattern AWS Step Functions integrates with services directly in the Amazon
* States Language.
*/
override fun integrationPattern(integrationPattern: IntegrationPattern) {
cdkBuilder.integrationPattern(integrationPattern.let(IntegrationPattern.Companion::unwrap))
}
/**
* The name of the new model.
*
* @param modelName The name of the new model.
*/
override fun modelName(modelName: String) {
cdkBuilder.modelName(modelName)
}
/**
* JSONPath expression to select select a portion of the state output to pass to the next state.
*
* May also be the special value JsonPath.DISCARD, which will cause the effective
* output to be the empty object {}.
*
* Default: - The entire JSON node determined by the state input, the task result,
* and resultPath is passed to the next state (JSON path '$')
*
* @param outputPath JSONPath expression to select select a portion of the state output to pass
* to the next state.
*/
override fun outputPath(outputPath: String) {
cdkBuilder.outputPath(outputPath)
}
/**
* The definition of the primary docker image containing inference code, associated artifacts,
* and custom environment map that the inference code uses when the model is deployed for
* predictions.
*
* @param primaryContainer The definition of the primary docker image containing inference code,
* associated artifacts, and custom environment map that the inference code uses when the model is
* deployed for predictions.
*/
override fun primaryContainer(primaryContainer: IContainerDefinition) {
cdkBuilder.primaryContainer(primaryContainer.let(IContainerDefinition.Companion::unwrap))
}
/**
* JSONPath expression to indicate where to inject the state's output.
*
* May also be the special value JsonPath.DISCARD, which will cause the state's
* input to become its output.
*
* Default: - Replaces the entire input with the result (JSON path '$')
*
* @param resultPath JSONPath expression to indicate where to inject the state's output.
*/
override fun resultPath(resultPath: String) {
cdkBuilder.resultPath(resultPath)
}
/**
* The JSON that will replace the state's raw result and become the effective result before
* ResultPath is applied.
*
* You can use ResultSelector to create a payload with values that are static
* or selected from the state's raw result.
*
* Default: - None
*
* [Documentation](https://docs.aws.amazon.com/step-functions/latest/dg/input-output-inputpath-params.html#input-output-resultselector)
* @param resultSelector The JSON that will replace the state's raw result and become the
* effective result before ResultPath is applied.
*/
override fun resultSelector(resultSelector: Map) {
cdkBuilder.resultSelector(resultSelector.mapValues{CdkObjectWrappers.unwrap(it.value)})
}
/**
* An execution role that you can pass in a CreateModel API request.
*
* Default: - a role will be created.
*
* @param role An execution role that you can pass in a CreateModel API request.
*/
override fun role(role: IRole) {
cdkBuilder.role(role.let(IRole.Companion::unwrap))
}
/**
* Optional name for this state.
*
* Default: - The construct ID will be used as state name
*
* @param stateName Optional name for this state.
*/
override fun stateName(stateName: String) {
cdkBuilder.stateName(stateName)
}
/**
* The subnets of the VPC to which the hosted model is connected (Note this parameter is only
* used when VPC is provided).
*
* Default: - Private Subnets are selected
*
* @param subnetSelection The subnets of the VPC to which the hosted model is connected (Note
* this parameter is only used when VPC is provided).
*/
override fun subnetSelection(subnetSelection: SubnetSelection) {
cdkBuilder.subnetSelection(subnetSelection.let(SubnetSelection.Companion::unwrap))
}
/**
* The subnets of the VPC to which the hosted model is connected (Note this parameter is only
* used when VPC is provided).
*
* Default: - Private Subnets are selected
*
* @param subnetSelection The subnets of the VPC to which the hosted model is connected (Note
* this parameter is only used when VPC is provided).
*/
@kotlin.Suppress("INAPPLICABLE_JVM_NAME")
@JvmName("67e5dfda72939e998d3a70c474e672759c4137aa680a47bcf097c78126229078")
override fun subnetSelection(subnetSelection: SubnetSelection.Builder.() -> Unit): Unit =
subnetSelection(SubnetSelection(subnetSelection))
/**
* Tags to be applied to the model.
*
* Default: - No tags
*
* @param tags Tags to be applied to the model.
*/
override fun tags(tags: TaskInput) {
cdkBuilder.tags(tags.let(TaskInput.Companion::unwrap))
}
/**
* Timeout for the task.
*
* [disable-awslint:duration-prop-type] is needed because all props interface in
* aws-stepfunctions-tasks extend this interface
*
* Default: - None
*
* @param taskTimeout Timeout for the task.
*/
override fun taskTimeout(taskTimeout: Timeout) {
cdkBuilder.taskTimeout(taskTimeout.let(Timeout.Companion::unwrap))
}
/**
* (deprecated) Timeout for the task.
*
* Default: - None
*
* @deprecated use `taskTimeout`
* @param timeout Timeout for the task.
*/
@Deprecated(message = "deprecated in CDK")
override fun timeout(timeout: Duration) {
cdkBuilder.timeout(timeout.let(Duration.Companion::unwrap))
}
/**
* The VPC that is accessible by the hosted model.
*
* Default: - None
*
* @param vpc The VPC that is accessible by the hosted model.
*/
override fun vpc(vpc: IVpc) {
cdkBuilder.vpc(vpc.let(IVpc.Companion::unwrap))
}
public fun build(): software.amazon.awscdk.services.stepfunctions.tasks.SageMakerCreateModel =
cdkBuilder.build()
}
public companion object {
public operator fun invoke(
scope: CloudshiftdevConstructsConstruct,
id: String,
block: Builder.() -> Unit = {},
): SageMakerCreateModel {
val builderImpl = BuilderImpl(CloudshiftdevConstructsConstruct.unwrap(scope), id)
return SageMakerCreateModel(builderImpl.apply(block).build())
}
internal
fun wrap(cdkObject: software.amazon.awscdk.services.stepfunctions.tasks.SageMakerCreateModel):
SageMakerCreateModel = SageMakerCreateModel(cdkObject)
internal fun unwrap(wrapped: SageMakerCreateModel):
software.amazon.awscdk.services.stepfunctions.tasks.SageMakerCreateModel = wrapped.cdkObject
as software.amazon.awscdk.services.stepfunctions.tasks.SageMakerCreateModel
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy