Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_hotspot20_h2qpadviceofcharge.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_h2qpadviceofcharge
15 short_description: Configure advice of charge.
16 version_added: "2.1.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_h2qpadviceofcharge:
29 description: The top level parameters set.
30 required: false
31 type: dict
32 suboptions:
33 aoc_list:
34 aliases: ['aoc-list']
35 type: list
36 elements: dict
37 description: Aoc list.
38 suboptions:
39 nai_realm:
40 aliases: ['nai-realm']
41 type: str
42 description: NAI realm list name.
43 nai_realm_encoding:
44 aliases: ['nai-realm-encoding']
45 type: str
46 description: NAI realm encoding.
47 name:
48 type: str
49 description: Advice of charge ID.
50 plan_info:
51 aliases: ['plan-info']
52 type: list
53 elements: dict
54 description: Plan info.
55 suboptions:
56 currency:
57 type: str
58 description: Currency code.
59 info_file:
60 aliases: ['info-file']
61 type: str
62 description: Info file.
63 lang:
64 type: str
65 description: Language code.
66 name:
67 type: str
68 description: Plan name.
69 type:
70 type: str
71 description: Usage charge type.
72 choices: ['time-based', 'volume-based', 'time-and-volume-based',
73 'unlimited']
74 name:
75 type: str
76 description: Plan name.
77 required: true
78 '''
79
80 EXAMPLES = '''
81 - name: Example playbook (generated based on argument schema)
82 hosts: fortimanagers
83 connection: httpapi
84 gather_facts: false
85 tasks:
86 - name: Configure advice of charge.
87 fortinet.fortimanager.fmgr_hotspot20_h2qpadviceofcharge:
88 # workspace_locking_adom: <global or your adom name>
89 adom: <your own value>
90 state: present # <value in [present, absent]>
91 hotspot20_h2qpadviceofcharge:
92 name: "your value" # Required variable, string
93 # aoc_list:
94 # - nai_realm: <string>
95 # nai_realm_encoding: <string>
96 # name: <string>
97 # plan_info:
98 # - currency: <string>
99 # info_file: <string>
100 # lang: <string>
101 # name: <string>
102 # type: <value in [time-based, volume-based, time-and-volume-based, ...]>
103 '''
104
105 RETURN = '''
106 meta:
107 description: The result of the request.
108 type: dict
109 returned: always
110 contains:
111 request_url:
112 description: The full url requested.
113 returned: always
114 type: str
115 sample: /sys/login/user
116 response_code:
117 description: The status of api request.
118 returned: always
119 type: int
120 sample: 0
121 response_data:
122 description: The api response.
123 type: list
124 returned: always
125 response_message:
126 description: The descriptive message of the api response.
127 type: str
128 returned: always
129 sample: OK.
130 system_information:
131 description: The information of the target system.
132 type: dict
133 returned: always
134 rc:
135 description: The status the request.
136 type: int
137 returned: always
138 sample: 0
139 version_check_warning:
140 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
141 type: list
142 returned: complex
143 '''
144 from ansible.module_utils.basic import AnsibleModule
145 from ansible.module_utils.connection import Connection
146 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
147 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
148
149
150 def main():
151 urls_list = [
152 '/pm/config/adom/{adom}/obj/wireless-controller/hotspot20/h2qp-advice-of-charge',
153 '/pm/config/global/obj/wireless-controller/hotspot20/h2qp-advice-of-charge'
154 ]
155 module_arg_spec = {
156 'adom': {'required': True, 'type': 'str'},
157 'revision_note': {'type': 'str'},
158 'hotspot20_h2qpadviceofcharge': {
159 'type': 'dict', 'v_range': [['7.0.3', '']],
160 'options': {
161 'aoc-list': {
162 'v_range': [['7.0.3', '']],
163 'type': 'list',
164 'options': {
165 'nai-realm': {'v_range': [['7.0.3', '']], 'type': 'str'},
166 'nai-realm-encoding': {'v_range': [['7.0.3', '']], 'type': 'str'},
167 'name': {'v_range': [['7.0.3', '']], 'type': 'str'},
168 'plan-info': {
169 'v_range': [['7.0.3', '']],
170 'type': 'list',
171 'options': {
172 'currency': {'v_range': [['7.0.3', '']], 'type': 'str'},
173 'info-file': {'v_range': [['7.0.3', '']], 'type': 'str'},
174 'lang': {'v_range': [['7.0.3', '']], 'type': 'str'},
175 'name': {'v_range': [['7.0.3', '']], 'type': 'str'}
176 },
177 'elements': 'dict'
178 },
179 'type': {
180 'v_range': [['7.0.3', '']],
181 'choices': ['time-based', 'volume-based', 'time-and-volume-based', 'unlimited'],
182 'type': 'str'
183 }
184 },
185 'elements': 'dict'
186 },
187 'name': {'v_range': [['7.0.3', '']], 'required': True, 'type': 'str'}
188 }
189 }
190 }
191
192 module_option_spec = get_module_arg_spec('full crud')
193 module_arg_spec.update(module_option_spec)
194 check_galaxy_version(module_arg_spec)
195 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'hotspot20_h2qpadviceofcharge'),
196 supports_check_mode=True)
197 if not module._socket_path:
198 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
199 connection = Connection(module._socket_path)
200 fmgr = NAPIManager('full crud', module_arg_spec, urls_list,
201 'name', 'data', module, connection)
202 fmgr.process_crud()
203 module.exit_json(meta=module.params)
204
205
206 if __name__ == '__main__':
207 main()