PutScope create or update sonarqube project @Summary create or update sonarqube project @Description Create or update sonarqube project @Tags plugins/sonarqube @Accept application/json @Param connectionId path int false "connection ID" @Param scope body PutScopesReqBody true "json" @Success 200 {ob
(input *plugin.ApiResourceInput)
| 41 | // @Failure 500 {object} shared.ApiBody "Internal Error" |
| 42 | // @Router /plugins/sonarqube/connections/{connectionId}/scopes [PUT] |
| 43 | func PutScope(input *plugin.ApiResourceInput) (*plugin.ApiResourceOutput, errors.Error) { |
| 44 | // decode request body to scope, deal with lastAnalysisDate format |
| 45 | data, ok := input.Body["data"].([]interface{}) |
| 46 | if !ok { |
| 47 | return nil, errors.BadInput.New("invalid `data`") |
| 48 | } |
| 49 | for _, item := range data { |
| 50 | dateStr, ok := item.(map[string]interface{})["lastAnalysisDate"].(string) |
| 51 | if !ok { |
| 52 | continue |
| 53 | } |
| 54 | timeObj, err := common.ConvertStringToTime(dateStr) |
| 55 | if err != nil { |
| 56 | panic(err) |
| 57 | } |
| 58 | |
| 59 | item.(map[string]interface{})["lastAnalysisDate"] = timeObj |
| 60 | |
| 61 | } |
| 62 | |
| 63 | return dsHelper.ScopeApi.PutMultiple(input) |
| 64 | } |
| 65 | |
| 66 | // UpdateScope patch to sonarqube project |
| 67 | // @Summary patch to sonarqube project |
nothing calls this directly
no test coverage detected