Skip to content

Commit f082295

Browse files
author
Shiyue Cheng
committed
Added new config settings for async REST session
1 parent 13dc2fa commit f082295

13 files changed

Lines changed: 409 additions & 271 deletions

meraki/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
MAXIMUM_RETRIES, OUTPUT_LOG, LOG_PATH, LOG_FILE_PREFIX, PRINT_TO_CONSOLE, SIMULATE_API_CALLS
8787
)
8888

89-
__version__ = '0.100.0'
89+
__version__ = '0.100.1'
9090

9191
class DashboardAPI(object):
9292
"""

meraki/aio/__init__.py

Lines changed: 247 additions & 235 deletions
Large diffs are not rendered by default.

meraki/aio/api/alert_settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ async def updateNetworkAlertSettings(self, networkId: str, **kwargs):
2525
https://api.meraki.com/api_docs#update-the-alert-configuration-for-this-network
2626
2727
- networkId (string)
28-
- defaultDestinations (object): The network_wide destinations for all alerts on the network.
28+
- defaultDestinations (object): The network-wide destinations for all alerts on the network.
2929
- alerts (array): Alert-specific configuration for each type. Only alerts that pertain to the network can be updated.
3030
"""
3131

meraki/aio/api/cameras.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ async def updateDeviceCameraQualityAndRetentionSettings(self, serial: str, **kwa
3131
- restrictedBandwidthModeEnabled (boolean): Boolean indicating if restricted bandwidth is enabled(true) or disabled(false) on the camera
3232
- quality (string): Quality of the camera. Can be one of 'Standard', 'High' or 'Enhanced'. Not all qualities are supported by every camera model.
3333
- resolution (string): Resolution of the camera. Can be one of '1280x720', '1920x1080', '1080x1080' or '2058x2058'. Not all resolutions are supported by every camera model.
34+
- motionDetectorVersion (integer): The version of the motion detector that will be used by the camera. Only applies to Gen 2 cameras. Defaults to v2.
3435
"""
3536

3637
kwargs.update(locals())
@@ -41,14 +42,17 @@ async def updateDeviceCameraQualityAndRetentionSettings(self, serial: str, **kwa
4142
if 'resolution' in kwargs:
4243
options = ['1280x720', '1920x1080', '1080x1080', '2058x2058']
4344
assert kwargs['resolution'] in options, f'''"resolution" cannot be "{kwargs['resolution']}", & must be set to one of: {options}'''
45+
if 'motionDetectorVersion' in kwargs:
46+
options = [1, 2]
47+
assert kwargs['motionDetectorVersion'] in options, f'''"motionDetectorVersion" cannot be "{kwargs['motionDetectorVersion']}", & must be set to one of: {options}'''
4448

4549
metadata = {
4650
'tags': ['Cameras'],
4751
'operation': 'updateDeviceCameraQualityAndRetentionSettings',
4852
}
4953
resource = f'/devices/{serial}/camera/qualityAndRetentionSettings'
5054

51-
body_params = ['profileId', 'motionBasedRetentionEnabled', 'audioRecordingEnabled', 'restrictedBandwidthModeEnabled', 'quality', 'resolution']
55+
body_params = ['profileId', 'motionBasedRetentionEnabled', 'audioRecordingEnabled', 'restrictedBandwidthModeEnabled', 'quality', 'resolution', 'motionDetectorVersion']
5256
payload = {k: v for (k, v) in kwargs.items() if k in body_params}
5357

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

meraki/aio/api/devices.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ async def claimNetworkDevices(self, networkId: str, **kwargs):
5959
}
6060
resource = f'/networks/{networkId}/devices/claim'
6161

62-
body_params = ['serials', 'serial', 'serials']
62+
body_params = ['serials', 'serial']
6363
payload = {k: v for (k, v) in kwargs.items() if k in body_params}
6464

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

meraki/aio/api/networks.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,13 +194,17 @@ async def getNetworkTraffic(self, networkId: str, **kwargs):
194194
- networkId (string)
195195
- t0 (string): The beginning of the timespan for the data. The maximum lookback period is 30 days from today.
196196
- timespan (number): The timespan for which the information will be fetched. If specifying timespan, do not specify parameter t0. The value must be in seconds and be less than or equal to 30 days.
197-
- deviceType (string): Filter the data by device type: combined (default), wireless, switch, appliance.
198-
When using combined, for each rule the data will come from the device type with the most usage.
197+
- deviceType (string): Filter the data by device type: 'combined', 'wireless', 'switch' or 'appliance'. Defaults to 'combined'.
198+
When using 'combined', for each rule the data will come from the device type with the most usage.
199199
200200
"""
201201

202202
kwargs.update(locals())
203203

204+
if 'deviceType' in kwargs:
205+
options = ['combined', 'wireless', 'switch', 'appliance']
206+
assert kwargs['deviceType'] in options, f'''"deviceType" cannot be "{kwargs['deviceType']}", & must be set to one of: {options}'''
207+
204208
metadata = {
205209
'tags': ['Networks'],
206210
'operation': 'getNetworkTraffic',

meraki/aio/api/organizations.py

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ async def deleteOrganization(self, organizationId: str):
9393

9494
return await self._session.delete(metadata, resource)
9595

96-
async def claimOrganization(self, organizationId: str, **kwargs):
96+
async def claimIntoOrganization(self, organizationId: str, **kwargs):
9797
"""
9898
**Claim a list of devices, licenses, and/or orders into an organization. When claiming by order, all devices and licenses in the order will be claimed; licenses will be added to the organization and devices will be placed in the organization's inventory.**
9999
https://api.meraki.com/api_docs#claim-a-list-of-devices-licenses-and/or-orders-into-an-organization
@@ -108,7 +108,31 @@ async def claimOrganization(self, organizationId: str, **kwargs):
108108

109109
metadata = {
110110
'tags': ['Organizations'],
111-
'operation': 'claimOrganization',
111+
'operation': 'claimIntoOrganization',
112+
}
113+
resource = f'/organizations/{organizationId}/claim'
114+
115+
body_params = ['orders', 'serials', 'licenses']
116+
payload = {k: v for (k, v) in kwargs.items() if k in body_params}
117+
118+
return await self._session.post(metadata, resource, payload)
119+
120+
async def claimOrganization(self, organizationId: str, **kwargs):
121+
"""
122+
**Claim a list of devices, licenses, and/or orders into an organization. When claiming by order, all devices and licenses in the order will be claimed; licenses will be added to the organization and devices will be placed in the organization's inventory.**
123+
https://api.meraki.com/api_docs#claim-a-list-of-devices-licenses-and/or-orders-into-an-organization
124+
125+
- organizationId (string)
126+
- orders (array): The numbers of the orders that should be claimed
127+
- serials (array): The serials of the devices that should be claimed
128+
- licenses (array): The licenses that should be claimed
129+
"""
130+
131+
kwargs.update(locals())
132+
133+
metadata = {
134+
'tags': ['Organizations'],
135+
'operation': 'claimIntoOrganization',
112136
}
113137
resource = f'/organizations/{organizationId}/claim'
114138

meraki/aio/api/ssids.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,18 +62,18 @@ async def updateNetworkSsid(self, networkId: str, number: str, **kwargs):
6262
- number (string)
6363
- name (string): The name of the SSID
6464
- enabled (boolean): Whether or not the SSID is enabled
65-
- authMode (string): The association control method for the SSID ('open', 'psk', 'open-with-radius', '8021x-meraki' or '8021x-radius')
65+
- authMode (string): The association control method for the SSID ('open', 'psk', 'open-with-radius', '8021x-meraki', '8021x-radius', 'ipsk-with-radius' or 'ipsk-without-radius')
6666
- enterpriseAdminAccess (string): Whether or not an SSID is accessible by 'enterprise' administrators ('access disabled' or 'access enabled')
6767
- encryptionMode (string): The psk encryption mode for the SSID ('wep' or 'wpa'). This param is only valid if the authMode is 'psk'
6868
- psk (string): The passkey for the SSID. This param is only valid if the authMode is 'psk'
6969
- wpaEncryptionMode (string): The types of WPA encryption. ('WPA1 only', 'WPA1 and WPA2', 'WPA2 only', 'WPA3 Transition Mode' or 'WPA3 only')
7070
- splashPage (string): The type of splash page for the SSID ('None', 'Click-through splash page', 'Billing', 'Password-protected with Meraki RADIUS', 'Password-protected with custom RADIUS', 'Password-protected with Active Directory', 'Password-protected with LDAP', 'SMS authentication', 'Systems Manager Sentry', 'Facebook Wi-Fi', 'Google OAuth' or 'Sponsored guest'). This attribute is not supported for template children.
71-
- radiusServers (array): The RADIUS 802.1x servers to be used for authentication. This param is only valid if the authMode is 'open-with-radius' or '8021x-radius'
71+
- radiusServers (array): The RADIUS 802.1X servers to be used for authentication. This param is only valid if the authMode is 'open-with-radius', '8021x-radius' or 'ipsk-with-radius'
7272
- radiusCoaEnabled (boolean): If true, Meraki devices will act as a RADIUS Dynamic Authorization Server and will respond to RADIUS Change-of-Authorization and Disconnect messages sent by the RADIUS server.
7373
- radiusFailoverPolicy (string): This policy determines how authentication requests should be handled in the event that all of the configured RADIUS servers are unreachable ('Deny access' or 'Allow access')
7474
- radiusLoadBalancingPolicy (string): This policy determines which RADIUS server will be contacted first in an authentication attempt and the ordering of any necessary retry attempts ('Strict priority order' or 'Round robin')
75-
- radiusAccountingEnabled (boolean): Whether or not RADIUS accounting is enabled. This param is only valid if the authMode is 'open-with-radius' or '8021x-radius'
76-
- radiusAccountingServers (array): The RADIUS accounting 802.1x servers to be used for authentication. This param is only valid if the authMode is 'open-with-radius' or '8021x-radius' and radiusAccountingEnabled is 'true'
75+
- radiusAccountingEnabled (boolean): Whether or not RADIUS accounting is enabled. This param is only valid if the authMode is 'open-with-radius', '8021x-radius' or 'ipsk-with-radius'
76+
- radiusAccountingServers (array): The RADIUS accounting 802.1X servers to be used for authentication. This param is only valid if the authMode is 'open-with-radius', '8021x-radius' or 'ipsk-with-radius' and radiusAccountingEnabled is 'true'
7777
- radiusAttributeForGroupPolicies (string): Specify the RADIUS attribute used to look up group policies ('Filter-Id', 'Reply-Message', 'Airespace-ACL-Name' or 'Aruba-User-Role'). Access points must receive this attribute in the RADIUS Access-Accept message
7878
- ipAssignmentMode (string): The client IP assignment mode ('NAT mode', 'Bridge mode', 'Layer 3 roaming', 'Layer 3 roaming with a concentrator' or 'VPN')
7979
- useVlanTagging (boolean): Whether or not traffic should be directed to use specific VLANs. This param is only valid if the ipAssignmentMode is 'Bridge mode' or 'Layer 3 roaming'
@@ -94,7 +94,7 @@ async def updateNetworkSsid(self, networkId: str, number: str, **kwargs):
9494
kwargs.update(locals())
9595

9696
if 'authMode' in kwargs:
97-
options = ['open', 'psk', 'open-with-radius', '8021x-meraki', '8021x-radius']
97+
options = ['open', 'psk', 'open-with-radius', '8021x-meraki', '8021x-radius', 'ipsk-with-radius', 'ipsk-without-radius']
9898
assert kwargs['authMode'] in options, f'''"authMode" cannot be "{kwargs['authMode']}", & must be set to one of: {options}'''
9999
if 'enterpriseAdminAccess' in kwargs:
100100
options = ['access disabled', 'access enabled']

meraki/aio/api/vlans.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ async def getNetworkVlans(self, networkId: str):
1919

2020
return await self._session.get(metadata, resource)
2121

22-
async def createNetworkVlan(self, networkId: str, id: str, name: str, subnet: str, applianceIp: str):
22+
async def createNetworkVlan(self, networkId: str, id: str, name: str, subnet: str, applianceIp: str, **kwargs):
2323
"""
2424
**Add a VLAN**
2525
https://api.meraki.com/api_docs#add-a-vlan
@@ -29,17 +29,18 @@ async def createNetworkVlan(self, networkId: str, id: str, name: str, subnet: st
2929
- name (string): The name of the new VLAN
3030
- subnet (string): The subnet of the VLAN
3131
- applianceIp (string): The local IP of the appliance on the VLAN
32+
- groupPolicyId (string): The id of the desired group policy to apply to the VLAN
3233
"""
3334

34-
kwargs = locals()
35+
kwargs.update(locals())
3536

3637
metadata = {
3738
'tags': ['VLANs'],
3839
'operation': 'createNetworkVlan',
3940
}
4041
resource = f'/networks/{networkId}/vlans'
4142

42-
body_params = ['id', 'name', 'subnet', 'applianceIp']
43+
body_params = ['id', 'name', 'subnet', 'applianceIp', 'groupPolicyId']
4344
payload = {k: v for (k, v) in kwargs.items() if k in body_params}
4445

4546
return await self._session.post(metadata, resource, payload)
@@ -71,6 +72,7 @@ async def updateNetworkVlan(self, networkId: str, vlanId: str, **kwargs):
7172
- name (string): The name of the VLAN
7273
- subnet (string): The subnet of the VLAN
7374
- applianceIp (string): The local IP of the appliance on the VLAN
75+
- groupPolicyId (string): The id of the desired group policy to apply to the VLAN
7476
- vpnNatSubnet (string): The translated VPN subnet if VPN and VPN subnet translation are enabled on the VLAN
7577
- 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'
7678
- dhcpRelayServerIps (array): The IPs of the DHCP servers that DHCP requests should be relayed to
@@ -99,7 +101,7 @@ async def updateNetworkVlan(self, networkId: str, vlanId: str, **kwargs):
99101
}
100102
resource = f'/networks/{networkId}/vlans/{vlanId}'
101103

102-
body_params = ['name', 'subnet', 'applianceIp', 'vpnNatSubnet', 'dhcpHandling', 'dhcpRelayServerIps', 'dhcpLeaseTime', 'dhcpBootOptionsEnabled', 'dhcpBootNextServer', 'dhcpBootFilename', 'fixedIpAssignments', 'reservedIpRanges', 'dnsNameservers', 'dhcpOptions']
104+
body_params = ['name', 'subnet', 'applianceIp', 'groupPolicyId', 'vpnNatSubnet', 'dhcpHandling', 'dhcpRelayServerIps', 'dhcpLeaseTime', 'dhcpBootOptionsEnabled', 'dhcpBootNextServer', 'dhcpBootFilename', 'fixedIpAssignments', 'reservedIpRanges', 'dnsNameservers', 'dhcpOptions']
103105
payload = {k: v for (k, v) in kwargs.items() if k in body_params}
104106

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

0 commit comments

Comments
 (0)