
    Vhd%                     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_contract
short_description: Manage contract resources (vz:BrCP)
description:
- Manage Contract resources on Cisco ACI fabrics.
options:
  contract:
    description:
    - The name of the contract.
    type: str
    aliases: [ contract_name, name ]
  description:
    description:
    - Description for the contract.
    type: str
    aliases: [ descr ]
  tenant:
    description:
    - The name of the tenant.
    type: str
    aliases: [ tenant_name ]
  scope:
    description:
    - The scope of a service contract.
    - The APIC defaults to C(context) when unset during creation.
    type: str
    choices: [ application-profile, context, global, tenant ]
  priority:
    description:
    - The desired QoS class to be used.
    - The APIC defaults to C(unspecified) when unset during creation.
    type: str
    choices: [ level1, level2, level3, unspecified ]
  dscp:
    description:
    - The target Differentiated Service (DSCP) value.
    - The APIC defaults to C(unspecified) when unset during creation.
    type: str
    choices: [ AF11, AF12, AF13, AF21, AF22, AF23, AF31, AF32, AF33, AF41, AF42, AF43, CS0, CS1, CS2, CS3, CS4, CS5, CS6, CS7, EF, VA, unspecified ]
    aliases: [ target ]
  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 Contract Subjects, see M(cisco.aci.aci_contract_subject) to do this.
  Contract Subjects can still be removed using this module.
- The C(tenant) used 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_contract_subject
- module: cisco.aci.aci_tenant
- name: APIC Management Information Model reference
  description: More information about the internal APIC class B(vz:BrCP).
  link: https://developer.cisco.com/docs/apic-mim-ref/
author:
- Dag Wieers (@dagwieers)
a  
- name: Add a new contract
  cisco.aci.aci_contract:
    host: apic
    username: admin
    password: SomeSecretPassword
    tenant: production
    contract: web_to_db
    description: Communication between web-servers and database
    scope: application-profile
    state: present
  delegate_to: localhost

- name: Remove an existing contract
  cisco.aci.aci_contract:
    host: apic
    username: admin
    password: SomeSecretPassword
    tenant: production
    contract: web_to_db
    state: absent
  delegate_to: localhost

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

- name: Query all contracts
  cisco.aci.aci_contract:
    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      t	        dg d      t	        dg d	      t	        dg d
dg      t	        ddg 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      }|j                  j                  d      }|j                  j                  d      }	t        |      }
|
j                  t	        ddj                  |      |d|i      t	        d d!j                  |      |d|i      "       |
j                          |dk(  rE|
j                  d t	        ||||||	#      $       |
j                  d %       |
j                          n|dk(  r|
j                          |
j!                          y )&Nstrcontract_namename)typealiasestenant_namedescr)zapplication-profilecontextglobaltenant)r   choices)level1level2level3unspecified)AF11AF12AF13AF21AF22AF23AF31AF32AF33AF41AF42AF43CS0CS1CS2CS3CS4CS5CS6CS7EFVAr   target)r   r   r   present)absentr7   query)r   defaultr   )r   )contractr   descriptionscopeprioritydscpstate
name_aliasTr@   r8   r;   r   )argument_specsupports_check_moderequired_ifr<   r=   r>   r?   rA   fvTenantztn-{0})	aci_classaci_rnmodule_objecttarget_filtervzBrCPzbrc-{0})
root_class
subclass_1)r   r   r=   prio
targetDscp	nameAlias)rF   class_config)rF   )r   updater   r   dictr   paramsgetr   construct_urlformatget_existingpayloadget_diffpost_configdelete_config	exit_json)rB   moduler;   r<   r=   r>   r?   r@   r   rA   acis              j/home/dcms/DCMS/lib/python3.12/site-packages/ansible_collections/cisco/aci/plugins/modules/aci_contract.pymainr`      sd   %'M,./)*5?F*CD8egY7']^5*WX2 J7
: y:XYU#I  %N # hX 67i*h!78
F }}  ,H--##M2KMMg&E}}  ,H==V$DMMg&E]]x(F""<0J
F
C ??6* !6*	
 ##H-"!8,	
   	!$ 	 
	
 	x(	(	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__ ra   r_   <module>rm      si    A @(-)Vab FP*Xg
R 5 E  EcL zF ra   