Debian Codegraph @

ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_threat_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_threat_layer
33 short_description: Manages threat-layer objects on Check Point over Web Services API
34 description:
35 - Manages threat-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 default rule in the new layer.
49 - Available from R80.10 management version.
50 type: bool
51 tags:
52 description:
53 - Collection of tag identifiers.
54 type: list
55 elements: str
56 color:
57 description:
58 - Color of the object. Should be one of existing colors.
59 type: str
60 choices: ['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', 'khaki', 'orchid', 'dark orange', 'dark sea green',
61 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon',
62 'coral', 'sea green', 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', 'yellow']
63 comments:
64 description:
65 - Comments string.
66 type: str
67 details_level:
68 description:
69 - 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
70 representation of the object.
71 type: str
72 choices: ['uid', 'standard', 'full']
73 ignore_warnings:
74 description:
75 - Apply changes ignoring warnings.
76 type: bool
77 ignore_errors:
78 description:
79 - 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.
80 type: bool
81 extends_documentation_fragment: check_point.mgmt.checkpoint_objects
82 """
83
84 EXAMPLES = """
85 - name: add-threat-layer
86 cp_mgmt_threat_layer:
87 name: New Layer 1
88 state: present
89
90 - name: delete-threat-layer
91 cp_mgmt_threat_layer:
92 name: New Layer 2
93 state: absent
94 """
95
96 RETURN = """
97 cp_mgmt_threat_layer:
98 description: The checkpoint object created or updated.
99 returned: always, except when deleting the object.
100 type: dict
101 """
102
103 from ansible.module_utils.basic import AnsibleModule
104 from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import (
105 checkpoint_argument_spec_for_objects,
106 api_call,
107 )
108
109
110 def main():
111 argument_spec = dict(
112 name=dict(type="str", required=True),
113 add_default_rule=dict(type="bool"),
114 tags=dict(type="list", elements="str"),
115 color=dict(
116 type="str",
117 choices=[
118 "aquamarine",
119 "black",
120 "blue",
121 "crete blue",
122 "burlywood",
123 "cyan",
124 "dark green",
125 "khaki",
126 "orchid",
127 "dark orange",
128 "dark sea green",
129 "pink",
130 "turquoise",
131 "dark blue",
132 "firebrick",
133 "brown",
134 "forest green",
135 "gold",
136 "dark gold",
137 "gray",
138 "dark gray",
139 "light green",
140 "lemon chiffon",
141 "coral",
142 "sea green",
143 "sky blue",
144 "magenta",
145 "purple",
146 "slate blue",
147 "violet red",
148 "navy blue",
149 "olive",
150 "orange",
151 "red",
152 "sienna",
153 "yellow",
154 ],
155 ),
156 comments=dict(type="str"),
157 details_level=dict(type="str", choices=["uid", "standard", "full"]),
158 ignore_warnings=dict(type="bool"),
159 ignore_errors=dict(type="bool"),
160 )
161 argument_spec.update(checkpoint_argument_spec_for_objects)
162
163 module = AnsibleModule(
164 argument_spec=argument_spec, supports_check_mode=True
165 )
166 api_call_object = "threat-layer"
167
168 result = api_call(module, api_call_object)
169 module.exit_json(**result)
170
171
172 if __name__ == "__main__":
173 main()