Debian Codegraph @

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