o
    ii                     @   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   S/home/air/goalskill_t/back/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_mds6      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_impersonateF   s
   r   c                   C   r
   r   )r   r	   r   r   r   r   r   r   "token_request_id_token_impersonateP   r   r   c                   C   r
   r   )r   r	   r   CRED_TYPE_SA_ASSERTIONr   r   r   r   'token_request_access_token_sa_assertionY   r   r   c                   C   r
   r   )r   r	   r   r   r   r   r   r   #token_request_id_token_sa_assertionb   r   r   c                   C      d t tS N{} {})r   r	   CRED_TYPE_USERr   r   r   r   token_request_userj      r   c                   C   r   r   )r   r	   REQUEST_TYPE_MDS_PINGr   r   r   r   mds_pings   r   r   c                   C   r   r   )r   r	   REQUEST_TYPE_REAUTH_STARTr   r   r   r   reauth_starty   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   	
			