
    Ájk                    t   d dl mZ d dl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! ddl"m#Z#m$Z$ ddl%m&Z&m'Z' ddl(m)Z) ddl*m+Z+ ddgZ, G d de      Z- G d de      Z. G d d      Z/ G d d      Z0 G d d      Z1 G d d      Z2y)    )annotations)List)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)SyncPageCursorAsyncPageCursor)AsyncPaginatormake_request_options)certificate_list_paramscertificate_create_params)AnthropicBetaParam)BetaTunnelCertificateCertificatesAsyncCertificatesc            	         e Zd Zed
d       Zedd       Z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y)r!   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
        )CertificatesWithRawResponseselfs    T/tmp/pip-target-k_scjv0h/lib/python/anthropic/resources/beta/tunnels/certificates.pywith_raw_responsezCertificates.with_raw_response   s     +400    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
        )!CertificatesWithStreamingResponser'   s    r)   with_streaming_responsez$Certificates.with_streaming_response$   s     166r+   Nbetasextra_headersextra_query
extra_bodytimeoutc          
     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 )4  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.

        Registers a public CA certificate on a tunnel. Anthropic verifies the gateway's
        server certificate against this CA when it terminates the inner TLS session. A
        tunnel holds at most two non-archived certificates.

        Args:
          ca_certificate_pem: PEM-encoded X.509 CA certificate. Must contain exactly one certificate and no
              private-key material. Maximum 8KB.

          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 anthropic-beta,c              3  2   K   | ]  }t        |        y wNstr.0es     r)   	<genexpr>z&Certificates.create.<locals>.<genexpr>X        5Lc!f5L   mcp-tunnels-2026-06-22./v1/tunnels/{tunnel_id}/certificates?beta=true	tunnel_idca_certificate_pemr2   r3   r4   r5   bodyoptionscast_to)
ValueErrorr   r   joinr   r   _postr   r   r   CertificateCreateParamsr   r    r(   rH   rI   r1   r2   r3   r4   r5   s           r)   createzCertificates.create-   s    L WXaWdeff	
$ '*hhu5Le5LOgNh/i&j"	
 "	
 *+C]H[Y[]zzJV_` %'9:<U<m<m )+Q[el *  	
 		
r+   c          
     F   |st        d|      |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 certificate 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
        r8   =Expected a non-empty value for `certificate_id` but received r9   r:   c              3  2   K   | ]  }t        |        y wr<   r=   r?   s     r)   rB   z(Certificates.retrieve.<locals>.<genexpr>   rC   rD   rE   ?/v1/tunnels/{tunnel_id}/certificates/{certificate_id}?beta=truerH   certificate_idrJ   rM   rN   
rO   r   r   rP   r   r   _getr   r   r    r(   r[   rH   r1   r2   r3   r4   r5   s           r)   retrievezCertificates.retrievek   s    B WXaWdeff\]k\nopp	
$ '*hhu5Le5LOgNh/i&j"	
 "	
 *+C]H[Y[]yyQ#-
 )+Q[el *  

 
	
r+   include_archivedlimitpager1   r2   r3   r4   r5   c               v   |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           t        ||||	t        |||dt        j                        	      t        
      S )X  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 the certificates registered on a tunnel. Archived certificates are
        excluded unless include_archived is set.

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

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

          page: Opaque pagination cursor from a previous `list_tunnel_certificates` 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
        r8   r9   r:   c              3  2   K   | ]  }t        |        y wr<   r=   r?   s     r)   rB   z$Certificates.list.<locals>.<genexpr>   rC   rD   rE   rF   rG   rb   rc   rd   r2   r3   r4   r5   queryrd   rM   model)rO   r   r   rP   r   r   _get_api_listr   r   r    r   r   r   CertificateListParams
r(   rH   rb   rc   rd   r1   r2   r3   r4   r5   s
             r)   listzCertificates.list   s    T WXaWdeff	
$ '*hhu5Le5LOgNh/i&j"	
 "	
 *+C]H[Y[]!!JV_` 56(+'%%,<!& $
 ,AA (# " 
 	
r+   c          
     F   |st        d|      |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 certificate, removing it from the set Anthropic trusts for the
        tunnel. The certificate record is retained. Archiving the last non-archived
        certificate is permitted; the tunnel rejects MCP traffic until a new certificate
        is added.

        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
        r8   rW   r9   r:   c              3  2   K   | ]  }t        |        y wr<   r=   r?   s     r)   rB   z'Certificates.archive.<locals>.<genexpr>  rC   rD   rE   G/v1/tunnels/{tunnel_id}/certificates/{certificate_id}/archive?beta=truerZ   rJ   r\   
