Anons79 Mini Shell

Directory : /lib/python2.7/site-packages/ansible/modules/identity/keycloak/
Upload File :
Current File : //lib/python2.7/site-packages/ansible/modules/identity/keycloak/keycloak_group.pyc

�
�Udac@`s�ddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
mZmZm
Z
mZmZddlmZd
�Zedkr�e�ndS(i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatust	communitytsupported_bys�

---
module: keycloak_group

short_description: Allows administration of Keycloak groups via Keycloak API

description:
    - This module allows you to add, remove or modify Keycloak groups via the Keycloak REST API.
      It requires access to the REST API via OpenID Connect; the user connecting and the client being
      used must have the requisite access rights. In a default Keycloak installation, admin-cli
      and an admin user would work, as would a separate client definition with the scope tailored
      to your needs and a user having the expected roles.

    - The names of module options are snake_cased versions of the camelCase ones found in the
      Keycloak API and its documentation at U(http://www.keycloak.org/docs-api/3.3/rest-api/).

    - Attributes are multi-valued in the Keycloak API. All attributes are lists of individual values and will
      be returned that way by this module. You may pass single values for attributes when calling the module,
      and this will be translated into a list suitable for the API.

    - When updating a group, where possible provide the group ID to the module. This removes a lookup
      to the API to translate the name into the group ID.

version_added: "2.8"

options:
    state:
        description:
            - State of the group.
            - On C(present), the group will be created if it does not yet exist, or updated with the parameters you provide.
            - On C(absent), the group will be removed if it exists.
        required: true
        default: 'present'
        type: str
        choices:
            - present
            - absent

    name:
        type: str
        description:
            - Name of the group.
            - This parameter is required only when creating or updating the group.

    realm:
        type: str
        description:
            - They Keycloak realm under which this group resides.
        default: 'master'

    id:
        type: str
        description:
            - The unique identifier for this group.
            - This parameter is not required for updating or deleting a group but
              providing it will reduce the number of API calls required.

    attributes:
        type: dict
        description:
            - A dict of key/value pairs to set as custom attributes for the group.
            - Values may be single values (e.g. a string) or a list of strings.

notes:
    - Presently, the I(realmRoles), I(clientRoles) and I(access) attributes returned by the Keycloak API
      are read-only for groups. This limitation will be removed in a later version of this module.

extends_documentation_fragment:
    - keycloak

author:
    - Adam Goossens (@adamgoossens)
s�
- name: Create a Keycloak group
  keycloak_group:
    name: my-new-kc-group
    realm: MyCustomRealm
    state: present
    auth_client_id: admin-cli
    auth_keycloak_url: https://auth.example.com/auth
    auth_realm: master
    auth_username: USERNAME
    auth_password: PASSWORD
  delegate_to: localhost

- name: Delete a keycloak group
  keycloak_group:
    id: '9d59aa76-2755-48c6-b1af-beb70a82c3cd'
    state: absent
    realm: MyCustomRealm
    auth_client_id: admin-cli
    auth_keycloak_url: https://auth.example.com/auth
    auth_realm: master
    auth_username: USERNAME
    auth_password: PASSWORD
  delegate_to: localhost

- name: Delete a Keycloak group based on name
  keycloak_group:
    name: my-group-for-deletion
    state: absent
    auth_client_id: admin-cli
    auth_keycloak_url: https://auth.example.com/auth
    auth_realm: master
    auth_username: USERNAME
    auth_password: PASSWORD
  delegate_to: localhost

- name: Update the name of a Keycloak group
  keycloak_group:
    id: '9d59aa76-2755-48c6-b1af-beb70a82c3cd'
    name: an-updated-kc-group-name
    state: present
    auth_client_id: admin-cli
    auth_keycloak_url: https://auth.example.com/auth
    auth_realm: master
    auth_username: USERNAME
    auth_password: PASSWORD
  delegate_to: localhost

- name: Create a keycloak group with some custom attributes
  keycloak_group:
    auth_client_id: admin-cli
    auth_keycloak_url: https://auth.example.com/auth
    auth_realm: master
    auth_username: USERNAME
    auth_password: PASSWORD
    name: my-new_group
    attributes:
        attrib1: value1
        attrib2: value2
        attrib3:
            - with
            - numerous
            - individual
            - list
            - items
  delegate_to: localhost
s�
group:
  description: Group representation of the group after module execution (sample is truncated).
  returned: always
  type: complex
  contains:
    id:
      description: GUID that identifies the group
      type: str
      returned: always
      sample: 23f38145-3195-462c-97e7-97041ccea73e
    name:
      description: Name of the group
      type: str
      returned: always
      sample: grp-test-123
    attributes:
      description: Attributes applied to this group
      type: dict
      returned: always
      sample:
        attr1: ["val1", "val2", "val3"]
    path:
      description: URI path to the group
      type: str
      returned: always
      sample: /grp-test-123
    realmRoles:
      description: An array of the realm-level roles granted to this group
      type: list
      returned: always
      sample: []
    subGroups:
      description: A list of groups that are children of this group. These groups will have the same parameters as
                   documented here.
      type: list
      returned: always
    clientRoles:
      description: A list of client-level roles granted to this group
      type: list
      returned: always
      sample: []
    access:
      description: A dict describing the accesses you have to this group based on the credentials used.
      type: dict
      returned: always
      sample:
        manage: true
        manageMembership: true
        view: true
(tKeycloakAPItcameltkeycloak_argument_spect	get_tokent
KeycloakError(t
AnsibleModulecC`s?t�}tdtdddddg�dtdd�dtd	d
�dtd	d
�dtd	d
��}|j|�td|dtdddgg�}tdtdddidd�}y�td|jjd�d|jjd�d|jjd�d|jjd�d|jjd�d|jjd�d|jjd��}Wn)t	k
rq}|j
dt|��nXt||�}|jjd�}|jjd�}|jjd�}	|jjd�}
|jjd�}d)}|	d)kr|j|
d|�}n|j|	d|�}|d)kr,in|}|d)k	r�xM|jdj�D]5\}
}t|t�sv|gn||jd|
<qRWng|jD]I}|tt�j��ddgkr�|jj|�d)k	r�|^q�}i}x[|D]S}|jj|�}||kr"||nd)}||kr�||t|�<q�q�W|j�}|j|�|ikr�|dkr�|jr�td dd!d�|d<nd"|d<t�|d<|j|�nt|d<|
d)kr�|j
dd#�n|jrtd dd!|�|d<n|jr/|j|�n|j|d|�|j|
|�}||d<d$jd|dd|d�|d<n�|dkr�||kr�t|d<||d<d%jd|d�|d<|j|�nt|d<|jr
td |d!|�|d<n|jr#|j|�n|j|d|�|j|dd|�}||d<d&jd|d�|d<|j|�n�|dkr.t�|d<|jr�td |d!d�|d<n|jr�|j|�n|d}	|jd'|	d|�t|d<d(jd|d�|d<|j|�n|j|�d)S(*s(
    Module execution

    :return:
    tstatetdefaulttpresenttchoicestabsenttrealmtmastertidttypetstrtnamet
