Debian Codegraph @

ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_set_domain.py

raw
1 #!/usr/bin/python
2 # -*- coding: utf-8 -*-
3 #
4 # Ansible module to manage CheckPoint 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_set_domain
33 short_description: Edit existing object using object name or uid.
34 description:
35 - Edit existing object using object name or uid.
36 - All operations are performed over Web Services API.
37 - Available from R80 management version.
38 version_added: "2.1.0"
39 author: "Or Soffer (@chkp-orso)"
40 options:
41 name:
42 description:
43 - Object name.
44 type: str
45 required: True
46 servers:
47 description:
48 - Domain servers. When this field is provided, 'set-domain' command is executed asynchronously.
49 type: dict
50 suboptions:
51 add:
52 description:
53 - Adds to collection of values
54 type: list
55 elements: dict
56 suboptions:
57 name:
58 description:
59 - Object name. Must be unique in the domain.
60 type: str
61 ip_address:
62 description:
63 - IPv4 or IPv6 address. If both addresses are required use ipv4-address and ipv6-address fields explicitly.
64 type: str
65 ipv4_address:
66 description:
67 - IPv4 address.
68 type: str
69 ipv6_address:
70 description:
71 - IPv6 address.
72 type: str
73 multi_domain_server:
74 description:
75 - Multi Domain server name or UID.
76 type: str
77 skip_start_domain_server:
78 description:
79 - Set this value to be true to prevent starting the new created domain.
80 type: bool
81 type:
82 description:
83 - Domain server type.
84 type: str
85 choices: ['management server', 'log server', 'smc']
86 remove:
87 description:
88 - Remove from collection of values
89 type: list
90 elements: str
91 suboptions:
92 name:
93 description:
94 - Object name. Must be unique in the domain.
95 type: str
96 color:
97 description:
98 - Color of the object. Should be one of existing colors.
99 type: str
100 choices: ['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', 'khaki', 'orchid', 'dark orange', 'dark sea green',
101 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon',
102 'coral', 'sea green', 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', 'yellow']
103 comments:
104 description:
105 - Comments string.
106 type: str
107 details_level:
108 description:
109 - 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
110 representation of the object.
111 type: str
112 choices: ['uid', 'standard', 'full']
113 ignore_warnings:
114 description:
115 - Apply changes ignoring warnings.
116 type: bool
117 ignore_errors:
118 description:
119 - 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.
120 type: bool
121 tags:
122 description:
123 - Collection of tag identifiers. Note, The list of tags can not be modified in a single command together with the domain servers. To modify
124 tags, please use the separate 'set-domain' command, without providing the list of domain servers.
125 type: list
126 elements: str
127 extends_documentation_fragment: check_point.mgmt.checkpoint_commands
128 """
129
130 EXAMPLES = """
131 - name: set-domain
132 cp_mgmt_set_domain:
133 comments: This is domain1 comment
134 name: domain1
135 """
136
137 RETURN = """
138 cp_mgmt_domain:
139 description: The checkpoint set-domain output.
140 returned: always.
141 type: dict
142 """
143
144 from ansible.module_utils.basic import AnsibleModule
145 from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import (
146 checkpoint_argument_spec_for_commands,
147 api_command,
148 )
149
150
151 def main():
152 argument_spec = dict(
153 name=dict(type="str", required=True),
154 servers=dict(
155 type="dict",
156 options=dict(
157 add=dict(
158 type="list",
159 elements="dict",
160 options=dict(
161 name=dict(type="str"),
162 ip_address=dict(type="str"),
163 ipv4_address=dict(type="str"),
164 ipv6_address=dict(type="str"),
165 multi_domain_server=dict(type="str"),
166 skip_start_domain_server=dict(type="bool"),
167 type=dict(
168 type="str",
169 choices=["management server", "log server", "smc"],
170 ),
171 ),
172 ),
173 remove=dict(type="list", elements="str"),
174 ),
175 ),
176 color=dict(
177 type="str",
178 choices=[
179 "aquamarine",
180 "black",
181 "blue",
182 "crete blue",
183 "burlywood",
184 "cyan",
185 "dark green",
186 "khaki",
187 "orchid",
188 "dark orange",
189 "dark sea green",
190 "pink",
191 "turquoise",
192 "dark blue",
193 "firebrick",
194 "brown",
195 "forest green",
196 "gold",
197 "dark gold",
198 "gray",
199 "dark gray",
200 "light green",
201 "lemon chiffon",
202 "coral",
203 "sea green",
204 "sky blue",
205 "magenta",
206 "purple",
207 "slate blue",
208 "violet red",
209 "navy blue",
210 "olive",
211 "orange",
212 "red",
213 "sienna",
214 "yellow",
215 ],
216 ),
217 comments=dict(type="str"),
218 details_level=dict(type="str", choices=["uid", "standard", "full"]),
219 ignore_warnings=dict(type="bool"),
220 ignore_errors=dict(type="bool"),
221 tags=dict(type="list", elements="str"),
222 )
223 argument_spec.update(checkpoint_argument_spec_for_commands)
224
225 module = AnsibleModule(argument_spec=argument_spec)
226 command = "set-domain"
227
228 result = api_command(module, command)
229 module.exit_json(**result)
230
231
232 if __name__ == "__main__":
233 main()