
    6i#                     (   d dl mZmZmZmZmZmZ d dlmZm	Z	  G d de      Z
 G d d      Z G d ded	
      Ze	 G d de             Ze	 G d deed                Zeeef   Z G d de      Zg dZ G d d      Z G d d      Z G d d      Zy)    )Any
NamedTupleOptional	TypedDictUnionContextManager)Protocolruntime_checkablec                   (    e Zd ZU dZeed<   	 eed<   y)AccessTokenz!Represents an OAuth access token.token
expires_onN)__name__
__module____qualname____doc__str__annotations__int     Y/home/azureuser/techstart-app/venv/lib/python3.12/site-packages/azure/core/credentials.pyr   r   
   s    +JO3r   r   c                   ~    e Zd ZU dZeed<   	 eed<   	 eed<   	 ee   ed<   	 ddddedededee   d	df
d
Zd	efdZ	y)AccessTokenInfoa  Information about an OAuth access token.

    This class is an alternative to `AccessToken` which provides additional information about the token.

    :param str token: The token string.
    :param int expires_on: The token's expiration time in Unix time.
    :keyword str token_type: The type of access token. Defaults to 'Bearer'.
    :keyword int refresh_on: Specifies the time, in Unix time, when the cached token should be proactively
        refreshed. Optional.
    r   r   
token_type
refresh_onBearerN)r   r   returnc                <    || _         || _        || _        || _        y )N)r   r   r   r   )selfr   r   r   r   s        r   __init__zAccessTokenInfo.__init__(   s      
$$$r   c                 z    dj                  | j                  | j                  | j                  | j                        S )NzJAccessTokenInfo(token='{}', expires_on={}, token_type='{}', refresh_on={}))formatr   r   r   r   r    s    r   __repr__zAccessTokenInfo.__repr__5   s.    [bbJJ$//
 	
r   )
r   r   r   r   r   r   r   r   r!   r%   r   r   r   r   r      s{    	 JO3O#l #$(%% %
 % SM% 
%
# 
r   r   c                   4    e Zd ZU dZeed<   	 eed<   	 eed<   y)TokenRequestOptionszFOptions to use for access token requests. All parameters are optional.claims	tenant_id
enable_caeN)r   r   r   r   r   r   boolr   r   r   r'   r'   ;   s     PK5N8ar   r'   F)totalc                   F    e Zd ZdZdddddedee   dee   ded	ed
efdZ	y)TokenCredentialz2Protocol for classes able to provide OAuth tokens.NF)r(   r)   r*   scopesr(   r)   r*   kwargsr   c                     y)a  Request an access token for `scopes`.

        :param str scopes: The type of access needed.

        :keyword str claims: Additional claims required in the token, such as those returned in a resource
            provider's claims challenge following an authorization failure.
        :keyword str tenant_id: Optional tenant to include in the token request.
        :keyword bool enable_cae: Indicates whether to enable Continuous Access Evaluation (CAE) for the requested
            token. Defaults to False.

        :rtype: AccessToken
        :return: An AccessToken instance containing the token string and its expiration time in Unix time.
        Nr   )r    r(   r)   r*   r/   r0   s         r   	get_tokenzTokenCredential.get_tokenK   s    * 	r   )
r   r   r   r   r   r   r+   r   r   r2   r   r   r   r.   r.   G   sW    <
 !%#'   C=	
   
r   r.   c                   8    e Zd ZdZdddedee   defdZd	dZ	y)
SupportsTokenInfozTProtocol for classes able to provide OAuth access tokens with additional properties.N)optionsr/   r5   r   c                     y)a  Request an access token for `scopes`.

        This is an alternative to `get_token` to enable certain scenarios that require additional properties
        on the token.

        :param str scopes: The type of access needed.
        :keyword options: A dictionary of options for the token request. Unknown options will be ignored. Optional.
        :paramtype options: TokenRequestOptions

        :rtype: AccessTokenInfo
        :return: An AccessTokenInfo instance containing information about the token.
        Nr   )r    r5   r/   s      r   get_token_infoz SupportsTokenInfo.get_token_infog   s     	r   c                      y)zlClose the credential, releasing any resources it holds.

        :return: None
        :rtype: None
        Nr   r$   s    r   closezSupportsTokenInfo.closev   s    r   )r   N)
