MCPcopy Create free account
hub / github.com/APIParkLab/APIPark / MapByCluster

Method MapByCluster

service/monitor/iml.go:71–93  ·  view source on GitHub ↗
(ctx context.Context, partitionIds ...string)

Source from the content-addressed store, hash-verified

69}
70
71func (i *imlMonitorService) MapByCluster(ctx context.Context, partitionIds ...string) (map[string]*Monitor, error) {
72 if len(partitionIds) == 0 {
73 return make(map[string]*Monitor), nil
74 }
75 list, err := i.store.List(ctx, map[string]interface{}{
76 "cluster": partitionIds,
77 })
78 if err != nil {
79 return nil, err
80 }
81 return utils.SliceToMapO(list, func(m *monitor.Monitor) (string, *Monitor) {
82 return m.Cluster, &Monitor{
83 ID: m.UUID,
84 Cluster: m.Cluster,
85 Driver: m.Driver,
86 Config: m.Config,
87 Creator: m.Creator,
88 Updater: m.Updater,
89 CreateAt: m.CreateAt,
90 UpdateAt: m.UpdateAt,
91 }
92 }), nil
93}
94
95func (i *imlMonitorService) Save(ctx context.Context, m *SaveMonitor) error {
96 userId := utils.UserId(ctx)

Callers

nothing calls this directly

Calls 1

ListMethod · 0.65

Tested by

no test coverage detected