Ë
    €ÏÊ  ã                   óˆ   — d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ	 ddl
mZ ddlmZ ddlmZ dd	lmZ  G d
„ d«      Zy)z.Utilities for handling API endpoint overrides.é    )Úabsolute_import)Údivision)Úunicode_literals)Úgkehub_api_util)Úutil)Ú
exceptions)Úlog)Ú
propertiesc                   ó@   — e Zd ZdZej
                  Zdefd„Zd„ Zd„ Z	y)ÚRegionalGatewayEndpointa•  Context manager for connecting to a particular regional Connect Gateway endpoint.

  This uses the provided region to temporarily override
  `api_endpoint_overrides/connectgateway` to a regional endpoint. If the
  `gkehub` endpoint is overridden, the `connectgateway` endpoint will use the
  same environment.

  This context manager is a no-op if the `connectgateway` endpoint is already
  overridden.
  Úregionc                 óÌ   — |st        j                  d«      ‚|| _        d| _        t        j
                  j                  j                  | j                  «      | _	        d| _
        y)z£Initializes the context manager.

    Args:
      region: The Connect Gateway region to connect to.

    Raises:
      exceptions.Error: If `region` is Falsy.
    z3A region must be provided for the Gateway endpoint.N)r   ÚErrorr   Úendpointr
   ÚVALUESÚapi_endpoint_overridesÚPropertyÚAPI_NAMEÚoverrideÚ_original_endpoint)Úselfr   s     ú;lib/googlecloudsdk/command_lib/container/fleet/overrides.pyÚ__init__z RegionalGatewayEndpoint.__init__+   s\   € ñ Ü×ÑØ
?óð ð €D„Kà€D„Mä×%Ñ%×<Ñ<×EÑEØ‰ó€D„Mð $(€DÕó    c                 ó  — | j                   j                  «       rt        j                  d«       y 	 t        j
                  j                  j                  t        j                  «      j                  «       }t        j                  || j                  «      }d|› d| _        | j                   j                  «       | _        | j                   j#                  | j                  «       | S # t        j                  $ r d }Y Œˆw xY w)Na  You are running this command with the `connectgateway` endpoint override set. Ensure you are using the correct regional endpoint. If you are only trying to change your environment, set only the `gkehub` endpoint override and not the `connectgateway` endpoint override.zhttps://Ú/)r   ÚIsExplicitlySetr	   Úwarningr
   r   r   r   r   ÚGKEHUB_API_NAMEÚGetÚNoSuchPropertyErrorÚmemberships_utilÚGetConnectGatewayServiceNamer   r   r   ÚSet)r   Úhub_overrideÚ	subdomains      r   Ú	__enter__z!RegionalGatewayEndpoint.__enter__B   sÕ   € Ø‡}}×$Ñ$Ô&Ü	‡kkðôð ðÜ×&Ñ&×=Ñ=×FÑFÜ
×
)Ñ
)óç‰‹ð ô !×=Ñ=Ød—k‘kó€Ið ˜y˜k¨Ð+€D„MØ"Ÿm™m×/Ñ/Ó1€DÔØ‡MM×Ñd—m‘mÔ$Ø€Køô ×)Ñ)ò Ø‚lðús   ²AC( Ã(D Ã?D c                 óN   — | j                   j                  | j                  «       y )N)r   r$   r   )r   Úexc_typeÚ	exc_valueÚ	tracebacks       r   Ú__exit__z RegionalGatewayEndpoint.__exit__\   s   € Ø‡MM×Ñd×-Ñ-Õ.r   N)
Ú__name__Ú
__module__Ú__qualname__Ú__doc__Úconnectgateway_api_utilr   Ústrr   r'   r,   © r   r   r   r      s*   „ ñ	ð %×-Ñ-€(ð(˜Só (ò.ó4/r   r   N)r0   Ú
__future__r   r   r   Ú&googlecloudsdk.api_lib.container.fleetr   Ú5googlecloudsdk.api_lib.container.fleet.connectgatewayr   r1   Ú6googlecloudsdk.command_lib.container.fleet.membershipsr"   Úgooglecloudsdk.corer   r	   r
   r   r3   r   r   Ú<module>r9      s1   ðñ 5å &Ý Ý 'å BÝ aÝ [Ý *Ý #Ý *÷@/ò @/r   