-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathput_validate_connector_config.go
More file actions
42 lines (35 loc) · 1.23 KB
/
put_validate_connector_config.go
File metadata and controls
42 lines (35 loc) · 1.23 KB
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
40
41
42
package connect
import (
"context"
)
type ValidateConnectorConfigOptions struct {
Config map[string]interface{}
}
type ConnectorValidationResultConfig struct {
Definition map[string]interface{} `json:"definition"`
Value map[string]interface{} `json:"value"`
}
type ConnectorValidationResult struct {
Name string `json:"name"`
ErrorCount int `json:"error_count"`
Groups []string `json:"groups"`
Configs []ConnectorValidationResultConfig `json:"configs"`
}
func (c *Client) PutValidateConnectorConfig(ctx context.Context, pluginClassName string, options ValidateConnectorConfigOptions) (ConnectorValidationResult, error) {
var connectorValidationResult ConnectorValidationResult
response, err := c.client.NewRequest().
SetContext(ctx).
SetResult(&connectorValidationResult).
SetError(ApiError{}).
SetPathParam("pluginClassName", pluginClassName).
SetBody(options.Config).
Put("/connector-plugins/{pluginClassName}/config/validate")
if err != nil {
return ConnectorValidationResult{}, err
}
err = getErrorFromResponse(response)
if err != nil {
return ConnectorValidationResult{}, err
}
return connectorValidationResult, nil
}