cloudflare
Version:
The official TypeScript library for the Cloudflare API
124 lines • 4.53 kB
JavaScript
// 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 BaseInterconnects = /* @__PURE__ */ (() => {
class BaseInterconnects extends 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(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(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(path `/accounts/${account_id}/cni/interconnects/${icon}`, {
...options,
headers: 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(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(path `/accounts/${account_id}/cni/interconnects/${icon}/loa`, {
query,
...options,
headers: 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(path `/accounts/${account_id}/cni/interconnects/${icon}/status`, options);
}
}
BaseInterconnects._key = Object.freeze([
'networkInterconnects',
'interconnects',
]);
return BaseInterconnects;
})();
export class Interconnects extends BaseInterconnects {
}
//# sourceMappingURL=interconnects.mjs.map