Debian Codegraph @

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