Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_system_log_topology.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_log_topology
15 short_description: Logging topology settings.
16 version_added: "2.1.0"
17 extends_documentation_fragment:
18 - fortinet.fortimanager.general
19 - fortinet.fortimanager.general.partial_crud
20 options:
21 system_log_topology:
22 description: The top level parameters set.
23 required: false
24 type: dict
25 suboptions:
26 max_depth:
27 aliases: ['max-depth']
28 type: int
29 description: Maximum descend levels below this device.
30 max_depth_share:
31 aliases: ['max-depth-share']
32 type: int
33 description: Maximum descend levels below this device to share with upstream.
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: Logging topology settings.
43 fortinet.fortimanager.fmgr_system_log_topology:
44 # workspace_locking_adom: <global or your adom name>
45 system_log_topology:
46 # max_depth: <integer>
47 # max_depth_share: <integer>
48 '''
49
50 RETURN = '''
51 meta:
52 description: The result of the request.
53 type: dict
54 returned: always
55 contains:
56 request_url:
57 description: The full url requested.
58 returned: always
59 type: str
60 sample: /sys/login/user
61 response_code:
62 description: The status of api request.
63 returned: always
64 type: int
65 sample: 0
66 response_data:
67 description: The api response.
68 type: list
69 returned: always
70 response_message:
71 description: The descriptive message of the api response.
72 type: str
73 returned: always
74 sample: OK.
75 system_information:
76 description: The information of the target system.
77 type: dict
78 returned: always
79 rc:
80 description: The status the request.
81 type: int
82 returned: always
83 sample: 0
84 version_check_warning:
85 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
86 type: list
87 returned: complex
88 '''
89 from ansible.module_utils.basic import AnsibleModule
90 from ansible.module_utils.connection import Connection
91 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
92 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
93
94
95 def main():
96 urls_list = [
97 '/cli/global/system/log/topology'
98 ]
99 module_arg_spec = {
100 'system_log_topology': {
101 'type': 'dict', 'v_range': [['6.4.7', '6.4.15'], ['7.0.2', '']],
102 'options': {
103 'max-depth': {'v_range': [['6.4.7', '6.4.15'], ['7.0.2', '']], 'type': 'int'},
104 'max-depth-share': {'v_range': [['6.4.7', '6.4.15'], ['7.0.2', '']], 'type': 'int'}
105 }
106 }
107 }
108
109 module_option_spec = get_module_arg_spec('partial crud')
110 module_arg_spec.update(module_option_spec)
111 check_galaxy_version(module_arg_spec)
112 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'system_log_topology'),
113 supports_check_mode=True)
114 if not module._socket_path:
115 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
116 connection = Connection(module._socket_path)
117 fmgr = NAPIManager('partial crud', module_arg_spec, urls_list,
118 None, 'data', module, connection)
119 fmgr.process_partial_crud()
120 module.exit_json(meta=module.params)
121
122
123 if __name__ == '__main__':
124 main()