Debian Codegraph @

ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_resource_mms.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_resource_mms
31 short_description: Manages resource-mms objects on Checkpoint over Web Services API
32 description:
33 - Manages resource-mms 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 track:
45 description:
46 - Logs the activity when a packet matches on a Firewall Rule with the Resource.
47 type: str
48 choices: ['none', 'log', 'popup alert', 'mail alert', 'snmp trap alert', 'user defined alert no.1', 'user defined alert no.2', 'user defined alert no.3']
49 action:
50 description:
51 - Accepts or Drops traffic that matches a Firewall Rule using the Resource.
52 type: str
53 choices: ['drop', 'accept']
54 color:
55 description:
56 - Color of the object. Should be one of existing colors.
57 type: str
58 choices: ['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', 'khaki', 'orchid', 'dark orange', 'dark sea green',
59 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon',
60 'coral', 'sea green', 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', 'yellow']
61 comments:
62 description:
63 - Comments string.
64 type: str
65 details_level:
66 description:
67 - 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
68 representation of the object.
69 type: str
70 choices: ['uid', 'standard', 'full']
71 tags:
72 description:
73 - Collection of tag identifiers.
74 type: list
75 elements: str
76 ignore_warnings:
77 description:
78 - Apply changes ignoring warnings.
79 type: bool
80 ignore_errors:
81 description:
82 - 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.
83 type: bool
84 extends_documentation_fragment: check_point.mgmt.checkpoint_objects
85 """
86
87 EXAMPLES = """
88 - name: add-resource-mms
89 cp_mgmt_resource_mms:
90 name: newMmsResource
91 state: present
92
93 - name: set-resource-mms
94 cp_mgmt_resource_mms:
95 action: drop
96 name: newMmsResource
97 state: present
98 track: popup alert
99
100 - name: delete-resource-mms
101 cp_mgmt_resource_mms:
102 name: newMmsResource
103 state: absent
104 """
105
106 RETURN = """
107 cp_mgmt_resource_mms:
108 description: The checkpoint object created or updated.
109 returned: always, except when deleting the object.
110 type: dict
111 """
112
113 from ansible.module_utils.basic import AnsibleModule
114 from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_objects, api_call
115
116
117 def main():
118 argument_spec = dict(
119 name=dict(type='str', required=True),
120 track=dict(type='str', choices=['none', 'log', 'popup alert', 'mail alert', 'snmp trap alert',
121 'user defined alert no.1', 'user defined alert no.2', 'user defined alert no.3']),
122 action=dict(type='str', choices=['drop', 'accept']),
123 color=dict(type='str', choices=['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green',
124 'khaki', 'orchid', 'dark orange', 'dark sea green', 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown',
125 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', 'coral', 'sea green',
126 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna',
127 'yellow']),
128 comments=dict(type='str'),
129 details_level=dict(type='str', choices=['uid', 'standard', 'full']),
130 tags=dict(type='list', elements='str'),
131 ignore_warnings=dict(type='bool'),
132 ignore_errors=dict(type='bool')
133 )
134 argument_spec.update(checkpoint_argument_spec_for_objects)
135
136 module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True)
137 api_call_object = 'resource-mms'
138
139 result = api_call(module, api_call_object)
140 module.exit_json(**result)
141
142
143 if __name__ == '__main__':
144 main()