Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_fmupdate_webspam_webproxy.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_fmupdate_webspam_webproxy
15 short_description: Configure the web proxy for use with FortiGuard antivirus and IPS updates.
16 version_added: "2.0.0"
17 extends_documentation_fragment:
18 - fortinet.fortimanager.general
19 - fortinet.fortimanager.general.partial_crud
20 options:
21 fmupdate_webspam_webproxy:
22 description: The top level parameters set.
23 required: false
24 type: dict
25 suboptions:
26 ip:
27 type: str
28 description: IPv4 address of the web proxy.
29 ip6:
30 type: str
31 description: IPv6 address of the web proxy.
32 mode:
33 type: str
34 description:
35 - Web proxy mode
36 - proxy - HTTP proxy.
37 - tunnel - HTTP tunnel.
38 choices: ['proxy', 'tunnel']
39 password:
40 type: raw
41 description: (list) The password for the user name used for authentication.
42 port:
43 type: int
44 description: The port number of the web proxy
45 status:
46 type: str
47 description:
48 - Enable/disable connections through the web proxy
49 - disable - Disable setting.
50 - enable - Enable setting.
51 choices: ['disable', 'enable']
52 username:
53 type: str
54 description: The user name used for authentication.
55 address:
56 type: str
57 description: Web proxy address.
58 '''
59
60 EXAMPLES = '''
61 - name: Example playbook (generated based on argument schema)
62 hosts: fortimanagers
63 connection: httpapi
64 gather_facts: false
65 tasks:
66 - name: Configure the web proxy for use with FortiGuard antivirus and IPS updates.
67 fortinet.fortimanager.fmgr_fmupdate_webspam_webproxy:
68 # workspace_locking_adom: <global or your adom name>
69 fmupdate_webspam_webproxy:
70 # ip: <string>
71 # ip6: <string>
72 # mode: <value in [proxy, tunnel]>
73 # password: <list or string>
74 # port: <integer>
75 # status: <value in [disable, enable]>
76 # username: <string>
77 # address: <string>
78 '''
79
80 RETURN = '''
81 meta:
82 description: The result of the request.
83 type: dict
84 returned: always
85 contains:
86 request_url:
87 description: The full url requested.
88 returned: always
89 type: str
90 sample: /sys/login/user
91 response_code:
92 description: The status of api request.
93 returned: always
94 type: int
95 sample: 0
96 response_data:
97 description: The api response.
98 type: list
99 returned: always
100 response_message:
101 description: The descriptive message of the api response.
102 type: str
103 returned: always
104 sample: OK.
105 system_information:
106 description: The information of the target system.
107 type: dict
108 returned: always
109 rc:
110 description: The status the request.
111 type: int
112 returned: always
113 sample: 0
114 version_check_warning:
115 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
116 type: list
117 returned: complex
118 '''
119 from ansible.module_utils.basic import AnsibleModule
120 from ansible.module_utils.connection import Connection
121 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
122 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
123
124
125 def main():
126 urls_list = [
127 '/cli/global/fmupdate/web-spam/web-proxy'
128 ]
129 module_arg_spec = {
130 'fmupdate_webspam_webproxy': {
131 'type': 'dict', 'v_range': [['6.0.0', '7.4.0']],
132 'options': {
133 'ip': {'v_range': [['6.0.0', '6.2.1']], 'type': 'str'},
134 'ip6': {'v_range': [['6.0.0', '6.2.1']], 'type': 'str'},
135 'mode': {'v_range': [['6.0.0', '7.4.0']], 'choices': ['proxy', 'tunnel'], 'type': 'str'},
136 'password': {'v_range': [['6.0.0', '7.4.0']], 'no_log': True, 'type': 'raw'},
137 'port': {'v_range': [['6.0.0', '7.4.0']], 'type': 'int'},
138 'status': {'v_range': [['6.0.0', '7.4.0']], 'choices': ['disable', 'enable'], 'type': 'str'},
139 'username': {'v_range': [['6.0.0', '7.4.0']], 'type': 'str'},
140 'address': {'v_range': [['6.2.2', '7.4.0']], 'type': 'str'}
141 }
142 }
143 }
144
145 module_option_spec = get_module_arg_spec('partial crud')
146 module_arg_spec.update(module_option_spec)
147 check_galaxy_version(module_arg_spec)
148 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'fmupdate_webspam_webproxy'),
149 supports_check_mode=True)
150 if not module._socket_path:
151 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
152 connection = Connection(module._socket_path)
153 fmgr = NAPIManager('partial crud', module_arg_spec, urls_list,
154 None, 'data', module, connection)
155 fmgr.process_partial_crud()
156 module.exit_json(meta=module.params)
157
158
159 if __name__ == '__main__':
160 main()