
    Vh                     z    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  G d de      Zd	 Zed
k(  r e        yy)    )absolute_importdivisionprint_functiona  
---
module: restore
version_added: "1.0.0"
author:
    - WangBaoshan (@ieisystem)
short_description: Restore server settings
description:
   -  Restore server settings on ieisystem Server.
notes:
   - Does not support C(check_mode).
options:
    bak_file:
        description:
            - Select backup file or bak folder.
        required: true
        type: str
    item:
        description:
            - Select export item.
            - Only the M5 model supports this parameter.
        choices: ['all', 'network', 'dns', 'service', 'ntp', 'smtp', 'snmptrap', 'ad', 'ldap', 'user', 'bios']
        type: str
extends_documentation_fragment:
    - ieisystem.inmanage.inmanage
av  
- name: Restore test
  hosts: inmanage
  connection: local
  gather_facts: false
  vars:
    inmanage:
      host: "{{ ansible_ssh_host }}"
      username: "{{ username }}"
      password: "{{ password }}"

  tasks:

  - name: "Restore server settings"
    ieisystem.inmanage.restore:
      bak_file: "/home/wbs/backfile"
      item: "all"
      provider: "{{ inmanage }}"
a1  
message:
    description: Messages returned after module execution.
    returned: always
    type: str
state:
    description: Status after module execution.
    returned: always
    type: str
changed:
    description: Check to see if a change was made on the device.
    returned: always
    type: bool
)AnsibleModule)inmanage_argument_specget_connectionc                   *    e Zd Zd Zd Zd Zd Zd Zy)Restorec                 ^    || _         d | _        | j                          t               | _        y )N)specmoduleinit_moduledictresults)selfargument_specs     n/home/dcms/DCMS/lib/python3.12/site-packages/ansible_collections/ieisystem/inmanage/plugins/modules/restore.py__init__zRestore.__init__N   s%    !	v    c                 <    t        | j                  d      | _        y)zInit module objectF)r   supports_check_modeN)r   r   r   r   s    r   r   zRestore.init_moduleT   s     $))@r   c                     d| j                   j                  d<   t        | j                         | _        | j                  d   dk(  rd| j                  d<   y y )Nrestore
subcommandStateSuccessTchanged)r   paramsr   r   r   s    r   run_commandzRestore.run_commandZ   sJ    +4<(%dkk2<< I-&*DLL# .r   c                 P     | j                   j                  di | j                   y)zShow resultN )r   	exit_jsonr   r   s    r   show_resultzRestore.show_result`   s    --r   c                 D    | j                          | j                          y)WorkerN)r    r$   r   s    r   workzRestore.workd   s    r   N)__name__
__module____qualname__r   r   r    r$   r'   r"   r   r   r
   r
   M   s    @+.r   r
   c            	          t        t        dd      t        ddg d            } | j                  t               t        |       }|j	                          y )NstrT)typerequiredF)allnetworkdnsservicentpsmtpsnmptrapadldapuserbios)r-   r.   choices)bak_fileitem)r   updater   r
   r'   )r   restore_objs     r   mainr?   j   sP    540uu  7T  UM /0-(Kr   __main__N)
__future__r   r   r   r-   __metaclass__DOCUMENTATIONEXAMPLESRETURNansible.module_utils.basicr   Dansible_collections.ieisystem.inmanage.plugins.module_utils.inmanager   r   objectr
   r?   r(   r"   r   r   <module>rI      sU    C B6(
 5 yf : zF r   