Class: Anthropic::Resources::Organization::ServiceAccounts
- Inherits:
-
Object
- Object
- Anthropic::Resources::Organization::ServiceAccounts
- Defined in:
- lib/anthropic/resources/organization/service_accounts.rb,
lib/anthropic/resources/organization/service_accounts/workspaces.rb,
sig/anthropic/resources/organization/service_accounts.rbs,
sig/anthropic/resources/organization/service_accounts/workspaces.rbs
Defined Under Namespace
Classes: Workspaces
Instance Attribute Summary collapse
Instance Method Summary collapse
-
#archive(service_account_id, request_options: {}) ⇒ Anthropic::Models::Organization::ServiceAccount
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, request_options: {}) ⇒ Anthropic::Models::Organization::ServiceAccount
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, request_options: {}) ⇒ Anthropic::Internal::PageCursor<Anthropic::Models::Organization::ServiceAccount>
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, request_options: {}) ⇒ Anthropic::Models::Organization::ServiceAccount
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, request_options: {}) ⇒ Anthropic::Models::Organization::ServiceAccount
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.
206 207 208 209 |
# File 'lib/anthropic/resources/organization/service_accounts.rb', line 206 def initialize(client:) @client = client @workspaces = Anthropic::Resources::Organization::ServiceAccounts::Workspaces.new(client: client) end |
Instance Attribute Details
#workspaces ⇒ Anthropic::Resources::Organization::ServiceAccounts::Workspaces (readonly)
8 9 10 |
# File 'lib/anthropic/resources/organization/service_accounts.rb', line 8 def workspaces @workspaces end |
Instance Method Details
#archive(service_account_id, request_options: {}) ⇒ Anthropic::Models::Organization::ServiceAccount
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.
191 192 193 194 195 196 197 198 199 200 201 |
# File 'lib/anthropic/resources/organization/service_accounts.rb', line 191 def archive(service_account_id, params = {}) @client.request( span_name: Anthropic::Internal::Tracing::SpanName::ORGANIZATION_SERVICE_ACCOUNTS_ARCHIVE, span_attributes: {"anthropic.organization.service_account.id" => service_account_id}, span_route: "/v1/organizations/service_accounts/{service_account_id}/archive", method: :post, path: ["v1/organizations/service_accounts/%1$s/archive", service_account_id], model: Anthropic::Organization::ServiceAccount, options: params[:request_options] ) end |
#create(name:, description: nil, organization_role: nil, request_options: {}) ⇒ Anthropic::Models::Organization::ServiceAccount
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::Organization::ServiceAccountCreateParams for more details.
42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/anthropic/resources/organization/service_accounts.rb', line 42 def create(params) parsed, = Anthropic::Organization::ServiceAccountCreateParams.dump_request(params) @client.request( span_name: Anthropic::Internal::Tracing::SpanName::ORGANIZATION_SERVICE_ACCOUNTS_CREATE, span_created_id: "anthropic.organization.service_account.id", span_route: "/v1/organizations/service_accounts", method: :post, path: "v1/organizations/service_accounts", body: parsed, model: Anthropic::Organization::ServiceAccount, options: ) end |
#list(include_archived: nil, limit: nil, page: nil, request_options: {}) ⇒ Anthropic::Internal::PageCursor<Anthropic::Models::Organization::ServiceAccount>
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.
152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 |
# File 'lib/anthropic/resources/organization/service_accounts.rb', line 152 def list(params = {}) parsed, = Anthropic::Organization::ServiceAccountListParams.dump_request(params) query = Anthropic::Internal::Util.encode_query_params(parsed) @client.request( span_name: Anthropic::Internal::Tracing::SpanName::ORGANIZATION_SERVICE_ACCOUNTS_LIST, span_route: "/v1/organizations/service_accounts", span_query: %w[include_archived limit page], method: :get, path: "v1/organizations/service_accounts", query: query, page: Anthropic::Internal::PageCursor, model: Anthropic::Organization::ServiceAccount, options: ) end |
#retrieve(service_account_id, request_options: {}) ⇒ Anthropic::Models::Organization::ServiceAccount
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_...).
72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/anthropic/resources/organization/service_accounts.rb', line 72 def retrieve(service_account_id, params = {}) @client.request( span_name: Anthropic::Internal::Tracing::SpanName::ORGANIZATION_SERVICE_ACCOUNTS_RETRIEVE, span_attributes: {"anthropic.organization.service_account.id" => service_account_id}, span_route: "/v1/organizations/service_accounts/{service_account_id}", method: :get, path: ["v1/organizations/service_accounts/%1$s", service_account_id], model: Anthropic::Organization::ServiceAccount, options: params[:request_options] ) end |
#update(service_account_id, description: nil, organization_role: nil, request_options: {}) ⇒ Anthropic::Models::Organization::ServiceAccount
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::Organization::ServiceAccountUpdateParams for more details.
114 115 116 117 118 119 120 121 122 123 124 125 126 |
# File 'lib/anthropic/resources/organization/service_accounts.rb', line 114 def update(service_account_id, params = {}) parsed, = Anthropic::Organization::ServiceAccountUpdateParams.dump_request(params) @client.request( span_name: Anthropic::Internal::Tracing::SpanName::ORGANIZATION_SERVICE_ACCOUNTS_UPDATE, span_attributes: {"anthropic.organization.service_account.id" => service_account_id}, span_route: "/v1/organizations/service_accounts/{service_account_id}", method: :post, path: ["v1/organizations/service_accounts/%1$s", service_account_id], body: parsed, model: Anthropic::Organization::ServiceAccount, options: ) end |