r   r   r   r   r   r   r'   r   r7   r9   r   r   r   r4   r4   c   s.    ^TX c H=P4Q ]l r   r4   c                   &    e Zd ZU dZeed<   eed<   y)AzureNamedKeyzRepresents a name and key pair.namekeyN)r   r   r   r   r   r   r   r   r   r;   r;      s    )
I	Hr   r;   )	AzureKeyCredentialAzureSasCredentialr   r   r4   AzureNamedKeyCredentialr.   r'   TokenProviderc                   F    e Zd ZdZdeddfdZedefd       ZdeddfdZy)r>   a  Credential type used for authenticating to an Azure service.
    It provides the ability to update the key without creating a new client.

    :param str key: The key used to authenticate to an Azure service
    :raises TypeError: If the key is not a string.
    r=   r   Nc                 H    t        |t              st        d      || _        y )Nzkey must be a string.)
isinstancer   	TypeError_keyr    r=   s     r   r!   zAzureKeyCredential.__init__   s    #s#344	r   c                     | j                   S )zpThe value of the configured key.

        :rtype: str
        :return: The value of the configured key.
        )rF   r$   s    r   r=   zAzureKeyCredential.key   s     yyr   c                 b    |st        d      t        |t              st        d      || _        y)a)  Update the key.

        This can be used when you've regenerated your service key and want
        to update long-lived clients.

        :param str key: The key used to authenticate to an Azure service
        :raises ValueError or TypeError: If the key is None, empty, or not a string.
        z2The key used for updating can not be None or emptyz+The key used for updating must be a string.N)
ValueErrorrD   r   rE   rF   rG   s     r   updatezAzureKeyCredential.update   s0     QRR#s#IJJ	r   )	r   r   r   r   r   r!   propertyr=   rK   r   r   r   r>   r>      sH    C D 
 S  # $ r   r>   c                   F    e Zd ZdZdeddfdZedefd       ZdeddfdZy)r?   a;  Credential type used for authenticating to an Azure service.
    It provides the ability to update the shared access signature without creating a new client.

    :param str signature: The shared access signature used to authenticate to an Azure service
    :raises TypeError: If the signature is not a string.
    	signaturer   Nc                 H    t        |t              st        d      || _        y )Nzsignature must be a string.)rD   r   rE   
_signaturer    rN   s     r   r!   zAzureSasCredential.__init__   s    )S)9::#r   c                     | j                   S )zThe value of the configured shared access signature.

        :rtype: str
        :return: The value of the configured shared access signature.
        )rP   r$   s    r   rN   zAzureSasCredential.signature   s     r   c                 b    |st        d      t        |t              st        d      || _        y)a  Update the shared access signature.

        This can be used when you've regenerated your shared access signature and want
        to update long-lived clients.

        :param str signature: The shared access signature used to authenticate to an Azure service
        :raises ValueError: If the signature is None or empty.
        :raises TypeError: If the signature is not a string.
        z8The signature used for updating can not be None or emptyz1The signature used for updating must be a string.N)rJ   rD   r   rE   rP   rQ   s     r   rK   zAzureSasCredential.update   s0     WXX)S)OPP#r   )	r   r   r   r   r   r!   rL   rN   rK   r   r   r   r?   r?      sH    $# $$ $
 3  $ $ $r   r?   c                   N    e Zd ZdZdededdfdZedefd       ZdededdfdZ	y)	r@   ak  Credential type used for working with any service needing a named key that follows patterns
    established by the other credential types.

    :param str name: The name of the credential used to authenticate to an Azure service.
    :param str key: The key used to authenticate to an Azure service.
    :raises TypeError: If the name or key is not a string.
    r<   r=   r   Nc                 |    t        |t              rt        |t              st        d      t        ||      | _        y )N"Both name and key must be strings.rD   r   rE   r;   _credentialr    r<   r=   s      r   r!   z AzureNamedKeyCredential.__init__   s0    $$JsC,@@AA(s3r   c                     | j                   S )z|The value of the configured name.

        :rtype: AzureNamedKey
        :return: The value of the configured name.
        )rX   r$   s    r   	named_keyz!AzureNamedKeyCredential.named_key   s     r   c                 |    t        |t              rt        |t              st        d      t        ||      | _        y)a\  Update the named key credential.

        Both name and key must be provided in order to update the named key credential.
        Individual attributes cannot be updated.

        :param str name: The name of the credential used to authenticate to an Azure service.
        :param str key: The key used to authenticate to an Azure service.
        rV   NrW   rY   s      r   rK   zAzureNamedKeyCredential.update   s2     $$JsC,@@AA(s3r   )
r   r   r   r   r   r!   rL   r;   r[   rK   r   r   r   r@   r@      sV    4S 4s 4t 4
  =    43 4S 4T 4r   r@   N)typingr   r   r   r   r   r   typing_extensionsr	   r
   r   r   r'   r.   r4   rA   r;   __all__r>   r?   r@   r   r   r   <module>r`      s    O N 94* 4%
 %
P	b)5 	b h  6 .1D"E  4 o'889J 
# #L$$ $$N"4 "4r   