Class: Anthropic::Resources::Beta::Organization::TelemetryDestinations::Workspaces

Inherits:
Object
  • Object
show all
Defined in:
lib/anthropic/resources/beta/organization/telemetry_destinations/workspaces.rb,
sig/anthropic/resources/beta/organization/telemetry_destinations/workspaces.rbs

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:



176
177
178
# File 'lib/anthropic/resources/beta/organization/telemetry_destinations/workspaces.rb', line 176

def initialize(client:)
  @client = client
end

Instance Method Details

#add(workspace_id, destination_id:, betas: nil, request_options: {}) ⇒ Anthropic::Models::Beta::Organization::TelemetryDestinations::BetaTelemetryDestinationWorkspace

Add one workspace to a destination's workspace list.

Under include the workspace's spans start going to the destination. Under exclude they stop. A list holds at most 1,000 workspaces.

Adding a workspace that is already on the list changes nothing and returns the existing entry. An archived workspace that isn't on the list yet can't be added. A destination whose workspaces.type is all doesn't have a list, so the API returns 400. To change which workspaces such a destination covers, update its workspaces.

See the OpenTelemetry export guide to learn more about choosing the workspaces of a destination.

Some parameter documentations has been truncated, see Models::Beta::Organization::TelemetryDestinations::WorkspaceAddParams for more details.

Parameters:

  • workspace_id (String) —

    Path param: ID of the workspace to add (wrkspc_...).

  • destination_id (String) —

    Path param: ID of the destination (tdst_...).

  • betas (Array<Symbol, String, Anthropic::Models::AnthropicBeta>) —

    Header param: This endpoint is in beta: requests must send

  • request_options (Anthropic::RequestOptions, Hash{Symbol=>Object}, nil)
  • destination_id: (String)
  • betas: (::Array[Anthropic::Models::anthropic_beta])
  • request_options: (Anthropic::request_opts)

Returns:

See Also:



90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# File 'lib/anthropic/resources/beta/organization/telemetry_destinations/workspaces.rb', line 90

def add(workspace_id, params)
  parsed, options =
    Anthropic::Beta::Organization::TelemetryDestinations::WorkspaceAddParams.dump_request(params)
  destination_id =
    parsed.delete(:destination_id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    qualifiers: {beta: "true"},
    span_name: Anthropic::Internal::Tracing::SpanName::ORGANIZATION_TELEMETRY_DESTINATIONS_WORKSPACES_ADD,
    span_attributes: {
      "anthropic.organization.telemetry_destination.id" => destination_id,
      "anthropic.organization.telemetry_destination.workspace.id" => workspace_id
    },
    span_route: "/v1/organizations/telemetry_destinations/{destination_id}/workspaces/{workspace_id}",
    method: :post,
    path: [
      "v1/organizations/telemetry_destinations/%1$s/workspaces/%2$s",
      destination_id,
      workspace_id
    ],
    headers: parsed.transform_keys(betas: "anthropic-beta"),
    model: Anthropic::Beta::Organization::TelemetryDestinations::BetaTelemetryDestinationWorkspace,
    options: {extra_headers: {"anthropic-beta" => "telemetry-destinations-2026-08-11"}, **options}
  )
end

#list(destination_id, limit: nil, page: nil, betas: nil, request_options: {}) ⇒ Anthropic::Internal::PageCursor<Anthropic::Models::Beta::Organization::TelemetryDestinations::BetaTelemetryDestinationWorkspace>

List the workspaces on a destination's workspace list, newest entry first.

A destination whose workspaces.type is all doesn't have a list, so its page is empty. The list includes archived workspaces.

See the OpenTelemetry export guide to learn more about choosing the workspaces of a destination.

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

