Debian Codegraph @

ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_syslog_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_syslog_server
31 short_description: Manages syslog-server objects on Checkpoint over Web Services API
32 description:
33 - Manages syslog-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 - Host server object identified by the name or UID.
47 type: str
48 port:
49 description:
50 - Port number.
51 type: int
52 server_version:
53 description:
54 - RFC version.
55 type: str
56 choices: ['bsd', 'syslog']
57 color:
58 description:
59 - Color of the object. Should be one of existing colors.
60 type: str
61 choices: ['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', 'khaki', 'orchid', 'dark orange', 'dark sea green',
62 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon',
63 'coral', 'sea green', 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', 'yellow']
64 comments:
65 description:
66 - Comments string.
67 type: str
68 details_level:
69 description:
70 - 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
71 representation of the object.
72 type: str
73 choices: ['uid', 'standard', 'full']
74 domains_to_process:
75 description:
76 - 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
77 with ignore-warnings true. Valid values are, CURRENT_DOMAIN, ALL_DOMAINS_ON_THIS_SERVER.
78 type: list
79 elements: str
80 tags:
81 description:
82 - Collection of tag identifiers.
83 type: list
84 elements: str
85 ignore_warnings:
86 description:
87 - Apply changes ignoring warnings.
88 type: bool
89 ignore_errors:
90 description:
91 - 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.
92 type: bool
93 extends_documentation_fragment: check_point.mgmt.checkpoint_objects
94 """
95
96 EXAMPLES = """
97 - name: add-syslog-server
98 cp_mgmt_syslog_server:
99 host: syslogServerHost
100 name: newSyslogServer
101 port: 18889
102 state: present
103
104 - name: set-syslog-server
105 cp_mgmt_syslog_server:
106 name: newSyslogServer
107 port: '10101'
108 state: present
109
110 - name: delete-syslog-server
111 cp_mgmt_syslog_server:
112 name: newSyslogServer
113 state: absent
114 """
115
116 RETURN = """
117 cp_mgmt_syslog_server:
118 description: The checkpoint object created or updated.
119 returned: always, except when deleting the object.
120 type: dict
121 """
122
123 from ansible.module_utils.basic import AnsibleModule
124 from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_objects, api_call
125
126
127 def main():
128 argument_spec = dict(
129 name=dict(type='str', required=True),
130 host=dict(type='str'),
131 port=dict(type='int'),
132 server_version=dict(type='str', choices=['bsd', 'syslog']),
133 color=dict(type='str', choices=['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green',
134 'khaki', 'orchid', 'dark orange', 'dark sea green', 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown',
135 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', 'coral', 'sea green',
136 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna',
137 'yellow']),
138 comments=dict(type='str'),
139 details_level=dict(type='str', choices=['uid', 'standard', 'full']),
140 domains_to_process=dict(type='list', elements='str'),
141 tags=dict(type='list', elements='str'),
142 ignore_warnings=dict(type='bool'),
143 ignore_errors=dict(type='bool')
144 )
145 argument_spec.update(checkpoint_argument_spec_for_objects)
146
147 module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True)
148 api_call_object = 'syslog-server'
149
150 result = api_call(module, api_call_object)
151 module.exit_json(**result)
152
153
154 if __name__ == '__main__':
155 main()