Debian Codegraph @

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