/* List all Projects */ func listProjects(svc *devicefarm.DeviceFarm) { resp, err := svc.ListProjects(nil) failOnErr(err, "error listing projects") fmt.Println(awsutil.Prettify(resp)) }
// GetProjectArn returns project ARN by project name func GetProjectArn(client *devicefarm.DeviceFarm, project string) string { var arn string params := &devicefarm.ListProjectsInput{} resp, err := client.ListProjects(params) errors.Validate(err, "Failed to get list of projects for account") for _, entry := range resp.Projects { if *entry.Name == project { arn = *entry.Arn } } log.Println("Project ARN:", arn) return arn }
/* List all Projects */ func listProjects(svc *devicefarm.DeviceFarm) { resp, err := svc.ListProjects(nil) failOnErr(err, "error listing projects") //fmt.Println(awsutil.Prettify(resp)) table := tablewriter.NewWriter(os.Stdout) table.SetHeader([]string{"Name", "Created", "Arn"}) table.SetAlignment(tablewriter.ALIGN_LEFT) table.SetColWidth(50) for _, m := range resp.Projects { line := []string{*m.Name, time.Time.String(*m.Created), *m.Arn} table.Append(line) } table.Render() // Send output }