Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_log_npuserver_serverinfo.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_log_npuserver_serverinfo
15 short_description: configure server info.
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 log_npuserver_serverinfo:
29 description: The top level parameters set.
30 required: false
31 type: dict
32 suboptions:
33 dest_port:
34 aliases: ['dest-port']
35 type: int
36 description: Set the dest port for the log packet
37 id:
38 type: int
39 description: Server id.
40 required: true
41 ip_family:
42 aliases: ['ip-family']
43 type: str
44 description: Set the version the IP address
45 choices: ['v4', 'v6']
46 ipv4_server:
47 aliases: ['ipv4-server']
48 type: str
49 description: Set the IPv4 address for the log server
50 ipv6_server:
51 aliases: ['ipv6-server']
52 type: str
53 description: Set the IPv6 address for the log server
54 source_port:
55 aliases: ['source-port']
56 type: int
57 description: Set the source port for the log packet
58 template_tx_timeout:
59 aliases: ['template-tx-timeout']
60 type: int
61 description: Set the template tx timeout
62 vdom:
63 type: str
64 description: Interface connected to the log server is in this virtual domain
65 log_transport:
66 aliases: ['log-transport']
67 type: str
68 description: Set transport protocol
69 choices: ['udp', 'tcp']
70 vdom_:
71 type: str
72 description: Vdom.
73 '''
74
75 EXAMPLES = '''
76 - name: Example playbook (generated based on argument schema)
77 hosts: fortimanagers
78 connection: httpapi
79 gather_facts: false
80 tasks:
81 - name: Configure server info.
82 fortinet.fortimanager.fmgr_log_npuserver_serverinfo:
83 # workspace_locking_adom: <global or your adom name>
84 adom: <your own value>
85 state: present # <value in [present, absent]>
86 log_npuserver_serverinfo:
87 id: 0 # Required variable, integer
88 # dest_port: <integer>
89 # ip_family: <value in [v4, v6]>
90 # ipv4_server: <string>
91 # ipv6_server: <string>
92 # source_port: <integer>
93 # template_tx_timeout: <integer>
94 # vdom: <string>
95 # log_transport: <value in [udp, tcp]>
96 # vdom_: <string>
97 '''
98
99 RETURN = '''
100 meta:
101 description: The result of the request.
102 type: dict
103 returned: always
104 contains:
105 request_url:
106 description: The full url requested.
107 returned: always
108 type: str
109 sample: /sys/login/user
110 response_code:
111 description: The status of api request.
112 returned: always
113 type: int
114 sample: 0
115 response_data:
116 description: The api response.
117 type: list
118 returned: always
119 response_message:
120 description: The descriptive message of the api response.
121 type: str
122 returned: always
123 sample: OK.
124 system_information:
125 description: The information of the target system.
126 type: dict
127 returned: always
128 rc:
129 description: The status the request.
130 type: int
131 returned: always
132 sample: 0
133 version_check_warning:
134 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
135 type: list
136 returned: complex
137 '''
138 from ansible.module_utils.basic import AnsibleModule
139 from ansible.module_utils.connection import Connection
140 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
141 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
142
143
144 def main():
145 urls_list = [
146 '/pm/config/adom/{adom}/obj/log/npu-server/server-info',
147 '/pm/config/global/obj/log/npu-server/server-info'
148 ]
149 module_arg_spec = {
150 'adom': {'required': True, 'type': 'str'},
151 'revision_note': {'type': 'str'},
152 'log_npuserver_serverinfo': {
153 'type': 'dict', 'v_range': [['6.4.7', '6.4.15'], ['7.0.1', '7.0.14'], ['7.2.0', '7.4.7'], ['7.6.0', '7.6.4']],
154 'options': {
155 'dest-port': {'v_range': [['6.4.7', '6.4.15'], ['7.0.1', '7.0.14'], ['7.2.0', '7.4.7'], ['7.6.0', '7.6.4']], 'type': 'int'},
156 'id': {'v_range': [['6.4.7', '6.4.15'], ['7.0.1', '7.0.14'], ['7.2.0', '7.4.7'], ['7.6.0', '7.6.4']], 'required': True, 'type': 'int'},
157 'ip-family': {
158 'v_range': [['6.4.7', '6.4.15'], ['7.0.1', '7.0.14'], ['7.2.0', '7.4.7'], ['7.6.0', '7.6.4']],
159 'choices': ['v4', 'v6'],
160 'type': 'str'
161 },
162 'ipv4-server': {'v_range': [['6.4.7', '6.4.15'], ['7.0.1', '7.0.14'], ['7.2.0', '7.4.7'], ['7.6.0', '7.6.4']], 'type': 'str'},
163 'ipv6-server': {'v_range': [['6.4.7', '6.4.15'], ['7.0.1', '7.0.14'], ['7.2.0', '7.4.7'], ['7.6.0', '7.6.4']], 'type': 'str'},
164 'source-port': {'v_range': [['6.4.7', '6.4.15'], ['7.0.1', '7.0.14'], ['7.2.0', '7.4.7'], ['7.6.0', '7.6.4']], 'type': 'int'},
165 'template-tx-timeout': {'v_range': [['6.4.7', '6.4.15'], ['7.0.1', '7.0.14'], ['7.2.0', '7.4.7'], ['7.6.0', '7.6.4']], 'type': 'int'},
166 'vdom': {
167 'v_range': [['6.4.7', '6.4.15'], ['7.0.1', '7.0.14'], ['7.2.0', '7.2.10'], ['7.4.0', '7.4.7'], ['7.6.0', '7.6.4']],
168 'type': 'str'
169 },
170 'log-transport': {'v_range': [['7.4.2', '7.4.7'], ['7.6.0', '7.6.4']], 'choices': ['udp', 'tcp'], 'type': 'str'},
171 'vdom_': {'v_range': [['7.2.11', '7.2.12'], ['7.6.4', '7.6.4']], '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, 'log_npuserver_serverinfo'),
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 'id', 'data', module, connection)
186 fmgr.process_crud()
187 module.exit_json(meta=module.params)
188
189
190 if __name__ == '__main__':
191 main()