Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_firewall_accessproxysshclientcert.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_firewall_accessproxysshclientcert
15 short_description: Configure Access Proxy SSH client certificate.
16 version_added: "2.4.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 firewall_accessproxysshclientcert:
29 description: The top level parameters set.
30 required: false
31 type: dict
32 suboptions:
33 auth_ca:
34 aliases: ['auth-ca']
35 type: str
36 description: Name of the SSH server public key authentication CA.
37 cert_extension:
38 aliases: ['cert-extension']
39 type: list
40 elements: dict
41 description: Cert extension.
42 suboptions:
43 critical:
44 type: str
45 description: Critical option.
46 choices: ['no', 'yes']
47 data:
48 type: str
49 description: Data of certificate extension.
50 name:
51 type: str
52 description: Name of certificate extension.
53 type:
54 type: str
55 description: Type of certificate extension.
56 choices: ['fixed', 'user']
57 name:
58 type: str
59 description: SSH client certificate name.
60 required: true
61 permit_agent_forwarding:
62 aliases: ['permit-agent-forwarding']
63 type: str
64 description: Enable/disable appending permit-agent-forwarding certificate extension.
65 choices: ['disable', 'enable']
66 permit_port_forwarding:
67 aliases: ['permit-port-forwarding']
68 type: str
69 description: Enable/disable appending permit-port-forwarding certificate extension.
70 choices: ['disable', 'enable']
71 permit_pty:
72 aliases: ['permit-pty']
73 type: str
74 description: Enable/disable appending permit-pty certificate extension.
75 choices: ['disable', 'enable']
76 permit_user_rc:
77 aliases: ['permit-user-rc']
78 type: str
79 description: Enable/disable appending permit-user-rc certificate extension.
80 choices: ['disable', 'enable']
81 permit_x11_forwarding:
82 aliases: ['permit-x11-forwarding']
83 type: str
84 description: Enable/disable appending permit-x11-forwarding certificate extension.
85 choices: ['disable', 'enable']
86 source_address:
87 aliases: ['source-address']
88 type: str
89 description: Enable/disable appending source-address certificate critical option.
90 choices: ['disable', 'enable']
91 '''
92
93 EXAMPLES = '''
94 - name: Example playbook (generated based on argument schema)
95 hosts: fortimanagers
96 connection: httpapi
97 gather_facts: false
98 tasks:
99 - name: Configure Access Proxy SSH client certificate.
100 fortinet.fortimanager.fmgr_firewall_accessproxysshclientcert:
101 # workspace_locking_adom: <global or your adom name>
102 adom: <your own value>
103 state: present # <value in [present, absent]>
104 firewall_accessproxysshclientcert:
105 name: "your value" # Required variable, string
106 # auth_ca: <string>
107 # cert_extension:
108 # - critical: <value in [no, yes]>
109 # data: <string>
110 # name: <string>
111 # type: <value in [fixed, user]>
112 # permit_agent_forwarding: <value in [disable, enable]>
113 # permit_port_forwarding: <value in [disable, enable]>
114 # permit_pty: <value in [disable, enable]>
115 # permit_user_rc: <value in [disable, enable]>
116 # permit_x11_forwarding: <value in [disable, enable]>
117 # source_address: <value in [disable, enable]>
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/firewall/access-proxy-ssh-client-cert',
168 '/pm/config/global/obj/firewall/access-proxy-ssh-client-cert'
169 ]
170 module_arg_spec = {
171 'adom': {'required': True, 'type': 'str'},
172 'revision_note': {'type': 'str'},
173 'firewall_accessproxysshclientcert': {
174 'type': 'dict', 'v_range': [['7.4.2', '']],
175 'options': {
176 'auth-ca': {'v_range': [['7.4.2', '']], 'type': 'str'},
177 'cert-extension': {
178 'v_range': [['7.4.2', '']],
179 'type': 'list',
180 'options': {
181 'critical': {'v_range': [['7.4.2', '']], 'choices': ['no', 'yes'], 'type': 'str'},
182 'data': {'v_range': [['7.4.2', '']], 'type': 'str'},
183 'name': {'v_range': [['7.4.2', '']], 'type': 'str'},
184 'type': {'v_range': [['7.4.2', '']], 'choices': ['fixed', 'user'], 'type': 'str'}
185 },
186 'elements': 'dict'
187 },
188 'name': {'v_range': [['7.4.2', '']], 'required': True, 'type': 'str'},
189 'permit-agent-forwarding': {'v_range': [['7.4.2', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
190 'permit-port-forwarding': {'v_range': [['7.4.2', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
191 'permit-pty': {'v_range': [['7.4.2', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
192 'permit-user-rc': {'v_range': [['7.4.2', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
193 'permit-x11-forwarding': {'v_range': [['7.4.2', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
194 'source-address': {'v_range': [['7.4.2', '']], 'choices': ['disable', 'enable'], 'type': 'str'}
195 }
196 }
197 }
198
199 module_option_spec = get_module_arg_spec('full crud')
200 module_arg_spec.update(module_option_spec)
201 check_galaxy_version(module_arg_spec)
202 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'firewall_accessproxysshclientcert'),
203 supports_check_mode=True)
204 if not module._socket_path:
205 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
206 connection = Connection(module._socket_path)
207 fmgr = NAPIManager('full crud', module_arg_spec, urls_list,
208 'name', 'data', module, connection)
209 fmgr.process_crud()
210 module.exit_json(meta=module.params)
211
212
213 if __name__ == '__main__':
214 main()