Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_system_guiact.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_guiact
15 short_description: System settings through GUI.
16 version_added: "2.0.0"
17 extends_documentation_fragment:
18 - fortinet.fortimanager.general
19 - fortinet.fortimanager.general.partial_crud
20 options:
21 system_guiact:
22 description: The top level parameters set.
23 required: false
24 type: dict
25 suboptions:
26 backup_all:
27 type: str
28 description: Backup all settings.
29 backup_conf:
30 type: str
31 description: Backup config file.
32 eventlog_msg:
33 type: str
34 description: Write event log.
35 eventlog_path:
36 type: str
37 description: Event log path.
38 reboot:
39 type: int
40 description: Reboot system.
41 reset2default:
42 type: int
43 description: Reset to factory default.
44 restore_all:
45 type: str
46 description: Restore all settings.
47 restore_conf:
48 type: str
49 description: Restore config file.
50 time:
51 type: str
52 description: Time.
53 '''
54
55 EXAMPLES = '''
56 - name: Example playbook (generated based on argument schema)
57 hosts: fortimanagers
58 connection: httpapi
59 gather_facts: false
60 tasks:
61 - name: System settings through GUI.
62 fortinet.fortimanager.fmgr_system_guiact:
63 # workspace_locking_adom: <global or your adom name>
64 system_guiact:
65 # backup_all: <string>
66 # backup_conf: <string>
67 # eventlog_msg: <string>
68 # eventlog_path: <string>
69 # reboot: <integer>
70 # reset2default: <integer>
71 # restore_all: <string>
72 # restore_conf: <string>
73 # time: <string>
74 '''
75
76 RETURN = '''
77 meta:
78 description: The result of the request.
79 type: dict
80 returned: always
81 contains:
82 request_url:
83 description: The full url requested.
84 returned: always
85 type: str
86 sample: /sys/login/user
87 response_code:
88 description: The status of api request.
89 returned: always
90 type: int
91 sample: 0
92 response_data:
93 description: The api response.
94 type: list
95 returned: always
96 response_message:
97 description: The descriptive message of the api response.
98 type: str
99 returned: always
100 sample: OK.
101 system_information:
102 description: The information of the target system.
103 type: dict
104 returned: always
105 rc:
106 description: The status the request.
107 type: int
108 returned: always
109 sample: 0
110 version_check_warning:
111 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
112 type: list
113 returned: complex
114 '''
115 from ansible.module_utils.basic import AnsibleModule
116 from ansible.module_utils.connection import Connection
117 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
118 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
119
120
121 def main():
122 urls_list = [
123 '/cli/global/system/guiact'
124 ]
125 module_arg_spec = {
126 'system_guiact': {
127 'type': 'dict', 'v_range': [['6.0.0', '7.0.11'], ['7.2.0', '7.2.4'], ['7.4.0', '7.4.0']],
128 'options': {
129 'backup_all': {'v_range': [['6.0.0', '7.0.11'], ['7.2.0', '7.2.4'], ['7.4.0', '7.4.0']], 'type': 'str'},
130 'backup_conf': {'v_range': [['6.0.0', '7.0.11'], ['7.2.0', '7.2.4'], ['7.4.0', '7.4.0']], 'type': 'str'},
131 'eventlog_msg': {'v_range': [['6.0.0', '7.0.11'], ['7.2.0', '7.2.4'], ['7.4.0', '7.4.0']], 'type': 'str'},
132 'eventlog_path': {'v_range': [['6.0.0', '7.0.11'], ['7.2.0', '7.2.4'], ['7.4.0', '7.4.0']], 'type': 'str'},
133 'reboot': {'v_range': [['6.0.0', '7.0.11'], ['7.2.0', '7.2.4'], ['7.4.0', '7.4.0']], 'type': 'int'},
134 'reset2default': {'v_range': [['6.0.0', '7.0.11'], ['7.2.0', '7.2.4'], ['7.4.0', '7.4.0']], 'type': 'int'},
135 'restore_all': {'v_range': [['6.0.0', '7.0.11'], ['7.2.0', '7.2.4'], ['7.4.0', '7.4.0']], 'type': 'str'},
136 'restore_conf': {'v_range': [['6.0.0', '7.0.11'], ['7.2.0', '7.2.4'], ['7.4.0', '7.4.0']], 'type': 'str'},
137 'time': {'v_range': [['6.0.0', '7.0.11'], ['7.2.0', '7.2.4'], ['7.4.0', '7.4.0']], 'type': 'str'}
138 }
139 }
140 }
141
142 module_option_spec = get_module_arg_spec('partial crud')
143 module_arg_spec.update(module_option_spec)
144 check_galaxy_version(module_arg_spec)
145 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'system_guiact'),
146 supports_check_mode=True)
147 if not module._socket_path:
148 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
149 connection = Connection(module._socket_path)
150 fmgr = NAPIManager('partial crud', module_arg_spec, urls_list,
151 None, 'data', module, connection)
152 fmgr.process_partial_crud()
153 module.exit_json(meta=module.params)
154
155
156 if __name__ == '__main__':
157 main()