
    Áj                       d dl mZ d dlmZmZ d dlmZ d dlZddlm	Z	 ddl
mZmZmZmZmZmZmZ ddlmZmZmZmZmZ dd	lmZ dd
lmZmZ ddlmZmZ ddl m!Z!m"Z"m#Z#m$Z$m%Z%m&Z& ddl'm(Z(m)Z) ddl*m+Z+m,Z,m-Z- ddl.m/Z/m0Z0 ddl1m2Z2 ddl3m4Z4 ddl5m6Z6 ddgZ7 G d de      Z8 G d de      Z9 G d d      Z: G d d      Z; G d d      Z< G d d      Z=y)     )annotations)ListOptional)chainN   )_legacy_response)BodyOmitQueryHeadersNotGivenomit	not_given)is_givenpath_templatemaybe_transformstrip_not_givenasync_maybe_transform)cached_property)SyncAPIResourceAsyncAPIResource)to_streamed_response_wrapper"async_to_streamed_response_wrapper   )CertificatesAsyncCertificatesCertificatesWithRawResponse AsyncCertificatesWithRawResponse!CertificatesWithStreamingResponse&AsyncCertificatesWithStreamingResponse)SyncPageCursorAsyncPageCursor)tunnel_list_paramstunnel_create_paramstunnel_rotate_token_params)AsyncPaginatormake_request_options)
BetaTunnel)AnthropicBetaParam)BetaTunnelTokenTunnelsAsyncTunnelsc            	      x   e Zd Zedd       Zedd       Zedd       Zeeddded	 	 	 	 	 	 	 	 	 	 	 	 	 ddZ	eddded	 	 	 	 	 	 	 	 	 	 	 	 	 ddZ
eeeeddded		 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd
Zeddded	 	 	 	 	 	 	 	 	 	 	 	 	 ddZeddded	 	 	 	 	 	 	 	 	 	 	 	 	 ddZeeddded	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddZy)r+   c                ,    t        | j                        S N)r   _clientselfs    O/tmp/pip-target-k_scjv0h/lib/python/anthropic/resources/beta/tunnels/tunnels.pycertificateszTunnels.certificates#   s    DLL))    c                    t        |       S a  
        This property can be used as a prefix for any HTTP method call to return
        the raw response object instead of the parsed content.

        For more information, see https://www.github.com/anthropics/anthropic-sdk-python#accessing-raw-response-data-eg-headers
        )TunnelsWithRawResponser1   s    r3   with_raw_responsezTunnels.with_raw_response'   s     &d++r5   c                    t        |       S z
        An alternative to `.with_raw_response` that doesn't eagerly read the response body.

        For more information, see https://www.github.com/anthropics/anthropic-sdk-python#with_streaming_response
        )TunnelsWithStreamingResponser1   s    r3   with_streaming_responsezTunnels.with_streaming_response1   s     ,D11r5   Ndisplay_namebetasextra_headersextra_query
extra_bodytimeoutc          
     $   i t        dt        |      r#dj                  t        d |D        dg            nt        i      |xs i }ddi|xs i }| j                  dt        d|it        j                        t        ||||      t              S )	  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.

        Args:
          display_name: Optional human-readable name for the tunnel (1-255 characters).

          betas: Optional header to specify the beta version(s) you want to use.

          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        anthropic-beta,c              3  2   K   | ]  }t        |        y wr/   str.0es     r3   	<genexpr>z!Tunnels.create.<locals>.<genexpr>a        5Lc!f5L   mcp-tunnels-2026-06-22/v1/tunnels?beta=truer?   rA   rB   rC   rD   bodyoptionscast_to)r   r   joinr   r   _postr   r$   TunnelCreateParamsr'   r(   r2   r?   r@   rA   rB   rC   rD   s          r3   createzTunnels.create:   s    H	
