UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

131 lines • 4.84 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Entries = exports.BaseEntries = void 0; const tslib_1 = require("../../../../internal/tslib.js"); // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. const resource_1 = require("../../../../core/resource.js"); const CustomAPI = tslib_1.__importStar(require("./custom.js")); const custom_1 = require("./custom.js"); const IntegrationAPI = tslib_1.__importStar(require("./integration.js")); const integration_1 = require("./integration.js"); const PredefinedAPI = tslib_1.__importStar(require("./predefined.js")); const predefined_1 = require("./predefined.js"); const pagination_1 = require("../../../../core/pagination.js"); const path_1 = require("../../../../internal/utils/path.js"); var BaseEntries = /* @__PURE__ */ (() => { class BaseEntries extends resource_1.APIResource { /** * Creates a DLP custom entry. * * @example * ```ts * const entry = await client.zeroTrust.dlp.entries.create({ * account_id: 'account_id', * enabled: true, * name: 'name', * pattern: { regex: 'regex' }, * }); * ``` */ create(params, options) { const { account_id, ...body } = params; return this._client.post((0, path_1.path) `/accounts/${account_id}/dlp/entries`, { body, ...options })._thenUnwrap((obj) => obj.result); } /** * Updates a DLP entry. * * @example * ```ts * const entry = await client.zeroTrust.dlp.entries.update( * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', * { * account_id: 'account_id', * name: 'name', * pattern: { regex: 'regex' }, * type: 'custom', * }, * ); * ``` */ update(entryID, params, options) { const { account_id, ...body } = params; return this._client.put((0, path_1.path) `/accounts/${account_id}/dlp/entries/${entryID}`, { body, ...options, })._thenUnwrap((obj) => obj.result); } /** * Lists all DLP entries in an account. * * @example * ```ts * // Automatically fetches more pages as needed. * for await (const entryListResponse of client.zeroTrust.dlp.entries.list( * { account_id: 'account_id' }, * )) { * // ... * } * ``` */ list(params, options) { const { account_id } = params; return this._client.getAPIList((0, path_1.path) `/accounts/${account_id}/dlp/entries`, (pagination_1.SinglePage), options); } /** * Deletes a DLP custom entry. * * @example * ```ts * const entry = await client.zeroTrust.dlp.entries.delete( * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', * { account_id: 'account_id' }, * ); * ``` */ delete(entryID, params, options) { const { account_id } = params; return this._client.delete((0, path_1.path) `/accounts/${account_id}/dlp/entries/${entryID}`, options)._thenUnwrap((obj) => obj.result); } /** * Fetches a DLP entry by ID. * * @example * ```ts * const entry = await client.zeroTrust.dlp.entries.get( * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', * { account_id: 'account_id' }, * ); * ``` */ get(entryID, params, options) { const { account_id } = params; return this._client.get((0, path_1.path) `/accounts/${account_id}/dlp/entries/${entryID}`, options)._thenUnwrap((obj) => obj.result); } } BaseEntries._key = Object.freeze([ 'zeroTrust', 'dlp', 'entries', ]); return BaseEntries; })(); exports.BaseEntries = BaseEntries; var Entries = /* @__PURE__ */ (() => { class Entries extends BaseEntries { constructor() { super(...arguments); this.custom = new CustomAPI.Custom(this._client); this.predefined = new PredefinedAPI.Predefined(this._client); this.integration = new IntegrationAPI.Integration(this._client); } } Entries.Custom = custom_1.Custom; Entries.BaseCustom = custom_1.BaseCustom; Entries.Predefined = predefined_1.Predefined; Entries.BasePredefined = predefined_1.BasePredefined; Entries.Integration = integration_1.Integration; Entries.BaseIntegration = integration_1.BaseIntegration; return Entries; })(); exports.Entries = Entries; //# sourceMappingURL=entries.js.map