o
    ~j6hî  ã                   @   s´   d Z ddlZddlmZ dZdZdZdZdZd	Z	d
Z
dZdZdZdZdZdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zd d!„ Zd"d#„ Zd$d%„ Zd&d'„ Zd(d)„ ZdS )*z‘ We use x-goog-api-client header to report metrics. This module provides
the constants and helper methods to construct x-goog-api-client header.
é    N)Úversionzx-goog-api-clientzgoogle-byoid-sdkzauth-request-type/atzauth-request-type/itzauth-request-type/mdszauth-request-type/re-startzauth-request-type/re-contzcred-type/uzcred-type/sazcred-type/jwtzcred-type/mdszcred-type/impc                   C   s   d  t ¡ tj¡S )Nzgl-python/{} auth/{})ÚformatÚplatformÚpython_versionr   Ú__version__© r   r   úb/var/www/html/chefvision.cloud.itp360.com/venv/lib/python3.10/site-packages/google/auth/metrics.pyÚpython_and_auth_lib_version-   s   r	   c                   C   ó   d  tƒ tt¡S ©Nz{} {} {})r   r	   ÚREQUEST_TYPE_ACCESS_TOKENÚCRED_TYPE_SA_MDSr   r   r   r   Útoken_request_access_token_mds5   ó   ÿr   c                   C   r
   r   )r   r	   ÚREQUEST_TYPE_ID_TOKENr   r   r   r   r   Útoken_request_id_token_mds=   r   r   c                   C   r
   r   )r   r	   r   ÚCRED_TYPE_SA_IMPERSONATEr   r   r   r   Ú&token_request_access_token_impersonateE   s
   ýr   c                   C   r
   r   )r   r	   r   r   r   r   r   r   Ú"token_request_id_token_impersonateO   r   r   c                   C   r
   r   )r   r	   r   ÚCRED_TYPE_SA_ASSERTIONr   r   r   r   Ú'token_request_access_token_sa_assertionX   r   r   c                   C   r
   r   )r   r	   r   r   r   r   r   r   Ú#token_request_id_token_sa_assertiona   r   r   c                   C   ó   d  tƒ t¡S ©Nú{} {})r   r	   ÚCRED_TYPE_USERr   r   r   r   Útoken_request_useri   ó   r   c                   C   r   r   )r   r	   ÚREQUEST_TYPE_MDS_PINGr   r   r   r   Úmds_pingq   r   r   c                   C   r   r   )r   r	   ÚREQUEST_TYPE_REAUTH_STARTr   r   r   r   Úreauth_startw   r   r!   c                   C   r   r   )r   r	   ÚREQUEST_TYPE_REAUTH_CONTINUEr   r   r   r   Úreauth_continue}   r   r#   c                 C   s2   d  tƒ t¡}|  ¡ D ]\}}d  |||¡}q|S )Nr   z{} {}/{})r   r	   ÚBYOID_HEADER_SECTIONÚitems)Úmetrics_optionsÚheaderÚkeyÚvaluer   r   r   Úbyoid_metrics_headerƒ   s   r*   c                 C   s4   |sdS t | vr|| t < dS | t   d| 7  < dS )aµ  Add x-goog-api-client header with the given value.

    Args:
        headers (Mapping[str, str]): The headers to which we will add the
            metric header.
        metric_header_value (Optional[str]): If value is None, do nothing;
            if headers already has a x-goog-api-client header, append the value
            to the existing header; otherwise add a new x-goog-api-client
            header with the given value.
    Nú )ÚAPI_CLIENT_HEADER)ÚheadersÚmetric_header_valuer   r   r   Úadd_metric_headerŠ   s
   r/   )Ú__doc__r   Úgoogle.authr   r,   r$   r   r   r   r    r"   r   r   ÚCRED_TYPE_SA_JWTr   r   r	   r   r   r   r   r   r   r   r   r!   r#   r*   r/   r   r   r   r   Ú<module>   s8   
		