Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions meraki/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@
)
from meraki.rest_session import *

__version__ = '2.0.2'
__api_version__ = '1.57.0'
__version__ = '2.0.3'
__api_version__ = '1.58.0'


class DashboardAPI(object):
Expand Down
108 changes: 108 additions & 0 deletions meraki/aio/api/campusGateway.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
import urllib


class AsyncCampusGateway:
def __init__(self, session):
super().__init__()
self._session = session



def createNetworkCampusGatewayCluster(self, networkId: str, name: str, uplinks: list, tunnels: list, nameservers: dict, portChannels: list, **kwargs):
"""
**Create a cluster and add campus gateways to it**
https://developer.cisco.com/meraki/api-v1/#!create-network-campus-gateway-cluster

- networkId (string): Network ID
- name (string): Name of the new cluster
- uplinks (array): Uplink interface settings of the cluster
- tunnels (array): Tunnel interface settings of the cluster: Reuse uplink or specify tunnel interface
- nameservers (object): Nameservers of the cluster
- portChannels (array): Port channel settings of the cluster
- devices (array): Devices to be added to the cluster
- notes (string): Notes about cluster with max size of 511 characters allowed
"""

kwargs.update(locals())

metadata = {
'tags': ['campusGateway', 'configure', 'clusters'],
'operation': 'createNetworkCampusGatewayCluster'
}
networkId = urllib.parse.quote(str(networkId), safe='')
resource = f'/networks/{networkId}/campusGateway/clusters'

body_params = ['name', 'uplinks', 'tunnels', 'nameservers', 'portChannels', 'devices', 'notes', ]
payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params}

return self._session.post(metadata, resource, payload)



def updateNetworkCampusGatewayCluster(self, networkId: str, clusterId: str, **kwargs):
"""
**Update a cluster and add/remove campus gateways to/from it**
https://developer.cisco.com/meraki/api-v1/#!update-network-campus-gateway-cluster

- networkId (string): Network ID
- clusterId (string): Cluster ID
- name (string): Name of the cluster
- uplinks (array): Uplink interface settings of the cluster
- tunnels (array): Tunnel interface settings of the cluster: Reuse uplink or specify tunnel interface
- nameservers (object): Nameservers of the cluster
- portChannels (array): Port channel settings of the cluster
- devices (array): Devices in the cluster
- notes (string): Notes about cluster with max size of 511 characters allowed
"""

kwargs.update(locals())

metadata = {
'tags': ['campusGateway', 'configure', 'clusters'],
'operation': 'updateNetworkCampusGatewayCluster'
}
networkId = urllib.parse.quote(str(networkId), safe='')
clusterId = urllib.parse.quote(str(clusterId), safe='')
resource = f'/networks/{networkId}/campusGateway/clusters/{clusterId}'

body_params = ['name', 'uplinks', 'tunnels', 'nameservers', 'portChannels', 'devices', 'notes', ]
payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params}

return self._session.put(metadata, resource, payload)



def getOrganizationCampusGatewayDevicesUplinksLocalOverridesByDevice(self, organizationId: str, total_pages=1, direction='next', **kwargs):
"""
**Uplink overrides configured locally on Campus Gateway devices in an organization.**
https://developer.cisco.com/meraki/api-v1/#!get-organization-campus-gateway-devices-uplinks-local-overrides-by-device

- organizationId (string): Organization ID
- total_pages (integer or string): use with perPage to get total results up to total_pages*perPage; -1 or "all" for all pages
- direction (string): direction to paginate, either "next" (default) or "prev" page
- serials (array): A list of serial numbers. The returned devices will be filtered to only include these serials.
- perPage (integer): The number of entries per page returned. Acceptable range is 3 - 1000. Default is 1000.
- startingAfter (string): A token used by the server to indicate the start of the page. Often this is a timestamp or an ID but it is not limited to those. This parameter should not be defined by client applications. The link for the first, last, prev, or next page in the HTTP Link header should define it.
- endingBefore (string): A token used by the server to indicate the end of the page. Often this is a timestamp or an ID but it is not limited to those. This parameter should not be defined by client applications. The link for the first, last, prev, or next page in the HTTP Link header should define it.
"""

kwargs.update(locals())

