Debian Codegraph @

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