MCPcopy Index your code
hub / github.com/cortexlabs/cortex / asyncDescribeAPITable

Function asyncDescribeAPITable

cli/cmd/lib_async_apis.go:58–82  ·  view source on GitHub ↗
(asyncAPI schema.APIResponse, env cliconfig.Environment)

Source from the content-addressed store, hash-verified

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

Callers 1

describeAPIFunction · 0.85

Calls 5

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

Tested by

no test coverage detected