
    Vh                     ^    	 d dl Z d dlmZ  G d de      Zd Zd Zd Zd Zy# e$ r Y %w xY w)	    N)BaseWaiterFactoryc                   2     e Zd Z fdZe fd       Z xZS )DynamodbWaiterFactoryc                 H    |j                  d      }t        | 	  ||       y )Ndynamodb)clientsuper__init__)selfmoduler   	__class__s      o/home/dcms/DCMS/lib/python3.12/site-packages/ansible_collections/community/aws/plugins/module_utils/dynamodb.pyr
   zDynamodbWaiterFactory.__init__   s"     z*(    c                    t         |   }t        t        dddt        dddd      t        d	d
d      g      t        dddt        d	d
d      g      t        dddt        d	d
d      t        dddd      t        dddd      t        dddd      t        dddd      t        dddd      t        dddd      g            }|j                  |       |S )NDescribeTable      ACTIVEpathsuccesszTable.TableStatus)expectedmatcherstateargumentResourceNotFoundExceptionerrorretry)r   r   r   )	operationdelaymaxAttempts	acceptorsfailureFz/contains(keys(Table), `GlobalSecondaryIndexes`)pathAllz*Table.GlobalSecondaryIndexes[].IndexStatusCREATINGpathAnyUPDATINGDELETINGTz+length(Table.GlobalSecondaryIndexes) == `0`)table_existstable_not_existsglobal_indexes_active)r	   _waiter_model_datadictupdate)r   dataddb_datar   s      r   r+   z(DynamodbWaiterFactory._waiter_model_data   s-   w))(F)Vij"=wV]^	 ")"=wV_`	 #')"=wV_`!& &'!R	 !) )'!M	 !+ )%!M	 !+ )%!M	 !+ )%!M	 !% &'!N	C'	,#%?
@ 	Hr   )__name__
__module____qualname__r
   propertyr+   __classcell__)r   s   @r   r   r      s    ) C Cr   r   c                    t        |d      }||z  }	 t        |       j                  |      }|j                  ||d|       y # t        j
                  j                  $ r }| j                  |d|        Y d }~y d }~wt        j
                  j                  t        j
                  j                  f$ r }| j                  |d|        Y d }~y d }~ww xY w)N   )DelayMaxAttempts)WaiterConfig	TableNamezTimeout while waiting for )msgzFailed while waiting for )
minr   
get_waiterwaitbotocore
exceptionsWaiterErrorfail_json_awsClientErrorBotoCoreError)	r   waiter_nameaction_descriptionwait_timeout
table_namer   max_attemptswaiteres	            r   _do_waitrL   \   s    a E5(LV&v.99+F#(F  	 	
 ** WQ&@AS@T$UVV'')) V 	Q&?@R?S$TUU	Vs#   0A C!A<<:C6CCc                 "    t        | dd||       y )Nr(   ztable creationrL   r   rG   rH   s      r   wait_table_existsrP   o   s    V^%5|ZPr   c                 "    t        | dd||       y )Nr)   ztable deletionrN   rO   s      r   wait_table_not_existsrR   s   s    V')9<Tr   c                 "    t        | dd||       y )Nr*   zsecondary index updatesrN   rO   s      r   wait_indexes_activerT   w   s    V,.GWabr   )	r?   ImportError;ansible_collections.community.aws.plugins.module_utils.baser   r   rL   rP   rR   rT    r   r   <module>rX      sP   	 ZK- K\V&QUc_  		s   $ ,,