U
    d/e                     @  s6   d Z ddlmZ ddlmZmZmZ G dd dZdS )z,Credential definitions to access S3 service.    )annotations)datetime	timedeltatimezonec                   @  s   e Zd ZU dZded< ded< ded< ded< dddddd
ddZeddddZeddddZeddddZ	ddddZ
d	S )CredentialszJ
    Represents credentials access key, secret key and session token.
    str_access_key_secret_keyz
str | None_session_tokenzdatetime | None_expirationN)
access_key
secret_keysession_token
expirationc                 C  sR   |st d|st d|| _|| _|| _|rH|jrH|tjjd d}|| _	d S )NzAccess key must not be emptyzSecret key must not be empty)tzinfo)

ValueErrorr   r	   r
   r   
astimezoner   utcreplacer   )selfr   r   r   r    r   A/tmp/pip-unpacked-wheel-xery97c7/minio/credentials/credentials.py__init__!   s    
zCredentials.__init__)returnc                 C  s   | j S )zGet access key.)r   r   r   r   r   r   7   s    zCredentials.access_keyc                 C  s   | j S )zGet secret key.)r	   r   r   r   r   r   <   s    zCredentials.secret_keyc                 C  s   | j S )zGet session token.)r
   r   r   r   r   r   A   s    zCredentials.session_tokenboolc                 C  s"   | j r| j t tdd k S dS )z.Check whether this credentials expired or not.
   )secondsF)r   r   utcnowr   r   r   r   r   
is_expiredF   s    zCredentials.is_expired)NN)__name__
__module____qualname____doc____annotations__r   propertyr   r   r   r   r   r   r   r   r      s   
  r   N)r#   
__future__r   r   r   r   r   r   r   r   r   <module>   s   