UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

122 lines • 4.5 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.CNIs = exports.BaseCNIs = void 0; // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. const resource_1 = require("../../core/resource.js"); const headers_1 = require("../../internal/headers.js"); const path_1 = require("../../internal/utils/path.js"); var BaseCNIs = /* @__PURE__ */ (() => { class BaseCNIs extends resource_1.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((0, path_1.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((0, path_1.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((0, path_1.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((0, path_1.path) `/accounts/${account_id}/cni/cnis/${cni}`, { ...options, headers: (0, headers_1.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((0, path_1.path) `/accounts/${account_id}/cni/cnis/${cni}`, options); } } BaseCNIs._key = Object.freeze([ 'networkInterconnects', 'cnis', ]); return BaseCNIs; })(); exports.BaseCNIs = BaseCNIs; class CNIs extends BaseCNIs { } exports.CNIs = CNIs; //# sourceMappingURL=cnis.js.map