List<String> listTaskPrivateAddresses(String cluster, AwsCredentials credentials) {
        LOGGER.fine("Listing tasks from cluster: '%s'", cluster);
        List<String> taskArns = listTasks(cluster, credentials);
        LOGGER.fine("AWS ECS ListTasks found the following tasks: %s", taskArns);
        if (!taskArns.isEmpty()) {
            List<Task> tasks = describeTasks(cluster, taskArns, credentials);
            if (!tasks.isEmpty()) {
                return tasks.stream().map(Task::getPrivateAddress).collect(Collectors.toList());
            }
        }
        return emptyList();
    }
@Test
    public void listTasksFiltered() {
        // given
        String cluster = "arn:aws:ecs:eu-central-1:665466731577:cluster/rafal-test-cluster";
        AwsConfig awsConfig = AwsConfig.builder()
                                       .setFamily("family-name")
                                       .build();
        AwsEcsApi awsEcsApi = new AwsEcsApi(endpoint, awsConfig, requestSigner, CLOCK);

        stubListTasks("arn:aws:ecs:eu-central-1:665466731577:cluster/rafal-test-cluster", "family-name");
        stubDescribeTasks(Map.of(
                        "arn:aws:ecs:us-east-1:012345678910:task/0b69d5c0-d655-4695-98cd-5d2d526d9d5a", "10.0.1.16",
                        "arn:aws:ecs:us-east-1:012345678910:task/51a01bdf-d00e-487e-ab14-7645330b6207", "10.0.1.219"),
                cluster);

        // when
        List<String> ips = awsEcsApi.listTaskPrivateAddresses(cluster, CREDENTIALS);

        // then
        assertThat(ips).containsExactlyInAnyOrder("10.0.1.16", "10.0.1.219");
    }