Class: Anthropic::Resources::Beta::Organization::ServiceAccounts
- Inherits:
-
Object
- Object
- Anthropic::Resources::Beta::Organization::ServiceAccounts
- Defined in:
- lib/anthropic/resources/beta/organization/service_accounts.rb,
lib/anthropic/resources/beta/organization/service_accounts/workspaces.rb,
sig/anthropic/resources/beta/organization/service_accounts.rbs,
sig/anthropic/resources/beta/organization/service_accounts/workspaces.rbs
Defined Under Namespace
Classes: Workspaces
Instance Attribute Summary collapse
Instance Method Summary collapse
-
#archive(service_account_id, betas: nil, request_options: {}) ⇒ Anthropic::Models::Beta::Organization::BetaServiceAccount
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. -
#create(name:, description: nil, organization_role: nil, betas: nil, request_options: {}) ⇒ Anthropic::Models::Beta::Organization::BetaServiceAccount
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:) ⇒ ServiceAccounts
constructor
private
A new instance of ServiceAccounts.
-
#list(include_archived: nil, limit: nil, page: nil, betas: nil, request_options: {}) ⇒ Anthropic::Internal::PageCursor<Anthropic::Models::Beta::Organization::BetaServiceAccount>
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. -
#retrieve(service_account_id, betas: nil, request_options: {}) ⇒ Anthropic::Models::Beta::Organization::BetaServiceAccount
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. -
#update(service_account_id, description: nil, organization_role: nil, betas: nil, request_options: {}) ⇒ Anthropic::Models::Beta::Organization::BetaServiceAccount
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:) ⇒ ServiceAccounts
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 ServiceAccounts.
208 209 210 211 |
# File 'lib/anthropic/resources/beta/organization/service_accounts.rb', line 208 def initialize(client:) @client = client @workspaces = Anthropic::Resources::Beta::Organization::ServiceAccounts::Workspaces.new(client: client) end |
Instance Attribute Details
#workspaces ⇒ Anthropic::Resources::Beta::Organization::ServiceAccounts::Workspaces (readonly)
9 10 11 |
# File 'lib/anthropic/resources/beta/organization/service_accounts.rb', line 9 def workspaces @workspaces end |
Instance Method Details
#archive(service_account_id, betas: nil, request_options: {}) ⇒ Anthropic::Models::Beta::Organization::BetaServiceAccount
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.
Archive a service account.
Idempotent; re-archiving returns the service account with its original
archived_at. Rejected with 400 if any live (non-archived) federation rule
still targets this service account, same as issuer archival; archive those rules
first or change their target to another service account.
194 195 196 197 198 199 200 201 202 203 |
# File 'lib/anthropic/resources/beta/organization/service_accounts.rb', line 194 def archive(service_account_id, params = {}) parsed, = Anthropic::Beta::Organization::ServiceAccountArchiveParams.dump_request(params) @client.request( method: :post, path: ["v1/organizations/service_accounts/%1$s/archive?beta=true", service_account_id], headers: parsed.transform_keys(betas: "anthropic-beta"), model: Anthropic::Beta::Organization::BetaServiceAccount, options: ) end |
#create(name:, description: nil, organization_role: nil, betas: nil, request_options: {}) ⇒ Anthropic::Models::Beta::Organization::BetaServiceAccount
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.
Create a service account.
A service account is a named workload identity that federation rules target.
organization_role is developer (default) or admin; a rule may only be
created or retargeted to grant org:admin scope when the target's
organization_role is admin. Creating an admin-role service account
requires an interactive credential (a user OAuth token or a Console session) — a
workload may only create developer-role service accounts.
Some parameter documentations has been truncated, see Models::Beta::Organization::ServiceAccountCreateParams for more details.
44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/anthropic/resources/beta/organization/service_accounts.rb', line 44 def create(params) parsed, = Anthropic::Beta::Organization::ServiceAccountCreateParams.dump_request(params) header_params = {betas: "anthropic-beta"} @client.request( method: :post, path: "v1/organizations/service_accounts?beta=true", headers: parsed.slice(*header_params.keys).transform_keys(header_params), body: parsed.except(*header_params.keys), model: Anthropic::Beta::Organization::BetaServiceAccount, options: ) end |
#list(include_archived: nil, limit: nil, page: nil, betas: nil, request_options: {}) ⇒ Anthropic::Internal::PageCursor<Anthropic::Models::Beta::Organization::BetaServiceAccount>
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 service accounts in the caller's organization.
Results are ordered by creation time, newest first. Use limit and the
next_page cursor to paginate; set include_archived=true to include archived
service accounts.
156 157 158 159 160 161 162 163 164 165 166 167 168 169 |
# File 'lib/anthropic/resources/beta/organization/service_accounts.rb', line 156 def list(params = {}) query_params = [:include_archived, :limit, :page] parsed, = Anthropic::Beta::Organization::ServiceAccountListParams.dump_request(params) query = Anthropic::Internal::Util.encode_query_params(parsed.slice(*query_params)) @client.request( method: :get, path: "v1/organizations/service_accounts?beta=true", query: query, headers: parsed.except(*query_params).transform_keys(betas: "anthropic-beta"), page: Anthropic::Internal::PageCursor, model: Anthropic::Beta::Organization::BetaServiceAccount, options: ) end |
#retrieve(service_account_id, betas: nil, request_options: {}) ⇒ Anthropic::Models::Beta::Organization::BetaServiceAccount
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.
Retrieve a service account by its ID (svac_...).
75 76 77 78 79 80 81 82 83 84 |
# File 'lib/anthropic/resources/beta/organization/service_accounts.rb', line 75 def retrieve(service_account_id, params = {}) parsed, = Anthropic::Beta::Organization::ServiceAccountRetrieveParams.dump_request(params) @client.request( method: :get, path: ["v1/organizations/service_accounts/%1$s?beta=true", service_account_id], headers: parsed.transform_keys(betas: "anthropic-beta"), model: Anthropic::Beta::Organization::BetaServiceAccount, options: ) end |
#update(service_account_id, description: nil, organization_role: nil, betas: nil, request_options: {}) ⇒ Anthropic::Models::Beta::Organization::BetaServiceAccount
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.
Update a service account.
Only description and organization_role are mutable; name cannot be
changed. Archived service accounts cannot be updated; this returns 400. Setting
organization_role to admin (even when unchanged) requires an interactive
credential (a user OAuth token or a Console session).
Some parameter documentations has been truncated, see Models::Beta::Organization::ServiceAccountUpdateParams for more details.
117 118 119 120 121 122 123 124 125 126 127 128 |
# File 'lib/anthropic/resources/beta/organization/service_accounts.rb', line 117 def update(service_account_id, params = {}) parsed, = Anthropic::Beta::Organization::ServiceAccountUpdateParams.dump_request(params) header_params = {betas: "anthropic-beta"} @client.request( method: :post, path: ["v1/organizations/service_accounts/%1$s?beta=true", service_account_id], headers: parsed.slice(*header_params.keys).transform_keys(header_params), body: parsed.except(*header_params.keys), model: Anthropic::Beta::Organization::BetaServiceAccount, options: ) end |