Debian Codegraph @

ansible_collections/cisco/intersight/plugins/modules/intersight_uuid_pool_info.py

raw
1 #!/usr/bin/python
2 # -*- coding: utf-8 -*-
3
4 # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
5
6 from __future__ import absolute_import, division, print_function
7 __metaclass__ = type
8
9 ANSIBLE_METADATA = {'metadata_version': '1.1',
10 'status': ['preview'],
11 'supported_by': 'community'}
12
13 DOCUMENTATION = r'''
14 ---
15 module: intersight_uuid_pool_info
16 short_description: Gather information about UUID Pool in Cisco Intersight
17 description:
18 - Gather information about UUID Pool in L(Cisco Intersight,https://intersight.com).
19 - Information can be filtered using Organization and Name. if none is passed all information regarding existing
20 uuid pools will be fetched.
21 extends_documentation_fragment: intersight
22 options:
23 organization:
24 description:
25 - The name of the organization that will have information gathered from.
26 type: str
27 name:
28 description:
29 - The name of the UUID Pool that will have information gathered from.
30 type: str
31 author:
32 - Shahar Golshani (@sgolshan)
33 '''
34
35 EXAMPLES = r'''
36 - name: Fetch uuid pool information by name
37 cisco.intersight.intersight_uuid_pool_info:
38 api_private_key: "{{ api_private_key }}"
39 api_key_id: "{{ api_key_id }}"
40 name: lab-uuid-pool
41
42 - name: Fetch all uuid pool information
43 cisco.intersight.intersight_uuid_pool_info:
44 api_private_key: "{{ api_private_key }}"
45 api_key_id: "{{ api_key_id }}"
46 '''
47
48 RETURN = r'''
49 api_response:
50 description: The API response output returned by the specified resource.
51 returned: always
52 type: dict
53 sample:
54 "api_response": [
55 {
56 "Name": "lab-uuid-pool",
57 "ObjectType": "uuidpool.Pool",
58 "Description": "UUID Pool for lab use",
59 "Prefix": "550E8400-E29B-41D4",
60 "UuidSuffixBlocks": [
61 {
62 "From": "A716-446655440000",
63 "Size": 100
64 },
65 {
66 "From": "A716-446655441000",
67 "Size": 200
68 }
69 ],
70 "Size": 300,
71 "Assigned": 0,
72 "Reserved": 0,
73 "Tags": [
74 {
75 "Key": "Site",
76 "Value": "RCDN"
77 }
78 ]
79 }
80 ]
81 '''
82
83
84 from ansible.module_utils.basic import AnsibleModule
85 from ansible_collections.cisco.intersight.plugins.module_utils.intersight import IntersightModule, intersight_argument_spec
86
87
88 def main():
89 argument_spec = intersight_argument_spec.copy()
90 argument_spec.update(
91 organization=dict(type='str'),
92 name=dict(type='str')
93 )
94 module = AnsibleModule(
95 argument_spec,
96 supports_check_mode=True,
97 )
98
99 intersight = IntersightModule(module)
100 intersight.result['api_response'] = {}
101 intersight.result['trace_id'] = ''
102
103 # Resource path used to fetch info
104 resource_path = '/uuidpool/Pools'
105
106 query_params = intersight.set_query_params()
107
108 intersight.get_resource(
109 resource_path=resource_path,
110 query_params=query_params,
111 return_list=True
112 )
113
114 module.exit_json(**intersight.result)
115
116
117 if __name__ == '__main__':
118 main()