UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

129 lines • 4.85 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Interconnects = exports.BaseInterconnects = 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 BaseInterconnects = /* @__PURE__ */ (() => { class BaseInterconnects extends resource_1.APIResource { /** * Creates a new network interconnect for connecting Cloudflare's network to * external networks. Interconnects provide dedicated bandwidth and reduced latency * for traffic exchange. * * @example * ```ts * const interconnect = * await client.networkInterconnects.interconnects.create({ * account_id: 'account_id', * account: 'account', * slot_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', * type: 'type', * }); * ``` */ create(params, options) { const { account_id, ...body } = params; return this._client.post((0, path_1.path) `/accounts/${account_id}/cni/interconnects`, { body, ...options }); } /** * Lists all network interconnects configured for the account, including physical * and virtual connections. * * @example * ```ts * const interconnects = * await client.networkInterconnects.interconnects.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/interconnects`, { query, ...options }); } /** * Permanently removes a network interconnect configuration. The physical or * virtual connection will be terminated. * * @example * ```ts * await client.networkInterconnects.interconnects.delete( * 'icon', * { account_id: 'account_id' }, * ); * ``` */ delete(icon, params, options) { const { account_id } = params; return this._client.delete((0, path_1.path) `/accounts/${account_id}/cni/interconnects/${icon}`, { ...options, headers: (0, headers_1.buildHeaders)([{ Accept: '*/*' }, options?.headers]), }); } /** * Retrieves configuration and status details for a specific network interconnect. * * @example * ```ts * const interconnect = * await client.networkInterconnects.interconnects.get( * 'icon', * { account_id: 'account_id' }, * ); * ``` */ get(icon, params, options) { const { account_id } = params; return this._client.get((0, path_1.path) `/accounts/${account_id}/cni/interconnects/${icon}`, options); } /** * Downloads the Letter of Authorization (LOA) for a network interconnect, required * for physical cross-connect provisioning. * * @example * ```ts * await client.networkInterconnects.interconnects.loa( * 'icon', * { account_id: 'account_id' }, * ); * ``` */ loa(icon, params, options) { const { account_id, ...query } = params; return this._client.get((0, path_1.path) `/accounts/${account_id}/cni/interconnects/${icon}/loa`, { query, ...options, headers: (0, headers_1.buildHeaders)([{ Accept: '*/*' }, options?.headers]), }); } /** * Gets the current operational status of a network interconnect, including link * state and traffic metrics. * * @example * ```ts * const response = * await client.networkInterconnects.interconnects.status( * 'icon', * { account_id: 'account_id' }, * ); * ``` */ status(icon, params, options) { const { account_id } = params; return this._client.get((0, path_1.path) `/accounts/${account_id}/cni/interconnects/${icon}/status`, options); } } BaseInterconnects._key = Object.freeze([ 'networkInterconnects', 'interconnects', ]); return BaseInterconnects; })(); exports.BaseInterconnects = BaseInterconnects; class Interconnects extends BaseInterconnects { } exports.Interconnects = Interconnects; //# sourceMappingURL=interconnects.js.map