$ '*hhu5Le5LOgNh/i&j"	
 "	
 *+C]H[Y[]zz# .,!?AUAhAhi(+Q[el   
 	
r5   r@   rA   rB   rC   rD   c          
     $   |st        d|      i t        dt        |      r#dj                  t	        d |D        dg            nt
        i      |xs i }ddi|xs i }| j                  t        d|      t        ||||      t        	      S )
  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.

        Args:
          betas: Optional header to specify the beta version(s) you want to use.

          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        8Expected a non-empty value for `tunnel_id` but received rG   rH   c              3  2   K   | ]  }t        |        y wr/   rJ   rL   s     r3   rO   z#Tunnels.retrieve.<locals>.<genexpr>   rP   rQ   rR   !/v1/tunnels/{tunnel_id}?beta=true	tunnel_idrT   rW   rX   

ValueErrorr   r   rY   r   r   _getr   r'   r(   r2   re   r@   rA   rB   rC   rD   s          r3   retrievezTunnels.retriever   s    @ WXaWdeff	
$ '*hhu5Le5LOgNh/i&j"	
 "	
 *+C]H[Y[]yy=S(+Q[el   
 	
r5   include_archivedlimitpager@   rA   rB   rC   rD   c               @   i t        dt        |      r#dj                  t        d |D        dg            nt        i      |xs i }ddi|xs i }| j                  dt        t           t        ||||t        |||dt        j                              t              S )	Q  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.

        Args:
          include_archived: Whether to include archived tunnels in the results. Defaults to false.

          limit: Maximum number of tunnels to return per page. Defaults to 20, maximum 1000.

          page: Opaque pagination cursor from a previous `list_tunnels` response.

          betas: Optional header to specify the beta version(s) you want to use.

          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        rG   rH   c              3  2   K   | ]  }t        |        y wr/   rJ   rL   s     r3   rO   zTunnels.list.<locals>.<genexpr>   rP   rQ   rR   rS   rm   rn   ro   rA   rB   rC   rD   queryro   rW   model)r   r   rY   r   r   _get_api_listr!   r(   r'   r   r#   TunnelListParams	r2   rm   rn   ro   r@   rA   rB   rC   rD   s	            r3   listzTunnels.list   s    R	
$ '*hhu5Le5LOgNh/i&j"	
 "	
 *+C]H[Y[]!!#
+(+'%%,<!& $
 '77 # " 
 	
r5   c          
     $   |st        d|      i t        dt        |      r#dj                  t	        d |D        dg            nt
        i      |xs i }ddi|xs i }| j                  t        d|      t        ||||      t        	      S )
  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.

        Args:
          betas: Optional header to specify the beta version(s) you want to use.

          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        ra   rG   rH   c              3  2   K   | ]  }t        |        y wr/   rJ   rL   s     r3   rO   z"Tunnels.archive.<locals>.<genexpr>  rP   rQ   rR   )/v1/tunnels/{tunnel_id}/archive?beta=truerd   rT   rf   
rh   r   r   rY   r   r   rZ   r   r'   r(   rj   s          r3   archivezTunnels.archive   s    F WXaWdeff	
$ '*hhu5Le5LOgNh/i&j"	
 "	
 *+C]H[Y[]zzEQZ[(+Q[el   
 	
r5   c          
     $   |st        d|      i t        dt        |      r#dj                  t	        d |D        dg            nt
        i      |xs i }ddi|xs i }| j                  t        d|      t        ||||      t        	      S )
  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.

        Args:
          betas: Optional header to specify the beta version(s) you want to use.

          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        ra   rG   rH   c              3  2   K   | ]  }t        |        y wr/   rJ   rL   s     r3   rO   z'Tunnels.reveal_token.<locals>.<genexpr>O  rP   rQ   rR   ./v1/tunnels/{tunnel_id}/reveal_token?beta=truerd   rT   rf   
