cloudflare
Version:
The official TypeScript library for the Cloudflare API
115 lines • 4.26 kB
JavaScript
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from "../../../../core/resource.mjs";
import * as LevelsAPI from "./levels/levels.mjs";
import { BaseLevels, Levels, } from "./levels/levels.mjs";
import { SinglePage } from "../../../../core/pagination.mjs";
import { path } from "../../../../internal/utils/path.mjs";
export var BaseSensitivityGroups = /* @__PURE__ */ (() => {
class BaseSensitivityGroups extends APIResource {
/**
* Creates a sensitivity group, optionally from a template.
*
* @example
* ```ts
* const sensitivityGroup =
* await client.zeroTrust.dlp.sensitivityGroups.create({
* account_id: 'account_id',
* name: 'name',
* });
* ```
*/
create(params, options) {
const { account_id, ...body } = params;
return this._client.post(path `/accounts/${account_id}/dlp/sensitivity_groups`, {
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* Updates a sensitivity group and its levels.
*
* @example
* ```ts
* const sensitivityGroup =
* await client.zeroTrust.dlp.sensitivityGroups.update(
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
* { account_id: 'account_id' },
* );
* ```
*/
update(sensitivityGroupID, params, options) {
const { account_id, ...body } = params;
return this._client.put(path `/accounts/${account_id}/dlp/sensitivity_groups/${sensitivityGroupID}`, {
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* Lists sensitivity groups configured for the account.
*
* @example
* ```ts
* // Automatically fetches more pages as needed.
* for await (const sensitivityGroupListResponse of client.zeroTrust.dlp.sensitivityGroups.list(
* { account_id: 'account_id' },
* )) {
* // ...
* }
* ```
*/
list(params, options) {
const { account_id } = params;
return this._client.getAPIList(path `/accounts/${account_id}/dlp/sensitivity_groups`, (SinglePage), options);
}
/**
* Deletes a sensitivity group and its levels.
*
* @example
* ```ts
* const sensitivityGroup =
* await client.zeroTrust.dlp.sensitivityGroups.delete(
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
* { account_id: 'account_id' },
* );
* ```
*/
delete(sensitivityGroupID, params, options) {
const { account_id } = params;
return this._client.delete(path `/accounts/${account_id}/dlp/sensitivity_groups/${sensitivityGroupID}`, options)._thenUnwrap((obj) => obj.result);
}
/**
* Gets a sensitivity group and its levels.
*
* @example
* ```ts
* const sensitivityGroup =
* await client.zeroTrust.dlp.sensitivityGroups.get(
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
* { account_id: 'account_id' },
* );
* ```
*/
get(sensitivityGroupID, params, options) {
const { account_id } = params;
return this._client.get(path `/accounts/${account_id}/dlp/sensitivity_groups/${sensitivityGroupID}`, options)._thenUnwrap((obj) => obj.result);
}
}
BaseSensitivityGroups._key = Object.freeze([
'zeroTrust',
'dlp',
'sensitivityGroups',
]);
return BaseSensitivityGroups;
})();
export var SensitivityGroups = /* @__PURE__ */ (() => {
class SensitivityGroups extends BaseSensitivityGroups {
constructor() {
super(...arguments);
this.levels = new LevelsAPI.Levels(this._client);
}
}
SensitivityGroups.Levels = Levels;
SensitivityGroups.BaseLevels = BaseLevels;
return SensitivityGroups;
})();
//# sourceMappingURL=sensitivity-groups.mjs.map