MCPcopy
hub / github.com/apache/devlake / TestExistingConnection

Function TestExistingConnection

backend/plugins/q_dev/api/test_connection.go:50–67  ·  view source on GitHub ↗

TestExistingConnection 测试现有连接

(input *plugin.ApiResourceInput)

Source from the content-addressed store, hash-verified

48
49// TestExistingConnection 测试现有连接
50func TestExistingConnection(input *plugin.ApiResourceInput) (*plugin.ApiResourceOutput, errors.Error) {
51 connection := &models.QDevConnection{}
52 err := connectionHelper.First(connection, input.Params)
53 if err != nil {
54 return nil, errors.BadInput.Wrap(err, "find connection from db")
55 }
56 if err := api.DecodeMapStruct(input.Body, connection, false); err != nil {
57 return nil, err
58 }
59 // 测试连接
60 _, err = tasks.NewQDevS3Client(nil, connection)
61 if err != nil {
62 return nil, err
63 }
64
65 // 连接成功
66 return &plugin.ApiResourceOutput{Status: http.StatusOK}, nil
67}

Callers

nothing calls this directly

Calls 2

WrapMethod · 0.80
FirstMethod · 0.65

Tested by

no test coverage detected