-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmodel_uptime_test_.go
247 lines (241 loc) · 8.13 KB
/
model_uptime_test_.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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
/*
* StatusCake API
*
* Copyright (c) 2023
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*
* API version: 1.2.0
* Contact: [email protected]
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package statuscake
import (
"encoding/json"
"time"
)
// UptimeTest struct for UptimeTest
type UptimeTest struct {
// Uptime check ID
ID string `json:"id"`
// Name of the check
Name string `json:"name"`
TestType UptimeTestType `json:"test_type"`
// URL, FQDN, or IP address of the server under test
WebsiteURL string `json:"website_url"`
CheckRate UptimeTestCheckRate `json:"check_rate"`
// Number of confirmation servers to confirm downtime before an alert is triggered
Confirmation int32 `json:"confirmation"`
// List of contact group IDs
ContactGroups []string `json:"contact_groups"`
// JSON object. Represents headers to be sent when making requests
CustomHeader *string `json:"custom_header,omitempty"`
// List of IP addresses to compare against returned DNS records
DNSIPs []string `json:"dns_ips"`
// FQDN or IP address of the nameserver to query
DNSServer *string `json:"dns_server,omitempty"`
// Whether to consider the check as down if the content is present within the response
DoNotFind bool `json:"do_not_find"`
// Whether to send an alert if the SSL certificate is soon to expire
EnableSSLAlert bool `json:"enable_ssl_alert"`
// Specify where the redirect chain should end
FinalEndpoint *string `json:"final_endpoint,omitempty"`
// String to look for within the response. Considered down if not found
FindString *string `json:"find_string,omitempty"`
// Whether to follow redirects when testing. Disabled by default
FollowRedirects bool `json:"follow_redirects"`
// Include header content in string match search
IncludeHeader bool `json:"include_header"`
// Name of the hosting provider
Host *string `json:"host,omitempty"`
// When the check was last run (RFC3339 format)
LastTested *time.Time `json:"last_tested_at,omitempty"`
// The server location the check will run next
NextLocation *string `json:"next_location,omitempty"`
// Whether the check should be run
Paused bool `json:"paused"`
// Destination port for TCP checks
Port *int32 `json:"port,omitempty"`
// JSON object. Payload submitted with the request. Setting this updates the check to use the HTTP POST verb
PostBody *string `json:"post_body,omitempty"`
// Raw HTTP POST string to send to the server
PostRaw *string `json:"post_raw,omitempty"`
// Whether the check is currently being processed
Processing bool `json:"processing"`
// The server location the check is currently being run
ProcessingOn *string `json:"processing_on,omitempty"`
ProcessingState *UptimeTestProcessingState `json:"processing_state,omitempty"`
// List of assigned monitoring locations on which to run checks
Servers []MonitoringLocation `json:"servers"`
Status UptimeTestStatus `json:"status"`
// List of status codes that trigger an alert
StatusCodes []string `json:"status_codes"`
// List of tags
Tags []string `json:"tags"`
// The number of seconds to wait to receive the first byte
Timeout int32 `json:"timeout"`
// The number of minutes to wait before sending an alert
TriggerRate int32 `json:"trigger_rate"`
// Uptime percentage for a check
Uptime float32 `json:"uptime"`
// Whether to enable cookie storage
UseJAR bool `json:"use_jar"`
// Custom user agent string set when testing
UserAgent *string `json:"user_agent,omitempty"`
}
// NewUptimeTest instantiates a new UptimeTest object.
// This constructor will assign default values to properties that have it
// defined, and makes sure properties required by API are set, but the set of
// arguments will change when the set of required properties is changed.
func NewUptimeTest(id string, name string, testType UptimeTestType, websiteUrl string, checkRate UptimeTestCheckRate, confirmation int32, contactGroups []string, dnsIps []string, doNotFind bool, enableSslAlert bool, followRedirects bool, includeHeader bool, paused bool, processing bool, servers []MonitoringLocation, status UptimeTestStatus, statusCodes []string, tags []string, timeout int32, triggerRate int32, uptime float32, useJar bool) *UptimeTest {
return &UptimeTest{
ID: id,
Name: name,
TestType: testType,
WebsiteURL: websiteUrl,
CheckRate: checkRate,
Confirmation: confirmation,
ContactGroups: contactGroups,
DNSIPs: dnsIps,
DoNotFind: doNotFind,
EnableSSLAlert: enableSslAlert,
FollowRedirects: followRedirects,
IncludeHeader: includeHeader,
Paused: paused,
Processing: processing,
Servers: servers,
Status: status,
StatusCodes: statusCodes,
Tags: tags,
Timeout: timeout,
TriggerRate: triggerRate,
Uptime: uptime,
UseJAR: useJar,
}
}
// MarshalJSON serialises data in the struct to JSON.
func (o UptimeTest) MarshalJSON() ([]byte, error) {
toSerialize := map[string]interface{}{}
if true {
toSerialize["id"] = o.ID
}
if true {
toSerialize["name"] = o.Name
}
if true {
toSerialize["test_type"] = o.TestType
}
if true {
toSerialize["website_url"] = o.WebsiteURL
}
if true {
toSerialize["check_rate"] = o.CheckRate
}
if true {
toSerialize["confirmation"] = o.Confirmation
}
if true {
toSerialize["contact_groups"] = o.ContactGroups
}
if o.CustomHeader != nil {
toSerialize["custom_header"] = o.CustomHeader
}
if true {
toSerialize["dns_ips"] = o.DNSIPs
}
if o.DNSServer != nil {
toSerialize["dns_server"] = o.DNSServer
}
if true {
toSerialize["do_not_find"] = o.DoNotFind
}
if true {
toSerialize["enable_ssl_alert"] = o.EnableSSLAlert
}
if o.FinalEndpoint != nil {
toSerialize["final_endpoint"] = o.FinalEndpoint
}
if o.FindString != nil {
toSerialize["find_string"] = o.FindString
}
if true {
toSerialize["follow_redirects"] = o.FollowRedirects
}
if true {
toSerialize["include_header"] = o.IncludeHeader
}
if o.Host != nil {
toSerialize["host"] = o.Host
}
if o.LastTested != nil {
toSerialize["last_tested_at"] = o.LastTested
}
if o.NextLocation != nil {
toSerialize["next_location"] = o.NextLocation
}
if true {
toSerialize["paused"] = o.Paused
}
if o.Port != nil {
toSerialize["port"] = o.Port
}
if o.PostBody != nil {
toSerialize["post_body"] = o.PostBody
}
if o.PostRaw != nil {
toSerialize["post_raw"] = o.PostRaw
}
if true {
toSerialize["processing"] = o.Processing
}
if o.ProcessingOn != nil {
toSerialize["processing_on"] = o.ProcessingOn
}
if o.ProcessingState != nil {
toSerialize["processing_state"] = o.ProcessingState
}
if true {
toSerialize["servers"] = o.Servers
}
if true {
toSerialize["status"] = o.Status
}
if true {
toSerialize["status_codes"] = o.StatusCodes
}
if true {
toSerialize["tags"] = o.Tags
}
if true {
toSerialize["timeout"] = o.Timeout
}
if true {
toSerialize["trigger_rate"] = o.TriggerRate
}
if true {
toSerialize["uptime"] = o.Uptime
}
if true {
toSerialize["use_jar"] = o.UseJAR
}
if o.UserAgent != nil {
toSerialize["user_agent"] = o.UserAgent
}
return json.Marshal(toSerialize)
}