(spaceSummary v7action.SpaceSummary)
| 92 | } |
| 93 | |
| 94 | func (cmd SpaceCommand) displaySecurityGroupRulesTable(spaceSummary v7action.SpaceSummary) { |
| 95 | tableHeaders := []string{"security group", "destination", "ports", "protocol", "lifecycle", "description"} |
| 96 | table := [][]string{tableHeaders} |
| 97 | |
| 98 | rows := collectSecurityGroupRuleRows(spaceSummary) |
| 99 | if len(rows) == 0 { |
| 100 | cmd.UI.DisplayNewline() |
| 101 | cmd.UI.DisplayText("No security group rules found.") |
| 102 | return |
| 103 | } |
| 104 | |
| 105 | sort.Slice(rows, func(i, j int) bool { |
| 106 | groupNameA := rows[i][0] |
| 107 | groupNameB := rows[j][0] |
| 108 | return groupNameA < groupNameB |
| 109 | }) |
| 110 | |
| 111 | table = append(table, rows...) |
| 112 | |
| 113 | cmd.UI.DisplayNewline() |
| 114 | cmd.UI.DisplayTableWithHeader("", table, ui.DefaultTableSpacePadding) |
| 115 | } |
| 116 | |
| 117 | func collectSecurityGroupRuleRows(spaceSummary v7action.SpaceSummary) [][]string { |
| 118 | var rows [][]string |
no test coverage detected