|
1 | 1 | package loadbalancer |
2 | 2 |
|
3 | 3 | import ( |
| 4 | + "strings" |
| 5 | + |
4 | 6 | "github.com/UpCloudLtd/upcloud-cli/internal/commands" |
5 | 7 | "github.com/UpCloudLtd/upcloud-cli/internal/completion" |
6 | 8 | "github.com/UpCloudLtd/upcloud-cli/internal/output" |
@@ -69,6 +71,19 @@ func (s *showCommand) Execute(exec commands.Executor, uuid string) (output.Outpu |
69 | 71 | }) |
70 | 72 | } |
71 | 73 |
|
| 74 | + resolverRows := []output.TableRow{} |
| 75 | + for _, resolver := range lb.Resolvers { |
| 76 | + var nameservers []string |
| 77 | + for _, nameserver := range resolver.Nameservers { |
| 78 | + nameservers = append(nameservers, ui.DefaultAddressColours.Sprint(nameserver)) |
| 79 | + } |
| 80 | + |
| 81 | + resolverRows = append(resolverRows, output.TableRow{ |
| 82 | + resolver.Name, |
| 83 | + strings.Join(nameservers, ", "), |
| 84 | + }) |
| 85 | + } |
| 86 | + |
72 | 87 | // For JSON and YAML output, passthrough API response |
73 | 88 | return output.MarshaledWithHumanOutput{ |
74 | 89 | Value: lb, |
@@ -117,6 +132,16 @@ func (s *showCommand) Execute(exec commands.Executor, uuid string) (output.Outpu |
117 | 132 | Rows: frontEndRows, |
118 | 133 | }, |
119 | 134 | }, |
| 135 | + output.CombinedSection{ |
| 136 | + Title: "Resolvers:", |
| 137 | + Contents: output.Table{ |
| 138 | + Columns: []output.TableColumn{ |
| 139 | + {Key: "name", Header: "Name"}, |
| 140 | + {Key: "nameservers", Header: "Nameservers"}, |
| 141 | + }, |
| 142 | + Rows: resolverRows, |
| 143 | + }, |
| 144 | + }, |
120 | 145 | }, |
121 | 146 | }, nil |
122 | 147 | } |
0 commit comments