Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_sys_logout.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_sys_logout
15 short_description: Log out a session.
16 version_added: "2.0.0"
17 extends_documentation_fragment:
18 - fortinet.fortimanager.general
19 '''
20
21 EXAMPLES = '''
22 - name: Example playbook (generated based on argument schema)
23 hosts: fortimanagers
24 connection: httpapi
25 gather_facts: false
26 tasks:
27 - name: Log out a session.
28 fortinet.fortimanager.fmgr_sys_logout:
29 # workspace_locking_adom: <global or your adom name>
30 '''
31
32 RETURN = '''
33 meta:
34 description: The result of the request.
35 type: dict
36 returned: always
37 contains:
38 request_url:
39 description: The full url requested.
40 returned: always
41 type: str
42 sample: /sys/login/user
43 response_code:
44 description: The status of api request.
45 returned: always
46 type: int
47 sample: 0
48 response_data:
49 description: The api response.
50 type: list
51 returned: always
52 response_message:
53 description: The descriptive message of the api response.
54 type: str
55 returned: always
56 sample: OK.
57 system_information:
58 description: The information of the target system.
59 type: dict
60 returned: always
61 rc:
62 description: The status the request.
63 type: int
64 returned: always
65 sample: 0
66 version_check_warning:
67 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
68 type: list
69 returned: complex
70 '''
71 from ansible.module_utils.basic import AnsibleModule
72 from ansible.module_utils.connection import Connection
73 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
74 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
75
76
77 def main():
78 urls_list = [
79 '/sys/logout'
80 ]
81 module_arg_spec = {
82 }
83
84 module_option_spec = get_module_arg_spec('exec')
85 module_arg_spec.update(module_option_spec)
86 check_galaxy_version(module_arg_spec)
87 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'sys_logout'),
88 supports_check_mode=True)
89 if not module._socket_path:
90 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
91 connection = Connection(module._socket_path)
92 fmgr = NAPIManager('exec', module_arg_spec, urls_list,
93 None, None, module, connection)
94 fmgr.process_exec()
95 module.exit_json(meta=module.params)
96
97
98 if __name__ == '__main__':
99 main()