-
Notifications
You must be signed in to change notification settings - Fork 0
/
act-utils.wit
97 lines (78 loc) · 1.99 KB
/
act-utils.wit
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
package act:utils
interface http-client {
record http-call-options {
method: methods,
uri: string,
headers: headers,
body: list<u8>, //The body is just a byte array
}
record http-return-values {
status: u16,
body: list<u8>
}
enum methods {
GET,
POST,
PUT,
DELETE,
OPTIONS,
HEAD
}
//Seems like the closest we can get to a map style structure
type headers = list<tuple<string, string>>
make-http-request: func(options: http-call-options) -> http-return-values
}
interface time-client {
//This name is clunky, but want to make it obvious to authors that we want the
//unix timestamp in milliseconds
get-sys-time-unix-millis: func() -> u64
}
interface print-client {
print-host: func(input: string)
}
interface creds-client {
record creds {
access-key-id: string,
secret-access-key: string,
session-token: string,
}
get-creds: func() -> creds
}
world utils {
import http-client
import time-client
import print-client
import creds-client
export list-tables: func() -> result<string, string>
export alarm-connector-def
}
interface alarm-connector-def {
record alarm-event {
event-arn: string,
service: string,
event-type-code: string,
event-type-category: string,
start-time: string,
end-time: string,
event-description: event-desc-list,
affected-entities: entity-list,
}
type event-desc-list = list<event-description>
record event-description {
language: string,
latest-description: string,
}
type entity-list = list<entity>
//This Entity is not to be confused with the ACT concept of
//Entity = Component | Connector, thats just an unfortunate overlap of
//concept names
record entity{
entity-value: string,
tags: list<tag>,
}
record tag{
key: string,
value: string,
}
parse: func(input: string) -> result<alarm-event, string>
}