
    Vh|                         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
  e
j                         d        Zd	 Zd
 Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zedk(  r e        yy# e$ r Y hw xY w)aA  
module: route53_info
short_description: Retrieves Route 53 details using AWS methods
version_added: 5.0.0
description:
  - Gets various details related to Route 53 zone, record set or health check details.
  - This module was originally added to C(community.aws) in release 1.0.0.
options:
  query:
    description:
      - Specifies the query action to take.
    required: true
    choices: [
            'change',
            'checker_ip_range',
            'health_check',
            'hosted_zone',
            'record_sets',
            'reusable_delegation_set',
            ]
    type: str
  change_id:
    description:
      - The ID of the change batch request.
      - The value that you specify here is the value that
        ChangeResourceRecordSets returned in the Id element
        when you submitted the request.
      - Required if O(query=change).
    required: false
    type: str
  hosted_zone_id:
    description:
      - The Hosted Zone ID of the DNS zone.
      - Required if O(query) is set to V(hosted_zone) and O(hosted_zone_method) is set to V(details).
      - Required if O(query) is set to V(record_sets).
    required: false
    type: str
  max_items:
    description:
      - Maximum number of items to return for various get/list requests.
    required: false
    type: int
  next_marker:
    description:
      - "Some requests such as list_command: hosted_zones will return a maximum
        number of entries - EG 100 or the number specified by O(max_items).
        If the number of entries exceeds this maximum another request can be sent
        using the NextMarker entry from the first response to get the next page
        of results."
    required: false
    type: str
  delegation_set_id:
    description:
      - The DNS Zone delegation set ID.
    required: false
    type: str
  start_record_name:
    description:
      - "The first name in the lexicographic ordering of domain names that you want
        the list_command: record_sets to start listing from."
    required: false
    type: str
  type:
    description:
      - The type of DNS record.
    required: false
    choices: [ 'A', 'CNAME', 'MX', 'AAAA', 'TXT', 'PTR', 'SRV', 'SPF', 'CAA', 'NS', 'NAPTR', 'SOA', 'DS' ]
    type: str
  dns_name:
    description:
      - The first name in the lexicographic ordering of domain names that you want
        the list_command to start listing from.
    required: false
    type: str
  resource_id:
    description:
      - The ID/s of the specified resource/s.
      - Required if O(query=health_check) and O(health_check_method=tags).
      - Required if O(query=hosted_zone) and O(hosted_zone_method=tags).
    required: false
    aliases: ['resource_ids']
    type: list
    elements: str
  health_check_id:
    description:
      - The ID of the health check.
      - Required if V(query) is set to V(health_check) and
        O(health_check_method) is set to V(details) or V(status) or V(failure_reason).
    required: false
    type: str
  hosted_zone_method:
    description:
      - "This is used in conjunction with query: hosted_zone.
        It allows for listing details, counts or tags of various
        hosted zone details."
    required: false
    choices: [
        'details',
        'list',
        'list_by_name',
        'count',
        'tags',
        ]
    default: 'list'
    type: str
  health_check_method:
    description:
      - "This is used in conjunction with query: health_check.
        It allows for listing details, counts or tags of various
        health check details."
    required: false
    choices: [
        'list',
        'details',
        'status',
        'failure_reason',
        'count',
        'tags',
        ]
    default: 'list'
    type: str
author:
  - Karen Cheng (@Etherdaemon)
extends_documentation_fragment:
  - amazon.aws.common.modules
  - amazon.aws.region.modules
  - amazon.aws.boto3
a`  
# Simple example of listing all hosted zones
- name: List all hosted zones
  amazon.aws.route53_info:
    query: hosted_zone
  register: hosted_zones

# Getting a count of hosted zones
- name: Return a count of all hosted zones
  amazon.aws.route53_info:
    query: hosted_zone
    hosted_zone_method: count
  register: hosted_zone_count

- name: List the first 20 resource record sets in a given hosted zone
  amazon.aws.route53_info:
    profile: account_name
    query: record_sets
    hosted_zone_id: ZZZ1111112222
    max_items: 20
  register: record_sets

- name: List first 20 health checks
  amazon.aws.route53_info:
    query: health_check
    health_check_method: list
    max_items: 20
  register: health_checks

- name: Get health check last failure_reason
  amazon.aws.route53_info:
    query: health_check
    health_check_method: failure_reason
    health_check_id: 00000000-1111-2222-3333-12345678abcd
  register: health_check_failure_reason

- name: Retrieve reusable delegation set details
  amazon.aws.route53_info:
    query: reusable_delegation_set
    delegation_set_id: delegation id
  register: delegation_sets

- name: setup of example for using next_marker
  amazon.aws.route53_info:
    query: hosted_zone
    max_items: 1
  register: first_info

- name: example for using next_marker
  amazon.aws.route53_info:
    query: hosted_zone
    next_marker: "{{ first_info.NextMarker }}"
    max_items: 1
  when: "'NextMarker' in first_info"

- name: retrieve host entries starting with host1.workshop.test.io
  block:
    - name: grab zone id
      amazon.aws.route53_zone:
        zone: "test.io"
      register: AWSINFO

    - name: grab Route53 record information
      amazon.aws.route53_info:
        type: A
        query: record_sets
        hosted_zone_id: "{{ AWSINFO.zone_id }}"
        start_record_name: "host1.workshop.test.io"
      register: RECORDS
a:  
resource_record_sets:
    description: A list of resource record sets returned by list_resource_record_sets in boto3.
    returned: when O(query=record_sets)
    type: list
    elements: dict
    contains:
        name:
            description: The name of a record in the specified hosted zone.
            type: str
            sample: 'www.example.com'
        type:
            description: The DNS record type.
            type: str
            sample: 'A'
        ttl:
            description: The resource record cache time to live (TTL), in seconds.
            type: int
            sample: 60
        set_identifier:
            description: An identifier that differentiates among multiple resource record sets that have the same combination of name and type.
            type: str
            sample: 'abcd'
        resource_records:
            description: Information about the resource records.
            type: list
            elements: dict
            contains:
                value:
                    description: The current or new DNS record value.
                    type: str
                    sample: 'ns-12.awsdns-34.com.'
        geo_location:
            description: The specified geographic location for which the Route53 responds to based on location.
            type: dict
            elements: str
            contains:
                continent_code:
                    description: The two-letter code for the continent.
                    type: str
                    sample: 'NA'
                country_code:
                    description: The two-letter code for a country.
                    type: str
                    sample: 'US'
                subdivision_code:
                    description: The two-letter code for a state of the United States
                    type: str
                    sample: 'NY'
    version_added: 4.0.0
    version_added_collection: community.aws
hosted_zones:
    description: A list of hosted zones returned by list_hosted_zones in boto3.
    returned: when O(query=hosted_zone)
    type: list
    elements: dict
    contains:
        id:
            description: The ID of the hosted zone assigned by Amazon Route53 to the hosted zone at the creation time.
            type: str
            sample: '/hostedzone/Z01234567AB1234567890'
        name:
            description: The name of the domain.
            type: str
            sample: 'example.io'
        resource_record_set_count:
            description: The number of resource record sets in the hosted zone.
            type: int
            sample: 3
        caller_reference:
            description: The value specified for CallerReference at the time of hosted zone creation.
            type: str
            sample: '01d0db12-x0x9-12a3-1234-0z000z00zz0z'
        config:
            description: A dict that contains Comment and PrivateZone elements.
            type: dict
            contains:
                comment:
                    description: Any comments that included about in the hosted zone.
                    type: str
                    sample: 'HostedZone created by Route53 Registrar'
                private_zone:
                    description: A value that indicates whether this is a private hosted zone or not.
                    type: bool
                    sample: false
    version_added: 4.0.0
    version_added_collection: community.aws
health_checks:
    description: A list of Route 53 health checks returned by list_health_checks in boto3.
    type: list
    elements: dict
    returned: when O(query=health_check)
    contains:
        id:
            description: The identifier that Amazon Route53 assigned to the health check at the time of creation.
            type: str
            sample: '12345cdc-2cc4-1234-bed2-123456abc1a2'
        health_check_version:
            description: The version of the health check.
            type: str
            sample: 1
        caller_reference:
            description: A unique string that you specified when you created the health check.
            type: str
            sample: '01d0db12-x0x9-12a3-1234-0z000z00zz0z'
        health_check_config:
            description: A dict that contains detailed information about one health check.
            type: dict
            contains:
                disabled:
                    description: Whether Route53 should stop performing health checks on a endpoint.
                    type: bool
                    sample: false
                enable_sni:
                    description: Whether Route53 should send value of FullyQualifiedDomainName to endpoint in client_hello message during TLS negotiation.
                    type: bool
                    sample: true
                failure_threshold:
                    description: The number of consecutive health checks that an endpoint must pass/fail for Route 53 to change current status of endpoint.
                    type: int
                    sample: 3
                fully_qualified_domain_name:
                    description: The fully qualified DNS name of the endpoint on which Route53 performs health checks.
                    type: str
                    sample: 'hello'
                inverted:
                    description: Whether Route53 should invert the status of a health check.
                    type: bool
                    sample: false
                ip_address:
                    description: The IPv4/IPv6 IP address of the endpoint that Route53 should perform health checks on.
                    type: str
                    sample: 192.0.2.44
                measure_latency:
                    description: Whether Route53 should measure latency between health checkers in multiple AWS regions and the endpoint.
                    type: bool
                    sample: false
                port:
                    description: The port of the endpoint that Route53 should perform health checks on.
                    type: int
                    sample: 80
                request_interval:
                    description: The number of seconds between the time that Route53 gets a response from endpoint and the next health check request.
                    type: int
                    sample: 30
                resource_path:
                    description: The path that Route53 requests when performing health checks.
                    type: str
                    sample: '/welcome.html'
                search_string:
                    description: The string that Route 53 uses to search for in the response body from specified resource.
                    type: str
                    sample: 'test-string-to-match'
                type:
                    description: The type of the health check.
                    type: str
                    sample: HTTPS
    version_added: 4.0.0
    version_added_collection: community.aws
checker_ip_ranges:
    description: A list of IP ranges in CIDR format for Amazon Route 53 health checkers.
    returned: when O(query=checker_ip_range)
    type: list
    elements: str
    version_added: 4.1.0
    version_added_collection: community.aws
delegation_sets:
    description: A list of dicts that contains information about the reusable delegation set.
    returned: when O(query=reusable_delegation_set)
    type: list
    elements: dict
    version_added: 4.1.0
    version_added_collection: community.aws
health_check:
    description: A dict of Route53 health check details returned by get_health_check in boto3.
    type: dict
    returned: when O(query=health_check) and O(health_check_method=details)
    contains:
        id:
            description: The identifier that Amazon Route 53 assigned to the health check at the time of creation.
            type: str
            sample: '12345cdc-2cc4-1234-bed2-123456abc1a2'
        health_check_version:
            description: The version of the health check.
            type: str
            sample: 1
        caller_reference:
            description: A unique string that you specified when you created the health check.
            type: str
            sample: '01d0db12-x0x9-12a3-1234-0z000z00zz0z'
        health_check_config:
            description: A dict that contains detailed information about one health check.
            type: dict
            contains:
                disabled:
                    description: Whether Route53 should stop performing health checks on a endpoint.
                    type: bool
                    sample: false
                enable_sni:
                    description: Whether Route53 should send value of FullyQualifiedDomainName to endpoint in client_hello message during TLS negotiation.
                    type: bool
                    sample: true
                failure_threshold:
                    description: The number of consecutive health checks that an endpoint must pass/fail for Route53 to change current status of endpoint.
                    type: int
                    sample: 3
                fully_qualified_domain_name:
                    description: The fully qualified DNS name of the endpoint on which Route53 performs health checks.
                    type: str
                    sample: 'hello'
                inverted:
                    description: Whether Route53 should invert the status of a health check.
                    type: bool
                    sample: false
                ip_address:
                    description: The IPv4/IPv6 IP address of the endpoint that Route53 should perform health checks on.
                    type: str
                    sample: 192.0.2.44
                measure_latency:
                    description: Whether Route53 should measure latency between health checkers in multiple AWS regions and the endpoint.
                    type: bool
                    sample: false
                port:
                    description: The port of the endpoint that Route53 should perform health checks on.
                    type: int
                    sample: 80
                request_interval:
                    description: The number of seconds between the time that Route53 gets a response from endpoint and the next health check request.
                    type: int
                    sample: 30
                resource_path:
                    description: The path that Route53 requests when performing health checks.
                    type: str
                    sample: '/welcome.html'
                search_string:
                    description: The string that Route53 uses to search for in the response body from specified resource.
                    type: str
                    sample: 'test-string-to-match'
                type:
                    description: The type of the health check.
                    type: str
                    sample: HTTPS
    version_added: 4.1.0
    version_added_collection: community.aws
health_check_observations:
    description: A dict of Route53 health check details returned by get_health_check_status and get_health_check_last_failure_reason in boto3.
    type: list
    elements: dict
    returned: when O(query=health_check) and O(health_check_method=status) or O(health_check_method=failure_reason)
    contains:
        ip_address:
            description: The IP address of the Amazon Route 53 health checker that provided the failure reason in StatusReport.
            type: str
            sample: '12.345.67.89'
        region:
            description: The region of the Amazon Route 53 health checker that provided the status in StatusReport.
            type: str
            sample: 'us-west-1'
        status_report:
            description: A complex type that contains the last failure reason and the time of the failed health check.
            type: dict
            contains:
                checked_time:
                    description: The date and time that the health checker performed the health check in ISO 8601 format and Coordinated Universal Time (UTC).
                    type: str
                    sample: '2023-03-08T23:10:08.452000+00:00'
                status:
                    description: A description of the status of the health check endpoint as reported by one of the Amazon Route 53 health checkers.
                    type: str
                    sample: 'Failure: Resolved IP: 12.345.67.89. The connection was closed by the endpoint.'
    version_added: 5.4.0
ResourceRecordSets:
    description: A deprecated CamelCased list of resource record sets returned by list_resource_record_sets in boto3. \
                 This list contains same elements/parameters as it's snake_cased version mentioned above. \
                 This field is deprecated and will be removed in 6.0.0 version release.
    returned: when O(query=record_sets)
    type: list
    elements: dict
HostedZones:
    description: A deprecated CamelCased list of hosted zones returned by list_hosted_zones in boto3. \
                 This list contains same elements/parameters as it's snake_cased version mentioned above. \
                 This field is deprecated and will be removed in 6.0.0 version release.
    returned: when O(query=hosted_zone)
    type: list
    elements: dict
HealthChecks:
    description: A deprecated CamelCased list of Route53 health checks returned by list_health_checks in boto3. \
                 This list contains same elements/parameters as it's snake_cased version mentioned above. \
                 This field is deprecated and will be removed in 6.0.0 version release.
    type: list
    elements: dict
    returned: when O(query=health_check)
CheckerIpRanges:
    description: A deprecated CamelCased list of IP ranges in CIDR format for Amazon Route 53 health checkers.\
                 This list contains same elements/parameters as it's snake_cased version mentioned abobe. \
                 This field is deprecated and will be removed in 6.0.0 version release.
    type: list
    elements: str
    returned: when O(query=checker_ip_range)
DelegationSets:
    description: A deprecated CamelCased list of dicts that contains information about the reusable delegation set. \
                 This list contains same elements/parameters as it's snake_cased version mentioned above. \
                 This field is deprecated and will be removed in 6.0.0 version release.
    type: list
    elements: dict
    returned: when O(query=reusable_delegation_set)
HealthCheck:
    description: A deprecated CamelCased dict of Route53 health check details returned by get_health_check in boto3. \
                 This dict contains same elements/parameters as it's snake_cased version mentioned above. \
                 This field is deprecated and will be removed in 6.0.0 version release.
    type: dict
    returned: when O(query=health_check) and O(health_check_method=details)
    N)camel_dict_to_snake_dict)AnsibleAWSModule)AWSRetryc                 l    t         j                  |       } |j                  di |j                         S )N )clientget_paginatorpaginatebuild_full_result)paginator_nameparams	paginators      k/home/dcms/DCMS/lib/python3.12/site-packages/ansible_collections/amazon/aws/plugins/modules/route53_info.py_paginated_resultr     s1    $$^4I9''99;;    c                      t               } t        j                  j                  d      r#t        j                  j                  d      | d<   nt        j	                  d       t        j                  di | S )Nhosted_zone_idIdHosted Zone Id is requiredmsgr   )dictmoduler   get	fail_jsonr   get_hosted_zoner   s    r   r   r     s[    VF}})*}}(()9:t9:!!+F++r   c                  H   t               } t        j                  j                  d      st        j                  j                  d      r+t	        t        j                  j                  d            | d<   t        j                  j                  d      r"t        j                  j                  d      | d<   t        j                  di | }n7t        j                  j                  d      | d<   t        j                  di | }|d   |d<   t        j                  d	d
d       |S )Ndelegation_set_id	max_itemsMaxItemsnext_markerMarkerDelegationSetIdDelegationSetsdelegation_setszThe 'CamelCase' return values with key 'DelegationSets' is deprecated and will be replaced by 'snake_case' return values with key 'delegation_sets'.  Both case values are returned for now.
2025-01-01
amazon.awsdatecollection_namer   )	r   r   r   r   strr   list_reusable_delegation_setsget_reusable_delegation_set	deprecater   resultss     r   reusable_delegation_set_detailsr2   &  s    VF==01==[)!$V]]%6%6{%C!DF:==]+%}}00?F866@@$*MM$5$56I$J !44>v>!()9!:G
% $   Nr   c                  B   t               } t        j                  j                  d      r,t        t        j                  j                  d            | d<   t        j                  j                  d      r"t        j                  j                  d      | d<   t        j                  j                  d      r"t        j                  j                  d      | d<   t	        di | d   }|D cg c]  }t        |       }}t        j                  d	d
d       |||dS c c}w )Nr    r!   PaginationConfigr"   r#   r   r$   HostedZoneszThe 'CamelCase' return values with key 'HostedZones' and 'list' are deprecated and will be replaced by 'snake_case' return values with key 'hosted_zones'.  Both case values are returned for now.r'   r(   r)   )r6   listhosted_zones)list_hosted_zonesr   r   r   r   r   r   r/   )r   zoneszonesnaked_zoness       r   r9   r9   C  s    VF }}%%)6==3D3D[3Q%R!"}}'!==,,];x}},-$*MM$5$56I$J !<V<]KE?DEt,T2ELE
, $   $  Fs   *Dc                     t               } t        j                  j                  d      r"t        j                  j                  d      | d<   t        j                  j                  d      r"t        j                  j                  d      | d<   t        j                  j                  d      r+t	        t        j                  j                  d            | d<   t        j                  di | S )Nr   HostedZoneIddns_nameDNSNamer    r!   r   )r   r   r   r   r,   r   list_hosted_zones_by_namer   s    r   rB   rB   d  s    VF}})*!'!2!23C!D~}}$"MM--j9y}}% !2!2;!?@z++5f55r   c                      t               } t        j                  j                  d      r#t        j                  j                  d      | d<   nt        j	                  d       t        j                  di | }|S )N	change_idr   zchange_id is requiredr   r   )r   r   r   r   r   r   
get_changer0   s     r   change_detailsrF   s  s]    VF}}%}}((5t45)&)GNr   c                  n    t         j                         } | d   | d<   t        j                  ddd       | S )NCheckerIpRangeschecker_ip_rangeszThe 'CamelCase' return values with key 'CheckerIpRanges' is deprecated and will be replaced by 'snake_case' return values with key 'checker_ip_ranges'.  Both case values are returned for now.r'   r(   r)   )r   get_checker_ip_rangesr   r/   r1   s    r   checker_ip_range_detailsrL     sH    **,G#*+<#=G 
% $   Nr   c                      t         j                  j                  d      dk(  rt        j	                         } | S t        j                         } | S )Nqueryhealth_check)r   r   r   r   get_health_check_countget_hosted_zone_countrK   s    r   	get_countrR     sC    }}!^3//1 N ..0Nr   c                     t               } t               }t        j                  j                  d      st        j	                  d       n"t        j                  j                  d      | d<   t        j                  j                  d      dk(  r@t        j                  di | }t        |d         |d<   t        j                  d	d
d       |S t        j                  j                  d      dk(  r6t        j                  di | }|d   D cg c]  }t        |       c}|d<   |S t        j                  j                  d      dk(  r4t        j                  di | }|d   D cg c]  }t        |       c}|d<   |S c c}w c c}w )Nhealth_check_idzhealth_check_id is requiredr   HealthCheckIdhealth_check_methoddetailsHealthCheckrO   zThe 'CamelCase' return values with key 'HealthCheck' is deprecated and will be replaced by 'snake_case' return values with key 'health_check'.  Both case values are returned for now.r'   r(   r)   failure_reasonHealthCheckObservationshealth_check_observationsstatusr   )r   r   r   r   r   r   get_health_checkr   r/   $get_health_check_last_failure_reasonget_health_check_status)r   r1   responserO   s       r   r]   r]     sv   VFfG==./:;"(--"3"34E"F}}./9<))3F3":7=;Q"R% ( 	 	
, N 
		0	15E	E>>HHGOPiGj0
7C$\20
+, N 
		0	1X	=11;F;GOPiGj0
7C$\20
+, N0
0
s   E?%Fc                  J   t               } t        j                  j                  d      r#t        j                  j                  d      | d<   nt        j	                  d       t        j                  j                  d      dk(  rd| d<   nd	| d<   t        j                  d
i | S )Nresource_idResourceIdsz'resource_id or resource_ids is requiredr   rN   rO   healthcheckResourceType
hostedzoner   )r   r   r   r   r   r   list_tags_for_resourcesr   s    r   get_resource_tagsrh     s    VF}}' & 1 1- @}FG}}!^3!.~!-~))3F33r   c                     t               } t        j                  j                  d      r"t        j                  j                  d      | d<   t        j                  j                  d      r,t        t        j                  j                  d            | d<   t	        di | d   }|D cg c]  }t        |       }}t        j                  ddd	
       |||dS c c}w )Nr"   r#   r    r4   r5   HealthCheckszThe 'CamelCase' return values with key 'HealthChecks' and 'list' are deprecated and will be replaced by 'snake_case' return values with key 'health_checks'.  Both case values are returned for now.r'   r(   r)   )rj   r7   health_checks)list_health_checksr:   )r   rk   rO   snaked_health_checkss       r   rl   rl     s    VF}}'!==,,];x }}%%)6==3D3D[3Q%R!"%EfEnUMWde|4\Bee
, $   &-  fs   )Cc                     t               } t        j                  j                  d      r#t        j                  j                  d      | d<   nt        j	                  d       t        j                  j                  d      r"t        j                  j                  d      | d<   t        j                  j                  d      r5t        j                  j                  d      st        j	                  d       t        j                  j                  d      r"t        j                  j                  d      | d	<   t        j                  j                  d
      r,t        t        j                  j                  d
            | d<   t        di | d   }|D cg c]  }t        |       }}t        j                  ddd       |||dS c c}w )Nr   r?   r   r   start_record_nameStartRecordNametypez2start_record_name must be specified if type is setStartRecordTyper    r4   r5   ResourceRecordSetszThe 'CamelCase' return values with key 'ResourceRecordSets' and 'list' are deprecated and will be replaced by 'snake_case' return values with key 'resource_record_sets'.  Both case values are returned for now.r'   r(   r)   )rs   r7   resource_record_sets)list_resource_record_sets)r   r   r   r   r   r   r   r/   )r   record_sets
record_setsnaked_record_setss       r   record_sets_detailsry     su   VF}})*!'!2!23C!D~9:}},-$*MM$5$56I$J ! }} ):):;N)OQR}} $*MM$5$5f$= ! }}%%)6==3D3D[3Q%R!"#J6JK_`KQ\]:2:>]]
7 $   * 2  ^s   Gc                      t         t        t        t        t        t        d}  | t        j
                  j                  d                }|S )Nr7   rW   r\   rY   counttagsrV   )rl   r]   rR   rh   r   r   r   )health_check_invocationsr1   s     r   health_check_detailsr     sD    "#"*!  Q&v}}'8'89N'OPRGNr   c                      t         t        t        t        t        d}  | t
        j                  j                  d                }|S )NrW   r7   list_by_namer|   r}   hosted_zone_method)r   r9   rB   rR   rh   r   r   r   )hosted_zone_invocationsr1   s     r   hosted_zone_detailsr   #  sA    "!1! O%fmm&7&78L&MNPGNr   c                     t        t        g dd      t               t               t        d      t               t               t               t        dg d      t               t        d	d
