Debian Codegraph @

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