UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

110 lines • 4.18 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.WARP = exports.BaseWARP = void 0; // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. const resource_1 = require("../../../../core/resource.js"); const path_1 = require("../../../../internal/utils/path.js"); var BaseWARP = /* @__PURE__ */ (() => { class BaseWARP extends resource_1.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((0, path_1.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((0, path_1.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((0, path_1.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((0, path_1.path) `/accounts/${account_id}/zerotrust/subnets/warp/${subnetID}`, options)._thenUnwrap((obj) => obj.result); } } BaseWARP._key = Object.freeze([ 'zeroTrust', 'networks', 'subnets', 'warp', ]); return BaseWARP; })(); exports.BaseWARP = BaseWARP; class WARP extends BaseWARP { } exports.WARP = WARP; //# sourceMappingURL=warp.js.map