(ctx context.Context, clusterId string, kind ...plugin_model.Kind)
| 209 | } |
| 210 | |
| 211 | func (i *imlPluginService) ListCluster(ctx context.Context, clusterId string, kind ...plugin_model.Kind) ([]*ConfigPartition, error) { |
| 212 | |
| 213 | defines, err := i.Defines(ctx, kind...) |
| 214 | if err != nil { |
| 215 | return nil, err |
| 216 | } |
| 217 | |
| 218 | configList, err := i.pluginPartitionStore.List(ctx, map[string]interface{}{ |
| 219 | "partition": clusterId, |
| 220 | }) |
| 221 | if err != nil { |
| 222 | return nil, err |
| 223 | } |
| 224 | configMap := utils.SliceToMap(configList, func(t *plugin.Partition) string { |
| 225 | return t.Plugin |
| 226 | }) |
| 227 | |
| 228 | return utils.SliceToSlice(defines, func(d *PluginDefine) *ConfigPartition { |
| 229 | c, has := configMap[d.Name] |
| 230 | if has { |
| 231 | return &ConfigPartition{ |
| 232 | Extend: d.Extend, |
| 233 | Cname: d.Cname, |
| 234 | Desc: d.Name, |
| 235 | Config: ConfigFromStore(c), |
| 236 | } |
| 237 | } else { |
| 238 | return &ConfigPartition{ |
| 239 | Extend: d.Extend, |
| 240 | Cname: d.Cname, |
| 241 | Desc: d.Name, |
| 242 | |
| 243 | Config: &Config{ |
| 244 | Plugin: d.Name, |
| 245 | Status: d.Status, |
| 246 | Config: d.Config, |
| 247 | |
| 248 | Operator: "", |
| 249 | }, |
| 250 | } |
| 251 | } |
| 252 | }), nil |
| 253 | |
| 254 | } |
nothing calls this directly
no test coverage detected