|
1 | 1 | package config |
2 | 2 |
|
3 | 3 | type Monitor struct { |
4 | | - // Whether the monitor is active |
5 | | - Active bool `json:"active,omitempty"` |
6 | | - // Assertions to run on the response |
7 | | - Assertions []Assertion `json:"assertions,omitempty"` |
8 | | - // Time in milliseconds to wait before marking the request as degraded |
9 | | - DegradedAfter int64 `json:"degradedAfter,omitempty"` |
10 | | - Description string `json:"description,omitempty"` |
11 | | - Frequency Frequency `json:"frequency"` |
12 | | - Kind CoordinateKind `json:"kind"` |
13 | 4 | // Name of the monitor |
14 | | - Name string `json:"name"` |
15 | | - // Whether the monitor is public |
16 | | - Public bool `json:"public,omitempty"` |
| 5 | + Name string `json:"name" ,yaml:"name"` |
| 6 | + Description string `json:"description,omitempty" ,yaml:"description,omitempty"` |
| 7 | + Frequency Frequency `json:"frequency" ,yaml:"frequency"` |
17 | 8 | // Regions to run the request in |
18 | | - Regions []Region `json:"regions"` |
19 | | - // The HTTP Request we are sending |
20 | | - Request Request `json:"request"` |
| 9 | + Regions []Region `json:"regions" ,yaml:"regions"` |
| 10 | + // Whether the monitor is active |
| 11 | + Active bool `json:"active"` |
| 12 | + Kind CoordinateKind `json:"kind" ,yaml:"kind"` |
21 | 13 | // Number of retries to attempt |
22 | | - Retry int64 `json:"retry,omitempty"` |
| 14 | + Retry int64 `json:"retry,omitempty" ,yaml:"retry,omitempty"` |
| 15 | + // Whether the monitor is public |
| 16 | + Public bool `json:"public,omitempty" ,yaml:"public,omitempty"` |
| 17 | + // The HTTP Request we are sending |
| 18 | + Request Request `json:"request" ,yaml:"request"` |
| 19 | + // Time in milliseconds to wait before marking the request as degraded |
| 20 | + DegradedAfter int64 `json:"degradedAfter,omitempty" ,yaml:"degradedAfter,omitempty"` |
23 | 21 | // Time in milliseconds to wait before marking the request as timed out |
24 | | - Timeout int64 `json:"timeout,omitempty"` |
| 22 | + Timeout int64 `json:"timeout,omitempty" ,yaml:"timeout,omitempty"` |
| 23 | + // Assertions to run on the response |
| 24 | + Assertions []Assertion `json:"assertions,omitempty" ,yaml:"assertions,omitempty"` |
25 | 25 | } |
26 | 26 |
|
27 | 27 | type Assertion struct { |
28 | 28 | // Comparison operator |
29 | | - Compare Compare `json:"compare"` |
30 | | - Kind AssertionKind `json:"kind"` |
| 29 | + Compare Compare `json:"compare" ,yaml:"compare"` |
| 30 | + Kind AssertionKind `json:"kind" ,yaml:"kind"` |
31 | 31 | // Status code to assert |
32 | 32 | // |
33 | 33 | // Header value to assert |
34 | 34 | // |
35 | 35 | // Text body to assert |
36 | | - Target any `json:"target"` |
| 36 | + Target any `json:"target" ,yaml:"target"` |
37 | 37 | // Header key to assert |
38 | | - Key string `json:"key,omitempty"` |
| 38 | + Key string `json:"key,omitempty" ,yaml:"key,omitempty"` |
39 | 39 | } |
40 | 40 |
|
41 | 41 | // The HTTP Request we are sending |
42 | 42 | type Request struct { |
43 | 43 | // Body to send with the request |
44 | | - Body string `json:"body,omitempty"` |
45 | | - Headers map[string]string `json:"headers,omitempty"` |
46 | | - Method Method `json:"method,omitempty"` |
| 44 | + Body string `json:"body,omitempty" ,yaml:"body,omitempty"` |
| 45 | + Headers map[string]string `json:"headers,omitempty" ,yaml:"headers,omitempty"` |
| 46 | + Method Method `json:"method,omitempty" ,yaml:"method,omitempty"` |
47 | 47 | // URL to request |
48 | | - URL string `json:"url,omitempty"` |
| 48 | + URL string `json:"url,omitempty" ,yaml:"url,omitempty"` |
49 | 49 | // Host to connect to |
50 | | - Host string `json:"host,omitempty"` |
| 50 | + Host string `json:"host,omitempty" ,yaml:"host,omitempty"` |
51 | 51 | // Port to connect to |
52 | | - Port float64 `json:"port,omitempty"` |
| 52 | + Port int64 `json:"port,omitempty" ,yaml:"port,omitempty"` |
53 | 53 | } |
54 | 54 |
|
55 | 55 | // Comparison operator |
|
0 commit comments