metadata = {
'tags': ['campusGateway', 'configure', 'devices', 'uplinks', 'localOverrides', 'byDevice'],
'operation': 'getOrganizationCampusGatewayDevicesUplinksLocalOverridesByDevice'
}
organizationId = urllib.parse.quote(str(organizationId), safe='')
resource = f'/organizations/{organizationId}/campusGateway/devices/uplinks/localOverrides/byDevice'

query_params = ['serials', 'perPage', 'startingAfter', 'endingBefore', ]
params = {k.strip(): v for k, v in kwargs.items() if k.strip() in query_params}

array_params = ['serials', ]
for k, v in kwargs.items():
if k.strip() in array_params:
params[f'{k.strip()}[]'] = kwargs[f'{k}']
params.pop(k.strip())

return self._session.get_pages(metadata, resource, params, total_pages, direction)

7 changes: 4 additions & 3 deletions meraki/aio/api/networks.py
Original file line number Diff line number Diff line change
Expand Up @@ -650,6 +650,7 @@ def claimNetworkDevices(self, networkId: str, serials: list, **kwargs):
- networkId (string): Network ID
- serials (array): A list of serials of devices to claim
- addAtomically (boolean): Whether to claim devices atomically. If true, all devices will be claimed or none will be claimed. Default is true.
- detailsByDevice (array): Optional details for claimed devices (currently only used for Catalyst devices)
"""

kwargs.update(locals())
Expand All @@ -661,7 +662,7 @@ def claimNetworkDevices(self, networkId: str, serials: list, **kwargs):
networkId = urllib.parse.quote(str(networkId), safe='')
resource = f'/networks/{networkId}/devices/claim'

body_params = ['serials', ]
body_params = ['serials', 'detailsByDevice', ]
payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params}

return self._session.post(metadata, resource, payload)
Expand Down Expand Up @@ -731,7 +732,7 @@ def getNetworkEvents(self, networkId: str, total_pages=1, direction='prev', even
- total_pages (integer or string): use with perPage to get total results up to total_pages*perPage; -1 or "all" for all pages
- direction (string): direction to paginate, either "next" or "prev" (default) page
- event_log_end_time (string): ISO8601 Zulu/UTC time, to use in conjunction with startingAfter, to retrieve events within a time window
- productType (string): The product type to fetch events for. This parameter is required for networks with multiple device types. Valid types are wireless, appliance, switch, systemsManager, camera, cellularGateway, wirelessController, and secureConnect
- productType (string): The product type to fetch events for. This parameter is required for networks with multiple device types. Valid types are wireless, appliance, switch, systemsManager, camera, cellularGateway, wirelessController, campusGateway, and secureConnect
- includedEventTypes (array): A list of event types. The returned events will be filtered to only include events with these types.
- excludedEventTypes (array): A list of event types. The returned events will be filtered to exclude events with these types.
- deviceMac (string): The MAC address of the Meraki device which the list of events will be filtered with
Expand All @@ -753,7 +754,7 @@ def getNetworkEvents(self, networkId: str, total_pages=1, direction='prev', even
kwargs.update(locals())

if 'productType' in kwargs:
options = ['appliance', 'camera', 'cellularGateway', 'secureConnect', 'switch', 'systemsManager', 'wireless', 'wirelessController']
options = ['appliance', 'camera', 'campusGateway', 'cellularGateway', 'secureConnect', 'switch', 'systemsManager', 'wireless', 'wirelessController']
assert kwargs['productType'] in options, f'''"productType" cannot be "{kwargs['productType']}", & must be set to one of: {options}'''

metadata = {
Expand Down
45 changes: 37 additions & 8 deletions meraki/aio/api/organizations.py
Original file line number Diff line number Diff line change
Expand Up @@ -1398,7 +1398,7 @@ def getOrganizationBrandingPolicies(self, organizationId: str):



def createOrganizationBrandingPolicy(self, organizationId: str, **kwargs):
def createOrganizationBrandingPolicy(self, organizationId: str, name: str, **kwargs):
"""
**Add a new branding policy to an organization**
https://developer.cisco.com/meraki/api-v1/#!create-organization-branding-policy
Expand Down Expand Up @@ -1497,7 +1497,7 @@ def getOrganizationBrandingPolicy(self, organizationId: str, brandingPolicyId: s



def updateOrganizationBrandingPolicy(self, organizationId: str, brandingPolicyId: str, **kwargs):
def updateOrganizationBrandingPolicy(self, organizationId: str, brandingPolicyId: str, name: str, **kwargs):
"""
**Update a branding policy**
https://developer.cisco.com/meraki/api-v1/#!update-organization-branding-policy
Expand Down Expand Up @@ -1856,7 +1856,7 @@ def getOrganizationDevices(self, organizationId: str, total_pages=1, direction='
- endingBefore (string): A token used by the server to indicate the end of the page. Often this is a timestamp or an ID but it is not limited to those. This parameter should not be defined by client applications. The link for the first, last, prev, or next page in the HTTP Link header should define it.
- configurationUpdatedAfter (string): Filter results by whether or not the device's configuration has been updated after the given timestamp
- networkIds (array): Optional parameter to filter devices by network.
- productTypes (array): Optional parameter to filter devices by product type. Valid types are wireless, appliance, switch, systemsManager, camera, cellularGateway, sensor, wirelessController, and secureConnect.
- productTypes (array): Optional parameter to filter devices by product type. Valid types are wireless, appliance, switch, systemsManager, camera, cellularGateway, sensor, wirelessController, campusGateway, and secureConnect.
- tags (array): Optional parameter to filter devices by tags.
- tagsFilterType (string): Optional parameter of value 'withAnyTags' or 'withAllTags' to indicate whether to return networks which contain ANY or ALL of the included tags. If no type is included, 'withAnyTags' will be selected.
- name (string): Optional parameter to filter devices by name. All returned devices will have a name that contains the search term or is an exact match.
Expand Down Expand Up @@ -2197,6 +2197,35 @@ def createOrganizationDevicesPacketCaptureCapture(self, organizationId: str, ser



def bulkOrganizationDevicesPacketCaptureCapturesCreate(self, organizationId: str, devices: list, name: str, **kwargs):
"""
**Perform a packet capture on multiple devices and store in Meraki Cloud.**
https://developer.cisco.com/meraki/api-v1/#!bulk-organization-devices-packet-capture-captures-create

- organizationId (string): Organization ID
- devices (array): Device details (maximum of 20 devices allowed)
- name (string): Name of packet capture file
- notes (string): Reason for capture
- duration (integer): Duration of the capture in seconds
- filterExpression (string): Filter expression for the capture
"""

kwargs.update(locals())

metadata = {
'tags': ['organizations', 'configure', 'devices', 'packetCapture', 'captures'],
'operation': 'bulkOrganizationDevicesPacketCaptureCapturesCreate'
}
organizationId = urllib.parse.quote(str(organizationId), safe='')
resource = f'/organizations/{organizationId}/devices/packetCapture/captures/bulkCreate'

body_params = ['devices', 'notes', 'duration', 'filterExpression', 'name', ]
payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params}

return self._session.post(metadata, resource, payload)



def bulkOrganizationDevicesPacketCaptureCapturesDelete(self, organizationId: str, captureIds: list):
"""
**BulkDelete packet captures from cloud**
Expand Down Expand Up @@ -2541,7 +2570,7 @@ def getOrganizationDevicesStatuses(self, organizationId: str, total_pages=1, dir
- networkIds (array): Optional parameter to filter devices by network ids.
- serials (array): Optional parameter to filter devices by serials.
- statuses (array): Optional parameter to filter devices by statuses. Valid statuses are ["online", "alerting", "offline", "dormant"].
- productTypes (array): An optional parameter to filter device statuses by product type. Valid types are wireless, appliance, switch, systemsManager, camera, cellularGateway, sensor, wirelessController, and secureConnect.
- productTypes (array): An optional parameter to filter device statuses by product type. Valid types are wireless, appliance, switch, systemsManager, camera, cellularGateway, sensor, wirelessController, campusGateway, and secureConnect.
- models (array): Optional parameter to filter devices by models.
- tags (array): An optional parameter to filter devices by tags. The filtering is case-sensitive. If tags are included, 'tagsFilterType' should also be included (see below).
- tagsFilterType (string): An optional parameter of value 'withAnyTags' or 'withAllTags' to indicate whether to return devices which contain ANY or ALL of the included tags. If no type is included, 'withAnyTags' will be selected.
Expand Down Expand Up @@ -2579,7 +2608,7 @@ def getOrganizationDevicesStatusesOverview(self, organizationId: str, **kwargs):
https://developer.cisco.com/meraki/api-v1/#!get-organization-devices-statuses-overview

- organizationId (string): Organization ID
- productTypes (array): An optional parameter to filter device statuses by product type. Valid types are wireless, appliance, switch, systemsManager, camera, cellularGateway, sensor, wirelessController, and secureConnect.
- productTypes (array): An optional parameter to filter device statuses by product type. Valid types are wireless, appliance, switch, systemsManager, camera, cellularGateway, sensor, wirelessController, campusGateway, and secureConnect.
- networkIds (array): An optional parameter to filter device statuses by network.
"""

Expand Down Expand Up @@ -2622,7 +2651,7 @@ def getOrganizationDevicesSystemMemoryUsageHistoryByInterval(self, organizationI
- interval (integer): The time interval in seconds for returned data. The valid intervals are: 300, 1200, 3600, 14400. The default is 300. Interval is calculated if time params are provided.
- networkIds (array): Optional parameter to filter the result set by the included set of network IDs
- serials (array): Optional parameter to filter device availabilities history by device serial numbers
- productTypes (array): Optional parameter to filter device statuses by product type. Valid types are wireless, appliance, switch, systemsManager, camera, cellularGateway, sensor, wirelessController, and secureConnect.
- productTypes (array): Optional parameter to filter device statuses by product type. Valid types are wireless, appliance, switch, systemsManager, camera, cellularGateway, sensor, wirelessController, campusGateway, and secureConnect.
"""

kwargs.update(locals())
Expand Down Expand Up @@ -3142,7 +3171,7 @@ def getOrganizationInventoryDevices(self, organizationId: str, total_pages=1, di
- orderNumbers (array): Search for devices in inventory based on order numbers.
- tags (array): Filter devices by tags. The filtering is case-sensitive. If tags are included, 'tagsFilterType' should also be included (see below).
- tagsFilterType (string): To use with 'tags' parameter, to filter devices which contain ANY or ALL given tags. Accepted values are 'withAnyTags' or 'withAllTags', default is 'withAnyTags'.
- productTypes (array): Filter devices by product type. Accepted values are appliance, camera, cellularGateway, secureConnect, sensor, switch, systemsManager, wireless, and wirelessController.
- productTypes (array): Filter devices by product type. Accepted values are appliance, camera, campusGateway, cellularGateway, secureConnect, sensor, switch, systemsManager, wireless, and wirelessController.
"""

kwargs.update(locals())
Expand Down Expand Up @@ -4921,7 +4950,7 @@ def getOrganizationWebhooksAlertTypes(self, organizationId: str, **kwargs):
kwargs.update(locals())

if 'productType' in kwargs:
options = ['appliance', 'camera', 'cellularGateway', 'health', 'platform', 'sensor', 'sm', 'switch', 'wireless']
options = ['appliance', 'camera', 'cellularGateway', 'platform', 'sensor', 'sm', 'switch', 'wireless']
assert kwargs['productType'] in options, f'''"productType" cannot be "{kwargs['productType']}", & must be set to one of: {options}'''

metadata = {
Expand Down
27 changes: 27 additions & 0 deletions meraki/aio/api/spaces.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import urllib


class AsyncSpaces:
def __init__(self, session):
super().__init__()
self._session = session



def removeOrganizationSpacesIntegration(self, organizationId: str):
"""
**Remove the Spaces integration from Meraki**
https://developer.cisco.com/meraki/api-v1/#!remove-organization-spaces-integration

- organizationId (string): Organization ID
"""

metadata = {
'tags': ['organizations', 'configure', 'spaces', 'integration'],
'operation': 'removeOrganizationSpacesIntegration'
}
organizationId = urllib.parse.quote(str(organizationId), safe='')
resource = f'/organizations/{organizationId}/spaces/integration/remove'

return self._session.post(metadata, resource)

Loading