Ejemplo n.º 1
0
func printTags(ctx context.Context, svc ec2.EC2, instanceIds []*string) {
	if ctx.Verbose {
		tagsOut := getTags(svc, instanceIds)
		lastID := ""

		for _, td := range tagsOut.Tags {
			if lastID != *td.ResourceId {
				ctx.PrintVerbose(fmt.Sprintf("    Resource ID %s", *td.ResourceId))
				lastID = *td.ResourceId
			}
			ctx.PrintVerbose(fmt.Sprintf("      %s=%s", *td.Key, *td.Value))
		}
	}
}
Ejemplo n.º 2
0
func printTags(ctx context.Context, svc elasticsearchservice.ElasticsearchService, resourceIds []*string) {
	if ctx.Verbose {
		for _, arn := range resourceIds {
			ctx.PrintVerbose(fmt.Sprintf("    Processing domain %s", *arn))
			resp, _ := svc.ListTags(&elasticsearchservice.ListTagsInput{
				ARN: arn,
			})

			// Well, this will throw an error if there are no tags instead of just returning an empty list...ugh
			// kingpin.FatalIfError(err, "Could not retrieve tags for elastic search domain %s", arn)

			for _, tag := range resp.TagList {
				ctx.PrintVerbose(fmt.Sprintf("      %s=%s", *tag.Key, *tag.Value))
			}
		}
	}
}