UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

117 lines • 4.26 kB
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from "../../core/resource.mjs"; import { buildHeaders } from "../../internal/headers.mjs"; import { path } from "../../internal/utils/path.mjs"; export var BaseCNIs = /* @__PURE__ */ (() => { class BaseCNIs extends APIResource { /** * Creates a new Cloud Network Interconnect (CNI) for private network connectivity * between Cloudflare and your infrastructure. CNIs enable dedicated, * high-performance network links. * * @example * ```ts * const cni = await client.networkInterconnects.cnis.create({ * account_id: 'account_id', * account: 'account', * interconnect: 'interconnect', * magic: { * conduit_name: 'conduit_name', * description: 'description', * mtu: 0, * }, * }); * ``` */ create(params, options) { const { account_id, ...body } = params; return this._client.post(path `/accounts/${account_id}/cni/cnis`, { body, ...options }); } /** * Updates the configuration of an existing Cloud Network Interconnect (CNI), * including connection parameters and routing settings. * * @example * ```ts * const cni = await client.networkInterconnects.cnis.update( * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', * { * account_id: 'account_id', * id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', * account: 'account', * cust_ip: '192.168.3.4/31', * interconnect: 'interconnect', * magic: { * conduit_name: 'conduit_name', * description: 'description', * mtu: 0, * }, * p2p_ip: '192.168.3.4/31', * }, * ); * ``` */ update(cni, params, options) { const { account_id, ...body } = params; return this._client.put(path `/accounts/${account_id}/cni/cnis/${cni}`, { body, ...options }); } /** * Lists all Cloud Network Interconnects (CNIs) configured for the account, showing * connection status and parameters. * * @example * ```ts * const cnis = await client.networkInterconnects.cnis.list({ * account_id: 'account_id', * }); * ``` */ list(params, options) { const { account_id, ...query } = params; return this._client.get(path `/accounts/${account_id}/cni/cnis`, { query, ...options }); } /** * Permanently removes a Cloud Network Interconnect (CNI) configuration. The * private network connection will be terminated. * * @example * ```ts * await client.networkInterconnects.cnis.delete( * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', * { account_id: 'account_id' }, * ); * ``` */ delete(cni, params, options) { const { account_id } = params; return this._client.delete(path `/accounts/${account_id}/cni/cnis/${cni}`, { ...options, headers: buildHeaders([{ Accept: '*/*' }, options?.headers]), }); } /** * Retrieves configuration details for a specific Cloud Network Interconnect (CNI), * including connection status and parameters. * * @example * ```ts * const cni = await client.networkInterconnects.cnis.get( * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', * { account_id: 'account_id' }, * ); * ``` */ get(cni, params, options) { const { account_id } = params; return this._client.get(path `/accounts/${account_id}/cni/cnis/${cni}`, options); } } BaseCNIs._key = Object.freeze([ 'networkInterconnects', 'cnis', ]); return BaseCNIs; })(); export class CNIs extends BaseCNIs { } //# sourceMappingURL=cnis.mjs.map