本文整理匯總了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
}