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

Method GetConfig

service/plugin-cluster/iml.go:96–122  ·  view source on GitHub ↗
(ctx context.Context, clusterId string, name string)

Source from the content-addressed store, hash-verified

94}
95
96func (i *imlPluginService) GetConfig(ctx context.Context, clusterId string, name string) (*Config, *PluginDefine, error) {
97
98 define, err := i.defineStore.First(ctx, map[string]interface{}{
99 "name": name,
100 })
101 if err != nil {
102 if errors.Is(err, gorm.ErrRecordNotFound) {
103 return nil, nil, fmt.Errorf("plugin define not found: %s", name)
104 }
105 return nil, nil, err
106 }
107 conf, _ := i.pluginPartitionStore.First(ctx, map[string]interface{}{
108 "partition": clusterId,
109 "Plugin": name,
110 })
111 if conf == nil {
112 return &Config{
113 Plugin: name,
114 Status: define.Status,
115 Config: define.Config,
116 Operator: "",
117 }, FromEntity(define), nil
118
119 }
120 return ConfigFromStore(conf), FromEntity(define), nil
121
122}
123
124func (i *imlPluginService) Defines(ctx context.Context, kind ...plugin_model.Kind) ([]*PluginDefine, error) {
125 if len(kind) == 0 {

Callers

nothing calls this directly

Calls 2

ConfigFromStoreFunction · 0.85
FromEntityFunction · 0.70

Tested by

no test coverage detected