Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_firewall_mmsprofile_outbreakprevention.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_outbreakprevention
15 short_description: Configure Virus Outbreak Prevention settings.
16 version_added: "2.1.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_outbreakprevention:
35 description: The top level parameters set.
36 required: false
37 type: dict
38 suboptions:
39 external_blocklist:
40 aliases: ['external-blocklist']
41 type: str
42 description: Enable/disable external malware blocklist.
43 choices: ['disable', 'enable']
44 ftgd_service:
45 aliases: ['ftgd-service']
46 type: str
47 description: Enable/disable FortiGuard Virus outbreak prevention service.
48 choices: ['disable', 'enable']
49 '''
50
51 EXAMPLES = '''
52 - name: Example playbook (generated based on argument schema)
53 hosts: fortimanagers
54 connection: httpapi
55 gather_facts: false
56 tasks:
57 - name: Configure Virus Outbreak Prevention settings.
58 fortinet.fortimanager.fmgr_firewall_mmsprofile_outbreakprevention:
59 # workspace_locking_adom: <global or your adom name>
60 adom: <your own value>
61 mms_profile: <your own value>
62 firewall_mmsprofile_outbreakprevention:
63 # external_blocklist: <value in [disable, enable]>
64 # ftgd_service: <value in [disable, enable]>
65 '''
66
67 RETURN = '''
68 meta:
69 description: The result of the request.
70 type: dict
71 returned: always
72 contains:
73 request_url:
74 description: The full url requested.
75 returned: always
76 type: str
77 sample: /sys/login/user
78 response_code:
79 description: The status of api request.
80 returned: always
81 type: int
82 sample: 0
83 response_data:
84 description: The api response.
85 type: list
86 returned: always
87 response_message:
88 description: The descriptive message of the api response.
89 type: str
90 returned: always
91 sample: OK.
92 system_information:
93 description: The information of the target system.
94 type: dict
95 returned: always
96 rc:
97 description: The status the request.
98 type: int
99 returned: always
100 sample: 0
101 version_check_warning:
102 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
103 type: list
104 returned: complex
105 '''
106 from ansible.module_utils.basic import AnsibleModule
107 from ansible.module_utils.connection import Connection
108 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
109 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
110
111
112 def main():
113 urls_list = [
114 '/pm/config/adom/{adom}/obj/firewall/mms-profile/{mms-profile}/outbreak-prevention',
115 '/pm/config/global/obj/firewall/mms-profile/{mms-profile}/outbreak-prevention'
116 ]
117 module_arg_spec = {
118 'adom': {'required': True, 'type': 'str'},
119 'mms-profile': {'type': 'str', 'api_name': 'mms_profile'},
120 'mms_profile': {'type': 'str'},
121 'revision_note': {'type': 'str'},
122 'firewall_mmsprofile_outbreakprevention': {
123 'type': 'dict', 'v_range': [['6.2.0', '7.6.2']],
124 'options': {
125 'external-blocklist': {'v_range': [['6.2.0', '7.6.2']], 'choices': ['disable', 'enable'], 'type': 'str'},
126 'ftgd-service': {'v_range': [['6.2.0', '7.6.2']], 'choices': ['disable', 'enable'], 'type': 'str'}
127 }
128 }
129 }
130
131 module_option_spec = get_module_arg_spec('partial crud')
132 module_arg_spec.update(module_option_spec)
133 check_galaxy_version(module_arg_spec)
134 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'firewall_mmsprofile_outbreakprevention'),
135 supports_check_mode=True)
136 if not module._socket_path:
137 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
138 connection = Connection(module._socket_path)
139 fmgr = NAPIManager('partial crud', module_arg_spec, urls_list,
140 None, 'data', module, connection)
141 fmgr.process_partial_crud()
142 module.exit_json(meta=module.params)
143
144
145 if __name__ == '__main__':
146 main()