B
    ­»ˆdá  ã               @   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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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   úE/var/www/html/venv/lib/python3.7/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_mds2   s    r   c               C   s   d  tƒ tt¡S )Nz{} {} {})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 )Nz{} {} {})r   r	   r
   ÚCRED_TYPE_SA_IMPERSONATEr   r   r   r   Ú&token_request_access_token_impersonateB   s    r   c               C   s   d  tƒ tt¡S )Nz{} {} {})r   r	   r   r   r   r   r   r   Ú"token_request_id_token_impersonateL   s    r   c               C   s   d  tƒ tt¡S )Nz{} {} {})r   r	   r
   ÚCRED_TYPE_SA_ASSERTIONr   r   r   r   Ú'token_request_access_token_sa_assertionU   s    r   c               C   s   d  tƒ tt¡S )Nz{} {} {})r   r	   r   r   r   r   r   r   Ú#token_request_id_token_sa_assertion^   s    r   c               C   s   d  tƒ t¡S )Nz{} {})r   r	   ÚCRED_TYPE_USERr   r   r   r   Útoken_request_userf   s    r   c               C   s   d  tƒ t¡S )Nz{} {})r   r	   ÚREQUEST_TYPE_MDS_PINGr   r   r   r   Úmds_pingn   s    r   c               C   s   d  tƒ t¡S )Nz{} {})r   r	   ÚREQUEST_TYPE_REAUTH_STARTr   r   r   r   Úreauth_startt   s    r   c               C   s   d  tƒ t¡S )Nz{} {})r   r	   ÚREQUEST_TYPE_REAUTH_CONTINUEr   r   r   r   Úreauth_continuez   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   ZCRED_TYPE_SA_JWTr   r   r	   r   r   r   r   r   r   r   r   r   r   r    r   r   r   r   Ú<module>   s2   
		