cloudflare
Version:
The official TypeScript library for the Cloudflare API
121 lines • 4.75 kB
JavaScript
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from "../../../../../core/resource.mjs";
import * as OrderAPI from "./order.mjs";
import { BaseOrder, Order, } from "./order.mjs";
import { SinglePage } from "../../../../../core/pagination.mjs";
import { path } from "../../../../../internal/utils/path.mjs";
export var BaseLevels = /* @__PURE__ */ (() => {
class BaseLevels extends 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(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(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(path `/accounts/${account_id}/dlp/sensitivity_groups/${sensitivityGroupID}/levels`, (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(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(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;
})();
export var Levels = /* @__PURE__ */ (() => {
class Levels extends BaseLevels {
constructor() {
super(...arguments);
this.order = new OrderAPI.Order(this._client);
}
}
Levels.Order = Order;
Levels.BaseOrder = BaseOrder;
return Levels;
})();
//# sourceMappingURL=levels.mjs.map