Debian Codegraph @

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

raw symbols SCIP
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_fibre_channel_qos_policy_info
16 short_description: Gather information about Fibre Channel QoS Policies in Cisco Intersight
17 description:
18 - Retrieve information about Fibre Channel QoS Policies from L(Cisco Intersight,https://intersight.com).
19 - Query policies by organization or policy name.
20 - Returns structured data with policy metadata and Fibre Channel QoS configuration details.
21 - If no filters are provided, all Fibre Channel QoS Policies will be returned.
22 extends_documentation_fragment: intersight
23 options:
24 organization:
25 description:
26 - The name of the organization to filter Fibre Channel QoS Policies by.
27 - Use 'default' for the default organization.
28 - When specified, only policies from this organization will be returned.
29 type: str
30 name:
31 description:
32 - The exact name of the Fibre Channel QoS Policy to retrieve information from.
33 - When specified, only the matching policy will be returned.
34 type: str
35 author:
36 - Ron Gershburg (@rgershbu)
37 '''
38
39 EXAMPLES = r'''
40 # Basic Usage Examples
41 - name: Fetch all Fibre Channel QoS Policies from all organizations
42 cisco.intersight.intersight_fibre_channel_qos_policy_info:
43 api_private_key: "{{ api_private_key }}"
44 api_key_id: "{{ api_key_id }}"
45 register: all_fc_qos_policies
46
47 # Organization-specific Examples
48 - name: Fetch all Fibre Channel QoS Policies from the default organization
49 cisco.intersight.intersight_fibre_channel_qos_policy_info:
50 api_private_key: "{{ api_private_key }}"
51 api_key_id: "{{ api_key_id }}"
52 organization: "default"
53 register: default_org_policies
54
55 - name: Fetch all Fibre Channel QoS Policies from a custom organization
56 cisco.intersight.intersight_fibre_channel_qos_policy_info:
57 api_private_key: "{{ api_private_key }}"
58 api_key_id: "{{ api_key_id }}"
59 organization: "Engineering"
60 register: engineering_policies
61
62 # Specific Policy Examples
63 - name: Fetch a specific Fibre Channel QoS Policy by name
64 cisco.intersight.intersight_fibre_channel_qos_policy_info:
65 api_private_key: "{{ api_private_key }}"
66 api_key_id: "{{ api_key_id }}"
67 name: "fc-qos-policy-01"
68 register: specific_policy
69
70 - name: Fetch a specific policy from a specific organization
71 cisco.intersight.intersight_fibre_channel_qos_policy_info:
72 api_private_key: "{{ api_private_key }}"
73 api_key_id: "{{ api_key_id }}"
74 organization: "Production"
75 name: "fc-qos-policy-prod"
76 register: specific_org_policy
77 '''
78
79 RETURN = r'''
80 api_response:
81 description:
82 - The API response containing Fibre Channel QoS Policy information.
83 - Returns a list.
84 returned: always
85 type: list
86 sample:
87 [
88 {
89 "Name": "fc-qos-policy-01",
90 "ObjectType": "vnic.FcQosPolicy",
91 "Moid": "1234567890abcdef12345678",
92 "Description": "Fibre Channel QoS policy for production servers",
93 "RateLimit": 10000,
94 "MaxDataFieldSize": 2048,
95 "Cos": 5,
96 "Burst": 20480,
97 "Organization": {
98 "Name": "default",
99 "ObjectType": "organization.Organization",
100 "Moid": "abcdef1234567890abcdef12"
101 },
102 "Tags": [
103 {
104 "Key": "Environment",
105 "Value": "Production"
106 },
107 {
108 "Key": "Owner",
109 "Value": "Storage-Team"
110 }
111 ]
112 }
113 ]
114 '''
115
116
117 from ansible.module_utils.basic import AnsibleModule
118 from ansible_collections.cisco.intersight.plugins.module_utils.intersight import IntersightModule, intersight_argument_spec
119
120
121 def main():
122 argument_spec = intersight_argument_spec.copy()
123 argument_spec.update(
124 organization=dict(type='str'),
125 name=dict(type='str')
126 )
127 module = AnsibleModule(
128 argument_spec,
129 supports_check_mode=True,
130 )
131 intersight = IntersightModule(module)
132 intersight.result['api_response'] = {}
133 intersight.result['trace_id'] = ''
134 # Resource path used to fetch policy info
135 resource_path = '/vnic/FcQosPolicies'
136 # Get query parameters for policies
137 query_params = intersight.set_query_params()
138 # Get Fibre Channel QoS policies
139 intersight.get_resource(
140 resource_path=resource_path,
141 query_params=query_params,
142 return_list=True
143 )
144 module.exit_json(**intersight.result)
145
146
147 if __name__ == '__main__':
148 main()