cloudflare
Version:
The official TypeScript library for the Cloudflare API
114 lines • 4.2 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.DataClasses = exports.BaseDataClasses = 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 BaseDataClasses = /* @__PURE__ */ (() => {
class BaseDataClasses extends resource_1.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((0, path_1.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((0, path_1.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((0, path_1.path) `/accounts/${account_id}/dlp/data_classes`, (pagination_1.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((0, path_1.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((0, path_1.path) `/accounts/${account_id}/dlp/data_classes/${dataClassID}`, options)._thenUnwrap((obj) => obj.result);
}
}
BaseDataClasses._key = Object.freeze([
'zeroTrust',
'dlp',
'dataClasses',
]);
return BaseDataClasses;
})();
exports.BaseDataClasses = BaseDataClasses;
class DataClasses extends BaseDataClasses {
}
exports.DataClasses = DataClasses;
//# sourceMappingURL=data-classes.js.map