Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_system_log_fospolicystats.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_fospolicystats
15 short_description: FortiOS policy statistics 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_fospolicystats:
22 description: The top level parameters set.
23 required: false
24 type: dict
25 suboptions:
26 retention_days:
27 aliases: ['retention-days']
28 type: int
29 description: Number of days for FortiOS policy stats data storage.
30 sampling_interval:
31 aliases: ['sampling-interval']
32 type: int
33 description: Interval to request policy stats data from FortiOS in minutes.
34 status:
35 type: str
36 description:
37 - Disable/Enable FortiOS policy statistics feature.
38 - disable - Disable querying FortiOS policy stats.
39 - enable - Enable querying FortiOS policy stats.
40 choices: ['disable', 'enable']
41 '''
42
43 EXAMPLES = '''
44 - name: Example playbook (generated based on argument schema)
45 hosts: fortimanagers
46 connection: httpapi
47 gather_facts: false
48 tasks:
49 - name: FortiOS policy statistics settings.
50 fortinet.fortimanager.fmgr_system_log_fospolicystats:
51 # workspace_locking_adom: <global or your adom name>
52 system_log_fospolicystats:
53 # retention_days: <integer>
54 # sampling_interval: <integer>
55 # status: <value in [disable, enable]>
56 '''
57
58 RETURN = '''
59 meta:
60 description: The result of the request.
61 type: dict
62 returned: always
63 contains:
64 request_url:
65 description: The full url requested.
66 returned: always
67 type: str
68 sample: /sys/login/user
69 response_code:
70 description: The status of api request.
71 returned: always
72 type: int
73 sample: 0
74 response_data:
75 description: The api response.
76 type: list
77 returned: always
78 response_message:
79 description: The descriptive message of the api response.
80 type: str
81 returned: always
82 sample: OK.
83 system_information:
84 description: The information of the target system.
85 type: dict
86 returned: always
87 rc:
88 description: The status the request.
89 type: int
90 returned: always
91 sample: 0
92 version_check_warning:
93 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
94 type: list
95 returned: complex
96 '''
97 from ansible.module_utils.basic import AnsibleModule
98 from ansible.module_utils.connection import Connection
99 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
100 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
101
102
103 def main():
104 urls_list = [
105 '/cli/global/system/log/fos-policy-stats'
106 ]
107 module_arg_spec = {
108 'system_log_fospolicystats': {
109 'type': 'dict', 'v_range': [['7.0.2', '']],
110 'options': {
111 'retention-days': {'v_range': [['7.0.2', '']], 'type': 'int'},
112 'sampling-interval': {'v_range': [['7.0.2', '']], 'type': 'int'},
113 'status': {'v_range': [['7.0.2', '']], 'choices': ['disable', 'enable'], 'type': 'str'}
114 }
115 }
116 }
117
118 module_option_spec = get_module_arg_spec('partial crud')
119 module_arg_spec.update(module_option_spec)
120 check_galaxy_version(module_arg_spec)
121 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'system_log_fospolicystats'),
122 supports_check_mode=True)
123 if not module._socket_path:
124 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
125 connection = Connection(module._socket_path)
126 fmgr = NAPIManager('partial crud', module_arg_spec, urls_list,
127 None, 'data', module, connection)
128 fmgr.process_partial_crud()
129 module.exit_json(meta=module.params)
130
131
132 if __name__ == '__main__':
133 main()