Debian Codegraph @

ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_where_used.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_where_used
31 short_description: Searches for usage of the target object in other objects and rules.
32 description:
33 - Searches for usage of the target object in other objects and rules.
34 - All operations are performed over Web Services API.
35 - Available from R80 management version.
36 version_added: "5.0.0"
37 author: "Eden Brillant (@chkp-edenbr)"
38 options:
39 name:
40 description:
41 - Object name.
42 type: str
43 dereference_group_members:
44 description:
45 - Indicates whether to dereference "members" field by details level for every object in reply.
46 - Available from R80.10 management version.
47 type: bool
48 show_membership:
49 description:
50 - Indicates whether to calculate and show "groups" field for every object in reply.
51 - Available from R80.10 management version.
52 type: bool
53 async_response:
54 description:
55 - Run command in asynchronous mode and return task UID. Use show-task command to check the progress of the task.
56 - Available from R81.20 management version.
57 type: bool
58 details_level:
59 description:
60 - 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
61 representation of the object.
62 type: str
63 choices: ['uid', 'standard', 'full']
64 domains_to_process:
65 description:
66 - Indicates which domains to process the commands on. It cannot be used with the details-level full, must be run from the System Domain only and
67 with ignore-warnings true. Valid values are, CURRENT_DOMAIN, ALL_DOMAINS_ON_THIS_SERVER.
68 - Available from R81 management version.
69 type: list
70 elements: str
71 indirect:
72 description:
73 - Search for indirect usage.
74 type: bool
75 indirect_max_depth:
76 description:
77 - Maximum nesting level during indirect usage search.
78 type: int
79 extends_documentation_fragment: check_point.mgmt.checkpoint_commands
80 """
81
82 EXAMPLES = """
83 - name: where-used
84 cp_mgmt_where_used:
85 name: Host 1
86 """
87
88 RETURN = """
89 cp_mgmt_where_used:
90 description: The checkpoint where-used output.
91 returned: always.
92 type: dict
93 """
94
95 from ansible.module_utils.basic import AnsibleModule
96 from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command
97
98
99 def main():
100 argument_spec = dict(
101 name=dict(type='str'),
102 dereference_group_members=dict(type='bool'),
103 show_membership=dict(type='bool'),
104 async_response=dict(type='bool'),
105 details_level=dict(type='str', choices=['uid', 'standard', 'full']),
106 domains_to_process=dict(type='list', elements='str'),
107 indirect=dict(type='bool'),
108 indirect_max_depth=dict(type='int')
109 )
110 argument_spec.update(checkpoint_argument_spec_for_commands)
111
112 module = AnsibleModule(argument_spec=argument_spec)
113
114 command = "where-used"
115
116 result = api_command(module, command)
117 module.exit_json(**result)
118
119
120 if __name__ == '__main__':
121 main()