Debian Codegraph @

ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_service_compound_tcp.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_service_compound_tcp
31 short_description: Manages service-compound-tcp objects on Checkpoint over Web Services API
32 description:
33 - Manages service-compound-tcp objects on Checkpoint devices including creating, updating and removing objects.
34 - All operations are performed over Web Services API.
35 - Available from R80.40 JHF management version.
36 version_added: "5.0.0"
37 author: "Eden Brillant (@chkp-edenbr)"
38 options:
39 name:
40 description:
41 - Object name.
42 type: str
43 required: True
44 compound_service:
45 description:
46 - Compound service type.
47 type: str
48 choices: ['pointcast', 'netcaster', 'backweb', 'cdf']
49 keep_connections_open_after_policy_installation:
50 description:
51 - Keep connections open after policy has been installed even if they are not allowed under the new policy. This overrides the settings in the
52 Connection Persistence page. If you change this property, the change will not affect open connections, but only future connections.
53 type: bool
54 tags:
55 description:
56 - Collection of tag identifiers.
57 type: list
58 elements: str
59 color:
60 description:
61 - Color of the object. Should be one of existing colors.
62 type: str
63 choices: ['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', 'khaki', 'orchid', 'dark orange', 'dark sea green',
64 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon',
65 'coral', 'sea green', 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', 'yellow']
66 comments:
67 description:
68 - Comments string.
69 type: str
70 details_level:
71 description:
72 - 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
73 representation of the object.
74 type: str
75 choices: ['uid', 'standard', 'full']
76 groups:
77 description:
78 - Collection of group identifiers.
79 type: list
80 elements: str
81 ignore_warnings:
82 description:
83 - Apply changes ignoring warnings.
84 type: bool
85 ignore_errors:
86 description:
87 - 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.
88 type: bool
89 extends_documentation_fragment: check_point.mgmt.checkpoint_objects
90 """
91
92 EXAMPLES = """
93 - name: add-service-compound-tcp
94 cp_mgmt_service_compound_tcp:
95 compound_service: pointcast
96 keep_connections_open_after_policy_installation: 'True'
97 name: mycompoundtcp
98 state: present
99
100 - name: set-service-compound-tcp
101 cp_mgmt_service_compound_tcp:
102 compound_service: backweb
103 keep_connections_open_after_policy_installation: 'False'
104 name: mycompoundtcp
105 state: present
106
107 - name: delete-service-compound-tcp
108 cp_mgmt_service_compound_tcp:
109 name: mycompoundtcp
110 state: absent
111 """
112
113 RETURN = """
114 cp_mgmt_service_compound_tcp:
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 checkpoint_argument_spec_for_objects, api_call
122
123
124 def main():
125 argument_spec = dict(
126 name=dict(type='str', required=True),
127 compound_service=dict(type='str', choices=['pointcast', 'netcaster', 'backweb', 'cdf']),
128 keep_connections_open_after_policy_installation=dict(type='bool'),
129 tags=dict(type='list', elements='str'),
130 color=dict(type='str', choices=['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green',
131 'khaki', 'orchid', 'dark orange', 'dark sea green', 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown',
132 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', 'coral', 'sea green',
133 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna',
134 'yellow']),
135 comments=dict(type='str'),
136 details_level=dict(type='str', choices=['uid', 'standard', 'full']),
137 groups=dict(type='list', elements='str'),
138 ignore_warnings=dict(type='bool'),
139 ignore_errors=dict(type='bool')
140 )
141 argument_spec.update(checkpoint_argument_spec_for_objects)
142
143 module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True)
144 api_call_object = 'service-compound-tcp'
145
146 result = api_call(module, api_call_object)
147 module.exit_json(**result)
148
149
150 if __name__ == '__main__':
151 main()