Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_switchcontroller_managedswitch_snmptrapthreshold.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_switchcontroller_managedswitch_snmptrapthreshold
15 short_description: Configuration method to edit Simple Network Management Protocol
16 version_added: "2.1.0"
17 extends_documentation_fragment:
18 - fortinet.fortimanager.general
19 - fortinet.fortimanager.general.partial_crud
20 options:
21 revision_note:
22 description: The change note that can be specified when an object is created or updated.
23 type: str
24 adom:
25 description: The parameter (adom) in requested url.
26 type: str
27 required: true
28 managed-switch:
29 description: Deprecated, please use "managed_switch"
30 type: str
31 managed_switch:
32 description: The parameter (managed-switch) in requested url.
33 type: str
34 switchcontroller_managedswitch_snmptrapthreshold:
35 description: The top level parameters set.
36 required: false
37 type: dict
38 suboptions:
39 trap_high_cpu_threshold:
40 aliases: ['trap-high-cpu-threshold']
41 type: int
42 description: CPU usage when trap is sent.
43 trap_log_full_threshold:
44 aliases: ['trap-log-full-threshold']
45 type: int
46 description: Log disk usage when trap is sent.
47 trap_low_memory_threshold:
48 aliases: ['trap-low-memory-threshold']
49 type: int
50 description: Memory usage when trap is sent.
51 '''
52
53 EXAMPLES = '''
54 - name: Example playbook (generated based on argument schema)
55 hosts: fortimanagers
56 connection: httpapi
57 gather_facts: false
58 tasks:
59 - name: Configuration method to edit Simple Network Management Protocol
60 fortinet.fortimanager.fmgr_switchcontroller_managedswitch_snmptrapthreshold:
61 # workspace_locking_adom: <global or your adom name>
62 adom: <your own value>
63 managed_switch: <your own value>
64 switchcontroller_managedswitch_snmptrapthreshold:
65 # trap_high_cpu_threshold: <integer>
66 # trap_log_full_threshold: <integer>
67 # trap_low_memory_threshold: <integer>
68 '''
69
70 RETURN = '''
71 meta:
72 description: The result of the request.
73 type: dict
74 returned: always
75 contains:
76 request_url:
77 description: The full url requested.
78 returned: always
79 type: str
80 sample: /sys/login/user
81 response_code:
82 description: The status of api request.
83 returned: always
84 type: int
85 sample: 0
86 response_data:
87 description: The api response.
88 type: list
89 returned: always
90 response_message:
91 description: The descriptive message of the api response.
92 type: str
93 returned: always
94 sample: OK.
95 system_information:
96 description: The information of the target system.
97 type: dict
98 returned: always
99 rc:
100 description: The status the request.
101 type: int
102 returned: always
103 sample: 0
104 version_check_warning:
105 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
106 type: list
107 returned: complex
108 '''
109 from ansible.module_utils.basic import AnsibleModule
110 from ansible.module_utils.connection import Connection
111 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
112 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
113
114
115 def main():
116 urls_list = [
117 '/pm/config/adom/{adom}/obj/switch-controller/managed-switch/{managed-switch}/snmp-trap-threshold',
118 '/pm/config/global/obj/switch-controller/managed-switch/{managed-switch}/snmp-trap-threshold'
119 ]
120 module_arg_spec = {
121 'adom': {'required': True, 'type': 'str'},
122 'managed-switch': {'type': 'str', 'api_name': 'managed_switch'},
123 'managed_switch': {'type': 'str'},
124 'revision_note': {'type': 'str'},
125 'switchcontroller_managedswitch_snmptrapthreshold': {
126 'type': 'dict', 'v_range': [['6.2.1', '6.2.3']],
127 'options': {
128 'trap-high-cpu-threshold': {'v_range': [['6.2.1', '6.2.3']], 'type': 'int'},
129 'trap-log-full-threshold': {'v_range': [['6.2.1', '6.2.3']], 'type': 'int'},
130 'trap-low-memory-threshold': {'v_range': [['6.2.1', '6.2.3']], 'type': 'int'}
131 }
132 }
133 }
134
135 module_option_spec = get_module_arg_spec('partial crud')
136 module_arg_spec.update(module_option_spec)
137 check_galaxy_version(module_arg_spec)
138 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'switchcontroller_managedswitch_snmptrapthreshold'),
139 supports_check_mode=True)
140 if not module._socket_path:
141 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
142 connection = Connection(module._socket_path)
143 fmgr = NAPIManager('partial crud', module_arg_spec, urls_list,
144 None, 'data', module, connection)
145 fmgr.process_partial_crud()
146 module.exit_json(meta=module.params)
147
148
149 if __name__ == '__main__':
150 main()