Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_firewall_profileprotocoloptions_mapi.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_profileprotocoloptions_mapi
15 short_description: Configure MAPI protocol options.
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 profile-protocol-options:
29 description: Deprecated, please use "profile_protocol_options"
30 type: str
31 profile_protocol_options:
32 description: The parameter (profile-protocol-options) in requested url.
33 type: str
34 firewall_profileprotocoloptions_mapi:
35 description: The top level parameters set.
36 required: false
37 type: dict
38 suboptions:
39 options:
40 type: list
41 elements: str
42 description: One or more options that can be applied to the session.
43 choices: ['fragmail', 'oversize', 'no-content-summary']
44 oversize_limit:
45 aliases: ['oversize-limit']
46 type: int
47 description: Maximum in-memory file size that can be scanned
48 ports:
49 type: raw
50 description: (list) Ports to scan for content
51 scan_bzip2:
52 aliases: ['scan-bzip2']
53 type: str
54 description: Enable/disable scanning of BZip2 compressed files.
55 choices: ['disable', 'enable']
56 status:
57 type: str
58 description: Enable/disable the active status of scanning for this protocol.
59 choices: ['disable', 'enable']
60 uncompressed_nest_limit:
61 aliases: ['uncompressed-nest-limit']
62 type: int
63 description: Maximum nested levels of compression that can be uncompressed and scanned
64 uncompressed_oversize_limit:
65 aliases: ['uncompressed-oversize-limit']
66 type: int
67 description: Maximum in-memory uncompressed file size that can be scanned
68 '''
69
70 EXAMPLES = '''
71 - name: Example playbook (generated based on argument schema)
72 hosts: fortimanagers
73 connection: httpapi
74 gather_facts: false
75 tasks:
76 - name: Configure MAPI protocol options.
77 fortinet.fortimanager.fmgr_firewall_profileprotocoloptions_mapi:
78 # workspace_locking_adom: <global or your adom name>
79 adom: <your own value>
80 profile_protocol_options: <your own value>
81 firewall_profileprotocoloptions_mapi:
82 # options: ["fragmail", "oversize", "no-content-summary"]
83 # oversize_limit: <integer>
84 # ports: <list or integer>
85 # scan_bzip2: <value in [disable, enable]>
86 # status: <value in [disable, enable]>
87 # uncompressed_nest_limit: <integer>
88 # uncompressed_oversize_limit: <integer>
89 '''
90
91 RETURN = '''
92 meta:
93 description: The result of the request.
94 type: dict
95 returned: always
96 contains:
97 request_url:
98 description: The full url requested.
99 returned: always
100 type: str
101 sample: /sys/login/user
102 response_code:
103 description: The status of api request.
104 returned: always
105 type: int
106 sample: 0
107 response_data:
108 description: The api response.
109 type: list
110 returned: always
111 response_message:
112 description: The descriptive message of the api response.
113 type: str
114 returned: always
115 sample: OK.
116 system_information:
117 description: The information of the target system.
118 type: dict
119 returned: always
120 rc:
121 description: The status the request.
122 type: int
123 returned: always
124 sample: 0
125 version_check_warning:
126 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
127 type: list
128 returned: complex
129 '''
130 from ansible.module_utils.basic import AnsibleModule
131 from ansible.module_utils.connection import Connection
132 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
133 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
134
135
136 def main():
137 urls_list = [
138 '/pm/config/adom/{adom}/obj/firewall/profile-protocol-options/{profile-protocol-options}/mapi',
139 '/pm/config/global/obj/firewall/profile-protocol-options/{profile-protocol-options}/mapi'
140 ]
141 module_arg_spec = {
142 'adom': {'required': True, 'type': 'str'},
143 'profile-protocol-options': {'type': 'str', 'api_name': 'profile_protocol_options'},
144 'profile_protocol_options': {'type': 'str'},
145 'revision_note': {'type': 'str'},
146 'firewall_profileprotocoloptions_mapi': {
147 'type': 'dict', 'v_range': [['6.0.0', '']],
148 'options': {
149 'options': {'type': 'list', 'choices': ['fragmail', 'oversize', 'no-content-summary'], 'elements': 'str'},
150 'oversize-limit': {'type': 'int'},
151 'ports': {'type': 'raw'},
152 'scan-bzip2': {'choices': ['disable', 'enable'], 'type': 'str'},
153 'status': {'choices': ['disable', 'enable'], 'type': 'str'},
154 'uncompressed-nest-limit': {'type': 'int'},
155 'uncompressed-oversize-limit': {'type': 'int'}
156 }
157 }
158 }
159
160 module_option_spec = get_module_arg_spec('partial crud')
161 module_arg_spec.update(module_option_spec)
162 check_galaxy_version(module_arg_spec)
163 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'firewall_profileprotocoloptions_mapi'),
164 supports_check_mode=True)
165 if not module._socket_path:
166 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
167 connection = Connection(module._socket_path)
168 fmgr = NAPIManager('partial crud', module_arg_spec, urls_list,
169 None, 'data', module, connection)
170 fmgr.process_partial_crud()
171 module.exit_json(meta=module.params)
172
173
174 if __name__ == '__main__':
175 main()