MCPcopy
hub / github.com/cortexlabs/cortex / realtimeDescribeAPITable

Function realtimeDescribeAPITable

cli/cmd/lib_realtime_apis.go:57–81  ·  view source on GitHub ↗
(realtimeAPI schema.APIResponse, env cliconfig.Environment)

Source from the content-addressed store, hash-verified

55}
56
57func 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
83func realtimeAPIsTable(realtimeAPIs []schema.APIResponse, envNames []string) table.Table {
84 rows := make([][]interface{}, 0, len(realtimeAPIs))

Callers 1

describeAPIFunction · 0.85

Calls 5

ErrorUnexpectedFunction · 0.92
BoldFunction · 0.92
realtimeAPIsTableFunction · 0.85
replicaCountTableFunction · 0.85
MustFormatMethod · 0.80

Tested by

no test coverage detected