UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

95 lines • 3.57 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.TracerouteTests = exports.BaseTracerouteTests = void 0; // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. const resource_1 = require("../../../core/resource.js"); const path_1 = require("../../../internal/utils/path.js"); var BaseTracerouteTests = /* @__PURE__ */ (() => { class BaseTracerouteTests extends resource_1.APIResource { /** * Get test details and aggregate performance metrics for a traceroute test for a * given time period between 1 hour and 7 days. * * @example * ```ts * const traceroute = * await client.zeroTrust.dex.tracerouteTests.get( * 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', * { * account_id: '01a7362d577a6c3019a474fd6f485823', * from: '1689520412000', * interval: 'minute', * to: '1689606812000', * }, * ); * ``` */ get(testID, params, options) { const { account_id, ...query } = params; return this._client.get((0, path_1.path) `/accounts/${account_id}/dex/traceroute-tests/${testID}`, { query, ...options, })._thenUnwrap((obj) => obj.result); } /** * Get a breakdown of metrics by hop for individual traceroute test runs. * * @example * ```ts * const networkPathResponse = * await client.zeroTrust.dex.tracerouteTests.networkPath( * 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', * { * account_id: '01a7362d577a6c3019a474fd6f485823', * deviceId: 'deviceId', * from: '1689520412000', * interval: 'minute', * to: '1689606812000', * }, * ); * ``` */ networkPath(testID, params, options) { const { account_id, ...query } = params; return this._client.get((0, path_1.path) `/accounts/${account_id}/dex/traceroute-tests/${testID}/network-path`, { query, ...options, })._thenUnwrap((obj) => obj.result); } /** * Get percentiles for a traceroute test for a given time period between 1 hour and * 7 days. * * @example * ```ts * const response = * await client.zeroTrust.dex.tracerouteTests.percentiles( * 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', * { * account_id: '01a7362d577a6c3019a474fd6f485823', * from: '2023-09-20T17:00:00Z', * to: '2023-09-20T17:00:00Z', * }, * ); * ``` */ percentiles(testID, params, options) { const { account_id, ...query } = params; return this._client.get((0, path_1.path) `/accounts/${account_id}/dex/traceroute-tests/${testID}/percentiles`, { query, ...options, })._thenUnwrap((obj) => obj.result); } } BaseTracerouteTests._key = Object.freeze([ 'zeroTrust', 'dex', 'tracerouteTests', ]); return BaseTracerouteTests; })(); exports.BaseTracerouteTests = BaseTracerouteTests; class TracerouteTests extends BaseTracerouteTests { } exports.TracerouteTests = TracerouteTests; //# sourceMappingURL=traceroute-tests.js.map