本文整理汇总了Golang中github.com/aws/aws-sdk-go/service/ecs.ECS.DescribeClusters方法的典型用法代码示例。如果您正苦于以下问题:Golang ECS.DescribeClusters方法的具体用法?Golang ECS.DescribeClusters怎么用?Golang ECS.DescribeClusters使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/aws/aws-sdk-go/service/ecs.ECS
的用法示例。
在下文中一共展示了ECS.DescribeClusters方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: DescribeCluster
// DescribeCluster will return a Cluster (detail struct)
func DescribeCluster(svc *ecs.ECS, cluster *string) (*ecs.Cluster, error) {
// Get cluster details for all the things...
reqParams := &ecs.DescribeClustersInput{
Clusters: []*string{cluster},
}
resp, err := svc.DescribeClusters(reqParams)
if err != nil {
return nil, fmt.Errorf("ecs.DescribeClusters: %s", err.Error())
}
return resp.Clusters[0], err
}
示例2: VerifyClusterExists
// Verify that the ECS cluster exists.
func VerifyClusterExists(ecs_obj *ecs.ECS, cluster string) error {
params := &ecs.DescribeClustersInput{
Clusters: []*string{
aws.String(cluster),
},
}
clusters, err := ecs_obj.DescribeClusters(params)
if err != nil {
return fmt.Errorf("Cannot verify if ECS cluster exists: %s", FormatAwsError(err))
}
if len(clusters.Clusters) == 0 {
return fmt.Errorf("Error: ECS Cluster '%s' does not exist, cannot proceed.\n", cluster)
}
if len(clusters.Clusters) != 1 {
return fmt.Errorf("Error: Unexpected number of ECS Clusters returned when searching for '%s'. Received: %+v\n", cluster, clusters.Clusters)
}
return nil
}