Debian Codegraph @

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

raw
1 #!/usr/bin/python
2 # -*- coding: utf-8 -*-
3 #
4 # Ansible module to manage CheckPoint 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_mds
33 short_description: Manages mds objects on Checkpoint over Web Services API
34 description:
35 - Manages mds objects on Checkpoint devices including creating, updating and removing objects.
36 - All operations are performed over Web Services API.
37 - Available from R80.40 JHF management version.
38 version_added: "2.1.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 hardware:
59 description:
60 - Hardware name. For example, Open server, Smart-1, Other.
61 type: str
62 os:
63 description:
64 - Operating system name. For example, Gaia, Linux, SecurePlatform.
65 type: str
66 version:
67 description:
68 - System version.
69 type: str
70 one_time_password:
71 description:
72 - Secure internal connection one time password.
73 type: str
74 server_type:
75 description:
76 - Type of the management server.
77 type: str
78 choices: ['multi-domain server', 'multi-domain log server']
79 ip_pool_first:
80 description:
81 - First IP address in the range.
82 type: str
83 ipv4_pool_first:
84 description:
85 - First IPv4 address in the range.
86 type: str
87 ipv6_pool_first:
88 description:
89 - First IPv6 address in the range.
90 type: str
91 ip_pool_last:
92 description:
93 - Last IP address in the range.
94 type: str
95 ipv4_pool_last:
96 description:
97 - Last IPv4 address in the range.
98 type: str
99 ipv6_pool_last:
100 description:
101 - Last IPv6 address in the range.
102 type: str
103 tags:
104 description:
105 - Collection of tag identifiers.
106 type: list
107 elements: str
108 color:
109 description:
110 - Color of the object. Should be one of existing colors.
111 type: str
112 choices: ['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', 'khaki', 'orchid', 'dark orange', 'dark sea green',
113 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon',
114 'coral', 'sea green', 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', 'yellow']
115 comments:
116 description:
117 - Comments string.
118 type: str
119 details_level:
120 description:
121 - 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
122 representation of the object.
123 type: str
124 choices: ['uid', 'standard', 'full']
125 ignore_warnings:
126 description:
127 - Apply changes ignoring warnings.
128 type: bool
129 ignore_errors:
130 description:
131 - 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.
132 type: bool
133 extends_documentation_fragment: check_point.mgmt.checkpoint_objects
134 """
135
136 EXAMPLES = """
137 - name: add-mds
138 cp_mgmt_mds:
139 hardware: open server
140 ip_address: 1.1.1.1
141 ip_pool_first: 2.2.2.2
142 ip_pool_last: 3.3.3.3
143 name: mymds
144 os: gaia
145 server_type: multi-domain server
146 state: present
147
148 - name: set-mds
149 cp_mgmt_mds:
150 hardware: Smart-1
151 ip_address: 1.2.3.4
152 name: mymds
153 os: linux
154 state: present
155
156 - name: delete-mds
157 cp_mgmt_mds:
158 name: mymds
159 state: absent
160 """
161
162 RETURN = """
163 cp_mgmt_mds:
164 description: The checkpoint object created or updated.
165 returned: always, except when deleting the object.
166 type: dict
167 """
168
169 from ansible.module_utils.basic import AnsibleModule
170 from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import (
171 checkpoint_argument_spec_for_objects,
172 api_call,
173 )
174
175
176 def main():
177 argument_spec = dict(
178 name=dict(type="str", required=True),
179 ip_address=dict(type="str"),
180 ipv4_address=dict(type="str"),
181 ipv6_address=dict(type="str"),
182 hardware=dict(type="str"),
183 os=dict(type="str"),
184 version=dict(type="str"),
185 one_time_password=dict(type="str", no_log=True),
186 server_type=dict(
187 type="str",
188 choices=["multi-domain server", "multi-domain log server"],
189 ),
190 ip_pool_first=dict(type="str"),
191 ipv4_pool_first=dict(type="str"),
192 ipv6_pool_first=dict(type="str"),
193 ip_pool_last=dict(type="str"),
194 ipv4_pool_last=dict(type="str"),
195 ipv6_pool_last=dict(type="str"),
196 tags=dict(type="list", elements="str"),
197 color=dict(
198 type="str",
199 choices=[
200 "aquamarine",
201 "black",
202 "blue",
203 "crete blue",
204 "burlywood",
205 "cyan",
206 "dark green",
207 "khaki",
208 "orchid",
209 "dark orange",
210 "dark sea green",
211 "pink",
212 "turquoise",
213 "dark blue",
214 "firebrick",
215 "brown",
216 "forest green",
217 "gold",
218 "dark gold",
219 "gray",
220 "dark gray",
221 "light green",
222 "lemon chiffon",
223 "coral",
224 "sea green",
225 "sky blue",
226 "magenta",
227 "purple",
228 "slate blue",
229 "violet red",
230 "navy blue",
231 "olive",
232 "orange",
233 "red",
234 "sienna",
235 "yellow",
236 ],
237 ),
238 comments=dict(type="str"),
239 details_level=dict(type="str", choices=["uid", "standard", "full"]),
240 ignore_warnings=dict(type="bool"),
241 ignore_errors=dict(type="bool"),
242 )
243 argument_spec.update(checkpoint_argument_spec_for_objects)
244
245 module = AnsibleModule(
246 argument_spec=argument_spec, supports_check_mode=True
247 )
248 api_call_object = "mds"
249
250 result = api_call(module, api_call_object)
251 module.exit_json(**result)
252
253
254 if __name__ == "__main__":
255 main()