| 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_show_changes |
| 31 |
short_description: Show changes between two sessions. |
| 32 |
description: |
| 33 |
- Show changes between two sessions. |
| 34 |
- All operations are performed over Web Services API. |
| 35 |
- Available from R80.10 management version. |
| 36 |
version_added: "5.0.0" |
| 37 |
author: "Eden Brillant (@chkp-edenbr)" |
| 38 |
options: |
| 39 |
from_date: |
| 40 |
description: |
| 41 |
- The date from which tracking changes is to be performed. ISO 8601. If timezone isn't specified in the input, the Management server's timezone is used. |
| 42 |
type: str |
| 43 |
from_session: |
| 44 |
description: |
| 45 |
- The session UID from which tracking changes is to be performed. |
| 46 |
type: str |
| 47 |
limit: |
| 48 |
description: |
| 49 |
- Maximum number of sessions to analyze. |
| 50 |
type: int |
| 51 |
offset: |
| 52 |
description: |
| 53 |
- Number of sessions to skip (beginning with from-session). |
| 54 |
type: int |
| 55 |
to_date: |
| 56 |
description: |
| 57 |
- The date until which tracking changes is to be performed. ISO 8601. If timezone isn't specified in the input, the Management server's timezone is used. |
| 58 |
type: str |
| 59 |
to_session: |
| 60 |
description: |
| 61 |
- The session UID until which tracking changes is to be performed. |
| 62 |
type: str |
| 63 |
dereference_group_members: |
| 64 |
description: |
| 65 |
- Indicates whether to dereference "members" field by details level for every object in reply. |
| 66 |
type: bool |
| 67 |
show_membership: |
| 68 |
description: |
| 69 |
- Indicates whether to calculate and show "groups" field for every object in reply. |
| 70 |
type: bool |
| 71 |
dereference_max_depth: |
| 72 |
description: |
| 73 |
- When details level is full you can choose the number of levels in the API reply. |
| 74 |
type: int |
| 75 |
details_level: |
| 76 |
description: |
| 77 |
- 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 |
| 78 |
representation of the object. |
| 79 |
type: str |
| 80 |
choices: ['uid', 'standard', 'full'] |
| 81 |
extends_documentation_fragment: check_point.mgmt.checkpoint_commands |
| 82 |
""" |
| 83 |
|
| 84 |
EXAMPLES = """ |
| 85 |
- name: show-changes |
| 86 |
cp_mgmt_show_changes: |
| 87 |
from_date: '2017-02-01T08:20:50' |
| 88 |
to_date: '2017-02-21' |
| 89 |
""" |
| 90 |
|
| 91 |
RETURN = """ |
| 92 |
cp_mgmt_show_changes: |
| 93 |
description: The checkpoint show-changes output. |
| 94 |
returned: always. |
| 95 |
type: dict |
| 96 |
""" |
| 97 |
|
| 98 |
from ansible.module_utils.basic import AnsibleModule |
| 99 |
from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command |
| 100 |
|
| 101 |
|
| 102 |
def main(): |
| 103 |
argument_spec = dict( |
| 104 |
from_date=dict(type='str'), |
| 105 |
from_session=dict(type='str'), |
| 106 |
limit=dict(type='int'), |
| 107 |
offset=dict(type='int'), |
| 108 |
to_date=dict(type='str'), |
| 109 |
to_session=dict(type='str'), |
| 110 |
dereference_group_members=dict(type='bool'), |
| 111 |
show_membership=dict(type='bool'), |
| 112 |
dereference_max_depth=dict(type='int'), |
| 113 |
details_level=dict(type='str', choices=['uid', 'standard', 'full']) |
| 114 |
) |
| 115 |
argument_spec.update(checkpoint_argument_spec_for_commands) |
| 116 |
|
| 117 |
module = AnsibleModule(argument_spec=argument_spec) |
| 118 |
|
| 119 |
command = "show-changes" |
| 120 |
|
| 121 |
result = api_command(module, command) |
| 122 |
module.exit_json(**result) |
| 123 |
|
| 124 |
|
| 125 |
if __name__ == '__main__': |
| 126 |
main() |