rh   r   r   rY   r   r   rZ   r   r'   r*   rj   s          r3   reveal_tokenzTunnels.reveal_token'  s    F WXaWdeff	
$ '*hhu5Le5LOgNh/i&j"	
 "	
 *+C]H[Y[]zzJV_`(+Q[el $  
 	
r5   reasonr@   rA   rB   rC   rD   c          
     Z   |st        d|      i t        dt        |      r#dj                  t	        d |D        dg            nt
        i      |xs i }ddi|xs i }| j                  t        d|      t        d|it        j                        t        ||||	      t        
      S )  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.

        Args:
          reason: Optional free-text reason for the rotation, recorded for audit.

          betas: Optional header to specify the beta version(s) you want to use.

          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        ra   rG   rH   c              3  2   K   | ]  }t        |        y wr/   rJ   rL   s     r3   rO   z'Tunnels.rotate_token.<locals>.<genexpr>  rP   rQ   rR   ./v1/tunnels/{tunnel_id}/rotate_token?beta=truerd   r   rT   rU   )rh   r   r   rY   r   r   rZ   r   r   r%   TunnelRotateTokenParamsr'   r*   r2   re   r   r@   rA   rB   rC   rD   s           r3   rotate_tokenzTunnels.rotate_token_  s    J WXaWdeff	
$ '*hhu5Le5LOgNh/i&j"	
 "	
 *+C]H[Y[]zzJV_` (F!35O5g5gh(+Q[el $  
 	
r5   )returnr   )r   r8   )r   r<   r?   Optional[str] | Omitr@   List[AnthropicBetaParam] | OmitrA   Headers | NonerB   Query | NonerC   Body | NonerD   'float | httpx.Timeout | None | NotGivenr   r(   re   rK   r@   r   rA   r   rB   r   rC   r   rD   r   r   r(   )rm   bool | Omitrn   
int | Omitro   
str | Omitr@   r   rA   r   rB   r   rC   r   rD   r   r   zSyncPageCursor[BetaTunnel]re   rK   r@   r   rA   r   rB   r   rC   r   rD   r   r   r*   re   rK   r   r   r@   r   rA   r   rB   r   rC   r   rD   r   r   r*   __name__
__module____qualname__r   r4   r9   r=   r   r   r]   rk   r{   r   r   r    r5   r3   r+   r+   "   s   * * , , 2 2 .215 )-$("&;D6
 +6
 /	6
 &6
 "6
  6
 96
 
6
x 26 )-$("&;D3
3
 /	3
 &3
 "3
  3
 93
 
3
p )- 15 )-$("&;DF
 &F
 	F

 F
 /F
 &F
 "F
  F
 9F
 
$F
X 26 )-$("&;D6
6
 /	6
 &6
 "6
  6
 96
 
6
x 26 )-$("&;D6
6
 /	6
 &6
 "6
  6
 96
 
6
x (,15 )-$("&;D9
9
 %	9

 /9
 &9
 "9
  9
 99
 
9
r5   c            	      x   e Zd Zedd       Zedd       Zedd       Zeeddded	 	 	 	 	 	 	 	 	 	 	 	 	 ddZ	eddded	 	 	 	 	 	 	 	 	 	 	 	 	 ddZ
eeeeddded		 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd
Zeddded	 	 	 	 	 	 	 	 	 	 	 	 	 ddZeddded	 	 	 	 	 	 	 	 	 	 	 	 	 ddZeeddded	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddZy)r,   c                ,    t        | j                        S r/   )r   r0   r1   s    r3   r4   zAsyncTunnels.certificates  s     ..r5   c                    t        |       S r7   )AsyncTunnelsWithRawResponser1   s    r3   r9   zAsyncTunnels.with_raw_response  s     +400r5   c                    t        |       S r;   )!AsyncTunnelsWithStreamingResponser1   s    r3   r=   z$AsyncTunnels.with_streaming_response  s     166r5   Nr>   c          
     T  K   i t        dt        |      r#dj                  t        d |D        dg            nt        i      |xs i }ddi|xs i }| j                  dt        d|it        j                         d{   t        ||||      t        	       d{   S 7 $7 w)
