Class: Anthropic::Resources::Beta::Tunnels
- Inherits:
-
Object
- Object
- Anthropic::Resources::Beta::Tunnels
- Defined in:
- lib/anthropic/resources/beta/tunnels.rb,
lib/anthropic/resources/beta/tunnels/certificates.rb,
sig/anthropic/resources/beta/tunnels.rbs,
sig/anthropic/resources/beta/tunnels/certificates.rbs
Defined Under Namespace
Classes: Certificates
Instance Attribute Summary collapse
Instance Method Summary collapse
-
#archive(tunnel_id, betas: nil, request_options: {}) ⇒ Anthropic::Models::Beta::BetaTunnel
The Tunnels API is in research preview.
-
#create(display_name: nil, betas: nil, request_options: {}) ⇒ Anthropic::Models::Beta::BetaTunnel
The Tunnels API is in research preview.
-
#initialize(client:) ⇒ Tunnels
constructor
private
A new instance of Tunnels.
-
#list(include_archived: nil, limit: nil, page: nil, betas: nil, request_options: {}) ⇒ Anthropic::Internal::PageCursor<Anthropic::Models::Beta::BetaTunnel>
Some parameter documentations has been truncated, see Models::Beta::TunnelListParams for more details.
-
#retrieve(tunnel_id, betas: nil, request_options: {}) ⇒ Anthropic::Models::Beta::BetaTunnel
The Tunnels API is in research preview.
-
#reveal_token(tunnel_id, betas: nil, request_options: {}) ⇒ Anthropic::Models::Beta::BetaTunnelToken
The Tunnels API is in research preview.
-
#rotate_token(tunnel_id, reason: nil, betas: nil, request_options: {}) ⇒ Anthropic::Models::Beta::BetaTunnelToken
The Tunnels API is in research preview.
Constructor Details
#initialize(client:) ⇒ Tunnels
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 Tunnels.
215 216 217 218 |
# File 'lib/anthropic/resources/beta/tunnels.rb', line 215 def initialize(client:) @client = client @certificates = Anthropic::Resources::Beta::Tunnels::Certificates.new(client: client) end |
Instance Attribute Details
#certificates ⇒ Anthropic::Resources::Beta::Tunnels::Certificates (readonly)
8 9 10 |
# File 'lib/anthropic/resources/beta/tunnels.rb', line 8 def certificates @certificates end |
Instance Method Details
#archive(tunnel_id, betas: nil, request_options: {}) ⇒ Anthropic::Models::Beta::BetaTunnel
The Tunnels API is in research preview. It requires the
anthropic-beta: mcp-tunnels-2026-06-22 header and may change without a
deprecation period. It supersedes the Admin API endpoints at
/v1/organizations/tunnels, which remain available during a migration window.
Archives a tunnel. Archival is irreversible: every non-archived certificate on the tunnel is archived in the same operation, the hostname is retired and never re-allocated, and the tunnel token is invalidated. Retrying against an already-archived tunnel returns the existing record unchanged.
134 135 136 137 138 139 140 141 142 143 |
# File 'lib/anthropic/resources/beta/tunnels.rb', line 134 def archive(tunnel_id, params = {}) parsed, = Anthropic::Beta::TunnelArchiveParams.dump_request(params) @client.request( method: :post, path: ["v1/tunnels/%1$s/archive?beta=true", tunnel_id], headers: parsed.transform_keys(betas: "anthropic-beta"), model: Anthropic::Beta::BetaTunnel, options: {extra_headers: {"anthropic-beta" => "mcp-tunnels-2026-06-22"}, **} ) end |
#create(display_name: nil, betas: nil, request_options: {}) ⇒ Anthropic::Models::Beta::BetaTunnel
The Tunnels API is in research preview. It requires the
anthropic-beta: mcp-tunnels-2026-06-22 header and may change without a
deprecation period. It supersedes the Admin API endpoints at
/v1/organizations/tunnels, which remain available during a migration window.
Creates a tunnel. Creation allocates a fresh hostname and provisions the tunnel; it is not idempotent. The new tunnel rejects MCP traffic until at least one CA certificate is added.
30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/anthropic/resources/beta/tunnels.rb', line 30 def create(params = {}) parsed, = Anthropic::Beta::TunnelCreateParams.dump_request(params) header_params = {betas: "anthropic-beta"} @client.request( method: :post, path: "v1/tunnels?beta=true", headers: parsed.slice(*header_params.keys).transform_keys(header_params), body: parsed.except(*header_params.keys), model: Anthropic::Beta::BetaTunnel, options: {extra_headers: {"anthropic-beta" => "mcp-tunnels-2026-06-22"}, **} ) end |
#list(include_archived: nil, limit: nil, page: nil, betas: nil, request_options: {}) ⇒ Anthropic::Internal::PageCursor<Anthropic::Models::Beta::BetaTunnel>
Some parameter documentations has been truncated, see Models::Beta::TunnelListParams for more details.
The Tunnels API is in research preview. It requires the
anthropic-beta: mcp-tunnels-2026-06-22 header and may change without a
deprecation period. It supersedes the Admin API endpoints at
/v1/organizations/tunnels, which remain available during a migration window.
Lists tunnels. Results are ordered by creation time, newest first; archived tunnels are excluded unless include_archived is set.
98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
# File 'lib/anthropic/resources/beta/tunnels.rb', line 98 def list(params = {}) query_params = [:include_archived, :limit, :page] parsed, = Anthropic::Beta::TunnelListParams.dump_request(params) query = Anthropic::Internal::Util.encode_query_params(parsed.slice(*query_params)) @client.request( method: :get, path: "v1/tunnels?beta=true", query: query, headers: parsed.except(*query_params).transform_keys(betas: "anthropic-beta"), page: Anthropic::Internal::PageCursor, model: Anthropic::Beta::BetaTunnel, options: {extra_headers: {"anthropic-beta" => "mcp-tunnels-2026-06-22"}, **} ) end |
#retrieve(tunnel_id, betas: nil, request_options: {}) ⇒ Anthropic::Models::Beta::BetaTunnel
The Tunnels API is in research preview. It requires the
anthropic-beta: mcp-tunnels-2026-06-22 header and may change without a
deprecation period. It supersedes the Admin API endpoints at
/v1/organizations/tunnels, which remain available during a migration window.
Fetches a tunnel by ID.
61 62 63 64 65 66 67 68 69 70 |
# File 'lib/anthropic/resources/beta/tunnels.rb', line 61 def retrieve(tunnel_id, params = {}) parsed, = Anthropic::Beta::TunnelRetrieveParams.dump_request(params) @client.request( method: :get, path: ["v1/tunnels/%1$s?beta=true", tunnel_id], headers: parsed.transform_keys(betas: "anthropic-beta"), model: Anthropic::Beta::BetaTunnel, options: {extra_headers: {"anthropic-beta" => "mcp-tunnels-2026-06-22"}, **} ) end |
#reveal_token(tunnel_id, betas: nil, request_options: {}) ⇒ Anthropic::Models::Beta::BetaTunnelToken
The Tunnels API is in research preview. It requires the
anthropic-beta: mcp-tunnels-2026-06-22 header and may change without a
deprecation period. It supersedes the Admin API endpoints at
/v1/organizations/tunnels, which remain available during a migration window.
Reveals a tunnel's connector token. The value is fetched live on each call; Anthropic does not store it. Repeated calls return the same value until the token is rotated. Exposed as POST so the token does not appear in intermediary access logs.
166 167 168 169 170 171 172 173 174 175 |
# File 'lib/anthropic/resources/beta/tunnels.rb', line 166 def reveal_token(tunnel_id, params = {}) parsed, = Anthropic::Beta::TunnelRevealTokenParams.dump_request(params) @client.request( method: :post, path: ["v1/tunnels/%1$s/reveal_token?beta=true", tunnel_id], headers: parsed.transform_keys(betas: "anthropic-beta"), model: Anthropic::Beta::BetaTunnelToken, options: {extra_headers: {"anthropic-beta" => "mcp-tunnels-2026-06-22"}, **} ) end |
#rotate_token(tunnel_id, reason: nil, betas: nil, request_options: {}) ⇒ Anthropic::Models::Beta::BetaTunnelToken
The Tunnels API is in research preview. It requires the
anthropic-beta: mcp-tunnels-2026-06-22 header and may change without a
deprecation period. It supersedes the Admin API endpoints at
/v1/organizations/tunnels, which remain available during a migration window.
Rotates a tunnel's connector token. Rotation invalidates the current token for new connections and returns a fresh value; established connections are not severed. A connector restarted after rotation must use the new value.
199 200 201 202 203 204 205 206 207 208 209 210 |
# File 'lib/anthropic/resources/beta/tunnels.rb', line 199 def rotate_token(tunnel_id, params = {}) parsed, = Anthropic::Beta::TunnelRotateTokenParams.dump_request(params) header_params = {betas: "anthropic-beta"} @client.request( method: :post, path: ["v1/tunnels/%1$s/rotate_token?beta=true", tunnel_id], headers: parsed.slice(*header_params.keys).transform_keys(header_params), body: parsed.except(*header_params.keys), model: Anthropic::Beta::BetaTunnelToken, options: {extra_headers: {"anthropic-beta" => "mcp-tunnels-2026-06-22"}, **} ) end |