Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_extendercontroller_simprofile.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_extendercontroller_simprofile
15 short_description: Extender controller sim profile
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 extendercontroller_simprofile:
29 description: The top level parameters set.
30 required: false
31 type: dict
32 suboptions:
33 auto_switch_profile:
34 aliases: ['auto-switch_profile']
35 type: dict
36 description: Auto switch profile.
37 suboptions:
38 dataplan:
39 type: str
40 description: Dataplan.
41 choices: ['disable', 'enable']
42 disconnect:
43 type: str
44 description: Disconnect.
45 choices: ['disable', 'enable']
46 disconnect_period:
47 aliases: ['disconnect-period']
48 type: int
49 description: Disconnect period.
50 disconnect_threshold:
51 aliases: ['disconnect-threshold']
52 type: int
53 description: Disconnect threshold.
54 signal:
55 type: str
56 description: Signal.
57 choices: ['disable', 'enable']
58 status:
59 type: str
60 description: Status.
61 choices: ['disable', 'enable']
62 switch_back:
63 aliases: ['switch-back']
64 type: list
65 elements: str
66 description: Switch back.
67 choices: ['time', 'timer']
68 switch_back_time:
69 aliases: ['switch-back-time']
70 type: str
71 description: Switch back time.
72 switch_back_timer:
73 aliases: ['switch-back-timer']
74 type: int
75 description: Switch back timer.
76 conn_status:
77 aliases: ['conn-status']
78 type: int
79 description: Conn status.
80 default_sim:
81 aliases: ['default-sim']
82 type: str
83 description: Default sim.
84 choices: ['sim1', 'sim2', 'carrier', 'cost']
85 description:
86 type: str
87 description: Description.
88 gps:
89 type: str
90 description: Gps.
91 choices: ['disable', 'enable']
92 modem_id:
93 aliases: ['modem-id']
94 type: int
95 description: Modem id.
96 name:
97 type: str
98 description: Name.
99 required: true
100 preferred_carrier:
101 aliases: ['preferred-carrier']
102 type: str
103 description: Preferred carrier.
104 redundant_intf:
105 aliases: ['redundant-intf']
106 type: str
107 description: Redundant intf.
108 redundant_mode:
109 aliases: ['redundant-mode']
110 type: str
111 description: Redundant mode.
112 choices: ['disable', 'enable']
113 sim1_pin:
114 aliases: ['sim1-pin']
115 type: str
116 description: Sim1 pin.
117 choices: ['disable', 'enable']
118 sim1_pin_code:
119 aliases: ['sim1-pin-code']
120 type: raw
121 description: (list) Sim1 pin code.
122 sim2_pin:
123 aliases: ['sim2-pin']
124 type: str
125 description: Sim2 pin.
126 choices: ['disable', 'enable']
127 sim2_pin_code:
128 aliases: ['sim2-pin-code']
129 type: raw
130 description: (list) Sim2 pin code.
131 status:
132 type: str
133 description: Status.
134 choices: ['disable', 'enable']
135 '''
136
137 EXAMPLES = '''
138 - name: Example playbook (generated based on argument schema)
139 hosts: fortimanagers
140 connection: httpapi
141 gather_facts: false
142 tasks:
143 - name: Extender controller sim profile
144 fortinet.fortimanager.fmgr_extendercontroller_simprofile:
145 # workspace_locking_adom: <global or your adom name>
146 adom: <your own value>
147 state: present # <value in [present, absent]>
148 extendercontroller_simprofile:
149 name: "your value" # Required variable, string
150 # auto_switch_profile:
151 # dataplan: <value in [disable, enable]>
152 # disconnect: <value in [disable, enable]>
153 # disconnect_period: <integer>
154 # disconnect_threshold: <integer>
155 # signal: <value in [disable, enable]>
156 # status: <value in [disable, enable]>
157 # switch_back: ["time", "timer"]
158 # switch_back_time: <string>
159 # switch_back_timer: <integer>
160 # conn_status: <integer>
161 # default_sim: <value in [sim1, sim2, carrier, ...]>
162 # description: <string>
163 # gps: <value in [disable, enable]>
164 # modem_id: <integer>
165 # preferred_carrier: <string>
166 # redundant_intf: <string>
167 # redundant_mode: <value in [disable, enable]>
168 # sim1_pin: <value in [disable, enable]>
169 # sim1_pin_code: <list or string>
170 # sim2_pin: <value in [disable, enable]>
171 # sim2_pin_code: <list or string>
172 # status: <value in [disable, enable]>
173 '''
174
175 RETURN = '''
176 meta:
177 description: The result of the request.
178 type: dict
179 returned: always
180 contains:
181 request_url:
182 description: The full url requested.
183 returned: always
184 type: str
185 sample: /sys/login/user
186 response_code:
187 description: The status of api request.
188 returned: always
189 type: int
190 sample: 0
191 response_data:
192 description: The api response.
193 type: list
194 returned: always
195 response_message:
196 description: The descriptive message of the api response.
197 type: str
198 returned: always
199 sample: OK.
200 system_information:
201 description: The information of the target system.
202 type: dict
203 returned: always
204 rc:
205 description: The status the request.
206 type: int
207 returned: always
208 sample: 0
209 version_check_warning:
210 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
211 type: list
212 returned: complex
213 '''
214 from ansible.module_utils.basic import AnsibleModule
215 from ansible.module_utils.connection import Connection
216 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
217 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
218
219
220 def main():
221 urls_list = [
222 '/pm/config/adom/{adom}/obj/extender-controller/sim_profile',
223 '/pm/config/global/obj/extender-controller/sim_profile'
224 ]
225 module_arg_spec = {
226 'adom': {'required': True, 'type': 'str'},
227 'revision_note': {'type': 'str'},
228 'extendercontroller_simprofile': {
229 'type': 'dict', 'v_range': [['6.4.4', '']],
230 'options': {
231 'auto-switch_profile': {
232 'v_range': [['6.4.5', '']],
233 'type': 'dict',
234 'options': {
235 'dataplan': {'v_range': [['6.4.5', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
236 'disconnect': {'v_range': [['6.4.5', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
237 'disconnect-period': {'v_range': [['6.4.5', '']], 'type': 'int'},
238 'disconnect-threshold': {'v_range': [['6.4.5', '']], 'type': 'int'},
239 'signal': {'v_range': [['6.4.5', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
240 'status': {'v_range': [['6.4.5', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
241 'switch-back': {'v_range': [['6.4.5', '']], 'type': 'list', 'choices': ['time', 'timer'], 'elements': 'str'},
242 'switch-back-time': {'v_range': [['6.4.5', '']], 'type': 'str'},
243 'switch-back-timer': {'v_range': [['6.4.5', '']], 'type': 'int'}
244 }
245 },
246 'conn-status': {'v_range': [['6.4.4', '']], 'type': 'int'},
247 'default-sim': {'v_range': [['6.4.4', '']], 'choices': ['sim1', 'sim2', 'carrier', 'cost'], 'type': 'str'},
248 'description': {'v_range': [['6.4.4', '']], 'type': 'str'},
249 'gps': {'v_range': [['6.4.4', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
250 'modem-id': {'v_range': [['6.4.4', '']], 'type': 'int'},
251 'name': {'v_range': [['6.4.4', '']], 'required': True, 'type': 'str'},
252 'preferred-carrier': {'v_range': [['6.4.4', '']], 'type': 'str'},
253 'redundant-intf': {'v_range': [['6.4.4', '']], 'type': 'str'},
254 'redundant-mode': {'v_range': [['6.4.4', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
255 'sim1-pin': {'v_range': [['6.4.4', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
256 'sim1-pin-code': {'v_range': [['6.4.4', '']], 'type': 'raw'},
257 'sim2-pin': {'v_range': [['6.4.4', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
258 'sim2-pin-code': {'v_range': [['6.4.4', '']], 'type': 'raw'},
259 'status': {'v_range': [['6.4.4', '']], 'choices': ['disable', 'enable'], 'type': 'str'}
260 }
261 }
262 }
263
264 module_option_spec = get_module_arg_spec('full crud')
265 module_arg_spec.update(module_option_spec)
266 check_galaxy_version(module_arg_spec)
267 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'extendercontroller_simprofile'),
268 supports_check_mode=True)
269 if not module._socket_path:
270 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
271 connection = Connection(module._socket_path)
272 fmgr = NAPIManager('full crud', module_arg_spec, urls_list,
273 'name', 'data', module, connection)
274 fmgr.process_crud()
275 module.exit_json(meta=module.params)
276
277
278 if __name__ == '__main__':
279 main()