Debian Codegraph @

ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_threat_protection_override.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_threat_protection_override
33 short_description: Edit existing object using object name or uid.
34 description:
35 - Edit existing object using object name or uid.
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 comments:
46 description:
47 - Protection comments.
48 type: str
49 follow_up:
50 description:
51 - Tag the protection with pre-defined follow-up flag.
52 type: bool
53 overrides:
54 description:
55 - Overrides per profile for this protection<br> Note, Remove override for Core protections removes only the action's override. Remove override
56 for Threat Cloud protections removes the action, track and packet captures.
57 type: list
58 elements: dict
59 suboptions:
60 action:
61 description:
62 - Protection action.
63 type: str
64 choices: ['Threat Cloud: Inactive', 'Detect', 'Prevent <br> Core: Drop', 'Inactive', 'Accept']
65 profile:
66 description:
67 - Profile name.
68 type: str
69 capture_packets:
70 description:
71 - Capture packets.
72 type: bool
73 track:
74 description:
75 - Tracking method for protection.
76 type: str
77 choices: ['none', 'log', 'alert', 'mail', 'snmp trap', 'user alert', 'user alert 1', 'user alert 2']
78 details_level:
79 description:
80 - 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
81 representation of the object.
82 type: str
83 choices: ['uid', 'standard', 'full']
84 extends_documentation_fragment: check_point.mgmt.checkpoint_commands
85 """
86
87 EXAMPLES = """
88 - name: threat_protection_override
89 cp_mgmt_threat_protection_override:
90 name: FTP Commands
91 overrides:
92 - action: inactive
93 capture_packets: true
94 profile: New Profile 1
95 track: None
96 state: present
97 """
98
99 RETURN = """
100 cp_mgmt_threat_protection_override:
101 description: The checkpoint threat_protection_override output.
102 returned: always.
103 type: dict
104 """
105
106 from ansible.module_utils.basic import AnsibleModule
107 from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import (
108 checkpoint_argument_spec_for_commands,
109 api_command,
110 )
111
112
113 def main():
114 argument_spec = dict(
115 name=dict(type="str"),
116 comments=dict(type="str"),
117 follow_up=dict(type="bool"),
118 overrides=dict(
119 type="list",
120 elements="dict",
121 options=dict(
122 action=dict(
123 type="str",
124 choices=[
125 "Threat Cloud: Inactive",
126 "Detect",
127 "Prevent <br> Core: Drop",
128 "Inactive",
129 "Accept",
130 ],
131 ),
132 profile=dict(type="str"),
133 capture_packets=dict(type="bool"),
134 track=dict(
135 type="str",
136 choices=[
137 "none",
138 "log",
139 "alert",
140 "mail",
141 "snmp trap",
142 "user alert",
143 "user alert 1",
144 "user alert 2",
145 ],
146 ),
147 ),
148 ),
149 details_level=dict(type="str", choices=["uid", "standard", "full"]),
150 )
151 argument_spec.update(checkpoint_argument_spec_for_commands)
152
153 module = AnsibleModule(argument_spec=argument_spec)
154
155 command = "set-threat-protection"
156
157 result = api_command(module, command)
158 module.exit_json(**result)
159
160
161 if __name__ == "__main__":
162 main()