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

com.pulumi.awsnative.ecs.kotlin.TaskSet.kt Maven / Gradle / Ivy

Go to download

Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.

There is a newer version: 1.11.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.awsnative.ecs.kotlin

import com.pulumi.awsnative.ecs.kotlin.enums.TaskSetLaunchType
import com.pulumi.awsnative.ecs.kotlin.outputs.TaskSetLoadBalancer
import com.pulumi.awsnative.ecs.kotlin.outputs.TaskSetNetworkConfiguration
import com.pulumi.awsnative.ecs.kotlin.outputs.TaskSetScale
import com.pulumi.awsnative.ecs.kotlin.outputs.TaskSetServiceRegistry
import com.pulumi.awsnative.kotlin.outputs.Tag
import com.pulumi.core.Output
import com.pulumi.kotlin.KotlinCustomResource
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.ResourceMapper
import com.pulumi.kotlin.options.CustomResourceOptions
import com.pulumi.kotlin.options.CustomResourceOptionsBuilder
import com.pulumi.resources.Resource
import kotlin.Boolean
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import com.pulumi.awsnative.ecs.kotlin.enums.TaskSetLaunchType.Companion.toKotlin as taskSetLaunchTypeToKotlin
import com.pulumi.awsnative.ecs.kotlin.outputs.TaskSetLoadBalancer.Companion.toKotlin as taskSetLoadBalancerToKotlin
import com.pulumi.awsnative.ecs.kotlin.outputs.TaskSetNetworkConfiguration.Companion.toKotlin as taskSetNetworkConfigurationToKotlin
import com.pulumi.awsnative.ecs.kotlin.outputs.TaskSetScale.Companion.toKotlin as taskSetScaleToKotlin
import com.pulumi.awsnative.ecs.kotlin.outputs.TaskSetServiceRegistry.Companion.toKotlin as taskSetServiceRegistryToKotlin
import com.pulumi.awsnative.kotlin.outputs.Tag.Companion.toKotlin as tagToKotlin

/**
 * Builder for [TaskSet].
 */
@PulumiTagMarker
public class TaskSetResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: TaskSetArgs = TaskSetArgs()

    public var opts: CustomResourceOptions = CustomResourceOptions()

    /**
     * @param name The _unique_ name of the resulting resource.
     */
    public fun name(`value`: String) {
        this.name = value
    }

    /**
     * @param block The arguments to use to populate this resource's properties.
     */
    public suspend fun args(block: suspend TaskSetArgsBuilder.() -> Unit) {
        val builder = TaskSetArgsBuilder()
        block(builder)
        this.args = builder.build()
    }

    /**
     * @param block A bag of options that control this resource's behavior.
     */
    public suspend fun opts(block: suspend CustomResourceOptionsBuilder.() -> Unit) {
        this.opts = com.pulumi.kotlin.options.CustomResourceOptions.opts(block)
    }

    internal fun build(): TaskSet {
        val builtJavaResource = com.pulumi.awsnative.ecs.TaskSet(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return TaskSet(builtJavaResource)
    }
}

/**
 * Create a task set in the specified cluster and service. This is used when a service uses the EXTERNAL deployment controller type. For more information, see https://docs.aws.amazon.com/AmazonECS/latest/developerguide/deployment-types.htmlin the Amazon Elastic Container Service Developer Guide.
 */
