§
    ÎÑßj  ã                   óŠ   — d dl mZmZmZ d dlmZ d dlmZ dZ G d„ de¦  «        Z	 G d„ de¦  «        Z
 G d	„ d
e¦  «        ZdS )é    )ÚGoogleResponseÚGoogleBaseConnectionÚGoogleOAuth2Credential)ÚProvider)ÚKubernetesContainerDriverÚv1c                   ó   — e Zd ZdS )ÚGKEResponseN)Ú__name__Ú
__module__Ú__qualname__© ó    úR/opt/saltstack/salt/lib/python3.11/site-packages/libcloud/container/drivers/gke.pyr
   r
      s   € € € € € Ø€Dr   r
   c                   óF   ‡ — e Zd ZdZdZeZ	 	 	 dˆ fd„	Zˆ fd„Zˆ fd„Z	ˆ xZ
S )ÚGKEConnectiona3  
    Connection class for the GKE driver.

    GKEConnection extends :class:`google.GoogleBaseConnection` for 3 reasons:
      1. modify request_path for GKE URI.
      2. Implement gce_params functionality described below.
      3. Add request_aggregated_items method for making aggregated API calls.

    zcontainer.googleapis.comNc                 ó”   •—  t          ¦   «         j        ||f|||dœ|¤Ž d                     t          |¦  «        | _        i | _        d S )N)ÚsecureÚ	auth_typeÚcredential_fileú/{}/projects/{})ÚsuperÚ__init__ÚformatÚAPI_VERSIONÚrequest_pathÚ
gke_params)	ÚselfÚuser_idÚkeyr   r   r   ÚprojectÚkwargsÚ	__class__s	           €r   r   zGKEConnection.__init__)   sj   ø€ ð 	�‰ŒÔØØð	
ð ØØ+ð	
ð 	
ð ð	
ð 	
ð 	
ð .×4Ò4µ[À'ÑJÔJˆÔØˆŒˆˆr   c                 ó˜   •— t          ¦   «                              ||¦  «        \  }}| j        r|                     | j        ¦  «         ||fS )zŒ
        Update URL parameters with values from self.gke_params.

        @inherits: :class:`GoogleBaseConnection.pre_connect_hook`
        )r   Úpre_connect_hookr   Úupdate)r   ÚparamsÚheadersr#   s      €r   r%   zGKEConnection.pre_connect_hook>   sJ   ø€ õ  ™'œ'×2Ò2°6¸7ÑCÔC‰ˆ�ØŒ?ð 	+Ø�MŠM˜$œ/Ñ*Ô*Ð*Ø�wˆÐr   c                 ó¶   •—  t          ¦   «         j        |i |¤Ž}| j        r7d|j        v r|j        d         | j        d<   nd| j        v r| j        d= d| _        |S )zŠ
        Perform request then do GKE-specific processing of URL params.

        @inherits: :class:`GoogleBaseConnection.request`
        ÚnextPageTokenÚ	pageTokenN)r   Úrequestr   Úobject)r   Úargsr"   Úresponser#   s       €r   r,   zGKEConnection.requestI   sq   ø€ ð #•5‘7”7”? DÐ3¨FÐ3Ð3ˆð Œ?ð 	#Ø (¤/Ð1Ð1Ø/7¬¸Ô/O�” Ñ,Ð,Ø ¤Ð/Ð/Ø”O KÐ0Ø"ˆDŒOàˆr   )NNN)r   r   r   Ú__doc__Úhostr
   ÚresponseClsr   r%   r,   Ú__classcell__©r#   s   @r   r   r      s�   ø€ € € € € ðð ð &€DØ€Kð ØØðð ð ð ð ð ð*	ð 	ð 	ð 	ð 	ðð ð ð ð ð ð ð ð r   r   c                   óp   ‡ — e Zd ZdZeZdZdZej	        Z
dZdZdZ	 	 	 	 	 	 	 	 dˆ fd	„	Zd
„ Zdd„Zdd„Zˆ xZS )ÚGKEContainerDriveraœ  
    GKE Container Driver class.

    This is the primary driver for interacting with Google Container
    Engine. It contains all of the standard libcloud methods,
    plus additional ex_* methods for more features.

    Note that many methods allow either objects or strings (or lists of
    objects/strings).  In most cases, passing strings instead of objects
    will result in additional GKE API calls.
    ÚgooglezGoogle Container Enginez https://container.googleapis.comTz&https://container.googleapis.com/auth/Né»  c
                 óv  •— |st          d¦  «        ‚|€t          j        }|| _        || _        || _        d| _        |�|| _        |pt          j        dz   | j        z   | _	         t          ¦   «         j        ||fddddœ|
