UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

109 lines • 4.21 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Ingresses = exports.BaseIngresses = 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 BaseIngresses = /* @__PURE__ */ (() => { class BaseIngresses extends resource_1.APIResource { /** * Create a new ingress rule for the specified sinkhole. The CIDR block must be a * Cloudflare BYOIP associated with your account. The zone_id must be a zone with * the ability to create Spectrum Apps. The sinkhole must belong to the same * account as the zone. * * @example * ```ts * const ingress = * await client.intel.sinkholes.ingresses.create( * '93defa6e909e464e8c89a85859f36d3c', * { * zone_id: '023e105f4ecef8ad9ca31a8372d0c353', * cidr: 'cidr', * }, * ); * ``` */ create(sinkholeID, params, options) { const { zone_id, ...body } = params; return this._client.post((0, path_1.path) `/zones/${zone_id}/intel/sinkholes/${sinkholeID}/ingresses`, { body, ...options, })._thenUnwrap((obj) => obj.result); } /** * Replaces the specified ingress rule. The sinkhole must belong to the same * account as the zone. * * @example * ```ts * const ingress = * await client.intel.sinkholes.ingresses.update( * 'de32ae5203724ed08dcc26e971a4d22f', * { * zone_id: '023e105f4ecef8ad9ca31a8372d0c353', * sinkhole_id: '93defa6e909e464e8c89a85859f36d3c', * cidr: 'cidr', * }, * ); * ``` */ update(ingressID, params, options) { const { zone_id, sinkhole_id, ...body } = params; return this._client.put((0, path_1.path) `/zones/${zone_id}/intel/sinkholes/${sinkhole_id}/ingresses/${ingressID}`, { body, ...options, })._thenUnwrap((obj) => obj.result); } /** * Delete the specified ingress rule. The sinkhole must belong to the same account * as the zone. * * @example * ```ts * const ingress = * await client.intel.sinkholes.ingresses.delete( * 'de32ae5203724ed08dcc26e971a4d22f', * { * zone_id: '023e105f4ecef8ad9ca31a8372d0c353', * sinkhole_id: '93defa6e909e464e8c89a85859f36d3c', * }, * ); * ``` */ delete(ingressID, params, options) { const { zone_id, sinkhole_id } = params; return this._client.delete((0, path_1.path) `/zones/${zone_id}/intel/sinkholes/${sinkhole_id}/ingresses/${ingressID}`, options)._thenUnwrap((obj) => obj.result); } /** * Get the specified ingress rule associated with a sinkhole. The sinkhole must * belong to the same account as the zone. * * @example * ```ts * const ingress = await client.intel.sinkholes.ingresses.get( * 'de32ae5203724ed08dcc26e971a4d22f', * { * zone_id: '023e105f4ecef8ad9ca31a8372d0c353', * sinkhole_id: '93defa6e909e464e8c89a85859f36d3c', * }, * ); * ``` */ get(ingressID, params, options) { const { zone_id, sinkhole_id } = params; return this._client.get((0, path_1.path) `/zones/${zone_id}/intel/sinkholes/${sinkhole_id}/ingresses/${ingressID}`, options)._thenUnwrap((obj) => obj.result); } } BaseIngresses._key = Object.freeze([ 'intel', 'sinkholes', 'ingresses', ]); return BaseIngresses; })(); exports.BaseIngresses = BaseIngresses; class Ingresses extends BaseIngresses { } exports.Ingresses = Ingresses; //# sourceMappingURL=ingresses.js.map