(realtimeAPI schema.APIResponse, env cliconfig.Environment)
| 55 | } |
| 56 | |
| 57 | func realtimeDescribeAPITable(realtimeAPI schema.APIResponse, env cliconfig.Environment) (string, error) { |
| 58 | if realtimeAPI.Metadata == nil { |
| 59 | return "", errors.ErrorUnexpected("missing metadata from operator response") |
| 60 | } |
| 61 | |
| 62 | if realtimeAPI.Status == nil { |
| 63 | return "", errors.ErrorUnexpected(fmt.Sprintf("missing status for %s api", realtimeAPI.Metadata.Name)) |
| 64 | } |
| 65 | |
| 66 | t := realtimeAPIsTable([]schema.APIResponse{realtimeAPI}, []string{env.Name}) |
| 67 | out := t.MustFormat() |
| 68 | |
| 69 | if realtimeAPI.DashboardURL != nil && *realtimeAPI.DashboardURL != "" { |
| 70 | out += "\n" + console.Bold("metrics dashboard: ") + *realtimeAPI.DashboardURL + "\n" |
| 71 | } |
| 72 | |
| 73 | if realtimeAPI.Endpoint != nil { |
| 74 | out += "\n" + console.Bold("endpoint: ") + *realtimeAPI.Endpoint + "\n" |
| 75 | } |
| 76 | |
| 77 | t = replicaCountTable(realtimeAPI.Status.ReplicaCounts) |
| 78 | out += "\n" + t.MustFormat() |
| 79 | |
| 80 | return out, nil |
| 81 | } |
| 82 | |
| 83 | func realtimeAPIsTable(realtimeAPIs []schema.APIResponse, envNames []string) table.Table { |
| 84 | rows := make([][]interface{}, 0, len(realtimeAPIs)) |
no test coverage detected