mirror of https://github.com/docker/compose.git
Use DescribeCluster as ListCluster is a Paginated API
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This commit is contained in:
parent
ea6d35a927
commit
f8bf0078aa
|
@ -2,8 +2,7 @@ package amazon
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"strings"
|
"github.com/aws/aws-sdk-go/aws"
|
||||||
|
|
||||||
"github.com/aws/aws-sdk-go/service/ecs"
|
"github.com/aws/aws-sdk-go/service/ecs"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
@ -40,13 +39,11 @@ func (c client) DeleteCluster() error {
|
||||||
|
|
||||||
func (c client) ClusterExists() (bool, error) {
|
func (c client) ClusterExists() (bool, error) {
|
||||||
logrus.Debug("Check if cluster was already created: ", c.Cluster)
|
logrus.Debug("Check if cluster was already created: ", c.Cluster)
|
||||||
clusters, err := c.ECS.ListClusters(nil)
|
clusters, err := c.ECS.DescribeClusters(&ecs.DescribeClustersInput{
|
||||||
|
Clusters: []*string{aws.String(c.Cluster)},
|
||||||
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
found := false
|
return len(clusters.Clusters) > 0, nil
|
||||||
for _, arn := range clusters.ClusterArns {
|
|
||||||
found = found || strings.HasSuffix(*arn, "/"+c.Cluster)
|
|
||||||
}
|
|
||||||
return found, nil
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue