cloudflare/cloudflare-typescript
Publicmirrored fromhttps://github.com/cloudflare/cloudflare-typescriptAvailable
src/resources/dex/colos.ts
52lines · 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 ColosAPI from 'cloudflare/resources/dex/colos'; |
| 6 | |
| 7 | export class Colos extends APIResource { |
| 8 | /** |
| 9 | * List Cloudflare colos that account's devices were connected to during a time |
| 10 | * period, sorted by usage starting from the most used colo. Colos without traffic |
| 11 | * are also returned and sorted alphabetically. |
| 12 | */ |
| 13 | list( |
| 14 | accountId: string, |
| 15 | query: ColoListParams, |
| 16 | options?: Core.RequestOptions, |
| 17 | ): Core.APIPromise<ColoListResponse | null> { |
| 18 | return ( |
| 19 | this._client.get(`/accounts/${accountId}/dex/colos`, { query, ...options }) as Core.APIPromise<{ |
| 20 | result: ColoListResponse | null; |
| 21 | }> |
| 22 | )._thenUnwrap((obj) => obj.result); |
| 23 | } |
| 24 | } |
| 25 | |
| 26 | /** |
| 27 | * array of colos. |
| 28 | */ |
| 29 | export type ColoListResponse = Array<unknown>; |
| 30 | |
| 31 | export interface ColoListParams { |
| 32 | /** |
| 33 | * End time for connection period in RFC3339 (ISO 8601) format. |
| 34 | */ |
| 35 | timeEnd: string; |
| 36 | |
| 37 | /** |
| 38 | * Start time for connection period in RFC3339 (ISO 8601) format. |
| 39 | */ |
| 40 | timeStart: string; |
| 41 | |
| 42 | /** |
| 43 | * Type of usage that colos should be sorted by. If unspecified, returns all |
| 44 | * Cloudflare colos sorted alphabetically. |
| 45 | */ |
| 46 | sortBy?: 'fleet-status-usage' | 'application-tests-usage'; |
| 47 | } |
| 48 | |
| 49 | export namespace Colos { |
| 50 | export import ColoListResponse = ColosAPI.ColoListResponse; |
| 51 | export import ColoListParams = ColosAPI.ColoListParams; |
| 52 | } |
| 53 | |