Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_firewall_proxyaddrgrp.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_proxyaddrgrp
15 short_description: Web proxy address group configuration.
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 firewall_proxyaddrgrp:
29 description: The top level parameters set.
30 required: false
31 type: dict
32 suboptions:
33 color:
34 type: int
35 description: Integer value to determine the color of the icon in the GUI
36 comment:
37 type: str
38 description: Optional comments.
39 member:
40 type: raw
41 description: (list or str) Members of address group.
42 name:
43 type: str
44 description: Address group name.
45 required: true
46 tagging:
47 type: list
48 elements: dict
49 description: Tagging.
50 suboptions:
51 category:
52 type: str
53 description: Tag category.
54 name:
55 type: str
56 description: Tagging entry name.
57 tags:
58 type: raw
59 description: (list) Tags.
60 type:
61 type: str
62 description: Source or destination address group type.
63 choices: ['src', 'dst']
64 uuid:
65 type: str
66 description: Universally Unique Identifier
67 visibility:
68 type: str
69 description: Enable/disable visibility of the object in the GUI.
70 choices: ['disable', 'enable']
71 tags:
72 type: str
73 description: Names of object-tags
74 _image_base64:
75 aliases: ['_image-base64']
76 type: str
77 description: Image base64.
78 logic_type:
79 aliases: ['logic-type']
80 type: str
81 description: Logic type.
82 choices: ['or', 'and']
83 '''
84
85 EXAMPLES = '''
86 - name: Example playbook
87 hosts: fortimanagers
88 gather_facts: false
89 connection: httpapi
90 vars:
91 ansible_httpapi_use_ssl: true
92 ansible_httpapi_validate_certs: false
93 ansible_httpapi_port: 443
94 tasks:
95 - name: Web proxy address group configuration.
96 fortinet.fortimanager.fmgr_firewall_proxyaddrgrp:
97 bypass_validation: false
98 adom: ansible
99 state: present
100 firewall_proxyaddrgrp:
101 color: 1
102 comment: "ansible-comment"
103 member: "ansible-test" # need a valid proxy address name
104 name: "ansible-test2"
105
106 - name: Gathering fortimanager facts
107 hosts: fortimanagers
108 gather_facts: false
109 connection: httpapi
110 vars:
111 ansible_httpapi_use_ssl: true
112 ansible_httpapi_validate_certs: false
113 ansible_httpapi_port: 443
114 tasks:
115 - name: Retrieve all the proxy address groups
116 fortinet.fortimanager.fmgr_fact:
117 facts:
118 selector: "firewall_proxyaddrgrp"
119 params:
120 adom: "ansible"
121 proxy_addrgrp: "your_value"
122 '''
123
124 RETURN = '''
125 meta:
126 description: The result of the request.
127 type: dict
128 returned: always
129 contains:
130 request_url:
131 description: The full url requested.
132 returned: always
133 type: str
134 sample: /sys/login/user
135 response_code:
136 description: The status of api request.
137 returned: always
138 type: int
139 sample: 0
140 response_data:
141 description: The api response.
142 type: list
143 returned: always
144 response_message:
145 description: The descriptive message of the api response.
146 type: str
147 returned: always
148 sample: OK.
149 system_information:
150 description: The information of the target system.
151 type: dict
152 returned: always
153 rc:
154 description: The status the request.
155 type: int
156 returned: always
157 sample: 0
158 version_check_warning:
159 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
160 type: list
161 returned: complex
162 '''
163 from ansible.module_utils.basic import AnsibleModule
164 from ansible.module_utils.connection import Connection
165 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
166 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
167
168
169 def main():
170 urls_list = [
171 '/pm/config/adom/{adom}/obj/firewall/proxy-addrgrp',
172 '/pm/config/global/obj/firewall/proxy-addrgrp'
173 ]
174 module_arg_spec = {
175 'adom': {'required': True, 'type': 'str'},
176 'revision_note': {'type': 'str'},
177 'firewall_proxyaddrgrp': {
178 'type': 'dict', 'v_range': [['6.0.0', '']],
179 'options': {
180 'color': {'type': 'int'},
181 'comment': {'type': 'str'},
182 'member': {'type': 'raw'},
183 'name': {'required': True, 'type': 'str'},
184 'tagging': {
185 'type': 'list',
186 'options': {'category': {'type': 'str'}, 'name': {'type': 'str'}, 'tags': {'type': 'raw'}},
187 'elements': 'dict'
188 },
189 'type': {'choices': ['src', 'dst'], 'type': 'str'},
190 'uuid': {'type': 'str'},
191 'visibility': {'v_range': [['6.0.0', '7.6.2']], 'choices': ['disable', 'enable'], 'type': 'str'},
192 'tags': {'v_range': [['6.2.0', '6.4.15'], ['7.4.8', '7.4.10']], 'type': 'str'},
193 '_image-base64': {'v_range': [['6.2.2', '']], 'type': 'str'},
194 'logic-type': {'v_range': [['7.4.9', '7.4.10'], ['7.6.5', '']], 'choices': ['or', 'and'], '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_proxyaddrgrp'),
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()