Skip to content

Commit 253163a

Browse files
Enhance API support and documentation (#310)
- Added new OpenAPI v3 generator script for library generation. - Updated existing library generation scripts to include additional supported scopes: 'campusGateway', 'nac', and 'spaces'. - Improved documentation for various API methods, including parameter descriptions and return types. - Updated version numbers to reflect changes in the API and library generation capabilities. - Updated with Dashboard API version 1.65.0
1 parent a089f03 commit 253163a

41 files changed

Lines changed: 2736 additions & 240 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

generator/generate_library.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,8 @@ def generate_library(spec: dict, version_number: str, api_version_number: str, i
247247
"secureConnect",
248248
"wirelessController",
249249
"campusGateway",
250-
"spaces"
250+
"spaces",
251+
"nac"
251252
]
252253
# legacy scopes = ['organizations', 'networks', 'devices', 'appliance', 'camera', 'cellularGateway', 'insight',
253254
# 'sm', 'switch', 'wireless']

generator/generate_library_oasv2.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,8 @@ def parse_params(operation, parameters, param_filters=None):
167167
def generate_library(spec, version_number, is_github_action):
168168
# Supported scopes list will include organizations, networks, devices, and all product types.
169169
supported_scopes = ['organizations', 'networks', 'devices', 'appliance', 'camera', 'cellularGateway', 'insight',
170-
'sm', 'switch', 'wireless', 'sensor', 'administered', 'licensing', 'secureConnect']
170+
'sm', 'switch', 'wireless', 'sensor', 'administered', 'licensing', 'secureConnect', 'campusGateway',
171+
'nac', 'spaces', 'wirelessController']
171172
# legacy scopes = ['organizations', 'networks', 'devices', 'appliance', 'camera', 'cellularGateway', 'insight',
172173
# 'sm', 'switch', 'wireless']
173174
tags = spec['tags']

generator/generate_library_oasv3.py

Lines changed: 677 additions & 0 deletions
Large diffs are not rendered by default.

generator/generate_snippets.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,8 @@ def main():
196196
"secureConnect",
197197
"wirelessController",
198198
"campusGateway",
199-
"spaces"
199+
"spaces",
200+
"nac"
200201
]
201202
# legacy scopes = ['organizations', 'networks', 'devices',
202203
# 'appliance', 'camera', 'cellularGateway', 'insight', 'sm', 'switch', 'wireless']

meraki/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@
4646
)
4747
from meraki.rest_session import *
4848

49-
__version__ = '2.0.3'
50-
__api_version__ = '1.58.0'
49+
__version__ = '2.1.0'
50+
__api_version__ = '1.65.0'
5151

5252

5353
class DashboardAPI(object):

meraki/aio/api/appliance.py

