Debian Codegraph @

ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_application_site_facts.py

raw
1 #!/usr/bin/python
2 # -*- coding: utf-8 -*-
3 #
4 # Ansible module to manage Check Point 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_application_site_facts
33 short_description: Get application-site objects facts on Check Point over Web Services API
34 description:
35 - Get application-site objects facts on Check Point 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 management version.
40 version_added: "1.0.0"
41 author: "Or Soffer (@chkp-orso)"
42 options:
43 name:
44 description:
45 - Object name.
46 This parameter is relevant only for getting a specific object.
47 type: str
48 application_id:
49 description:
50 - Object application identifier.
51 type: str
52 details_level:
53 description:
54 - 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
55 representation of the object.
56 type: str
57 choices: ['uid', 'standard', 'full']
58 filter:
59 description:
60 - Search expression to filter objects by. The provided text should be exactly the same as it would be given in SmartConsole Object Explorer. The
61 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
62 name, comment, tags etc.
63 - Available from R81 JHF management version.
64 type: str
65 version_added: "6.4.0"
66 limit:
67 description:
68 - No more than that many results will be returned.
69 This parameter is relevant only for getting few objects.
70 type: int
71 offset:
72 description:
73 - Skip that many results before beginning to return them.
74 This parameter is relevant only for getting few objects.
75 type: int
76 order:
77 description:
78 - Sorts results by the given field. By default the results are sorted in the ascending order by name.
79 This parameter is relevant only for getting few objects.
80 type: list
81 elements: dict
82 suboptions:
83 ASC:
84 description:
85 - Sorts results by the given field in ascending order.
86 type: str
87 choices: ['name']
88 DESC:
89 description:
90 - Sorts results by the given field in descending order.
91 type: str
92 choices: ['name']
93 show_membership:
94 description:
95 - Indicates whether to calculate and show "groups" field for every object in reply.
96 - Available from R80.10 management version.
97 type: bool
98 domains_to_process:
99 description:
100 - 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
101 with ignore-warnings true. Valid values are, CURRENT_DOMAIN, ALL_DOMAINS_ON_THIS_SERVER.
102 - Available from R81 management version.
103 type: list
104 elements: str
105 version_added: "6.4.0"
106 extends_documentation_fragment: check_point.mgmt.checkpoint_facts
107 """
108
109 EXAMPLES = """
110 - name: show-application-site
111 cp_mgmt_application_site_facts:
112 name: facebook
113
114 - name: show-application-sites
115 cp_mgmt_application_site_facts:
116 details_level: standard
117 limit: 50
118 offset: 0
119 """
120
121 RETURN = """
122 ansible_facts:
123 description: The checkpoint object facts.
124 returned: always.
125 type: dict
126 """
127
128 from ansible.module_utils.basic import AnsibleModule
129 from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import (
130 checkpoint_argument_spec_for_facts,
131 api_call_facts,
132 )
133
134
135 def main():
136 argument_spec = dict(
137 name=dict(type="str"),
138 application_id=dict(type="str"),
139 details_level=dict(type="str", choices=["uid", "standard", "full"]),
140 filter=dict(type='str'),
141 limit=dict(type="int"),
142 offset=dict(type="int"),
143 order=dict(
144 type="list",
145 elements="dict",
146 options=dict(
147 ASC=dict(type="str", choices=["name"]),
148 DESC=dict(type="str", choices=["name"]),
149 ),
150 ),
151 show_membership=dict(type="bool"),
152 domains_to_process=dict(type='list', elements="str")
153 )
154 argument_spec.update(checkpoint_argument_spec_for_facts)
155
156 module = AnsibleModule(
157 argument_spec=argument_spec, supports_check_mode=True
158 )
159
160 api_call_object = "application-site"
161 api_call_object_plural_version = "application-sites"
162
163 result = api_call_facts(
164 module, api_call_object, api_call_object_plural_version
165 )
166 module.exit_json(ansible_facts=result)
167
168
169 if __name__ == "__main__":
170 main()