Debian Codegraph @

ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_checkpoint_host_facts.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_checkpoint_host_facts
31 short_description: Get checkpoint-host objects facts on Checkpoint over Web Services API
32 description:
33 - Get checkpoint-host objects facts on Checkpoint devices.
34 - All operations are performed over Web Services API.
35 - This module handles both operations, get a specific object and get several objects,
36 For getting a specific object use the parameter 'name'.
37 - Available from R80.40 JHF management version.
38 version_added: "5.0.0"
39 author: "Eden Brillant (@chkp-edenbr)"
40 options:
41 name:
42 description:
43 - Object name.
44 This parameter is relevant only for getting a specific object.
45 type: str
46 details_level:
47 description:
48 - 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
49 representation of the object.
50 type: str
51 choices: ['uid', 'standard', 'full']
52 filter:
53 description:
54 - Search expression to filter objects by. The provided text should be exactly the same as it would be given in SmartConsole Object Explorer. The
55 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
56 name, comment, tags etc.
57 - Available from R81 JHF management version.
58 type: str
59 limit:
60 description:
61 - The maximal number of returned results.
62 This parameter is relevant only for getting few objects.
63 type: int
64 offset:
65 description:
66 - Number of the results to initially skip.
67 This parameter is relevant only for getting few objects.
68 type: int
69 order:
70 description:
71 - Sorts the results by search criteria. Automatically sorts the results by Name, in the ascending order.
72 This parameter is relevant only for getting few objects.
73 type: list
74 elements: dict
75 suboptions:
76 ASC:
77 description:
78 - Sorts results by the given field in ascending order.
79 type: str
80 choices: ['name']
81 DESC:
82 description:
83 - Sorts results by the given field in descending order.
84 type: str
85 choices: ['name']
86 show_membership:
87 description:
88 - Indicates whether to calculate and show "groups" field for every object in reply.
89 - Available from R81 JHF management version.
90 type: bool
91 domains_to_process:
92 description:
93 - 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
94 with ignore-warnings true. Valid values are, CURRENT_DOMAIN, ALL_DOMAINS_ON_THIS_SERVER.
95 - Available from R81 management version.
96 type: list
97 elements: str
98 extends_documentation_fragment: check_point.mgmt.checkpoint_facts
99 """
100
101 EXAMPLES = """
102 - name: show-checkpoint-host
103 cp_mgmt_checkpoint_host_facts:
104 name: CP Host 1
105
106 - name: show-checkpoint-hosts
107 cp_mgmt_checkpoint_host_facts:
108 limit: 10
109 """
110
111 RETURN = """
112 ansible_facts:
113 description: The checkpoint object facts.
114 returned: always.
115 type: dict
116 """
117
118 from ansible.module_utils.basic import AnsibleModule
119 from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_facts, api_call_facts
120
121
122 def main():
123 argument_spec = dict(
124 name=dict(type='str'),
125 details_level=dict(type='str', choices=['uid', 'standard', 'full']),
126 filter=dict(type='str'),
127 limit=dict(type='int'),
128 offset=dict(type='int'),
129 order=dict(type='list', elements='dict', options=dict(
130 ASC=dict(type='str', choices=['name']),
131 DESC=dict(type='str', choices=['name'])
132 )),
133 show_membership=dict(type='bool'),
134 domains_to_process=dict(type='list', elements='str')
135 )
136 argument_spec.update(checkpoint_argument_spec_for_facts)
137
138 module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True)
139
140 api_call_object = "checkpoint-host"
141 api_call_object_plural_version = "checkpoint-hosts"
142
143 result = api_call_facts(module, api_call_object, api_call_object_plural_version)
144 module.exit_json(ansible_facts=result)
145
146
147 if __name__ == '__main__':
148 main()