@anthropic-ai/sdk
Version:
The official TypeScript library for the Anthropic API
199 lines • 9.57 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.RBACGroups = void 0;
const resource_1 = require("../../../../../core/resource.js");
const pagination_1 = require("../../../../../core/pagination.js");
const headers_1 = require("../../../../../internal/headers.js");
const tracing_1 = require("../../../../../internal/tracing.js");
const path_1 = require("../../../../../internal/utils/path.js");
class RBACGroups extends resource_1.APIResource {
/**
* Retrieve an RBAC Group's Claude Code managed settings.
*
* **Accepted credentials:** an organization-level Admin API key with the
* `read:claude_code_managed_settings` scope.
*
* Every request must include the beta header
* `anthropic-beta: ce-claude-code-managed-settings-2026-10-06`. A request without
* it, or from an organization not enabled for this beta, returns `404`. The Claude
* Code Managed Settings API is in beta and is available to Claude Enterprise
* organizations only.
*
* @throws {BetaCMEKFeatureUnsupportedError}
* @throws {CMEKKeyDisabledError}
* @throws {BetaRBACGroupManagedSettingsNotFoundError}
*
* @example
* ```ts
* const betaClaudeCodeRBACGroupManagedSettings =
* await client.beta.organization.claudeCode.managedSettings.rbacGroups.retrieve(
* 'rbac_group_id',
* );
* ```
*/
retrieve(rbacGroupID, params = {}, options) {
const { betas } = params ?? {};
return this._client.get((0, path_1.path) `/v1/organizations/claude_code/managed_settings/rbac_groups/${rbacGroupID}`, {
...options,
headers: (0, headers_1.buildHeaders)([
{ 'anthropic-beta': [...(betas ?? []), 'ce-claude-code-managed-settings-2026-10-06'].toString() },
options?.headers,
]),
__qualifiers: { beta: 'true' },
__span: (0, tracing_1.startApiCallSpan)(this._client, 'anthropic.organization.claude_code.managed_settings.rbac_groups.retrieve', options, {
route: '/v1/organizations/claude_code/managed_settings/rbac_groups/{rbac_group_id}',
attributes: { 'anthropic.organization.claude_code.managed_setting.rbac_group.id': rbacGroupID },
}),
});
}
/**
* List the RBAC Groups that have Claude Code managed settings, highest precedence
* first.
*
* Each entry gives the group's status and timestamps, not its settings. The list
* includes deleted groups that still have settings, and leaves out the default
* settings. If the order changes between pages, the request returns `409`: list
* again from the first page.
*
* **Accepted credentials:** an organization-level Admin API key with the
* `read:claude_code_managed_settings` scope.
*
* Every request must include the beta header
* `anthropic-beta: ce-claude-code-managed-settings-2026-10-06`. A request without
* it, or from an organization not enabled for this beta, returns `404`. The Claude
* Code Managed Settings API is in beta and is available to Claude Enterprise
* organizations only.
*
* @example
* ```ts
* // Automatically fetches more pages as needed.
* for await (const betaClaudeCodeRBACGroupManagedSettingsSummary of client.beta.organization.claudeCode.managedSettings.rbacGroups.list()) {
* // ...
* }
* ```
*/
list(params = {}, options) {
const { betas, ...query } = params ?? {};
return this._client.getAPIList('/v1/organizations/claude_code/managed_settings/rbac_groups', (pagination_1.PageCursor), {
query,
...options,
headers: (0, headers_1.buildHeaders)([
{ 'anthropic-beta': [...(betas ?? []), 'ce-claude-code-managed-settings-2026-10-06'].toString() },
options?.headers,
]),
__qualifiers: { beta: 'true' },
__span: (0, tracing_1.startApiCallSpan)(this._client, 'anthropic.organization.claude_code.managed_settings.rbac_groups.list', options, {
route: '/v1/organizations/claude_code/managed_settings/rbac_groups',
queryParams: ['limit', 'page'],
}),
});
}
/**
* Delete an RBAC Group's Claude Code managed settings and remove the group from
* `rbac_group_order`.
*
* A group with no settings returns `404` with the error code
* `rbac_group_managed_settings_not_found`. That code on a retry of a delete that
* returned `503` means the settings are gone.
*
* **Accepted credentials:** an organization-level Admin API key with the
* `write:claude_code_managed_settings` scope.
*
* Every request must include the beta header
* `anthropic-beta: ce-claude-code-managed-settings-2026-10-06`. A request without
* it, or from an organization not enabled for this beta, returns `404`. The Claude
* Code Managed Settings API is in beta and is available to Claude Enterprise
* organizations only.
*
* A write that returns `503` may have applied. Retrying it is safe.
*
* @throws {CMEKKeyDisabledError}
* @throws {BetaSettingsHistoryLimitExceededError}
* @throws {SandboxEgressRestrictedError}
* @throws {BetaRBACGroupManagedSettingsNotFoundError}
*
* @example
* ```ts
* const betaDeletedClaudeCodeRBACGroupManagedSettings =
* await client.beta.organization.claudeCode.managedSettings.rbacGroups.delete(
* 'rbac_group_id',
* );
* ```
*/
delete(rbacGroupID, params = {}, options) {
const { betas } = params ?? {};
return this._client.delete((0, path_1.path) `/v1/organizations/claude_code/managed_settings/rbac_groups/${rbacGroupID}`, {
...options,
headers: (0, headers_1.buildHeaders)([
{ 'anthropic-beta': [...(betas ?? []), 'ce-claude-code-managed-settings-2026-10-06'].toString() },
options?.headers,
]),
__qualifiers: { beta: 'true' },
__span: (0, tracing_1.startApiCallSpan)(this._client, 'anthropic.organization.claude_code.managed_settings.rbac_groups.delete', options, {
route: '/v1/organizations/claude_code/managed_settings/rbac_groups/{rbac_group_id}',
attributes: { 'anthropic.organization.claude_code.managed_setting.rbac_group.id': rbacGroupID },
}),
});
}
/**
* Create or replace an RBAC Group's Claude Code managed settings.
*
* New settings join the end of `rbac_group_order`, and existing settings keep
* their place. Until the group is moved up, its members who also belong to an
* earlier group keep that group's settings. In `organization` mode a write changes
* no member's settings until the organization switches to `rbac_groups` mode. Once
* a group has settings, that switch no longer copies the organization settings
* into default settings, so members in no RBAC Group in `rbac_group_order` receive
* no settings unless you set the default settings before the switch.
*
* Get the group's ID from the RBAC Groups API. One key can hold `read:rbac_groups`
* and `write:claude_code_managed_settings`.
*
* **Accepted credentials:** an organization-level Admin API key with the
* `write:claude_code_managed_settings` scope.
*
* Every request must include the beta header
* `anthropic-beta: ce-claude-code-managed-settings-2026-10-06`. A request without
* it, or from an organization not enabled for this beta, returns `404`. The Claude
* Code Managed Settings API is in beta and is available to Claude Enterprise
* organizations only.
*
* A write that returns `503` may have applied. Retrying it is safe.
*
* @throws {BetaCMEKFeatureUnsupportedError}
* @throws {CMEKKeyDisabledError}
* @throws {BetaRBACGroupOrderLimitExceededError}
* @throws {BetaRequestBodyTimeoutError}
* @throws {BetaSettingsDocumentLimitExceededError}
* @throws {BetaSettingsHistoryLimitExceededError}
* @throws {SandboxEgressRestrictedError}
* @throws {BetaRBACGroupNotFoundError}
*
* @example
* ```ts
* const betaClaudeCodeRBACGroupManagedSettings =
* await client.beta.organization.claudeCode.managedSettings.rbacGroups.set(
* 'rbac_group_id',
* { settings: { foo: 'bar' } },
* );
* ```
*/
set(rbacGroupID, params, options) {
const { betas, ...body } = params;
return this._client.post((0, path_1.path) `/v1/organizations/claude_code/managed_settings/rbac_groups/${rbacGroupID}`, {
body,
...options,
headers: (0, headers_1.buildHeaders)([
{ 'anthropic-beta': [...(betas ?? []), 'ce-claude-code-managed-settings-2026-10-06'].toString() },
options?.headers,
]),
__qualifiers: { beta: 'true' },
__span: (0, tracing_1.startApiCallSpan)(this._client, 'anthropic.organization.claude_code.managed_settings.rbac_groups.set', options, {
route: '/v1/organizations/claude_code/managed_settings/rbac_groups/{rbac_group_id}',
attributes: { 'anthropic.organization.claude_code.managed_setting.rbac_group.id': rbacGroupID },
}),
});
}
}
exports.RBACGroups = RBACGroups;
//# sourceMappingURL=rbac-groups.js.map