Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_vpnsslweb_realm.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_vpnsslweb_realm
15 short_description: Realm.
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 vpnsslweb_realm:
29 description: The top level parameters set.
30 required: false
31 type: dict
32 suboptions:
33 login_page:
34 aliases: ['login-page']
35 type: str
36 description: Replacement HTML for SSL-VPN login page.
37 max_concurrent_user:
38 aliases: ['max-concurrent-user']
39 type: int
40 description: Maximum concurrent users
41 url_path:
42 aliases: ['url-path']
43 type: str
44 description: URL path to access SSL-VPN login page.
45 virtual_host:
46 aliases: ['virtual-host']
47 type: str
48 description: Virtual host name for realm.
49 nas_ip:
50 aliases: ['nas-ip']
51 type: str
52 description: IP address used as a NAS-IP to communicate with the RADIUS server.
53 radius_server:
54 aliases: ['radius-server']
55 type: str
56 description: RADIUS server associated with realm.
57 radius_port:
58 aliases: ['radius-port']
59 type: int
60 description: RADIUS service port number
61 virtual_host_only:
62 aliases: ['virtual-host-only']
63 type: str
64 description: Enable/disable enforcement of virtual host method for SSL-VPN client access.
65 choices: ['disable', 'enable']
66 virtual_host_server_cert:
67 aliases: ['virtual-host-server-cert']
68 type: str
69 description: Name of the server certificate to used for this realm.
70 '''
71
72 EXAMPLES = '''
73 - name: Example playbook (generated based on argument schema)
74 hosts: fortimanagers
75 connection: httpapi
76 gather_facts: false
77 tasks:
78 - name: Realm.
79 fortinet.fortimanager.fmgr_vpnsslweb_realm:
80 # workspace_locking_adom: <global or your adom name>
81 adom: <your own value>
82 state: present # <value in [present, absent]>
83 vpnsslweb_realm:
84 # login_page: <string>
85 # max_concurrent_user: <integer>
86 # url_path: <string>
87 # virtual_host: <string>
88 # nas_ip: <string>
89 # radius_server: <string>
90 # radius_port: <integer>
91 # virtual_host_only: <value in [disable, enable]>
92 # virtual_host_server_cert: <string>
93 '''
94
95 RETURN = '''
96 meta:
97 description: The result of the request.
98 type: dict
99 returned: always
100 contains:
101 request_url:
102 description: The full url requested.
103 returned: always
104 type: str
105 sample: /sys/login/user
106 response_code:
107 description: The status of api request.
108 returned: always
109 type: int
110 sample: 0
111 response_data:
112 description: The api response.
113 type: list
114 returned: always
115 response_message:
116 description: The descriptive message of the api response.
117 type: str
118 returned: always
119 sample: OK.
120 system_information:
121 description: The information of the target system.
122 type: dict
123 returned: always
124 rc:
125 description: The status the request.
126 type: int
127 returned: always
128 sample: 0
129 version_check_warning:
130 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
131 type: list
132 returned: complex
133 '''
134 from ansible.module_utils.basic import AnsibleModule
135 from ansible.module_utils.connection import Connection
136 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
137 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
138
139
140 def main():
141 urls_list = [
142 '/pm/config/adom/{adom}/obj/vpn/ssl/web/realm',
143 '/pm/config/global/obj/vpn/ssl/web/realm'
144 ]
145 module_arg_spec = {
146 'adom': {'required': True, 'type': 'str'},
147 'revision_note': {'type': 'str'},
148 'vpnsslweb_realm': {
149 'type': 'dict', 'v_range': [['6.0.0', '']],
150 'options': {
151 'login-page': {'type': 'str'},
152 'max-concurrent-user': {'type': 'int'},
153 'url-path': {'type': 'str'},
154 'virtual-host': {'type': 'str'},
155 'nas-ip': {'v_range': [['6.4.0', '']], 'type': 'str'},
156 'radius-server': {'v_range': [['6.4.0', '']], 'type': 'str'},
157 'radius-port': {'v_range': [['6.4.2', '']], 'type': 'int'},
158 'virtual-host-only': {'v_range': [['6.4.1', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
159 'virtual-host-server-cert': {'v_range': [['7.0.2', '']], 'type': 'str'}
160 }
161 }
162 }
163
164 module_option_spec = get_module_arg_spec('full crud')
165 module_arg_spec.update(module_option_spec)
166 check_galaxy_version(module_arg_spec)
167 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'vpnsslweb_realm'),
168 supports_check_mode=True)
169 if not module._socket_path:
170 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
171 connection = Connection(module._socket_path)
172 fmgr = NAPIManager('full crud', module_arg_spec, urls_list,
173 None, 'data', module, connection)
174 fmgr.process_crud()
175 module.exit_json(meta=module.params)
176
177
178 if __name__ == '__main__':
179 main()