io.cloudshiftdev.awscdk.services.ecs.patterns.FargateServiceBaseProps.kt Maven / Gradle / Ivy
The newest version!
@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.FargatePlatformVersion
import io.cloudshiftdev.awscdk.services.ecs.FargateTaskDefinition
import io.cloudshiftdev.awscdk.services.ecs.RuntimePlatform
import kotlin.Number
import kotlin.Unit
import kotlin.jvm.JvmName
/**
* Example:
*
* ```
* // The code below shows an example of how to instantiate this type.
* // The values are placeholders you should change.
* import io.cloudshiftdev.awscdk.services.ecs.*;
* import io.cloudshiftdev.awscdk.services.ecs.patterns.*;
* CpuArchitecture cpuArchitecture;
* FargateTaskDefinition fargateTaskDefinition;
* OperatingSystemFamily operatingSystemFamily;
* FargateServiceBaseProps fargateServiceBaseProps = FargateServiceBaseProps.builder()
* .cpu(123)
* .ephemeralStorageGiB(123)
* .memoryLimitMiB(123)
* .platformVersion(FargatePlatformVersion.LATEST)
* .runtimePlatform(RuntimePlatform.builder()
* .cpuArchitecture(cpuArchitecture)
* .operatingSystemFamily(operatingSystemFamily)
* .build())
* .taskDefinition(fargateTaskDefinition)
* .build();
* ```
*/
public interface FargateServiceBaseProps {
/**
* 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
*/
public fun cpu(): Number? = unwrap(this).getCpu()
/**
* 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.
*/
public fun ephemeralStorageGiB(): Number? = unwrap(this).getEphemeralStorageGiB()
/**
* 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
*/
public 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
*/
public 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
*/
public fun runtimePlatform(): RuntimePlatform? =
unwrap(this).getRuntimePlatform()?.let(RuntimePlatform::wrap)
/**
* 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
*/
public fun taskDefinition(): FargateTaskDefinition? =
unwrap(this).getTaskDefinition()?.let(FargateTaskDefinition::wrap)
/**
* A builder for [FargateServiceBaseProps]
*/
@CdkDslMarker
public interface Builder {
/**
* @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 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 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("ad701131b10c34d9874ce28883035bf3ff7fc97460c81564c99f9214b961441c")
public fun runtimePlatform(runtimePlatform: RuntimePlatform.Builder.() -> Unit)
/**
* @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.FargateServiceBaseProps.Builder =
software.amazon.awscdk.services.ecs.patterns.FargateServiceBaseProps.builder()
/**
* @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 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 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("ad701131b10c34d9874ce28883035bf3ff7fc97460c81564c99f9214b961441c")
override fun runtimePlatform(runtimePlatform: RuntimePlatform.Builder.() -> Unit): Unit =
runtimePlatform(RuntimePlatform(runtimePlatform))
/**
* @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.FargateServiceBaseProps =
cdkBuilder.build()
}
private class Wrapper(
cdkObject: software.amazon.awscdk.services.ecs.patterns.FargateServiceBaseProps,
) : CdkObject(cdkObject),
FargateServiceBaseProps {
/**
* 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 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 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 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 = {}): FargateServiceBaseProps {
val builderImpl = BuilderImpl()
return Wrapper(builderImpl.apply(block).build())
}
internal
fun wrap(cdkObject: software.amazon.awscdk.services.ecs.patterns.FargateServiceBaseProps):
FargateServiceBaseProps = CdkObjectWrappers.wrap(cdkObject) as? FargateServiceBaseProps ?:
Wrapper(cdkObject)
internal fun unwrap(wrapped: FargateServiceBaseProps):
software.amazon.awscdk.services.ecs.patterns.FargateServiceBaseProps = (wrapped as
CdkObject).cdkObject as software.amazon.awscdk.services.ecs.patterns.FargateServiceBaseProps
}
}