public class TaskSet internal constructor(
    override val javaResource: com.pulumi.awsnative.ecs.TaskSet,
) : KotlinCustomResource(javaResource, TaskSetMapper) {
    /**
     * The ID of the task set.
     */
    public val awsId: Output
        get() = javaResource.awsId().applyValue({ args0 -> args0 })

    /**
     * The short name or full Amazon Resource Name (ARN) of the cluster that hosts the service to create the task set in.
     */
    public val cluster: Output
        get() = javaResource.cluster().applyValue({ args0 -> args0 })

    /**
     * An optional non-unique tag that identifies this task set in external systems. If the task set is associated with a service discovery registry, the tasks in this task set will have the ECS_TASK_SET_EXTERNAL_ID AWS Cloud Map attribute set to the provided value.
     */
    public val externalId: Output?
        get() = javaResource.externalId().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The launch type that new tasks in the task set will use. For more information, see https://docs.aws.amazon.com/AmazonECS/latest/developerguide/launch_types.html in the Amazon Elastic Container Service Developer Guide.
     */
    public val launchType: Output?
        get() = javaResource.launchType().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    taskSetLaunchTypeToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * A load balancer object representing the load balancer to use with the task set. The supported load balancer types are either an Application Load Balancer or a Network Load Balancer.
     */
    public val loadBalancers: Output>?
        get() = javaResource.loadBalancers().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 ->
                        taskSetLoadBalancerToKotlin(args0)
                    })
                })
            }).orElse(null)
        })

    /**
     * The network configuration for the task set.
     */
    public val networkConfiguration: Output?
        get() = javaResource.networkConfiguration().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> taskSetNetworkConfigurationToKotlin(args0) })
            }).orElse(null)
        })

    /**
     * The platform version that the tasks in the task set should use. A platform version is specified only for tasks using the Fargate launch type. If one isn't specified, the LATEST platform version is used by default.
     */
    public val platformVersion: Output?
        get() = javaResource.platformVersion().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * A floating-point percentage of the desired number of tasks to place and keep running in the task set.
     */
    public val scale: Output?
        get() = javaResource.scale().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    taskSetScaleToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * The short name or full Amazon Resource Name (ARN) of the service to create the task set in.
     */
    public val service: Output
        get() = javaResource.service().applyValue({ args0 -> args0 })

    /**
     * The details of the service discovery registries to assign to this task set. For more information, see https://docs.aws.amazon.com/AmazonECS/latest/developerguide/service-discovery.html.
     */
    public val serviceRegistries: Output>?
        get() = javaResource.serviceRegistries().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 ->
                        taskSetServiceRegistryToKotlin(args0)
                    })
                })
            }).orElse(null)
        })

    /**
     * The metadata that you apply to the task set to help you categorize and organize them. Each tag consists of a key and an optional value. You define both.
     * The following basic restrictions apply to tags:
     * - Maximum number of tags per resource - 50
     * - For each resource, each tag key must be unique, and each tag key can have only one value.
     * - Maximum key length - 128 Unicode characters in UTF-8
     * - Maximum value length - 256 Unicode characters in UTF-8
     * - If your tagging schema is used across multiple services and resources, remember that other services may have restrictions on allowed characters. Generally allowed characters are: letters, numbers, and spaces representable in UTF-8, and the following characters: + - = . _ : / @.
     * - Tag keys and values are case-sensitive.
     * - Do not use `aws:` , `AWS:` , or any upper or lowercase combination of such as a prefix for either keys or values as it is reserved for AWS use. You cannot edit or delete tag keys or values with this prefix. Tags with this prefix do not count against your tags per resource limit.
     */
    public val tags: Output>?
        get() = javaResource.tags().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 -> tagToKotlin(args0) })
                })
            }).orElse(null)
        })

    /**
     * The short name or full Amazon Resource Name (ARN) of the task definition for the tasks in the task set to use.
     */
    public val taskDefinition: Output
        get() = javaResource.taskDefinition().applyValue({ args0 -> args0 })
}

public object TaskSetMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.awsnative.ecs.TaskSet::class == javaResource::class

    override fun map(javaResource: Resource): TaskSet = TaskSet(
        javaResource as
            com.pulumi.awsnative.ecs.TaskSet,
    )
}

/**
 * @see [TaskSet].
 * @param name The _unique_ name of the resulting resource.
 * @param block Builder for [TaskSet].
 */
public suspend fun taskSet(name: String, block: suspend TaskSetResourceBuilder.() -> Unit): TaskSet {
    val builder = TaskSetResourceBuilder()
    builder.name(name)
    block(builder)
    return builder.build()
}

/**
 * @see [TaskSet].
 * @param name The _unique_ name of the resulting resource.
 */
public fun taskSet(name: String): TaskSet {
    val builder = TaskSetResourceBuilder()
    builder.name(name)
    return builder.build()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy