| 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_layer_structure |
| 31 |
short_description: Shows the entire layer structure. |
| 32 |
description: |
| 33 |
- Shows the entire layer structure. The layer structure is divided into sections and each section has its own entities. |
| 34 |
- Supported layer types include Access Control, NAT, Custom Threat Prevention, Threat Exception and HTTPS Inspection. |
| 35 |
- All operations are performed over Web Services API. |
| 36 |
- Available from R81.10 management version. |
| 37 |
version_added: "5.0.0" |
| 38 |
author: "Eden Brillant (@chkp-edenbr)" |
| 39 |
options: |
| 40 |
name: |
| 41 |
description: |
| 42 |
- Object name. Must be unique in the domain. |
| 43 |
type: str |
| 44 |
required: True |
| 45 |
package: |
| 46 |
description: |
| 47 |
- Name of the package. Must be set when want to receive the resolved rule instead of the place holder in global domain layer. |
| 48 |
type: str |
| 49 |
limit: |
| 50 |
description: |
| 51 |
- The maximal number of returned results. |
| 52 |
type: int |
| 53 |
offset: |
| 54 |
description: |
| 55 |
- Number of the results to initially skip. |
| 56 |
type: int |
| 57 |
details_level: |
| 58 |
description: |
| 59 |
- 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 |
| 60 |
representation of the object. |
| 61 |
type: str |
| 62 |
choices: ['uid', 'standard'] |
| 63 |
extends_documentation_fragment: check_point.mgmt.checkpoint_commands |
| 64 |
""" |
| 65 |
|
| 66 |
EXAMPLES = """ |
| 67 |
- name: show-layer-structure |
| 68 |
cp_mgmt_show_layer_structure: |
| 69 |
details_level: standard |
| 70 |
limit: 20 |
| 71 |
name: Network |
| 72 |
offset: 0 |
| 73 |
""" |
| 74 |
|
| 75 |
RETURN = """ |
| 76 |
cp_mgmt_show_layer_structure: |
| 77 |
description: The checkpoint show-layer-structure output. |
| 78 |
returned: always. |
| 79 |
type: dict |
| 80 |
""" |
| 81 |
|
| 82 |
from ansible.module_utils.basic import AnsibleModule |
| 83 |
from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command |
| 84 |
|
| 85 |
|
| 86 |
def main(): |
| 87 |
argument_spec = dict( |
| 88 |
name=dict(type='str', required=True), |
| 89 |
package=dict(type='str'), |
| 90 |
limit=dict(type='int'), |
| 91 |
offset=dict(type='int'), |
| 92 |
details_level=dict(type='str', choices=['uid', 'standard']) |
| 93 |
) |
| 94 |
argument_spec.update(checkpoint_argument_spec_for_commands) |
| 95 |
|
| 96 |
module = AnsibleModule(argument_spec=argument_spec) |
| 97 |
|
| 98 |
command = "show-layer-structure" |
| 99 |
|
| 100 |
result = api_command(module, command) |
| 101 |
module.exit_json(**result) |
| 102 |
|
| 103 |
|
| 104 |
if __name__ == '__main__': |
| 105 |
main() |