¤Ž d                     t          | j        ¦  «        | _        t          j        | _        dS )a*  
        :param  user_id: The email address (for service accounts) or Client ID
                         (for installed apps) to be used for authentication.
        :type   user_id: ``str``

        :param  key: The RSA Key (for service accounts) or file path containing
                     key or Client Secret (for installed apps) to be used for
                     authentication.
        :type   key: ``str``

        :keyword  datacenter: The name of the datacenter (zone) used for
                              operations.
        :type     datacenter: ``str``

        :keyword  project: Your GKE project name. (required)
        :type     project: ``str``

        :keyword  auth_type: Accepted values are "SA" or "IA" or "GKE"
                             ("Service Account" or "Installed Application" or
                             "GKE" if libcloud is being used on a GKE instance
                             with service account enabled).
                             If not supplied, auth_type will be guessed based
                             on value of user_id or if the code is being
                             executed in a GKE instance.
        :type     auth_type: ``str``

        :keyword  scopes: List of authorization URLs. Default is empty and
                          grants read/write to Compute, Storage, DNS.
        :type     scopes: ``list``

        :keyword  credential_file: Path to file for caching authentication
                                   information used by GKEConnection.
        :type     credential_file: ``str``
        z7Project name must be specified using "project" keyword.Nú.T)r   r1   Úportr   )Ú
ValueErrorr6   Úwebsiter   r!   ÚscopesÚzoner   Údefault_credential_filer   r   r   r   r   Ú	base_path)r   r   r    Ú
datacenterr!   r   r>   r   r1   r;   r"   r#   s              €r   r   zGKEContainerDriver.__init__s   sÊ   ø€ ð^ ð 	[ÝÐYÑZÔZÐZØˆ<Ý%Ô-ˆDØ"ˆŒØˆŒØˆŒØˆŒ	ØÐ!Ø"ˆDŒIàÐbÕ5ÔMÐPSÑSÐVZÔVbÑbð 	Ôð 	�‰ŒÔ˜ #ÐS¨d¸ÀDÐSÐSÈFÐSÐSÐSà*×1Ò1µ+¸t¼|ÑLÔLˆŒÝ)Ô1ˆŒˆˆr   c                 ó8   — | j         | j        | j        | j        dœS )N©r   r!   r>   r   rD   )r   s    r   Ú_ex_connection_class_kwargsz.GKEContainerDriver._ex_connection_class_kwargsµ   s&   € àœØ”|Ø”kØ#Ô3ð	
ð 
ð 	
r   c                 óZ   — d|z  }|€d}| j                              |d¬¦  «        j        }|S )a	  
        Return a list of cluster information in the current zone or all zones.

        :keyword  ex_zone:  Optional zone name or None
        :type     ex_zone:  ``str`` or :class:`GCEZone` or
                            :class:`NodeLocation` or ``None``
        z/zones/%s/clustersNz/zones/clustersÚGET©Úmethod)Ú
connectionr,   r-   ©r   Úex_zoner,   r/   s       r   Úlist_clustersz GKEContainerDriver.list_clusters½   s:   € ð '¨'Ñ2ˆØˆ?Ø'ˆGà”?×*Ò*¨7¸5Ð*ÑAÔAÔHˆØˆr   c                 ód   — |€| j         }d|z  }| j                             |d¬¦  «        j        }|S )a   
        Return configuration info about the Container Engine service.

        :keyword  ex_zone:  Optional zone name or None
        :type     ex_zone:  ``str`` or :class:`GCEZone` or
                            :class:`NodeLocation` or ``None``
        Nz/zones/%s/serverconfigrG   rH   )r?   rJ   r,   r-   rK   s       r   Úget_server_configz$GKEContainerDriver.get_server_configÌ   s<   € ð ˆ?Ø”iˆGØ*¨gÑ6ˆà”?×*Ò*¨7¸5Ð*ÑAÔAÔHˆØˆr   )NNNNNNNr8   )N)r   r   r   r0   r   ÚconnectionClsÚapi_nameÚnamer   ÚGKEÚtyper=   Úsupports_clustersÚAUTH_URLr   rE   rM   rO   r3   r4   s   @r   r6   r6   ]   sÇ   ø€ € € € € ð
ð 
ð "€MØ€HØ$€DØŒ<€DØ0€GØÐà7€Hð
 ØØØØØØØð@2ð @2ð @2ð @2ð @2ð @2ðD
ð 
ð 
ðð ð ð ðð ð ð ð ð ð ð r   r6   N)Úlibcloud.common.googler   r   r   Úlibcloud.container.providersr   Ú%libcloud.container.drivers.kubernetesr   r   r
   r   r6   r   r   r   ú<module>rZ      sä   ðð  `Ð _Ð _Ð _Ð _Ð _Ð _Ð _Ð _Ð _Ø 1Ð 1Ð 1Ð 1Ð 1Ð 1Ø KÐ KÐ KÐ KÐ KÐ Kà€ð	ð 	ð 	ð 	ð 	�.ñ 	ô 	ð 	ð?ð ?ð ?ð ?ð ?Ð(ñ ?ô ?ð ?ðD|ð |ð |ð |ð |Ð2ñ |ô |ð |ð |ð |r   