
    Vh                     z    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mZ d Zedk(  r e        yy)    )absolute_importdivisionprint_functionz1.1preview	certified)metadata_versionstatussupported_bya  
---
module: aci_tenant
short_description: Manage tenants (fv:Tenant)
description:
- Manage tenants on Cisco ACI fabrics.
options:
  tenant:
    description:
    - The name of the tenant.
    type: str
    aliases: [ name, tenant_name ]
  description:
    description:
    - Description for the tenant.
    type: str
    aliases: [ descr ]
  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
  name_alias:
    description:
    - The alias for the current object. This relates to the nameAlias field in ACI.
    type: str
extends_documentation_fragment:
- cisco.aci.aci
- cisco.aci.annotation
- cisco.aci.owner

seealso:
- module: cisco.aci.aci_ap
- module: cisco.aci.aci_bd
- module: cisco.aci.aci_contract
- module: cisco.aci.aci_filter
- module: cisco.aci.aci_vrf
- name: APIC Management Information Model reference
  description: More information about the internal APIC class B(fv:Tenant).
  link: https://developer.cisco.com/docs/apic-mim-ref/
author:
- Jacob McGill (@jmcgill298)
a  
- name: Add a new tenant
  cisco.aci.aci_tenant:
    host: apic
    username: admin
    password: SomeSecretPassword
    tenant: production
    description: Production tenant
    state: present
  delegate_to: localhost

- name: Remove a tenant
  cisco.aci.aci_tenant:
    host: apic
    username: admin
    password: SomeSecretPassword
    tenant: production
    state: absent
  delegate_to: localhost

- name: Query a tenant
  cisco.aci.aci_tenant:
    host: apic
    username: admin
    password: SomeSecretPassword
    tenant: production
    state: query
  delegate_to: localhost
  register: query_result

- name: Query all tenants
  cisco.aci.aci_tenant:
    host: apic
    username: admin
    password: SomeSecretPassword
    state: query
  delegate_to: localhost
  register: query_result
a
  
current:
  description: The existing configuration from the APIC after the module has finished
  returned: success
  type: list
  sample:
    [
        {
            "fvTenant": {
                "attributes": {
                    "descr": "Production environment",
                    "dn": "uni/tn-production",
                    "name": "production",
                    "nameAlias": "",
                    "ownerKey": "",
                    "ownerTag": ""
                }
            }
        }
    ]
error:
  description: The error information as returned from the APIC
  returned: failure
  type: dict
  sample:
    {
        "code": "122",
        "text": "unknown managed object class foo"
    }
raw:
  description: The raw output returned by the APIC REST API (xml or json)
  returned: parse error
  type: str
  sample: '<?xml version="1.0" encoding="UTF-8"?><imdata totalCount="1"><error code="122" text="unknown managed object class foo"/></imdata>'
sent:
  description: The actual/minimal configuration pushed to the APIC
  returned: info
  type: list
  sample:
    {
        "fvTenant": {
            "attributes": {
                "descr": "Production environment"
            }
        }
    }
previous:
  description: The original configuration from the APIC before the module has started
  returned: info
  type: list
  sample:
    [
        {
            "fvTenant": {
                "attributes": {
                    "descr": "Production",
                    "dn": "uni/tn-production",
                    "name": "production",
                    "nameAlias": "",
                    "ownerKey": "",
                    "ownerTag": ""
                }
            }
        }
    ]
proposed:
  description: The assembled configuration from the user-provided parameters
  returned: info
  type: dict
  sample:
    {
        "fvTenant": {
            "attributes": {
                "descr": "Production environment",
                "name": "production"
            }
        }
    }
filter_string:
  description: The filter string used for the request
  returned: failure or debug
  type: str
  sample: ?rsp-prop-include=config-only
method:
  description: The HTTP method used for the request to the APIC
  returned: failure or debug
  type: str
  sample: POST
response:
  description: The HTTP response from the APIC
  returned: failure or debug
  type: str
  sample: OK (30 bytes)
status:
  description: The HTTP status from the APIC
  returned: failure or debug
  type: int
  sample: 200
url:
  description: The HTTP url used for the request to the APIC
  returned: failure or debug
  type: str
  sample: https://10.11.12.13/api/mo/uni/tn-production.json
)AnsibleModule)	ACIModuleaci_argument_specaci_annotation_specaci_owner_specc            
      ~   t               } | j                  t                      | j                  t                      | j                  t	        dddg      t	        ddg      t	        ddg d      t	        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      }t        |      }|j                  t	        ddj                  |      |d|i             |j                          |dk(  rB|j                  dt	        |||             |j                  d       |j                          n|dk(  r|j                          |j!                          y )Nstrnametenant_name)typealiasesdescrpresent)absentr   query)r   defaultchoices)r   )tenantdescriptionstate
name_aliasTr   r   r   )argument_specsupports_check_moderequired_ifr   r   fvTenantztn-{0})	aci_classaci_rnmodule_objecttarget_filter)
root_class)r   r   	nameAlias)r$   class_config)r$   )r   updater   r   dictr   paramsgetr   construct_urlformatget_existingpayloadget_diffpost_configdelete_config	exit_json)r    moduler   r   r   r   acis          h/home/dcms/DCMS/lib/python3.12/site-packages/ansible_collections/cisco/aci/plugins/modules/aci_tenant.pymainr:      s   %'M,./)*(?@egY7y:XYU#	   # h
+i(,
F --##M2KMMg&E]]x(F""<0J
F
C ??6* !6*	
   	 !$ 	 	
 	z*	(	MMO    __main__N)
__future__r   r   r   r   __metaclass__ANSIBLE_METADATADOCUMENTATIONEXAMPLESRETURNansible.module_utils.basicr   6ansible_collections.cisco.aci.plugins.module_utils.acir   r   r   r   r:   __name__ r;   r9   <module>rG      sg    A @(-)Vab ,\&Pg
R 5 E  E5p zF r;   