Debian Codegraph @

ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_wildcard.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_wildcard
33 short_description: Manages wildcard objects on Check Point over Web Services API
34 description:
35 - Manages wildcard objects on Check Point devices including creating, updating and removing objects.
36 - All operations are performed over Web Services API.
37 - Available from R80.20.M1 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 ipv4_address:
47 description:
48 - IPv4 address.
49 type: str
50 ipv4_mask_wildcard:
51 description:
52 - IPv4 mask wildcard.
53 type: str
54 ipv6_address:
55 description:
56 - IPv6 address.
57 type: str
58 ipv6_mask_wildcard:
59 description:
60 - IPv6 mask wildcard.
61 type: str
62 tags:
63 description:
64 - Collection of tag identifiers.
65 type: list
66 elements: str
67 color:
68 description:
69 - Color of the object. Should be one of existing colors.
70 type: str
71 choices: ['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', 'khaki', 'orchid', 'dark orange', 'dark sea green',
72 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon',
73 'coral', 'sea green', 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', 'yellow']
74 comments:
75 description:
76 - Comments string.
77 type: str
78 details_level:
79 description:
80 - 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
81 representation of the object.
82 type: str
83 choices: ['uid', 'standard', 'full']
84 groups:
85 description:
86 - Collection of group identifiers.
87 type: list
88 elements: str
89 ignore_warnings:
90 description:
91 - Apply changes ignoring warnings.
92 type: bool
93 ignore_errors:
94 description:
95 - 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.
96 type: bool
97 extends_documentation_fragment: check_point.mgmt.checkpoint_objects
98 """
99
100 EXAMPLES = """
101 - name: add-wildcard
102 cp_mgmt_wildcard:
103 ipv4_address: 192.168.2.1
104 ipv4_mask_wildcard: 0.0.0.128
105 name: New Wildcard 1
106 state: present
107
108 - name: set-wildcard
109 cp_mgmt_wildcard:
110 color: green
111 ipv6_address: 2001:db8::1111
112 ipv6_mask_wildcard: ffff:ffff::f0f0
113 name: New Wildcard 1
114 state: present
115
116 - name: delete-wildcard
117 cp_mgmt_wildcard:
118 name: New Wildcard 1
119 state: absent
120 """
121
122 RETURN = """
123 cp_mgmt_wildcard:
124 description: The checkpoint object created or updated.
125 returned: always, except when deleting the object.
126 type: dict
127 """
128
129 from ansible.module_utils.basic import AnsibleModule
130 from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import (
131 checkpoint_argument_spec_for_objects,
132 api_call,
133 )
134
135
136 def main():
137 argument_spec = dict(
138 name=dict(type="str", required=True),
139 ipv4_address=dict(type="str"),
140 ipv4_mask_wildcard=dict(type="str"),
141 ipv6_address=dict(type="str"),
142 ipv6_mask_wildcard=dict(type="str"),
143 tags=dict(type="list", elements="str"),
144 color=dict(
145 type="str",
146 choices=[
147 "aquamarine",
148 "black",
149 "blue",
150 "crete blue",
151 "burlywood",
152 "cyan",
153 "dark green",
154 "khaki",
155 "orchid",
156 "dark orange",
157 "dark sea green",
158 "pink",
159 "turquoise",
160 "dark blue",
161 "firebrick",
162 "brown",
163 "forest green",
164 "gold",
165 "dark gold",
166 "gray",
167 "dark gray",
168 "light green",
169 "lemon chiffon",
170 "coral",
171 "sea green",
172 "sky blue",
173 "magenta",
174 "purple",
175 "slate blue",
176 "violet red",
177 "navy blue",
178 "olive",
179 "orange",
180 "red",
181 "sienna",
182 "yellow",
183 ],
184 ),
185 comments=dict(type="str"),
186 details_level=dict(type="str", choices=["uid", "standard", "full"]),
187 groups=dict(type="list", elements="str"),
188 ignore_warnings=dict(type="bool"),
189 ignore_errors=dict(type="bool"),
190 )
191 argument_spec.update(checkpoint_argument_spec_for_objects)
192
193 module = AnsibleModule(
194 argument_spec=argument_spec, supports_check_mode=True
195 )
196 api_call_object = "wildcard"
197
198 result = api_call(module, api_call_object)
199 module.exit_json(**result)
200
201
202 if __name__ == "__main__":
203 main()