Debian Codegraph @

ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_application_site_group.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_application_site_group
33 short_description: Manages application-site-group objects on Check Point over Web Services API
34 description:
35 - Manages application-site-group 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 members:
47 description:
48 - Collection of application and URL filtering objects identified by the name or UID.
49 type: list
50 elements: str
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 groups:
74 description:
75 - Collection of group identifiers.
76 type: list
77 elements: str
78 ignore_warnings:
79 description:
80 - Apply changes ignoring warnings.
81 type: bool
82 ignore_errors:
83 description:
84 - 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.
85 type: bool
86 extends_documentation_fragment: check_point.mgmt.checkpoint_objects
87 """
88
89 EXAMPLES = """
90 - name: add-application-site-group
91 cp_mgmt_application_site_group:
92 members:
93 - facebook
94 - Social Networking
95 - New Application Site 1
96 - New Application Site Category 1
97 name: New Application Site Group 1
98 state: present
99
100 - name: set-application-site-group
101 cp_mgmt_application_site_group:
102 name: New Application Site Group 1
103 members:
104 - AliveProxy
105 state: present
106
107 - name: delete-application-site-group
108 cp_mgmt_application_site_group:
109 name: New Application Site Group 1
110 state: absent
111 """
112
113 RETURN = """
114 cp_mgmt_application_site_group:
115 description: The checkpoint object created or updated.
116 returned: always, except when deleting the object.
117 type: dict
118 """
119
120 from ansible.module_utils.basic import AnsibleModule
121 from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import (
122 checkpoint_argument_spec_for_objects,
123 api_call,
124 )
125
126
127 def main():
128 argument_spec = dict(
129 name=dict(type="str", required=True),
130 members=dict(type="list", elements="str"),
131 tags=dict(type="list", elements="str"),
132 color=dict(
133 type="str",
134 choices=[
135 "aquamarine",
136 "black",
137 "blue",
138 "crete blue",
139 "burlywood",
140 "cyan",
141 "dark green",
142 "khaki",
143 "orchid",
144 "dark orange",
145 "dark sea green",
146 "pink",
147 "turquoise",
148 "dark blue",
149 "firebrick",
150 "brown",
151 "forest green",
152 "gold",
153 "dark gold",
154 "gray",
155 "dark gray",
156 "light green",
157 "lemon chiffon",
158 "coral",
159 "sea green",
160 "sky blue",
161 "magenta",
162 "purple",
163 "slate blue",
164 "violet red",
165 "navy blue",
166 "olive",
167 "orange",
168 "red",
169 "sienna",
170 "yellow",
171 ],
172 ),
173 comments=dict(type="str"),
174 details_level=dict(type="str", choices=["uid", "standard", "full"]),
175 groups=dict(type="list", elements="str"),
176 ignore_warnings=dict(type="bool"),
177 ignore_errors=dict(type="bool"),
178 )
179 argument_spec.update(checkpoint_argument_spec_for_objects)
180
181 module = AnsibleModule(
182 argument_spec=argument_spec, supports_check_mode=True
183 )
184 api_call_object = "application-site-group"
185
186 result = api_call(module, api_call_object)
187 module.exit_json(**result)
188
189
190 if __name__ == "__main__":
191 main()