Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_utmprofile.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_utmprofile
15 short_description: Configure UTM
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 utmprofile:
29 description: The top level parameters set.
30 required: false
31 type: dict
32 suboptions:
33 antivirus_profile:
34 aliases: ['antivirus-profile']
35 type: str
36 description: AntiVirus profile name.
37 application_list:
38 aliases: ['application-list']
39 type: str
40 description: Application control list name.
41 comment:
42 type: str
43 description: Comment.
44 ips_sensor:
45 aliases: ['ips-sensor']
46 type: str
47 description: IPS sensor name.
48 name:
49 type: str
50 description: UTM profile name.
51 required: true
52 scan_botnet_connections:
53 aliases: ['scan-botnet-connections']
54 type: str
55 description: Block or monitor connections to Botnet servers or disable Botnet scanning.
56 choices: ['disable', 'block', 'monitor']
57 utm_log:
58 aliases: ['utm-log']
59 type: str
60 description: Enable/disable UTM logging.
61 choices: ['disable', 'enable']
62 webfilter_profile:
63 aliases: ['webfilter-profile']
64 type: str
65 description: WebFilter profile name.
66 '''
67
68 EXAMPLES = '''
69 - name: Example playbook (generated based on argument schema)
70 hosts: fortimanagers
71 connection: httpapi
72 gather_facts: false
73 tasks:
74 - name: Configure UTM
75 fortinet.fortimanager.fmgr_utmprofile:
76 # workspace_locking_adom: <global or your adom name>
77 adom: <your own value>
78 state: present # <value in [present, absent]>
79 utmprofile:
80 name: "your value" # Required variable, string
81 # antivirus_profile: <string>
82 # application_list: <string>
83 # comment: <string>
84 # ips_sensor: <string>
85 # scan_botnet_connections: <value in [disable, block, monitor]>
86 # utm_log: <value in [disable, enable]>
87 # webfilter_profile: <string>
88 '''
89
90 RETURN = '''
91 meta:
92 description: The result of the request.
93 type: dict
94 returned: always
95 contains:
96 request_url:
97 description: The full url requested.
98 returned: always
99 type: str
100 sample: /sys/login/user
101 response_code:
102 description: The status of api request.
103 returned: always
104 type: int
105 sample: 0
106 response_data:
107 description: The api response.
108 type: list
109 returned: always
110 response_message:
111 description: The descriptive message of the api response.
112 type: str
113 returned: always
114 sample: OK.
115 system_information:
116 description: The information of the target system.
117 type: dict
118 returned: always
119 rc:
120 description: The status the request.
121 type: int
122 returned: always
123 sample: 0
124 version_check_warning:
125 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
126 type: list
127 returned: complex
128 '''
129 from ansible.module_utils.basic import AnsibleModule
130 from ansible.module_utils.connection import Connection
131 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
132 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
133
134
135 def main():
136 urls_list = [
137 '/pm/config/adom/{adom}/obj/wireless-controller/utm-profile',
138 '/pm/config/global/obj/wireless-controller/utm-profile'
139 ]
140 module_arg_spec = {
141 'adom': {'required': True, 'type': 'str'},
142 'revision_note': {'type': 'str'},
143 'utmprofile': {
144 'type': 'dict', 'v_range': [['6.2.2', '']],
145 'options': {
146 'antivirus-profile': {'v_range': [['6.2.2', '']], 'type': 'str'},
147 'application-list': {'v_range': [['6.2.2', '']], 'type': 'str'},
148 'comment': {'v_range': [['6.2.2', '']], 'type': 'str'},
149 'ips-sensor': {'v_range': [['6.2.2', '']], 'type': 'str'},
150 'name': {'v_range': [['6.2.2', '']], 'required': True, 'type': 'str'},
151 'scan-botnet-connections': {'v_range': [['6.2.2', '']], 'choices': ['disable', 'block', 'monitor'], 'type': 'str'},
152 'utm-log': {'v_range': [['6.2.2', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
153 'webfilter-profile': {'v_range': [['6.2.2', '']], 'type': 'str'}
154 }
155 }
156 }
157
158 module_option_spec = get_module_arg_spec('full crud')
159 module_arg_spec.update(module_option_spec)
160 check_galaxy_version(module_arg_spec)
161 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'utmprofile'),
162 supports_check_mode=True)
163 if not module._socket_path:
164 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
165 connection = Connection(module._socket_path)
166 fmgr = NAPIManager('full crud', module_arg_spec, urls_list,
167 'name', 'data', module, connection)
168 fmgr.process_crud()
169 module.exit_json(meta=module.params)
170
171
172 if __name__ == '__main__':
173 main()