cloudflare
Version:
The official TypeScript library for the Cloudflare API
130 lines (103 loc) • 3.1 kB
text/typescript
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from '../../../../core/resource';
import { APIPromise } from '../../../../core/api-promise';
import { RequestOptions } from '../../../../internal/request-options';
import { path } from '../../../../internal/utils/path';
export class BaseNetworkPath extends APIResource {
static override readonly _key: readonly ['zeroTrust', 'dex', 'tracerouteTestResults', 'networkPath'] =
Object.freeze(['zeroTrust', 'dex', 'tracerouteTestResults', 'networkPath'] as const);
/**
* Get a breakdown of hops and performance metrics for a specific traceroute test
* run
*
* @example
* ```ts
* const networkPath =
* await client.zeroTrust.dex.tracerouteTestResults.networkPath.get(
* 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415',
* { account_id: '01a7362d577a6c3019a474fd6f485823' },
* );
* ```
*/
get(
testResultID: string,
params: NetworkPathGetParams,
options?: RequestOptions,
): APIPromise<NetworkPathGetResponse> {
const { account_id } = params;
return (
this._client.get(
path`/accounts/${account_id}/dex/traceroute-test-results/${testResultID}/network-path`,
options,
) as APIPromise<{ result: NetworkPathGetResponse }>
)._thenUnwrap((obj) => obj.result);
}
}
export class NetworkPath extends BaseNetworkPath {}
export interface NetworkPathGetResponse {
/**
* An array of the hops taken by the device to reach the end destination.
*/
hops: Array<NetworkPathGetResponse.Hop>;
/**
* API Resource UUID tag.
*/
resultId: string;
/**
* Cloudflare colo airport code.
*/
colo?: string;
/**
* Name of the device associated with this network path response.
*/
deviceName?: string;
/**
* Whether the test was run inside or outside of the WARP tunnel.
*/
execution_context?: 'EXECUTION_CONTEXT_INVALID' | 'OUT_OF_TUNNEL' | 'IN_TUNNEL';
/**
* API Resource UUID tag.
*/
testId?: string;
/**
* Name of the traceroute test.
*/
testName?: string;
/**
* Timestamp indicating when the traceroute test execution began.
*/
time_start?: string;
tunnel_type?: string | null;
}
export namespace NetworkPathGetResponse {
export interface Hop {
ttl: number;
asn?: number | null;
aso?: string | null;
ipAddress?: string | null;
location?: Hop.Location | null;
mile?: 'client-to-app' | 'client-to-cf-egress' | 'client-to-cf-ingress' | 'client-to-isp' | null;
name?: string | null;
packetLossPct?: number | null;
rttMs?: number | null;
}
export namespace Hop {
export interface Location {
city?: string | null;
state?: string | null;
zip?: string | null;
}
}
}
export interface NetworkPathGetParams {
/**
* Unique Cloudflare account ID.
*/
account_id: string;
}
export declare namespace NetworkPath {
export {
type NetworkPathGetResponse as NetworkPathGetResponse,
type NetworkPathGetParams as NetworkPathGetParams,
};
}