cloudflare
Version:
The official TypeScript library for the Cloudflare API
104 lines • 3.96 kB
JavaScript
// 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 BaseIngresses = /* @__PURE__ */ (() => {
class BaseIngresses extends 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(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(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(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(path `/zones/${zone_id}/intel/sinkholes/${sinkhole_id}/ingresses/${ingressID}`, options)._thenUnwrap((obj) => obj.result);
}
}
BaseIngresses._key = Object.freeze([
'intel',
'sinkholes',
'ingresses',
]);
return BaseIngresses;
})();
export class Ingresses extends BaseIngresses {
}
//# sourceMappingURL=ingresses.mjs.map