MCPcopy Create free account
hub / github.com/1Panel-dev/1Panel / findConfiguredAgentByID

Function findConfiguredAgentByID

agent/app/service/agents_agents.go:266–286  ·  view source on GitHub ↗
(baseDir string, conf map[string]interface{}, id string)

Source from the content-addressed store, hash-verified

264}
265
266func findConfiguredAgentByID(baseDir string, conf map[string]interface{}, id string) (dto.AgentConfiguredAgentItem, bool) {
267 agents, ok := conf["agents"].(map[string]interface{})
268 if !ok {
269 return dto.AgentConfiguredAgentItem{}, false
270 }
271 rawList, ok := agents["list"].([]interface{})
272 if !ok {
273 return dto.AgentConfiguredAgentItem{}, false
274 }
275 for _, item := range rawList {
276 record, ok := item.(map[string]interface{})
277 if !ok {
278 continue
279 }
280 configured := extractConfiguredAgentItem(baseDir, record)
281 if strings.EqualFold(configured.ID, id) {
282 return configured, true
283 }
284 }
285 return dto.AgentConfiguredAgentItem{}, false
286}
287
288func formatRoleBinding(channel, accountID string) string {
289 if channel == "" {

Callers 2

DeleteRoleMethod · 0.85
operateRoleBindingMethod · 0.85

Calls 1

Tested by

no test coverage detected