UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

109 lines • 3.92 kB
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from "../../../core/resource.mjs"; import { SinglePage } from "../../../core/pagination.mjs"; import { path } from "../../../internal/utils/path.mjs"; export var BaseDataClasses = /* @__PURE__ */ (() => { class BaseDataClasses extends APIResource { /** * Creates a data class for use in DLP profiles. * * @example * ```ts * const dataClass = * await client.zeroTrust.dlp.dataClasses.create({ * account_id: 'account_id', * data_tags: ['182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e'], * expression: 'expression', * name: 'name', * sensitivity_levels: [ * { * group_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', * level_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', * }, * ], * }); * ``` */ create(params, options) { const { account_id, ...body } = params; return this._client.post(path `/accounts/${account_id}/dlp/data_classes`, { body, ...options })._thenUnwrap((obj) => obj.result); } /** * Updates the configuration for a data class. * * @example * ```ts * const dataClass = * await client.zeroTrust.dlp.dataClasses.update( * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', * { account_id: 'account_id' }, * ); * ``` */ update(dataClassID, params, options) { const { account_id, ...body } = params; return this._client.put(path `/accounts/${account_id}/dlp/data_classes/${dataClassID}`, { body, ...options, })._thenUnwrap((obj) => obj.result); } /** * Lists data classes configured for the account. * * @example * ```ts * // Automatically fetches more pages as needed. * for await (const dataClassListResponse of client.zeroTrust.dlp.dataClasses.list( * { account_id: 'account_id' }, * )) { * // ... * } * ``` */ list(params, options) { const { account_id } = params; return this._client.getAPIList(path `/accounts/${account_id}/dlp/data_classes`, (SinglePage), options); } /** * Deletes a data class from the account. * * @example * ```ts * const dataClass = * await client.zeroTrust.dlp.dataClasses.delete( * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', * { account_id: 'account_id' }, * ); * ``` */ delete(dataClassID, params, options) { const { account_id } = params; return this._client.delete(path `/accounts/${account_id}/dlp/data_classes/${dataClassID}`, options)._thenUnwrap((obj) => obj.result); } /** * Gets the configuration for a data class. * * @example * ```ts * const dataClass = * await client.zeroTrust.dlp.dataClasses.get( * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', * { account_id: 'account_id' }, * ); * ``` */ get(dataClassID, params, options) { const { account_id } = params; return this._client.get(path `/accounts/${account_id}/dlp/data_classes/${dataClassID}`, options)._thenUnwrap((obj) => obj.result); } } BaseDataClasses._key = Object.freeze([ 'zeroTrust', 'dlp', 'dataClasses', ]); return BaseDataClasses; })(); export class DataClasses extends BaseDataClasses { } //# sourceMappingURL=data-classes.mjs.map