Class: Anthropic::Resources::Beta::Organization::Workspaces::ServiceAccounts
- Inherits:
-
Object
- Object
- Anthropic::Resources::Beta::Organization::Workspaces::ServiceAccounts
- Defined in:
- lib/anthropic/resources/beta/organization/workspaces/service_accounts.rb,
sig/anthropic/resources/beta/organization/workspaces/service_accounts.rbs
Instance Method Summary collapse
-
#add(workspace_id, service_account_id:, workspace_role:, betas: nil, request_options: {}) ⇒ Anthropic::Models::Beta::Organization::BetaServiceAccountWorkspaceMember
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(workspace_id, limit: nil, page: nil, betas: nil, request_options: {}) ⇒ Anthropic::Internal::PageCursor<Anthropic::Models::Beta::Organization::BetaServiceAccountWorkspaceMember>
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(service_account_id, workspace_id:, betas: nil, request_options: {}) ⇒ Anthropic::Models::Beta::Organization::Workspaces::ServiceAccountRemoveResponse
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, workspace_id:, betas: nil, request_options: {}) ⇒ Anthropic::Models::Beta::Organization::BetaServiceAccountWorkspaceMember
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, workspace_id:, workspace_role:, betas: nil, request_options: {}) ⇒ Anthropic::Models::Beta::Organization::BetaServiceAccountWorkspaceMember
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.
278 279 280 |
# File 'lib/anthropic/resources/beta/organization/workspaces/service_accounts.rb', line 278 def initialize(client:) @client = client end |
Instance Method Details
#add(workspace_id, service_account_id:, workspace_role:, betas: nil, request_options: {}) ⇒ Anthropic::Models::Beta::Organization::BetaServiceAccountWorkspaceMember
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.
Add a service account to a workspace with the given workspace_role.
The role determines what the service account can do in the workspace and which
workspace-scoped permissions it can be granted when authenticating through
federation. Every service account is already an implicit workspace_user member
of the default workspace; adding it explicitly assigns a chosen role. If the
service account is already an explicit member of the workspace, its
workspace_role is replaced with the value supplied here. Archived workspaces
return 400. Archived service accounts cannot be added and are rejected.
202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 |
# File 'lib/anthropic/resources/beta/organization/workspaces/service_accounts.rb', line 202 def add(workspace_id, params) parsed, = Anthropic::Beta::Organization::Workspaces::ServiceAccountAddParams.dump_request(params) header_params = {betas: "anthropic-beta"} @client.request( qualifiers: {beta: "true"}, span_name: Anthropic::Internal::Tracing::SpanName::ORGANIZATION_WORKSPACES_SERVICE_ACCOUNTS_ADD, span_attributes: {"anthropic.organization.workspace.id" => workspace_id}, span_created_id: {"anthropic.organization.workspace.service_account.id" => :service_account_id}, span_route: "/v1/organizations/workspaces/{workspace_id}/service_accounts", method: :post, path: ["v1/organizations/workspaces/%1$s/service_accounts", workspace_id], headers: parsed.slice(*header_params.keys).transform_keys(header_params), body: parsed.except(*header_params.keys), model: Anthropic::Beta::Organization::BetaServiceAccountWorkspaceMember, options: ) end |
#list(workspace_id, limit: nil, page: nil, betas: nil, request_options: {}) ⇒ Anthropic::Internal::PageCursor<Anthropic::Models::Beta::Organization::BetaServiceAccountWorkspaceMember>
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 the service accounts that are members of a workspace.
Each entry includes the service account's workspace_role. Use limit and the
next_page cursor to paginate. Archived workspaces return 400; use
GET /service_accounts/{id}/workspaces to audit memberships of an archived
workspace. The implicit default-workspace membership is not included in this
list. Memberships of archived service accounts are omitted from the results.
149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 |
# File 'lib/anthropic/resources/beta/organization/workspaces/service_accounts.rb', line 149 def list(workspace_id, params = {}) query_params = [:limit, :page] parsed, = Anthropic::Beta::Organization::Workspaces::ServiceAccountListParams.dump_request(params) query = Anthropic::Internal::Util.encode_query_params(parsed.slice(*query_params)) @client.request( qualifiers: {beta: "true"}, span_name: Anthropic::Internal::Tracing::SpanName::ORGANIZATION_WORKSPACES_SERVICE_ACCOUNTS_LIST, span_attributes: {"anthropic.organization.workspace.id" => workspace_id}, span_route: "/v1/organizations/workspaces/{workspace_id}/service_accounts", span_query: %w[limit page], method: :get, path: ["v1/organizations/workspaces/%1$s/service_accounts", workspace_id], query: query, headers: parsed.except(*query_params).transform_keys(betas: "anthropic-beta"), page: Anthropic::Internal::PageCursor, model: Anthropic::Beta::Organization::BetaServiceAccountWorkspaceMember, options: ) end |
#remove(service_account_id, workspace_id:, betas: nil, request_options: {}) ⇒ Anthropic::Models::Beta::Organization::Workspaces::ServiceAccountRemoveResponse
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.
Remove a service account from a workspace.
Removal is idempotent (returns 200 even if the membership was already removed).
A DELETE against the implicit default-workspace membership returns 200 but is a
no-op and the membership persists; deleting an explicit default-workspace row
reverts to the implicit workspace_user membership. Archived workspaces
return 400.
248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 |
# File 'lib/anthropic/resources/beta/organization/workspaces/service_accounts.rb', line 248 def remove(service_account_id, params) parsed, = Anthropic::Beta::Organization::Workspaces::ServiceAccountRemoveParams.dump_request(params) workspace_id = parsed.delete(:workspace_id) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( qualifiers: {beta: "true"}, span_name: Anthropic::Internal::Tracing::SpanName::ORGANIZATION_WORKSPACES_SERVICE_ACCOUNTS_REMOVE, span_attributes: { "anthropic.organization.workspace.id" => workspace_id, "anthropic.organization.workspace.service_account.id" => service_account_id }, span_route: "/v1/organizations/workspaces/{workspace_id}/service_accounts/{service_account_id}", method: :delete, path: [ "v1/organizations/workspaces/%1$s/service_accounts/%2$s", workspace_id, service_account_id ], headers: parsed.transform_keys(betas: "anthropic-beta"), model: Anthropic::Models::Beta::Organization::Workspaces::ServiceAccountRemoveResponse, options: ) end |
#retrieve(service_account_id, workspace_id:, betas: nil, request_options: {}) ⇒ Anthropic::Models::Beta::Organization::BetaServiceAccountWorkspaceMember
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's membership in a workspace.
Returns the membership record, including the service account's workspace_role
in this workspace. Archived workspaces return 400. For the default workspace,
returns the implicit (implicit: true) membership when no explicit membership
exists; an explicitly added membership is returned with its assigned role. An
archived service account returns 404.
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/anthropic/resources/beta/organization/workspaces/service_accounts.rb', line 35 def retrieve(service_account_id, params) parsed, = Anthropic::Beta::Organization::Workspaces::ServiceAccountRetrieveParams.dump_request(params) workspace_id = parsed.delete(:workspace_id) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( qualifiers: {beta: "true"}, span_name: Anthropic::Internal::Tracing::SpanName::ORGANIZATION_WORKSPACES_SERVICE_ACCOUNTS_RETRIEVE, span_attributes: { "anthropic.organization.workspace.id" => workspace_id, "anthropic.organization.workspace.service_account.id" => service_account_id }, span_route: "/v1/organizations/workspaces/{workspace_id}/service_accounts/{service_account_id}", method: :get, path: [ "v1/organizations/workspaces/%1$s/service_accounts/%2$s", workspace_id, service_account_id ], headers: parsed.transform_keys(betas: "anthropic-beta"), model: Anthropic::Beta::Organization::BetaServiceAccountWorkspaceMember, options: ) end |
#update(service_account_id, workspace_id:, workspace_role:, betas: nil, request_options: {}) ⇒ Anthropic::Models::Beta::Organization::BetaServiceAccountWorkspaceMember
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.
Change a service account's role in a workspace.
The new workspace_role replaces the current one. Only explicit memberships can
be updated; to set a role on the implicit default-workspace membership, add the
service account explicitly with
POST /workspaces/{workspace_id}/service_accounts. Archived workspaces
return 400. Archived service accounts cannot be updated and are rejected.
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
# File 'lib/anthropic/resources/beta/organization/workspaces/service_accounts.rb', line 92 def update(service_account_id, params) parsed, = Anthropic::Beta::Organization::Workspaces::ServiceAccountUpdateParams.dump_request(params) workspace_id = parsed.delete(:workspace_id) do raise ArgumentError.new("missing required path argument #{_1}") end header_params = {betas: "anthropic-beta"} @client.request( qualifiers: {beta: "true"}, span_name: Anthropic::Internal::Tracing::SpanName::ORGANIZATION_WORKSPACES_SERVICE_ACCOUNTS_UPDATE, span_attributes: { "anthropic.organization.workspace.id" => workspace_id, "anthropic.organization.workspace.service_account.id" => service_account_id }, span_route: "/v1/organizations/workspaces/{workspace_id}/service_accounts/{service_account_id}", method: :post, path: [ "v1/organizations/workspaces/%1$s/service_accounts/%2$s", workspace_id, service_account_id ], headers: parsed.slice(*header_params.keys).transform_keys(header_params), body: parsed.except(*header_params.keys), model: Anthropic::Beta::Organization::BetaServiceAccountWorkspaceMember, options: ) end |