cloudflare
Version:
The official TypeScript library for the Cloudflare API
123 lines • 4.57 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Posture = exports.BasePosture = 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 IntegrationsAPI = tslib_1.__importStar(require("./integrations.js"));
const integrations_1 = require("./integrations.js");
const pagination_1 = require("../../../../core/pagination.js");
const path_1 = require("../../../../internal/utils/path.js");
var BasePosture = /* @__PURE__ */ (() => {
class BasePosture extends resource_1.APIResource {
/**
* Creates a new device posture rule.
*
* @example
* ```ts
* const devicePostureRule =
* await client.zeroTrust.devices.posture.create({
* account_id: '699d98642c564d2e855e9661899b7252',
* name: 'Admin Serial Numbers',
* type: 'file',
* });
* ```
*/
create(params, options) {
const { account_id, ...body } = params;
return this._client.post((0, path_1.path) `/accounts/${account_id}/devices/posture`, { body, ...options })._thenUnwrap((obj) => obj.result);
}
/**
* Updates a device posture rule.
*
* @example
* ```ts
* const devicePostureRule =
* await client.zeroTrust.devices.posture.update(
* 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415',
* {
* account_id: '699d98642c564d2e855e9661899b7252',
* name: 'Admin Serial Numbers',
* type: 'file',
* },
* );
* ```
*/
update(ruleID, params, options) {
const { account_id, ...body } = params;
return this._client.put((0, path_1.path) `/accounts/${account_id}/devices/posture/${ruleID}`, {
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* Fetches device posture rules for a Zero Trust account.
*
* @example
* ```ts
* // Automatically fetches more pages as needed.
* for await (const devicePostureRule of client.zeroTrust.devices.posture.list(
* { account_id: '699d98642c564d2e855e9661899b7252' },
* )) {
* // ...
* }
* ```
*/
list(params, options) {
const { account_id } = params;
return this._client.getAPIList((0, path_1.path) `/accounts/${account_id}/devices/posture`, (pagination_1.SinglePage), options);
}
/**
* Deletes a device posture rule.
*
* @example
* ```ts
* const posture =
* await client.zeroTrust.devices.posture.delete(
* 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415',
* { account_id: '699d98642c564d2e855e9661899b7252' },
* );
* ```
*/
delete(ruleID, params, options) {
const { account_id } = params;
return this._client.delete((0, path_1.path) `/accounts/${account_id}/devices/posture/${ruleID}`, options)._thenUnwrap((obj) => obj.result);
}
/**
* Fetches a single device posture rule.
*
* @example
* ```ts
* const devicePostureRule =
* await client.zeroTrust.devices.posture.get(
* 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415',
* { account_id: '699d98642c564d2e855e9661899b7252' },
* );
* ```
*/
get(ruleID, params, options) {
const { account_id } = params;
return this._client.get((0, path_1.path) `/accounts/${account_id}/devices/posture/${ruleID}`, options)._thenUnwrap((obj) => obj.result);
}
}
BasePosture._key = Object.freeze([
'zeroTrust',
'devices',
'posture',
]);
return BasePosture;
})();
exports.BasePosture = BasePosture;
var Posture = /* @__PURE__ */ (() => {
class Posture extends BasePosture {
constructor() {
super(...arguments);
this.integrations = new IntegrationsAPI.Integrations(this._client);
}
}
Posture.Integrations = integrations_1.Integrations;
Posture.BaseIntegrations = integrations_1.BaseIntegrations;
return Posture;
})();
exports.Posture = Posture;
//# sourceMappingURL=posture.js.map