Debian Codegraph @

ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_multicast_address_range.py

raw
1 #!/usr/bin/python
2 # -*- coding: utf-8 -*-
3 #
4 # Ansible module to manage Check Point Firewall (c) 2019
5 #
6 # Ansible is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
10 #
11 # Ansible is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
15 #
16 # You should have received a copy of the GNU General Public License
17 # along with Ansible. If not, see <http://www.gnu.org/licenses/>.
18 #
19
20 from __future__ import absolute_import, division, print_function
21
22 __metaclass__ = type
23
24 ANSIBLE_METADATA = {
25 "metadata_version": "1.1",
26 "status": ["preview"],
27 "supported_by": "community",
28 }
29
30 DOCUMENTATION = """
31 ---
32 module: cp_mgmt_multicast_address_range
33 short_description: Manages multicast-address-range objects on Check Point over Web Services API
34 description:
35 - Manages multicast-address-range objects on Check Point devices including creating, updating and removing objects.
36 - All operations are performed over Web Services API.
37 - Available from R80.10 management version.
38 version_added: "1.0.0"
39 author: "Or Soffer (@chkp-orso)"
40 options:
41 name:
42 description:
43 - Object name.
44 type: str
45 required: True
46 ip_address:
47 description:
48 - IPv4 or IPv6 address. If both addresses are required use ipv4-address and ipv6-address fields explicitly.
49 type: str
50 ipv4_address:
51 description:
52 - IPv4 address.
53 type: str
54 ipv6_address:
55 description:
56 - IPv6 address.
57 type: str
58 ip_address_first:
59 description:
60 - First IP address in the range. If both IPv4 and IPv6 address ranges are required, use the ipv4-address-first and the ipv6-address-first fields instead.
61 type: str
62 ipv4_address_first:
63 description:
64 - First IPv4 address in the range.
65 type: str
66 ipv6_address_first:
67 description:
68 - First IPv6 address in the range.
69 type: str
70 ip_address_last:
71 description:
72 - Last IP address in the range. If both IPv4 and IPv6 address ranges are required, use the ipv4-address-first and the ipv6-address-first fields instead.
73 type: str
74 ipv4_address_last:
75 description:
76 - Last IPv4 address in the range.
77 type: str
78 ipv6_address_last:
79 description:
80 - Last IPv6 address in the range.
81 type: str
82 tags:
83 description:
84 - Collection of tag identifiers.
85 type: list
86 elements: str
87 color:
88 description:
89 - Color of the object. Should be one of existing colors.
90 type: str
91 choices: ['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', 'khaki', 'orchid', 'dark orange', 'dark sea green',
92 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon',
93 'coral', 'sea green', 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', 'yellow']
94 comments:
95 description:
96 - Comments string.
97 type: str
98 details_level:
99 description:
100 - The level of detail for some of the fields in the response can vary from showing only the UID value of the object to a fully detailed
101 representation of the object.
102 type: str
103 choices: ['uid', 'standard', 'full']
104 groups:
105 description:
106 - Collection of group identifiers.
107 type: list
108 elements: str
109 ignore_warnings:
110 description:
111 - Apply changes ignoring warnings.
112 type: bool
113 ignore_errors:
114 description:
115 - Apply changes ignoring errors. You won't be able to publish such a changes. If ignore-warnings flag was omitted - warnings will also be ignored.
116 type: bool
117 extends_documentation_fragment: check_point.mgmt.checkpoint_objects
118 """
119
120 EXAMPLES = """
121 - name: add-multicast-address-range
122 cp_mgmt_multicast_address_range:
123 ip_address_first: 224.0.0.1
124 ip_address_last: 224.0.0.4
125 name: New Multicast Address Range
126 state: present
127
128 - name: set-multicast-address-range
129 cp_mgmt_multicast_address_range:
130 ip_address_first: 224.0.0.7
131 ip_address_last: 224.0.0.10
132 name: New Multicast Address Range
133 state: present
134
135 - name: delete-multicast-address-range
136 cp_mgmt_multicast_address_range:
137 name: New Multicast Address Range
138 state: absent
139 """
140
141 RETURN = """
142 cp_mgmt_multicast_address_range:
143 description: The checkpoint object created or updated.
144 returned: always, except when deleting the object.
145 type: dict
146 """
147
148 from ansible.module_utils.basic import AnsibleModule
149 from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import (
150 checkpoint_argument_spec_for_objects,
151 api_call,
152 )
153
154
155 def main():
156 argument_spec = dict(
157 name=dict(type="str", required=True),
158 ip_address=dict(type="str"),
159 ipv4_address=dict(type="str"),
160 ipv6_address=dict(type="str"),
161 ip_address_first=dict(type="str"),
162 ipv4_address_first=dict(type="str"),
163 ipv6_address_first=dict(type="str"),
164 ip_address_last=dict(type="str"),
165 ipv4_address_last=dict(type="str"),
166 ipv6_address_last=dict(type="str"),
167 tags=dict(type="list", elements="str"),
168 color=dict(
169 type="str",
170 choices=[
171 "aquamarine",
172 "black",
173 "blue",
174 "crete blue",
175 "burlywood",
176 "cyan",
177 "dark green",
178 "khaki",
179 "orchid",
180 "dark orange",
181 "dark sea green",
182 "pink",
183 "turquoise",
184 "dark blue",
185 "firebrick",
186 "brown",
187 "forest green",
188 "gold",
189 "dark gold",
190 "gray",
191 "dark gray",
192 "light green",
193 "lemon chiffon",
194 "coral",
195 "sea green",
196 "sky blue",
197 "magenta",
198 "purple",
199 "slate blue",
200 "violet red",
201 "navy blue",
202 "olive",
203 "orange",
204 "red",
205 "sienna",
206 "yellow",
207 ],
208 ),
209 comments=dict(type="str"),
210 details_level=dict(type="str", choices=["uid", "standard", "full"]),
211 groups=dict(type="list", elements="str"),
212 ignore_warnings=dict(type="bool"),
213 ignore_errors=dict(type="bool"),
214 )
215 argument_spec.update(checkpoint_argument_spec_for_objects)
216
217 module = AnsibleModule(
218 argument_spec=argument_spec, supports_check_mode=True
219 )
220 api_call_object = "multicast-address-range"
221
222 result = api_call(module, api_call_object)
223 module.exit_json(**result)
224
225
226 if __name__ == "__main__":
227 main()