
    VhO                     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: backup
version_added: "1.0.0"
author:
    - WangBaoshan (@ieisystem)
short_description: Backup server settings
description:
   - Backup server settings on ieisystem Server.
notes:
   - Does not support C(check_mode).
options:
    bak_file:
        description:
            - Backup file or bak folder.
        required: true
        type: str
    item:
        description:
            - Export item.
            - The values for M5 modules are 'all', 'network', 'service', 'ntp', 'snmptrap', 'dns', 'smtp', 'ad', 'ldap', 'user', 'bios'.
            - The values for M6 modules are 'all', 'network', 'service', 'ntp', 'snmptrap',  'kvm', 'ipmi', 'authentication', 'syslog'.
            - The values for M7 modules are 'all', 'network', 'service', 'syslog', 'ncsi'.
        choices: ['all', 'network', 'service', 'ntp', 'snmptrap', 'dns', 'smtp', 'ad', 'ldap',
         'user', 'bios', 'kvm', 'ipmi', 'authentication', 'syslog', 'ncsi']
        required: true
        type: str
extends_documentation_fragment:
    - ieisystem.inmanage.inmanage
ak  
- name: Backup test
  hosts: inmanage
  connection: local
  gather_facts: false
  vars:
    inmanage:
      host: "{{ ansible_ssh_host }}"
      username: "{{ username }}"
      password: "{{ password }}"

  tasks:

  - name: "Backup server settings"
    ieisystem.inmanage.backup:
      bak_file: "/home/wbs/"
      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)Backupc                 ^    || _         d | _        | j                          t               | _        y )N)specmoduleinit_moduledictresults)selfargument_specs     m/home/dcms/DCMS/lib/python3.12/site-packages/ansible_collections/ieisystem/inmanage/plugins/modules/backup.py__init__zBackup.__init__R   s%    !	v    c                 <    t        | j                  d      | _        y)zInit module objectF)r   supports_check_modeN)r   r   r   r   s    r   r   zBackup.init_moduleX   s     $))@r   c                 j    d| j                   j                  d<   t        | j                         | _        y )Nbackup
subcommand)r   paramsr   r   r   s    r   run_commandzBackup.run_command^   s&    +3<(%dkk2r   c                 P     | j                   j                  di | j                   y)zShow resultN )r   	exit_jsonr   r   s    r   show_resultzBackup.show_resultb   s    --r   c                 D    | j                          | j                          y)WorkerN)r   r!   r   s    r   workzBackup.workf   s    r   N)__name__
__module____qualname__r   r   r   r!   r$   r   r   r   r
   r
   Q   s    @3.r   r
   c            	          t        t        dd      t        ddg d            } | j                  t               t        |       }|j	                          y )NstrT)typerequired)allnetworkservicentpsnmptrapdnssmtpadldapuserbioskvmipmiauthenticationsyslogncsi)r*   r+   choices)bak_fileitem)r   updater   r
   r$   )r   
backup_objs     r   mainrA   l   sN    540ut 6A BM
 /0&JOO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
   rA   r%   r   r   r   <module>rK      sU    C B>(
 5 yV 6 zF r   