Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_wanopt_profile_cifs.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_wanopt_profile_cifs
15 short_description: Enable/disable CIFS
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:
29 description: The parameter (profile) in requested url.
30 type: str
31 required: true
32 wanopt_profile_cifs:
33 description: The top level parameters set.
34 required: false
35 type: dict
36 suboptions:
37 byte_caching:
38 aliases: ['byte-caching']
39 type: str
40 description: Enable/disable byte-caching for HTTP.
41 choices: ['disable', 'enable']
42 log_traffic:
43 aliases: ['log-traffic']
44 type: str
45 description: Enable/disable logging.
46 choices: ['disable', 'enable']
47 port:
48 type: raw
49 description: (list) Single port number or port number range for CIFS.
50 prefer_chunking:
51 aliases: ['prefer-chunking']
52 type: str
53 description: Select dynamic or fixed-size data chunking for HTTP WAN Optimization.
54 choices: ['dynamic', 'fix']
55 secure_tunnel:
56 aliases: ['secure-tunnel']
57 type: str
58 description: Enable/disable securing the WAN Opt tunnel using SSL.
59 choices: ['disable', 'enable']
60 status:
61 type: str
62 description: Enable/disable HTTP WAN Optimization.
63 choices: ['disable', 'enable']
64 tunnel_sharing:
65 aliases: ['tunnel-sharing']
66 type: str
67 description: Tunnel sharing mode for aggressive/non-aggressive and/or interactive/non-interactive protocols.
68 choices: ['private', 'shared', 'express-shared']
69 protocol_opt:
70 aliases: ['protocol-opt']
71 type: str
72 description: Select Protocol specific optimitation or generic TCP optimization.
73 choices: ['protocol', 'tcp']
74 '''
75
76 EXAMPLES = '''
77 - name: Example playbook (generated based on argument schema)
78 hosts: fortimanagers
79 connection: httpapi
80 gather_facts: false
81 tasks:
82 - name: Enable/disable CIFS
83 fortinet.fortimanager.fmgr_wanopt_profile_cifs:
84 # workspace_locking_adom: <global or your adom name>
85 adom: <your own value>
86 profile: <your own value>
87 wanopt_profile_cifs:
88 # byte_caching: <value in [disable, enable]>
89 # log_traffic: <value in [disable, enable]>
90 # port: <list or integer>
91 # prefer_chunking: <value in [dynamic, fix]>
92 # secure_tunnel: <value in [disable, enable]>
93 # status: <value in [disable, enable]>
94 # tunnel_sharing: <value in [private, shared, express-shared]>
95 # protocol_opt: <value in [protocol, tcp]>
96 '''
97
98 RETURN = '''
99 meta:
100 description: The result of the request.
101 type: dict
102 returned: always
103 contains:
104 request_url:
105 description: The full url requested.
106 returned: always
107 type: str
108 sample: /sys/login/user
109 response_code:
110 description: The status of api request.
111 returned: always
112 type: int
113 sample: 0
114 response_data:
115 description: The api response.
116 type: list
117 returned: always
118 response_message:
119 description: The descriptive message of the api response.
120 type: str
121 returned: always
122 sample: OK.
123 system_information:
124 description: The information of the target system.
125 type: dict
126 returned: always
127 rc:
128 description: The status the request.
129 type: int
130 returned: always
131 sample: 0
132 version_check_warning:
133 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
134 type: list
135 returned: complex
136 '''
137 from ansible.module_utils.basic import AnsibleModule
138 from ansible.module_utils.connection import Connection
139 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
140 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
141
142
143 def main():
144 urls_list = [
145 '/pm/config/adom/{adom}/obj/wanopt/profile/{profile}/cifs',
146 '/pm/config/global/obj/wanopt/profile/{profile}/cifs'
147 ]
148 module_arg_spec = {
149 'adom': {'required': True, 'type': 'str'},
150 'profile': {'required': True, 'type': 'str'},
151 'revision_note': {'type': 'str'},
152 'wanopt_profile_cifs': {
153 'type': 'dict', 'v_range': [['6.0.0', '']],
154 'options': {
155 'byte-caching': {'choices': ['disable', 'enable'], 'type': 'str'},
156 'log-traffic': {'choices': ['disable', 'enable'], 'type': 'str'},
157 'port': {'v_range': [['6.0.0', '7.6.2']], 'type': 'raw'},
158 'prefer-chunking': {'choices': ['dynamic', 'fix'], 'type': 'str'},
159 'secure-tunnel': {'choices': ['disable', 'enable'], 'type': 'str'},
160 'status': {'choices': ['disable', 'enable'], 'type': 'str'},
161 'tunnel-sharing': {'choices': ['private', 'shared', 'express-shared'], 'type': 'str'},
162 'protocol-opt': {'v_range': [['6.4.0', '']], 'choices': ['protocol', 'tcp'], 'type': 'str'}
163 }
164 }
165 }
166
167 module_option_spec = get_module_arg_spec('partial crud')
168 module_arg_spec.update(module_option_spec)
169 check_galaxy_version(module_arg_spec)
170 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'wanopt_profile_cifs'),
171 supports_check_mode=True)
172 if not module._socket_path:
173 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
174 connection = Connection(module._socket_path)
175 fmgr = NAPIManager('partial crud', module_arg_spec, urls_list,
176 None, 'data', module, connection)
177 fmgr.process_partial_crud()
178 module.exit_json(meta=module.params)
179
180
181 if __name__ == '__main__':
182 main()