-
Notifications
You must be signed in to change notification settings - Fork 7
/
api.go
68 lines (53 loc) · 2.18 KB
/
api.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
package types
import localconstants "github.com/turbot/flowpipe/internal/constants"
// APIVersionRequestURI defines the requested API version.
type APIVersionRequestURI struct {
APIVersion string `uri:"api_version" binding:"required,flowpipe_api_version"`
}
type ListRequestQuery struct {
NextToken string `json:"next_token" form:"next_token" binding:"omitempty"`
Limit *int `json:"limit,omitempty" form:"limit" binding:"omitempty"`
}
type PipelineRequestURI struct {
PipelineName string `uri:"pipeline_name" binding:"required" format:"^[a-z_]{0,32}$"`
}
type IntegrationRequestURI struct {
IntegrationName string `uri:"integration_name" binding:"required" format:"^[a-z_]{0,32}$"`
}
type NotifierRequestURI struct {
NotifierName string `uri:"notifier_name" binding:"required" format:"^[a-z_]{0,32}$"`
}
type TriggerRequestURI struct {
TriggerName string `uri:"trigger_name" binding:"required" format:"^[a-z]{0,32}$"`
}
type VariableRequestURI struct {
VariableName string `uri:"variable_name" binding:"required" format:"^[a-z]{0,32}$"`
}
type ModRequestURI struct {
ModName string `uri:"mod_name" binding:"required" format:"^[a-z]{0,32}$"`
}
type ProcessRequestURI struct {
// TODO: do we want to pass the ExecutionID or PipelineExecutionID? The log is stored under ExecutionID but the execution works with PipelineExecutionID
// ProcessId string `uri:"process_id" binding:"required" format:"^(pexec|exec)_[0-9a-v]{20}$"`
ProcessId string `uri:"process_id" binding:"required" format:"^exec_[0-9a-v]{20}$"`
}
type WebhookRequestUri struct {
Hook string `json:"hook" uri:"hook" binding:"required"`
Hash string `json:"hash" uri:"hash" binding:"required"`
}
type WebhookRequestQuery struct {
WaitTime *int `json:"wait_time" form:"wait_time" binding:"omitempty"`
}
func (c *WebhookRequestQuery) GetWaitTime() int {
if c.WaitTime != nil {
return *c.WaitTime
}
return localconstants.DefaultWaitRetry
}
type PipelineRequestQuery struct {
ExecutionMode *string `json:"execution_mode" form:"execution_mode" binding:"omitempty,oneof=synchronous asynchronous"`
}
type InputIDHash struct {
ID string `json:"id" uri:"id" binding:"required"`
Hash string `json:"hash" uri:"hash" binding:"required"`
}