cloudflare/cloudflare-typescript
Publicmirrored fromhttps://github.com/cloudflare/cloudflare-typescriptAvailable
src/resources/dex/traceroute-tests.ts
577lines · modecode
| 1 | // File generated from our OpenAPI spec by Stainless. |
| 2 | |
| 3 | import * as Core from 'cloudflare/core'; |
| 4 | import { APIResource } from 'cloudflare/resource'; |
| 5 | import * as TracerouteTestsAPI from 'cloudflare/resources/dex/traceroute-tests'; |
| 6 | |
| 7 | export class TracerouteTests extends APIResource { |
| 8 | /** |
| 9 | * Get test details and aggregate performance metrics for an traceroute test for a |
| 10 | * given time period between 1 hour and 7 days. |
| 11 | */ |
| 12 | retrieve( |
| 13 | accountId: string, |
| 14 | testId: string, |
| 15 | query: TracerouteTestRetrieveParams, |
| 16 | options?: Core.RequestOptions, |
| 17 | ): Core.APIPromise<TracerouteTestRetrieveResponse> { |
| 18 | return ( |
| 19 | this._client.get(`/accounts/${accountId}/dex/traceroute-tests/${testId}`, { |
| 20 | query, |
| 21 | ...options, |
| 22 | }) as Core.APIPromise<{ result: TracerouteTestRetrieveResponse }> |
| 23 | )._thenUnwrap((obj) => obj.result); |
| 24 | } |
| 25 | |
| 26 | /** |
| 27 | * Get a breakdown of metrics by hop for individual traceroute test runs |
| 28 | */ |
| 29 | networkPath( |
| 30 | accountId: string, |
| 31 | testId: string, |
| 32 | query: TracerouteTestNetworkPathParams, |
| 33 | options?: Core.RequestOptions, |
| 34 | ): Core.APIPromise<TracerouteTestNetworkPathResponse> { |
| 35 | return ( |
| 36 | this._client.get(`/accounts/${accountId}/dex/traceroute-tests/${testId}/network-path`, { |
| 37 | query, |
| 38 | ...options, |
| 39 | }) as Core.APIPromise<{ result: TracerouteTestNetworkPathResponse }> |
| 40 | )._thenUnwrap((obj) => obj.result); |
| 41 | } |
| 42 | |
| 43 | /** |
| 44 | * Get percentiles for a traceroute test for a given time period between 1 hour and |
| 45 | * 7 days. |
| 46 | */ |
| 47 | percentiles( |
| 48 | accountId: string, |
| 49 | testId: string, |
| 50 | query: TracerouteTestPercentilesParams, |
| 51 | options?: Core.RequestOptions, |
| 52 | ): Core.APIPromise<TracerouteTestPercentilesResponse> { |
| 53 | return ( |
| 54 | this._client.get(`/accounts/${accountId}/dex/traceroute-tests/${testId}/percentiles`, { |
| 55 | query, |
| 56 | ...options, |
| 57 | }) as Core.APIPromise<{ result: TracerouteTestPercentilesResponse }> |
| 58 | )._thenUnwrap((obj) => obj.result); |
| 59 | } |
| 60 | } |
| 61 | |
| 62 | export interface TracerouteTestRetrieveResponse { |
| 63 | /** |
| 64 | * The host of the Traceroute synthetic application test |
| 65 | */ |
| 66 | host: string; |
| 67 | |
| 68 | /** |
| 69 | * The interval at which the Traceroute synthetic application test is set to run. |
| 70 | */ |
| 71 | interval: string; |
| 72 | |
| 73 | kind: 'traceroute'; |
| 74 | |
| 75 | /** |
| 76 | * The name of the Traceroute synthetic application test |
| 77 | */ |
| 78 | name: string; |
| 79 | |
| 80 | tracerouteStats?: TracerouteTestRetrieveResponse.TracerouteStats | null; |
| 81 | |
| 82 | tracerouteStatsByColo?: Array<TracerouteTestRetrieveResponse.TracerouteStatsByColo>; |
| 83 | } |
| 84 | |
| 85 | export namespace TracerouteTestRetrieveResponse { |
| 86 | export interface TracerouteStats { |
| 87 | availabilityPct: TracerouteStats.AvailabilityPct; |
| 88 | |
| 89 | hopsCount: TracerouteStats.HopsCount; |
| 90 | |
| 91 | packetLossPct: TracerouteStats.PacketLossPct; |
| 92 | |
| 93 | roundTripTimeMs: TracerouteStats.RoundTripTimeMs; |
| 94 | |
| 95 | /** |
| 96 | * Count of unique devices that have run this test in the given time period |
| 97 | */ |
| 98 | uniqueDevicesTotal: number; |
| 99 | } |
| 100 | |
| 101 | export namespace TracerouteStats { |
| 102 | export interface AvailabilityPct { |
| 103 | slots: Array<AvailabilityPct.Slot>; |
| 104 | |
| 105 | /** |
| 106 | * average observed in the time period |
| 107 | */ |
| 108 | avg?: number | null; |
| 109 | |
| 110 | /** |
| 111 | * highest observed in the time period |
| 112 | */ |
| 113 | max?: number | null; |
| 114 | |
| 115 | /** |
| 116 | * lowest observed in the time period |
| 117 | */ |
| 118 | min?: number | null; |
| 119 | } |
| 120 | |
| 121 | export namespace AvailabilityPct { |
| 122 | export interface Slot { |
| 123 | timestamp: string; |
| 124 | |
| 125 | value: number; |
| 126 | } |
| 127 | } |
| 128 | |
| 129 | export interface HopsCount { |
| 130 | slots: Array<HopsCount.Slot>; |
| 131 | |
| 132 | /** |
| 133 | * average observed in the time period |
| 134 | */ |
| 135 | avg?: number | null; |
| 136 | |
| 137 | /** |
| 138 | * highest observed in the time period |
| 139 | */ |
| 140 | max?: number | null; |
| 141 | |
| 142 | /** |
| 143 | * lowest observed in the time period |
| 144 | */ |
| 145 | min?: number | null; |
| 146 | } |
| 147 | |
| 148 | export namespace HopsCount { |
| 149 | export interface Slot { |
| 150 | timestamp: string; |
| 151 | |
| 152 | value: number; |
| 153 | } |
| 154 | } |
| 155 | |
| 156 | export interface PacketLossPct { |
| 157 | slots: Array<PacketLossPct.Slot>; |
| 158 | |
| 159 | /** |
| 160 | * average observed in the time period |
| 161 | */ |
| 162 | avg?: number | null; |
| 163 | |
| 164 | /** |
| 165 | * highest observed in the time period |
| 166 | */ |
| 167 | max?: number | null; |
| 168 | |
| 169 | /** |
| 170 | * lowest observed in the time period |
| 171 | */ |
| 172 | min?: number | null; |
| 173 | } |
| 174 | |
| 175 | export namespace PacketLossPct { |
| 176 | export interface Slot { |
| 177 | timestamp: string; |
| 178 | |
| 179 | value: number; |
| 180 | } |
| 181 | } |
| 182 | |
| 183 | export interface RoundTripTimeMs { |
| 184 | slots: Array<RoundTripTimeMs.Slot>; |
| 185 | |
| 186 | /** |
| 187 | * average observed in the time period |
| 188 | */ |
| 189 | avg?: number | null; |
| 190 | |
| 191 | /** |
| 192 | * highest observed in the time period |
| 193 | */ |
| 194 | max?: number | null; |
| 195 | |
| 196 | /** |
| 197 | * lowest observed in the time period |
| 198 | */ |
| 199 | min?: number | null; |
| 200 | } |
| 201 | |
| 202 | export namespace RoundTripTimeMs { |
| 203 | export interface Slot { |
| 204 | timestamp: string; |
| 205 | |
| 206 | value: number; |
| 207 | } |
| 208 | } |
| 209 | } |
| 210 | |
| 211 | export interface TracerouteStatsByColo { |
| 212 | availabilityPct: TracerouteStatsByColo.AvailabilityPct; |
| 213 | |
| 214 | colo: string; |
| 215 | |
| 216 | hopsCount: TracerouteStatsByColo.HopsCount; |
| 217 | |
| 218 | packetLossPct: TracerouteStatsByColo.PacketLossPct; |
| 219 | |
| 220 | roundTripTimeMs: TracerouteStatsByColo.RoundTripTimeMs; |
| 221 | |
| 222 | /** |
| 223 | * Count of unique devices that have run this test in the given time period |
| 224 | */ |
| 225 | uniqueDevicesTotal: number; |
| 226 | } |
| 227 | |
| 228 | export namespace TracerouteStatsByColo { |
| 229 | export interface AvailabilityPct { |
| 230 | slots: Array<AvailabilityPct.Slot>; |
| 231 | |
| 232 | /** |
| 233 | * average observed in the time period |
| 234 | */ |
| 235 | avg?: number | null; |
| 236 | |
| 237 | /** |
| 238 | * highest observed in the time period |
| 239 | */ |
| 240 | max?: number | null; |
| 241 | |
| 242 | /** |
| 243 | * lowest observed in the time period |
| 244 | */ |
| 245 | min?: number | null; |
| 246 | } |
| 247 | |
| 248 | export namespace AvailabilityPct { |
| 249 | export interface Slot { |
| 250 | timestamp: string; |
| 251 | |
| 252 | value: number; |
| 253 | } |
| 254 | } |
| 255 | |
| 256 | export interface HopsCount { |
| 257 | slots: Array<HopsCount.Slot>; |
| 258 | |
| 259 | /** |
| 260 | * average observed in the time period |
| 261 | */ |
| 262 | avg?: number | null; |
| 263 | |
| 264 | /** |
| 265 | * highest observed in the time period |
| 266 | */ |
| 267 | max?: number | null; |
| 268 | |
| 269 | /** |
| 270 | * lowest observed in the time period |
| 271 | */ |
| 272 | min?: number | null; |
| 273 | } |
| 274 | |
| 275 | export namespace HopsCount { |
| 276 | export interface Slot { |
| 277 | timestamp: string; |
| 278 | |
| 279 | value: number; |
| 280 | } |
| 281 | } |
| 282 | |
| 283 | export interface PacketLossPct { |
| 284 | slots: Array<PacketLossPct.Slot>; |
| 285 | |
| 286 | /** |
| 287 | * average observed in the time period |
| 288 | */ |
| 289 | avg?: number | null; |
| 290 | |
| 291 | /** |
| 292 | * highest observed in the time period |
| 293 | */ |
| 294 | max?: number | null; |
| 295 | |
| 296 | /** |
| 297 | * lowest observed in the time period |
| 298 | */ |
| 299 | min?: number | null; |
| 300 | } |
| 301 | |
| 302 | export namespace PacketLossPct { |
| 303 | export interface Slot { |
| 304 | timestamp: string; |
| 305 | |
| 306 | value: number; |
| 307 | } |
| 308 | } |
| 309 | |
| 310 | export interface RoundTripTimeMs { |
| 311 | slots: Array<RoundTripTimeMs.Slot>; |
| 312 | |
| 313 | /** |
| 314 | * average observed in the time period |
| 315 | */ |
| 316 | avg?: number | null; |
| 317 | |
| 318 | /** |
| 319 | * highest observed in the time period |
| 320 | */ |
| 321 | max?: number | null; |
| 322 | |
| 323 | /** |
| 324 | * lowest observed in the time period |
| 325 | */ |
| 326 | min?: number | null; |
| 327 | } |
| 328 | |
| 329 | export namespace RoundTripTimeMs { |
| 330 | export interface Slot { |
| 331 | timestamp: string; |
| 332 | |
| 333 | value: number; |
| 334 | } |
| 335 | } |
| 336 | } |
| 337 | } |
| 338 | |
| 339 | export interface TracerouteTestNetworkPathResponse { |
| 340 | /** |
| 341 | * API Resource UUID tag. |
| 342 | */ |
| 343 | id: string; |
| 344 | |
| 345 | deviceName?: string; |
| 346 | |
| 347 | /** |
| 348 | * The interval at which the Traceroute synthetic application test is set to run. |
| 349 | */ |
| 350 | interval?: string; |
| 351 | |
| 352 | kind?: 'traceroute'; |
| 353 | |
| 354 | name?: string; |
| 355 | |
| 356 | networkPath?: TracerouteTestNetworkPathResponse.NetworkPath | null; |
| 357 | |
| 358 | /** |
| 359 | * The host of the Traceroute synthetic application test |
| 360 | */ |
| 361 | url?: string; |
| 362 | } |
| 363 | |
| 364 | export namespace TracerouteTestNetworkPathResponse { |
| 365 | export interface NetworkPath { |
| 366 | slots: Array<NetworkPath.Slot>; |
| 367 | |
| 368 | /** |
| 369 | * Specifies the sampling applied, if any, to the slots response. When sampled, |
| 370 | * results shown represent the first test run to the start of each sampling |
| 371 | * interval. |
| 372 | */ |
| 373 | sampling?: NetworkPath.Sampling | null; |
| 374 | } |
| 375 | |
| 376 | export namespace NetworkPath { |
| 377 | export interface Slot { |
| 378 | /** |
| 379 | * API Resource UUID tag. |
| 380 | */ |
| 381 | id: string; |
| 382 | |
| 383 | /** |
| 384 | * Round trip time in ms of the client to app mile |
| 385 | */ |
| 386 | clientToAppRttMs: number | null; |
| 387 | |
| 388 | /** |
| 389 | * Round trip time in ms of the client to Cloudflare egress mile |
| 390 | */ |
| 391 | clientToCfEgressRttMs: number | null; |
| 392 | |
| 393 | /** |
| 394 | * Round trip time in ms of the client to Cloudflare ingress mile |
| 395 | */ |
| 396 | clientToCfIngressRttMs: number | null; |
| 397 | |
| 398 | timestamp: string; |
| 399 | |
| 400 | /** |
| 401 | * Round trip time in ms of the client to ISP mile |
| 402 | */ |
| 403 | clientToIspRttMs?: number | null; |
| 404 | } |
| 405 | |
| 406 | /** |
| 407 | * Specifies the sampling applied, if any, to the slots response. When sampled, |
| 408 | * results shown represent the first test run to the start of each sampling |
| 409 | * interval. |
| 410 | */ |
| 411 | export interface Sampling { |
| 412 | unit: 'hours'; |
| 413 | |
| 414 | value: number; |
| 415 | } |
| 416 | } |
| 417 | } |
| 418 | |
| 419 | export interface TracerouteTestPercentilesResponse { |
| 420 | hopsCount?: TracerouteTestPercentilesResponse.HopsCount; |
| 421 | |
| 422 | packetLossPct?: TracerouteTestPercentilesResponse.PacketLossPct; |
| 423 | |
| 424 | roundTripTimeMs?: TracerouteTestPercentilesResponse.RoundTripTimeMs; |
| 425 | } |
| 426 | |
| 427 | export namespace TracerouteTestPercentilesResponse { |
| 428 | export interface HopsCount { |
| 429 | /** |
| 430 | * p50 observed in the time period |
| 431 | */ |
| 432 | p50?: number | null; |
| 433 | |
| 434 | /** |
| 435 | * p90 observed in the time period |
| 436 | */ |
| 437 | p90?: number | null; |
| 438 | |
| 439 | /** |
| 440 | * p95 observed in the time period |
| 441 | */ |
| 442 | p95?: number | null; |
| 443 | |
| 444 | /** |
| 445 | * p99 observed in the time period |
| 446 | */ |
| 447 | p99?: number | null; |
| 448 | } |
| 449 | |
| 450 | export interface PacketLossPct { |
| 451 | /** |
| 452 | * p50 observed in the time period |
| 453 | */ |
| 454 | p50?: number | null; |
| 455 | |
| 456 | /** |
| 457 | * p90 observed in the time period |
| 458 | */ |
| 459 | p90?: number | null; |
| 460 | |
| 461 | /** |
| 462 | * p95 observed in the time period |
| 463 | */ |
| 464 | p95?: number | null; |
| 465 | |
| 466 | /** |
| 467 | * p99 observed in the time period |
| 468 | */ |
| 469 | p99?: number | null; |
| 470 | } |
| 471 | |
| 472 | export interface RoundTripTimeMs { |
| 473 | /** |
| 474 | * p50 observed in the time period |
| 475 | */ |
| 476 | p50?: number | null; |
| 477 | |
| 478 | /** |
| 479 | * p90 observed in the time period |
| 480 | */ |
| 481 | p90?: number | null; |
| 482 | |
| 483 | /** |
| 484 | * p95 observed in the time period |
| 485 | */ |
| 486 | p95?: number | null; |
| 487 | |
| 488 | /** |
| 489 | * p99 observed in the time period |
| 490 | */ |
| 491 | p99?: number | null; |
| 492 | } |
| 493 | } |
| 494 | |
| 495 | export interface TracerouteTestRetrieveParams { |
| 496 | /** |
| 497 | * Time interval for aggregate time slots. |
| 498 | */ |
| 499 | interval: 'minute' | 'hour'; |
| 500 | |
| 501 | /** |
| 502 | * End time for aggregate metrics in ISO ms |
| 503 | */ |
| 504 | timeEnd: string; |
| 505 | |
| 506 | /** |
| 507 | * Start time for aggregate metrics in ISO ms |
| 508 | */ |
| 509 | timeStart: string; |
| 510 | |
| 511 | /** |
| 512 | * Optionally filter result stats to a Cloudflare colo. Cannot be used in |
| 513 | * combination with deviceId param. |
| 514 | */ |
| 515 | colo?: string; |
| 516 | |
| 517 | /** |
| 518 | * Optionally filter result stats to a specific device(s). Cannot be used in |
| 519 | * combination with colo param. |
| 520 | */ |
| 521 | deviceId?: Array<string>; |
| 522 | } |
| 523 | |
| 524 | export interface TracerouteTestNetworkPathParams { |
| 525 | /** |
| 526 | * Device to filter tracroute result runs to |
| 527 | */ |
| 528 | deviceId: string; |
| 529 | |
| 530 | /** |
| 531 | * Time interval for aggregate time slots. |
| 532 | */ |
| 533 | interval: 'minute' | 'hour'; |
| 534 | |
| 535 | /** |
| 536 | * End time for aggregate metrics in ISO ms |
| 537 | */ |
| 538 | timeEnd: string; |
| 539 | |
| 540 | /** |
| 541 | * Start time for aggregate metrics in ISO ms |
| 542 | */ |
| 543 | timeStart: string; |
| 544 | } |
| 545 | |
| 546 | export interface TracerouteTestPercentilesParams { |
| 547 | /** |
| 548 | * End time for aggregate metrics in ISO format |
| 549 | */ |
| 550 | timeEnd: string; |
| 551 | |
| 552 | /** |
| 553 | * Start time for aggregate metrics in ISO format |
| 554 | */ |
| 555 | timeStart: string; |
| 556 | |
| 557 | /** |
| 558 | * Optionally filter result stats to a Cloudflare colo. Cannot be used in |
| 559 | * combination with deviceId param. |
| 560 | */ |
| 561 | colo?: string; |
| 562 | |
| 563 | /** |
| 564 | * Optionally filter result stats to a specific device(s). Cannot be used in |
| 565 | * combination with colo param. |
| 566 | */ |
| 567 | deviceId?: Array<string>; |
| 568 | } |
| 569 | |
| 570 | export namespace TracerouteTests { |
| 571 | export import TracerouteTestRetrieveResponse = TracerouteTestsAPI.TracerouteTestRetrieveResponse; |
| 572 | export import TracerouteTestNetworkPathResponse = TracerouteTestsAPI.TracerouteTestNetworkPathResponse; |
| 573 | export import TracerouteTestPercentilesResponse = TracerouteTestsAPI.TracerouteTestPercentilesResponse; |
| 574 | export import TracerouteTestRetrieveParams = TracerouteTestsAPI.TracerouteTestRetrieveParams; |
| 575 | export import TracerouteTestNetworkPathParams = TracerouteTestsAPI.TracerouteTestNetworkPathParams; |
| 576 | export import TracerouteTestPercentilesParams = TracerouteTestsAPI.TracerouteTestPercentilesParams; |
| 577 | } |
| 578 | |