Skip to content

Commit 2a94a9d

Browse files
authored
fix api error (#15)
1 parent 0830661 commit 2a94a9d

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

internal/api/ecs.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ func GetClusters(ctx context.Context) ([]types.Cluster, error) {
3939
}
4040
}
4141

42+
if len(clusterARNs) == 0 {
43+
return []types.Cluster{}, nil
44+
}
45+
4246
res, err := client.DescribeClusters(ctx, &ecs.DescribeClustersInput{
4347
Clusters: clusterARNs,
4448
})
@@ -68,6 +72,10 @@ func GetServices(ctx context.Context, cluster *types.Cluster) ([]types.Service,
6872
}
6973
}
7074

75+
if len(serviceARNs) == 0 {
76+
return []types.Service{}, nil
77+
}
78+
7179
res, err := client.DescribeServices(ctx, &ecs.DescribeServicesInput{
7280
Cluster: cluster.ClusterArn,
7381
Services: serviceARNs,
@@ -104,6 +112,10 @@ func GetTasks(ctx context.Context, cluster *types.Cluster, service *types.Servic
104112
}
105113
}
106114

115+
if len(taskARNs) == 0 {
116+
return []types.Task{}, nil
117+
}
118+
107119
describeRes, err := client.DescribeTasks(ctx, &ecs.DescribeTasksInput{
108120
Cluster: cluster.ClusterArn,
109121
Tasks: taskARNs,

0 commit comments

Comments
 (0)