tagResource

inline suspend fun EcsClient.tagResource(crossinline block: TagResourceRequest.Builder.() -> Unit): TagResourceResponse

Associates the specified tags to a resource with the specified resourceArn. If existing tags on a resource aren't specified in the request parameters, they aren't changed. When a resource is deleted, the tags that are associated with that resource are deleted as well.

Samples

import aws.sdk.kotlin.services.ecs.model.Tag

fun main() { 
   //sampleStart 
   // This example tags the dev cluster with key team and value dev
val resp = ecsClient.tagResource {
    resourceArn = "arn:aws:ecs:region:aws_account_id:cluster/dev"
    tags = listOf<Tag>(
        Tag {
            key = "team"
            value = "dev"
        }            
    )
} 
   //sampleEnd
}