
    Vho                     ~    d Z dZdZ	 ddlZddlmZ ddlmZ ddl	m
Z dZd	 Zd
 Zedk(  r e        yy# e$ r Y /w xY w)a  
---
module: route53_wait
version_added: 6.3.0
short_description: wait for changes in Amazons Route 53 DNS service to propagate
description:
  - When using M(amazon.aws.route53) with I(wait=false), this module allows to wait for the
    module's propagation to finish at a later point of time.
options:
  result:
    aliases:
      - results
    description:
      - The registered result of one or multiple M(amazon.aws.route53) invocations.
    required: true
    type: dict
  wait_timeout:
    description:
      - How long to wait for the changes to be replicated, in seconds.
      - This timeout will be used for every changed result in I(result).
    default: 300
    type: int
  region:
    description:
      - This setting is ignored by the module. It is only present to make it possible to
        have I(region) present in the module default group.
    type: str
author:
  - Felix Fontein (@felixfontein)
extends_documentation_fragment:
  - amazon.aws.common.modules
  - amazon.aws.boto3
z
#
an  
# Example when using a single route53 invocation:

- name: Add new.foo.com as an A record with 3 IPs
  amazon.aws.route53:
    state: present
    zone: foo.com
    record: new.foo.com
    type: A
    ttl: 7200
    value:
      - 1.1.1.1
      - 2.2.2.2
      - 3.3.3.3
  register: module_result

# do something else

- name: Wait for the changes of the above route53 invocation to propagate
  community.aws.route53_wait:
    result: "{{ module_result }}"

#########################################################################
# Example when using a loop over amazon.aws.route53:

- name: Add various A records
  amazon.aws.route53:
    state: present
    zone: foo.com
    record: "{{ item.record }}"
    type: A
    ttl: 300
    value: "{{ item.value }}"
  loop:
    - record: new.foo.com
      value: 1.1.1.1
    - record: foo.foo.com
      value: 2.2.2.2
    - record: bar.foo.com
      value:
        - 3.3.3.3
        - 4.4.4.4
  register: module_results

# do something else

- name: Wait for the changes of the above three route53 invocations to propagate
  community.aws.route53_wait:
    results: "{{ module_results }}"
    N)	to_native)
get_waiter)AnsibleCommunityAWSModule   c           	   #     K   d| v rdD ]  }|| vst        d| d       t        | d   t              st        d      t        | d         D ]R  \  }}t        |t              st        d|dz    d      d	D ]  }||vst        d| d
|dz           d|dz    |f T y dD ]  }|| vst        d| d       d| f y w)Nresults)changedmsgskippedzmissing z keyz"results is present, but not a listzresult    z is not a dictionary)r	   failedansible_loop_var
invocationz key for result z for result #)r	   r    )
ValueError
isinstancelist	enumeratedict)r   keyindexresults       n/home/dcms/DCMS/lib/python3.12/site-packages/ansible_collections/community/aws/plugins/modules/route53_wait.pydetect_task_resultsr   n   s     G0 	7C'! 8C5!566	7 '),d3ABB&wy'9: 	6ME6fd+ 7519+5I!JKKN Rf$$xu4DUQYK%PQQR "%!)-v55	6 	$ 3gxuD1223 g+s   CA-C?-C-Cc            	         t        t        dddg      t        dd      t        d	      
      } t        | d      }|j                  d   }|j                  j                  d      }g }	 t	        |      D ]-  \  }}|j                  d      s|j                  ||d   f       / 	 	 |j                  d      }|D ];  \  }
}	 t        d      }|j                  |t        t         |t         z               = |j+                  d       y # t        $ r(}|j                  dt        |              Y d }~d }~ww xY w# t        j                  j                  $ r}	|j                  |	d       Y d }	~	d }	~	ww xY w# t        j                  j"                  $ r!}	|j                  |	d|
 d       Y d }	~	d }	~	wt        j                  j$                  t        j                  j&                  f$ r}	|j                  |	d       Y d }	~	Nd }	~	wt(        $ r*}	|j                  dt        |	       d       Y d }	~	d }	~	ww xY w)Nr   Tr   )typerequiredaliasesinti,  )r   defaultstr)r   )r   wait_timeoutregion)argument_specsupports_check_moder   r"   wait_idzLThe value passed as result does not seem to be a registered route53 result: )r
   route53zFailed to connect to AWSresource_record_sets_changed)DelayMaxAttempts)IdWaiterConfigz,Timeout waiting for resource records changesz to be appliedzFailed to update recordszUnhandled exception. ()F)r	   )r   AnsibleAWSModuleparamsgetr   appendr   	fail_jsonr   clientbotocore
exceptionsHTTPClientErrorfail_json_awsr   wait
WAIT_RETRYWaiterErrorBotoCoreErrorClientError	Exception	exit_json)r$   module	result_inwait_timeout_inchanged_resultsdescriptionr   excr'   ewhatr&   waiters                r   mainrH      s@   $Duc2M MtTFh'Imm''7OO
#6y#A 	IKzz)$&&VI5F'GH	I@--	* ) Kg	K)GHFKK!$ /: =  K( U#?  
^_hil_m^no 	 	
 	

 .. @Q$>??@ "".. 	m  *VW[V\\j(k ll--++
 	D   (B CC 	K#9)A,q!IJJ	Ksf   +"D D (E  5E=	D=D88D= E:E55E:=H?F66:H?0H		H?H::H?__main__)DOCUMENTATIONRETURNEXAMPLESr4   ImportErroransible.module_utils._textr   ;ansible_collections.amazon.aws.plugins.module_utils.waitersr   >ansible_collections.community.aws.plugins.module_utils.modulesr   r.   r9   r   rH   __name__     r   <module>rT      sh    D
1f	 1 R x
.0$f zF m  		s   4 <<