-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathget_connector.go
More file actions
37 lines (31 loc) · 836 Bytes
/
get_connector.go
File metadata and controls
37 lines (31 loc) · 836 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package connect
import (
"context"
)
type ConnectorInfo struct {
Name string `json:"name"`
Config map[string]string `json:"config"`
Tasks []ConnectorTaskID `json:"tasks"`
Type string `json:"type,omitempty"`
}
type ConnectorTaskID struct {
Connector string `json:"connector"`
Task int `json:"task"`
}
func (c *Client) GetConnector(ctx context.Context, connectorName string) (ConnectorInfo, error) {
var connectorInfo ConnectorInfo
response, err := c.client.NewRequest().
SetContext(ctx).
SetResult(&connectorInfo).
SetError(ApiError{}).
SetPathParam("connector", connectorName).
Get("/connectors/{connector}")
if err != nil {
return ConnectorInfo{}, err
}
err = getErrorFromResponse(response)
if err != nil {
return ConnectorInfo{}, err
}
return connectorInfo, nil
}