
    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_functionaZ  
---
module: edit_ad
version_added: "1.0.0"
author:
    - WangBaoshan (@ieisystem)
short_description: Set active directory information
description:
   - Set active directory information on kaytus Server.
notes:
   - Does not support C(check_mode).
options:
    enable:
        description:
            - Active Directory Authentication Status.
        choices: ['enable', 'disable']
        type: str
    ssl_enable:
        description:
            - Active Directory SSL Status.
        choices: ['enable', 'disable']
        type: str
    name:
        description:
            - Secret Username. Specify the Username of an administrator of the Active Directory Server.
        type: str
    code:
        description:
            - Secret Password. Specify the Password of the administrator.
        type: str
    timeout:
        description:
            - The Time Out configuration(15-300).
            - Only the M5 model supports this parameter.
        type: int
    domain:
        description:
            - User Domain Name. Specify the Domain Name for the user for example MyDomain.com.
        type: str
    addr1:
        description:
            - Domain Controller Server Address1. Enter the IP address of Active Directory server.
        type: str
    addr2:
        description:
            - Domain Controller Server Address2. Enter the IP address of Active Directory server.
        type: str
    addr3:
        description:
            - Domain Controller Server Address3. Enter the IP address of Active Directory server.
        type: str
extends_documentation_fragment:
    - kaytus.ksmanage.ksmanage
az  
- name: Ad test
  hosts: ksmanage
  connection: local
  gather_facts: false
  vars:
    ksmanage:
      host: "{{ ansible_ssh_host }}"
      username: "{{ username }}"
      password: "{{ password }}"

  tasks:

  - name: "Set active directory information"
    kaytus.ksmanage.edit_ad:
      enable: "disable"
      provider: "{{ ksmanage }}"

  - name: "Set active directory information"
    kaytus.ksmanage.edit_ad:
      enable: "enable"
      name: "test"
      code: "123456"
      timeout: 120
      domain: "test.com"
      addr1: "100.2.2.2"
      addr2: "100.2.2.3"
      addr3: "100.2.2.4"
      provider: "{{ ksmanage }}"
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)ksmanage_argument_specget_connectionc                   *    e Zd Zd Zd Zd Zd Zd Zy)ADc                 ^    || _         d | _        | j                          t               | _        y )N)specmoduleinit_moduledictresults)selfargument_specs     k/home/dcms/DCMS/lib/python3.12/site-packages/ansible_collections/kaytus/ksmanage/plugins/modules/edit_ad.py__init__zAD.__init__u   s%    !	v    c                 <    t        | j                  d      | _        y)zInit module objectF)r   supports_check_modeN)r   r   r   r   s    r   r   zAD.init_module{   s     $))@r   c                     d| j                   j                  d<   t        | j                         | _        | j                  d   dk(  rd| j                  d<   y y )Nsetad
subcommandStateSuccessTchanged)r   paramsr   r   r   s    r   run_commandzAD.run_command   sJ    +2<(%dkk2<< I-&*DLL# .r   c                 P     | j                   j                  di | j                   y)zShow resultN )r   	exit_jsonr   r   s    r   show_resultzAD.show_result   s    --r   c                 D    | j                          | j                          y)WorkerN)r    r$   r   s    r   workzAD.work   s    r   N)__name__
__module____qualname__r   r   r    r$   r'   r"   r   r   r
   r
   t   s    @+.r   r
   c                  ^   t        t        ddddg      t        ddddg      t        dd      t        dd      t        dd      t        dd      t        dd      t        dd      t        dd      	      } | j                  t               t        |       }|j	                          y )	NstrFenabledisable)typerequiredchoices)r/   r0   int)	r-   
ssl_enablenamecodetimeoutdomainaddr1addr2addr3)r   updater   r
   r'   )r   ad_objs     r   mainr=      s    98MNUUXy<QRuu-uu-%%0/...
M /0F
KKMr   __main__N)
__future__r   r   r   r/   __metaclass__DOCUMENTATIONEXAMPLESRETURNansible.module_utils.basicr   Aansible_collections.kaytus.ksmanage.plugins.module_utils.ksmanager   r   objectr
   r=   r(   r"   r   r   <module>rG      sV    C B5n>
 5 v :" zF r   