Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_hotspot20_anqpnairealm.py

raw symbols SCIP
1 #!/usr/bin/python
2 from __future__ import absolute_import, division, print_function
3 # Copyright 2019-2024 Fortinet, Inc.
4 # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
5
6 __metaclass__ = type
7
8 ANSIBLE_METADATA = {'status': ['preview'],
9 'supported_by': 'community',
10 'metadata_version': '1.1'}
11
12 DOCUMENTATION = '''
13 ---
14 module: fmgr_hotspot20_anqpnairealm
15 short_description: Configure network access identifier
16 version_added: "2.0.0"
17 extends_documentation_fragment:
18 - fortinet.fortimanager.general
19 - fortinet.fortimanager.general.full_crud
20 options:
21 revision_note:
22 description: The change note that can be specified when an object is created or updated.
23 type: str
24 adom:
25 description: The parameter (adom) in requested url.
26 type: str
27 required: true
28 hotspot20_anqpnairealm:
29 description: The top level parameters set.
30 required: false
31 type: dict
32 suboptions:
33 nai_list:
34 aliases: ['nai-list']
35 type: list
36 elements: dict
37 description: Nai list.
38 suboptions:
39 eap_method:
40 aliases: ['eap-method']
41 type: list
42 elements: dict
43 description: Eap method.
44 suboptions:
45 auth_param:
46 aliases: ['auth-param']
47 type: list
48 elements: dict
49 description: Auth param.
50 suboptions:
51 id:
52 type: str
53 description: ID of authentication parameter.
54 choices: ['non-eap-inner-auth', 'inner-auth-eap',
55 'credential', 'tunneled-credential']
56 index:
57 type: int
58 description: Param index.
59 val:
60 type: str
61 description: Value of authentication parameter.
62 choices: ['eap-identity', 'eap-md5', 'eap-tls',
63 'eap-ttls', 'eap-peap', 'eap-sim', 'eap-aka',
64 'eap-aka-prime', 'non-eap-pap', 'non-eap-chap',
65 'non-eap-mschap', 'non-eap-mschapv2',
66 'cred-sim', 'cred-usim', 'cred-nfc',
67 'cred-hardware-token', 'cred-softoken',
68 'cred-certificate', 'cred-user-pwd',
69 'cred-none', 'cred-vendor-specific',
70 'tun-cred-sim', 'tun-cred-usim', 'tun-cred-nfc',
71 'tun-cred-hardware-token', 'tun-cred-softoken',
72 'tun-cred-certificate', 'tun-cred-user-pwd',
73 'tun-cred-anonymous', 'tun-cred-vendor-specific']
74 index:
75 type: int
76 description: EAP method index.
77 method:
78 type: str
79 description: EAP method type.
80 choices: ['eap-identity', 'eap-md5', 'eap-tls', 'eap-ttls',
81 'eap-peap', 'eap-sim', 'eap-aka', 'eap-aka-prime']
82 encoding:
83 type: str
84 description: Enable/disable format in accordance with IETF RFC 4282.
85 choices: ['disable', 'enable']
86 nai_realm:
87 aliases: ['nai-realm']
88 type: str
89 description: Configure NAI realms
90 name:
91 type: str
92 description: NAI realm name.
93 name:
94 type: str
95 description: NAI realm list name.
96 required: true
97 '''
98
99 EXAMPLES = '''
100 - name: Example playbook (generated based on argument schema)
101 hosts: fortimanagers
102 connection: httpapi
103 gather_facts: false
104 tasks:
105 - name: Configure network access identifier
106 fortinet.fortimanager.fmgr_hotspot20_anqpnairealm:
107 # workspace_locking_adom: <global or your adom name>
108 adom: <your own value>
109 state: present # <value in [present, absent]>
110 hotspot20_anqpnairealm:
111 name: "your value" # Required variable, string
112 # nai_list:
113 # - eap_method:
114 # - auth_param:
115 # - id: <value in [non-eap-inner-auth, inner-auth-eap, credential, ...]>
116 # index: <integer>
117 # val: <value in [eap-identity, eap-md5, eap-tls, ...]>
118 # index: <integer>
119 # method: <value in [eap-identity, eap-md5, eap-tls, ...]>
120 # encoding: <value in [disable, enable]>
121 # nai_realm: <string>
122 # name: <string>
123 '''
124
125 RETURN = '''
126 meta:
127 description: The result of the request.
128 type: dict
129 returned: always
130 contains:
131 request_url:
132 description: The full url requested.
133 returned: always
134 type: str
135 sample: /sys/login/user
136 response_code:
137 description: The status of api request.
138 returned: always
139 type: int
140 sample: 0
141 response_data:
142 description: The api response.
143 type: list
144 returned: always
145 response_message:
146 description: The descriptive message of the api response.
147 type: str
148 returned: always
149 sample: OK.
150 system_information:
151 description: The information of the target system.
152 type: dict
153 returned: always
154 rc:
155 description: The status the request.
156 type: int
157 returned: always
158 sample: 0
159 version_check_warning:
160 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
161 type: list
162 returned: complex
163 '''
164 from ansible.module_utils.basic import AnsibleModule
165 from ansible.module_utils.connection import Connection
166 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
167 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
168
169
170 def main():
171 urls_list = [
172 '/pm/config/adom/{adom}/obj/wireless-controller/hotspot20/anqp-nai-realm',
173 '/pm/config/global/obj/wireless-controller/hotspot20/anqp-nai-realm'
174 ]
175 module_arg_spec = {
176 'adom': {'required': True, 'type': 'str'},
177 'revision_note': {'type': 'str'},
178 'hotspot20_anqpnairealm': {
179 'type': 'dict', 'v_range': [['6.0.0', '']],
180 'options': {
181 'nai-list': {
182 'type': 'list',
183 'options': {
184 'eap-method': {
185 'type': 'list',
186 'options': {
187 'auth-param': {
188 'type': 'list',
189 'options': {
190 'id': {'choices': ['non-eap-inner-auth', 'inner-auth-eap', 'credential', 'tunneled-credential'], 'type': 'str'},
191 'index': {'type': 'int'},
192 'val': {
193 'choices': [
194 'eap-identity', 'eap-md5', 'eap-tls', 'eap-ttls', 'eap-peap', 'eap-sim', 'eap-aka', 'eap-aka-prime',
195 'non-eap-pap', 'non-eap-chap', 'non-eap-mschap', 'non-eap-mschapv2', 'cred-sim', 'cred-usim', 'cred-nfc',
196 'cred-hardware-token', 'cred-softoken', 'cred-certificate', 'cred-user-pwd', 'cred-none',
197 'cred-vendor-specific', 'tun-cred-sim', 'tun-cred-usim', 'tun-cred-nfc', 'tun-cred-hardware-token',
198 'tun-cred-softoken', 'tun-cred-certificate', 'tun-cred-user-pwd', 'tun-cred-anonymous',
199 'tun-cred-vendor-specific'
200 ],
201 'type': 'str'
202 }
203 },
204 'elements': 'dict'
205 },
206 'index': {'type': 'int'},
207 'method': {
208 'choices': ['eap-identity', 'eap-md5', 'eap-tls', 'eap-ttls', 'eap-peap', 'eap-sim', 'eap-aka', 'eap-aka-prime'],
209 'type': 'str'
210 }
211 },
212 'elements': 'dict'
213 },
214 'encoding': {'choices': ['disable', 'enable'], 'type': 'str'},
215 'nai-realm': {'type': 'str'},
216 'name': {'type': 'str'}
217 },
218 'elements': 'dict'
219 },
220 'name': {'required': True, 'type': 'str'}
221 }
222 }
223 }
224
225 module_option_spec = get_module_arg_spec('full crud')
226 module_arg_spec.update(module_option_spec)
227 check_galaxy_version(module_arg_spec)
228 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'hotspot20_anqpnairealm'),
229 supports_check_mode=True)
230 if not module._socket_path:
231 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
232 connection = Connection(module._socket_path)
233 fmgr = NAPIManager('full crud', module_arg_spec, urls_list,
234 'name', 'data', module, connection)
235 fmgr.process_crud()
236 module.exit_json(meta=module.params)
237
238
239 if __name__ == '__main__':
240 main()