Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_hotspot20_h2qpconncapability.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_hotspot20_h2qpconncapability
15 short_description: Configure connection capability.
16 version_added: "2.0.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 hotspot20_h2qpconncapability:
29 description: The top level parameters set.
30 required: false
31 type: dict
32 suboptions:
33 esp_port:
34 aliases: ['esp-port']
35 type: str
36 description: Set ESP port service
37 choices: ['closed', 'open', 'unknown']
38 ftp_port:
39 aliases: ['ftp-port']
40 type: str
41 description: Set FTP port service status.
42 choices: ['closed', 'open', 'unknown']
43 http_port:
44 aliases: ['http-port']
45 type: str
46 description: Set HTTP port service status.
47 choices: ['closed', 'open', 'unknown']
48 icmp_port:
49 aliases: ['icmp-port']
50 type: str
51 description: Set ICMP port service status.
52 choices: ['closed', 'open', 'unknown']
53 ikev2_port:
54 aliases: ['ikev2-port']
55 type: str
56 description: Set IKEv2 port service for IPsec VPN status.
57 choices: ['closed', 'open', 'unknown']
58 ikev2_xx_port:
59 aliases: ['ikev2-xx-port']
60 type: str
61 description: Set UDP port 4500
62 choices: ['closed', 'open', 'unknown']
63 name:
64 type: str
65 description: Connection capability name.
66 required: true
67 pptp_vpn_port:
68 aliases: ['pptp-vpn-port']
69 type: str
70 description: Set Point to Point Tunneling Protocol
71 choices: ['closed', 'open', 'unknown']
72 ssh_port:
73 aliases: ['ssh-port']
74 type: str
75 description: Set SSH port service status.
76 choices: ['closed', 'open', 'unknown']
77 tls_port:
78 aliases: ['tls-port']
79 type: str
80 description: Set TLS VPN
81 choices: ['closed', 'open', 'unknown']
82 voip_tcp_port:
83 aliases: ['voip-tcp-port']
84 type: str
85 description: Set VoIP TCP port service status.
86 choices: ['closed', 'open', 'unknown']
87 voip_udp_port:
88 aliases: ['voip-udp-port']
89 type: str
90 description: Set VoIP UDP port service status.
91 choices: ['closed', 'open', 'unknown']
92 '''
93
94 EXAMPLES = '''
95 - name: Example playbook (generated based on argument schema)
96 hosts: fortimanagers
97 connection: httpapi
98 gather_facts: false
99 tasks:
100 - name: Configure connection capability.
101 fortinet.fortimanager.fmgr_hotspot20_h2qpconncapability:
102 # workspace_locking_adom: <global or your adom name>
103 adom: <your own value>
104 state: present # <value in [present, absent]>
105 hotspot20_h2qpconncapability:
106 name: "your value" # Required variable, string
107 # esp_port: <value in [closed, open, unknown]>
108 # ftp_port: <value in [closed, open, unknown]>
109 # http_port: <value in [closed, open, unknown]>
110 # icmp_port: <value in [closed, open, unknown]>
111 # ikev2_port: <value in [closed, open, unknown]>
112 # ikev2_xx_port: <value in [closed, open, unknown]>
113 # pptp_vpn_port: <value in [closed, open, unknown]>
114 # ssh_port: <value in [closed, open, unknown]>
115 # tls_port: <value in [closed, open, unknown]>
116 # voip_tcp_port: <value in [closed, open, unknown]>
117 # voip_udp_port: <value in [closed, open, unknown]>
118 '''
119
120 RETURN = '''
121 meta:
122 description: The result of the request.
123 type: dict
124 returned: always
125 contains:
126 request_url:
127 description: The full url requested.
128 returned: always
129 type: str
130 sample: /sys/login/user
131 response_code:
132 description: The status of api request.
133 returned: always
134 type: int
135 sample: 0
136 response_data:
137 description: The api response.
138 type: list
139 returned: always
140 response_message:
141 description: The descriptive message of the api response.
142 type: str
143 returned: always
144 sample: OK.
145 system_information:
146 description: The information of the target system.
147 type: dict
148 returned: always
149 rc:
150 description: The status the request.
151 type: int
152 returned: always
153 sample: 0
154 version_check_warning:
155 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
156 type: list
157 returned: complex
158 '''
159 from ansible.module_utils.basic import AnsibleModule
160 from ansible.module_utils.connection import Connection
161 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
162 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
163
164
165 def main():
166 urls_list = [
167 '/pm/config/adom/{adom}/obj/wireless-controller/hotspot20/h2qp-conn-capability',
168 '/pm/config/global/obj/wireless-controller/hotspot20/h2qp-conn-capability'
169 ]
170 module_arg_spec = {
171 'adom': {'required': True, 'type': 'str'},
172 'revision_note': {'type': 'str'},
173 'hotspot20_h2qpconncapability': {
174 'type': 'dict', 'v_range': [['6.0.0', '']],
175 'options': {
176 'esp-port': {'choices': ['closed', 'open', 'unknown'], 'type': 'str'},
177 'ftp-port': {'choices': ['closed', 'open', 'unknown'], 'type': 'str'},
178 'http-port': {'choices': ['closed', 'open', 'unknown'], 'type': 'str'},
179 'icmp-port': {'choices': ['closed', 'open', 'unknown'], 'type': 'str'},
180 'ikev2-port': {'choices': ['closed', 'open', 'unknown'], 'type': 'str'},
181 'ikev2-xx-port': {'choices': ['closed', 'open', 'unknown'], 'type': 'str'},
182 'name': {'required': True, 'type': 'str'},
183 'pptp-vpn-port': {'choices': ['closed', 'open', 'unknown'], 'type': 'str'},
184 'ssh-port': {'choices': ['closed', 'open', 'unknown'], 'type': 'str'},
185 'tls-port': {'choices': ['closed', 'open', 'unknown'], 'type': 'str'},
186 'voip-tcp-port': {'choices': ['closed', 'open', 'unknown'], 'type': 'str'},
187 'voip-udp-port': {'choices': ['closed', 'open', 'unknown'], 'type': 'str'}
188 }
189 }
190 }
191
192 module_option_spec = get_module_arg_spec('full crud')
193 module_arg_spec.update(module_option_spec)
194 check_galaxy_version(module_arg_spec)
195 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'hotspot20_h2qpconncapability'),
196 supports_check_mode=True)
197 if not module._socket_path:
198 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
199 connection = Connection(module._socket_path)
200 fmgr = NAPIManager('full crud', module_arg_spec, urls_list,
201 'name', 'data', module, connection)
202 fmgr.process_crud()
203 module.exit_json(meta=module.params)
204
205
206 if __name__ == '__main__':
207 main()