Debian Codegraph @

ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_service_icmp6.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_service_icmp6
33 short_description: Manages service-icmp6 objects on Check Point over Web Services API
34 description:
35 - Manages service-icmp6 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 icmp_code:
47 description:
48 - As listed in, <a href="http,//www.iana.org/assignments/icmp-parameters" target="_blank">RFC 792</a>.
49 type: int
50 icmp_type:
51 description:
52 - As listed in, <a href="http,//www.iana.org/assignments/icmp-parameters" target="_blank">RFC 792</a>.
53 type: int
54 keep_connections_open_after_policy_installation:
55 description:
56 - Keep connections open after policy has been installed even if they are not allowed under the new policy. This overrides the settings in the
57 Connection Persistence page. If you change this property, the change will not affect open connections, but only future connections.
58 type: bool
59 tags:
60 description:
61 - Collection of tag identifiers.
62 type: list
63 elements: str
64 color:
65 description:
66 - Color of the object. Should be one of existing colors.
67 type: str
68 choices: ['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', 'khaki', 'orchid', 'dark orange', 'dark sea green',
69 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon',
70 'coral', 'sea green', 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', 'yellow']
71 comments:
72 description:
73 - Comments string.
74 type: str
75 details_level:
76 description:
77 - 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
78 representation of the object.
79 type: str
80 choices: ['uid', 'standard', 'full']
81 groups:
82 description:
83 - Collection of group identifiers.
84 type: list
85 elements: str
86 ignore_warnings:
87 description:
88 - Apply changes ignoring warnings.
89 type: bool
90 ignore_errors:
91 description:
92 - 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.
93 type: bool
94 extends_documentation_fragment: check_point.mgmt.checkpoint_objects
95 """
96
97 EXAMPLES = """
98 - name: add-service-icmp6
99 cp_mgmt_service_icmp6:
100 icmp_code: 7
101 icmp_type: 5
102 name: Icmp1
103 state: present
104
105 - name: set-service-icmp6
106 cp_mgmt_service_icmp6:
107 icmp_code: 13
108 icmp_type: 45
109 name: icmp1
110 state: present
111
112 - name: delete-service-icmp6
113 cp_mgmt_service_icmp6:
114 name: icmp2
115 state: absent
116 """
117
118 RETURN = """
119 cp_mgmt_service_icmp6:
120 description: The checkpoint object created or updated.
121 returned: always, except when deleting the object.
122 type: dict
123 """
124
125 from ansible.module_utils.basic import AnsibleModule
126 from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import (
127 checkpoint_argument_spec_for_objects,
128 api_call,
129 )
130
131
132 def main():
133 argument_spec = dict(
134 name=dict(type="str", required=True),
135 icmp_code=dict(type="int"),
136 icmp_type=dict(type="int"),
137 keep_connections_open_after_policy_installation=dict(type="bool"),
138 tags=dict(type="list", elements="str"),
139 color=dict(
140 type="str",
141 choices=[
142 "aquamarine",
143 "black",
144 "blue",
145 "crete blue",
146 "burlywood",
147 "cyan",
148 "dark green",
149 "khaki",
150 "orchid",
151 "dark orange",
152 "dark sea green",
153 "pink",
154 "turquoise",
155 "dark blue",
156 "firebrick",
157 "brown",
158 "forest green",
159 "gold",
160 "dark gold",
161 "gray",
162 "dark gray",
163 "light green",
164 "lemon chiffon",
165 "coral",
166 "sea green",
167 "sky blue",
168 "magenta",
169 "purple",
170 "slate blue",
171 "violet red",
172 "navy blue",
173 "olive",
174 "orange",
175 "red",
176 "sienna",
177 "yellow",
178 ],
179 ),
180 comments=dict(type="str"),
181 details_level=dict(type="str", choices=["uid", "standard", "full"]),
182 groups=dict(type="list", elements="str"),
183 ignore_warnings=dict(type="bool"),
184 ignore_errors=dict(type="bool"),
185 )
186 argument_spec.update(checkpoint_argument_spec_for_objects)
187
188 module = AnsibleModule(
189 argument_spec=argument_spec, supports_check_mode=True
190 )
191 api_call_object = "service-icmp6"
192
193 result = api_call(module, api_call_object)
194 module.exit_json(**result)
195
196
197 if __name__ == "__main__":
198 main()