Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_firewall_multicastaddress6.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_multicastaddress6
15 short_description: Configure IPv6 multicast address.
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_multicastaddress6:
29 description: The top level parameters set.
30 required: false
31 type: dict
32 suboptions:
33 color:
34 type: int
35 description: Color of icon on the GUI.
36 comment:
37 type: str
38 description: Comment.
39 ip6:
40 type: str
41 description: IPv6 address prefix
42 name:
43 type: str
44 description: IPv6 multicast address 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 or str) Tags.
60 visibility:
61 type: str
62 description: Enable/disable visibility of the IPv6 multicast address on the GUI.
63 choices: ['disable', 'enable']
64 tags:
65 type: str
66 description: Applied object tags.
67 '''
68
69 EXAMPLES = '''
70 - name: Example playbook
71 hosts: fortimanagers
72 gather_facts: false
73 connection: httpapi
74 vars:
75 ansible_httpapi_use_ssl: true
76 ansible_httpapi_validate_certs: false
77 ansible_httpapi_port: 443
78 tasks:
79 - name: Configure IPv6 multicast address.
80 fortinet.fortimanager.fmgr_firewall_multicastaddress6:
81 bypass_validation: false
82 adom: ansible
83 state: present
84 firewall_multicastaddress6:
85 color: 2
86 comment: "ansible-comment"
87 ip6: "2001::10/128"
88 name: "ansible-test"
89 visibility: enable
90
91 - name: Gathering fortimanager facts
92 hosts: fortimanagers
93 gather_facts: false
94 connection: httpapi
95 vars:
96 ansible_httpapi_use_ssl: true
97 ansible_httpapi_validate_certs: false
98 ansible_httpapi_port: 443
99 tasks:
100 - name: Retrieve all the IPv6 multicast addresses
101 fortinet.fortimanager.fmgr_fact:
102 facts:
103 selector: "firewall_multicastaddress6"
104 params:
105 adom: "ansible"
106 multicast_address6: "your_value"
107 '''
108
109 RETURN = '''
110 meta:
111 description: The result of the request.
112 type: dict
113 returned: always
114 contains:
115 request_url:
116 description: The full url requested.
117 returned: always
118 type: str
119 sample: /sys/login/user
120 response_code:
121 description: The status of api request.
122 returned: always
123 type: int
124 sample: 0
125 response_data:
126 description: The api response.
127 type: list
128 returned: always
129 response_message:
130 description: The descriptive message of the api response.
131 type: str
132 returned: always
133 sample: OK.
134 system_information:
135 description: The information of the target system.
136 type: dict
137 returned: always
138 rc:
139 description: The status the request.
140 type: int
141 returned: always
142 sample: 0
143 version_check_warning:
144 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
145 type: list
146 returned: complex
147 '''
148 from ansible.module_utils.basic import AnsibleModule
149 from ansible.module_utils.connection import Connection
150 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
151 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
152
153
154 def main():
155 urls_list = [
156 '/pm/config/adom/{adom}/obj/firewall/multicast-address6',
157 '/pm/config/global/obj/firewall/multicast-address6'
158 ]
159 module_arg_spec = {
160 'adom': {'required': True, 'type': 'str'},
161 'revision_note': {'type': 'str'},
162 'firewall_multicastaddress6': {
163 'type': 'dict', 'v_range': [['6.0.0', '']],
164 'options': {
165 'color': {'type': 'int'},
166 'comment': {'type': 'str'},
167 'ip6': {'type': 'str'},
168 'name': {'required': True, 'type': 'str'},
169 'tagging': {
170 'type': 'list',
171 'options': {'category': {'type': 'str'}, 'name': {'type': 'str'}, 'tags': {'type': 'raw'}},
172 'elements': 'dict'
173 },
174 'visibility': {'v_range': [['6.0.0', '7.6.2']], 'choices': ['disable', 'enable'], 'type': 'str'},
175 'tags': {'v_range': [['6.2.0', '6.4.15']], 'type': 'str'}
176 }
177 }
178 }
179
180 module_option_spec = get_module_arg_spec('full crud')
181 module_arg_spec.update(module_option_spec)
182 check_galaxy_version(module_arg_spec)
183 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'firewall_multicastaddress6'),
184 supports_check_mode=True)
185 if not module._socket_path:
186 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
187 connection = Connection(module._socket_path)
188 fmgr = NAPIManager('full crud', module_arg_spec, urls_list,
189 'name', 'data', module, connection)
190 fmgr.process_crud()
191 module.exit_json(meta=module.params)
192
193
194 if __name__ == '__main__':
195 main()