
    Vh                     z    d dl mZmZmZ eZdZdZdZd dl	m
Z
mZ d dlmZ  G d de      Zd	 Zed
k(  r e        yy)    )absolute_importdivisionprint_functionaD
  
---
module: user_group
version_added: "1.0.0"
author:
    - WangBaoshan (@ieisystem)
short_description: Manage user group
description:
   - Manage user group on ieisystem Server.
notes:
   - Does not support C(check_mode).
options:
    state:
        description:
            - Whether the user 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.
            - The range of group name for M6 model is OEM1, OEM2, OEM3, OEM4.
        required: true
        type: str
    pri:
        description:
            - Group privilege.
            - Required when I(state=present).
            - Only the M5 model supports this parameter.
        choices: ['administrator', 'operator', 'user', 'oem', 'none']
        type: str
    general:
        description:
            - General configuration privilege.
            - Required when I(state=present).
            - Only the M6 model supports this parameter.
        choices: ['enable', 'disable']
        type: str
    power:
        description:
            - Power control privilege.
            - Required when I(state=present).
            - Only the M6 model supports this parameter.
        choices: ['enable', 'disable']
        type: str
    media:
        description:
            - Remote media configuration privilege.
            - Required when I(state=present).
            - Only the M6 model supports this parameter.
        choices: ['enable', 'disable']
        type: str
    kvm:
        description:
            - Remote KVM configuration privilege.
            - Required when I(state=present).
            - Only the M6 model supports this parameter.
        choices: ['enable', 'disable']
        type: str
    security:
        description:
            - Security configuration privilege.
            - Required when I(state=present).
            - Only the M6 model supports this parameter.
        choices: ['enable', 'disable']
        type: str
    debug:
        description:
            - Debug diagnose privilege.
            - Required when I(state=present).
            - Only the M6 model supports this parameter.
        choices: ['enable', 'disable']
        type: str
    self:
        description:
            - Itself configuration privilege.
            - Required when I(state=present).
            - Only the M6 model supports this parameter.
        choices: ['enable', 'disable']
        type: str
extends_documentation_fragment:
    - ieisystem.inmanage.inmanage
ab  
- name: User group test
  hosts: inmanage
  connection: local
  gather_facts: false
  vars:
    inmanage:
      host: "{{ ansible_ssh_host }}"
      username: "{{ username }}"
      password: "{{ password }}"

  tasks:

  - name: "Add user group"
    ieisystem.inmanage.user_group:
      state: "present"
      name: "test"
      pri: "administrator"
      provider: "{{ inmanage }}"

  - name: "Set user group"
    ieisystem.inmanage.user_group:
      state: "present"
      name: "test"
      pri: "user"
      provider: "{{ inmanage }}"

  - name: "Set m6 user group"
    ieisystem.inmanage.user_group:
      state: "present"
      name: "OEM1"
      general: "enable"
      kvm: "enable"
      provider: "{{ inmanage }}"

  - name: "Delete user group"
    ieisystem.inmanage.user_group:
      state: "absent"
      name: "test"
      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
)inmanage_argument_specget_connection)AnsibleModulec                   *    e Zd Zd Zd Zd Zd Zd Zy)	UserGroupc                 ^    || _         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/user_group.py__init__zUserGroup.__init__   s%    !	v    c                 <    t        | j                  d      | _        y)zInit module objectF)r   supports_check_modeN)r   r   r   r   s    r   r   zUserGroup.init_module   s     $))@r   c                     d| j                   j                  d<   t        | j                         | _        | j                  d   dk(  rd| j                  d<   y y )Neditusergroup
subcommandStateSuccessTchanged)r   paramsr   r   r   s    r   run_commandzUserGroup.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UserGroup.show_result   s    --r   c                 D    | j                          | j                          y)WorkerN)r    r$   r   s    r   workzUserGroup.work   s    r   N)__name__
__module____qualname__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g d	      t        ddd
dg	      t        ddd
dg	      t        ddd
dg	      t        ddd
dg	      t        ddd
dg	      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operatoruseroemnone)r/   r2   r0   enabledisable)
statenameprigeneralpowermediakvmsecuritydebugr   )r   updater   r
   r'   )r   usergroup_objs     r   mainrE      s    	8'<iPut,ee5ij%%(I9NO)7LM)7LMeeh	5JK558Y:OP)7LMuux6KLM /0m,Mr   __main__N)
__future__r   r   r   r/   __metaclass__DOCUMENTATIONEXAMPLESRETURNDansible_collections.ieisystem.inmanage.plugins.module_utils.inmanager   r   ansible.module_utils.basicr   objectr
   rE   r(   r"   r   r   <module>rO      sY    C BRh(T
 z 4 :$ zF r   