Debian Codegraph @

ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_service_dce_rpc.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_service_dce_rpc
33 short_description: Manages service-dce-rpc objects on Check Point over Web Services API
34 description:
35 - Manages service-dce-rpc 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 interface_uuid:
47 description:
48 - Network interface UUID.
49 type: str
50 keep_connections_open_after_policy_installation:
51 description:
52 - Keep connections open after policy has been installed even if they are not allowed under the new policy. This overrides the settings in the
53 Connection Persistence page. If you change this property, the change will not affect open connections, but only future connections.
54 type: bool
55 tags:
56 description:
57 - Collection of tag identifiers.
58 type: list
59 elements: str
60 color:
61 description:
62 - Color of the object. Should be one of existing colors.
63 type: str
64 choices: ['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', 'khaki', 'orchid', 'dark orange', 'dark sea green',
65 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon',
66 'coral', 'sea green', 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', 'yellow']
67 comments:
68 description:
69 - Comments string.
70 type: str
71 details_level:
72 description:
73 - 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
74 representation of the object.
75 type: str
76 choices: ['uid', 'standard', 'full']
77 groups:
78 description:
79 - Collection of group identifiers.
80 type: list
81 elements: str
82 ignore_warnings:
83 description:
84 - Apply changes ignoring warnings.
85 type: bool
86 ignore_errors:
87 description:
88 - 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.
89 type: bool
90 extends_documentation_fragment: check_point.mgmt.checkpoint_objects
91 """
92
93 EXAMPLES = """
94 - name: add-service-dce-rpc
95 cp_mgmt_service_dce_rpc:
96 interface_uuid: 97aeb460-9aea-11d5-bd16-0090272ccb30
97 keep_connections_open_after_policy_installation: false
98 name: New_DCE-RPC_Service_1
99 state: present
100
101 - name: set-service-dce-rpc
102 cp_mgmt_service_dce_rpc:
103 color: green
104 interface_uuid: 44aeb460-9aea-11d5-bd16-009027266b30
105 name: New_DCE-RPC_Service_1
106 state: present
107
108 - name: delete-service-dce-rpc
109 cp_mgmt_service_dce_rpc:
110 name: New_DCE-RPC_Service_2
111 state: absent
112 """
113
114 RETURN = """
115 cp_mgmt_service_dce_rpc:
116 description: The checkpoint object created or updated.
117 returned: always, except when deleting the object.
118 type: dict
119 """
120
121 from ansible.module_utils.basic import AnsibleModule
122 from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import (
123 checkpoint_argument_spec_for_objects,
124 api_call,
125 )
126
127
128 def main():
129 argument_spec = dict(
130 name=dict(type="str", required=True),
131 interface_uuid=dict(type="str"),
132 keep_connections_open_after_policy_installation=dict(type="bool"),
133 tags=dict(type="list", elements="str"),
134 color=dict(
135 type="str",
136 choices=[
137 "aquamarine",
138 "black",
139 "blue",
140 "crete blue",
141 "burlywood",
142 "cyan",
143 "dark green",
144 "khaki",
145 "orchid",
146 "dark orange",
147 "dark sea green",
148 "pink",
149 "turquoise",
150 "dark blue",
151 "firebrick",
152 "brown",
153 "forest green",
154 "gold",
155 "dark gold",
156 "gray",
157 "dark gray",
158 "light green",
159 "lemon chiffon",
160 "coral",
161 "sea green",
162 "sky blue",
163 "magenta",
164 "purple",
165 "slate blue",
166 "violet red",
167 "navy blue",
168 "olive",
169 "orange",
170 "red",
171 "sienna",
172 "yellow",
173 ],
174 ),
175 comments=dict(type="str"),
176 details_level=dict(type="str", choices=["uid", "standard", "full"]),
177 groups=dict(type="list", elements="str"),
178 ignore_warnings=dict(type="bool"),
179 ignore_errors=dict(type="bool"),
180 )
181 argument_spec.update(checkpoint_argument_spec_for_objects)
182
183 module = AnsibleModule(
184 argument_spec=argument_spec, supports_check_mode=True
185 )
186 api_call_object = "service-dce-rpc"
187
188 result = api_call(module, api_call_object)
189 module.exit_json(**result)
190
191
192 if __name__ == "__main__":
193 main()