Lines changed: 62 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ def updateNetworkApplianceFirewallFirewalledService(self, networkId: str, servic
446446
- networkId (string): Network ID
447447
- service (string): Service
448448
- access (string): A string indicating the rule for which IPs are allowed to use the specified service. Acceptable values are "blocked" (no remote IPs can access the service), "restricted" (only allowed IPs can access the service), and "unrestriced" (any remote IP can access the service). This field is required
449-
- allowedIps (array): An array of allowed IPs that can access the service. This field is required if "access" is set to "restricted". Otherwise this field is ignored
449+
- allowedIps (array): An array of allowed CIDRs that can access the service. This field is required if "access" is set to "restricted". Otherwise this field is ignored
450450
"""
451451

452452
kwargs.update(locals())
@@ -1931,7 +1931,7 @@ def updateNetworkApplianceTrafficShapingUplinkSelection(self, networkId: str, **
19311931
19321932
- networkId (string): Network ID
19331933
- activeActiveAutoVpnEnabled (boolean): Toggle for enabling or disabling active-active AutoVPN
1934-
- defaultUplink (string): The default uplink. Must be one of: 'wan1' or 'wan2'
1934+
- defaultUplink (string): The default uplink. Must be a WAN interface 'wanX'
19351935
- loadBalancingEnabled (boolean): Toggle for enabling or disabling load balancing
19361936
- failoverAndFailback (object): WAN failover and failback behavior
19371937
- wanTrafficUplinkPreferences (array): Array of uplink preference rules for WAN traffic
@@ -2014,7 +2014,7 @@ def getNetworkApplianceUplinksUsageHistory(self, networkId: str, **kwargs):
20142014

20152015
def getNetworkApplianceVlans(self, networkId: str):
20162016
"""
2017-
**List the VLANs for an MX network**
2017+
**List the VLANs for a Cisco Secure Router network**
20182018
https://developer.cisco.com/meraki/api-v1/#!get-network-appliance-vlans
20192019
20202020
- networkId (string): Network ID
@@ -2157,7 +2157,7 @@ def updateNetworkApplianceVlan(self, networkId: str, vlanId: str, **kwargs):
21572157
- groupPolicyId (string): The id of the desired group policy to apply to the VLAN
21582158
- vpnNatSubnet (string): The translated VPN subnet if VPN and VPN subnet translation are enabled on the VLAN
21592159
- dhcpHandling (string): The appliance's handling of DHCP requests on this VLAN. One of: 'Run a DHCP server', 'Relay DHCP to another server' or 'Do not respond to DHCP requests'
2160-
- dhcpRelayServerIps (array): The IPs of the DHCP servers that DHCP requests should be relayed to
2160+
- dhcpRelayServerIps (array): The IPs (IPv4) of the DHCP servers that DHCP requests should be relayed to. CIDR/subnet notation and hostnames are not supported.
21612161
- dhcpLeaseTime (string): The term of DHCP leases if the appliance is running a DHCP server on this VLAN. One of: '30 minutes', '1 hour', '4 hours', '12 hours', '1 day' or '1 week'
21622162
- dhcpBootOptionsEnabled (boolean): Use DHCP boot options specified in other properties
21632163
- dhcpBootNextServer (string): DHCP boot option to direct boot clients to the server to load the boot file from
@@ -3061,22 +3061,34 @@ def getOrganizationApplianceUplinkStatuses(self, organizationId: str, total_page
30613061

30623062

30633063

3064-
def getOrganizationApplianceUplinksStatusesOverview(self, organizationId: str):
3064+
def getOrganizationApplianceUplinksStatusesOverview(self, organizationId: str, **kwargs):
30653065
"""
30663066
**Returns an overview of uplink statuses**
30673067
https://developer.cisco.com/meraki/api-v1/#!get-organization-appliance-uplinks-statuses-overview
30683068
30693069
- organizationId (string): Organization ID
3070+
- networkIds (array): A list of network IDs. The returned devices will be filtered to only include these networks.
30703071
"""
30713072

3073+
kwargs.update(locals())
3074+
30723075
metadata = {
30733076
'tags': ['appliance', 'monitor', 'uplinks', 'statuses', 'overview'],
30743077
'operation': 'getOrganizationApplianceUplinksStatusesOverview'
30753078
}
30763079
organizationId = urllib.parse.quote(str(organizationId), safe='')
30773080
resource = f'/organizations/{organizationId}/appliance/uplinks/statuses/overview'
30783081

3079-
return self._session.get(metadata, resource)
3082+
query_params = ['networkIds', ]
3083+
params = {k.strip(): v for k, v in kwargs.items() if k.strip() in query_params}
3084+
3085+
array_params = ['networkIds', ]
3086+
for k, v in kwargs.items():
3087+
if k.strip() in array_params:
3088+
params[f'{k.strip()}[]'] = kwargs[f'{k}']
3089+
params.pop(k.strip())
3090+
3091+
return self._session.get(metadata, resource, params)
30803092

30813093

30823094

@@ -3107,6 +3119,50 @@ def getOrganizationApplianceUplinksUsageByNetwork(self, organizationId: str, **k
31073119

31083120

31093121

3122+
def getOrganizationApplianceVpnSiteToSiteIpsecPeersSlas(self, organizationId: str):
3123+
"""
3124+
**Get the list of available IPsec SLA policies for an organization**
3125+
https://developer.cisco.com/meraki/api-v1/#!get-organization-appliance-vpn-site-to-site-ipsec-peers-slas
3126+
3127+
- organizationId (string): Organization ID
3128+
"""
3129+
3130+
metadata = {
3131+
'tags': ['appliance', 'configure', 'vpn', 'siteToSite', 'ipsec', 'peers', 'slas'],
3132+
'operation': 'getOrganizationApplianceVpnSiteToSiteIpsecPeersSlas'
3133+
}
3134+
organizationId = urllib.parse.quote(str(organizationId), safe='')
3135+
resource = f'/organizations/{organizationId}/appliance/vpn/siteToSite/ipsec/peers/slas'
3136+
3137+
return self._session.get(metadata, resource)
3138+
3139+
3140+
3141+
def updateOrganizationApplianceVpnSiteToSiteIpsecPeersSlas(self, organizationId: str, **kwargs):
3142+
"""
3143+
**Update the IPsec SLA policies for an organization**
3144+
https://developer.cisco.com/meraki/api-v1/#!update-organization-appliance-vpn-site-to-site-ipsec-peers-slas
3145+
3146+
- organizationId (string): Organization ID
3147+
- items (array): List of IPsec SLA policies
3148+
"""
3149+
3150+
kwargs.update(locals())
3151+
3152+
metadata = {
3153+
'tags': ['appliance', 'configure', 'vpn', 'siteToSite', 'ipsec', 'peers', 'slas'],
3154+
'operation': 'updateOrganizationApplianceVpnSiteToSiteIpsecPeersSlas'
3155+
}
3156+
organizationId = urllib.parse.quote(str(organizationId), safe='')
3157+
resource = f'/organizations/{organizationId}/appliance/vpn/siteToSite/ipsec/peers/slas'
3158+
3159+
body_params = ['items', ]
3160+
payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params}
3161+
3162+
return self._session.put(metadata, resource, payload)
3163+
3164+
3165+
31103166
def getOrganizationApplianceVpnStats(self, organizationId: str, total_pages=1, direction='next', **kwargs):
31113167
"""
31123168
**Show VPN history stat for networks in an organization**

meraki/aio/api/camera.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -868,13 +868,14 @@ def deleteOrganizationCameraCustomAnalyticsArtifact(self, organizationId: str, a
868868

869869

870870

871-
def getOrganizationCameraDetectionsHistoryByBoundaryByInterval(self, organizationId: str, boundaryIds: list, total_pages=1, direction='next', **kwargs):
871+
def getOrganizationCameraDetectionsHistoryByBoundaryByInterval(self, organizationId: str, boundaryIds: list, ranges: list, total_pages=1, direction='next', **kwargs):
872872
"""
873873
**Returns analytics data for timespans**
874874
https://developer.cisco.com/meraki/api-v1/#!get-organization-camera-detections-history-by-boundary-by-interval
875875
876876
- organizationId (string): Organization ID
877877
- boundaryIds (array): A list of boundary ids. The returned cameras will be filtered to only include these ids.
878+
- ranges (array): A list of time ranges with intervals
878879
- total_pages (integer or string): use with perPage to get total results up to total_pages*perPage; -1 or "all" for all pages
879880
- direction (string): direction to paginate, either "next" (default) or "prev" page
880881
- duration (integer): The minimum time, in seconds, that the person or car remains in the area to be counted. Defaults to boundary configuration or 60.
@@ -891,10 +892,10 @@ def getOrganizationCameraDetectionsHistoryByBoundaryByInterval(self, organizatio
891892
organizationId = urllib.parse.quote(str(organizationId), safe='')
892893
resource = f'/organizations/{organizationId}/camera/detections/history/byBoundary/byInterval'
893894

894-
query_params = ['boundaryIds', 'duration', 'perPage', 'boundaryTypes', ]
895+
query_params = ['boundaryIds', 'ranges', 'duration', 'perPage', 'boundaryTypes', ]
895896
params = {k.strip(): v for k, v in kwargs.items() if k.strip() in query_params}
896897

897-
array_params = ['boundaryIds', 'boundaryTypes', ]
898+
array_params = ['boundaryIds', 'ranges', 'boundaryTypes', ]
898899
for k, v in kwargs.items():
899900
if k.strip() in array_params:
900901
params[f'{k.strip()}[]'] = kwargs[f'{k}']

meraki/aio/api/campusGateway.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,42 @@ def updateNetworkCampusGatewayCluster(self, networkId: str, clusterId: str, **kw
7272

7373

7474

75+
def getOrganizationCampusGatewayClusters(self, organizationId: str, total_pages=1, direction='next', **kwargs):
76+
"""
77+
**Get the details of campus gateway clusters**
78+
https://developer.cisco.com/meraki/api-v1/#!get-organization-campus-gateway-clusters
79+
80+
- organizationId (string): Organization ID
81+
- total_pages (integer or string): use with perPage to get total results up to total_pages*perPage; -1 or "all" for all pages
82+
- direction (string): direction to paginate, either "next" (default) or "prev" page
83+
- networkIds (array): Networks for which information should be gathered.
84+
- perPage (integer): The number of entries per page returned. Acceptable range is 3 - 100. Default is 50.
85+
- 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.
86+
- 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.
87+
"""
88+
89+
kwargs.update(locals())
90+
91+
metadata = {
92+
'tags': ['campusGateway', 'configure', 'clusters'],
93+
'operation': 'getOrganizationCampusGatewayClusters'
94+
}
95+
organizationId = urllib.parse.quote(str(organizationId), safe='')
96+
resource = f'/organizations/{organizationId}/campusGateway/clusters'
97+
98+
query_params = ['networkIds', 'perPage', 'startingAfter', 'endingBefore', ]
99+
params = {k.strip(): v for k, v in kwargs.items() if k.strip() in query_params}
100+
101+
array_params = ['networkIds', ]
102+
for k, v in kwargs.items():
103+
if k.strip() in array_params:
104+
params[f'{k.strip()}[]'] = kwargs[f'{k}']
105+
params.pop(k.strip())
106+
107+
return self._session.get_pages(metadata, resource, params, total_pages, direction)
108+
109+
110+
75111
def getOrganizationCampusGatewayDevicesUplinksLocalOverridesByDevice(self, organizationId: str, total_pages=1, direction='next', **kwargs):
76112
"""
77113
**Uplink overrides configured locally on Campus Gateway devices in an organization.**

meraki/aio/api/devices.py

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,52 @@ def getDeviceLiveToolsMacTable(self, serial: str, macTableId: str):
345345

346346

347347

348+
def createDeviceLiveToolsMulticastRouting(self, serial: str, **kwargs):
349+
"""
350+
**Enqueue a job to perform a Multicast routing request for the device**
351+
https://developer.cisco.com/meraki/api-v1/#!create-device-live-tools-multicast-routing
352+
353+
- serial (string): Serial
354+
- callback (object): Details for the callback. Please include either an httpServerId OR url and sharedSecret
355+
"""
356+
357+
kwargs.update(locals())
358+
359+
metadata = {
360+
'tags': ['devices', 'liveTools', 'multicastRouting'],
361+
'operation': 'createDeviceLiveToolsMulticastRouting'
362+
}
363+
serial = urllib.parse.quote(str(serial), safe='')
364+
resource = f'/devices/{serial}/liveTools/multicastRouting'
365+
366+
body_params = ['callback', ]
367+
payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params}
368+
369+
return self._session.post(metadata, resource, payload)
370+
371+
372+
373+
def getDeviceLiveToolsMulticastRouting(self, serial: str, multicastRoutingId: str):
374+
"""
375+
**Return a Multicast routing live tool job.**
376+
https://developer.cisco.com/meraki/api-v1/#!get-device-live-tools-multicast-routing
377+
378+
- serial (string): Serial
379+
- multicastRoutingId (string): Multicast routing ID
380+
"""
381+
382+
metadata = {
383+
'tags': ['devices', 'liveTools', 'multicastRouting'],
384+
'operation': 'getDeviceLiveToolsMulticastRouting'
385+
}
386+
serial = urllib.parse.quote(str(serial), safe='')
387+
multicastRoutingId = urllib.parse.quote(str(multicastRoutingId), safe='')
388+
resource = f'/devices/{serial}/liveTools/multicastRouting/{multicastRoutingId}'
389+
390+
return self._session.get(metadata, resource)
391+
392+
393+
348394
def createDeviceLiveToolsPing(self, serial: str, target: str, **kwargs):
349395
"""
350396
**Enqueue a job to ping a target host from the device**

meraki/aio/api/licensing.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,12 @@ def getAdministeredLicensingSubscriptionSubscriptions(self, organizationIds: lis
4949
- 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.
5050
- 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.
5151
- subscriptionIds (array): List of subscription ids to fetch
52-
- startDate (string): Filter subscriptions by start date, ISO 8601 format. To filter with a range of dates, use 'startDate[<option>]=?' in the request. Accepted options include lt, gt, lte, gte.
53-
- endDate (string): Filter subscriptions by end date, ISO 8601 format. To filter with a range of dates, use 'endDate[<option>]=?' in the request. Accepted options include lt, gt, lte, gte.
5452
- statuses (array): List of statuses that returned subscriptions can have
5553
- productTypes (array): List of product types that returned subscriptions need to have entitlements for.
5654
- skus (array): List of SKUs that returned subscriptions need to have entitlements for.
5755
- name (string): Search for subscription name
56+
- startDate (string): Filter subscriptions by start date, ISO 8601 format. To filter with a range of dates, use 'startDate[<option>]=?' in the request. Accepted options include lt, gt, lte, gte.
57+
- endDate (string): Filter subscriptions by end date, ISO 8601 format. To filter with a range of dates, use 'endDate[<option>]=?' in the request. Accepted options include lt, gt, lte, gte.
5858
"""
5959

6060
kwargs.update(locals())
@@ -65,7 +65,7 @@ def getAdministeredLicensingSubscriptionSubscriptions(self, organizationIds: lis
6565
}
6666
resource = f'/administered/licensing/subscription/subscriptions'
6767

68-
query_params = ['perPage', 'startingAfter', 'endingBefore', 'subscriptionIds', 'organizationIds', 'startDate', 'endDate', 'statuses', 'productTypes', 'skus', 'name', ]
68+
query_params = ['perPage', 'startingAfter', 'endingBefore', 'subscriptionIds', 'organizationIds', 'statuses', 'productTypes', 'skus', 'name', 'startDate', 'endDate', ]
6969
params = {k.strip(): v for k, v in kwargs.items() if k.strip() in query_params}
7070

7171
array_params = ['subscriptionIds', 'organizationIds', 'statuses', 'productTypes', 'skus', ]

0 commit comments

Comments
 (0)