Debian Codegraph @

ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_override_categorization.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_override_categorization
31 short_description: Manages override-categorization objects on Checkpoint over Web Services API
32 description:
33 - Manages override-categorization objects on Checkpoint devices including creating, updating and removing objects.
34 - All operations are performed over Web Services API.
35 - Available from R82 management version.
36 version_added: "6.0.0"
37 author: "Eden Brillant (@chkp-edenbr)"
38 options:
39 url:
40 description:
41 - The URL for which we want to update the category and risk definitions, the URL and the object name are the same for Override Categorization.
42 type: str
43 required: True
44 url_defined_as_regular_expression:
45 description:
46 - States whether the URL is defined as a Regular Expression or not.
47 type: bool
48 new_primary_category:
49 description:
50 - Uid or name of the primary category based on its most defining aspect.
51 type: str
52 risk:
53 description:
54 - States the override categorization risk.
55 type: str
56 choices: ['unknown', 'very_low', 'low', 'medium', 'high', 'critical']
57 additional_categories:
58 description:
59 - Uid or name of the categories to override in the Application and URL Filtering or Threat Prevention.
60 type: list
61 elements: str
62 tags:
63 description:
64 - Collection of tag identifiers.
65 type: list
66 elements: str
67 color:
68 description:
69 - Color of the object. Should be one of existing colors.
70 type: str
71 choices: ['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', 'khaki', 'orchid', 'dark orange', 'dark sea green',
72 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon',
73 'coral', 'sea green', 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', 'yellow']
74 comments:
75 description:
76 - Comments string.
77 type: str
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 ignore_warnings:
85 description:
86 - Apply changes ignoring warnings.
87 type: bool
88 ignore_errors:
89 description:
90 - 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.
91 type: bool
92 new_url:
93 description:
94 - New name of the object.
95 type: str
96 extends_documentation_fragment: check_point.mgmt.checkpoint_objects
97 """
98
99 EXAMPLES = """
100 - name: add-override-categorization
101 cp_mgmt_override_categorization:
102 new_primary_category: Botnets
103 risk: low
104 state: present
105 url: newOverride
106
107 - name: set-override-categorization
108 cp_mgmt_override_categorization:
109 risk: high
110 state: present
111 url: newOverride
112
113 - name: delete-override-categorization
114 cp_mgmt_override_categorization:
115 state: absent
116 url: newOverride
117 """
118
119 RETURN = """
120 cp_mgmt_override_categorization:
121 description: The checkpoint object created or updated.
122 returned: always, except when deleting the object.
123 type: dict
124 """
125
126 from ansible.module_utils.basic import AnsibleModule
127 from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_objects, api_call
128
129
130 def main():
131 argument_spec = dict(
132 url=dict(type='str', required=True),
133 url_defined_as_regular_expression=dict(type='bool'),
134 new_primary_category=dict(type='str'),
135 risk=dict(type='str', choices=['unknown', 'very_low', 'low', 'medium', 'high', 'critical']),
136 additional_categories=dict(type='list', elements='str'),
137 tags=dict(type='list', elements='str'),
138 color=dict(type='str', choices=['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green',
139 'khaki', 'orchid', 'dark orange', 'dark sea green', 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown',
140 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', 'coral', 'sea green',
141 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna',
142 'yellow']),
143 comments=dict(type='str'),
144 details_level=dict(type='str', choices=['uid', 'standard', 'full']),
145 ignore_warnings=dict(type='bool'),
146 ignore_errors=dict(type='bool'),
147 new_url=dict(type='str')
148 )
149 argument_spec.update(checkpoint_argument_spec_for_objects)
150
151 module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True)
152 api_call_object = 'override-categorization'
153
154 result = api_call(module, api_call_object)
155 module.exit_json(**result)
156
157
158 if __name__ == '__main__':
159 main()