cloudflare
Version:
The official TypeScript library for the Cloudflare API
127 lines • 5.09 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Levels = exports.BaseLevels = 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 OrderAPI = tslib_1.__importStar(require("./order.js"));
const order_1 = require("./order.js");
const pagination_1 = require("../../../../../core/pagination.js");
const path_1 = require("../../../../../internal/utils/path.js");
var BaseLevels = /* @__PURE__ */ (() => {
class BaseLevels extends resource_1.APIResource {
/**
* Creates a sensitivity level in a group.
*
* @example
* ```ts
* const level =
* await client.zeroTrust.dlp.sensitivityGroups.levels.create(
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
* { account_id: 'account_id', name: 'name' },
* );
* ```
*/
create(sensitivityGroupID, params, options) {
const { account_id, ...body } = params;
return this._client.post((0, path_1.path) `/accounts/${account_id}/dlp/sensitivity_groups/${sensitivityGroupID}/levels`, {
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* Updates a sensitivity level in a group.
*
* @example
* ```ts
* const level =
* await client.zeroTrust.dlp.sensitivityGroups.levels.update(
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
* {
* account_id: 'account_id',
* sensitivity_group_id:
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
* },
* );
* ```
*/
update(sensitivityLevelID, params, options) {
const { account_id, sensitivity_group_id, ...body } = params;
return this._client.put((0, path_1.path) `/accounts/${account_id}/dlp/sensitivity_groups/${sensitivity_group_id}/levels/${sensitivityLevelID}`, { body, ...options })._thenUnwrap((obj) => obj.result);
}
/**
* Lists sensitivity levels in a sensitivity group.
*
* @example
* ```ts
* // Automatically fetches more pages as needed.
* for await (const levelListResponse of client.zeroTrust.dlp.sensitivityGroups.levels.list(
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
* { account_id: 'account_id' },
* )) {
* // ...
* }
* ```
*/
list(sensitivityGroupID, params, options) {
const { account_id } = params;
return this._client.getAPIList((0, path_1.path) `/accounts/${account_id}/dlp/sensitivity_groups/${sensitivityGroupID}/levels`, (pagination_1.SinglePage), options);
}
/**
* Deletes a sensitivity level from a group.
*
* @example
* ```ts
* const level =
* await client.zeroTrust.dlp.sensitivityGroups.levels.delete(
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
* {
* account_id: 'account_id',
* sensitivity_group_id:
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
* },
* );
* ```
*/
delete(sensitivityLevelID, params, options) {
const { account_id, sensitivity_group_id } = params;
return this._client.delete((0, path_1.path) `/accounts/${account_id}/dlp/sensitivity_groups/${sensitivity_group_id}/levels/${sensitivityLevelID}`, options)._thenUnwrap((obj) => obj.result);
}
/**
* Gets a sensitivity level from a group.
*
* @example
* ```ts
* const level =
* await client.zeroTrust.dlp.sensitivityGroups.levels.get(
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
* {
* account_id: 'account_id',
* sensitivity_group_id:
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
* },
* );
* ```
*/
get(sensitivityLevelID, params, options) {
const { account_id, sensitivity_group_id } = params;
return this._client.get((0, path_1.path) `/accounts/${account_id}/dlp/sensitivity_groups/${sensitivity_group_id}/levels/${sensitivityLevelID}`, options)._thenUnwrap((obj) => obj.result);
}
}
BaseLevels._key = Object.freeze(['zeroTrust', 'dlp', 'sensitivityGroups', 'levels']);
return BaseLevels;
})();
exports.BaseLevels = BaseLevels;
var Levels = /* @__PURE__ */ (() => {
class Levels extends BaseLevels {
constructor() {
super(...arguments);
this.order = new OrderAPI.Order(this._client);
}
}
Levels.Order = order_1.Order;
Levels.BaseOrder = order_1.BaseOrder;
return Levels;
})();
exports.Levels = Levels;
//# sourceMappingURL=levels.js.map