Debian Codegraph @

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