
    Vh[                     t    d dl mZmZmZ eZdZdZdZd dl	m
Z
 d dlmZ d dlmZmZmZ d Zed	k(  r e        y
y
)    )absolute_importdivisionprint_functiona
  
module: reverse_dns
short_description: Set or remove reverse DNS entry for IP
version_added: 1.2.0
author:
  - Felix Fontein (@felixfontein)
description:
  - Allows to set, update or remove a reverse DNS entry for an IP address.
extends_documentation_fragment:
  - community.hrobot.robot
  - community.hrobot.attributes
  - community.hrobot.attributes.actiongroup_robot
notes:
  - For the main IPv4 address of a server, deleting it actually sets it to a default hostname like C(static.X.Y.Z.W.clients.your-server.de).
    This substitution (delete is replaced by changing to this value) is done automatically by the API and results in the module
    not being idempotent in this case.
attributes:
  action_group:
    version_added: 1.6.0
  check_mode:
    support: full
  diff_mode:
    support: none
  idempotent:
    support: full

options:
  ip:
    description:
      - The IP address to set or remove a reverse DNS entry for.
    type: str
    required: true
  state:
    description:
      - Whether to set or update (V(present)) or delete (V(absent)) the reverse DNS entry for O(ip).
    type: str
    default: present
    choices:
      - present
      - absent
  value:
    description:
      - The reverse DNS entry for O(ip).
      - Required if O(state=present).
    type: str
ad  
---
- name: Set reverse DNS entry for 1.2.3.4
  community.hrobot.reverse_dns:
    hetzner_user: foo
    hetzner_password: bar
    ip: 1.2.3.4
    value: foo.example.com

- name: Remove reverse DNS entry for 2a01:f48:111:4221::1
  community.hrobot.reverse_dns:
    hetzner_user: foo
    hetzner_password: bar
    ip: 2a01:f48:111:4221::1
    state: absent
#)AnsibleModule)	urlencode)BASE_URLROBOT_DEFAULT_ARGUMENT_SPECfetch_url_jsonc                     t        t        dd      t        dddgd      t        d            } | j                  t               t        | dd	dd
gfg      }|j                  d   }|j                  d	   }|j                  d
   }dj                  t        |      }t        ||ddg      \  }}|dk(  rd }n;|r1|dk(  r|j                  d       t        dj                  |            |d   d   }d}	|dk(  r|nd }
||
k7  rAd}	|j                  s3|
t        ||dd       n!ddi}d|
i}t        ||t        |      |d       |j                  |	       y )NstrT)typerequiredpresentabsent)r   choicesdefault)r   )ipstatevaluer   r   )argument_specsupports_check_moderequired_ifr   z{0}/rdns/{1}IP_NOT_FOUNDRDNS_NOT_FOUND)accept_errorszThe IP address was not found)msgzUnexpected error {0}rdnsptrFDELETE)methodallow_empty_resultzContent-typez!application/x-www-form-urlencodedPOST)dataheadersr!   )changed)dictupdater
   r   paramsformatr	   r   	fail_jsonAssertionError
check_moder   	exit_json)r   moduler   r   r   urlresulterrorcurrentr&   expectedr%   r$   s                p/home/dcms/DCMS/lib/python3.12/site-packages/ansible_collections/community/hrobot/plugins/modules/reverse_dns.pymainr6   X   s~   UT*	8'<iPM
 45# y7)45F 
t	BMM'"EMM'"E


"
-C"63~O_>`aMFE  	N"!?@3::5ABB.'G*uH(  vs8PTU)+NOx(vs4'Z`a
W%    __main__N)
__future__r   r   r   r   __metaclass__DOCUMENTATIONEXAMPLESRETURNansible.module_utils.basicr   +ansible.module_utils.six.moves.urllib.parser   ?ansible_collections.community.hrobot.plugins.module_utils.robotr	   r
   r   r6   __name__ r7   r5   <module>rC      sS    A @-^" 
 4 A )&X zF r7   