Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_ztna_serviceconnector.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_ztna_serviceconnector
15 short_description: Ztna service connector
16 version_added: "2.12.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 ztna_serviceconnector:
29 description: The top level parameters set.
30 required: false
31 type: dict
32 suboptions:
33 certificate:
34 type: list
35 elements: str
36 description: Certificate.
37 connection_mode:
38 aliases: ['connection-mode']
39 type: str
40 description: Connection mode.
41 choices: ['forward', 'reverse']
42 encryption:
43 type: str
44 description: Encryption.
45 choices: ['disable', 'enable']
46 forward_address:
47 aliases: ['forward-address']
48 type: str
49 description: Forward address.
50 forward_destination_cn:
51 aliases: ['forward-destination-cn']
52 type: str
53 description: Forward destination cn.
54 forward_port:
55 aliases: ['forward-port']
56 type: int
57 description: Forward port.
58 health_check_interval:
59 aliases: ['health-check-interval']
60 type: int
61 description: Health check interval.
62 log:
63 type: str
64 description: Log.
65 choices: ['disable', 'enable']
66 name:
67 type: str
68 description: Name.
69 required: true
70 relay_dev_info:
71 aliases: ['relay-dev-info']
72 type: str
73 description: Relay dev info.
74 choices: ['disable', 'enable']
75 relay_user_info:
76 aliases: ['relay-user-info']
77 type: str
78 description: Relay user info.
79 choices: ['disable', 'enable']
80 ssl_max_version:
81 aliases: ['ssl-max-version']
82 type: str
83 description: Ssl max version.
84 choices: ['ssl-3.0', 'tls-1.0', 'tls-1.1', 'tls-1.2', 'tls-1.3']
85 ssl_min_version:
86 aliases: ['ssl-min-version']
87 type: str
88 description: Ssl min version.
89 choices: ['ssl-3.0', 'tls-1.0', 'tls-1.1', 'tls-1.2', 'tls-1.3']
90 status:
91 type: str
92 description: Status.
93 choices: ['disable', 'enable']
94 trusted_ca:
95 aliases: ['trusted-ca']
96 type: list
97 elements: str
98 description: Trusted ca.
99 url_map:
100 aliases: ['url-map']
101 type: str
102 description: Url map.
103 '''
104
105 EXAMPLES = '''
106 - name: Example playbook (generated based on argument schema)
107 hosts: fortimanagers
108 connection: httpapi
109 gather_facts: false
110 tasks:
111 - name: Ztna service connector
112 fortinet.fortimanager.fmgr_ztna_serviceconnector:
113 # workspace_locking_adom: <global or your adom name>
114 adom: <your own value>
115 state: present # <value in [present, absent]>
116 ztna_serviceconnector:
117 name: "your value" # Required variable, string
118 # certificate: <list or string>
119 # connection_mode: <value in [forward, reverse]>
120 # encryption: <value in [disable, enable]>
121 # forward_address: <string>
122 # forward_destination_cn: <string>
123 # forward_port: <integer>
124 # health_check_interval: <integer>
125 # log: <value in [disable, enable]>
126 # relay_dev_info: <value in [disable, enable]>
127 # relay_user_info: <value in [disable, enable]>
128 # ssl_max_version: <value in [ssl-3.0, tls-1.0, tls-1.1, ...]>
129 # ssl_min_version: <value in [ssl-3.0, tls-1.0, tls-1.1, ...]>
130 # status: <value in [disable, enable]>
131 # trusted_ca: <list or string>
132 # url_map: <string>
133 '''
134
135 RETURN = '''
136 meta:
137 description: The result of the request.
138 type: dict
139 returned: always
140 contains:
141 request_url:
142 description: The full url requested.
143 returned: always
144 type: str
145 sample: /sys/login/user
146 response_code:
147 description: The status of api request.
148 returned: always
149 type: int
150 sample: 0
151 response_data:
152 description: The api response.
153 type: list
154 returned: always
155 response_message:
156 description: The descriptive message of the api response.
157 type: str
158 returned: always
159 sample: OK.
160 system_information:
161 description: The information of the target system.
162 type: dict
163 returned: always
164 rc:
165 description: The status the request.
166 type: int
167 returned: always
168 sample: 0
169 version_check_warning:
170 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
171 type: list
172 returned: complex
173 '''
174 from ansible.module_utils.basic import AnsibleModule
175 from ansible.module_utils.connection import Connection
176 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
177 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
178
179
180 def main():
181 urls_list = [
182 '/pm/config/adom/{adom}/obj/ztna/service-connector',
183 '/pm/config/global/obj/ztna/service-connector'
184 ]
185 module_arg_spec = {
186 'adom': {'required': True, 'type': 'str'},
187 'revision_note': {'type': 'str'},
188 'ztna_serviceconnector': {
189 'type': 'dict', 'v_range': [['7.6.4', '']],
190 'options': {
191 'certificate': {'v_range': [['7.6.4', '']], 'type': 'list', 'elements': 'str'},
192 'connection-mode': {'v_range': [['7.6.4', '']], 'choices': ['forward', 'reverse'], 'type': 'str'},
193 'encryption': {'v_range': [['7.6.4', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
194 'forward-address': {'v_range': [['7.6.4', '']], 'type': 'str'},
195 'forward-destination-cn': {'v_range': [['7.6.4', '']], 'type': 'str'},
196 'forward-port': {'v_range': [['7.6.4', '']], 'type': 'int'},
197 'health-check-interval': {'v_range': [['7.6.4', '']], 'type': 'int'},
198 'log': {'v_range': [['7.6.4', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
199 'name': {'v_range': [['7.6.4', '']], 'required': True, 'type': 'str'},
200 'relay-dev-info': {'v_range': [['7.6.4', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
201 'relay-user-info': {'v_range': [['7.6.4', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
202 'ssl-max-version': {'v_range': [['7.6.4', '']], 'choices': ['ssl-3.0', 'tls-1.0', 'tls-1.1', 'tls-1.2', 'tls-1.3'], 'type': 'str'},
203 'ssl-min-version': {'v_range': [['7.6.4', '']], 'choices': ['ssl-3.0', 'tls-1.0', 'tls-1.1', 'tls-1.2', 'tls-1.3'], 'type': 'str'},
204 'status': {'v_range': [['7.6.4', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
205 'trusted-ca': {'v_range': [['7.6.4', '']], 'type': 'list', 'elements': 'str'},
206 'url-map': {'v_range': [['7.6.4', '']], 'type': 'str'}
207 }
208 }
209 }
210
211 module_option_spec = get_module_arg_spec('full crud')
212 module_arg_spec.update(module_option_spec)
213 check_galaxy_version(module_arg_spec)
214 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'ztna_serviceconnector'),
215 supports_check_mode=True)
216 if not module._socket_path:
217 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
218 connection = Connection(module._socket_path)
219 fmgr = NAPIManager('full crud', module_arg_spec, urls_list,
220 'name', 'data', module, connection)
221 fmgr.process_crud()
222 module.exit_json(meta=module.params)
223
224
225 if __name__ == '__main__':
226 main()