![JAR search and dependency download from the Maven repository](/logo.png)
io.cloudshiftdev.awscdk.services.ecs.patterns.ScheduledFargateTaskImageOptions.kt Maven / Gradle / Ivy
@file:Suppress("RedundantVisibilityModifier","RedundantUnitReturnType","RemoveRedundantQualifierName","unused","UnusedImport","ClassName","REDUNDANT_PROJECTION","DEPRECATION")
package io.cloudshiftdev.awscdk.services.ecs.patterns
import io.cloudshiftdev.awscdk.common.CdkDslMarker
import io.cloudshiftdev.awscdk.common.CdkObject
import io.cloudshiftdev.awscdk.common.CdkObjectWrappers
import io.cloudshiftdev.awscdk.services.ecs.ContainerImage
import io.cloudshiftdev.awscdk.services.ecs.FargatePlatformVersion
import io.cloudshiftdev.awscdk.services.ecs.FargateTaskDefinition
import io.cloudshiftdev.awscdk.services.ecs.LogDriver
import io.cloudshiftdev.awscdk.services.ecs.RuntimePlatform
import io.cloudshiftdev.awscdk.services.ecs.Secret
import kotlin.Number
import kotlin.String
import kotlin.Unit
import kotlin.collections.List
import kotlin.collections.Map
import kotlin.jvm.JvmName
/**
* The properties for the ScheduledFargateTask using an image.
*
* Example:
*
* ```
* Cluster cluster;
* ScheduledFargateTask scheduledFargateTask = ScheduledFargateTask.Builder.create(this,
* "ScheduledFargateTask")
* .cluster(cluster)
* .scheduledFargateTaskImageOptions(ScheduledFargateTaskImageOptions.builder()
* .image(ContainerImage.fromRegistry("amazon/amazon-ecs-sample"))
* .containerName("customContainerName")
* .memoryLimitMiB(512)
* .build())
* .schedule(Schedule.expression("rate(1 minute)"))
* .platformVersion(FargatePlatformVersion.LATEST)
* .build();
* ```
*/
public interface ScheduledFargateTaskImageOptions : ScheduledTaskImageProps, FargateServiceBaseProps
{
/**
* A builder for [ScheduledFargateTaskImageOptions]
*/
@CdkDslMarker
public interface Builder {
/**
* @param command The command that is passed to the container.
* If you provide a shell command as a single string, you have to quote command-line arguments.
*/
public fun command(command: List)
/**
* @param command The command that is passed to the container.
* If you provide a shell command as a single string, you have to quote command-line arguments.
*/
public fun command(vararg command: String)
/**
* @param containerName Optional name for the container added.
*/
public fun containerName(containerName: String)
/**
* @param cpu The number of cpu units used by the task.
* Valid values, which determines your range of valid values for the memory parameter:
*
* 256 (.25 vCPU) - Available memory values: 0.5GB, 1GB, 2GB
*
* 512 (.5 vCPU) - Available memory values: 1GB, 2GB, 3GB, 4GB
*
* 1024 (1 vCPU) - Available memory values: 2GB, 3GB, 4GB, 5GB, 6GB, 7GB, 8GB
*
* 2048 (2 vCPU) - Available memory values: Between 4GB and 16GB in 1GB increments
*
* 4096 (4 vCPU) - Available memory values: Between 8GB and 30GB in 1GB increments
*
* 8192 (8 vCPU) - Available memory values: Between 16GB and 60GB in 4GB increments
*
* 16384 (16 vCPU) - Available memory values: Between 32GB and 120GB in 8GB increments
*
* This default is set in the underlying FargateTaskDefinition construct.
*/
public fun cpu(cpu: Number)
/**
* @param environment The environment variables to pass to the container.
*/
public fun environment(environment: Map)
/**
* @param ephemeralStorageGiB The amount (in GiB) of ephemeral storage to be allocated to the
* task.
* The minimum supported value is `21` GiB and the maximum supported value is `200` GiB.
*
* Only supported in Fargate platform version 1.4.0 or later.
*/
public fun ephemeralStorageGiB(ephemeralStorageGiB: Number)
/**
* @param image The image used to start a container.
* Image or taskDefinition must be specified, but not both.
*/
public fun image(image: ContainerImage)
/**
* @param logDriver The log driver to use.
*/
public fun logDriver(logDriver: LogDriver)
/**
* @param memoryLimitMiB The amount (in MiB) of memory used by the task.
* This field is required and you must use one of the following values, which determines your
* range of valid values
* for the cpu parameter:
*
* 512 (0.5 GB), 1024 (1 GB), 2048 (2 GB) - Available cpu values: 256 (.25 vCPU)
*
* 1024 (1 GB), 2048 (2 GB), 3072 (3 GB), 4096 (4 GB) - Available cpu values: 512 (.5 vCPU)
*
* 2048 (2 GB), 3072 (3 GB), 4096 (4 GB), 5120 (5 GB), 6144 (6 GB), 7168 (7 GB), 8192 (8 GB) -
* Available cpu values: 1024 (1 vCPU)
*
* Between 4096 (4 GB) and 16384 (16 GB) in increments of 1024 (1 GB) - Available cpu values:
* 2048 (2 vCPU)
*
* Between 8192 (8 GB) and 30720 (30 GB) in increments of 1024 (1 GB) - Available cpu values:
* 4096 (4 vCPU)
*
* Between 16384 (16 GB) and 61440 (60 GB) in increments of 4096 (4 GB) - Available cpu values:
* 8192 (8 vCPU)
*
* Between 32768 (32 GB) and 122880 (120 GB) in increments of 8192 (8 GB) - Available cpu
* values: 16384 (16 vCPU)
*
* This default is set in the underlying FargateTaskDefinition construct.
*/
public fun memoryLimitMiB(memoryLimitMiB: Number)
/**
* @param platformVersion The platform version on which to run your service.
* If one is not specified, the LATEST platform version is used by default. For more
* information, see
* [AWS Fargate Platform
* Versions](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/platform_versions.html)
* in the Amazon Elastic Container Service Developer Guide.
*/
public fun platformVersion(platformVersion: FargatePlatformVersion)
/**
* @param runtimePlatform The runtime platform of the task definition.
*/
public fun runtimePlatform(runtimePlatform: RuntimePlatform)
/**
* @param runtimePlatform The runtime platform of the task definition.
*/
@kotlin.Suppress("INAPPLICABLE_JVM_NAME")
@JvmName("e57d04bfffcff26c5833d76ed826c126e55cbf4ebe080c0ee63e2606295a719c")
public fun runtimePlatform(runtimePlatform: RuntimePlatform.Builder.() -> Unit)
/**
* @param secrets The secret to expose to the container as an environment variable.
*/
public fun secrets(secrets: Map)
/**
* @param taskDefinition The task definition to use for tasks in the service. TaskDefinition or
* TaskImageOptions must be specified, but not both.
* [disable-awslint:ref-via-interface]
*/
public fun taskDefinition(taskDefinition: FargateTaskDefinition)
}
private class BuilderImpl : Builder {
private val cdkBuilder:
software.amazon.awscdk.services.ecs.patterns.ScheduledFargateTaskImageOptions.Builder =
software.amazon.awscdk.services.ecs.patterns.ScheduledFargateTaskImageOptions.builder()
/**
* @param command The command that is passed to the container.
* If you provide a shell command as a single string, you have to quote command-line arguments.
*/
override fun command(command: List) {
cdkBuilder.command(command)
}
/**
* @param command The command that is passed to the container.
* If you provide a shell command as a single string, you have to quote command-line arguments.
*/
override fun command(vararg command: String): Unit = command(command.toList())
/**
* @param containerName Optional name for the container added.
*/
override fun containerName(containerName: String) {
cdkBuilder.containerName(containerName)
}
/**
* @param cpu The number of cpu units used by the task.
* Valid values, which determines your range of valid values for the memory parameter:
*
* 256 (.25 vCPU) - Available memory values: 0.5GB, 1GB, 2GB
*
* 512 (.5 vCPU) - Available memory values: 1GB, 2GB, 3GB, 4GB
*
* 1024 (1 vCPU) - Available memory values: 2GB, 3GB, 4GB, 5GB, 6GB, 7GB, 8GB
*
* 2048 (2 vCPU) - Available memory values: Between 4GB and 16GB in 1GB increments
*
* 4096 (4 vCPU) - Available memory values: Between 8GB and 30GB in 1GB increments
*
* 8192 (8 vCPU) - Available memory values: Between 16GB and 60GB in 4GB increments
*
* 16384 (16 vCPU) - Available memory values: Between 32GB and 120GB in 8GB increments
*
* This default is set in the underlying FargateTaskDefinition construct.
*/
override fun cpu(cpu: Number) {
cdkBuilder.cpu(cpu)
}
/**
* @param environment The environment variables to pass to the container.
*/
override fun environment(environment: Map) {
cdkBuilder.environment(environment)
}
/**
* @param ephemeralStorageGiB The amount (in GiB) of ephemeral storage to be allocated to the
* task.
* The minimum supported value is `21` GiB and the maximum supported value is `200` GiB.
*
* Only supported in Fargate platform version 1.4.0 or later.
*/
override fun ephemeralStorageGiB(ephemeralStorageGiB: Number) {
cdkBuilder.ephemeralStorageGiB(ephemeralStorageGiB)
}
/**
* @param image The image used to start a container.
* Image or taskDefinition must be specified, but not both.
*/
override fun image(image: ContainerImage) {
cdkBuilder.image(image.let(ContainerImage.Companion::unwrap))
}
/**
* @param logDriver The log driver to use.
*/
override fun logDriver(logDriver: LogDriver) {
cdkBuilder.logDriver(logDriver.let(LogDriver.Companion::unwrap))
}
/**
* @param memoryLimitMiB The amount (in MiB) of memory used by the task.
* This field is required and you must use one of the following values, which determines your
* range of valid values
* for the cpu parameter:
*
* 512 (0.5 GB), 1024 (1 GB), 2048 (2 GB) - Available cpu values: 256 (.25 vCPU)
*
* 1024 (1 GB), 2048 (2 GB), 3072 (3 GB), 4096 (4 GB) - Available cpu values: 512 (.5 vCPU)
*
* 2048 (2 GB), 3072 (3 GB), 4096 (4 GB), 5120 (5 GB), 6144 (6 GB), 7168 (7 GB), 8192 (8 GB) -
* Available cpu values: 1024 (1 vCPU)
*
* Between 4096 (4 GB) and 16384 (16 GB) in increments of 1024 (1 GB) - Available cpu values:
* 2048 (2 vCPU)
*
* Between 8192 (8 GB) and 30720 (30 GB) in increments of 1024 (1 GB) - Available cpu values:
* 4096 (4 vCPU)
*
* Between 16384 (16 GB) and 61440 (60 GB) in increments of 4096 (4 GB) - Available cpu values:
* 8192 (8 vCPU)
*
* Between 32768 (32 GB) and 122880 (120 GB) in increments of 8192 (8 GB) - Available cpu
* values: 16384 (16 vCPU)
*
* This default is set in the underlying FargateTaskDefinition construct.
*/
override fun memoryLimitMiB(memoryLimitMiB: Number) {
cdkBuilder.memoryLimitMiB(memoryLimitMiB)
}
/**
* @param platformVersion The platform version on which to run your service.
* If one is not specified, the LATEST platform version is used by default. For more
* information, see
* [AWS Fargate Platform
* Versions](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/platform_versions.html)
* in the Amazon Elastic Container Service Developer Guide.
*/
override fun platformVersion(platformVersion: FargatePlatformVersion) {
cdkBuilder.platformVersion(platformVersion.let(FargatePlatformVersion.Companion::unwrap))
}
/**
* @param runtimePlatform The runtime platform of the task definition.
*/
override fun runtimePlatform(runtimePlatform: RuntimePlatform) {
cdkBuilder.runtimePlatform(runtimePlatform.let(RuntimePlatform.Companion::unwrap))
}
/**
* @param runtimePlatform The runtime platform of the task definition.
*/
@kotlin.Suppress("INAPPLICABLE_JVM_NAME")
@JvmName("e57d04bfffcff26c5833d76ed826c126e55cbf4ebe080c0ee63e2606295a719c")
override fun runtimePlatform(runtimePlatform: RuntimePlatform.Builder.() -> Unit): Unit =
runtimePlatform(RuntimePlatform(runtimePlatform))
/**
* @param secrets The secret to expose to the container as an environment variable.
*/
override fun secrets(secrets: Map) {
cdkBuilder.secrets(secrets.mapValues{Secret.unwrap(it.value)})
}
/**
* @param taskDefinition The task definition to use for tasks in the service. TaskDefinition or
* TaskImageOptions must be specified, but not both.
* [disable-awslint:ref-via-interface]
*/
override fun taskDefinition(taskDefinition: FargateTaskDefinition) {
cdkBuilder.taskDefinition(taskDefinition.let(FargateTaskDefinition.Companion::unwrap))
}
public fun build():
software.amazon.awscdk.services.ecs.patterns.ScheduledFargateTaskImageOptions =
cdkBuilder.build()
}
private class Wrapper(
cdkObject: software.amazon.awscdk.services.ecs.patterns.ScheduledFargateTaskImageOptions,
) : CdkObject(cdkObject),
ScheduledFargateTaskImageOptions {
/**
* The command that is passed to the container.
*
* If you provide a shell command as a single string, you have to quote command-line arguments.
*
* Default: - CMD value built into container image.
*/
override fun command(): List = unwrap(this).getCommand() ?: emptyList()
/**
* Optional name for the container added.
*
* Default: - ScheduledContainer
*/
override fun containerName(): String? = unwrap(this).getContainerName()
/**
* The number of cpu units used by the task.
*
* Valid values, which determines your range of valid values for the memory parameter:
*
* 256 (.25 vCPU) - Available memory values: 0.5GB, 1GB, 2GB
*
* 512 (.5 vCPU) - Available memory values: 1GB, 2GB, 3GB, 4GB
*
* 1024 (1 vCPU) - Available memory values: 2GB, 3GB, 4GB, 5GB, 6GB, 7GB, 8GB
*
* 2048 (2 vCPU) - Available memory values: Between 4GB and 16GB in 1GB increments
*
* 4096 (4 vCPU) - Available memory values: Between 8GB and 30GB in 1GB increments
*
* 8192 (8 vCPU) - Available memory values: Between 16GB and 60GB in 4GB increments
*
* 16384 (16 vCPU) - Available memory values: Between 32GB and 120GB in 8GB increments
*
* This default is set in the underlying FargateTaskDefinition construct.
*
* Default: 256
*/
override fun cpu(): Number? = unwrap(this).getCpu()
/**
* The environment variables to pass to the container.
*
* Default: none
*/
override fun environment(): Map = unwrap(this).getEnvironment() ?: emptyMap()
/**
* The amount (in GiB) of ephemeral storage to be allocated to the task.
*
* The minimum supported value is `21` GiB and the maximum supported value is `200` GiB.
*
* Only supported in Fargate platform version 1.4.0 or later.
*
* Default: Undefined, in which case, the task will receive 20GiB ephemeral storage.
*/
override fun ephemeralStorageGiB(): Number? = unwrap(this).getEphemeralStorageGiB()
/**
* The image used to start a container.
*
* Image or taskDefinition must be specified, but not both.
*
* Default: - none
*/
override fun image(): ContainerImage = unwrap(this).getImage().let(ContainerImage::wrap)
/**
* The log driver to use.
*
* Default: - AwsLogDriver if enableLogging is true
*/
override fun logDriver(): LogDriver? = unwrap(this).getLogDriver()?.let(LogDriver::wrap)
/**
* The amount (in MiB) of memory used by the task.
*
* This field is required and you must use one of the following values, which determines your
* range of valid values
* for the cpu parameter:
*
* 512 (0.5 GB), 1024 (1 GB), 2048 (2 GB) - Available cpu values: 256 (.25 vCPU)
*
* 1024 (1 GB), 2048 (2 GB), 3072 (3 GB), 4096 (4 GB) - Available cpu values: 512 (.5 vCPU)
*
* 2048 (2 GB), 3072 (3 GB), 4096 (4 GB), 5120 (5 GB), 6144 (6 GB), 7168 (7 GB), 8192 (8 GB) -
* Available cpu values: 1024 (1 vCPU)
*
* Between 4096 (4 GB) and 16384 (16 GB) in increments of 1024 (1 GB) - Available cpu values:
* 2048 (2 vCPU)
*
* Between 8192 (8 GB) and 30720 (30 GB) in increments of 1024 (1 GB) - Available cpu values:
* 4096 (4 vCPU)
*
* Between 16384 (16 GB) and 61440 (60 GB) in increments of 4096 (4 GB) - Available cpu values:
* 8192 (8 vCPU)
*
* Between 32768 (32 GB) and 122880 (120 GB) in increments of 8192 (8 GB) - Available cpu
* values: 16384 (16 vCPU)
*
* This default is set in the underlying FargateTaskDefinition construct.
*
* Default: 512
*/
override fun memoryLimitMiB(): Number? = unwrap(this).getMemoryLimitMiB()
/**
* The platform version on which to run your service.
*
* If one is not specified, the LATEST platform version is used by default. For more
* information, see
* [AWS Fargate Platform
* Versions](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/platform_versions.html)
* in the Amazon Elastic Container Service Developer Guide.
*
* Default: Latest
*/
override fun platformVersion(): FargatePlatformVersion? =
unwrap(this).getPlatformVersion()?.let(FargatePlatformVersion::wrap)
/**
* The runtime platform of the task definition.
*
* Default: - If the property is undefined, `operatingSystemFamily` is LINUX and
* `cpuArchitecture` is X86_64
*/
override fun runtimePlatform(): RuntimePlatform? =
unwrap(this).getRuntimePlatform()?.let(RuntimePlatform::wrap)
/**
* The secret to expose to the container as an environment variable.
*
* Default: - No secret environment variables.
*/
override fun secrets(): Map =
unwrap(this).getSecrets()?.mapValues{Secret.wrap(it.value)} ?: emptyMap()
/**
* The task definition to use for tasks in the service. TaskDefinition or TaskImageOptions must
* be specified, but not both.
*
* [disable-awslint:ref-via-interface]
*
* Default: - none
*/
override fun taskDefinition(): FargateTaskDefinition? =
unwrap(this).getTaskDefinition()?.let(FargateTaskDefinition::wrap)
}
public companion object {
public operator fun invoke(block: Builder.() -> Unit = {}): ScheduledFargateTaskImageOptions {
val builderImpl = BuilderImpl()
return Wrapper(builderImpl.apply(block).build())
}
internal
fun wrap(cdkObject: software.amazon.awscdk.services.ecs.patterns.ScheduledFargateTaskImageOptions):
ScheduledFargateTaskImageOptions = CdkObjectWrappers.wrap(cdkObject) as?
ScheduledFargateTaskImageOptions ?: Wrapper(cdkObject)
internal fun unwrap(wrapped: ScheduledFargateTaskImageOptions):
software.amazon.awscdk.services.ecs.patterns.ScheduledFargateTaskImageOptions = (wrapped as
CdkObject).cdkObject as
software.amazon.awscdk.services.ecs.patterns.ScheduledFargateTaskImageOptions
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy