(input *plugin.ApiResourceInput)
| 81 | } |
| 82 | |
| 83 | func TestExistingConnection(input *plugin.ApiResourceInput) (*plugin.ApiResourceOutput, errors.Error) { |
| 84 | connection, err := dsHelper.ConnApi.GetMergedConnection(input) |
| 85 | if err != nil { |
| 86 | return nil, errors.BadInput.Wrap(err, "find connection from db") |
| 87 | } |
| 88 | if err := helper.DecodeMapStruct(input.Body, connection, false); err != nil { |
| 89 | return nil, err |
| 90 | } |
| 91 | if connection.Endpoint == "" { |
| 92 | connection.Endpoint = defaultAsanaEndpoint |
| 93 | } |
| 94 | testConnectionResult, testConnectionErr := testConnection(context.TODO(), connection.AsanaConn) |
| 95 | if testConnectionErr != nil { |
| 96 | return nil, plugin.WrapTestConnectionErrResp(basicRes, testConnectionErr) |
| 97 | } |
| 98 | return &plugin.ApiResourceOutput{Body: testConnectionResult, Status: http.StatusOK}, nil |
| 99 | } |
| 100 | |
| 101 | func PostConnections(input *plugin.ApiResourceInput) (*plugin.ApiResourceOutput, errors.Error) { |
| 102 | if input.Body != nil { |
nothing calls this directly
no test coverage detected