| 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_info |
| 9 |
short_description: Information module for networks |
| 10 |
description: |
| 11 |
- Information module for Networks Info. |
| 12 |
- Get all networks. |
| 13 |
- Get networks by id. |
| 14 |
- List the networks that the user has privileges on in an organization. |
| 15 |
- Return a network. |
| 16 |
version_added: '1.0.0' |
| 17 |
extends_documentation_fragment: |
| 18 |
- cisco.meraki.module_info |
| 19 |
- cisco.meraki.module_info_pagination |
| 20 |
author: Francisco Munoz (@fmunoz) |
| 21 |
options: |
| 22 |
headers: |
| 23 |
description: Additional headers. |
| 24 |
type: dict |
| 25 |
networkId: |
| 26 |
description: |
| 27 |
- Information module for Networks Info. |
| 28 |
- NetworkId path parameter. Network ID. |
| 29 |
type: str |
| 30 |
organizationId: |
| 31 |
description: |
| 32 |
- Information module for Networks Info. |
| 33 |
- OrganizationId path parameter. Organization ID. |
| 34 |
type: str |
| 35 |
configTemplateId: |
| 36 |
description: |
| 37 |
- Information module for Networks Info. |
| 38 |
- > |
| 39 |
ConfigTemplateId query parameter. An optional parameter that is the ID of |
| 40 |
a config template. Will return all networks bound to that template. |
| 41 |
type: str |
| 42 |
isBoundToConfigTemplate: |
| 43 |
description: |
| 44 |
- Information module for Networks Info. |
| 45 |
- > |
| 46 |
IsBoundToConfigTemplate query parameter. An optional parameter to filter config |
| 47 |
template bound networks. If configTemplateId is set, this cannot be false. |
| 48 |
type: bool |
| 49 |
tags: |
| 50 |
description: |
| 51 |
- Information module for Networks Info. |
| 52 |
- > |
| 53 |
Tags query parameter. An optional parameter to filter networks by tags. The |
| 54 |
filtering is case-sensitive. If tags are included, 'tagsFilterType' should |
| 55 |
also be included (see below). |
| 56 |
elements: str |
| 57 |
type: list |
| 58 |
tagsFilterType: |
| 59 |
description: |
| 60 |
- Information module for Networks Info. |
| 61 |
- > |
| 62 |
TagsFilterType query parameter. An optional parameter of value 'withAnyTags' |
| 63 |
or 'withAllTags' to indicate whether to return networks which contain ANY |
| 64 |
or ALL of the included tags. If no type is included, 'withAnyTags' will be |
| 65 |
selected. |
| 66 |
type: str |
| 67 |
productTypes: |
| 68 |
description: |
| 69 |
- Information module for Networks Info. |
| 70 |
- > |
| 71 |
ProductTypes query parameter. An optional parameter to filter networks by |
| 72 |
product type. Results will have at least one of the included product types. |
| 73 |
elements: str |
| 74 |
type: list |
| 75 |
perPage: |
| 76 |
description: |
| 77 |
- Information module for Networks Info. |
| 78 |
- PerPage query parameter. The number of entries per page returned. Acceptable |
| 79 |
range is 3 - 100000. Default is 1000. |
| 80 |
type: int |
| 81 |
startingAfter: |
| 82 |
description: |
| 83 |
- Information module for Networks Info. |
| 84 |
- > |
| 85 |
StartingAfter query parameter. A token used by the server to indicate the |
| 86 |
start of the page. Often this is a timestamp or an ID but it is not limited |
| 87 |
to those. This parameter should not be defined by client applications. The |
| 88 |
link for the first, last, prev, or next page in the HTTP Link header should |
| 89 |
define it. |
| 90 |
type: str |
| 91 |
endingBefore: |
| 92 |
description: |
| 93 |
- Information module for Networks Info. |
| 94 |
- > |
| 95 |
EndingBefore query parameter. A token used by the server to indicate the end |
| 96 |
of the page. Often this is a timestamp or an ID but it is not limited to those. |
| 97 |
This parameter should not be defined by client applications. The link for |
| 98 |
the first, last, prev, or next page in the HTTP Link header should define |
| 99 |
it. |
| 100 |
type: str |
| 101 |
requirements: |
| 102 |
- meraki >= 2.4.9 |
| 103 |
- python >= 3.5 |
| 104 |
seealso: |
| 105 |
- name: Cisco Meraki documentation for networks getNetwork |
| 106 |
description: Complete reference of the getNetwork API. |
| 107 |
link: https://developer.cisco.com/meraki/api-v1/#!get-network |
| 108 |
- name: Cisco Meraki documentation for networks getOrganizationNetworks |
| 109 |
description: Complete reference of the getOrganizationNetworks API. |
| 110 |
link: https://developer.cisco.com/meraki/api-v1/#!get-organization-networks |
| 111 |
notes: |
| 112 |
- SDK Method used are |
| 113 |
networks.Networks.get_network, |
| 114 |
networks.Networks.get_organization_networks, |
| 115 |
- Paths used are |
| 116 |
get /networks/{networkId}, |
| 117 |
get /organizations/{organizationId}/networks, |
| 118 |
""" |
| 119 |
|
| 120 |
EXAMPLES = r""" |
| 121 |
- name: Get all networks |
| 122 |
cisco.meraki.networks_info: |
| 123 |
meraki_api_key: "{{ meraki_api_key }}" |
| 124 |
meraki_base_url: "{{ meraki_base_url }}" |
| 125 |
meraki_single_request_timeout: "{{ meraki_single_request_timeout }}" |
| 126 |
meraki_certificate_path: "{{ meraki_certificate_path }}" |
| 127 |
meraki_requests_proxy: "{{ meraki_requests_proxy }}" |
| 128 |
meraki_wait_on_rate_limit: "{{ meraki_wait_on_rate_limit }}" |
| 129 |
meraki_nginx_429_retry_wait_time: "{{ meraki_nginx_429_retry_wait_time }}" |
| 130 |
meraki_action_batch_retry_wait_time: "{{ meraki_action_batch_retry_wait_time }}" |
| 131 |
meraki_retry_4xx_error: "{{ meraki_retry_4xx_error }}" |
| 132 |
meraki_retry_4xx_error_wait_time: "{{ meraki_retry_4xx_error_wait_time }}" |
| 133 |
meraki_maximum_retries: "{{ meraki_maximum_retries }}" |
| 134 |
meraki_output_log: "{{ meraki_output_log }}" |
| 135 |
meraki_log_file_prefix: "{{ meraki_log_file_prefix }}" |
| 136 |
meraki_log_path: "{{ meraki_log_path }}" |
| 137 |
meraki_print_console: "{{ meraki_print_console }}" |
| 138 |
meraki_suppress_logging: "{{ meraki_suppress_logging }}" |
| 139 |
meraki_simulate: "{{ meraki_simulate }}" |
| 140 |
meraki_be_geo_id: "{{ meraki_be_geo_id }}" |
| 141 |
meraki_caller: "{{ meraki_caller }}" |
| 142 |
meraki_use_iterator_for_get_pages: "{{ meraki_use_iterator_for_get_pages }}" |
| 143 |
meraki_inherit_logging_config: "{{ meraki_inherit_logging_config }}" |
| 144 |
configTemplateId: string |
| 145 |
isBoundToConfigTemplate: true |
| 146 |
tags: [] |
| 147 |
tagsFilterType: string |
| 148 |
productTypes: [] |
| 149 |
perPage: 0 |
| 150 |
startingAfter: string |
| 151 |
endingBefore: string |
| 152 |
organizationId: string |
| 153 |
total_pages: -1 |
| 154 |
direction: next |
| 155 |
register: result |
| 156 |
- name: Get networks by id |
| 157 |
cisco.meraki.networks_info: |
| 158 |
meraki_api_key: "{{ meraki_api_key }}" |
| 159 |
meraki_base_url: "{{ meraki_base_url }}" |
| 160 |
meraki_single_request_timeout: "{{ meraki_single_request_timeout }}" |
| 161 |
meraki_certificate_path: "{{ meraki_certificate_path }}" |
| 162 |
meraki_requests_proxy: "{{ meraki_requests_proxy }}" |
| 163 |
meraki_wait_on_rate_limit: "{{ meraki_wait_on_rate_limit }}" |
| 164 |
meraki_nginx_429_retry_wait_time: "{{ meraki_nginx_429_retry_wait_time }}" |
| 165 |
meraki_action_batch_retry_wait_time: "{{ meraki_action_batch_retry_wait_time }}" |
| 166 |
meraki_retry_4xx_error: "{{ meraki_retry_4xx_error }}" |
| 167 |
meraki_retry_4xx_error_wait_time: "{{ meraki_retry_4xx_error_wait_time }}" |
| 168 |
meraki_maximum_retries: "{{ meraki_maximum_retries }}" |
| 169 |
meraki_output_log: "{{ meraki_output_log }}" |
| 170 |
meraki_log_file_prefix: "{{ meraki_log_file_prefix }}" |
| 171 |
meraki_log_path: "{{ meraki_log_path }}" |
| 172 |
meraki_print_console: "{{ meraki_print_console }}" |
| 173 |
meraki_suppress_logging: "{{ meraki_suppress_logging }}" |
| 174 |
meraki_simulate: "{{ meraki_simulate }}" |
| 175 |
meraki_be_geo_id: "{{ meraki_be_geo_id }}" |
| 176 |
meraki_caller: "{{ meraki_caller }}" |
| 177 |
meraki_use_iterator_for_get_pages: "{{ meraki_use_iterator_for_get_pages }}" |
| 178 |
meraki_inherit_logging_config: "{{ meraki_inherit_logging_config }}" |
| 179 |
networkId: string |
| 180 |
register: result |
| 181 |
""" |
| 182 |
RETURN = r""" |
| 183 |
meraki_response: |
| 184 |
description: A dictionary or list with the response returned by the Cisco Meraki Python SDK |
| 185 |
returned: always |
| 186 |
type: dict |
| 187 |
sample: > |
| 188 |
{ |
| 189 |
"id": "string", |
| 190 |
"organizationId": "string", |
| 191 |
"name": "string", |
| 192 |
"productTypes": [ |
| 193 |
"string" |
| 194 |
], |
| 195 |
"timeZone": "string", |
| 196 |
"tags": [ |
| 197 |
"string" |
| 198 |
], |
| 199 |
"enrollmentString": "string", |
| 200 |
"url": "string", |
| 201 |
"notes": "string", |
| 202 |
"isBoundToConfigTemplate": true |
| 203 |
} |
| 204 |
""" |