MCPcopy Create free account
hub / github.com/apache/devlake / PutScopes

Function PutScopes

backend/plugins/argocd/api/scope_api.go:38–57  ·  view source on GitHub ↗

PutScopes create or update argocd applications @Summary create or update argocd applications @Description Create or update ArgoCD application scopes @Tags plugins/argocd @Accept application/json @Param connectionId path int false "connection ID" @Param scope body models.ArgocdApplication true "json"

(input *plugin.ApiResourceInput)

Source from the content-addressed store, hash-verified

36// @Failure 500 {object} shared.ApiBody "Internal Error"
37// @Router /plugins/argocd/connections/{connectionId}/scopes [PUT]
38func PutScopes(input *plugin.ApiResourceInput) (*plugin.ApiResourceOutput, errors.Error) {
39 connParam, ok := input.Params["connectionId"]
40 if ok {
41 if cid, err := strconv.ParseUint(connParam, 10, 64); err == nil {
42 cfg, _ := CreateDefaultScopeConfig(cid)
43 if cfg != nil {
44 if data, ok := input.Body["data"].([]interface{}); ok {
45 for _, row := range data {
46 if m, ok := row.(map[string]interface{}); ok {
47 if _, has := m["scopeConfigId"]; !has || m["scopeConfigId"] == 0 {
48 m["scopeConfigId"] = cfg.ID
49 }
50 }
51 }
52 }
53 }
54 }
55 }
56 return dsHelper.ScopeApi.PutMultiple(input)
57}
58
59// UpdateScope patch to argocd application
60// @Summary patch to argocd application

Callers

nothing calls this directly

Calls 2

CreateDefaultScopeConfigFunction · 0.85
PutMultipleMethod · 0.80

Tested by

no test coverage detected