Debian Codegraph @

ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_access_layer.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": ["deprecated"],
27 "supported_by": "community",
28 }
29
30 DOCUMENTATION = """
31 ---
32 module: cp_mgmt_access_layer
33 short_description: Manages access-layer objects on Check Point over Web Services API
34 description:
35 - Manages access-layer objects on Check Point devices including creating, updating and removing objects.
36 - All operations are performed over Web Services API.
37 - Available from R80 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 add_default_rule:
47 description:
48 - Indicates whether to include a cleanup rule in the new layer.
49 - Available from R80.10 management version.
50 type: bool
51 applications_and_url_filtering:
52 description:
53 - Whether to enable Applications & URL Filtering blade on the layer.
54 type: bool
55 content_awareness:
56 description:
57 - Whether to enable Content Awareness blade on the layer.
58 - Available from R80.10 management version.
59 type: bool
60 detect_using_x_forward_for:
61 description:
62 - Whether to use X-Forward-For HTTP header, which is added by the proxy server to keep track of the original source IP.
63 type: bool
64 firewall:
65 description:
66 - Whether to enable Firewall blade on the layer.
67 type: bool
68 implicit_cleanup_action:
69 description:
70 - The default "catch-all" action for traffic that does not match any explicit or implied rules in the layer.
71 - Available from R80.20 management version.
72 type: str
73 choices: ['drop', 'accept']
74 mobile_access:
75 description:
76 - Whether to enable Mobile Access blade on the layer.
77 type: bool
78 shared:
79 description:
80 - Whether this layer is shared.
81 - Available from R80.10 management version.
82 type: bool
83 tags:
84 description:
85 - Collection of tag identifiers.
86 type: list
87 elements: str
88 color:
89 description:
90 - Color of the object. Should be one of existing colors.
91 type: str
92 choices: ['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', 'khaki', 'orchid', 'dark orange', 'dark sea green',
93 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon',
94 'coral', 'sea green', 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', 'yellow']
95 comments:
96 description:
97 - Comments string.
98 type: str
99 details_level:
100 description:
101 - 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
102 representation of the object.
103 type: str
104 choices: ['uid', 'standard', 'full']
105 ignore_warnings:
106 description:
107 - Apply changes ignoring warnings.
108 type: bool
109 ignore_errors:
110 description:
111 - 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.
112 type: bool
113 extends_documentation_fragment: check_point.mgmt.checkpoint_objects
114 """
115
116 EXAMPLES = """
117 - name: add-access-layer
118 cp_mgmt_access_layer:
119 name: New Layer 1
120 state: present
121
122 - name: set-access-layer
123 cp_mgmt_access_layer:
124 applications_and_url_filtering: false
125 data_awareness: true
126 name: New Layer 1
127 state: present
128
129 - name: delete-access-layer
130 cp_mgmt_access_layer:
131 name: New Layer 2
132 state: absent
133 """
134
135 RETURN = """
136 cp_mgmt_access_layer:
137 description: The checkpoint object created or updated.
138 returned: always, except when deleting the object.
139 type: dict
140 """
141
142 from ansible.module_utils.basic import AnsibleModule
143 from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import (
144 checkpoint_argument_spec_for_objects,
145 api_call,
146 )
147
148
149 def main():
150 argument_spec = dict(
151 name=dict(type="str", required=True),
152 add_default_rule=dict(type="bool"),
153 applications_and_url_filtering=dict(type="bool"),
154 content_awareness=dict(type="bool"),
155 detect_using_x_forward_for=dict(type="bool"),
156 firewall=dict(type="bool"),
157 implicit_cleanup_action=dict(type="str", choices=["drop", "accept"]),
158 mobile_access=dict(type="bool"),
159 shared=dict(type="bool"),
160 tags=dict(type="list", elements="str"),
161 color=dict(
162 type="str",
163 choices=[
164 "aquamarine",
165 "black",
166 "blue",
167 "crete blue",
168 "burlywood",
169 "cyan",
170 "dark green",
171 "khaki",
172 "orchid",
173 "dark orange",
174 "dark sea green",
175 "pink",
176 "turquoise",
177 "dark blue",
178 "firebrick",
179 "brown",
180 "forest green",
181 "gold",
182 "dark gold",
183 "gray",
184 "dark gray",
185 "light green",
186 "lemon chiffon",
187 "coral",
188 "sea green",
189 "sky blue",
190 "magenta",
191 "purple",
192 "slate blue",
193 "violet red",
194 "navy blue",
195 "olive",
196 "orange",
197 "red",
198 "sienna",
199 "yellow",
200 ],
201 ),
202 comments=dict(type="str"),
203 details_level=dict(type="str", choices=["uid", "standard", "full"]),
204 ignore_warnings=dict(type="bool"),
205 ignore_errors=dict(type="bool"),
206 )
207 argument_spec.update(checkpoint_argument_spec_for_objects)
208
209 module = AnsibleModule(
210 argument_spec=argument_spec, supports_check_mode=True
211 )
212 api_call_object = "access-layer"
213
214 result = api_call(module, api_call_object)
215 module.exit_json(**result)
216
217
218 if __name__ == "__main__":
219 main()