(ctx context.Context, clusterId string, resource string, f func(gateway.IDynamicClient) error)
| 1189 | } |
| 1190 | |
| 1191 | func (m *imlMonitorConfig) dynamicClient(ctx context.Context, clusterId string, resource string, f func(gateway.IDynamicClient) error) error { |
| 1192 | client, err := m.clusterService.GatewayClient(ctx, clusterId) |
| 1193 | if err != nil { |
| 1194 | return err |
| 1195 | } |
| 1196 | defer func() { |
| 1197 | err := client.Close(ctx) |
| 1198 | if err != nil { |
| 1199 | log.Warn("close apinto client:", err) |
| 1200 | } |
| 1201 | }() |
| 1202 | dynamic, err := client.Dynamic(resource) |
| 1203 | if err != nil { |
| 1204 | return err |
| 1205 | } |
| 1206 | return f(dynamic) |
| 1207 | } |
| 1208 | |
| 1209 | func (m *imlMonitorConfig) SaveMonitorConfig(ctx context.Context, cfg *monitor_dto.SaveMonitorConfig) (*monitor_dto.MonitorConfig, error) { |
| 1210 | clusterId := cluster.DefaultClusterID |
no test coverage detected