cloudflare
Version:
The official TypeScript library for the Cloudflare API
114 lines • 4.35 kB
JavaScript
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from "../../../core/resource.mjs";
import { V4PagePaginationArray, } from "../../../core/pagination.mjs";
import { path } from "../../../internal/utils/path.mjs";
export var BaseDeploymentGroups = /* @__PURE__ */ (() => {
class BaseDeploymentGroups extends 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(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(path `/accounts/${account_id}/devices/deployment-groups`, (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(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(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(path `/accounts/${account_id}/devices/deployment-groups/${groupID}`, options)._thenUnwrap((obj) => obj.result);
}
}
BaseDeploymentGroups._key = Object.freeze([
'zeroTrust',
'devices',
'deploymentGroups',
]);
return BaseDeploymentGroups;
})();
export class DeploymentGroups extends BaseDeploymentGroups {
}
//# sourceMappingURL=deployment-groups.mjs.map