-
Notifications
You must be signed in to change notification settings - Fork 541
/
dex.go
243 lines (209 loc) · 7.42 KB
/
dex.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
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
package zero_trust
import (
"github.com/cloudflare/cloudflare-go/v2/internal/apijson"
"github.com/cloudflare/cloudflare-go/v2/option"
)
// DEXService contains methods and other services that help with interacting with
// the cloudflare API. Note, unlike clients, this service does not read variables
// from the environment automatically. You should not instantiate this service
// directly, and instead use the [NewDEXService] method instead.
type DEXService struct {
Options []option.RequestOption
Colos *DEXColoService
FleetStatus *DEXFleetStatusService
HTTPTests *DEXHTTPTestService
Tests *DEXTestService
TracerouteTestResults *DEXTracerouteTestResultService
TracerouteTests *DEXTracerouteTestService
}
// NewDEXService generates a new service that applies the given options to each
// request. These options are applied after the parent client's options (if there
// is one), and before any request-specific options.
func NewDEXService(opts ...option.RequestOption) (r *DEXService) {
r = &DEXService{}
r.Options = opts
r.Colos = NewDEXColoService(opts...)
r.FleetStatus = NewDEXFleetStatusService(opts...)
r.HTTPTests = NewDEXHTTPTestService(opts...)
r.Tests = NewDEXTestService(opts...)
r.TracerouteTestResults = NewDEXTracerouteTestResultService(opts...)
r.TracerouteTests = NewDEXTracerouteTestService(opts...)
return
}
type DeviceExperienceMonitor struct {
ID string `json:"id,required"`
// Whether the policy is the default for the account
Default bool `json:"default,required"`
Name string `json:"name,required"`
JSON deviceExperienceMonitorJSON `json:"-"`
}
// deviceExperienceMonitorJSON contains the JSON metadata for the struct
// [DeviceExperienceMonitor]
type deviceExperienceMonitorJSON struct {
ID apijson.Field
Default apijson.Field
Name apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *DeviceExperienceMonitor) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r deviceExperienceMonitorJSON) RawJSON() string {
return r.raw
}
type NetworkPath struct {
Slots []NetworkPathSlot `json:"slots,required"`
// Specifies the sampling applied, if any, to the slots response. When sampled,
// results shown represent the first test run to the start of each sampling
// interval.
Sampling NetworkPathSampling `json:"sampling,nullable"`
JSON networkPathJSON `json:"-"`
}
// networkPathJSON contains the JSON metadata for the struct [NetworkPath]
type networkPathJSON struct {
Slots apijson.Field
Sampling apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *NetworkPath) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r networkPathJSON) RawJSON() string {
return r.raw
}
type NetworkPathSlot struct {
// API Resource UUID tag.
ID string `json:"id,required"`
// Round trip time in ms of the client to app mile
ClientToAppRTTMs int64 `json:"clientToAppRttMs,required,nullable"`
// Round trip time in ms of the client to Cloudflare egress mile
ClientToCfEgressRTTMs int64 `json:"clientToCfEgressRttMs,required,nullable"`
// Round trip time in ms of the client to Cloudflare ingress mile
ClientToCfIngressRTTMs int64 `json:"clientToCfIngressRttMs,required,nullable"`
Timestamp string `json:"timestamp,required"`
// Round trip time in ms of the client to ISP mile
ClientToISPRTTMs int64 `json:"clientToIspRttMs,nullable"`
JSON networkPathSlotJSON `json:"-"`
}
// networkPathSlotJSON contains the JSON metadata for the struct [NetworkPathSlot]
type networkPathSlotJSON struct {
ID apijson.Field
ClientToAppRTTMs apijson.Field
ClientToCfEgressRTTMs apijson.Field
ClientToCfIngressRTTMs apijson.Field
Timestamp apijson.Field
ClientToISPRTTMs apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *NetworkPathSlot) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r networkPathSlotJSON) RawJSON() string {
return r.raw
}
// Specifies the sampling applied, if any, to the slots response. When sampled,
// results shown represent the first test run to the start of each sampling
// interval.
type NetworkPathSampling struct {
Unit NetworkPathSamplingUnit `json:"unit,required"`
Value int64 `json:"value,required"`
JSON networkPathSamplingJSON `json:"-"`
}
// networkPathSamplingJSON contains the JSON metadata for the struct
// [NetworkPathSampling]
type networkPathSamplingJSON struct {
Unit apijson.Field
Value apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *NetworkPathSampling) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r networkPathSamplingJSON) RawJSON() string {
return r.raw
}
type NetworkPathSamplingUnit string
const (
NetworkPathSamplingUnitHours NetworkPathSamplingUnit = "hours"
)
func (r NetworkPathSamplingUnit) IsKnown() bool {
switch r {
case NetworkPathSamplingUnitHours:
return true
}
return false
}
type NetworkPathResponse struct {
// API Resource UUID tag.
ID string `json:"id,required"`
DeviceName string `json:"deviceName"`
// The interval at which the Traceroute synthetic application test is set to run.
Interval string `json:"interval"`
Kind NetworkPathResponseKind `json:"kind"`
Name string `json:"name"`
NetworkPath NetworkPath `json:"networkPath,nullable"`
// The host of the Traceroute synthetic application test
URL string `json:"url"`
JSON networkPathResponseJSON `json:"-"`
}
// networkPathResponseJSON contains the JSON metadata for the struct
// [NetworkPathResponse]
type networkPathResponseJSON struct {
ID apijson.Field
DeviceName apijson.Field
Interval apijson.Field
Kind apijson.Field
Name apijson.Field
NetworkPath apijson.Field
URL apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *NetworkPathResponse) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r networkPathResponseJSON) RawJSON() string {
return r.raw
}
type NetworkPathResponseKind string
const (
NetworkPathResponseKindTraceroute NetworkPathResponseKind = "traceroute"
)
func (r NetworkPathResponseKind) IsKnown() bool {
switch r {
case NetworkPathResponseKindTraceroute:
return true
}
return false
}
type Percentiles struct {
// p50 observed in the time period
P50 float64 `json:"p50,nullable"`
// p90 observed in the time period
P90 float64 `json:"p90,nullable"`
// p95 observed in the time period
P95 float64 `json:"p95,nullable"`
// p99 observed in the time period
P99 float64 `json:"p99,nullable"`
JSON percentilesJSON `json:"-"`
}
// percentilesJSON contains the JSON metadata for the struct [Percentiles]
type percentilesJSON struct {
P50 apijson.Field
P90 apijson.Field
P95 apijson.Field
P99 apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *Percentiles) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r percentilesJSON) RawJSON() string {
return r.raw
}