Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_firewall_accessproxyvirtualhost.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_accessproxyvirtualhost
15 short_description: Configure Access Proxy virtual hosts.
16 version_added: "2.1.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_accessproxyvirtualhost:
29 description: The top level parameters set.
30 required: false
31 type: dict
32 suboptions:
33 host:
34 type: str
35 description: The host name.
36 host_type:
37 aliases: ['host-type']
38 type: str
39 description: Type of host pattern.
40 choices: ['sub-string', 'wildcard']
41 name:
42 type: str
43 description: Virtual host name.
44 required: true
45 ssl_certificate:
46 aliases: ['ssl-certificate']
47 type: str
48 description: SSL certificate for this host.
49 replacemsg_group:
50 aliases: ['replacemsg-group']
51 type: str
52 description: Access-proxy-virtual-host replacement message override group.
53 client_cert:
54 aliases: ['client-cert']
55 type: str
56 description: Enable/disable requesting client certificate.
57 choices: ['disable', 'enable']
58 empty_cert_action:
59 aliases: ['empty-cert-action']
60 type: str
61 description: Action for an empty client certificate.
62 choices: ['block', 'accept', 'accept-unmanageable']
63 user_agent_detect:
64 aliases: ['user-agent-detect']
65 type: str
66 description: Enable/disable detecting device type by HTTP user-agent if no client certificate is provided.
67 choices: ['disable', 'enable']
68 '''
69
70 EXAMPLES = '''
71 - name: Example playbook (generated based on argument schema)
72 hosts: fortimanagers
73 connection: httpapi
74 gather_facts: false
75 tasks:
76 - name: Configure Access Proxy virtual hosts.
77 fortinet.fortimanager.fmgr_firewall_accessproxyvirtualhost:
78 # workspace_locking_adom: <global or your adom name>
79 adom: <your own value>
80 state: present # <value in [present, absent]>
81 firewall_accessproxyvirtualhost:
82 name: "your value" # Required variable, string
83 # host: <string>
84 # host_type: <value in [sub-string, wildcard]>
85 # ssl_certificate: <string>
86 # replacemsg_group: <string>
87 # client_cert: <value in [disable, enable]>
88 # empty_cert_action: <value in [block, accept, accept-unmanageable]>
89 # user_agent_detect: <value in [disable, enable]>
90 '''
91
92 RETURN = '''
93 meta:
94 description: The result of the request.
95 type: dict
96 returned: always
97 contains:
98 request_url:
99 description: The full url requested.
100 returned: always
101 type: str
102 sample: /sys/login/user
103 response_code:
104 description: The status of api request.
105 returned: always
106 type: int
107 sample: 0
108 response_data:
109 description: The api response.
110 type: list
111 returned: always
112 response_message:
113 description: The descriptive message of the api response.
114 type: str
115 returned: always
116 sample: OK.
117 system_information:
118 description: The information of the target system.
119 type: dict
120 returned: always
121 rc:
122 description: The status the request.
123 type: int
124 returned: always
125 sample: 0
126 version_check_warning:
127 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
128 type: list
129 returned: complex
130 '''
131 from ansible.module_utils.basic import AnsibleModule
132 from ansible.module_utils.connection import Connection
133 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
134 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
135
136
137 def main():
138 urls_list = [
139 '/pm/config/adom/{adom}/obj/firewall/access-proxy-virtual-host',
140 '/pm/config/global/obj/firewall/access-proxy-virtual-host'
141 ]
142 module_arg_spec = {
143 'adom': {'required': True, 'type': 'str'},
144 'revision_note': {'type': 'str'},
145 'firewall_accessproxyvirtualhost': {
146 'type': 'dict', 'v_range': [['7.0.1', '']],
147 'options': {
148 'host': {'v_range': [['7.0.1', '']], 'type': 'str'},
149 'host-type': {'v_range': [['7.0.1', '']], 'choices': ['sub-string', 'wildcard'], 'type': 'str'},
150 'name': {'v_range': [['7.0.1', '']], 'required': True, 'type': 'str'},
151 'ssl-certificate': {'v_range': [['7.0.1', '']], 'type': 'str'},
152 'replacemsg-group': {'v_range': [['7.0.5', '7.0.16'], ['7.2.1', '']], 'type': 'str'},
153 'client-cert': {'v_range': [['7.6.2', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
154 'empty-cert-action': {'v_range': [['7.6.2', '']], 'choices': ['block', 'accept', 'accept-unmanageable'], 'type': 'str'},
155 'user-agent-detect': {'v_range': [['7.6.2', '']], 'choices': ['disable', 'enable'], 'type': 'str'}
156 }
157 }
158 }
159
160 module_option_spec = get_module_arg_spec('full crud')
161 module_arg_spec.update(module_option_spec)
162 check_galaxy_version(module_arg_spec)
163 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'firewall_accessproxyvirtualhost'),
164 supports_check_mode=True)
165 if not module._socket_path:
166 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
167 connection = Connection(module._socket_path)
168 fmgr = NAPIManager('full crud', module_arg_spec, urls_list,
169 'name', 'data', module, connection)
170 fmgr.process_crud()
171 module.exit_json(meta=module.params)
172
173
174 if __name__ == '__main__':
175 main()