Debian Codegraph @

ansible_collections/cisco/aci/plugins/modules/aci_cloud_provider.py

raw
1 #!/usr/bin/python
2 # -*- coding: utf-8 -*-
3
4 # Copyright: (c) 2020, Lionel Hercot (@lhercot) <[email protected]>
5 # GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt)
6
7 from __future__ import absolute_import, division, print_function
8
9 __metaclass__ = type
10
11 DOCUMENTATION = r"""
12 ---
13 module: aci_cloud_provider
14 short_description: Query Cloud Provider information (cloud:ProvP)
15 description:
16 - Query Cloud Provider information (cloud:ProvP) on Cisco Cloud ACI.
17 author:
18 - Lionel Hercot (@lhercot)
19 options:
20 state:
21 description:
22 - Use C(query) for listing an object or multiple objects.
23 choices: [ query ]
24 default: query
25 type: str
26
27 notes:
28 - More information about the internal APIC class B(cloud:ProvP) from
29 L(the APIC Management Information Model reference,https://developer.cisco.com/docs/apic-mim-ref/).
30 - This module is used to query Cloud Provider information.
31 extends_documentation_fragment:
32 - cisco.aci.aci
33 - cisco.aci.annotation
34 """
35
36 EXAMPLES = r"""
37 - name: Query cloud provider information
38 cisco.aci.aci_cloud_provider:
39 host: apic
40 username: userName
41 password: somePassword
42 validate_certs: false
43 state: query
44 delegate_to: localhost
45 """
46
47 RETURN = r"""
48 current:
49 description: The existing configuration from the APIC after the module has finished
50 returned: success
51 type: list
52 sample:
53 [
54 {
55 "fvTenant": {
56 "attributes": {
57 "descr": "Production environment",
58 "dn": "uni/tn-production",
59 "name": "production",
60 "nameAlias": "",
61 "ownerKey": "",
62 "ownerTag": ""
63 }
64 }
65 }
66 ]
67 error:
68 description: The error information as returned from the APIC
69 returned: failure
70 type: dict
71 sample:
72 {
73 "code": "122",
74 "text": "unknown managed object class foo"
75 }
76 raw:
77 description: The raw output returned by the APIC REST API (xml or json)
78 returned: parse error
79 type: str
80 sample: '<?xml version="1.0" encoding="UTF-8"?><imdata totalCount="1"><error code="122" text="unknown managed object class foo"/></imdata>'
81 sent:
82 description: The actual/minimal configuration pushed to the APIC
83 returned: info
84 type: list
85 sample:
86 {
87 "fvTenant": {
88 "attributes": {
89 "descr": "Production environment"
90 }
91 }
92 }
93 previous:
94 description: The original configuration from the APIC before the module has started
95 returned: info
96 type: list
97 sample:
98 [
99 {
100 "fvTenant": {
101 "attributes": {
102 "descr": "Production",
103 "dn": "uni/tn-production",
104 "name": "production",
105 "nameAlias": "",
106 "ownerKey": "",
107 "ownerTag": ""
108 }
109 }
110 }
111 ]
112 proposed:
113 description: The assembled configuration from the user-provided parameters
114 returned: info
115 type: dict
116 sample:
117 {
118 "fvTenant": {
119 "attributes": {
120 "descr": "Production environment",
121 "name": "production"
122 }
123 }
124 }
125 filter_string:
126 description: The filter string used for the request
127 returned: failure or debug
128 type: str
129 sample: ?rsp-prop-include=config-only
130 method:
131 description: The HTTP method used for the request to the APIC
132 returned: failure or debug
133 type: str
134 sample: POST
135 response:
136 description: The HTTP response from the APIC
137 returned: failure or debug
138 type: str
139 sample: OK (30 bytes)
140 status:
141 description: The HTTP status from the APIC
142 returned: failure or debug
143 type: int
144 sample: 200
145 url:
146 description: The HTTP url used for the request to the APIC
147 returned: failure or debug
148 type: str
149 sample: https://10.11.12.13/api/mo/uni/tn-production.json
150 """
151
152 from ansible_collections.cisco.aci.plugins.module_utils.aci import ACIModule, aci_argument_spec, aci_annotation_spec
153 from ansible.module_utils.basic import AnsibleModule
154
155
156 def main():
157 argument_spec = aci_argument_spec()
158 argument_spec.update(aci_annotation_spec())
159 argument_spec.update(
160 state=dict(type="str", default="query", choices=["query"]),
161 )
162
163 module = AnsibleModule(
164 argument_spec=argument_spec,
165 supports_check_mode=True,
166 )
167
168 aci = ACIModule(module)
169 aci.construct_url(root_class=dict(aci_class="cloudProvP"))
170
171 aci.get_existing()
172
173 aci.exit_json()
174
175
176 if __name__ == "__main__":
177 main()