cloudflare/cloudflare-typescript
Publicmirrored fromhttps://github.com/cloudflare/cloudflare-typescriptAvailable
src/resources/addressing/services.ts
50lines · modecode
| 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. |
| 2 | |
| 3 | import * as Core from 'cloudflare/core'; |
| 4 | import { APIResource } from 'cloudflare/resource'; |
| 5 | import * as ServicesAPI from 'cloudflare/resources/addressing/services'; |
| 6 | |
| 7 | export class Services extends APIResource { |
| 8 | /** |
| 9 | * Bring-Your-Own IP (BYOIP) prefixes onboarded to Cloudflare must be bound to a |
| 10 | * service running on the Cloudflare network to enable a Cloudflare product on the |
| 11 | * IP addresses. This endpoint can be used as a reference of available services on |
| 12 | * the Cloudflare network, and their service IDs. |
| 13 | */ |
| 14 | list(params: ServiceListParams, options?: Core.RequestOptions): Core.APIPromise<ServiceListResponse> { |
| 15 | const { account_id } = params; |
| 16 | return ( |
| 17 | this._client.get(`/accounts/${account_id}/addressing/services`, options) as Core.APIPromise<{ |
| 18 | result: ServiceListResponse; |
| 19 | }> |
| 20 | )._thenUnwrap((obj) => obj.result); |
| 21 | } |
| 22 | } |
| 23 | |
| 24 | export type ServiceListResponse = Array<ServiceListResponse.ServiceListResponseItem>; |
| 25 | |
| 26 | export namespace ServiceListResponse { |
| 27 | export interface ServiceListResponseItem { |
| 28 | /** |
| 29 | * Identifier |
| 30 | */ |
| 31 | id?: string; |
| 32 | |
| 33 | /** |
| 34 | * Name of a service running on the Cloudflare network |
| 35 | */ |
| 36 | name?: string; |
| 37 | } |
| 38 | } |
| 39 | |
| 40 | export interface ServiceListParams { |
| 41 | /** |
| 42 | * Identifier |
| 43 | */ |
| 44 | account_id: string; |
| 45 | } |
| 46 | |
| 47 | export namespace Services { |
| 48 | export import ServiceListResponse = ServicesAPI.ServiceListResponse; |
| 49 | export import ServiceListParams = ServicesAPI.ServiceListParams; |
| 50 | } |
| 51 | |