U
    #FZhî  ã                   @   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   úZ/home/aprabhat/apps/x.techxrdev.in/venv/lib/python3.8/site-packages/google/auth/metrics.pyÚpython_and_auth_lib_version-   s    r	   c                   C   s   d  tƒ tt¡S ©Nz{} {} {})r   r	   ÚREQUEST_TYPE_ACCESS_TOKENÚCRED_TYPE_SA_MDSr   r   r   r   Útoken_request_access_token_mds5   s
      ÿr   c                   C   s   d  tƒ tt¡S r
   )r   r	   ÚREQUEST_TYPE_ID_TOKENr   r   r   r   r   Útoken_request_id_token_mds=   s
      ÿr   c                   C   s   d  tƒ tt¡S r
   )r   r	   r   ÚCRED_TYPE_SA_IMPERSONATEr   r   r   r   Ú&token_request_access_token_impersonateE   s
    ýr   c                   C   s   d  tƒ tt¡S r
   )r   r	   r   r   r   r   r   r   Ú"token_request_id_token_impersonateO   s
      ÿr   c                   C   s   d  tƒ tt¡S r
   )r   r	   r   ÚCRED_TYPE_SA_ASSERTIONr   r   r   r   Ú'token_request_access_token_sa_assertionX   s
      ÿr   c                   C   s   d  tƒ tt¡S r
   )r   r	   r   r   r   r   r   r   Ú#token_request_id_token_sa_assertiona   s
      ÿr   c                   C   s   d  tƒ t¡S ©Nú{} {})r   r	   ÚCRED_TYPE_USERr   r   r   r   Útoken_request_useri   s    r   c                   C   s   d  tƒ t¡S r   )r   r	   ÚREQUEST_TYPE_MDS_PINGr   r   r   r   Úmds_pingq   s    r   c                   C   s   d  tƒ t¡S r   )r   r	   ÚREQUEST_TYPE_REAUTH_STARTr   r   r   r   Úreauth_startw   s    r   c                   C   s   d  tƒ t¡S r   )r   r	   ÚREQUEST_TYPE_REAUTH_CONTINUEr   r   r   r   Úreauth_continue}   s    r   c                 C   s2   d  tƒ t¡}|  ¡ D ]\}}d  |||¡}q|S )Nr   z{} {}/{})r   r	   ÚBYOID_HEADER_SECTIONÚitems)Zmetrics_optionsÚheaderÚkeyÚvaluer   r   r   Úbyoid_metrics_headerƒ   s    r%   c                 C   s2   |sdS t | kr|| t < n| 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)ÚheadersZmetric_header_valuer   r   r   Úadd_metric_headerŠ   s
    
r)   )Ú__doc__r   Zgoogle.authr   r'   r    r   r   r   r   r   r   r   ZCRED_TYPE_SA_JWTr   r   r	   r   r   r   r   r   r   r   r   r   r   r%   r)   r   r   r   r   Ú<module>   s6   
		