gd      t               t        g dd	      t        g dd	            } t        | dddggd      a	 t        j                  dt	        j
                               at        t        t        t        t        t         d}t        d      }	  |t        j"                  j%                  d                }t        j&                  di | y # t        j                  j                  t        j                  j                  f$ r!}t        j                  |d       Y d }~d }~ww xY w# t        j                  j                  t        j                  j                  f$ r!}t        j                  |d       Y d }~d }~ww xY w)N)changechecker_ip_rangerO   hosted_zonerv   reusable_delegation_setT)choicesrequiredint)rq   r,   )ACNAMEMXAAAATXTPTRSRVSPFCAANSNAPTRSOADS)rq   r   r7   resource_ids)rq   aliaseselementsr   )r   defaultr{   )rN   rD   r   r    r"   r   ro   rq   r@   rb   rT   r   rV   r   rV   F)argument_specsupports_check_modemutually_exclusivecheck_boto3route53)retry_decoratorzFailed to connect to AWSr   )changedrN   zQuery failedr   )r   r   r   r   r   jittered_backoffbotocore
exceptionsClientErrorBotoCoreErrorfail_json_awsrF   rL   r   r   ry   r2   r   r   	exit_json)r   einvocationsr1   s       r   mainr   0  s     

 &vE"F&&o
 f~.>O(\flm  

5%MN # !#89
 F@y(:S:S:UV
 !4,**#BK 5!G49+fmm//89; w% ++X-@-@-N-NO @Q$>??@ ++X-@-@-N-NO 4QN334s0   /)E 'F 7F:FF7G6G11G6__main__)DOCUMENTATIONEXAMPLESRETURNr   ImportError0ansible.module_utils.common.dict_transformationsr   ;ansible_collections.amazon.aws.plugins.module_utils.modulesr   ;ansible_collections.amazon.aws.plugins.module_utils.retriesr   r   r   r   r2   r9   rB   rF   rL   rR   r]   rh   rl   ry   r   r   r   __name__r   r   r   <module>r      s   BENx
t		 V X P < <
,:B6	 "J4 <'T
H V zF a  		s   A- -A54A5