Parameters:

  • destination_id (String) —

    Path param: ID of the destination (tdst_...).

  • limit (Integer) —

    Query param: Number of entries to return per page, between 1 and 1,000. Defaults

  • page (String) —

    Query param: Opaque cursor from a previous response's next_page. Leave it out

  • betas (Array<Symbol, String, Anthropic::Models::AnthropicBeta>) —

    Header param: This endpoint is in beta: requests must send

  • request_options (Anthropic::RequestOptions, Hash{Symbol=>Object}, nil)
  • limit: (Integer)
  • page: (String)
  • betas: (::Array[Anthropic::Models::anthropic_beta])
  • request_options: (Anthropic::request_opts)

Returns:

See Also:



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/anthropic/resources/beta/organization/telemetry_destinations/workspaces.rb', line 37

def list(destination_id, params = {})
  query_params = [:limit, :page]
  parsed, options =
    Anthropic::Beta::Organization::TelemetryDestinations::WorkspaceListParams.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_TELEMETRY_DESTINATIONS_WORKSPACES_LIST,
    span_attributes: {"anthropic.organization.telemetry_destination.id" => destination_id},
    span_route: "/v1/organizations/telemetry_destinations/{destination_id}/workspaces",
    span_query: %w[limit page],
    method: :get,
    path: ["v1/organizations/telemetry_destinations/%1$s/workspaces", destination_id],
    query: query,
    headers: parsed.except(*query_params).transform_keys(betas: "anthropic-beta"),
    page: Anthropic::Internal::PageCursor,
    model: Anthropic::Beta::Organization::TelemetryDestinations::BetaTelemetryDestinationWorkspace,
    options: {extra_headers: {"anthropic-beta" => "telemetry-destinations-2026-08-11"}, **options}
  )
end

#remove(workspace_id, destination_id:, betas: nil, request_options: {}) ⇒ Anthropic::Models::Beta::Organization::TelemetryDestinations::BetaDeletedTelemetryDestinationWorkspace

Remove one workspace from a destination's workspace list.

Under include the workspace's spans stop going to the destination. Under exclude they start. An archived workspace can be removed too.

The API returns 404 when the workspace isn't on the list. A destination whose workspaces.type is all doesn't have a list, so the API returns 400.

See the OpenTelemetry export guide to learn more about choosing the workspaces of a destination.

Some parameter documentations has been truncated, see Models::Beta::Organization::TelemetryDestinations::WorkspaceRemoveParams for more details.

Parameters:

  • workspace_id (String) —

    Path param: ID of the workspace to remove (wrkspc_...).

  • destination_id (String) —

    Path param: ID of the destination (tdst_...).

  • betas (Array<Symbol, String, Anthropic::Models::AnthropicBeta>) —

    Header param: This endpoint is in beta: requests must send

  • request_options (Anthropic::RequestOptions, Hash{Symbol=>Object}, nil)
  • destination_id: (String)
  • betas: (::Array[Anthropic::Models::anthropic_beta])
  • request_options: (Anthropic::request_opts)

Returns:

See Also:



146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
# File 'lib/anthropic/resources/beta/organization/telemetry_destinations/workspaces.rb', line 146

def remove(workspace_id, params)
  parsed, options =
    Anthropic::Beta::Organization::TelemetryDestinations::WorkspaceRemoveParams.dump_request(params)
  destination_id =
    parsed.delete(:destination_id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    qualifiers: {beta: "true"},
    span_name: Anthropic::Internal::Tracing::SpanName::ORGANIZATION_TELEMETRY_DESTINATIONS_WORKSPACES_REMOVE,
    span_attributes: {
      "anthropic.organization.telemetry_destination.id" => destination_id,
      "anthropic.organization.telemetry_destination.workspace.id" => workspace_id
    },
    span_route: "/v1/organizations/telemetry_destinations/{destination_id}/workspaces/{workspace_id}",
    method: :delete,
    path: [
      "v1/organizations/telemetry_destinations/%1$s/workspaces/%2$s",
      destination_id,
      workspace_id
    ],
    headers: parsed.transform_keys(betas: "anthropic-beta"),
    model: Anthropic::Beta::Organization::TelemetryDestinations::BetaDeletedTelemetryDestinationWorkspace,
    options: {extra_headers: {"anthropic-beta" => "telemetry-destinations-2026-08-11"}, **options}
  )
end