Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_switchcontroller_managedswitch_snmpsysinfo.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_snmpsysinfo
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_snmpsysinfo:
35 description: The top level parameters set.
36 required: false
37 type: dict
38 suboptions:
39 contact_info:
40 aliases: ['contact-info']
41 type: str
42 description: Contact information.
43 description:
44 type: str
45 description: System description.
46 engine_id:
47 aliases: ['engine-id']
48 type: str
49 description: Local SNMP engine ID string
50 location:
51 type: str
52 description: System location.
53 status:
54 type: str
55 description: Enable/disable SNMP.
56 choices: ['disable', 'enable']
57 '''
58
59 EXAMPLES = '''
60 - name: Example playbook (generated based on argument schema)
61 hosts: fortimanagers
62 connection: httpapi
63 gather_facts: false
64 tasks:
65 - name: Configuration method to edit Simple Network Management Protocol
66 fortinet.fortimanager.fmgr_switchcontroller_managedswitch_snmpsysinfo:
67 # workspace_locking_adom: <global or your adom name>
68 adom: <your own value>
69 managed_switch: <your own value>
70 switchcontroller_managedswitch_snmpsysinfo:
71 # contact_info: <string>
72 # description: <string>
73 # engine_id: <string>
74 # location: <string>
75 # status: <value in [disable, enable]>
76 '''
77
78 RETURN = '''
79 meta:
80 description: The result of the request.
81 type: dict
82 returned: always
83 contains:
84 request_url:
85 description: The full url requested.
86 returned: always
87 type: str
88 sample: /sys/login/user
89 response_code:
90 description: The status of api request.
91 returned: always
92 type: int
93 sample: 0
94 response_data:
95 description: The api response.
96 type: list
97 returned: always
98 response_message:
99 description: The descriptive message of the api response.
100 type: str
101 returned: always
102 sample: OK.
103 system_information:
104 description: The information of the target system.
105 type: dict
106 returned: always
107 rc:
108 description: The status the request.
109 type: int
110 returned: always
111 sample: 0
112 version_check_warning:
113 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
114 type: list
115 returned: complex
116 '''
117 from ansible.module_utils.basic import AnsibleModule
118 from ansible.module_utils.connection import Connection
119 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
120 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
121
122
123 def main():
124 urls_list = [
125 '/pm/config/adom/{adom}/obj/switch-controller/managed-switch/{managed-switch}/snmp-sysinfo',
126 '/pm/config/global/obj/switch-controller/managed-switch/{managed-switch}/snmp-sysinfo'
127 ]
128 module_arg_spec = {
129 'adom': {'required': True, 'type': 'str'},
130 'managed-switch': {'type': 'str', 'api_name': 'managed_switch'},
131 'managed_switch': {'type': 'str'},
132 'revision_note': {'type': 'str'},
133 'switchcontroller_managedswitch_snmpsysinfo': {
134 'type': 'dict', 'v_range': [['6.2.1', '6.2.3']],
135 'options': {
136 'contact-info': {'v_range': [['6.2.1', '6.2.3']], 'type': 'str'},
137 'description': {'v_range': [['6.2.1', '6.2.3']], 'type': 'str'},
138 'engine-id': {'v_range': [['6.2.1', '6.2.3']], 'type': 'str'},
139 'location': {'v_range': [['6.2.1', '6.2.3']], 'type': 'str'},
140 'status': {'v_range': [['6.2.1', '6.2.3']], 'choices': ['disable', 'enable'], 'type': 'str'}
141 }
142 }
143 }
144
145 module_option_spec = get_module_arg_spec('partial crud')
146 module_arg_spec.update(module_option_spec)
147 check_galaxy_version(module_arg_spec)
148 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'switchcontroller_managedswitch_snmpsysinfo'),
149 supports_check_mode=True)
150 if not module._socket_path:
151 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
152 connection = Connection(module._socket_path)
153 fmgr = NAPIManager('partial crud', module_arg_spec, urls_list,
154 None, 'data', module, connection)
155 fmgr.process_partial_crud()
156 module.exit_json(meta=module.params)
157
158
159 if __name__ == '__main__':
160 main()