Debian Codegraph @

ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_show_unused_objects.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_show_unused_objects
31 short_description: Retrieve all unused objects.
32 description:
33 - Retrieve all unused objects.
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 filter:
40 description:
41 - Search expression to filter objects by. The provided text should be exactly the same as it would be given in SmartConsole Object Explorer. The
42 logical operators in the expression ('AND', 'OR') should be provided in capital letters. The search involves both a IP search and a textual search in
43 name, comment, tags etc.
44 - Available from R81 JHF management version.
45 type: str
46 limit:
47 description:
48 - The maximal number of returned results.
49 This parameter is relevant only for getting few objects.
50 type: int
51 offset:
52 description:
53 - Number of the results to initially skip.
54 This parameter is relevant only for getting few objects.
55 type: int
56 order:
57 description:
58 - Sorts the results by search criteria. Automatically sorts the results by Name, in the ascending order.
59 This parameter is relevant only for getting few objects.
60 type: list
61 elements: dict
62 suboptions:
63 ASC:
64 description:
65 - Sorts results by the given field in ascending order.
66 type: str
67 choices: ['name']
68 DESC:
69 description:
70 - Sorts results by the given field in descending order.
71 type: str
72 choices: ['name']
73 dereference_group_members:
74 description:
75 - Indicates whether to dereference "members" field by details level for every object in reply.
76 - Available from R80.10 management version.
77 type: bool
78 show_membership:
79 description:
80 - Indicates whether to calculate and show "groups" field for every object in reply.
81 - Available from R80.10 management version.
82 type: bool
83 details_level:
84 description:
85 - 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
86 representation of the object.
87 type: str
88 choices: ['uid', 'standard', 'full']
89 domains_to_process:
90 description:
91 - 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
92 with ignore-warnings true. Valid values are, CURRENT_DOMAIN, ALL_DOMAINS_ON_THIS_SERVER.
93 - Available from R81 management version.
94 type: list
95 elements: str
96 extends_documentation_fragment: check_point.mgmt.checkpoint_commands
97 """
98
99 EXAMPLES = """
100 - name: show-unused-objects
101 cp_mgmt_show_unused_objects:
102 details_level: standard
103 limit: 50
104 offset: 0
105 """
106
107 RETURN = """
108 cp_mgmt_show_unused_objects:
109 description: The checkpoint show-unused-objects output.
110 returned: always.
111 type: dict
112 """
113
114 from ansible.module_utils.basic import AnsibleModule
115 from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command
116
117
118 def main():
119 argument_spec = dict(
120 filter=dict(type='str'),
121 limit=dict(type='int'),
122 offset=dict(type='int'),
123 order=dict(type='list', elements='dict', options=dict(
124 ASC=dict(type='str', choices=['name']),
125 DESC=dict(type='str', choices=['name'])
126 )),
127 dereference_group_members=dict(type='bool'),
128 show_membership=dict(type='bool'),
129 details_level=dict(type='str', choices=['uid', 'standard', 'full']),
130 domains_to_process=dict(type='list', elements='str')
131 )
132 argument_spec.update(checkpoint_argument_spec_for_commands)
133
134 module = AnsibleModule(argument_spec=argument_spec)
135
136 command = "show-unused-objects"
137
138 result = api_command(module, command)
139 module.exit_json(**result)
140
141
142 if __name__ == '__main__':
143 main()