Debian Codegraph @

ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_get_interfaces.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_get_interfaces
31 short_description: Get physical interfaces with or without their topology from a Gaia Security Gateway or Cluster.
32 description:
33 - Get physical interfaces with or without their topology from a Gaia Security Gateway or Cluster.
34 - The fetched topology is based on static routes.
35 - SIC must be established in the Security Gateway or Cluster Member object.
36 - Security Gateway or Cluster Members must be up and running.
37 - All operations are performed over Web Services API.
38 - Available from R81 management version.
39 version_added: "5.0.0"
40 author: "Eden Brillant (@chkp-edenbr)"
41 options:
42 target_name:
43 description:
44 - Target name.
45 type: str
46 group_interfaces_by_subnet:
47 description:
48 - Specify whether to group the cluster interfaces by a subnet.
49 Otherwise, group the cluster interfaces by their names.
50 type: bool
51 use_defined_by_routes:
52 description:
53 - Specify whether to configure the topology "Defined by Routes" where applicable.
54 Otherwise, configure the topology to "This Network" as default for internal interfaces.
55 type: bool
56 with_topology:
57 description:
58 - Specify whether to fetch the interfaces with their topology. Otherwise, the Management Server fetches
59 the interfaces without their topology.
60 type: bool
61 extends_documentation_fragment: check_point.mgmt.checkpoint_commands
62 """
63
64 EXAMPLES = """
65 - name: get-interfaces
66 cp_mgmt_get_interfaces:
67 target_name: gw1
68 with_topology: true
69 """
70
71 RETURN = """
72 cp_mgmt_get_interfaces:
73 description: The checkpoint get-interfaces output.
74 returned: always.
75 type: dict
76 """
77
78 from ansible.module_utils.basic import AnsibleModule
79 from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command
80
81
82 def main():
83 argument_spec = dict(
84 target_name=dict(type='str'),
85 group_interfaces_by_subnet=dict(type='bool'),
86 use_defined_by_routes=dict(type='bool'),
87 with_topology=dict(type='bool')
88 )
89 argument_spec.update(checkpoint_argument_spec_for_commands)
90
91 module = AnsibleModule(argument_spec=argument_spec)
92
93 command = "get-interfaces"
94
95 result = api_command(module, command)
96 module.exit_json(**result)
97
98
99 if __name__ == '__main__':
100 main()