(pool params.Pool)
| 702 | } |
| 703 | |
| 704 | func formatOnePool(pool params.Pool) { |
| 705 | if outputFormat == common.OutputFormatJSON { |
| 706 | printAsJSON(pool) |
| 707 | return |
| 708 | } |
| 709 | t := table.NewWriter() |
| 710 | rowConfigAutoMerge := table.RowConfig{AutoMerge: true} |
| 711 | |
| 712 | header := table.Row{"Field", "Value"} |
| 713 | |
| 714 | tags := []string{} |
| 715 | for _, tag := range pool.Tags { |
| 716 | tags = append(tags, tag.Name) |
| 717 | } |
| 718 | |
| 719 | var belongsTo string |
| 720 | var level string |
| 721 | |
| 722 | switch { |
| 723 | case pool.RepoID != "" && pool.RepoName != "": |
| 724 | belongsTo = pool.RepoName |
| 725 | level = entityTypeRepo |
| 726 | case pool.OrgID != "" && pool.OrgName != "": |
| 727 | belongsTo = pool.OrgName |
| 728 | level = entityTypeOrg |
| 729 | case pool.EnterpriseID != "" && pool.EnterpriseName != "": |
| 730 | belongsTo = pool.EnterpriseName |
| 731 | level = entityTypeEnterprise |
| 732 | } |
| 733 | |
| 734 | t.AppendHeader(header) |
| 735 | t.AppendRow(table.Row{"ID", pool.ID}) |
| 736 | t.AppendRow(table.Row{"Created At", pool.CreatedAt}) |
| 737 | t.AppendRow(table.Row{"Updated At", pool.UpdatedAt}) |
| 738 | t.AppendRow(table.Row{"Provider Name", pool.ProviderName}) |
| 739 | t.AppendRow(table.Row{"Priority", pool.Priority}) |
| 740 | t.AppendRow(table.Row{"Image", pool.Image}) |
| 741 | t.AppendRow(table.Row{"Flavor", pool.Flavor}) |
| 742 | t.AppendRow(table.Row{"OS Type", pool.OSType}) |
| 743 | t.AppendRow(table.Row{"OS Architecture", pool.OSArch}) |
| 744 | t.AppendRow(table.Row{"Max Runners", pool.MaxRunners}) |
| 745 | t.AppendRow(table.Row{"Min Idle Runners", pool.MinIdleRunners}) |
| 746 | t.AppendRow(table.Row{"Runner Bootstrap Timeout", pool.RunnerBootstrapTimeout}) |
| 747 | t.AppendRow(table.Row{"Tags", strings.Join(tags, ", ")}) |
| 748 | t.AppendRow(table.Row{"Belongs to", belongsTo}) |
| 749 | t.AppendRow(table.Row{"Level", level}) |
| 750 | t.AppendRow(table.Row{"Template", fmt.Sprintf("%s (ID: %d)", pool.TemplateName, pool.TemplateID)}) |
| 751 | t.AppendRow(table.Row{"Enabled", pool.Enabled}) |
| 752 | t.AppendRow(table.Row{"Runner Prefix", pool.GetRunnerPrefix()}) |
| 753 | t.AppendRow(table.Row{"Extra specs", string(pool.ExtraSpecs)}) |
| 754 | t.AppendRow(table.Row{"GitHub Runner Group", pool.GitHubRunnerGroup}) |
| 755 | t.AppendRow(table.Row{"Forge Type", pool.Endpoint.EndpointType}) |
| 756 | t.AppendRow(table.Row{"Endpoint Name", pool.Endpoint.Name}) |
| 757 | |
| 758 | if len(pool.Instances) > 0 { |
| 759 | for _, instance := range pool.Instances { |
| 760 | t.AppendRow(table.Row{"Instances", fmt.Sprintf("%s (%s)", instance.Name, instance.ID)}, rowConfigAutoMerge) |
| 761 | } |
no test coverage detected