Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_firewall_accessproxysshclientcert_certextension.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_certextension
15 short_description: Configure certificate extension for user 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 access-proxy-ssh-client-cert:
29 description: Deprecated, please use "access_proxy_ssh_client_cert"
30 type: str
31 access_proxy_ssh_client_cert:
32 description: The parameter (access-proxy-ssh-client-cert) in requested url.
33 type: str
34 firewall_accessproxysshclientcert_certextension:
35 description: The top level parameters set.
36 required: false
37 type: dict
38 suboptions:
39 critical:
40 type: str
41 description: Critical option.
42 choices: ['no', 'yes']
43 data:
44 type: str
45 description: Data of certificate extension.
46 name:
47 type: str
48 description: Name of certificate extension.
49 required: true
50 type:
51 type: str
52 description: Type of certificate extension.
53 choices: ['fixed', 'user']
54 '''
55
56 EXAMPLES = '''
57 - name: Example playbook (generated based on argument schema)
58 hosts: fortimanagers
59 connection: httpapi
60 gather_facts: false
61 tasks:
62 - name: Configure certificate extension for user certificate.
63 fortinet.fortimanager.fmgr_firewall_accessproxysshclientcert_certextension:
64 # workspace_locking_adom: <global or your adom name>
65 adom: <your own value>
66 access_proxy_ssh_client_cert: <your own value>
67 state: present # <value in [present, absent]>
68 firewall_accessproxysshclientcert_certextension:
69 name: "your value" # Required variable, string
70 # critical: <value in [no, yes]>
71 # data: <string>
72 # type: <value in [fixed, user]>
73 '''
74
75 RETURN = '''
76 meta:
77 description: The result of the request.
78 type: dict
79 returned: always
80 contains:
81 request_url:
82 description: The full url requested.
83 returned: always
84 type: str
85 sample: /sys/login/user
86 response_code:
87 description: The status of api request.
88 returned: always
89 type: int
90 sample: 0
91 response_data:
92 description: The api response.
93 type: list
94 returned: always
95 response_message:
96 description: The descriptive message of the api response.
97 type: str
98 returned: always
99 sample: OK.
100 system_information:
101 description: The information of the target system.
102 type: dict
103 returned: always
104 rc:
105 description: The status the request.
106 type: int
107 returned: always
108 sample: 0
109 version_check_warning:
110 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
111 type: list
112 returned: complex
113 '''
114 from ansible.module_utils.basic import AnsibleModule
115 from ansible.module_utils.connection import Connection
116 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
117 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
118
119
120 def main():
121 urls_list = [
122 '/pm/config/adom/{adom}/obj/firewall/access-proxy-ssh-client-cert/{access-proxy-ssh-client-cert}/cert-extension',
123 '/pm/config/global/obj/firewall/access-proxy-ssh-client-cert/{access-proxy-ssh-client-cert}/cert-extension'
124 ]
125 module_arg_spec = {
126 'adom': {'required': True, 'type': 'str'},
127 'access-proxy-ssh-client-cert': {'type': 'str', 'api_name': 'access_proxy_ssh_client_cert'},
128 'access_proxy_ssh_client_cert': {'type': 'str'},
129 'revision_note': {'type': 'str'},
130 'firewall_accessproxysshclientcert_certextension': {
131 'type': 'dict', 'v_range': [['7.4.2', '']],
132 'options': {
133 'critical': {'v_range': [['7.4.2', '']], 'choices': ['no', 'yes'], 'type': 'str'},
134 'data': {'v_range': [['7.4.2', '']], 'type': 'str'},
135 'name': {'v_range': [['7.4.2', '']], 'required': True, 'type': 'str'},
136 'type': {'v_range': [['7.4.2', '']], 'choices': ['fixed', 'user'], 'type': 'str'}
137 }
138 }
139 }
140
141 module_option_spec = get_module_arg_spec('full crud')
142 module_arg_spec.update(module_option_spec)
143 check_galaxy_version(module_arg_spec)
144 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'firewall_accessproxysshclientcert_certextension'),
145 supports_check_mode=True)
146 if not module._socket_path:
147 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
148 connection = Connection(module._socket_path)
149 fmgr = NAPIManager('full crud', module_arg_spec, urls_list,
150 'name', 'data', module, connection)
151 fmgr.process_crud()
152 module.exit_json(meta=module.params)
153
154
155 if __name__ == '__main__':
156 main()