
    Vhc                     ^    d Z dZdZddlmZ ddlmZ  G d de      Zd Ze	d	k(  r e        y
y
)a  
---
module: identity_role
short_description: Manage a OpenStack identity (Keystone) role
author: OpenStack Ansible SIG
description:
  - Create, update or delete a OpenStack identity (Keystone) role.
options:
  description:
    description:
      - Role description.
    type: str
  domain_id:
    description:
      - Domain id to create the role in.
    type: str
  name:
    description:
      - Role name.
    required: true
    type: str
  state:
    description:
      - Should the resource be present or absent.
    choices: ['present', 'absent']
    default: present
    type: str
extends_documentation_fragment:
  - openstack.cloud.openstack
z
- name: Create a role named demo
  openstack.cloud.identity_role:
    cloud: mycloud
    state: present
    name: demo

- name: Delete the role named demo
  openstack.cloud.identity_role:
    cloud: mycloud
    state: absent
    name: demo
am  
role:
  description: Dictionary describing the identity role.
  returned: On success when I(state) is C(present).
  type: dict
  contains:
    description:
      description: Description of the role resource
      type: str
      sample: role description
    domain_id:
      description: Domain to which the role belongs
      type: str
      sample: default
    id:
      description: Unique role ID.
      type: str
      sample: "677bfab34c844a01b88a217aa12ec4c2"
    links:
      description: Links for the role resource
      type: list
    name:
      description: Role name.
      type: str
      sample: "demo"
    )OpenStackModule)StateMachinec            
           e Zd Z e e        e        ed       edddg            Z ed      Z G d d	e      Zd
 Zy)IdentityRoleModuleT)requiredpresentabsent)defaultchoices)description	domain_idnamestate)supports_check_modec                       e Zd Zd Zy) IdentityRoleModule._StateMachinec                 X    t        fddD              } | j                  d   fi |S )Nc              3   >   K   | ]  }|v r|   	||   f  y wN ).0k
attributess     q/home/dcms/DCMS/lib/python3.12/site-packages/ansible_collections/openstack/cloud/plugins/modules/identity_role.py	<genexpr>z9IdentityRoleModule._StateMachine._find.<locals>.<genexpr>a   s4      L*_A1J jm, Ls   )r   r   )dictfind_function)selfr   kwargss    ` r   _findz&IdentityRoleModule._StateMachine._find`   s<     L#0L LF &4%%j&8CFCC    N)__name__
__module____qualname__r    r   r!   r   _StateMachiner   _   s    	Dr!   r%   c                 h     j                   j                  dd j                        }t         fddD              }t         fddD              |d<    |d j                  j
                  d d	gd
d|\  }}| j                  |       y  j                  ||j                  d
             y )Nidentityrole)
connectionservice_name	type_namesdkc              3   ^   K   | ]$  }j                   |   |j                   |   f & y wr   paramsr   r   r   s     r   r   z)IdentityRoleModule.run.<locals>.<genexpr>m   s4      5Q3 $++a.) 5   *-)r   timeoutc              3   ^   K   | ]$  }j                   |   |j                   |   f & y wr   r.   r0   s     r   r   z)IdentityRoleModule.run.<locals>.<genexpr>r   s4      0KKN. T[[^$ 0r1   )r   r   r   r   r   F)
check_modeupdateable_attributesnon_updateable_attributeswait)changed)computed)r8   r(   r   )r%   connr,   r   ansibler4   	exit_jsonto_dict)r   smr   r(   
is_changeds   `    r   runzIdentityRoleModule.rung   s    499-7*0$(HH   .
  535 5
  0>0 0 	|
  ()@)@489D#(( !'	(j <NN:N.NN: $e <  >r!   N)	r"   r#   r$   r   argument_specmodule_kwargsr   r%   r@   r   r!   r   r   r   S   sO    F&4 9x.CD	M  MD D>r!   r   c                  &    t               }  |         y r   )r   )modules    r   mainrE      s    !F
Hr!   __main__N)
DOCUMENTATIONEXAMPLESRETURNBansible_collections.openstack.cloud.plugins.module_utils.openstackr   Aansible_collections.openstack.cloud.plugins.module_utils.resourcer   r   rE   r"   r   r!   r   <module>rL      sI   >
6 _ Z-> ->`
 zF r!   