MCPcopy Create free account
hub / github.com/clouditor/clouditor / getMetrics

Function getMetrics

cli/session.go:325–350  ·  view source on GitHub ↗

TODO(oxisto): This could be an interesting use case for 1.18 Go generics

(_ string)

Source from the content-addressed store, hash-verified

323
324// TODO(oxisto): This could be an interesting use case for 1.18 Go generics
325func getMetrics(_ string) []string {
326 var (
327 err error
328 session *Session
329 client orchestrator.OrchestratorClient
330 res *orchestrator.ListMetricsResponse
331 )
332
333 if session, err = ContinueSession(); err != nil {
334 fmt.Printf("Error while retrieving the session. Please re-authenticate.\n")
335 return nil
336 }
337
338 client = orchestrator.NewOrchestratorClient(session)
339
340 if res, err = client.ListMetrics(context.Background(), &orchestrator.ListMetricsRequest{}); err != nil {
341 return []string{}
342 }
343
344 var metrics []string
345 for _, v := range res.Metrics {
346 metrics = append(metrics, fmt.Sprintf("%s\t%s: %s", v.Id, v.Name, v.Description))
347 }
348
349 return metrics
350}
351
352// TODO(oxisto): This could be an interesting use case for 1.18 Go generics
353func getCatalogs(_ string) []string {

Callers 1

ValidArgsGetMetricsFunction · 0.85

Calls 3

NewOrchestratorClientFunction · 0.92
ContinueSessionFunction · 0.85
ListMetricsMethod · 0.65

Tested by

no test coverage detected