Debian Codegraph @

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