generated from ConduitIO/conduit-connector-template
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathparamgen_src.go
69 lines (65 loc) · 2.83 KB
/
paramgen_src.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
// Code generated by paramgen. DO NOT EDIT.
// Source: github.com/ConduitIO/conduit-commons/tree/main/paramgen
package http
import (
"github.com/conduitio/conduit-commons/config"
)
const (
SourceConfigHeaders = "headers"
SourceConfigMethod = "method"
SourceConfigParams = "params.*"
SourceConfigPollingPeriod = "pollingPeriod"
SourceConfigScriptGetRequestData = "script.getRequestData"
SourceConfigScriptParseResponse = "script.parseResponse"
SourceConfigUrl = "url"
)
func (SourceConfig) Parameters() map[string]config.Parameter {
return map[string]config.Parameter{
SourceConfigHeaders: {
Default: "",
Description: "Http headers to use in the request, comma separated list of : separated pairs",
Type: config.ParameterTypeString,
Validations: []config.Validation{},
},
SourceConfigMethod: {
Default: "GET",
Description: "Http method to use in the request",
Type: config.ParameterTypeString,
Validations: []config.Validation{
config.ValidationInclusion{List: []string{"GET", "HEAD", "OPTIONS"}},
},
},
SourceConfigParams: {
Default: "",
Description: "parameters to use in the request, use params.* as the config key and specify its value, ex: set \"params.id\" as \"1\".",
Type: config.ParameterTypeString,
Validations: []config.Validation{},
},
SourceConfigPollingPeriod: {
Default: "5m",
Description: "how often the connector will get data from the url",
Type: config.ParameterTypeDuration,
Validations: []config.Validation{},
},
SourceConfigScriptGetRequestData: {
Default: "",
Description: "The path to a .js file containing the code to prepare the request data.\nThe signature of the function needs to be:\n`function getRequestData(cfg, previousResponse, position)` where:\n* `cfg` (a map) is the connector configuration\n* `previousResponse` (a map) contains data from the previous response (if any), returned by `parseResponse`\n* `position` (a byte array) contains the starting position of the connector.\nThe function needs to return a Request object.",
Type: config.ParameterTypeString,
Validations: []config.Validation{},
},
SourceConfigScriptParseResponse: {
Default: "",
Description: "The path to a .js file containing the code to parse the response.\nThe signature of the function needs to be:\n`function parseResponse(bytes)` where\n`bytes` are the original response's raw bytes (i.e. unparsed).\nThe response should be a Response object.",
Type: config.ParameterTypeString,
Validations: []config.Validation{},
},
SourceConfigUrl: {
Default: "",
Description: "Http url to send requests to",
Type: config.ParameterTypeString,
Validations: []config.Validation{
config.ValidationRequired{},
},
},
}
}