UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

109 lines • 4.23 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ProxyEndpoints = exports.BaseProxyEndpoints = 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 BaseProxyEndpoints = /* @__PURE__ */ (() => { class BaseProxyEndpoints extends resource_1.APIResource { /** * Create a new Zero Trust Gateway proxy endpoint. * * @example * ```ts * const proxyEndpoint = * await client.zeroTrust.gateway.proxyEndpoints.create({ * account_id: '699d98642c564d2e855e9661899b7252', * name: 'Devops team', * }); * ``` */ create(params, options) { const { account_id, ...body } = params; return this._client.post((0, path_1.path) `/accounts/${account_id}/gateway/proxy_endpoints`, { body, ...options, })._thenUnwrap((obj) => obj.result); } /** * List all Zero Trust Gateway proxy endpoints for an account. * * @example * ```ts * // Automatically fetches more pages as needed. * for await (const proxyEndpoint of client.zeroTrust.gateway.proxyEndpoints.list( * { account_id: '699d98642c564d2e855e9661899b7252' }, * )) { * // ... * } * ``` */ list(params, options) { const { account_id, ...query } = params; return this._client.getAPIList((0, path_1.path) `/accounts/${account_id}/gateway/proxy_endpoints`, (pagination_1.SinglePage), { query, ...options }); } /** * Delete a configured Zero Trust Gateway proxy endpoint. * * @example * ```ts * const proxyEndpoint = * await client.zeroTrust.gateway.proxyEndpoints.delete( * 'ed35569b41ce4d1facfe683550f54086', * { account_id: '699d98642c564d2e855e9661899b7252' }, * ); * ``` */ delete(proxyEndpointID, params, options) { const { account_id } = params; return this._client.delete((0, path_1.path) `/accounts/${account_id}/gateway/proxy_endpoints/${proxyEndpointID}`, options)._thenUnwrap((obj) => obj.result); } /** * Update a configured Zero Trust Gateway proxy endpoint. * * @example * ```ts * const proxyEndpoint = * await client.zeroTrust.gateway.proxyEndpoints.edit( * 'ed35569b41ce4d1facfe683550f54086', * { account_id: '699d98642c564d2e855e9661899b7252' }, * ); * ``` */ edit(proxyEndpointID, params, options) { const { account_id, ...body } = params; return this._client.patch((0, path_1.path) `/accounts/${account_id}/gateway/proxy_endpoints/${proxyEndpointID}`, { body, ...options, })._thenUnwrap((obj) => obj.result); } /** * Get a single Zero Trust Gateway proxy endpoint. * * @example * ```ts * const proxyEndpoint = * await client.zeroTrust.gateway.proxyEndpoints.get( * 'ed35569b41ce4d1facfe683550f54086', * { account_id: '699d98642c564d2e855e9661899b7252' }, * ); * ``` */ get(proxyEndpointID, params, options) { const { account_id } = params; return this._client.get((0, path_1.path) `/accounts/${account_id}/gateway/proxy_endpoints/${proxyEndpointID}`, options)._thenUnwrap((obj) => obj.result); } } BaseProxyEndpoints._key = Object.freeze([ 'zeroTrust', 'gateway', 'proxyEndpoints', ]); return BaseProxyEndpoints; })(); exports.BaseProxyEndpoints = BaseProxyEndpoints; class ProxyEndpoints extends BaseProxyEndpoints { } exports.ProxyEndpoints = ProxyEndpoints; //# sourceMappingURL=proxy-endpoints.js.map