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)
| 36 | // @Failure 500 {object} shared.ApiBody "Internal Error" |
| 37 | // @Router /plugins/argocd/connections/{connectionId}/scopes [PUT] |
| 38 | func 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 |
nothing calls this directly
no test coverage detected