| 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: organizations_inventory_devices_info |
| 9 |
short_description: Information module for organizations _inventory _devices |
| 10 |
description: |
| 11 |
- Get all organizations _inventory _devices. |
| 12 |
- Get organizations _inventory _devices by id. |
| 13 |
- Return a single device from the inventory of an organization. |
| 14 |
- Return the device inventory for an organization. |
| 15 |
version_added: '1.0.0' |
| 16 |
extends_documentation_fragment: |
| 17 |
- cisco.meraki.module_info |
| 18 |
- cisco.meraki.module_info_pagination |
| 19 |
author: Francisco Munoz (@fmunoz) |
| 20 |
options: |
| 21 |
headers: |
| 22 |
description: Additional headers. |
| 23 |
type: dict |
| 24 |
organizationId: |
| 25 |
description: |
| 26 |
- OrganizationId path parameter. Organization ID. |
| 27 |
type: str |
| 28 |
perPage: |
| 29 |
description: |
| 30 |
- PerPage query parameter. The number of entries per page returned. Acceptable range is 3 - 1000. Default is 1000. |
| 31 |
type: int |
| 32 |
startingAfter: |
| 33 |
description: |
| 34 |
- > |
| 35 |
StartingAfter query parameter. A token used by the server to indicate the start of the page. Often this |
| 36 |
is a timestamp or an ID but it is not limited to those. This parameter should not be defined by client |
| 37 |
applications. The link for the first, last, prev, or next page in the HTTP Link header should define it. |
| 38 |
type: str |
| 39 |
endingBefore: |
| 40 |
description: |
| 41 |
- > |
| 42 |
EndingBefore query parameter. A token used by the server to indicate the end of the page. Often this is |
| 43 |
a timestamp or an ID but it is not limited to those. This parameter should not be defined by client |
| 44 |
applications. The link for the first, last, prev, or next page in the HTTP Link header should define it. |
| 45 |
type: str |
| 46 |
usedState: |
| 47 |
description: |
| 48 |
- UsedState query parameter. Filter results by used or unused inventory. Accepted values are 'used' or 'unused'. |
| 49 |
type: str |
| 50 |
search: |
| 51 |
description: |
| 52 |
- Search query parameter. Search for devices in inventory based on serial number, mac address, or model. |
| 53 |
type: str |
| 54 |
macs: |
| 55 |
description: |
| 56 |
- Macs query parameter. Search for devices in inventory based on mac addresses. |
| 57 |
elements: str |
| 58 |
type: list |
| 59 |
networkIds: |
| 60 |
description: |
| 61 |
- > |
| 62 |
NetworkIds query parameter. Search for devices in inventory based on network ids. Use explicit 'null' |
| 63 |
value to get available devices only. |
| 64 |
elements: str |
| 65 |
type: list |
| 66 |
serials: |
| 67 |
description: |
| 68 |
- Serials query parameter. Search for devices in inventory based on serials. |
| 69 |
elements: str |
| 70 |
type: list |
| 71 |
models: |
| 72 |
description: |
| 73 |
- Models query parameter. Search for devices in inventory based on model. |
| 74 |
elements: str |
| 75 |
type: list |
| 76 |
orderNumbers: |
| 77 |
description: |
| 78 |
- OrderNumbers query parameter. Search for devices in inventory based on order numbers. |
| 79 |
elements: str |
| 80 |
type: list |
| 81 |
tags: |
| 82 |
description: |
| 83 |
- > |
| 84 |
Tags query parameter. Filter devices by tags. The filtering is case-sensitive. If tags are included, |
| 85 |
'tagsFilterType' should also be included (see below). |
| 86 |
elements: str |
| 87 |
type: list |
| 88 |
tagsFilterType: |
| 89 |
description: |
| 90 |
- > |
| 91 |
TagsFilterType query parameter. To use with 'tags' parameter, to filter devices which contain ANY or ALL |
| 92 |
given tags. Accepted values are 'withAnyTags' or 'withAllTags', default is 'withAnyTags'. |
| 93 |
type: str |
| 94 |
productTypes: |
| 95 |
description: |
| 96 |
- > |
| 97 |
ProductTypes query parameter. Filter devices by product type. Accepted values are appliance, camera, |
| 98 |
campusGateway, cellularGateway, secureConnect, sensor, switch, systemsManager, wireless, and |
| 99 |
wirelessController. |
| 100 |
elements: str |
| 101 |
type: list |
| 102 |
eoxStatuses: |
| 103 |
description: |
| 104 |
- > |
| 105 |
EoxStatuses query parameter. Filter devices by EoX status. Accepted values are 'endOfSale', |
| 106 |
'endOfSupport', 'nearEndOfSupport', or 'null'. Use 'null' to filter for devices with no EOX data. |
| 107 |
Supports multiple values for multi-select filtering. |
| 108 |
elements: str |
| 109 |
type: list |
| 110 |
serial: |
| 111 |
description: |
| 112 |
- Serial path parameter. |
| 113 |
type: str |
| 114 |
requirements: |
| 115 |
- meraki >= 2.4.9 |
| 116 |
- python >= 3.5 |
| 117 |
seealso: |
| 118 |
- name: Cisco Meraki documentation for organizations getOrganizationInventoryDevice |
| 119 |
description: Complete reference of the getOrganizationInventoryDevice API. |
| 120 |
link: https://developer.cisco.com/meraki/api-v1/#!get-organization-inventory-device |
| 121 |
- name: Cisco Meraki documentation for organizations getOrganizationInventoryDevices |
| 122 |
description: Complete reference of the getOrganizationInventoryDevices API. |
| 123 |
link: https://developer.cisco.com/meraki/api-v1/#!get-organization-inventory-devices |
| 124 |
notes: |
| 125 |
- SDK Method used are |
| 126 |
organizations.Organizations.get_organization_inventory_device, |
| 127 |
organizations.Organizations.get_organization_inventory_devices, |
| 128 |
|
| 129 |
- Paths used are |
| 130 |
get /organizations/{organizationId}/inventory/devices, |
| 131 |
get /organizations/{organizationId}/inventory/devices/{serial}, |
| 132 |
""" |
| 133 |
|
| 134 |
EXAMPLES = r""" |
| 135 |
- name: Get all organizations _inventory _devices |
| 136 |
cisco.meraki.organizations_inventory_devices_info: |
| 137 |
meraki_api_key: "{{ meraki_api_key }}" |
| 138 |
meraki_base_url: "{{ meraki_base_url }}" |
| 139 |
meraki_single_request_timeout: "{{ meraki_single_request_timeout }}" |
| 140 |
meraki_certificate_path: "{{ meraki_certificate_path }}" |
| 141 |
meraki_requests_proxy: "{{ meraki_requests_proxy }}" |
| 142 |
meraki_wait_on_rate_limit: "{{ meraki_wait_on_rate_limit }}" |
| 143 |
meraki_nginx_429_retry_wait_time: "{{ meraki_nginx_429_retry_wait_time }}" |
| 144 |
meraki_action_batch_retry_wait_time: "{{ meraki_action_batch_retry_wait_time }}" |
| 145 |
meraki_retry_4xx_error: "{{ meraki_retry_4xx_error }}" |
| 146 |
meraki_retry_4xx_error_wait_time: "{{ meraki_retry_4xx_error_wait_time }}" |
| 147 |
meraki_maximum_retries: "{{ meraki_maximum_retries }}" |
| 148 |
meraki_output_log: "{{ meraki_output_log }}" |
| 149 |
meraki_log_file_prefix: "{{ meraki_log_file_prefix }}" |
| 150 |
meraki_log_path: "{{ meraki_log_path }}" |
| 151 |
meraki_print_console: "{{ meraki_print_console }}" |
| 152 |
meraki_suppress_logging: "{{ meraki_suppress_logging }}" |
| 153 |
meraki_simulate: "{{ meraki_simulate }}" |
| 154 |
meraki_be_geo_id: "{{ meraki_be_geo_id }}" |
| 155 |
meraki_caller: "{{ meraki_caller }}" |
| 156 |
meraki_use_iterator_for_get_pages: "{{ meraki_use_iterator_for_get_pages }}" |
| 157 |
meraki_inherit_logging_config: "{{ meraki_inherit_logging_config }}" |
| 158 |
perPage: 0 |
| 159 |
startingAfter: string |
| 160 |
endingBefore: string |
| 161 |
usedState: string |
| 162 |
search: string |
| 163 |
macs: [] |
| 164 |
networkIds: [] |
| 165 |
serials: [] |
| 166 |
models: [] |
| 167 |
orderNumbers: [] |
| 168 |
tags: [] |
| 169 |
tagsFilterType: string |
| 170 |
productTypes: [] |
| 171 |
eoxStatuses: [] |
| 172 |
organizationId: string |
| 173 |
total_pages: -1 |
| 174 |
direction: next |
| 175 |
register: result |
| 176 |
|
| 177 |
- name: Get organizations _inventory _devices by id |
| 178 |
cisco.meraki.organizations_inventory_devices_info: |
| 179 |
meraki_api_key: "{{ meraki_api_key }}" |
| 180 |
meraki_base_url: "{{ meraki_base_url }}" |
| 181 |
meraki_single_request_timeout: "{{ meraki_single_request_timeout }}" |
| 182 |
meraki_certificate_path: "{{ meraki_certificate_path }}" |
| 183 |
meraki_requests_proxy: "{{ meraki_requests_proxy }}" |
| 184 |
meraki_wait_on_rate_limit: "{{ meraki_wait_on_rate_limit }}" |
| 185 |
meraki_nginx_429_retry_wait_time: "{{ meraki_nginx_429_retry_wait_time }}" |
| 186 |
meraki_action_batch_retry_wait_time: "{{ meraki_action_batch_retry_wait_time }}" |
| 187 |
meraki_retry_4xx_error: "{{ meraki_retry_4xx_error }}" |
| 188 |
meraki_retry_4xx_error_wait_time: "{{ meraki_retry_4xx_error_wait_time }}" |
| 189 |
meraki_maximum_retries: "{{ meraki_maximum_retries }}" |
| 190 |
meraki_output_log: "{{ meraki_output_log }}" |
| 191 |
meraki_log_file_prefix: "{{ meraki_log_file_prefix }}" |
| 192 |
meraki_log_path: "{{ meraki_log_path }}" |
| 193 |
meraki_print_console: "{{ meraki_print_console }}" |
| 194 |
meraki_suppress_logging: "{{ meraki_suppress_logging }}" |
| 195 |
meraki_simulate: "{{ meraki_simulate }}" |
| 196 |
meraki_be_geo_id: "{{ meraki_be_geo_id }}" |
| 197 |
meraki_caller: "{{ meraki_caller }}" |
| 198 |
meraki_use_iterator_for_get_pages: "{{ meraki_use_iterator_for_get_pages }}" |
| 199 |
meraki_inherit_logging_config: "{{ meraki_inherit_logging_config }}" |
| 200 |
organizationId: string |
| 201 |
serial: string |
| 202 |
register: result |
| 203 |
""" |
| 204 |
RETURN = r""" |
| 205 |
meraki_response: |
| 206 |
description: A dictionary or list with the response returned by the Cisco Meraki Python SDK |
| 207 |
returned: always |
| 208 |
type: dict |
| 209 |
sample: > |
| 210 |
{ |
| 211 |
"mac": "string", |
| 212 |
"serial": "string", |
| 213 |
"name": "string", |
| 214 |
"model": "string", |
| 215 |
"networkId": "string", |
| 216 |
"orderNumber": "string", |
| 217 |
"claimedAt": "string", |
| 218 |
"licenseExpirationDate": "string", |
| 219 |
"tags": [ |
| 220 |
"string" |
| 221 |
], |
| 222 |
"productType": "string", |
| 223 |
"countryCode": "string", |
| 224 |
"details": [ |
| 225 |
{ |
| 226 |
"name": "string", |
| 227 |
"value": "string" |
| 228 |
} |
| 229 |
], |
| 230 |
"eox": { |
| 231 |
"status": "string", |
| 232 |
"endOfSaleAt": "string", |
| 233 |
"endOfSupportAt": "string" |
| 234 |
} |
| 235 |
} |
| 236 |
""" |