UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

105 lines • 3.97 kB
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from "../../../../core/resource.mjs"; import { path } from "../../../../internal/utils/path.mjs"; export var BaseWARP = /* @__PURE__ */ (() => { class BaseWARP extends APIResource { /** * Create a WARP IP assignment subnet. Currently, only IPv4 subnets can be created. * * **Network constraints:** * * - The network must be within one of the following private IP ranges: * - `10.0.0.0/8` (RFC 1918) * - `172.16.0.0/12` (RFC 1918) * - `192.168.0.0/16` (RFC 1918) * - `100.64.0.0/10` (RFC 6598 - CGNAT) * - The subnet must have a prefix length of `/24` or larger (e.g., `/16`, `/20`, * `/24` are valid; `/25`, `/28` are not) * * @example * ```ts * const subnet = * await client.zeroTrust.networks.subnets.warp.create({ * account_id: '699d98642c564d2e855e9661899b7252', * name: 'IPv4 Cloudflare Source IPs', * network: '100.64.0.0/12', * }); * ``` */ create(params, options) { const { account_id, ...body } = params; return this._client.post(path `/accounts/${account_id}/zerotrust/subnets/warp`, { body, ...options, })._thenUnwrap((obj) => obj.result); } /** * Delete a WARP IP assignment subnet. This operation is idempotent - deleting an * already-deleted or non-existent subnet will return success with a null result. * * @example * ```ts * const warp = * await client.zeroTrust.networks.subnets.warp.delete( * 'f70ff985-a4ef-4643-bbbc-4a0ed4fc8415', * { account_id: '699d98642c564d2e855e9661899b7252' }, * ); * ``` */ delete(subnetID, params, options) { const { account_id } = params; return this._client.delete(path `/accounts/${account_id}/zerotrust/subnets/warp/${subnetID}`, options)._thenUnwrap((obj) => obj.result); } /** * Updates a WARP IP assignment subnet. * * **Update constraints:** * * - The `network` field cannot be modified for WARP subnets. Only `name`, * `comment`, and `is_default_network` can be updated. * - IPv6 subnets cannot be updated * * @example * ```ts * const subnet = * await client.zeroTrust.networks.subnets.warp.edit( * 'f70ff985-a4ef-4643-bbbc-4a0ed4fc8415', * { account_id: '699d98642c564d2e855e9661899b7252' }, * ); * ``` */ edit(subnetID, params, options) { const { account_id, ...body } = params; return this._client.patch(path `/accounts/${account_id}/zerotrust/subnets/warp/${subnetID}`, { body, ...options, })._thenUnwrap((obj) => obj.result); } /** * Get a WARP IP assignment subnet. * * @example * ```ts * const subnet = * await client.zeroTrust.networks.subnets.warp.get( * 'f70ff985-a4ef-4643-bbbc-4a0ed4fc8415', * { account_id: '699d98642c564d2e855e9661899b7252' }, * ); * ``` */ get(subnetID, params, options) { const { account_id } = params; return this._client.get(path `/accounts/${account_id}/zerotrust/subnets/warp/${subnetID}`, options)._thenUnwrap((obj) => obj.result); } } BaseWARP._key = Object.freeze([ 'zeroTrust', 'networks', 'subnets', 'warp', ]); return BaseWARP; })(); export class WARP extends BaseWARP { } //# sourceMappingURL=warp.mjs.map