rO   r   r   rP   r   r   rQ   r   r   r    r_   s           r)   archivezCertificates.archive   s    H WXaWdeff\]k\nopp	
$ '*hhu5Le5LOgNh/i&j"	
 "	
 *+C]H[Y[]zzY#-
 )+Q[el *  

 
	
r+   )returnr&   )rw   r.   rH   r>   rI   r>   r1   List[AnthropicBetaParam] | Omitr2   Headers | Noner3   Query | Noner4   Body | Noner5   'float | httpx.Timeout | None | NotGivenrw   r    r[   r>   rH   r>   r1   ry   r2   rz   r3   r{   r4   r|   r5   r}   rw   r    )rH   r>   rb   bool | Omitrc   
int | Omitrd   
str | Omitr1   ry   r2   rz   r3   r{   r4   r|   r5   r}   rw   z%SyncPageCursor[BetaTunnelCertificate]__name__
__module____qualname__r   r*   r/   r   r   rT   r`   rp   rv    r+   r)   r!   r!      s   1 1 7 7 26 )-$("&;D<
<
  	<

 /<
 &<
 "<
  <
 9<
 
<
F 26 )-$("&;D:
:
 	:

 /:
 &:
 ":
  :
 9:
 
:
@ )- 15 )-$("&;DI
I
 &	I

 I
 I
 /I
 &I
 "I
  I
 9I
 
/I
` 26 )-$("&;D=
=
 	=

 /=
 &=
 "=
  =
 9=
 
=
r+   c            	         e Zd Zed
d       Zedd       Z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y)r"   c                    t        |       S r%   ) AsyncCertificatesWithRawResponser'   s    r)   r*   z#AsyncCertificates.with_raw_response3  s     055r+   c                    t        |       S r-   )&AsyncCertificatesWithStreamingResponser'   s    r)   r/   z)AsyncCertificates.with_streaming_response=  s     6d;;r+   Nr0   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)r7   r8   r9   r:   c              3  2   K   | ]  }t        |        y wr<   r=   r?   s     r)   rB   z+AsyncCertificates.create.<locals>.<genexpr>q  rC   rD   rE   rF   rG   rI   NrJ   rK   )rO   r   r   rP   r   r   rQ   r   r   r   rR   r   r    rS   s           r)   rT   zAsyncCertificates.createF  s     L WXaWdeff	
$ '*hhu5Le5LOgNh/i&j"	
 "	
 *+C]H[Y[]ZZJV_`,%'9:<U<m<m  )+Q[el *   	
 	
 		
	
s$   BCB?
C:C;CCc          
     b  K   |st        d|      |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)rV   r8   rW   r9   r:   c              3  2   K   | ]  }t        |        y wr<   r=   r?   s     r)   rB   z-AsyncCertificates.retrieve.<locals>.<genexpr>  rC   rD   rE   rY   rZ   rJ   r\   Nr]   r_   s           r)   r`   zAsyncCertificates.retrieve  s     B WXaWdeff\]k\nopp	
$ '*hhu5Le5LOgNh/i&j"	
 "	
 *+C]H[Y[]YYQ#-
 )+Q[el *  

 

 
	
 

   B&B/(B-)B/ra   c               v   |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           t        ||||	t        |||dt        j                        	      t        
      S )rf   r8   r9   r:   c              3  2   K   | ]  }t        |        y wr<   r=   r?   s     r)   rB   z)AsyncCertificates.list.<locals>.<genexpr>  rC   rD   rE   rF   rG   rh   ri   rk   )rO   r   r   rP   r   r   rm   r   r   r    r   r   r   rn   ro   s
             r)   rp   zAsyncCertificates.list  s    T WXaWdeff	
