UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

114 lines • 4.14 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.IPProfiles = exports.BaseIPProfiles = void 0; // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. const resource_1 = require("../../../core/resource.js"); const pagination_1 = require("../../../core/pagination.js"); const path_1 = require("../../../internal/utils/path.js"); var BaseIPProfiles = /* @__PURE__ */ (() => { class BaseIPProfiles extends resource_1.APIResource { /** * Creates a WARP Device IP profile. Currently, only IPv4 Device subnets can be * associated. * * @example * ```ts * const ipProfile = * await client.zeroTrust.devices.ipProfiles.create({ * account_id: 'account_id', * match: 'identity.email == "test@cloudflare.com"', * name: 'IPv4 Cloudflare Source IPs', * precedence: 100, * subnet_id: 'b70ff985-a4ef-4643-bbbc-4a0ed4fc8415', * }); * ``` */ create(params, options) { const { account_id, ...body } = params; return this._client.post((0, path_1.path) `/accounts/${account_id}/devices/ip-profiles`, { body, ...options, })._thenUnwrap((obj) => obj.result); } /** * Updates a WARP Device IP profile. Currently, only IPv4 Device subnets can be * associated. * * @example * ```ts * const ipProfile = * await client.zeroTrust.devices.ipProfiles.update( * 'profile_id', * { account_id: 'account_id' }, * ); * ``` */ update(profileID, params, options) { const { account_id, ...body } = params; return this._client.patch((0, path_1.path) `/accounts/${account_id}/devices/ip-profiles/${profileID}`, { body, ...options, })._thenUnwrap((obj) => obj.result); } /** * Lists WARP Device IP profiles. * * @example * ```ts * // Automatically fetches more pages as needed. * for await (const ipProfile of client.zeroTrust.devices.ipProfiles.list( * { account_id: 'account_id' }, * )) { * // ... * } * ``` */ list(params, options) { const { account_id, ...query } = params; return this._client.getAPIList((0, path_1.path) `/accounts/${account_id}/devices/ip-profiles`, (pagination_1.V4PagePaginationArray), { query, ...options }); } /** * Delete a WARP Device IP profile. * * @example * ```ts * const ipProfile = * await client.zeroTrust.devices.ipProfiles.delete( * 'profile_id', * { account_id: 'account_id' }, * ); * ``` */ delete(profileID, params, options) { const { account_id } = params; return this._client.delete((0, path_1.path) `/accounts/${account_id}/devices/ip-profiles/${profileID}`, options)._thenUnwrap((obj) => obj.result); } /** * Fetches a single WARP Device IP profile. * * @example * ```ts * const ipProfile = * await client.zeroTrust.devices.ipProfiles.get( * 'profile_id', * { account_id: 'account_id' }, * ); * ``` */ get(profileID, params, options) { const { account_id } = params; return this._client.get((0, path_1.path) `/accounts/${account_id}/devices/ip-profiles/${profileID}`, options)._thenUnwrap((obj) => obj.result); } } BaseIPProfiles._key = Object.freeze([ 'zeroTrust', 'devices', 'ipProfiles', ]); return BaseIPProfiles; })(); exports.BaseIPProfiles = BaseIPProfiles; class IPProfiles extends BaseIPProfiles { } exports.IPProfiles = IPProfiles; //# sourceMappingURL=ip-profiles.js.map