Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_wireless_syslogprofile.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_wireless_syslogprofile
15 short_description: Configure Wireless Termination Points
16 version_added: "2.2.0"
17 extends_documentation_fragment:
18 - fortinet.fortimanager.general
19 - fortinet.fortimanager.general.full_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 wireless_syslogprofile:
29 description: The top level parameters set.
30 required: false
31 type: dict
32 suboptions:
33 comment:
34 type: str
35 description: Comment.
36 log_level:
37 aliases: ['log-level']
38 type: str
39 description: Lowest level of log messages that FortiAP units send to this server
40 choices: ['emergency', 'alert', 'critical', 'error', 'warning', 'notification',
41 'information', 'debugging']
42 name:
43 type: str
44 description: WTP system log server profile name.
45 required: true
46 server_addr_type:
47 aliases: ['server-addr-type']
48 type: str
49 description: Syslog server address type
50 choices: ['fqdn', 'ip']
51 server_fqdn:
52 aliases: ['server-fqdn']
53 type: str
54 description: FQDN of syslog server that FortiAP units send log messages to.
55 server_ip:
56 aliases: ['server-ip']
57 type: str
58 description: IP address of syslog server that FortiAP units send log messages to.
59 server_port:
60 aliases: ['server-port']
61 type: int
62 description: Port number of syslog server that FortiAP units send log messages to
63 server_status:
64 aliases: ['server-status']
65 type: str
66 description: Enable/disable FortiAP units to send log messages to a syslog server
67 choices: ['disable', 'enable']
68 server_type:
69 aliases: ['server-type']
70 type: str
71 description: Configure syslog server type
72 choices: ['standard', 'fortianalyzer']
73 server:
74 type: str
75 description: Syslog server CN domain name or IP address.
76 '''
77
78 EXAMPLES = '''
79 - name: Example playbook (generated based on argument schema)
80 hosts: fortimanagers
81 connection: httpapi
82 gather_facts: false
83 tasks:
84 - name: Configure Wireless Termination Points
85 fortinet.fortimanager.fmgr_wireless_syslogprofile:
86 # workspace_locking_adom: <global or your adom name>
87 adom: <your own value>
88 state: present # <value in [present, absent]>
89 wireless_syslogprofile:
90 name: "your value" # Required variable, string
91 # comment: <string>
92 # log_level: <value in [emergency, alert, critical, ...]>
93 # server_addr_type: <value in [fqdn, ip]>
94 # server_fqdn: <string>
95 # server_ip: <string>
96 # server_port: <integer>
97 # server_status: <value in [disable, enable]>
98 # server_type: <value in [standard, fortianalyzer]>
99 # server: <string>
100 '''
101
102 RETURN = '''
103 meta:
104 description: The result of the request.
105 type: dict
106 returned: always
107 contains:
108 request_url:
109 description: The full url requested.
110 returned: always
111 type: str
112 sample: /sys/login/user
113 response_code:
114 description: The status of api request.
115 returned: always
116 type: int
117 sample: 0
118 response_data:
119 description: The api response.
120 type: list
121 returned: always
122 response_message:
123 description: The descriptive message of the api response.
124 type: str
125 returned: always
126 sample: OK.
127 system_information:
128 description: The information of the target system.
129 type: dict
130 returned: always
131 rc:
132 description: The status the request.
133 type: int
134 returned: always
135 sample: 0
136 version_check_warning:
137 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
138 type: list
139 returned: complex
140 '''
141 from ansible.module_utils.basic import AnsibleModule
142 from ansible.module_utils.connection import Connection
143 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
144 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
145
146
147 def main():
148 urls_list = [
149 '/pm/config/adom/{adom}/obj/wireless-controller/syslog-profile',
150 '/pm/config/global/obj/wireless-controller/syslog-profile'
151 ]
152 module_arg_spec = {
153 'adom': {'required': True, 'type': 'str'},
154 'revision_note': {'type': 'str'},
155 'wireless_syslogprofile': {
156 'type': 'dict', 'v_range': [['7.2.1', '']],
157 'options': {
158 'comment': {'v_range': [['7.2.1', '']], 'type': 'str'},
159 'log-level': {
160 'v_range': [['7.2.1', '']],
161 'choices': ['emergency', 'alert', 'critical', 'error', 'warning', 'notification', 'information', 'debugging'],
162 'type': 'str'
163 },
164 'name': {'v_range': [['7.2.1', '']], 'required': True, 'type': 'str'},
165 'server-addr-type': {'v_range': [['7.2.1', '']], 'choices': ['fqdn', 'ip'], 'type': 'str'},
166 'server-fqdn': {'v_range': [['7.2.1', '']], 'type': 'str'},
167 'server-ip': {'v_range': [['7.2.1', '']], 'type': 'str'},
168 'server-port': {'v_range': [['7.2.1', '']], 'type': 'int'},
169 'server-status': {'v_range': [['7.2.1', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
170 'server-type': {'v_range': [['7.6.2', '']], 'choices': ['standard', 'fortianalyzer'], 'type': 'str'},
171 'server': {'v_range': [['7.6.5', '']], 'type': 'str'}
172 }
173 }
174 }
175
176 module_option_spec = get_module_arg_spec('full crud')
177 module_arg_spec.update(module_option_spec)
178 check_galaxy_version(module_arg_spec)
179 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'wireless_syslogprofile'),
180 supports_check_mode=True)
181 if not module._socket_path:
182 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
183 connection = Connection(module._socket_path)
184 fmgr = NAPIManager('full crud', module_arg_spec, urls_list,
185 'name', 'data', module, connection)
186 fmgr.process_crud()
187 module.exit_json(meta=module.params)
188
189
190 if __name__ == '__main__':
191 main()