Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_securityconsole_template_validate.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_securityconsole_template_validate
15 short_description: Securityconsole template validate
16 version_added: "2.13.0"
17 extends_documentation_fragment:
18 - fortinet.fortimanager.general
19 options:
20 securityconsole_template_validate:
21 description: The top level parameters set.
22 required: false
23 type: dict
24 suboptions:
25 adom:
26 type: list
27 elements: str
28 description: Source ADOM name.
29 flags:
30 type: list
31 elements: str
32 description: Flags.
33 choices: ['none', 'json', 'default_cfg']
34 pkg:
35 type: str
36 description: Source package path and name.
37 scope:
38 type: list
39 elements: dict
40 description: Scope.
41 suboptions:
42 name:
43 type: str
44 description: Name.
45 vdom:
46 type: str
47 description: Vdom.
48 '''
49
50 EXAMPLES = '''
51 - name: Example playbook (generated based on argument schema)
52 hosts: fortimanagers
53 connection: httpapi
54 gather_facts: false
55 tasks:
56 - name: Securityconsole template validate
57 fortinet.fortimanager.fmgr_securityconsole_template_validate:
58 # workspace_locking_adom: <global or your adom name>
59 securityconsole_template_validate:
60 # adom: <list or string>
61 # flags: ["none", "json", "default_cfg"]
62 # pkg: <string>
63 # scope:
64 # - name: <string>
65 # vdom: <string>
66 '''
67
68 RETURN = '''
69 meta:
70 description: The result of the request.
71 type: dict
72 returned: always
73 contains:
74 request_url:
75 description: The full url requested.
76 returned: always
77 type: str
78 sample: /sys/login/user
79 response_code:
80 description: The status of api request.
81 returned: always
82 type: int
83 sample: 0
84 response_data:
85 description: The api response.
86 type: list
87 returned: always
88 response_message:
89 description: The descriptive message of the api response.
90 type: str
91 returned: always
92 sample: OK.
93 system_information:
94 description: The information of the target system.
95 type: dict
96 returned: always
97 rc:
98 description: The status the request.
99 type: int
100 returned: always
101 sample: 0
102 version_check_warning:
103 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
104 type: list
105 returned: complex
106 '''
107 from ansible.module_utils.basic import AnsibleModule
108 from ansible.module_utils.connection import Connection
109 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
110 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
111
112
113 def main():
114 urls_list = [
115 '/securityconsole/template/validate'
116 ]
117 module_arg_spec = {
118 'securityconsole_template_validate': {
119 'type': 'dict', 'v_range': [['7.6.5', '']],
120 'options': {
121 'adom': {'v_range': [['7.6.5', '']], 'type': 'list', 'elements': 'str'},
122 'flags': {'v_range': [['7.6.5', '']], 'type': 'list', 'choices': ['none', 'json', 'default_cfg'], 'elements': 'str'},
123 'pkg': {'v_range': [['7.6.5', '']], 'type': 'str'},
124 'scope': {
125 'v_range': [['7.6.5', '']],
126 'type': 'list',
127 'options': {'name': {'v_range': [['7.6.5', '']], 'type': 'str'}, 'vdom': {'v_range': [['7.6.5', '']], 'type': 'str'}},
128 'elements': 'dict'
129 }
130 }
131 }
132 }
133
134 module_option_spec = get_module_arg_spec('exec')
135 module_arg_spec.update(module_option_spec)
136 check_galaxy_version(module_arg_spec)
137 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'securityconsole_template_validate'),
138 supports_check_mode=True)
139 if not module._socket_path:
140 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
141 connection = Connection(module._socket_path)
142 fmgr = NAPIManager('exec', module_arg_spec, urls_list,
143 None, 'data', module, connection)
144 fmgr.process_exec()
145 module.exit_json(meta=module.params)
146
147
148 if __name__ == '__main__':
149 main()