rF   rG   rH   c              3  2   K   | ]  }t        |        y wr/   rJ   rL   s     r3   rO   z&AsyncTunnels.create.<locals>.<genexpr>  rP   rQ   rR   rS   r?   NrT   rU   )r   r   rY   r   r   rZ   r   r$   r[   r'   r(   r\   s          r3   r]   zAsyncTunnels.create  s     H	
$ '*hhu5Le5LOgNh/i&j"	
 "	
 *+C]H[Y[]ZZ#,nl-KMaMtMtuu(+Q[el    
 
 	
u
s$   A=B(?B$
 B(B& B(&B(r^   c          
     @  K   |st        d|      i t        dt        |      r#dj                  t	        d |D        dg            nt
        i      |xs i }ddi|xs i }| j                  t        d|      t        ||||      t        	       d
{   S 7 w)r`   ra   rG   rH   c              3  2   K   | ]  }t        |        y wr/   rJ   rL   s     r3   rO   z(AsyncTunnels.retrieve.<locals>.<genexpr>  rP   rQ   rR   rc   rd   rT   rf   Nrg   rj   s          r3   rk   zAsyncTunnels.retrieve  s     @ WXaWdeff	
$ '*hhu5Le5LOgNh/i&j"	
 "	
 *+C]H[Y[]YY=S(+Q[el   
 
 	
 
   BBBBrl   c               @   i t        dt        |      r#dj                  t        d |D        dg            nt        i      |xs i }ddi|xs i }| j                  dt        t           t        ||||t        |||dt        j                              t              S )	rq   rG   rH   c              3  2   K   | ]  }t        |        y wr/   rJ   rL   s     r3   rO   z$AsyncTunnels.list.<locals>.<genexpr>L  rP   rQ   rR   rS   rs   rt   rv   )r   r   rY   r   r   rx   r"   r(   r'   r   r#   ry   rz   s	            r3   r{   zAsyncTunnels.list   s    R	
$ '*hhu5Le5LOgNh/i&j"	
 "	
 *+C]H[Y[]!!# ,(+'%%,<!& $
 '77 # " 
 	
r5   c          
     @  K   |st        d|      i t        dt        |      r#dj                  t	        d |D        dg            nt
        i      |xs i }ddi|xs i }| j                  t        d|      t        ||||      t        	       d
{   S 7 w)r}   ra   rG   rH   c              3  2   K   | ]  }t        |        y wr/   rJ   rL   s     r3   rO   z'AsyncTunnels.archive.<locals>.<genexpr>  rP   rQ   rR   r   rd   rT   rf   Nr   rj   s          r3   r   zAsyncTunnels.archiveh  s     F WXaWdeff	
$ '*hhu5Le5LOgNh/i&j"	
 "	
 *+C]H[Y[]ZZEQZ[(+Q[el    
 
 	
 
r   c          
     @  K   |st        d|      i t        dt        |      r#dj                  t	        d |D        dg            nt
        i      |xs i }ddi|xs i }| j                  t        d|      t        ||||      t        	       d
{   S 7 w)r   ra   rG   rH   c              3  2   K   | ]  }t        |        y wr/   rJ   rL   s     r3   rO   z,AsyncTunnels.reveal_token.<locals>.<genexpr>  rP   rQ   rR   r   rd   rT   rf   Nr   rj   s          r3   r   zAsyncTunnels.reveal_token  s     F WXaWdeff	
$ '*hhu5Le5LOgNh/i&j"	
 "	
 *+C]H[Y[]ZZJV_`(+Q[el $   
 
 	
 
r   r   c          
       K   |st        d|      i t        dt        |      r#dj                  t	        d |D        dg            nt
        i      |xs i }ddi|xs i }| j                  t        d|      t        d|it        j                         d	{   t        ||||
      t               d	{   S 7 $7 w)r   ra   rG   rH   c              3  2   K   | ]  }t        |        y wr/   rJ   rL   s     r3   rO   z,AsyncTunnels.rotate_token.<locals>.<genexpr>  rP   rQ   rR   r   rd   r   NrT   rU   )rh   r   r   rY   r   r   rZ   r   r   r%   r   r'   r*   r   s           r3   r   zAsyncTunnels.rotate_token  s     J WXaWdeff	
$ '*hhu5Le5LOgNh/i&j"	
 "	
 *+C]H[Y[]ZZJV_`,h-?A[AsAstt(+Q[el $   
 
 	
t
s$   BCB?
C:C;CC)r   r   )r   r   )r   r   r   r   )rm   r   rn   r   ro   r   r@   r   rA   r   rB   r   rC   r   rD   r   r   z7AsyncPaginator[BetaTunnel, AsyncPageCursor[BetaTunnel]]r   r   r   r   r5   r3   r,   r,     s   / / 1 1 7 7 .215 )-$("&;D6
 +6
 /	6
 &6
 "6
  6
 96
 
6
x 26 )-$("&;D3
3
 /	3
 &3
 "3
  3
 93
 
3
p )- 15 )-$("&;DF
 &F
 	F

 F
 /F
 &F
 "F
  F
 9F
 
AF
X 26 )-$("&;D6
6
 /	6
 &6
 "6
  6
 96
 
6
x 26 )-$("&;D6
6
 /	6
 &6
 "6
  6
 96
 
6
x (,15 )-$("&;D9
9
 %	9

 /9
 &9
 "9
  9
 99
 
9
r5   c                  &    e Zd ZddZedd       Zy)r8   c                   || _         t        j                  |j                        | _        t        j                  |j                        | _        t        j                  |j
                        | _        t        j                  |j                        | _        t        j                  |j                        | _        t        j                  |j                        | _        y r/   )	_tunnelsr   to_raw_response_wrapperr]   rk   r{   r   r   r   r2   tunnelss     r3   __init__zTunnelsWithRawResponse.__init__  s    &>>NN
 )@@
 %<<LL
	 (??OO
 -DD  
 -DD  
r5   c                @    t        | j                  j                        S r/   )r   r   r4   r1   s    r3   r4   z#TunnelsWithRawResponse.certificates+  s    *4==+E+EFFr5   Nr   r+   r   None)r   r   r   r   r   r   r   r4   r   r5   r3   r8   r8     s    
, G Gr5   r8   c                  &    e Zd ZddZedd       Zy)r   c                   || _         t        j                  |j                        | _        t        j                  |j                        | _        t        j                  |j
                        | _        t        j                  |j                        | _        t        j                  |j                        | _        t        j                  |j                        | _        y r/   )	r   r   async_to_raw_response_wrapperr]   rk   r{   r   r   r   r   s     r3   r   z$AsyncTunnelsWithRawResponse.__init__1  s    &DDNN
 )FF
 %BBLL
	 (EEOO
 -JJ  
 -JJ  
r5   c                @    t        | j                  j                        S r/   )r   r   r4   r1   s    r3   r4   z(AsyncTunnelsWithRawResponse.certificatesG  s    /0J0JKKr5   Nr   r,   r   r   )r   r   r   r   r5   r3   r   r   0  s    
, L Lr5   r   c                  &    e Zd ZddZedd       Zy)r<   c                J   || _         t        |j                        | _        t        |j                        | _        t        |j                        | _        t        |j
                        | _        t        |j                        | _        t        |j                        | _        y r/   )r   r   r]   rk   r{   r   r   r   r   s     r3   r   z%TunnelsWithStreamingResponse.__init__M  s    2NN
 5
 1LL
	 4OO
 9  
 9  
r5   c                @    t        | j                  j                        S r/   )r   r   r4   r1   s    r3   r4   z)TunnelsWithStreamingResponse.certificatesc  s    01K1KLLr5   Nr   )r   r   r   r   r5   r3   r<   r<   L  s    
, M Mr5   r<   c                  &    e Zd ZddZedd       Zy)r   c                J   || _         t        |j                        | _        t        |j                        | _        t        |j                        | _        t        |j
                        | _        t        |j                        | _        t        |j                        | _        y r/   )r   r   r]   rk   r{   r   r   r   r   s     r3   r   z*AsyncTunnelsWithStreamingResponse.__init__i  s    8NN
 ;
 7LL
	 :OO
 ?  
 ?  
r5   c                @    t        | j                  j                        S r/   )r    r   r4   r1   s    r3   r4   z.AsyncTunnelsWithStreamingResponse.certificates  s    5dmm6P6PQQr5   Nr   )r   r    r   r   r5   r3   r   r   h  s    
, R Rr5   r   )>
__future__r   typingr   r   	itertoolsr   httpx r   _typesr	   r
   r   r   r   r   r   _utilsr   r   r   r   r   _compatr   	_resourcer   r   	_responser   r   r4   r   r   r   r   r   r    
paginationr!   r"   
types.betar#   r$   r%   _base_clientr&   r'   types.beta.beta_tunnelr(   types.anthropic_beta_paramr)   types.beta.beta_tunnel_tokenr*   __all__r+   r,   r8   r   r<   r   r   r5   r3   <module>r      s    # !   ! L L L g g ' ; Z  ; _ _ A 1 = <n
%v
o v
rv
# v
rG G8L L8M M8R Rr5   