Class: Anthropic::Resources::Organization::Workspaces

Inherits:
Object
  • Object
show all
Defined in:
lib/anthropic/resources/organization/workspaces.rb,
lib/anthropic/resources/organization/workspaces/members.rb,
lib/anthropic/resources/organization/workspaces/rate_limits.rb,
lib/anthropic/resources/organization/workspaces/service_accounts.rb,
sig/anthropic/resources/organization/workspaces.rbs,
sig/anthropic/resources/organization/workspaces/members.rbs,
sig/anthropic/resources/organization/workspaces/rate_limits.rbs,
sig/anthropic/resources/organization/workspaces/service_accounts.rbs

Defined Under Namespace

Classes: Members, RateLimits, ServiceAccounts

Instance Attribute Summary collapse

Instance Method Summary collapse

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.

Parameters:



204
205
206
207
208
209
# File 'lib/anthropic/resources/organization/workspaces.rb', line 204

def initialize(client:)
  @client = client
  @rate_limits = Anthropic::Resources::Organization::Workspaces::RateLimits.new(client: client)
  @members = Anthropic::Resources::Organization::Workspaces::Members.new(client: client)
  @service_accounts = Anthropic::Resources::Organization::Workspaces::ServiceAccounts.new(client: client)
end

Instance Attribute Details

#members ⇒ Anthropic::Resources::Organization::Workspaces::Members (readonly)



11
12
13
# File 'lib/anthropic/resources/organization/workspaces.rb', line 11

def members
  @members
end

#rate_limits ⇒ Anthropic::Resources::Organization::Workspaces::RateLimits (readonly)



8
9
10
# File 'lib/anthropic/resources/organization/workspaces.rb', line 8

def rate_limits
  @rate_limits
end

#service_accounts ⇒ Anthropic::Resources::Organization::Workspaces::ServiceAccounts (readonly)



14
15
16
# File 'lib/anthropic/resources/organization/workspaces.rb', line 14

def service_accounts
  @service_accounts
end

Instance Method Details

#archive(workspace_id, request_options: {}) ⇒ Anthropic::Models::Organization::Workspace

Archive Workspace

Parameters:

  • workspace_id (String)
  • request_options (Anthropic::RequestOptions, Hash{Symbol=>Object}, nil)
  • request_options: (Anthropic::request_opts)

Returns:

Raises:

See Also:



189
190
191
192
193
194
195
196
197
198
199
# File 'lib/anthropic/resources/organization/workspaces.rb', line 189

def archive(workspace_id, params = {})
  @client.request(
    span_name: Anthropic::Internal::Tracing::SpanName::ORGANIZATION_WORKSPACES_ARCHIVE,
    span_attributes: {"anthropic.organization.workspace.id" => workspace_id},
    span_route: "/v1/organizations/workspaces/{workspace_id}/archive",
    method: :post,
    path: ["v1/organizations/workspaces/%1$s/archive", workspace_id],
    model: Anthropic::Organization::Workspace,
    options: params[:request_options]
  )
end

#create(name:, data_residency: nil, display_color: nil, external_key_id: nil, tags: nil, user_profile_id: nil, request_options: {}) ⇒ Anthropic::Models::Organization::Workspace

Create Workspace

Some parameter documentations has been truncated, see Models::Organization::WorkspaceCreateParams for more details.

Parameters:

  • name (String) —

    Name of the Workspace.

  • data_residency (Anthropic::Models::Organization::DataResidencyCreateConfig, nil) —

    Data residency configuration for the workspace. If omitted, defaults to

  • display_color (String, nil) —

    Hex color code representing the Workspace in the Anthropic Console.

  • external_key_id (String, nil) —

    ID of the customer-managed encryption key (CMEK) configuration to use for this

  • tags (Hash{Symbol=>String}, nil) —

    User-defined tags as string key-value pairs. Keys may not begin with anthropic

  • user_profile_id (String, nil) —

    ID of a user profile to attach to the Workspace. Every inference request through

  • request_options (Anthropic::RequestOptions, Hash{Symbol=>Object}, nil)
  • name: (String)
  • data_residency: (Anthropic::Organization::DataResidencyCreateConfig, nil)
  • display_color: (String, nil)
  • external_key_id: (String, nil)
  • tags: (::Hash[Symbol, String], nil)
  • user_profile_id: (String, nil)
  • request_options: (Anthropic::request_opts)

Returns:

Raises:

See Also:



49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/anthropic/resources/organization/workspaces.rb', line 49

def create(params)
  parsed, options = Anthropic::Organization::WorkspaceCreateParams.dump_request(params)
  @client.request(
    span_name: Anthropic::Internal::Tracing::SpanName::ORGANIZATION_WORKSPACES_CREATE,
    span_created_id: "anthropic.organization.workspace.id",
    span_route: "/v1/organizations/workspaces",
    method: :post,
    path: "v1/organizations/workspaces",
    body: parsed,
    model: Anthropic::Organization::Workspace,
    options: options
  )
end

