cloudflare
Version:
The official TypeScript library for the Cloudflare API
90 lines • 3.3 kB
JavaScript
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from "../../../core/resource.mjs";
import { path } from "../../../internal/utils/path.mjs";
export var BaseTracerouteTests = /* @__PURE__ */ (() => {
class BaseTracerouteTests extends 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(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(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(path `/accounts/${account_id}/dex/traceroute-tests/${testID}/percentiles`, {
query,
...options,
})._thenUnwrap((obj) => obj.result);
}
}
BaseTracerouteTests._key = Object.freeze([
'zeroTrust',
'dex',
'tracerouteTests',
]);
return BaseTracerouteTests;
})();
export class TracerouteTests extends BaseTracerouteTests {
}
//# sourceMappingURL=traceroute-tests.mjs.map