Skip to content

Commit

Permalink
Provide metro as well with facility code for hardware reservation
Browse files Browse the repository at this point in the history
  • Loading branch information
aayushrangwala committed Aug 8, 2023
1 parent 15e23b9 commit 8739050
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions internal/hardware/retrieve.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ func (c *Client) Retrieve() *cobra.Command {
projectID, _ := cmd.Flags().GetString("project-id")
hardwareReservationID, _ := cmd.Flags().GetString("id")

header := []string{"ID", "Facility", "Plan", "Created"}
header := []string{"ID", "Facility", "Metro", "Plan", "Created"}

inc := []string{}
inc := []string{"facility"}

// only fetch extra details when rendered
switch c.Servicer.Format() {
Expand All @@ -69,8 +69,12 @@ func (c *Client) Retrieve() *cobra.Command {
}

data := make([][]string, 1)
metro := ""
if r.Facility.Metro != nil {
metro = r.Facility.Metro.Code
}

data[0] = []string{r.ID, r.Facility.Code, r.Plan.Name, r.CreatedAt.String()}
data[0] = []string{r.ID, r.Facility.Code, metro, r.Plan.Name, r.CreatedAt.String()}

return c.Out.Output(r, header, &data)
}
Expand All @@ -83,7 +87,11 @@ func (c *Client) Retrieve() *cobra.Command {
data := make([][]string, len(reservations))

for i, r := range reservations {
data[i] = []string{r.ID, r.Facility.Code, r.Plan.Name, r.CreatedAt.String()}
metro := ""
if r.Facility.Metro != nil {
metro = r.Facility.Metro.Code
}
data[i] = []string{r.ID, r.Facility.Code, metro, r.Plan.Name, r.CreatedAt.String()}
}

return c.Out.Output(reservations, header, &data)
Expand Down

0 comments on commit 8739050

Please sign in to comment.