attributestdictt
argument_spectsupports_check_modetrequired_one_oftchangedtmsgttdifftgrouptbase_urltauth_keycloak_urltvalidate_certst
auth_realmt	client_idtauth_client_idt
auth_usernamet
auth_passwordt
client_secrettauth_client_secrettbeforetafters$Group does not exist; doing nothing.s0name must be specified when creating a new groups*Group {name} has been created with ID {id}s$No changes required to group {name}.sGroup {id} has been updatedtgroupidsGroup {name} has been deletedN(R
RtupdateR
tTruetFalseRtparamstgetRt	fail_jsonRRtNonetget_group_by_nametget_group_by_groupidtitemst
isinstancetlisttkeysR	tcopyt_difft	exit_jsont
check_modetcreate_grouptformattupdate_grouptdelete_group(Rt	meta_argstmoduletresulttconnection_headertetkcRRtgidRRtbefore_grouptkeytvaltxtgroup_paramst	changesettparamtnew_param_valuet	old_valuet
updated_grouptafter_group((sT/usr/lib/python2.7/site-packages/ansible/modules/identity/keycloak/keycloak_group.pytmain�s�	
! 0%$

	


		



		

		

t__main__N(t
__future__RRRRt
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNt/ansible.module_utils.identity.keycloak.keycloakRR	R
RRtansible.module_utils.basicR
RWt__name__(((sT/usr/lib/python2.7/site-packages/ansible/modules/identity/keycloak/keycloak_group.pyt<module>s

KD4(	�

Anons79 File Manager Version 1.0, Coded By Anons79
Email: [email protected]