-
Notifications
You must be signed in to change notification settings - Fork 3
/
restart_connector.go
39 lines (34 loc) · 1.04 KB
/
restart_connector.go
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
38
39
package connect
import (
"context"
"strconv"
)
// RestartConnectorOptions describe the available options to restart connectors.
type RestartConnectorOptions struct {
// Specifies whether to restart the connector instance and task instances
// or just the connector instance. Default is false.
IncludeTasks bool
// Specifies whether to restart just the instances with a FAILED status
// or all instances. Default is false.
OnlyFailed bool
}
// // RestartConnector restart the connector.
func (c *Client) RestartConnector(ctx context.Context, connectorName string, options RestartConnectorOptions) error {
response, err := c.client.NewRequest().
SetContext(ctx).
SetError(ApiError{}).
SetPathParam("connector", connectorName).
SetQueryParams(map[string]string{
"includeTasks": strconv.FormatBool(options.IncludeTasks),
"onlyFailed": strconv.FormatBool(options.OnlyFailed),
}).
Post("/connectors/{connector}/restart")
if err != nil {
return err
}
err = getErrorFromResponse(response)
if err != nil {
return err
}
return nil
}