o
    sg                     @   sV   d Z ddlZddlZddlmZ eddddZG dd	 d	ZG d
d dZe ZdS )z2Function to standardize the connection to DynamoDB    N)Config   adaptive)max_attemptsmode)retriesc                   @   s"   e Zd ZdZdddZdd ZdS )	DynamoConnectorz/Class to standardize the connection to DynamoDB	us-west-1c                 C   s@   t jddk}|rtjd|td| _dS tjd|td| _dS )z4Constructor to initialize the connection to DynamoDBAWS_SAM_LOCALtruedynamodbregion_nameconfigN)osenvirongetboto3resourcer   r   )selfr   is_local r   2/var/www/html/XCapMarket/utils/dynamo_connector.py__init__   s   zDynamoConnector.__init__c                 C   s   | j |S )z%Method to get the table from DynamoDB)r   Table)r   
table_namer   r   r   	get_table   s   zDynamoConnector.get_tableNr	   )__name__
__module____qualname____doc__r   r   r   r   r   r   r      s    
r   c                   @   s    e Zd ZdddZdddZdS )SecretManagerr	   c                 C   s   t jd|td| _d S )Nsecretsmanagerr   )r   clientr   secret_manager)r   r   r   r   r   r   "   s   zSecretManager.__init__c                 C   s   | j j|dd S )N)SecretIdSecretString)r%   get_secret_value)r   secret_namer   r   r   r   
get_secret'   s   zSecretManager.get_secretNr   )r   r   r    r   r*   r   r   r   r   r"   !   s    
r"   )	r!   r   r   botocore.configr   r   r   r"   r%   r   r   r   r   <module>   s    
