listTasks

abstract suspend fun listTasks(input: ListTasksRequest = ListTasksRequest { }): ListTasksResponse

Returns a list of tasks. You can filter the results by cluster, task definition family, container instance, launch type, what IAM principal started the task, or by the desired status of the task.

Recently stopped tasks might appear in the returned results.

Samples


fun main() { 
   //sampleStart 
   // This example lists all of the tasks in a cluster.
val resp = ecsClient.listTasks {
    cluster = "default"
} 
   //sampleEnd
}

fun main() { 
   //sampleStart 
   // This example lists the tasks of a specified container instance. Specifying a containerInstance value
// limits the results to tasks that belong to that container instance.
val resp = ecsClient.listTasks {
    cluster = "default"
    containerInstance = "f6bbb147-5370-4ace-8c73-c7181ded911f"
} 
   //sampleEnd
}