Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_firewall_mmsprofile_notification.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_firewall_mmsprofile_notification
15 short_description: Notification configuration.
16 version_added: "2.0.0"
17 extends_documentation_fragment:
18 - fortinet.fortimanager.general
19 - fortinet.fortimanager.general.partial_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 mms-profile:
29 description: Deprecated, please use "mms_profile"
30 type: str
31 mms_profile:
32 description: The parameter (mms-profile) in requested url.
33 type: str
34 firewall_mmsprofile_notification:
35 description: The top level parameters set.
36 required: false
37 type: dict
38 suboptions:
39 alert_int:
40 aliases: ['alert-int']
41 type: int
42 description: Alert notification send interval.
43 alert_int_mode:
44 aliases: ['alert-int-mode']
45 type: str
46 description: Alert notification interval mode.
47 choices: ['hours', 'minutes']
48 alert_src_msisdn:
49 aliases: ['alert-src-msisdn']
50 type: str
51 description: Specify from address for alert messages.
52 alert_status:
53 aliases: ['alert-status']
54 type: str
55 description: Alert notification status.
56 choices: ['disable', 'enable']
57 bword_int:
58 aliases: ['bword-int']
59 type: int
60 description: Banned word notification send interval.
61 bword_int_mode:
62 aliases: ['bword-int-mode']
63 type: str
64 description: Banned word notification interval mode.
65 choices: ['hours', 'minutes']
66 bword_status:
67 aliases: ['bword-status']
68 type: str
69 description: Banned word notification status.
70 choices: ['disable', 'enable']
71 carrier_endpoint_bwl_int:
72 aliases: ['carrier-endpoint-bwl-int']
73 type: int
74 description: Carrier end point black/white list notification send interval.
75 carrier_endpoint_bwl_int_mode:
76 aliases: ['carrier-endpoint-bwl-int-mode']
77 type: str
78 description: Carrier end point black/white list notification interval mode.
79 choices: ['hours', 'minutes']
80 carrier_endpoint_bwl_status:
81 aliases: ['carrier-endpoint-bwl-status']
82 type: str
83 description: Carrier end point black/white list notification status.
84 choices: ['disable', 'enable']
85 days_allowed:
86 aliases: ['days-allowed']
87 type: list
88 elements: str
89 description: Weekdays on which notification messages may be sent.
90 choices: ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday',
91 'saturday']
92 detect_server:
93 aliases: ['detect-server']
94 type: str
95 description: Enable/disable automatic server address determination.
96 choices: ['disable', 'enable']
97 dupe_int:
98 aliases: ['dupe-int']
99 type: int
100 description: Duplicate notification send interval.
101 dupe_int_mode:
102 aliases: ['dupe-int-mode']
103 type: str
104 description: Duplicate notification interval mode.
105 choices: ['hours', 'minutes']
106 dupe_status:
107 aliases: ['dupe-status']
108 type: str
109 description: Duplicate notification status.
110 choices: ['disable', 'enable']
111 file_block_int:
112 aliases: ['file-block-int']
113 type: int
114 description: File block notification send interval.
115 file_block_int_mode:
116 aliases: ['file-block-int-mode']
117 type: str
118 description: File block notification interval mode.
119 choices: ['hours', 'minutes']
120 file_block_status:
121 aliases: ['file-block-status']
122 type: str
123 description: File block notification status.
124 choices: ['disable', 'enable']
125 flood_int:
126 aliases: ['flood-int']
127 type: int
128 description: Flood notification send interval.
129 flood_int_mode:
130 aliases: ['flood-int-mode']
131 type: str
132 description: Flood notification interval mode.
133 choices: ['hours', 'minutes']
134 flood_status:
135 aliases: ['flood-status']
136 type: str
137 description: Flood notification status.
138 choices: ['disable', 'enable']
139 from_in_header:
140 aliases: ['from-in-header']
141 type: str
142 description: Enable/disable insertion of from address in HTTP header.
143 choices: ['disable', 'enable']
144 mms_checksum_int:
145 aliases: ['mms-checksum-int']
146 type: int
147 description: MMS checksum notification send interval.
148 mms_checksum_int_mode:
149 aliases: ['mms-checksum-int-mode']
150 type: str
151 description: MMS checksum notification interval mode.
152 choices: ['hours', 'minutes']
153 mms_checksum_status:
154 aliases: ['mms-checksum-status']
155 type: str
156 description: MMS checksum notification status.
157 choices: ['disable', 'enable']
158 mmsc_hostname:
159 aliases: ['mmsc-hostname']
160 type: str
161 description: Host name or IP address of the MMSC.
162 mmsc_password:
163 aliases: ['mmsc-password']
164 type: raw
165 description: (list) Password required for authentication with the MMSC.
166 mmsc_port:
167 aliases: ['mmsc-port']
168 type: int
169 description: Port used on the MMSC for sending MMS messages
170 mmsc_url:
171 aliases: ['mmsc-url']
172 type: str
173 description: URL used on the MMSC for sending MMS messages.
174 mmsc_username:
175 aliases: ['mmsc-username']
176 type: str
177 description: User name required for authentication with the MMSC.
178 msg_protocol:
179 aliases: ['msg-protocol']
180 type: str
181 description: Protocol to use for sending notification messages.
182 choices: ['mm1', 'mm3', 'mm4', 'mm7']
183 msg_type:
184 aliases: ['msg-type']
185 type: str
186 description: MM7 message type.
187 choices: ['submit-req', 'deliver-req']
188 protocol:
189 type: str
190 description: Protocol.
191 rate_limit:
192 aliases: ['rate-limit']
193 type: int
194 description: Rate limit for sending notification messages
195 tod_window_duration:
196 aliases: ['tod-window-duration']
197 type: str
198 description: Time of day window duration.
199 tod_window_end:
200 aliases: ['tod-window-end']
201 type: str
202 description: Obsolete.
203 tod_window_start:
204 aliases: ['tod-window-start']
205 type: str
206 description: Time of day window start.
207 user_domain:
208 aliases: ['user-domain']
209 type: str
210 description: Domain name to which the user addresses belong.
211 vas_id:
212 aliases: ['vas-id']
213 type: str
214 description: VAS identifier.
215 vasp_id:
216 aliases: ['vasp-id']
217 type: str
218 description: VASP identifier.
219 virus_int:
220 aliases: ['virus-int']
221 type: int
222 description: Virus notification send interval.
223 virus_int_mode:
224 aliases: ['virus-int-mode']
225 type: str
226 description: Virus notification interval mode.
227 choices: ['hours', 'minutes']
228 virus_status:
229 aliases: ['virus-status']
230 type: str
231 description: Virus notification status.
232 choices: ['disable', 'enable']
233 '''
234
235 EXAMPLES = '''
236 - name: Example playbook (generated based on argument schema)
237 hosts: fortimanagers
238 connection: httpapi
239 gather_facts: false
240 tasks:
241 - name: Notification configuration.
242 fortinet.fortimanager.fmgr_firewall_mmsprofile_notification:
243 # workspace_locking_adom: <global or your adom name>
244 adom: <your own value>
245 mms_profile: <your own value>
246 firewall_mmsprofile_notification:
247 # alert_int: <integer>
248 # alert_int_mode: <value in [hours, minutes]>
249 # alert_src_msisdn: <string>
250 # alert_status: <value in [disable, enable]>
251 # bword_int: <integer>
252 # bword_int_mode: <value in [hours, minutes]>
253 # bword_status: <value in [disable, enable]>
254 # carrier_endpoint_bwl_int: <integer>
255 # carrier_endpoint_bwl_int_mode: <value in [hours, minutes]>
256 # carrier_endpoint_bwl_status: <value in [disable, enable]>
257 # days_allowed: ["sunday", "monday", "tuesday", "wednesday", "thursday", "friday",
258 # "saturday"]
259 # detect_server: <value in [disable, enable]>
260 # dupe_int: <integer>
261 # dupe_int_mode: <value in [hours, minutes]>
262 # dupe_status: <value in [disable, enable]>
263 # file_block_int: <integer>
264 # file_block_int_mode: <value in [hours, minutes]>
265 # file_block_status: <value in [disable, enable]>
266 # flood_int: <integer>
267 # flood_int_mode: <value in [hours, minutes]>
268 # flood_status: <value in [disable, enable]>
269 # from_in_header: <value in [disable, enable]>
270 # mms_checksum_int: <integer>
271 # mms_checksum_int_mode: <value in [hours, minutes]>
272 # mms_checksum_status: <value in [disable, enable]>
273 # mmsc_hostname: <string>
274 # mmsc_password: <list or string>
275 # mmsc_port: <integer>
276 # mmsc_url: <string>
277 # mmsc_username: <string>
278 # msg_protocol: <value in [mm1, mm3, mm4, ...]>
279 # msg_type: <value in [submit-req, deliver-req]>
280 # protocol: <string>
281 # rate_limit: <integer>
282 # tod_window_duration: <string>
283 # tod_window_end: <string>
284 # tod_window_start: <string>
285 # user_domain: <string>
286 # vas_id: <string>
287 # vasp_id: <string>
288 # virus_int: <integer>
289 # virus_int_mode: <value in [hours, minutes]>
290 # virus_status: <value in [disable, enable]>
291 '''
292
293 RETURN = '''
294 meta:
295 description: The result of the request.
296 type: dict
297 returned: always
298 contains:
299 request_url:
300 description: The full url requested.
301 returned: always
302 type: str
303 sample: /sys/login/user
304 response_code:
305 description: The status of api request.
306 returned: always
307 type: int
308 sample: 0
309 response_data:
310 description: The api response.
311 type: list
312 returned: always
313 response_message:
314 description: The descriptive message of the api response.
315 type: str
316 returned: always
317 sample: OK.
318 system_information:
319 description: The information of the target system.
320 type: dict
321 returned: always
322 rc:
323 description: The status the request.
324 type: int
325 returned: always
326 sample: 0
327 version_check_warning:
328 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
329 type: list
330 returned: complex
331 '''
332 from ansible.module_utils.basic import AnsibleModule
333 from ansible.module_utils.connection import Connection
334 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
335 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
336
337
338 def main():
339 urls_list = [
340 '/pm/config/adom/{adom}/obj/firewall/mms-profile/{mms-profile}/notification',
341 '/pm/config/global/obj/firewall/mms-profile/{mms-profile}/notification'
342 ]
343 module_arg_spec = {
344 'adom': {'required': True, 'type': 'str'},
345 'mms-profile': {'type': 'str', 'api_name': 'mms_profile'},
346 'mms_profile': {'type': 'str'},
347 'revision_note': {'type': 'str'},
348 'firewall_mmsprofile_notification': {
349 'type': 'dict', 'v_range': [['6.0.0', '7.6.2']],
350 'options': {
351 'alert-int': {'v_range': [['6.0.0', '7.6.2']], 'type': 'int'},
352 'alert-int-mode': {'v_range': [['6.0.0', '7.6.2']], 'choices': ['hours', 'minutes'], 'type': 'str'},
353 'alert-src-msisdn': {'v_range': [['6.0.0', '7.6.2']], 'type': 'str'},
354 'alert-status': {'v_range': [['6.0.0', '7.6.2']], 'choices': ['disable', 'enable'], 'type': 'str'},
355 'bword-int': {'v_range': [['6.0.0', '7.6.2']], 'type': 'int'},
356 'bword-int-mode': {'v_range': [['6.0.0', '7.6.2']], 'choices': ['hours', 'minutes'], 'type': 'str'},
357 'bword-status': {'v_range': [['6.0.0', '7.6.2']], 'choices': ['disable', 'enable'], 'type': 'str'},
358 'carrier-endpoint-bwl-int': {'v_range': [['6.0.0', '7.6.2']], 'type': 'int'},
359 'carrier-endpoint-bwl-int-mode': {'v_range': [['6.0.0', '7.6.2']], 'choices': ['hours', 'minutes'], 'type': 'str'},
360 'carrier-endpoint-bwl-status': {'v_range': [['6.0.0', '7.6.2']], 'choices': ['disable', 'enable'], 'type': 'str'},
361 'days-allowed': {
362 'v_range': [['6.0.0', '7.6.2']],
363 'type': 'list',
364 'choices': ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday'],
365 'elements': 'str'
366 },
367 'detect-server': {'v_range': [['6.0.0', '7.6.2']], 'choices': ['disable', 'enable'], 'type': 'str'},
368 'dupe-int': {'v_range': [['6.0.0', '7.6.2']], 'type': 'int'},
369 'dupe-int-mode': {'v_range': [['6.0.0', '7.6.2']], 'choices': ['hours', 'minutes'], 'type': 'str'},
370 'dupe-status': {'v_range': [['6.0.0', '7.6.2']], 'choices': ['disable', 'enable'], 'type': 'str'},
371 'file-block-int': {'v_range': [['6.0.0', '7.6.2']], 'type': 'int'},
372 'file-block-int-mode': {'v_range': [['6.0.0', '7.6.2']], 'choices': ['hours', 'minutes'], 'type': 'str'},
373 'file-block-status': {'v_range': [['6.0.0', '7.6.2']], 'choices': ['disable', 'enable'], 'type': 'str'},
374 'flood-int': {'v_range': [['6.0.0', '7.6.2']], 'type': 'int'},
375 'flood-int-mode': {'v_range': [['6.0.0', '7.6.2']], 'choices': ['hours', 'minutes'], 'type': 'str'},
376 'flood-status': {'v_range': [['6.0.0', '7.6.2']], 'choices': ['disable', 'enable'], 'type': 'str'},
377 'from-in-header': {'v_range': [['6.0.0', '7.6.2']], 'choices': ['disable', 'enable'], 'type': 'str'},
378 'mms-checksum-int': {'v_range': [['6.0.0', '7.6.2']], 'type': 'int'},
379 'mms-checksum-int-mode': {'v_range': [['6.0.0', '7.6.2']], 'choices': ['hours', 'minutes'], 'type': 'str'},
380 'mms-checksum-status': {'v_range': [['6.0.0', '7.6.2']], 'choices': ['disable', 'enable'], 'type': 'str'},
381 'mmsc-hostname': {'v_range': [['6.0.0', '7.6.2']], 'type': 'str'},
382 'mmsc-password': {'v_range': [['6.0.0', '7.6.2']], 'no_log': True, 'type': 'raw'},
383 'mmsc-port': {'v_range': [['6.0.0', '7.6.2']], 'type': 'int'},
384 'mmsc-url': {'v_range': [['6.0.0', '7.6.2']], 'type': 'str'},
385 'mmsc-username': {'v_range': [['6.0.0', '7.6.2']], 'type': 'str'},
386 'msg-protocol': {'v_range': [['6.0.0', '7.6.2']], 'choices': ['mm1', 'mm3', 'mm4', 'mm7'], 'type': 'str'},
387 'msg-type': {'v_range': [['6.0.0', '7.6.2']], 'choices': ['submit-req', 'deliver-req'], 'type': 'str'},
388 'protocol': {'v_range': [['6.0.0', '7.6.2']], 'type': 'str'},
389 'rate-limit': {'v_range': [['6.0.0', '7.6.2']], 'type': 'int'},
390 'tod-window-duration': {'v_range': [['6.0.0', '7.6.2']], 'type': 'str'},
391 'tod-window-end': {'v_range': [['6.0.0', '7.2.0']], 'type': 'str'},
392 'tod-window-start': {'v_range': [['6.0.0', '7.6.2']], 'type': 'str'},
393 'user-domain': {'v_range': [['6.0.0', '7.6.2']], 'type': 'str'},
394 'vas-id': {'v_range': [['6.0.0', '7.6.2']], 'type': 'str'},
395 'vasp-id': {'v_range': [['6.0.0', '7.6.2']], 'type': 'str'},
396 'virus-int': {'v_range': [['6.0.0', '7.6.2']], 'type': 'int'},
397 'virus-int-mode': {'v_range': [['6.0.0', '7.6.2']], 'choices': ['hours', 'minutes'], 'type': 'str'},
398 'virus-status': {'v_range': [['6.0.0', '7.6.2']], 'choices': ['disable', 'enable'], 'type': 'str'}
399 }
400 }
401 }
402
403 module_option_spec = get_module_arg_spec('partial crud')
404 module_arg_spec.update(module_option_spec)
405 check_galaxy_version(module_arg_spec)
406 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'firewall_mmsprofile_notification'),
407 supports_check_mode=True)
408 if not module._socket_path:
409 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
410 connection = Connection(module._socket_path)
411 fmgr = NAPIManager('partial crud', module_arg_spec, urls_list,
412 None, 'data', module, connection)
413 fmgr.process_partial_crud()
414 module.exit_json(meta=module.params)
415
416
417 if __name__ == '__main__':
418 main()