TestConnection test sonarqube connection options @Summary test sonarqube connection @Description Test sonarqube Connection @Tags plugins/sonarqube @Param body body models.SonarqubeConn true "json body" @Success 200 {object} SonarqubeTestConnResponse "Success" @Failure 400 {string} errcode.Error "B
(input *plugin.ApiResourceInput)
| 86 | // @Failure 500 {string} errcode.Error "Internal Error" |
| 87 | // @Router /plugins/sonarqube/test [POST] |
| 88 | func TestConnection(input *plugin.ApiResourceInput) (*plugin.ApiResourceOutput, errors.Error) { |
| 89 | // decode |
| 90 | var err errors.Error |
| 91 | var connection models.SonarqubeConn |
| 92 | if err = api.Decode(input.Body, &connection, vld); err != nil { |
| 93 | return nil, err |
| 94 | } |
| 95 | testConnectionResult, testConnectionErr := testConnection(context.TODO(), connection) |
| 96 | if testConnectionErr != nil { |
| 97 | return nil, plugin.WrapTestConnectionErrResp(basicRes, testConnectionErr) |
| 98 | } |
| 99 | if testConnectionResult.Status != http.StatusOK { |
| 100 | errMsg := fmt.Sprintf("Test connection fail, unexpected status code: %d", testConnectionResult.Status) |
| 101 | return nil, plugin.WrapTestConnectionErrResp(basicRes, errors.Default.New(errMsg)) |
| 102 | } |
| 103 | return testConnectionResult, nil |
| 104 | } |
| 105 | |
| 106 | // TestExistingConnection test sonarqube connection options |
| 107 | // @Summary test sonarqube connection |
nothing calls this directly
no test coverage detected