
    Vh                         d dl mZmZmZ eZddgddZdZdZdZ	d d	l
mZ d d
lmZmZmZ d dlmZ d Zedk(  r e        yy)    )absolute_importdivisionprint_functionz1.1preview	community)metadata_versionstatussupported_bya>  
---
module: mso_tenant
short_description: Manage tenants
description:
- Manage tenants on Cisco ACI Multi-Site.
author:
- Dag Wieers (@dagwieers)
options:
  tenant:
    description:
    - The name of the tenant.
    type: str
    aliases: [ name ]
  display_name:
    description:
    - The name of the tenant to be displayed in the web UI.
    type: str
  description:
    description:
    - The description for this tenant.
    type: str
  users:
    description:
    - A list of associated users for this tenant.
    - Using this property will replace any existing associated users.
    - Admin user is always added to the associated user list irrespective of this parameter being used.
    type: list
    elements: str
  remote_users:
    description:
    - A list of associated remote users for this tenant.
    type: list
    elements: dict
    suboptions:
      name:
        description:
        - The name of the associated remote user for this tenant.
        required: true
        type: str
      login_domain:
        description:
        - Domain name of the associated remote user for this tenant.
        required: true
        type: str
  sites:
    description:
    - A list of associated sites for this tenant.
    - Using this property will replace any existing associated sites.
    type: list
    elements: str
  orchestrator_only:
    description:
    - Orchestrator Only C(no) is used to delete the tenant from the MSO and Sites/APIC.
    - C(yes) is used to remove the tenant only from the MSO.
    type: str
    choices: [ 'yes', 'no' ]
    default: 'yes'
  state:
    description:
    - Use C(present) or C(absent) for adding or removing.
    - Use C(query) for listing an object or multiple objects.
    type: str
    choices: [ absent, present, query ]
    default: present
extends_documentation_fragment: cisco.mso.modules
a  
- name: Add a new tenant
  cisco.mso.mso_tenant:
    host: mso_host
    username: admin
    password: SomeSecretPassword
    tenant: north_europe
    display_name: North European Datacenter
    description: This tenant manages the NEDC environment.
    state: present

- name: Remove a tenant from MSO and Site/APIC
  cisco.mso.mso_tenant:
    host: mso_host
    username: admin
    password: SomeSecretPassword
    tenant: north_europe
    orchestrator_only: 'no'
    state: absent

- name: Remove a tenant from MSO only
  cisco.mso.mso_tenant:
    host: mso_host
    username: admin
    password: SomeSecretPassword
    tenant: north_europe
    orchestrator_only: 'yes'
    state: absent

- name: Query a tenant
  cisco.mso.mso_tenant:
    host: mso_host
    username: admin
    password: SomeSecretPassword
    tenant: north_europe
    state: query
  register: query_result

- name: Query all tenants
  cisco.mso.mso_tenant:
    host: mso_host
    username: admin
    password: SomeSecretPassword
    state: query
  register: query_result

)AnsibleModule)	MSOModulemso_argument_specndo_remote_user_spec)YES_OR_NO_TO_BOOL_STRING_MAPc                  t   t               } | j                  t        d      t        d      t        ddg      t        dd      t        ddt                     t        dd      t        dd	d	d
g      t        ddg d             t	        | ddddggdddggg      }|j
                  j                  d      }|j
                  j                  d      }|j
                  j                  d      }|j
                  j                  d      }|j
                  j                  d      }|j
                  j                  d      }t        |      }d }	d}
|rR|j                  |
|      |_	        |j                  rD|j                  j                  d      }	dj                  |	      }
n|j                  |
      |_	        |dk(  rn|dk(  rr|j                  |_        |j                  r|j                  r	i |_	        ndj                  |
t        j                  |            }
|j                  |
d       |_	        nn|dk(  rh|j                  |_        |j!                  |j
                  j                  d!            }|j#                  |j
                  j                  d"            }|||j%                  |      z  }t        ||	||||#      }|j'                  |d$       |j(                  j                  d%      ||j(                  d%<   |j                  rR|j+                         r|j                  r|j,                  |_	        ne|j                  |
d&|j(                  '      |_	        nA|j                  r|j,                  |_	        n#|j                  |
d(|j(                  '      |_	        |j/                          y ))Nstr)typename)r   aliaseslist)r   elementsdict)r   r   optionsyesno)r   defaultchoicespresent)absentr   query)descriptiondisplay_nametenantusersremote_userssitesorchestrator_onlystateTr(   r   r#   )argument_specsupports_check_moderequired_ifr!   r"   r'   r%   tenants)r   idztenants/{id})r-   r    z{0}?msc-only={1}DELETE)methodr&   r$   )r!   r-   r   displayNamesiteAssociationsuserAssociations)collater0   PUT)r/   dataPOST)r   updater   r   r   paramsgetr   get_objexistingformat
query_objsprevious
check_moder   requestlookup_siteslookup_userslookup_remote_userssanitizesentcheck_changedproposed	exit_json)r)   moduler!   r"   r#   r'   r(   r%   mso	tenant_idpathr&   r$   payloads                 h/home/dcms/DCMS/lib/python3.12/site-packages/ansible_collections/cisco/mso/plugins/modules/mso_tenant.pymainrO      s/   %'Me$u%1/v@T@VW/E55$-Py:XY  	 # h
+i(,
F --##M2K==$$^4L]]x(F))*=>MMg&E==$$^4L
F
CID {{4f{5<<((.I!((I(6D~~d+	(	||<<  !)007S7W7WXi7jk"{{4{A	)	||   !2!27!;<  !2!27!;<#S,,\::E#$""
 	Wd+ 88<<&.&,CHH]#<<  "$$#&<<CL#&;;tE;#QCL  "||"{{4SXX{NMMO    __main__N)
__future__r   r   r   r   __metaclass__ANSIBLE_METADATADOCUMENTATIONEXAMPLESRETURNansible.module_utils.basicr   6ansible_collections.cisco.mso.plugins.module_utils.msor   r   r   <ansible_collections.cisco.mso.plugins.module_utils.constantsr   rO   __name__ rP   rN   <module>r]      sd    A @(-)Vab BH-^
 5 u u e\~ zF rP   