Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_hotspot20_h2qpwanmetric.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_h2qpwanmetric
15 short_description: Configure WAN metrics.
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_h2qpwanmetric:
29 description: The top level parameters set.
30 required: false
31 type: dict
32 suboptions:
33 downlink_load:
34 aliases: ['downlink-load']
35 type: int
36 description: Downlink load.
37 downlink_speed:
38 aliases: ['downlink-speed']
39 type: int
40 description: Downlink speed
41 link_at_capacity:
42 aliases: ['link-at-capacity']
43 type: str
44 description: Link at capacity.
45 choices: ['disable', 'enable']
46 link_status:
47 aliases: ['link-status']
48 type: str
49 description: Link status.
50 choices: ['down', 'up', 'in-test']
51 load_measurement_duration:
52 aliases: ['load-measurement-duration']
53 type: int
54 description: Load measurement duration
55 name:
56 type: str
57 description: WAN metric name.
58 required: true
59 symmetric_wan_link:
60 aliases: ['symmetric-wan-link']
61 type: str
62 description: WAN link symmetry.
63 choices: ['asymmetric', 'symmetric']
64 uplink_load:
65 aliases: ['uplink-load']
66 type: int
67 description: Uplink load.
68 uplink_speed:
69 aliases: ['uplink-speed']
70 type: int
71 description: Uplink speed
72 '''
73
74 EXAMPLES = '''
75 - name: Example playbook (generated based on argument schema)
76 hosts: fortimanagers
77 connection: httpapi
78 gather_facts: false
79 tasks:
80 - name: Configure WAN metrics.
81 fortinet.fortimanager.fmgr_hotspot20_h2qpwanmetric:
82 # workspace_locking_adom: <global or your adom name>
83 adom: <your own value>
84 state: present # <value in [present, absent]>
85 hotspot20_h2qpwanmetric:
86 name: "your value" # Required variable, string
87 # downlink_load: <integer>
88 # downlink_speed: <integer>
89 # link_at_capacity: <value in [disable, enable]>
90 # link_status: <value in [down, up, in-test]>
91 # load_measurement_duration: <integer>
92 # symmetric_wan_link: <value in [asymmetric, symmetric]>
93 # uplink_load: <integer>
94 # uplink_speed: <integer>
95 '''
96
97 RETURN = '''
98 meta:
99 description: The result of the request.
100 type: dict
101 returned: always
102 contains:
103 request_url:
104 description: The full url requested.
105 returned: always
106 type: str
107 sample: /sys/login/user
108 response_code:
109 description: The status of api request.
110 returned: always
111 type: int
112 sample: 0
113 response_data:
114 description: The api response.
115 type: list
116 returned: always
117 response_message:
118 description: The descriptive message of the api response.
119 type: str
120 returned: always
121 sample: OK.
122 system_information:
123 description: The information of the target system.
124 type: dict
125 returned: always
126 rc:
127 description: The status the request.
128 type: int
129 returned: always
130 sample: 0
131 version_check_warning:
132 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
133 type: list
134 returned: complex
135 '''
136 from ansible.module_utils.basic import AnsibleModule
137 from ansible.module_utils.connection import Connection
138 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
139 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
140
141
142 def main():
143 urls_list = [
144 '/pm/config/adom/{adom}/obj/wireless-controller/hotspot20/h2qp-wan-metric',
145 '/pm/config/global/obj/wireless-controller/hotspot20/h2qp-wan-metric'
146 ]
147 module_arg_spec = {
148 'adom': {'required': True, 'type': 'str'},
149 'revision_note': {'type': 'str'},
150 'hotspot20_h2qpwanmetric': {
151 'type': 'dict', 'v_range': [['6.0.0', '']],
152 'options': {
153 'downlink-load': {'type': 'int'},
154 'downlink-speed': {'type': 'int'},
155 'link-at-capacity': {'choices': ['disable', 'enable'], 'type': 'str'},
156 'link-status': {'choices': ['down', 'up', 'in-test'], 'type': 'str'},
157 'load-measurement-duration': {'type': 'int'},
158 'name': {'required': True, 'type': 'str'},
159 'symmetric-wan-link': {'choices': ['asymmetric', 'symmetric'], 'type': 'str'},
160 'uplink-load': {'type': 'int'},
161 'uplink-speed': {'type': 'int'}
162 }
163 }
164 }
165
166 module_option_spec = get_module_arg_spec('full crud')
167 module_arg_spec.update(module_option_spec)
168 check_galaxy_version(module_arg_spec)
169 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'hotspot20_h2qpwanmetric'),
170 supports_check_mode=True)
171 if not module._socket_path:
172 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
173 connection = Connection(module._socket_path)
174 fmgr = NAPIManager('full crud', module_arg_spec, urls_list,
175 'name', 'data', module, connection)
176 fmgr.process_crud()
177 module.exit_json(meta=module.params)
178
179
180 if __name__ == '__main__':
181 main()