
    Vh                     h    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mZmZ d Zedk(  r e        y	y	)
    )absolute_importdivisionprint_functiona  
module: reset_info
short_description: Query information on the resetter of a dedicated server
version_added: 2.2.0
author:
  - Felix Fontein (@felixfontein)
description:
  - Query information on the resetter of a dedicated server.
seealso:
  - module: community.hrobot.reset
    description: Reset dedicated server.
extends_documentation_fragment:
  - community.hrobot.robot
  - community.hrobot.attributes
  - community.hrobot.attributes.actiongroup_robot
  - community.hrobot.attributes.idempotent_not_modify_state
  - community.hrobot.attributes.info_module

options:
  server_number:
    description:
      - The server number of the server to query its resetter.
    type: int
    required: true
a
  
---
- name: Query resetter information for server 1234
  community.hrobot.reset_info:
    hetzner_user: foo
    hetzner_password: bar
    server_number: 1234
  register: result

- name: Show reset methods
  ansible.builtin.debug:
    msg: "{{ result.reset.type }}"
aM  
reset:
  description:
    - Information on the server's resetter.
  type: dict
  returned: success
  contains:
    server_ip:
      description:
        - The primary IPv4 address of the server.
      type: str
      returned: success
      sample: 123.123.123.123
    server_ipv6_net:
      description:
        - The primary IPv6 network of the server.
      type: str
      returned: success
      sample: "2a01:4f8:111:4221::"
    server_number:
      description:
        - The server's ID.
      type: int
      returned: success
      sample: 321
    type:
      description:
        - The reset types supported by the resetter.
        - "Can be used for the O(community.hrobot.reset#module:reset_type) option of the M(community.hrobot.reset) module."
      type: list
      elements: str
      returned: success
      sample: [software, hardware, manual]
      choices:
        - software
        - hardware
        - power
        - manual
    operating_status:
      description:
        - The server's operating status.
      type: str
      returned: success
      sample: not supported
)AnsibleModule)BASE_URLROBOT_DEFAULT_ARGUMENT_SPECfetch_url_jsonc                  $   t        t        dd            } | j                  t               t        | d      }|j                  d   }dj                  t        |      }t        ||dd	g
      \  }}|dk(  r|j                  d       |d	k(  r|j                  d       t        |d         }|j                  d      }t        |t              r*ddddd}|D 	cg c]  }	|j                  |	|	       c}	|d<   |j                  |d       y c c}	w )NintT)typerequired)server_number)argument_specsupports_check_moder   z{0}/reset/{1}SERVER_NOT_FOUNDRESET_NOT_AVAILABLE)accept_errorszCThis server does not exist, or you do not have access rights for it)msgz(The server has no reset option availableresetr   softwarehardwarepowermanual)swhwr   man)r   changed)dictupdater   r   paramsformatr   r	   	fail_jsonget
isinstancelist	exit_json)
r   moduler   urlresulterrorr   reset_typestranslationelts
             o/home/dcms/DCMS/lib/python3.12/site-packages/ansible_collections/community/hrobot/plugins/modules/reset_info.pymainr/   k   s   5M 45# F
 MM/2M

 
 =
9C"63?QSh>ijMFE""bc%%GH!E))F#K+t$	
 ?JJsc2Jf
5$/ Ks   D__main__N)
__future__r   r   r   r   __metaclass__DOCUMENTATIONEXAMPLESRETURNansible.module_utils.basicr   ?ansible_collections.community.hrobot.plugins.module_utils.robotr   r   r	   r/   __name__     r.   <module>r;      sR    A @4,
\ 5 0D zF r:   