
    Vh.                     x    d dl mZ 	 d dlmZ dZddlmZ d Z G d d	e      Z	 G d
 d      Z
y# e$ r dZY (w xY w)    )wraps)ClientErrorTF   )
CloudRetryc                  0    t         rt        S t        d      S )z
    Allow for boto3 not being installed when using these utils by wrapping
    botocore.exceptions instead of assigning from it directly.
    N)	HAS_BOTO3r   type     k/home/dcms/DCMS/lib/python3.12/site-packages/ansible_collections/amazon/aws/plugins/module_utils/retries.py_botocore_exception_mayber   +   s    
 :r   c                   <    e Zd Z e       Zed        Zedd       Zy)AWSRetryc                 &    | j                   d   d   S )NErrorCode)response)errors    r   status_code_from_exceptionz#AWSRetry.status_code_from_exception8   s    ~~g&v..r   Nc                 8    g d}|r|j                  |       | |v S )N)RequestLimitExceededUnavailableServiceUnavailableInternalFailureInternalErrorTooManyRequestsException
Throttling)extend)response_codecatch_extra_error_codesretry_ons      r   foundzAWSRetry.found<   s&    
 #OO34((r   N)__name__
__module____qualname__r   
base_classstaticmethodr   r"   r
   r   r   r   r   5   s0    *,J/ / ) )r   r   c                   "    e Zd ZdZd Zd Zd Zy)RetryingBotoClientWrapper)get_paginatorcan_paginate
get_waitergenerate_presigned_urlc                      || _         || _        y r#   )clientretry)selfr0   r1   s      r   __init__z"RetryingBotoClientWrapper.__init___   s    
r   c                 Z    | j                        t              ddfd
       }|S )NF)	aws_retryc                 (    | r |i |S  |i |S r#   r
   )r5   argskwargsretrying_wrapper	unwrappeds      r   deciding_wrapperz[RetryingBotoClientWrapper._create_optional_retry_wrapper_function.<locals>.deciding_wrapperf   s&    '888 $1&11r   )r1   r   )r2   r:   r;   r9   s    ` @r   '_create_optional_retry_wrapper_functionzARetryingBotoClientWrapper._create_optional_retry_wrapper_functionc   s4    ::i0	y	.3 	2 
	2  r   c                     t        | j                  |      }|| j                  v r|S t        |      r | j	                  |      }t        | ||       |S |S r#   )getattrr0   &_RetryingBotoClientWrapper__never_waitcallabler<   setattr)r2   namer:   wrappeds       r   __getattr__z%RetryingBotoClientWrapper.__getattr__o   sU    DKK.	4$$$i BB9MGD$(Nr   N)r$   r%   r&   r?   r3   r<   rD   r
   r   r   r*   r*   W   s    L
 	r   r*   N)	functoolsr   botocore.exceptionsr   r   ImportErrorcloudr   r   r   r*   r
   r   r   <module>rI      sO   > /I )z )D! !e  Is   / 99