$ '*hhu5Le5LOgNh/i&j"	
 "	
 *+C]H[Y[]!!JV_` !67(+'%%,<!& $
 ,AA (# " 
 	
r+   c          
     b  K   |st        d|      |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)rr   r8   rW   r9   r:   c              3  2   K   | ]  }t        |        y wr<   r=   r?   s     r)   rB   z,AsyncCertificates.archive.<locals>.<genexpr>6  rC   rD   rE   rt   rZ   rJ   r\   Nru   r_   s           r)   rv   zAsyncCertificates.archive  s     H WXaWdeff\]k\nopp	
$ '*hhu5Le5LOgNh/i&j"	
 "	
 *+C]H[Y[]ZZY#-
 )+Q[el *   

 

 
	
 

r   )rw   r   )rw   r   rx   r~   )rH   r>   rb   r   rc   r   rd   r   r1   ry   r2   rz   r3   r{   r4   r|   r5   r}   rw   zMAsyncPaginator[BetaTunnelCertificate, AsyncPageCursor[BetaTunnelCertificate]]r   r   r+   r)   r"   r"   2  s   6 6 < < 26 )-$("&;D<
<
  	<

 /<
 &<
 "<
  <
 9<
 
<
F 26 )-$("&;D:
:
 	:

 /:
 &:
 ":
  :
 9:
 
:
@ )- 15 )-$("&;DI
I
 &	I

 I
 I
 /I
 &I
 "I
  I
 9I
 
WI
` 26 )-$("&;D=
=
 	=

 /=
 &=
 "=
  =
 9=
 
=
r+   c                      e Zd ZddZy)r&   c                2   || _         t        j                  |j                        | _        t        j                  |j                        | _        t        j                  |j
                        | _        t        j                  |j                        | _        y r<   )_certificatesr   to_raw_response_wrapperrT   r`   rp   rv   r(   certificatess     r)   __init__z$CertificatesWithRawResponse.__init__L  s|    )&>>
 )@@!!
 %<<
	 (??  
r+   Nr   r!   rw   Noner   r   r   r   r   r+   r)   r&   r&   K      
r+   r&   c                      e Zd ZddZy)r   c                2   || _         t        j                  |j                        | _        t        j                  |j                        | _        t        j                  |j
                        | _        t        j                  |j                        | _        y r<   )r   r   async_to_raw_response_wrapperrT   r`   rp   rv   r   s     r)   r   z)AsyncCertificatesWithRawResponse.__init__^  s|    )&DD
 )FF!!
 %BB
	 (EE  
r+   Nr   r"   rw   r   r   r   r+   r)   r   r   ]  r   r+   r   c                      e Zd ZddZy)r.   c                    || _         t        |j                        | _        t        |j                        | _        t        |j                        | _        t        |j
                        | _        y r<   )r   r   rT   r`   rp   rv   r   s     r)   r   z*CertificatesWithStreamingResponse.__init__p  sd    )2
 5!!
 1
	 4  
r+   Nr   r   r   r+   r)   r.   r.   o  r   r+   r.   c                      e Zd ZddZy)r   c                    || _         t        |j                        | _        t        |j                        | _        t        |j                        | _        t        |j
                        | _        y r<   )r   r   rT   r`   rp   rv   r   s     r)   r   z/AsyncCertificatesWithStreamingResponse.__init__  sd    )8
 ;!!
 7
	 :  
r+   Nr   r   r   r+   r)   r   r     r   r+   r   )3
__future__r   typingr   	itertoolsr   httpx r   _typesr   r	   r
   r   r   r   r   _utilsr   r   r   r   r   _compatr   	_resourcer   r   	_responser   r   
paginationr   r   _base_clientr   r   types.beta.tunnelsr   r   types.anthropic_beta_paramr   *types.beta.tunnels.beta_tunnel_certificater    __all__r!   r"   r&   r   r.   r   r   r+   r)   <module>r      s    #    ! L L L g g ' ; Z : A U = P.
/V
? V
rV
( V
r
 
$
 
$
 
$
 
r+   