/
event.go
128 lines (106 loc) · 4.02 KB
/
event.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
package scheme
// EventMeta describes core elements in a event request/response scheme.
type EventMeta struct {
ID uint64 `json:"id" yaml:"id" mapstructure:"id"`
Event string `json:"event" yaml:"event" mapstructure:"event"`
}
// RequestStatus describes a scheme for request/status event.
type RequestStatus struct {
EventMeta `mapstructure:",squash"`
}
// RequestVersion describes a scheme for request/version event.
type RequestVersion struct {
EventMeta `mapstructure:",squash"`
}
// RequestConfig describes a scheme for request/config event.
type RequestConfig struct {
EventMeta `mapstructure:",squash"`
}
// RequestPlugins describes a scheme for request/plugin event, with no
// plugin id being provided.
type RequestPlugins struct {
EventMeta `mapstructure:",squash"`
}
// RequestPlugin describes a scheme for request/plugin event.
type RequestPlugin struct {
EventMeta `mapstructure:",squash"`
Data PluginData `json:"data" yaml:"data" mapstructure:"data"`
}
// PluginData describes the data for request/plugin event.
type PluginData struct {
Plugin string `json:"plugin" yaml:"plugin" mapstructure:"plugin"`
}
// RequestPluginHealth describes a scheme for request/plugin_health event.
type RequestPluginHealth struct {
EventMeta `mapstructure:",squash"`
}
// RequestScan describes a scheme for request/scan event.
type RequestScan struct {
EventMeta `mapstructure:",squash"`
Data ScanOptions `json:"data" yaml:"data" mapstructure:"data"`
}
// RequestTags describes a scheme for request/tags event.
type RequestTags struct {
EventMeta `mapstructure:",squash"`
Data TagsOptions `json:"data" yaml:"data" mapstructure:"data"`
}
// RequestInfo describes a scheme for request/info event.
type RequestInfo struct {
EventMeta `mapstructure:",squash"`
Data DeviceData `json:"data" yaml:"data" mapstructure:"data"`
}
// DeviceData describes the data for response/info event.
type DeviceData struct {
Device string `json:"device" yaml:"device" mapstructure:"device"`
}
// RequestRead describes a scheme for request/read event.
type RequestRead struct {
EventMeta `mapstructure:",squash"`
Data ReadOptions `json:"data" yaml:"data" mapstructure:"data"`
}
// RequestReadDevice describes a scheme for request/read_device event.
type RequestReadDevice struct {
EventMeta `mapstructure:",squash"`
Data ReadDeviceData `json:"data" yaml:"data" mapstructure:"data"`
}
// ReadDeviceData describes the data for request/read_device event.
type ReadDeviceData struct {
Device string `json:"device" yaml:"device" mapstructure:"device"`
}
// RequestReadCache describes a scheme for request/read_cache event.
type RequestReadCache struct {
EventMeta `mapstructure:",squash"`
Data ReadCacheOptions `json:"data" yaml:"data" mapstructure:"data"`
}
// RequestReadStream describes a scheme for the request/read_stream event.
type RequestReadStream struct {
EventMeta `mapstructure:",squash"`
Data ReadStreamOptions `json:"data" yaml:"data" mapstructure:"data"`
}
// RequestWrite describes a scheme for request/write_async and
// request/write_sync event.
type RequestWrite struct {
EventMeta `mapstructure:",squash"`
Data RequestWriteData `json:"data" yaml:"data" mapstructure:"data"`
}
// RequestWriteData describes the data for request/write_async and
// request/write_sync event.
type RequestWriteData struct {
Device string `json:"device" yaml:"device" mapstructure:"device"`
Payload []WriteData `json:"payload" yaml:"payload" mapstructure:"payload"`
}
// RequestTransactions describes a scheme for request/transaction event with no
// transaction id being provided.
type RequestTransactions struct {
EventMeta `mapstructure:",squash"`
}
// RequestTransaction describes a scheme for request/transaction event.
type RequestTransaction struct {
EventMeta `mapstructure:",squash"`
Data WriteData `json:"data" yaml:"data" mapstructure:"data"`
}
// Response describes a generic response scheme.
type Response struct {
EventMeta `mapstructure:",squash"`
Data interface{} `json:"data" yaml:"data" mapstructure:"data"`
}