Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_bleprofile.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_bleprofile
15 short_description: Configure Bluetooth Low Energy profile.
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 bleprofile:
29 description: The top level parameters set.
30 required: false
31 type: dict
32 suboptions:
33 advertising:
34 type: list
35 elements: str
36 description: Advertising type.
37 choices: ['ibeacon', 'eddystone-uid', 'eddystone-url']
38 beacon_interval:
39 aliases: ['beacon-interval']
40 type: int
41 description: Beacon interval
42 ble_scanning:
43 aliases: ['ble-scanning']
44 type: str
45 description: Enable/disable Bluetooth Low Energy
46 choices: ['disable', 'enable']
47 comment:
48 type: str
49 description: Comment.
50 eddystone_instance:
51 aliases: ['eddystone-instance']
52 type: str
53 description: Eddystone instance ID.
54 eddystone_namespace:
55 aliases: ['eddystone-namespace']
56 type: str
57 description: Eddystone namespace ID.
58 eddystone_url:
59 aliases: ['eddystone-url']
60 type: str
61 description: Eddystone URL.
62 eddystone_url_encode_hex:
63 aliases: ['eddystone-url-encode-hex']
64 type: str
65 description: Eddystone encoded URL hexadecimal string
66 ibeacon_uuid:
67 aliases: ['ibeacon-uuid']
68 type: str
69 description: Universally Unique Identifier
70 major_id:
71 aliases: ['major-id']
72 type: int
73 description: Major ID.
74 minor_id:
75 aliases: ['minor-id']
76 type: int
77 description: Minor ID.
78 name:
79 type: str
80 description: Bluetooth Low Energy profile name.
81 required: true
82 txpower:
83 type: str
84 description: Transmit power level
85 choices: ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12',
86 '13', '14', '15', '16', '17']
87 scan_interval:
88 aliases: ['scan-interval']
89 type: int
90 description: Scan Interval
91 scan_period:
92 aliases: ['scan-period']
93 type: int
94 description: Scan Period
95 scan_threshold:
96 aliases: ['scan-threshold']
97 type: str
98 description: Minimum signal level/threshold in dBm required for the AP to report detected BLE device
99 scan_time:
100 aliases: ['scan-time']
101 type: int
102 description: Scan Time
103 scan_type:
104 aliases: ['scan-type']
105 type: str
106 description: Scan Type
107 choices: ['active', 'passive']
108 scan_window:
109 aliases: ['scan-window']
110 type: int
111 description: Scan Windows
112 '''
113
114 EXAMPLES = '''
115 - name: Example playbook (generated based on argument schema)
116 hosts: fortimanagers
117 connection: httpapi
118 gather_facts: false
119 tasks:
120 - name: Configure Bluetooth Low Energy profile.
121 fortinet.fortimanager.fmgr_bleprofile:
122 # workspace_locking_adom: <global or your adom name>
123 adom: <your own value>
124 state: present # <value in [present, absent]>
125 bleprofile:
126 name: "your value" # Required variable, string
127 # advertising: ["ibeacon", "eddystone-uid", "eddystone-url"]
128 # beacon_interval: <integer>
129 # ble_scanning: <value in [disable, enable]>
130 # comment: <string>
131 # eddystone_instance: <string>
132 # eddystone_namespace: <string>
133 # eddystone_url: <string>
134 # eddystone_url_encode_hex: <string>
135 # ibeacon_uuid: <string>
136 # major_id: <integer>
137 # minor_id: <integer>
138 # txpower: <value in [0, 1, 2, ...]>
139 # scan_interval: <integer>
140 # scan_period: <integer>
141 # scan_threshold: <string>
142 # scan_time: <integer>
143 # scan_type: <value in [active, passive]>
144 # scan_window: <integer>
145 '''
146
147 RETURN = '''
148 meta:
149 description: The result of the request.
150 type: dict
151 returned: always
152 contains:
153 request_url:
154 description: The full url requested.
155 returned: always
156 type: str
157 sample: /sys/login/user
158 response_code:
159 description: The status of api request.
160 returned: always
161 type: int
162 sample: 0
163 response_data:
164 description: The api response.
165 type: list
166 returned: always
167 response_message:
168 description: The descriptive message of the api response.
169 type: str
170 returned: always
171 sample: OK.
172 system_information:
173 description: The information of the target system.
174 type: dict
175 returned: always
176 rc:
177 description: The status the request.
178 type: int
179 returned: always
180 sample: 0
181 version_check_warning:
182 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
183 type: list
184 returned: complex
185 '''
186 from ansible.module_utils.basic import AnsibleModule
187 from ansible.module_utils.connection import Connection
188 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
189 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
190
191
192 def main():
193 urls_list = [
194 '/pm/config/adom/{adom}/obj/wireless-controller/ble-profile',
195 '/pm/config/global/obj/wireless-controller/ble-profile'
196 ]
197 module_arg_spec = {
198 'adom': {'required': True, 'type': 'str'},
199 'revision_note': {'type': 'str'},
200 'bleprofile': {
201 'type': 'dict', 'v_range': [['6.0.0', '']],
202 'options': {
203 'advertising': {'type': 'list', 'choices': ['ibeacon', 'eddystone-uid', 'eddystone-url'], 'elements': 'str'},
204 'beacon-interval': {'type': 'int'},
205 'ble-scanning': {'choices': ['disable', 'enable'], 'type': 'str'},
206 'comment': {'type': 'str'},
207 'eddystone-instance': {'type': 'str'},
208 'eddystone-namespace': {'type': 'str'},
209 'eddystone-url': {'type': 'str'},
210 'eddystone-url-encode-hex': {'type': 'str'},
211 'ibeacon-uuid': {'type': 'str'},
212 'major-id': {'type': 'int'},
213 'minor-id': {'type': 'int'},
214 'name': {'required': True, 'type': 'str'},
215 'txpower': {'choices': ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17'], 'type': 'str'},
216 'scan-interval': {'v_range': [['7.4.1', '']], 'type': 'int'},
217 'scan-period': {'v_range': [['7.4.1', '']], 'type': 'int'},
218 'scan-threshold': {'v_range': [['7.4.1', '']], 'type': 'str'},
219 'scan-time': {'v_range': [['7.4.1', '']], 'type': 'int'},
220 'scan-type': {'v_range': [['7.4.1', '']], 'choices': ['active', 'passive'], 'type': 'str'},
221 'scan-window': {'v_range': [['7.4.1', '']], 'type': 'int'}
222 }
223 }
224 }
225
226 module_option_spec = get_module_arg_spec('full crud')
227 module_arg_spec.update(module_option_spec)
228 check_galaxy_version(module_arg_spec)
229 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'bleprofile'),
230 supports_check_mode=True)
231 if not module._socket_path:
232 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
233 connection = Connection(module._socket_path)
234 fmgr = NAPIManager('full crud', module_arg_spec, urls_list,
235 'name', 'data', module, connection)
236 fmgr.process_crud()
237 module.exit_json(meta=module.params)
238
239
240 if __name__ == '__main__':
241 main()