cloudflare
Version:
The official TypeScript library for the Cloudflare API
119 lines • 4.65 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.DeploymentGroups = exports.BaseDeploymentGroups = 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 BaseDeploymentGroups = /* @__PURE__ */ (() => {
class BaseDeploymentGroups extends resource_1.APIResource {
/**
* Creates a new deployment group. Policy IDs must be unique across all deployment
* groups. This endpoint is in Beta.
*
* @example
* ```ts
* const deploymentGroup =
* await client.zeroTrust.devices.deploymentGroups.create({
* account_id: 'account_id',
* name: 'Engineering Ring 0',
* version_config: [
* {
* target_environment: 'windows',
* version: '2026.6.234.0',
* },
* ],
* });
* ```
*/
create(params, options) {
const { account_id, ...body } = params;
return this._client.post((0, path_1.path) `/accounts/${account_id}/devices/deployment-groups`, {
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* Lists all deployment groups for an account. Use deployment groups to assign
* target WARP client versions to specific devices. This endpoint is in Beta.
*
* @example
* ```ts
* // Automatically fetches more pages as needed.
* for await (const deploymentGroup of client.zeroTrust.devices.deploymentGroups.list(
* { account_id: 'account_id' },
* )) {
* // ...
* }
* ```
*/
list(params, options) {
const { account_id, ...query } = params;
return this._client.getAPIList((0, path_1.path) `/accounts/${account_id}/devices/deployment-groups`, (pagination_1.V4PagePaginationArray), { query, ...options });
}
/**
* Deletes a deployment group. Associated policies no longer apply and devices stop
* receiving version targets. This endpoint is in Beta.
*
* @example
* ```ts
* const deploymentGroup =
* await client.zeroTrust.devices.deploymentGroups.delete(
* 'group_id',
* { account_id: 'account_id' },
* );
* ```
*/
delete(groupID, params, options) {
const { account_id } = params;
return this._client.delete((0, path_1.path) `/accounts/${account_id}/devices/deployment-groups/${groupID}`, options)._thenUnwrap((obj) => obj.result);
}
/**
* Updates a deployment group. Returns 409 if any newly added policy IDs already
* belong to another deployment group. This endpoint is in Beta.
*
* @example
* ```ts
* const deploymentGroup =
* await client.zeroTrust.devices.deploymentGroups.edit(
* 'group_id',
* { account_id: 'account_id' },
* );
* ```
*/
edit(groupID, params, options) {
const { account_id, ...body } = params;
return this._client.patch((0, path_1.path) `/accounts/${account_id}/devices/deployment-groups/${groupID}`, {
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* Fetches a single deployment group by its ID. This endpoint is in Beta.
*
* @example
* ```ts
* const deploymentGroup =
* await client.zeroTrust.devices.deploymentGroups.get(
* 'group_id',
* { account_id: 'account_id' },
* );
* ```
*/
get(groupID, params, options) {
const { account_id } = params;
return this._client.get((0, path_1.path) `/accounts/${account_id}/devices/deployment-groups/${groupID}`, options)._thenUnwrap((obj) => obj.result);
}
}
BaseDeploymentGroups._key = Object.freeze([
'zeroTrust',
'devices',
'deploymentGroups',
]);
return BaseDeploymentGroups;
})();
exports.BaseDeploymentGroups = BaseDeploymentGroups;
class DeploymentGroups extends BaseDeploymentGroups {
}
exports.DeploymentGroups = DeploymentGroups;
//# sourceMappingURL=deployment-groups.js.map