MCPcopy Index your code
hub / github.com/cloudfoundry/cli / displaySecurityGroupRulesTable

Method displaySecurityGroupRulesTable

command/v7/space_command.go:94–115  ·  view source on GitHub ↗
(spaceSummary v7action.SpaceSummary)

Source from the content-addressed store, hash-verified

92}
93
94func (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
117func collectSecurityGroupRuleRows(spaceSummary v7action.SpaceSummary) [][]string {
118 var rows [][]string

Callers 1

ExecuteMethod · 0.95

Calls 4

DisplayNewlineMethod · 0.65
DisplayTextMethod · 0.65

Tested by

no test coverage detected