
    Vh3                     ^    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
)av  
module: federation_idp
short_description: Manage an identity provider in a OpenStack cloud
author: OpenStack Ansible SIG
description:
  - Create, update or delete an identity provider of the OpenStack
    identity (Keystone) service.
options:
  description:
    description:
      - The description of the identity provider.
    type: str
  domain_id:
    description:
      - The ID of a domain that is associated with the identity provider.
      - Federated users that authenticate with the identity provider will be
        created under the domain specified.
      - Required when creating a new identity provider.
    type: str
  id:
    description:
      - The ID (and name) of the identity provider.
    type: str
    required: true
    aliases: ['name']
  is_enabled:
    description:
      - Whether the identity provider is enabled or not.
      - Will default to C(false) when creating a new identity provider.
    type: bool
    aliases: ['enabled']
  remote_ids:
    description:
      - "List of the unique identity provider's remote IDs."
      - Will default to an empty list when creating a new identity provider.
    type: list
    elements: str
  state:
    description:
      - Whether the identity provider should be C(present) or C(absent).
    choices: ['present', 'absent']
    default: present
    type: str
extends_documentation_fragment:
  - openstack.cloud.openstack
a  
- name: Create an identity provider
  openstack.cloud.federation_idp:
    cloud: example_cloud
    name: example_provider
    domain_id: 0123456789abcdef0123456789abcdef
    description: 'My example IDP'
    remote_ids:
      - 'https://auth.example.com/auth/realms/ExampleRealm'

- name: Delete an identity provider
  openstack.cloud.federation_idp:
    cloud: example_cloud
    name: example_provider
    state: absent
a   
identity_provider:
  description: Dictionary describing the identity providers
  returned: On success when I(state) is C(present).
  type: dict
  contains:
    description:
      description: Identity provider description
      type: str
      sample: "demodescription"
    domain_id:
      description: Domain to which the identity provider belongs
      type: str
      sample: "default"
    id:
      description: Identity provider ID
      type: str
      sample: "test-idp"
    is_enabled:
      description: Indicates whether the identity provider is enabled
      type: bool
    name:
      description: Name of the identity provider, equals its ID.
      type: str
      sample: "test-idp"
    remote_ids:
      description: Remote IDs associated with the identity provider
      type: list
    )OpenStackModule)StateMachinec                       e Zd Z e e        e        eddg       eddg       edd	       ed
dd
g            Z ed      Zd Zy)IdentityProviderModuleTname)requiredaliasesboolenabled)typer	   liststr)r   elementspresentabsent)defaultchoices)description	domain_idid
is_enabled
remote_idsstate)supports_check_modec                 \    t         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identity_provider)
connectionservice_name	type_namesdkc              3   ^   K   | ]$  }j                   |   |j                   |   f & y wNparams.0kselfs     r/home/dcms/DCMS/lib/python3.12/site-packages/ansible_collections/openstack/cloud/plugins/modules/federation_idp.py	<genexpr>z-IdentityProviderModule.run.<locals>.<genexpr>|   s4      5Q3 $++a.) 5   *-)r   timeoutc              3   ^   K   | ]$  }j                   |   |j                   |   f & y wr#   r$   r&   s     r*   r+   z-IdentityProviderModule.run.<locals>.<genexpr>   s4      0KKN. T[[^$ 0r,   )r   r   r   r   r   
attributesr   F)
check_modeupdateable_attributesnon_updateable_attributeswait)changed)computed)r4   r    )r   connr!   dictansibler0   	exit_jsonto_dict)r)   smkwargsr   
is_changeds   `    r*   runzIdentityProviderModule.runv   s    TYY'1$7"hh(
  535 5
  0)0 0 	|  $,,11%)*5 	 	&: $NN:N.NN""3";";U";"K  M    N)__name__
__module____qualname__r8   argument_specmodule_kwargsr?   r6   r@   r*   r   r   i   s\    F&x0Vi[9Ve49x.CDM  MMr@   r   c                  &    t               }  |         y r#   )r   )modules    r*   mainrH      s    #%F
Hr@   __main__N)
DOCUMENTATIONEXAMPLESRETURNBansible_collections.openstack.cloud.plugins.module_utils.openstackr   Aansible_collections.openstack.cloud.plugins.module_utils.resourcer   r   rH   rA   r6   r@   r*   <module>rO      sL   -^"
< _ Z)M_ )MX
 zF r@   