| 1 |
#!/usr/bin/python |
| 2 |
# -*- coding: utf-8 -*- |
| 3 |
|
| 4 |
# Copyright (c) 2021, Cisco Systems |
| 5 |
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) |
| 6 |
|
| 7 |
DOCUMENTATION = r""" |
| 8 |
module: networks_floor_plans |
| 9 |
short_description: Resource module for networks _floorplans |
| 10 |
description: |
| 11 |
- Manage operations create, update and delete of the resource networks _floorplans. |
| 12 |
- Upload a floor plan. |
| 13 |
- Destroy a floor plan. |
| 14 |
- Update a floor plan's geolocation and other meta data. |
| 15 |
version_added: '1.0.0' |
| 16 |
extends_documentation_fragment: |
| 17 |
- cisco.meraki.module |
| 18 |
author: Francisco Munoz (@fmunoz) |
| 19 |
options: |
| 20 |
bottomLeftCorner: |
| 21 |
description: The longitude and latitude of the bottom left corner of your floor |
| 22 |
plan. |
| 23 |
suboptions: |
| 24 |
lat: |
| 25 |
description: Latitude. |
| 26 |
type: float |
| 27 |
lng: |
| 28 |
description: Longitude. |
| 29 |
type: float |
| 30 |
type: dict |
| 31 |
bottomRightCorner: |
| 32 |
description: The longitude and latitude of the bottom right corner of your floor |
| 33 |
plan. |
| 34 |
suboptions: |
| 35 |
lat: |
| 36 |
description: Latitude. |
| 37 |
type: float |
| 38 |
lng: |
| 39 |
description: Longitude. |
| 40 |
type: float |
| 41 |
type: dict |
| 42 |
center: |
| 43 |
description: The longitude and latitude of the center of your floor plan. The |
| 44 |
'center' or two adjacent corners (e.g. 'topLeftCorner' and 'bottomLeftCorner') |
| 45 |
must be specified. If 'center' is specified, the floor plan is placed over that |
| 46 |
point with no rotation. If two adjacent corners are specified, the floor plan |
| 47 |
is rotated to line up with the two specified points. The aspect ratio of the |
| 48 |
floor plan's image is preserved regardless of which corners/center are specified. |
| 49 |
(This means if that more than two corners are specified, only two corners may |
| 50 |
be used to preserve the floor plan's aspect ratio.). No two points can have |
| 51 |
the same latitude, longitude pair. |
| 52 |
suboptions: |
| 53 |
lat: |
| 54 |
description: Latitude. |
| 55 |
type: float |
| 56 |
lng: |
| 57 |
description: Longitude. |
| 58 |
type: float |
| 59 |
type: dict |
| 60 |
floorNumber: |
| 61 |
description: The floor number of the floors within the building. |
| 62 |
type: float |
| 63 |
floorPlanId: |
| 64 |
description: FloorPlanId path parameter. Floor plan ID. |
| 65 |
type: str |
| 66 |
imageContents: |
| 67 |
description: The file contents (a base 64 encoded string) of your image. Supported |
| 68 |
formats are PNG, GIF, and JPG. Note that all images are saved as PNG files, |
| 69 |
regardless of the format they are uploaded in. |
| 70 |
type: str |
| 71 |
name: |
| 72 |
description: The name of your floor plan. |
| 73 |
type: str |
| 74 |
networkId: |
| 75 |
description: NetworkId path parameter. Network ID. |
| 76 |
type: str |
| 77 |
topLeftCorner: |
| 78 |
description: The longitude and latitude of the top left corner of your floor plan. |
| 79 |
suboptions: |
| 80 |
lat: |
| 81 |
description: Latitude. |
| 82 |
type: float |
| 83 |
lng: |
| 84 |
description: Longitude. |
| 85 |
type: float |
| 86 |
type: dict |
| 87 |
topRightCorner: |
| 88 |
description: The longitude and latitude of the top right corner of your floor |
| 89 |
plan. |
| 90 |
suboptions: |
| 91 |
lat: |
| 92 |
description: Latitude. |
| 93 |
type: float |
| 94 |
lng: |
| 95 |
description: Longitude. |
| 96 |
type: float |
| 97 |
type: dict |
| 98 |
requirements: |
| 99 |
- meraki >= 2.4.9 |
| 100 |
- python >= 3.5 |
| 101 |
seealso: |
| 102 |
- name: Cisco Meraki documentation for networks createNetworkFloorPlan |
| 103 |
description: Complete reference of the createNetworkFloorPlan API. |
| 104 |
link: https://developer.cisco.com/meraki/api-v1/#!create-network-floor-plan |
| 105 |
- name: Cisco Meraki documentation for networks deleteNetworkFloorPlan |
| 106 |
description: Complete reference of the deleteNetworkFloorPlan API. |
| 107 |
link: https://developer.cisco.com/meraki/api-v1/#!delete-network-floor-plan |
| 108 |
- name: Cisco Meraki documentation for networks updateNetworkFloorPlan |
| 109 |
description: Complete reference of the updateNetworkFloorPlan API. |
| 110 |
link: https://developer.cisco.com/meraki/api-v1/#!update-network-floor-plan |
| 111 |
notes: |
| 112 |
- SDK Method used are |
| 113 |
networks.Networks.create_network_floor_plan, |
| 114 |
networks.Networks.delete_network_floor_plan, |
| 115 |
networks.Networks.update_network_floor_plan, |
| 116 |
- Paths used are |
| 117 |
post /networks/{networkId}/floorPlans, |
| 118 |
delete /networks/{networkId}/floorPlans/{floorPlanId}, |
| 119 |
put /networks/{networkId}/floorPlans/{floorPlanId}, |
| 120 |
""" |
| 121 |
|
| 122 |
EXAMPLES = r""" |
| 123 |
- name: Create |
| 124 |
cisco.meraki.networks_floor_plans: |
| 125 |
meraki_api_key: "{{ meraki_api_key }}" |
| 126 |
meraki_base_url: "{{ meraki_base_url }}" |
| 127 |
meraki_single_request_timeout: "{{ meraki_single_request_timeout }}" |
| 128 |
meraki_certificate_path: "{{ meraki_certificate_path }}" |
| 129 |
meraki_requests_proxy: "{{ meraki_requests_proxy }}" |
| 130 |
meraki_wait_on_rate_limit: "{{ meraki_wait_on_rate_limit }}" |
| 131 |
meraki_nginx_429_retry_wait_time: "{{ meraki_nginx_429_retry_wait_time }}" |
| 132 |
meraki_action_batch_retry_wait_time: "{{ meraki_action_batch_retry_wait_time }}" |
| 133 |
meraki_retry_4xx_error: "{{ meraki_retry_4xx_error }}" |
| 134 |
meraki_retry_4xx_error_wait_time: "{{ meraki_retry_4xx_error_wait_time }}" |
| 135 |
meraki_maximum_retries: "{{ meraki_maximum_retries }}" |
| 136 |
meraki_output_log: "{{ meraki_output_log }}" |
| 137 |
meraki_log_file_prefix: "{{ meraki_log_file_prefix }}" |
| 138 |
meraki_log_path: "{{ meraki_log_path }}" |
| 139 |
meraki_print_console: "{{ meraki_print_console }}" |
| 140 |
meraki_suppress_logging: "{{ meraki_suppress_logging }}" |
| 141 |
meraki_simulate: "{{ meraki_simulate }}" |
| 142 |
meraki_be_geo_id: "{{ meraki_be_geo_id }}" |
| 143 |
meraki_caller: "{{ meraki_caller }}" |
| 144 |
meraki_use_iterator_for_get_pages: "{{ meraki_use_iterator_for_get_pages }}" |
| 145 |
meraki_inherit_logging_config: "{{ meraki_inherit_logging_config }}" |
| 146 |
state: present |
| 147 |
bottomLeftCorner: |
| 148 |
lat: 37.770040510499996 |
| 149 |
lng: -122.38714009525 |
| 150 |
bottomRightCorner: |
| 151 |
lat: 37.770040510499996 |
| 152 |
lng: -122.38714009525 |
| 153 |
center: |
| 154 |
lat: 37.770040510499996 |
| 155 |
lng: -122.38714009525 |
| 156 |
floorNumber: 5.0 |
| 157 |
imageContents: 2a9edd3f4ffd80130c647d13eacb59f3 |
| 158 |
name: HQ Floor Plan |
| 159 |
networkId: string |
| 160 |
topLeftCorner: |
| 161 |
lat: 37.770040510499996 |
| 162 |
lng: -122.38714009525 |
| 163 |
topRightCorner: |
| 164 |
lat: 37.770040510499996 |
| 165 |
lng: -122.38714009525 |
| 166 |
- name: Update by id |
| 167 |
cisco.meraki.networks_floor_plans: |
| 168 |
meraki_api_key: "{{ meraki_api_key }}" |
| 169 |
meraki_base_url: "{{ meraki_base_url }}" |
| 170 |
meraki_single_request_timeout: "{{ meraki_single_request_timeout }}" |
| 171 |
meraki_certificate_path: "{{ meraki_certificate_path }}" |
| 172 |
meraki_requests_proxy: "{{ meraki_requests_proxy }}" |
| 173 |
meraki_wait_on_rate_limit: "{{ meraki_wait_on_rate_limit }}" |
| 174 |
meraki_nginx_429_retry_wait_time: "{{ meraki_nginx_429_retry_wait_time }}" |
| 175 |
meraki_action_batch_retry_wait_time: "{{ meraki_action_batch_retry_wait_time }}" |
| 176 |
meraki_retry_4xx_error: "{{ meraki_retry_4xx_error }}" |
| 177 |
meraki_retry_4xx_error_wait_time: "{{ meraki_retry_4xx_error_wait_time }}" |
| 178 |
meraki_maximum_retries: "{{ meraki_maximum_retries }}" |
| 179 |
meraki_output_log: "{{ meraki_output_log }}" |
| 180 |
meraki_log_file_prefix: "{{ meraki_log_file_prefix }}" |
| 181 |
meraki_log_path: "{{ meraki_log_path }}" |
| 182 |
meraki_print_console: "{{ meraki_print_console }}" |
| 183 |
meraki_suppress_logging: "{{ meraki_suppress_logging }}" |
| 184 |
meraki_simulate: "{{ meraki_simulate }}" |
| 185 |
meraki_be_geo_id: "{{ meraki_be_geo_id }}" |
| 186 |
meraki_caller: "{{ meraki_caller }}" |
| 187 |
meraki_use_iterator_for_get_pages: "{{ meraki_use_iterator_for_get_pages }}" |
| 188 |
meraki_inherit_logging_config: "{{ meraki_inherit_logging_config }}" |
| 189 |
state: present |
| 190 |
bottomLeftCorner: |
| 191 |
lat: 37.770040510499996 |
| 192 |
lng: -122.38714009525 |
| 193 |
bottomRightCorner: |
| 194 |
lat: 37.770040510499996 |
| 195 |
lng: -122.38714009525 |
| 196 |
center: |
| 197 |
lat: 37.770040510499996 |
| 198 |
lng: -122.38714009525 |
| 199 |
floorNumber: 5.0 |
| 200 |
floorPlanId: string |
| 201 |
imageContents: 2a9edd3f4ffd80130c647d13eacb59f3 |
| 202 |
name: HQ Floor Plan |
| 203 |
networkId: string |
| 204 |
topLeftCorner: |
| 205 |
lat: 37.770040510499996 |
| 206 |
lng: -122.38714009525 |
| 207 |
topRightCorner: |
| 208 |
lat: 37.770040510499996 |
| 209 |
lng: -122.38714009525 |
| 210 |
- name: Delete by id |
| 211 |
cisco.meraki.networks_floor_plans: |
| 212 |
meraki_api_key: "{{ meraki_api_key }}" |
| 213 |
meraki_base_url: "{{ meraki_base_url }}" |
| 214 |
meraki_single_request_timeout: "{{ meraki_single_request_timeout }}" |
| 215 |
meraki_certificate_path: "{{ meraki_certificate_path }}" |
| 216 |
meraki_requests_proxy: "{{ meraki_requests_proxy }}" |
| 217 |
meraki_wait_on_rate_limit: "{{ meraki_wait_on_rate_limit }}" |
| 218 |
meraki_nginx_429_retry_wait_time: "{{ meraki_nginx_429_retry_wait_time }}" |
| 219 |
meraki_action_batch_retry_wait_time: "{{ meraki_action_batch_retry_wait_time }}" |
| 220 |
meraki_retry_4xx_error: "{{ meraki_retry_4xx_error }}" |
| 221 |
meraki_retry_4xx_error_wait_time: "{{ meraki_retry_4xx_error_wait_time }}" |
| 222 |
meraki_maximum_retries: "{{ meraki_maximum_retries }}" |
| 223 |
meraki_output_log: "{{ meraki_output_log }}" |
| 224 |
meraki_log_file_prefix: "{{ meraki_log_file_prefix }}" |
| 225 |
meraki_log_path: "{{ meraki_log_path }}" |
| 226 |
meraki_print_console: "{{ meraki_print_console }}" |
| 227 |
meraki_suppress_logging: "{{ meraki_suppress_logging }}" |
| 228 |
meraki_simulate: "{{ meraki_simulate }}" |
| 229 |
meraki_be_geo_id: "{{ meraki_be_geo_id }}" |
| 230 |
meraki_caller: "{{ meraki_caller }}" |
| 231 |
meraki_use_iterator_for_get_pages: "{{ meraki_use_iterator_for_get_pages }}" |
| 232 |
meraki_inherit_logging_config: "{{ meraki_inherit_logging_config }}" |
| 233 |
state: absent |
| 234 |
floorPlanId: string |
| 235 |
networkId: string |
| 236 |
""" |
| 237 |
RETURN = r""" |
| 238 |
meraki_response: |
| 239 |
description: A dictionary or list with the response returned by the Cisco Meraki Python SDK |
| 240 |
returned: always |
| 241 |
type: dict |
| 242 |
sample: > |
| 243 |
{ |
| 244 |
"floorPlanId": "string", |
| 245 |
"imageUrl": "string", |
| 246 |
"imageUrlExpiresAt": "string", |
| 247 |
"imageExtension": "string", |
| 248 |
"imageMd5": "string", |
| 249 |
"name": "string", |
| 250 |
"devices": [ |
| 251 |
{ |
| 252 |
"name": "string", |
| 253 |
"lat": 0, |
| 254 |
"lng": 0, |
| 255 |
"address": "string", |
| 256 |
"notes": "string", |
| 257 |
"tags": [ |
| 258 |
"string" |
| 259 |
], |
| 260 |
"networkId": "string", |
| 261 |
"serial": "string", |
| 262 |
"model": "string", |
| 263 |
"imei": "string", |
| 264 |
"mac": "string", |
| 265 |
"lanIp": "string", |
| 266 |
"firmware": "string", |
| 267 |
"productType": "string", |
| 268 |
"details": [ |
| 269 |
{ |
| 270 |
"name": "string", |
| 271 |
"value": "string" |
| 272 |
} |
| 273 |
] |
| 274 |
} |
| 275 |
], |
| 276 |
"width": 0, |
| 277 |
"height": 0, |
| 278 |
"center": { |
| 279 |
"lat": 0, |
| 280 |
"lng": 0 |
| 281 |
}, |
| 282 |
"bottomLeftCorner": { |
| 283 |
"lat": 0, |
| 284 |
"lng": 0 |
| 285 |
}, |
| 286 |
"bottomRightCorner": { |
| 287 |
"lat": 0, |
| 288 |
"lng": 0 |
| 289 |
}, |
| 290 |
"topLeftCorner": { |
| 291 |
"lat": 0, |
| 292 |
"lng": 0 |
| 293 |
}, |
| 294 |
"topRightCorner": { |
| 295 |
"lat": 0, |
| 296 |
"lng": 0 |
| 297 |
}, |
| 298 |
"floorNumber": 0 |
| 299 |
} |
| 300 |
""" |