
    Vh'                     v    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 Zedk(  r e        yy)    )absolute_importdivisionprint_functionz1.1preview	certified)metadata_versionstatussupported_bya  
---
module: aci_esg
short_description: Manage Endpoint Security Groups (ESGs) objects (fv:ESg)
description:
- Manage Endpoint Security Groups (ESGs) on Cisco ACI fabrics.

options:
  tenant:
    description:
    - Name of the tenant.
    type: str
    aliases: [ tenant_name ]
  ap:
    description:
    - The name of the application profile.
    type: str
    aliases: [ app_profile, app_profile_name ]
  esg:
    description:
    - Name of the Endpoint Security Group.
    type: str
    aliases: [ esg_name, name ]
  admin_state:
    description:
    - Use C(false) to set 'Admin Up' on the ESG Admin state and is the default.
    - Use C(true) to set 'Admin Shut' on the ESG Admin state
    type: bool
    choices: [ false, true ]
  vrf:
    description:
    - Name of the VRF
    type: str
    aliases: [ vrf_name ]
  description:
    description:
    - Endpoint security group description.
    type: str
    aliases: [ descr ]
  intra_esg_isolation:
    description:
    - The default value of Intra ESG Isolation is C(unenforced).
    type: str
    choices: [ enforced, unenforced ]
  preferred_group_member:
    description:
    - The default value of Preferred Group Member is C(exclude).
    type: str
    choices: [ exclude, include ]
  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

seealso:
- module: cisco.aci.aci_aep_to_domain
- name: APIC Management Information Model reference
  description: More information about the internal APIC classes B(infra:AttEntityP) and B(infra:ProvAcc).
  link: https://developer.cisco.com/docs/apic-mim-ref/
author:
- Sabari Jaganathan (@sajagana)
a  
- name: Add a new ESG
  cisco.aci.aci_esg:
    host: apic
    username: admin
    password: SomeSecretPassword
    tenant: production
    ap: intranet
    esg: web_esg
    vrf: 'default'
    description: Web Intranet ESG
    state: present
  delegate_to: localhost

- name: Add list of ESGs
  cisco.aci.aci_esg:
    host: apic
    username: admin
    password: SomeSecretPassword
    tenant: production
    ap: ticketing
    esg: "{{ item.esg }}"
    description: Ticketing ESG
    vrf: 'default'
    state: present
  delegate_to: localhost
  with_items:
    - esg: web
    - esg: database

- name: Query an ESG
  cisco.aci.aci_esg:
    host: apic
    username: admin
    password: SomeSecretPassword
    tenant: production
    ap: ticketing
    esg: web_esg
    state: query
  delegate_to: localhost

- name: Query all ESGs
  cisco.aci.aci_esg:
    host: apic
    username: admin
    password: SomeSecretPassword
    state: query
  delegate_to: localhost

- name: Query all ESGs with a Specific Name
  cisco.aci.aci_esg:
    host: apic
    username: admin
    password: SomeSecretPassword
    esg: web_esg
    state: query
  delegate_to: localhost

- name: Query all ESGs of an App Profile
  cisco.aci.aci_esg:
    host: apic
    username: admin
    password: SomeSecretPassword
    ap: ticketing
    state: query
  delegate_to: localhost

- name: Remove an ESG
  cisco.aci.aci_esg:
    host: apic
    username: admin
    password: SomeSecretPassword
    tenant: production
    app_profile: intranet
    esg: web_esg
    state: absent
  delegate_to: localhost
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_specc                  *   t               } | j                  t                      | j                  t        ddg      t        dddg      t        dddg      t        dd	d
g      t        ddg      t        ddg      t        dddg      t        dddg      t        ddg d      t        d      
       t	        | d
ddg dgddg dgg      }t        |      }|j                  j                  d      }|j                  j                  d      }|j                  j                  d      }|j                  j                  d      }|j                  j                  d       }|j                  j                  d!      }|j                  j                  d"      }	|j                  j                  d#      }
|j                  j                  d      }|j                  j                  d$      }|j                  t        d%d&j                  |      |d|i'      t        d(d)j                  |      |d|i'      t        d*d+j                  |      |d|i'      d,g-       |j                          |dk(  r{d.d/d0}|j                  |      }|j                  d*t        ||||	|
|1      t        t        t        |2      3      4      g5       |j                  d*6       |j                          n|dk(  r|j                          |j                          y )7Nstrtenant_name)typealiasesapp_profileapp_profile_namenameesg_nameboolFT)r   choicesvrf_namedescrenforced
unenforcedexcludeincludepresent)absentr    query)r   defaultr   )r   )
tenantapesgadmin_statevrfdescriptionintra_esg_isolationpreferred_group_memberstate
name_aliasr,   r!   )r$   r%   r&   )r$   r%   r&   r(   )argument_specsupports_check_moderequired_ifr$   r%   r&   r'   r(   r)   r*   r+   r-   fvTenantztn-{0})	aci_classaci_rnmodule_objecttarget_filterfvApzap-{0}fvESgzesg-{0}	fvRsScope)
root_class
subclass_1
subclass_2child_classesyesno)TF)r   r   shutdown	pcEnfPref
prefGrMemb	nameAlias)tnFvCtxName)
attributes)r8   )r2   class_configchild_configs)r2   )r   updater   dictr   r   paramsgetconstruct_urlformatget_existingpayloadget_diffpost_configdelete_config	exit_json)r.   moduleacir$   r%   r&   r'   r(   r)   r*   r+   r,   r-   state_mappingr?   s                  e/home/dcms/DCMS/lib/python3.12/site-packages/ansible_collections/cisco/aci/plugins/modules/aci_esg.pymainrW     s   %'M,./8U]4F$GHefj%9:fudm<ej\2egY7 .
  $I8NO2

 U##  ( # h 78i!?@
F F
C]]x(F			4	 B
--

E
"C--##M2K
--

E
"C--##M2K --++,AB#]]../GHMMg&E""<0J ??6* !6*	
 ??2&!2,	
 ##C(!3-	
 
'  0 	$T2 $$[1!!-1$  $$3:O*PQR 	 	
 	w'	(	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   rW   __name__ rX   rV   <module>rd      sd    A @(-)Vab GTM^g
R 5 t t^B zF rX   