Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_hotspot20_qosmap.py

raw symbols SCIP
1 #!/usr/bin/python
2 from __future__ import absolute_import, division, print_function
3 # Copyright 2019-2024 Fortinet, Inc.
4 # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
5
6 __metaclass__ = type
7
8 ANSIBLE_METADATA = {'status': ['preview'],
9 'supported_by': 'community',
10 'metadata_version': '1.1'}
11
12 DOCUMENTATION = '''
13 ---
14 module: fmgr_hotspot20_qosmap
15 short_description: Configure QoS map set.
16 version_added: "2.0.0"
17 extends_documentation_fragment:
18 - fortinet.fortimanager.general
19 - fortinet.fortimanager.general.full_crud
20 options:
21 revision_note:
22 description: The change note that can be specified when an object is created or updated.
23 type: str
24 adom:
25 description: The parameter (adom) in requested url.
26 type: str
27 required: true
28 hotspot20_qosmap:
29 description: The top level parameters set.
30 required: false
31 type: dict
32 suboptions:
33 dscp_except:
34 aliases: ['dscp-except']
35 type: list
36 elements: dict
37 description: Dscp except.
38 suboptions:
39 dscp:
40 type: int
41 description: DSCP value.
42 index:
43 type: int
44 description: DSCP exception index.
45 up:
46 type: int
47 description: User priority.
48 dscp_range:
49 aliases: ['dscp-range']
50 type: list
51 elements: dict
52 description: Dscp range.
53 suboptions:
54 high:
55 type: int
56 description: DSCP high value.
57 index:
58 type: int
59 description: DSCP range index.
60 low:
61 type: int
62 description: DSCP low value.
63 up:
64 type: int
65 description: User priority.
66 name:
67 type: str
68 description: QOS-MAP name.
69 required: true
70 '''
71
72 EXAMPLES = '''
73 - name: Example playbook (generated based on argument schema)
74 hosts: fortimanagers
75 connection: httpapi
76 gather_facts: false
77 tasks:
78 - name: Configure QoS map set.
79 fortinet.fortimanager.fmgr_hotspot20_qosmap:
80 # workspace_locking_adom: <global or your adom name>
81 adom: <your own value>
82 state: present # <value in [present, absent]>
83 hotspot20_qosmap:
84 name: "your value" # Required variable, string
85 # dscp_except:
86 # - dscp: <integer>
87 # index: <integer>
88 # up: <integer>
89 # dscp_range:
90 # - high: <integer>
91 # index: <integer>
92 # low: <integer>
93 # up: <integer>
94 '''
95
96 RETURN = '''
97 meta:
98 description: The result of the request.
99 type: dict
100 returned: always
101 contains:
102 request_url:
103 description: The full url requested.
104 returned: always
105 type: str
106 sample: /sys/login/user
107 response_code:
108 description: The status of api request.
109 returned: always
110 type: int
111 sample: 0
112 response_data:
113 description: The api response.
114 type: list
115 returned: always
116 response_message:
117 description: The descriptive message of the api response.
118 type: str
119 returned: always
120 sample: OK.
121 system_information:
122 description: The information of the target system.
123 type: dict
124 returned: always
125 rc:
126 description: The status the request.
127 type: int
128 returned: always
129 sample: 0
130 version_check_warning:
131 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
132 type: list
133 returned: complex
134 '''
135 from ansible.module_utils.basic import AnsibleModule
136 from ansible.module_utils.connection import Connection
137 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
138 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
139
140
141 def main():
142 urls_list = [
143 '/pm/config/adom/{adom}/obj/wireless-controller/hotspot20/qos-map',
144 '/pm/config/global/obj/wireless-controller/hotspot20/qos-map'
145 ]
146 module_arg_spec = {
147 'adom': {'required': True, 'type': 'str'},
148 'revision_note': {'type': 'str'},
149 'hotspot20_qosmap': {
150 'type': 'dict', 'v_range': [['6.0.0', '']],
151 'options': {
152 'dscp-except': {'type': 'list', 'options': {'dscp': {'type': 'int'}, 'index': {'type': 'int'}, 'up': {'type': 'int'}}, 'elements': 'dict'},
153 'dscp-range': {
154 'type': 'list',
155 'options': {'high': {'type': 'int'}, 'index': {'type': 'int'}, 'low': {'type': 'int'}, 'up': {'type': 'int'}},
156 'elements': 'dict'
157 },
158 'name': {'required': True, 'type': 'str'}
159 }
160 }
161 }
162
163 module_option_spec = get_module_arg_spec('full crud')
164 module_arg_spec.update(module_option_spec)
165 check_galaxy_version(module_arg_spec)
166 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'hotspot20_qosmap'),
167 supports_check_mode=True)
168 if not module._socket_path:
169 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
170 connection = Connection(module._socket_path)
171 fmgr = NAPIManager('full crud', module_arg_spec, urls_list,
172 'name', 'data', module, connection)
173 fmgr.process_crud()
174 module.exit_json(meta=module.params)
175
176
177 if __name__ == '__main__':
178 main()