
    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_ap
short_description: Manage top level Application Profile (AP) objects (fv:Ap)
description:
- Manage top level Application Profile (AP) objects on Cisco ACI fabrics
options:
  tenant:
    description:
    - The name of an existing tenant.
    type: str
    aliases: [ tenant_name ]
  ap:
    description:
    - The name of the application network profile.
    type: str
    aliases: [ app_profile, app_profile_name, name ]
  description:
    description:
    - Description for the AP.
    type: str
    aliases: [ descr ]
  monitoring_policy:
    description:
    - The name of the monitoring policy.
    type: str
  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

notes:
- This module does not manage EPGs, see M(cisco.aci.aci_epg) to do this.
- The used C(tenant) must exist before using this module in your playbook.
  The M(cisco.aci.aci_tenant) module can be used for this.
seealso:
- module: cisco.aci.aci_tenant
- name: APIC Management Information Model reference
  description: More information about the internal APIC class B(fv:Ap).
  link: https://developer.cisco.com/docs/apic-mim-ref/
author:
- Swetha Chunduri (@schunduri)
- Shreyas Srish (@shrsr)
aE  
- name: Add a new AP
  cisco.aci.aci_ap:
    host: apic
    username: admin
    password: SomeSecretPassword
    tenant: production
    ap: default
    description: default ap
    monitoring_policy: default
    state: present
  delegate_to: localhost

- name: Remove an AP
  cisco.aci.aci_ap:
    host: apic
    username: admin
    password: SomeSecretPassword
    tenant: production
    ap: default
    state: absent
  delegate_to: localhost

- name: Query an AP
  cisco.aci.aci_ap:
    host: apic
    username: admin
    password: SomeSecretPassword
    tenant: production
    ap: default
    state: query
  delegate_to: localhost
  register: query_result

- name: Query all APs
  cisco.aci.aci_ap:
    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g      t	        dg d      t	        ddg      t	        ddg d      t	        d	      t	        d	      
       t        | dddddggd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	        t	        t	        |                  g}t        |      }	|	j                  t	        ddj                  |      |d|i      t	        ddj                  |      |d|i      dg       |	j                          |dk(  rC|	j                  dt	        |||      |        |	j                  d!       |	j                          n|dk(  r|	j                          |	j!                          y )"Nstrtenant_name)typealiases)app_profileapp_profile_namenamedescrpresent)absentr   query)r   defaultchoices)r   )tenantapdescriptionstate
name_aliasmonitoring_policyTr!   r   r   r   )argument_specsupports_check_moderequired_ifr    r"   r#   )tnMonEPGPolName)
attributes)fvRsApMonPolfvTenantztn-{0}r   )	aci_classaci_rnmodule_objecttarget_filterfvApzap-{0}r)   )
root_class
subclass_1child_classes)r   r   	nameAlias)r+   class_configchild_configs)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   r"   r#   r5   acis
             d/home/dcms/DCMS/lib/python3.12/site-packages/ansible_collections/cisco/aci/plugins/modules/aci_ap.pymainrE      s*   %'M,./)*8U$OPegY7y:XYU#E*   # h4 01i(D!12
F 
		4	 B--##M2KMMg&E]]x(F""<0J))*=>ttL]7^'_`aM
F
C ??6* !6*	
 ??2&!2,	
 &&    	!$
 ( 	 	
 	v&	(	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   rE   __name__ rF   rD   <module>rR      sh    A @(-)Vab 6p*Xg
R 5 E  EDN zF rF   