#list(after_id: nil, before_id: nil, ids: nil, include_archived: nil, include_default: nil, limit: nil, request_options: {}) ⇒ Anthropic::Internal::Page<Anthropic::Models::Organization::Workspace>

List Workspaces

Some parameter documentations has been truncated, see Models::Organization::WorkspaceListParams for more details.

Parameters:

  • after_id (String) —

    ID of the object to use as a cursor for pagination. When provided, returns the p

  • before_id (String) —

    ID of the object to use as a cursor for pagination. When provided, returns the p

  • ids (Array<String>) —

    Only the Workspaces with these IDs, at most 100. include_archived and

  • include_archived (Boolean) —

    Whether to include Workspaces that have been archived in the response

  • include_default (Boolean) —

    Whether to include the organization's default Workspace in the response

  • limit (Integer) —

    Number of items to return per page.

  • request_options (Anthropic::RequestOptions, Hash{Symbol=>Object}, nil)
  • after_id: (String)
  • before_id: (String)
  • ids: (::Array[String])
  • include_archived: (Boolean)
  • include_default: (Boolean)
  • limit: (Integer)
  • request_options: (Anthropic::request_opts)

Returns:

See Also:



160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
# File 'lib/anthropic/resources/organization/workspaces.rb', line 160

def list(params = {})
  parsed, options = Anthropic::Organization::WorkspaceListParams.dump_request(params)
  query = Anthropic::Internal::Util.encode_query_params(parsed)
  @client.request(
    span_name: Anthropic::Internal::Tracing::SpanName::ORGANIZATION_WORKSPACES_LIST,
    span_route: "/v1/organizations/workspaces",
    span_query: %w[after_id before_id ids include_archived include_default limit],
    method: :get,
    path: "v1/organizations/workspaces",
    query: query,
    page: Anthropic::Internal::Page,
    model: Anthropic::Organization::Workspace,
    options: options
  )
end

#retrieve(workspace_id, request_options: {}) ⇒ Anthropic::Models::Organization::Workspace

Get Workspace

Parameters:

  • workspace_id (String) —

    ID of the Workspace.

  • request_options (Anthropic::RequestOptions, Hash{Symbol=>Object}, nil)
  • request_options: (Anthropic::request_opts)

Returns:

See Also:



74
75
76
77
78
79
80
81
82
83
84
# File 'lib/anthropic/resources/organization/workspaces.rb', line 74

def retrieve(workspace_id, params = {})
  @client.request(
    span_name: Anthropic::Internal::Tracing::SpanName::ORGANIZATION_WORKSPACES_RETRIEVE,
    span_attributes: {"anthropic.organization.workspace.id" => workspace_id},
    span_route: "/v1/organizations/workspaces/{workspace_id}",
    method: :get,
    path: ["v1/organizations/workspaces/%1$s", workspace_id],
    model: Anthropic::Organization::Workspace,
    options: params[:request_options]
  )
end

#update(workspace_id, data_residency: nil, display_color: nil, external_key_id: nil, name: nil, tags: nil, user_profile_id: nil, request_options: {}) ⇒ Anthropic::Models::Organization::Workspace

Update Workspace

Some parameter documentations has been truncated, see Models::Organization::WorkspaceUpdateParams for more details.

Parameters:

  • workspace_id (String)
  • data_residency (Anthropic::Models::Organization::DataResidencyUpdateConfig, nil) —

    Data residency configuration for the workspace.

  • display_color (String) —

    Hex color code representing the Workspace in the Anthropic Console.

  • external_key_id (String) —

    ID of the customer-managed encryption key (CMEK) configuration to use for this

  • name (String) —

    Name of the Workspace.

  • tags (Hash{Symbol=>String, nil}, nil) —

    User-defined tags as string key-value pairs. Keys may not begin with anthropic

  • user_profile_id (String) —

    ID of a user profile to attach to the Workspace. Every inference request through

  • request_options (Anthropic::RequestOptions, Hash{Symbol=>Object}, nil)
  • data_residency: (Anthropic::Organization::DataResidencyUpdateConfig, nil)
  • display_color: (String)
  • external_key_id: (String)
  • name: (String)
  • tags: (::Hash[Symbol, String?], nil)
  • user_profile_id: (String)
  • request_options: (Anthropic::request_opts)

Returns:

Raises:

See Also:



122
123
124
125
126
127
128
129
130
131
132
133
134
# File 'lib/anthropic/resources/organization/workspaces.rb', line 122

def update(workspace_id, params = {})
  parsed, options = Anthropic::Organization::WorkspaceUpdateParams.dump_request(params)
  @client.request(
    span_name: Anthropic::Internal::Tracing::SpanName::ORGANIZATION_WORKSPACES_UPDATE,
    span_attributes: {"anthropic.organization.workspace.id" => workspace_id},
    span_route: "/v1/organizations/workspaces/{workspace_id}",
    method: :post,
    path: ["v1/organizations/workspaces/%1$s", workspace_id],
    body: parsed,
    model: Anthropic::Organization::Workspace,
    options: options
  )
end