Class: Anthropic::Resources::Beta::Organization::Federation::Rules::Workspaces
- Inherits:
-
Object
- Object
- Anthropic::Resources::Beta::Organization::Federation::Rules::Workspaces
- Defined in:
- lib/anthropic/resources/beta/organization/federation/rules/workspaces.rb,
sig/anthropic/resources/beta/organization/federation/rules/workspaces.rbs
Instance Method Summary collapse
-
#add(federation_rule_id, workspace_id:, betas: nil, request_options: {}) ⇒ Anthropic::Models::Beta::Organization::Federation::BetaFederationRuleWorkspace
Requires an OAuth access token with the
org:adminscope, fromant auth login --scope org:adminor a workload identity federation rule; Admin API keys are not accepted. -
#initialize(client:) ⇒ Workspaces
constructor
private
A new instance of Workspaces.
-
#list(federation_rule_id, limit: nil, page: nil, betas: nil, request_options: {}) ⇒ Anthropic::Internal::PageCursor<Anthropic::Models::Beta::Organization::Federation::BetaFederationRuleWorkspace>
Requires an OAuth access token with the
org:adminscope, fromant auth login --scope org:adminor a workload identity federation rule; Admin API keys are not accepted. -
#remove(workspace_id, federation_rule_id:, betas: nil, request_options: {}) ⇒ Anthropic::Models::Beta::Organization::Federation::Rules::WorkspaceRemoveResponse
Requires an OAuth access token with the
org:adminscope, fromant auth login --scope org:adminor a workload identity federation rule; Admin API keys are not accepted.
Constructor Details
#initialize(client:) ⇒ Workspaces
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Workspaces.
143 144 145 |
# File 'lib/anthropic/resources/beta/organization/federation/rules/workspaces.rb', line 143 def initialize(client:) @client = client end |
Instance Method Details
#add(federation_rule_id, workspace_id:, betas: nil, request_options: {}) ⇒ Anthropic::Models::Beta::Organization::Federation::BetaFederationRuleWorkspace
Requires an OAuth access token with the org:admin scope, from
ant auth login --scope org:admin or a workload identity federation rule; Admin
API keys are not accepted. See
Manage WIF with the Admin API.
Enable a federation rule for a workspace.
Idempotent; re-enabling returns the existing enablement. The rule and workspace
must both belong to your organization. Membership of the rule's target service
account in this workspace is not checked at enablement: token exchange into this
workspace is rejected unless the target is a member (it is implicitly a member
of the default workspace). Archived rules are rejected with 400. OAuth callers
may only manage rules whose oauth_scope is workspace:developer or
workspace:inference; other scopes require a Console session.
82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/anthropic/resources/beta/organization/federation/rules/workspaces.rb', line 82 def add(federation_rule_id, params) parsed, = Anthropic::Beta::Organization::Federation::Rules::WorkspaceAddParams.dump_request(params) header_params = {betas: "anthropic-beta"} @client.request( method: :post, path: ["v1/organizations/federation_rules/%1$s/workspaces?beta=true", federation_rule_id], headers: parsed.slice(*header_params.keys).transform_keys(header_params), body: parsed.except(*header_params.keys), model: Anthropic::Beta::Organization::Federation::BetaFederationRuleWorkspace, options: ) end |
#list(federation_rule_id, limit: nil, page: nil, betas: nil, request_options: {}) ⇒ Anthropic::Internal::PageCursor<Anthropic::Models::Beta::Organization::Federation::BetaFederationRuleWorkspace>
Requires an OAuth access token with the org:admin scope, from
ant auth login --scope org:admin or a workload identity federation rule; Admin
API keys are not accepted. See
Manage WIF with the Admin API.
List workspaces where this federation rule is enabled.
Returns all workspace enablements in a single response; the limit and page
parameters are accepted but have no effect, and next_page is always null.
Returns explicit per-workspace enablements only; for rules with
applies_to_all_workspaces or a legacy single workspace_id, check those
fields on the rule itself.
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/anthropic/resources/beta/organization/federation/rules/workspaces.rb', line 38 def list(federation_rule_id, params = {}) query_params = [:limit, :page] parsed, = Anthropic::Beta::Organization::Federation::Rules::WorkspaceListParams.dump_request(params) query = Anthropic::Internal::Util.encode_query_params(parsed.slice(*query_params)) @client.request( method: :get, path: ["v1/organizations/federation_rules/%1$s/workspaces?beta=true", federation_rule_id], query: query, headers: parsed.except(*query_params).transform_keys(betas: "anthropic-beta"), page: Anthropic::Internal::PageCursor, model: Anthropic::Beta::Organization::Federation::BetaFederationRuleWorkspace, options: ) end |
#remove(workspace_id, federation_rule_id:, betas: nil, request_options: {}) ⇒ Anthropic::Models::Beta::Organization::Federation::Rules::WorkspaceRemoveResponse
Requires an OAuth access token with the org:admin scope, from
ant auth login --scope org:admin or a workload identity federation rule; Admin
API keys are not accepted. See
Manage WIF with the Admin API.
Disable a federation rule for a workspace.
Idempotent; succeeds even if the enablement was already removed. OAuth callers
may only manage rules whose oauth_scope is workspace:developer or
workspace:inference; other scopes require a Console session.
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 |
# File 'lib/anthropic/resources/beta/organization/federation/rules/workspaces.rb', line 120 def remove(workspace_id, params) parsed, = Anthropic::Beta::Organization::Federation::Rules::WorkspaceRemoveParams.dump_request(params) federation_rule_id = parsed.delete(:federation_rule_id) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :delete, path: [ "v1/organizations/federation_rules/%1$s/workspaces/%2$s?beta=true", federation_rule_id, workspace_id ], headers: parsed.transform_keys(betas: "anthropic-beta"), model: Anthropic::Models::Beta::Organization::Federation::Rules::WorkspaceRemoveResponse, options: ) end |