
    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_functionaY  
---
module: ldap_group
version_added: "1.0.0"
author:
    - WangBaoshan (@ieisystem)
short_description: Manage ldap group information
description:
   - Manage ldap group information on ieisystem Server.
notes:
   - Does not support C(check_mode).
options:
    state:
        description:
            - Whether the ldap group should exist or not, taking action if the state is different from what is stated.
        choices: ['present', 'absent']
        default: present
        type: str
    name:
        description:
            - Group name.
        type: str
        required: true
    base:
        description:
            - Search Base.
        type: str
    pri:
        description:
            - Group privilege.
        choices: ['administrator', 'user', 'operator', 'oem', 'none']
        type: str
    kvm:
        description:
            - Kvm privilege.
        choices: ['enable', 'disable']
        type: str
    vm:
        description:
            - Vmedia privilege.
        choices: ['enable', 'disable']
        type: str
extends_documentation_fragment:
    - ieisystem.inmanage.inmanage
a   
- name: Ldap group test
  hosts: inmanage
  connection: local
  gather_facts: false
  vars:
    inmanage:
      host: "{{ ansible_ssh_host }}"
      username: "{{ username }}"
      password: "{{ password }}"

  tasks:

  - name: "Add ldap group information"
    ieisystem.inmanage.ldap_group:
      state: "present"
      name: "wbs"
      base: "cn=manager"
      pri: "administrator"
      kvm: "enable"
      vm: "disable"
      provider: "{{ inmanage }}"

  - name: "Set ldap group information"
    ieisystem.inmanage.ldap_group:
      state: "present"
      name: "wbs"
      pri: "user"
      kvm: "disable"
      provider: "{{ inmanage }}"

  - name: "Delete ldap group information"
    ieisystem.inmanage.ldap_group:
      state: "absent"
      name: "wbs"
      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)LDAPc                 ^    || _         d | _        | j                          t               | _        y )N)specmoduleinit_moduledictresults)selfargument_specs     q/home/dcms/DCMS/lib/python3.12/site-packages/ansible_collections/ieisystem/inmanage/plugins/modules/ldap_group.py__init__zLDAP.__init__s   s%    !	v    c                 <    t        | j                  d      | _        y)zInit module objectF)r   supports_check_modeN)r   r   r   r   s    r   r   zLDAP.init_moduley   s     $))@r   c                     d| j                   j                  d<   t        | j                         | _        | j                  d   dk(  rd| j                  d<   y y )Neditldapgroup
subcommandStateSuccessTchanged)r   paramsr   r   r   s    r   run_commandzLDAP.run_command   sJ    +:<(%dkk2<< I-&*DLL# .r   c                 P     | j                   j                  di | j                   y)zShow resultN )r   	exit_jsonr   r   s    r   show_resultzLDAP.show_result   s    --r   c                 D    | j                          | j                          y)WorkerN)r    r$   r   s    r   workz	LDAP.work   s    r   N)__name__
__module____qualname__r   r   r    r$   r'   r"   r   r   r
   r
   r   s    @+.r   r
   c                  "   t        t        dddgd      t        dd      t        dd      t        ddg d	      t        ddd
dg	      t        ddd
dg	            } | j                  t               t        |       }|j	                          y )Nstrpresentabsent)typechoicesdefaultT)r/   requiredF)administratoruseroperatoroemnone)r/   r2   r0   enabledisable)statenamebaseprikvmvm)r   updater   r
   r'   )r   ldap_objs     r   mainrB      s    	8'<iPut,uu-ee5ijeeh	5JKUUXy4IJM /0M"HMMOr   __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
   rB   r(   r"   r   r   <module>rL      sW    C B,\$L
 5 y6 : zF r   