Debian Codegraph @

ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_securemote_dns_server.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 = {'metadata_version': '1.1',
25 'status': ['preview'],
26 'supported_by': 'community'}
27
28 DOCUMENTATION = """
29 ---
30 module: cp_mgmt_securemote_dns_server
31 short_description: Manages securemote-dns-server objects on Checkpoint over Web Services API
32 description:
33 - Manages securemote-dns-server objects on Checkpoint devices including creating, updating and removing objects.
34 - All operations are performed over Web Services API.
35 - Available from R82 JHF management version.
36 version_added: "6.5.0"
37 author: "Dor Berenstein (@chkp-dorbe)"
38 options:
39 name:
40 description:
41 - Object name.
42 type: str
43 required: True
44 host:
45 description:
46 - DNS server for remote clients in the Remote access community. Identified by name or UID.
47 type: str
48 domains:
49 description:
50 - The DNS domains that the remote clients can access.
51 type: list
52 elements: dict
53 suboptions:
54 domain_suffix:
55 description:
56 - DNS Domain suffix.
57 type: str
58 maximum_prefix_label_count:
59 description:
60 - Maximum number of matching labels preceding the suffix.
61 type: int
62 color:
63 description:
64 - Color of the object. Should be one of existing colors.
65 type: str
66 choices: ['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', 'khaki', 'orchid', 'dark orange', 'dark sea green',
67 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon',
68 'coral', 'sea green', 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', 'yellow']
69 comments:
70 description:
71 - Comments string.
72 type: str
73 details_level:
74 description:
75 - 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
76 representation of the object.
77 type: str
78 choices: ['uid', 'standard', 'full']
79 domains_to_process:
80 description:
81 - Indicates which domains to process the commands on. It cannot be used with the details-level full, must be run from the System Domain only and
82 with ignore-warnings true. Valid values are, CURRENT_DOMAIN, ALL_DOMAINS_ON_THIS_SERVER.
83 type: list
84 elements: str
85 tags:
86 description:
87 - Collection of tag identifiers.
88 type: list
89 elements: str
90 ignore_warnings:
91 description:
92 - Apply changes ignoring warnings.
93 type: bool
94 ignore_errors:
95 description:
96 - 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.
97 type: bool
98 extends_documentation_fragment: check_point.mgmt.checkpoint_objects
99 """
100
101 EXAMPLES = """
102 - name: add-securemote-dns-server
103 cp_mgmt_securemote_dns_server:
104 domains:
105 - domain_suffix: .FirstDomain
106 maximum_prefix_label_count: 3
107 - domain_suffix: .SecondDomain
108 host: TestHost
109 name: TestSecuRemoteDNSSever
110 state: present
111
112 - name: set-securemote-dns-server
113 cp_mgmt_securemote_dns_server:
114 host: TestHost2
115 name: TestSecuRemoteDNSSever
116 state: present
117
118 - name: delete-securemote-dns-server
119 cp_mgmt_securemote_dns_server:
120 name: TestSecuRemoteDNSSever
121 state: absent
122 """
123
124 RETURN = """
125 cp_mgmt_securemote_dns_server:
126 description: The checkpoint object created or updated.
127 returned: always, except when deleting the object.
128 type: dict
129 """
130
131 from ansible.module_utils.basic import AnsibleModule
132 from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_objects, api_call
133
134
135 def main():
136 argument_spec = dict(
137 name=dict(type='str', required=True),
138 host=dict(type='str'),
139 domains=dict(type='list', elements="dict", options=dict(
140 domain_suffix=dict(type='str'),
141 maximum_prefix_label_count=dict(type='int')
142 )),
143 color=dict(type='str', choices=['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green',
144 'khaki', 'orchid', 'dark orange', 'dark sea green', 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown',
145 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', 'coral', 'sea green',
146 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna',
147 'yellow']),
148 comments=dict(type='str'),
149 details_level=dict(type='str', choices=['uid', 'standard', 'full']),
150 domains_to_process=dict(type='list', elements='str'),
151 tags=dict(type='list', elements='str'),
152 ignore_warnings=dict(type='bool'),
153 ignore_errors=dict(type='bool')
154 )
155 argument_spec.update(checkpoint_argument_spec_for_objects)
156
157 module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True)
158 api_call_object = 'securemote-dns-server'
159
160 result = api_call(module, api_call_object)
161 module.exit_json(**result)
162
163
164 if __name__ == '__main__':
165 main()