diff --git a/meraki/__init__.py b/meraki/__init__.py index 1d94ea94..5b64dffc 100644 --- a/meraki/__init__.py +++ b/meraki/__init__.py @@ -43,7 +43,7 @@ ) from meraki.rest_session import * -__version__ = '1.43.0' +__version__ = '1.45.0' class DashboardAPI(object): diff --git a/meraki/aio/api/appliance.py b/meraki/aio/api/appliance.py index f7d18df1..5b1f44d0 100644 --- a/meraki/aio/api/appliance.py +++ b/meraki/aio/api/appliance.py @@ -27,14 +27,19 @@ def getDeviceApplianceDhcpSubnets(self, serial: str): - def getDeviceAppliancePerformance(self, serial: str): + def getDeviceAppliancePerformance(self, serial: str, **kwargs): """ **Return the performance score for a single MX** https://developer.cisco.com/meraki/api-v1/#!get-device-appliance-performance - serial (string): Serial + - t0 (string): The beginning of the timespan for the data. + - t1 (string): The end of the timespan for the data. t1 can be a maximum of 14 days after t0. + - timespan (number): The timespan for which the information will be fetched. If specifying timespan, do not specify parameters t0 and t1. The value must be in seconds and be greater than or equal to 30 minutes and be less than or equal to 14 days. The default is 30 minutes. """ + kwargs.update(locals()) + metadata = { 'tags': ['appliance', 'monitor', 'performance'], 'operation': 'getDeviceAppliancePerformance' @@ -42,7 +47,10 @@ def getDeviceAppliancePerformance(self, serial: str): serial = urllib.parse.quote(str(serial), safe='') resource = f'/devices/{serial}/appliance/performance' - return self._session.get(metadata, resource) + query_params = ['t0', 't1', 'timespan', ] + params = {k.strip(): v for k, v in kwargs.items() if k.strip() in query_params} + + return self._session.get(metadata, resource, params) @@ -1143,6 +1151,31 @@ def getNetworkApplianceRfProfile(self, networkId: str, rfProfileId: str): + def updateNetworkApplianceSdwanInternetPolicies(self, networkId: str, **kwargs): + """ + **Update SDWAN internet traffic preferences for an MX network** + https://developer.cisco.com/meraki/api-v1/#!update-network-appliance-sdwan-internet-policies + + - networkId (string): Network ID + - wanTrafficUplinkPreferences (array): policies with respective traffic filters for an MX network + """ + + kwargs.update(locals()) + + metadata = { + 'tags': ['appliance', 'configure', 'sdwan', 'internetPolicies'], + 'operation': 'updateNetworkApplianceSdwanInternetPolicies' + } + networkId = urllib.parse.quote(str(networkId), safe='') + resource = f'/networks/{networkId}/appliance/sdwan/internetPolicies' + + body_params = ['wanTrafficUplinkPreferences', ] + payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params} + + return self._session.put(metadata, resource, payload) + + + def getNetworkApplianceSecurityEvents(self, networkId: str, total_pages=1, direction='next', **kwargs): """ **List the security events for a network** @@ -1495,10 +1528,10 @@ def createNetworkApplianceStaticRoute(self, networkId: str, name: str, subnet: s https://developer.cisco.com/meraki/api-v1/#!create-network-appliance-static-route - networkId (string): Network ID - - name (string): The name of the new static route - - subnet (string): The subnet of the static route - - gatewayIp (string): The gateway IP (next hop) of the static route - - gatewayVlanId (string): The gateway IP (next hop) VLAN ID of the static route + - name (string): Name of the route + - subnet (string): Subnet of the route + - gatewayIp (string): Gateway IP address (next hop) + - gatewayVlanId (string): Gateway VLAN ID """ kwargs.update(locals()) @@ -1545,13 +1578,13 @@ def updateNetworkApplianceStaticRoute(self, networkId: str, staticRouteId: str, - networkId (string): Network ID - staticRouteId (string): Static route ID - - name (string): The name of the static route - - subnet (string): The subnet of the static route - - gatewayIp (string): The gateway IP (next hop) of the static route - - gatewayVlanId (string): The gateway IP (next hop) VLAN ID of the static route - - enabled (boolean): The enabled state of the static route - - fixedIpAssignments (object): The DHCP fixed IP assignments on the static route. This should be an object that contains mappings from MAC addresses to objects that themselves each contain "ip" and "name" string fields. See the sample request/response for more details. - - reservedIpRanges (array): The DHCP reserved IP ranges on the static route + - name (string): Name of the route + - subnet (string): Subnet of the route + - gatewayIp (string): Gateway IP address (next hop) + - gatewayVlanId (string): Gateway VLAN ID + - enabled (boolean): Whether the route should be enabled or not + - fixedIpAssignments (object): Fixed DHCP IP assignments on the route + - reservedIpRanges (array): DHCP reserved IP ranges """ kwargs.update(locals()) diff --git a/meraki/aio/api/camera.py b/meraki/aio/api/camera.py index d8c6ec6b..f7dd8a29 100644 --- a/meraki/aio/api/camera.py +++ b/meraki/aio/api/camera.py @@ -10,7 +10,7 @@ def __init__(self, session): def getDeviceCameraAnalyticsLive(self, serial: str): """ - **Returns live state from camera of analytics zones** + **Returns live state from camera analytics zones** https://developer.cisco.com/meraki/api-v1/#!get-device-camera-analytics-live - serial (string): Serial diff --git a/meraki/aio/api/licensing.py b/meraki/aio/api/licensing.py index 76e606cb..59cb0bc5 100644 --- a/meraki/aio/api/licensing.py +++ b/meraki/aio/api/licensing.py @@ -126,7 +126,7 @@ def validateAdministeredLicensingSubscriptionSubscriptionsClaimKey(self, claimKe - def getAdministeredLicensingSubscriptionSubscriptionsComplianceStatuses(self, **kwargs): + def getAdministeredLicensingSubscriptionSubscriptionsComplianceStatuses(self, organizationIds: list, **kwargs): """ **Get compliance status for requested subscriptions** https://developer.cisco.com/meraki/api-v1/#!get-administered-licensing-subscription-subscriptions-compliance-statuses diff --git a/meraki/aio/api/networks.py b/meraki/aio/api/networks.py index 3ab04f2b..1e6d9490 100644 --- a/meraki/aio/api/networks.py +++ b/meraki/aio/api/networks.py @@ -503,7 +503,7 @@ def updateNetworkClientPolicy(self, networkId: str, clientId: str, devicePolicy: - networkId (string): Network ID - clientId (string): Client ID - devicePolicy (string): The policy to assign. Can be 'Whitelisted', 'Blocked', 'Normal' or 'Group policy'. Required. - - groupPolicyId (string): [optional] If 'devicePolicy' is set to 'Group policy' this param is used to specify the group policy ID. + - groupPolicyId (string): [Optional] If 'devicePolicy' is set to 'Group policy' this param is used to specify the group policy ID. """ kwargs.update(locals()) @@ -644,7 +644,7 @@ def getNetworkDevices(self, networkId: str): def claimNetworkDevices(self, networkId: str, serials: list): """ - **Claim devices into a network. (Note: for recently claimed devices, it may take a few minutes for API requsts against that device to succeed)** + **Claim devices into a network. (Note: for recently claimed devices, it may take a few minutes for API requests against that device to succeed)** https://developer.cisco.com/meraki/api-v1/#!claim-network-devices - networkId (string): Network ID @@ -1392,15 +1392,18 @@ def updateNetworkGroupPolicy(self, networkId: str, groupPolicyId: str, **kwargs) - def deleteNetworkGroupPolicy(self, networkId: str, groupPolicyId: str): + def deleteNetworkGroupPolicy(self, networkId: str, groupPolicyId: str, **kwargs): """ **Delete a group policy** https://developer.cisco.com/meraki/api-v1/#!delete-network-group-policy - networkId (string): Network ID - groupPolicyId (string): Group policy ID + - force (boolean): If true, the system deletes the GP even if there are active clients using the GP. After deletion, active clients that were assigned to that Group Policy will be left without any policy applied. Default is false. """ + kwargs.update(locals()) + metadata = { 'tags': ['networks', 'configure', 'groupPolicies'], 'operation': 'deleteNetworkGroupPolicy' diff --git a/meraki/aio/api/organizations.py b/meraki/aio/api/organizations.py index 8188f53f..e06d2789 100644 --- a/meraki/aio/api/organizations.py +++ b/meraki/aio/api/organizations.py @@ -1206,7 +1206,7 @@ def deleteOrganizationBrandingPolicy(self, organizationId: str, brandingPolicyId def claimIntoOrganization(self, organizationId: str, **kwargs): """ - **Claim a list of devices, licenses, and/or orders into an organization** + **Claim a list of devices, licenses, and/or orders into an organization inventory** https://developer.cisco.com/meraki/api-v1/#!claim-into-organization - organizationId (string): Organization ID @@ -1260,7 +1260,7 @@ def getOrganizationClientsBandwidthUsageHistory(self, organizationId: str, **kwa def getOrganizationClientsOverview(self, organizationId: str, **kwargs): """ - **Return summary information around client data usage (in mb) across the given organization.** + **Return summary information around client data usage (in kb) across the given organization.** https://developer.cisco.com/meraki/api-v1/#!get-organization-clients-overview - organizationId (string): Organization ID @@ -1308,7 +1308,7 @@ def getOrganizationClientsSearch(self, organizationId: str, mac: str, total_page organizationId = urllib.parse.quote(str(organizationId), safe='') resource = f'/organizations/{organizationId}/clients/search' - query_params = ['mac', 'perPage', 'startingAfter', 'endingBefore', ] + query_params = ['perPage', 'startingAfter', 'endingBefore', 'mac', ] params = {k.strip(): v for k, v in kwargs.items() if k.strip() in query_params} return self._session.get_pages(metadata, resource, params, total_pages, direction) @@ -1386,6 +1386,27 @@ def createOrganizationConfigTemplate(self, organizationId: str, name: str, **kwa + def getOrganizationConfigTemplate(self, organizationId: str, configTemplateId: str): + """ + **Return a single configuration template** + https://developer.cisco.com/meraki/api-v1/#!get-organization-config-template + + - organizationId (string): Organization ID + - configTemplateId (string): Config template ID + """ + + metadata = { + 'tags': ['organizations', 'configure', 'configTemplates'], + 'operation': 'getOrganizationConfigTemplate' + } + organizationId = urllib.parse.quote(str(organizationId), safe='') + configTemplateId = urllib.parse.quote(str(configTemplateId), safe='') + resource = f'/organizations/{organizationId}/configTemplates/{configTemplateId}' + + return self._session.get(metadata, resource) + + + def updateOrganizationConfigTemplate(self, organizationId: str, configTemplateId: str, **kwargs): """ **Update a configuration template** @@ -1435,27 +1456,6 @@ def deleteOrganizationConfigTemplate(self, organizationId: str, configTemplateId - def getOrganizationConfigTemplate(self, organizationId: str, configTemplateId: str): - """ - **Return a single configuration template** - https://developer.cisco.com/meraki/api-v1/#!get-organization-config-template - - - organizationId (string): Organization ID - - configTemplateId (string): Config template ID - """ - - metadata = { - 'tags': ['organizations', 'configure', 'configTemplates'], - 'operation': 'getOrganizationConfigTemplate' - } - organizationId = urllib.parse.quote(str(organizationId), safe='') - configTemplateId = urllib.parse.quote(str(configTemplateId), safe='') - resource = f'/organizations/{organizationId}/configTemplates/{configTemplateId}' - - return self._session.get(metadata, resource) - - - def getOrganizationConfigurationChanges(self, organizationId: str, total_pages=1, direction='prev', **kwargs): """ **View the Change Log for your organization** @@ -2165,6 +2165,52 @@ def getOrganizationInventoryDevices(self, organizationId: str, total_pages=1, di + def createOrganizationInventoryDevicesSwapsBulk(self, organizationId: str, swaps: list): + """ + **Swap the devices identified by devices.old with a devices.new, then perform the :afterAction on the devices.old.** + https://developer.cisco.com/meraki/api-v1/#!create-organization-inventory-devices-swaps-bulk + + - organizationId (string): Organization ID + - swaps (array): List of replacments to perform + """ + + kwargs = locals() + + metadata = { + 'tags': ['organizations', 'configure', 'inventory', 'devices', 'swaps', 'bulk'], + 'operation': 'createOrganizationInventoryDevicesSwapsBulk' + } + organizationId = urllib.parse.quote(str(organizationId), safe='') + resource = f'/organizations/{organizationId}/inventory/devices/swaps/bulk' + + body_params = ['swaps', ] + payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params} + + return self._session.post(metadata, resource, payload) + + + + def getOrganizationInventoryDevicesSwapsBulk(self, organizationId: str, id: str): + """ + **List of device swaps for a given request ID ({id}).** + https://developer.cisco.com/meraki/api-v1/#!get-organization-inventory-devices-swaps-bulk + + - organizationId (string): Organization ID + - id (string): ID + """ + + metadata = { + 'tags': ['organizations', 'configure', 'inventory', 'devices', 'swaps', 'bulk'], + 'operation': 'getOrganizationInventoryDevicesSwapsBulk' + } + organizationId = urllib.parse.quote(str(organizationId), safe='') + id = urllib.parse.quote(str(id), safe='') + resource = f'/organizations/{organizationId}/inventory/devices/swaps/bulk/{id}' + + return self._session.get(metadata, resource) + + + def getOrganizationInventoryDevice(self, organizationId: str, serial: str): """ **Return a single device from the inventory of an organization** diff --git a/meraki/aio/api/sensor.py b/meraki/aio/api/sensor.py index 82cf6533..45440120 100644 --- a/meraki/aio/api/sensor.py +++ b/meraki/aio/api/sensor.py @@ -8,6 +8,96 @@ def __init__(self, session): + def getDeviceSensorCommands(self, serial: str, total_pages=1, direction='next', **kwargs): + """ + **Returns a historical log of all commands** + https://developer.cisco.com/meraki/api-v1/#!get-device-sensor-commands + + - serial (string): Serial + - 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 + - operations (array): Optional parameter to filter commands by operation. Allowed values are disableDownstreamPower, enableDownstreamPower, cycleDownstreamPower, and refreshData. + - perPage (integer): The number of entries per page returned. Acceptable range is 3 - 1000. Default is 10. + - 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. + - sortOrder (string): Sorted order of entries. Order options are 'ascending' and 'descending'. Default is 'descending'. + - t0 (string): The beginning of the timespan for the data. The maximum lookback period is 30 days from today. + - t1 (string): The end of the timespan for the data. t1 can be a maximum of 30 days after t0. + - timespan (number): The timespan for which the information will be fetched. If specifying timespan, do not specify parameters t0 and t1. The value must be in seconds and be less than or equal to 30 days. The default is 30 days. + """ + + kwargs.update(locals()) + + if 'sortOrder' in kwargs: + options = ['ascending', 'descending'] + assert kwargs['sortOrder'] in options, f'''"sortOrder" cannot be "{kwargs['sortOrder']}", & must be set to one of: {options}''' + + metadata = { + 'tags': ['sensor', 'configure', 'commands'], + 'operation': 'getDeviceSensorCommands' + } + serial = urllib.parse.quote(str(serial), safe='') + resource = f'/devices/{serial}/sensor/commands' + + query_params = ['operations', 'perPage', 'startingAfter', 'endingBefore', 'sortOrder', 't0', 't1', 'timespan', ] + params = {k.strip(): v for k, v in kwargs.items() if k.strip() in query_params} + + array_params = ['operations', ] + 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) + + + + def createDeviceSensorCommand(self, serial: str, operation: str): + """ + **Sends a command to a sensor** + https://developer.cisco.com/meraki/api-v1/#!create-device-sensor-command + + - serial (string): Serial + - operation (string): Operation to run on the sensor. 'enableDownstreamPower', 'disableDownstreamPower', and 'cycleDownstreamPower' turn power on/off to the device that is connected downstream of an MT40 power monitor. 'refreshData' causes an MT15 or MT40 device to upload its latest readings so that they are immediately available in the Dashboard API. + """ + + kwargs = locals() + + metadata = { + 'tags': ['sensor', 'configure', 'commands'], + 'operation': 'createDeviceSensorCommand' + } + serial = urllib.parse.quote(str(serial), safe='') + resource = f'/devices/{serial}/sensor/commands' + + body_params = ['operation', ] + payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params} + + return self._session.post(metadata, resource, payload) + + + + def getDeviceSensorCommand(self, serial: str, commandId: str): + """ + **Returns information about the command's execution, including the status** + https://developer.cisco.com/meraki/api-v1/#!get-device-sensor-command + + - serial (string): Serial + - commandId (string): Command ID + """ + + metadata = { + 'tags': ['sensor', 'configure', 'commands'], + 'operation': 'getDeviceSensorCommand' + } + serial = urllib.parse.quote(str(serial), safe='') + commandId = urllib.parse.quote(str(commandId), safe='') + resource = f'/devices/{serial}/sensor/commands/{commandId}' + + return self._session.get(metadata, resource) + + + def getDeviceSensorRelationships(self, serial: str): """ **List the sensor roles for a given sensor or camera device.** diff --git a/meraki/aio/api/switch.py b/meraki/aio/api/switch.py index ad49aab1..991bb8e5 100644 --- a/meraki/aio/api/switch.py +++ b/meraki/aio/api/switch.py @@ -136,8 +136,8 @@ def updateDeviceSwitchPort(self, serial: str, portId: str, **kwargs): - tags (array): The list of tags of the switch port. - enabled (boolean): The status of the switch port. - poeEnabled (boolean): The PoE status of the switch port. - - type (string): The type of the switch port ('trunk' or 'access'). - - vlan (integer): The VLAN of the switch port. A null value will clear the value set for trunk ports. + - type (string): The type of the switch port ('trunk', 'access' or 'stack'). + - vlan (integer): The VLAN of the switch port. For a trunk port, this is the native VLAN. A null value will clear the value set for trunk ports. - voiceVlan (integer): The voice VLAN of the switch port. Only applicable to access ports. - allowedVlans (string): The VLANs allowed on the switch port. Only applicable to trunk ports. - isolationEnabled (boolean): The isolation status of the switch port. @@ -162,7 +162,7 @@ def updateDeviceSwitchPort(self, serial: str, portId: str, **kwargs): kwargs.update(locals()) if 'type' in kwargs: - options = ['access', 'trunk'] + options = ['access', 'stack', 'trunk'] assert kwargs['type'] in options, f'''"type" cannot be "{kwargs['type']}", & must be set to one of: {options}''' if 'stpGuard' in kwargs: options = ['bpdu guard', 'disabled', 'loop guard', 'root guard'] @@ -1342,12 +1342,12 @@ def createNetworkSwitchQosRule(self, networkId: str, vlan: int, **kwargs): - networkId (string): Network ID - vlan (integer): The VLAN of the incoming packet. A null value will match any VLAN. - - protocol (string): The protocol of the incoming packet. Can be one of "ANY", "TCP" or "UDP". Default value is "ANY" + - protocol (string): The protocol of the incoming packet. Default value is "ANY" - srcPort (integer): The source port of the incoming packet. Applicable only if protocol is TCP or UDP. - - srcPortRange (string): The source port range of the incoming packet. Applicable only if protocol is set to TCP or UDP. Example: 70-80 + - srcPortRange (string): The source port range of the incoming packet. Applicable only if protocol is set to TCP or UDP. - dstPort (integer): The destination port of the incoming packet. Applicable only if protocol is TCP or UDP. - - dstPortRange (string): The destination port range of the incoming packet. Applicable only if protocol is set to TCP or UDP. Example: 70-80 - - dscp (integer): DSCP tag. Set this to -1 to trust incoming DSCP. Default value is 0 + - dstPortRange (string): The destination port range of the incoming packet. Applicable only if protocol is set to TCP or UDP. + - dscp (integer): DSCP tag for the incoming packet. Set this to -1 to trust incoming DSCP. Default value is 0 """ kwargs.update(locals()) @@ -1464,12 +1464,12 @@ def updateNetworkSwitchQosRule(self, networkId: str, qosRuleId: str, **kwargs): - networkId (string): Network ID - qosRuleId (string): Qos rule ID - vlan (integer): The VLAN of the incoming packet. A null value will match any VLAN. - - protocol (string): The protocol of the incoming packet. Can be one of "ANY", "TCP" or "UDP". Default value is "ANY". + - protocol (string): The protocol of the incoming packet. Default value is "ANY" - srcPort (integer): The source port of the incoming packet. Applicable only if protocol is TCP or UDP. - - srcPortRange (string): The source port range of the incoming packet. Applicable only if protocol is set to TCP or UDP. Example: 70-80 + - srcPortRange (string): The source port range of the incoming packet. Applicable only if protocol is set to TCP or UDP. - dstPort (integer): The destination port of the incoming packet. Applicable only if protocol is TCP or UDP. - - dstPortRange (string): The destination port range of the incoming packet. Applicable only if protocol is set to TCP or UDP. Example: 70-80 - - dscp (integer): DSCP tag that should be assigned to incoming packet. Set this to -1 to trust incoming DSCP. Default value is 0. + - dstPortRange (string): The destination port range of the incoming packet. Applicable only if protocol is set to TCP or UDP. + - dscp (integer): DSCP tag that should be assigned to incoming packet. Set this to -1 to trust incoming DSCP. Default value is 0 """ kwargs.update(locals()) @@ -1632,7 +1632,7 @@ def updateNetworkSwitchRoutingMulticastRendezvousPoint(self, networkId: str, ren - networkId (string): Network ID - rendezvousPointId (string): Rendezvous point ID - - interfaceIp (string): The IP address of the interface to use + - interfaceIp (string): The IP address of the interface where the RP needs to be created. - multicastGroup (string): 'Any', or the IP address of a multicast group """ @@ -1772,7 +1772,7 @@ def getNetworkSwitchStacks(self, networkId: str): def createNetworkSwitchStack(self, networkId: str, name: str, serials: list): """ - **Create a stack** + **Create a switch stack** https://developer.cisco.com/meraki/api-v1/#!create-network-switch-stack - networkId (string): Network ID @@ -2419,8 +2419,8 @@ def updateOrganizationConfigTemplateSwitchProfilePort(self, organizationId: str, - tags (array): The list of tags of the switch template port. - enabled (boolean): The status of the switch template port. - poeEnabled (boolean): The PoE status of the switch template port. - - type (string): The type of the switch template port ('trunk' or 'access'). - - vlan (integer): The VLAN of the switch template port. A null value will clear the value set for trunk ports. + - type (string): The type of the switch template port ('trunk', 'access' or 'stack'). + - vlan (integer): The VLAN of the switch template port. For a trunk port, this is the native VLAN. A null value will clear the value set for trunk ports. - voiceVlan (integer): The voice VLAN of the switch template port. Only applicable to access ports. - allowedVlans (string): The VLANs allowed on the switch template port. Only applicable to trunk ports. - isolationEnabled (boolean): The isolation status of the switch template port. @@ -2443,7 +2443,7 @@ def updateOrganizationConfigTemplateSwitchProfilePort(self, organizationId: str, kwargs.update(locals()) if 'type' in kwargs: - options = ['access', 'trunk'] + options = ['access', 'stack', 'trunk'] assert kwargs['type'] in options, f'''"type" cannot be "{kwargs['type']}", & must be set to one of: {options}''' if 'stpGuard' in kwargs: options = ['bpdu guard', 'disabled', 'loop guard', 'root guard'] @@ -2566,3 +2566,30 @@ def getOrganizationSwitchPortsBySwitch(self, organizationId: str, total_pages=1, return self._session.get_pages(metadata, resource, params, total_pages, direction) + + + def getOrganizationSwitchPortsOverview(self, organizationId: str, **kwargs): + """ + **Returns the counts of all active ports for the requested timespan, grouped by speed** + https://developer.cisco.com/meraki/api-v1/#!get-organization-switch-ports-overview + + - organizationId (string): Organization ID + - t0 (string): The beginning of the timespan for the data. + - t1 (string): The end of the timespan for the data. t1 can be a maximum of 31 days after t0. + - timespan (number): The timespan for which the information will be fetched. If specifying timespan, do not specify parameters t0 and t1. The value must be in seconds and be greater than or equal to 12 hours and be less than or equal to 31 days. The default is 1 day. + """ + + kwargs.update(locals()) + + metadata = { + 'tags': ['switch', 'monitor', 'ports', 'overview'], + 'operation': 'getOrganizationSwitchPortsOverview' + } + organizationId = urllib.parse.quote(str(organizationId), safe='') + resource = f'/organizations/{organizationId}/switch/ports/overview' + + query_params = ['t0', 't1', 'timespan', ] + params = {k.strip(): v for k, v in kwargs.items() if k.strip() in query_params} + + return self._session.get(metadata, resource, params) + diff --git a/meraki/aio/api/wireless.py b/meraki/aio/api/wireless.py index 4b89edd2..37df2d44 100644 --- a/meraki/aio/api/wireless.py +++ b/meraki/aio/api/wireless.py @@ -585,9 +585,9 @@ def getNetworkWirelessClientConnectivityEvents(self, networkId: str, clientId: s - t1 (string): The end of the timespan for the data. t1 can be a maximum of 31 days after t0. - timespan (number): The timespan for which the information will be fetched. If specifying timespan, do not specify parameters t0 and t1. The value must be in seconds and be less than or equal to 31 days. The default is 1 day. - types (array): A list of event types to include. If not specified, events of all types will be returned. Valid types are 'assoc', 'disassoc', 'auth', 'deauth', 'dns', 'dhcp', 'roam', 'connection' and/or 'sticky'. + - band (string): Filter results by band. Valid bands are '2.4', '5' or '6'. + - ssidNumber (integer): Filter results by SSID. If not specified, events for all SSIDs will be returned. - includedSeverities (array): A list of severities to include. If not specified, events of all severities will be returned. Valid severities are 'good', 'info', 'warn' and/or 'bad'. - - band (string): Filter results by band (either '2.4', '5', '6'). - - ssidNumber (integer): An SSID number to include. If not specified, events for all SSIDs will be returned. - deviceSerial (string): Filter results by an AP's serial number. """ @@ -608,7 +608,7 @@ def getNetworkWirelessClientConnectivityEvents(self, networkId: str, clientId: s clientId = urllib.parse.quote(str(clientId), safe='') resource = f'/networks/{networkId}/wireless/clients/{clientId}/connectivityEvents' - query_params = ['perPage', 'startingAfter', 'endingBefore', 't0', 't1', 'timespan', 'types', 'includedSeverities', 'band', 'ssidNumber', 'deviceSerial', ] + query_params = ['perPage', 'startingAfter', 'endingBefore', 't0', 't1', 'timespan', 'types', 'band', 'ssidNumber', 'includedSeverities', 'deviceSerial', ] params = {k.strip(): v for k, v in kwargs.items() if k.strip() in query_params} array_params = ['types', 'includedSeverities', ] @@ -1326,7 +1326,7 @@ def updateNetworkWirelessSettings(self, networkId: str, **kwargs): - meshingEnabled (boolean): Toggle for enabling or disabling meshing in a network - ipv6BridgeEnabled (boolean): Toggle for enabling or disabling IPv6 bridging in a network (Note: if enabled, SSIDs must also be configured to use bridge mode) - locationAnalyticsEnabled (boolean): Toggle for enabling or disabling location analytics for your network - - upgradeStrategy (string): The upgrade strategy to apply to the network. Must be one of 'minimizeUpgradeTime' or 'minimizeClientDowntime'. Requires firmware version MR 26.8 or higher' + - upgradeStrategy (string): The default strategy that network devices will use to perform an upgrade. Requires firmware version MR 26.8 or higher. - ledLightsOn (boolean): Toggle for enabling or disabling LED lights on all APs in the network (making them run dark) - namedVlans (object): Named VLAN settings for wireless networks. """ @@ -1717,7 +1717,7 @@ def updateNetworkWirelessSsidFirewallL3FirewallRules(self, networkId: str, numbe - networkId (string): Network ID - number (string): Number - - rules (array): An ordered array of the firewall rules for this SSID (not including the local LAN access rule or the default rule) + - rules (array): An ordered array of the firewall rules for this SSID (not including the local LAN access rule or the default rule). - allowLanAccess (boolean): Allow wireless client access to local LAN (boolean value - true allows access and false denies access) (optional) """ @@ -2556,3 +2556,86 @@ def getOrganizationWirelessDevicesPacketLossByNetwork(self, organizationId: str, return self._session.get_pages(metadata, resource, params, total_pages, direction) + + + def getOrganizationWirelessRfProfilesAssignmentsByDevice(self, organizationId: str, total_pages=1, direction='next', **kwargs): + """ + **List the RF profiles of an organization by device** + https://developer.cisco.com/meraki/api-v1/#!get-organization-wireless-rf-profiles-assignments-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 + - 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. + - 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, and sensor. + - name (string): Optional parameter to filter RF profiles by device name. All returned devices will have a name that contains the search term or is an exact match. + - mac (string): Optional parameter to filter RF profiles by device MAC address. All returned devices will have a MAC address that contains the search term or is an exact match. + - serial (string): Optional parameter to filter RF profiles by device serial number. All returned devices will have a serial number that contains the search term or is an exact match. + - model (string): Optional parameter to filter RF profiles by device model. All returned devices will have a model that contains the search term or is an exact match. + - macs (array): Optional parameter to filter RF profiles by one or more device MAC addresses. All returned devices will have a MAC address that is an exact match. + - serials (array): Optional parameter to filter RF profiles by one or more device serial numbers. All returned devices will have a serial number that is an exact match. + - models (array): Optional parameter to filter RF profiles by one or more device models. All returned devices will have a model that is an exact match. + """ + + kwargs.update(locals()) + + metadata = { + 'tags': ['wireless', 'configure', 'rfProfiles', 'assignments', 'byDevice'], + 'operation': 'getOrganizationWirelessRfProfilesAssignmentsByDevice' + } + organizationId = urllib.parse.quote(str(organizationId), safe='') + resource = f'/organizations/{organizationId}/wireless/rfProfiles/assignments/byDevice' + + query_params = ['perPage', 'startingAfter', 'endingBefore', 'networkIds', 'productTypes', 'name', 'mac', 'serial', 'model', 'macs', 'serials', 'models', ] + params = {k.strip(): v for k, v in kwargs.items() if k.strip() in query_params} + + array_params = ['networkIds', 'productTypes', 'macs', 'serials', 'models', ] + 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) + + + + def getOrganizationWirelessSsidsStatusesByDevice(self, organizationId: str, total_pages=1, direction='next', **kwargs): + """ + **List status information of all BSSIDs in your organization** + https://developer.cisco.com/meraki/api-v1/#!get-organization-wireless-ssids-statuses-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 + - networkIds (array): Optional parameter to filter the result set by the included set of network IDs + - serials (array): A list of serial numbers. The returned devices will be filtered to only include these serials. + - bssids (array): A list of BSSIDs. The returned devices will be filtered to only include these BSSIDs. + - hideDisabled (boolean): If true, the returned devices will not include disabled SSIDs. (default: false) + - perPage (integer): The number of entries per page returned. Acceptable range is 3 - 500. Default is 100. + - 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': ['wireless', 'configure', 'ssids', 'statuses', 'byDevice'], + 'operation': 'getOrganizationWirelessSsidsStatusesByDevice' + } + organizationId = urllib.parse.quote(str(organizationId), safe='') + resource = f'/organizations/{organizationId}/wireless/ssids/statuses/byDevice' + + query_params = ['networkIds', 'serials', 'bssids', 'hideDisabled', 'perPage', 'startingAfter', 'endingBefore', ] + params = {k.strip(): v for k, v in kwargs.items() if k.strip() in query_params} + + array_params = ['networkIds', 'serials', 'bssids', ] + 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) + diff --git a/meraki/api/appliance.py b/meraki/api/appliance.py index f0a93fcc..708e2908 100644 --- a/meraki/api/appliance.py +++ b/meraki/api/appliance.py @@ -27,14 +27,19 @@ def getDeviceApplianceDhcpSubnets(self, serial: str): - def getDeviceAppliancePerformance(self, serial: str): + def getDeviceAppliancePerformance(self, serial: str, **kwargs): """ **Return the performance score for a single MX** https://developer.cisco.com/meraki/api-v1/#!get-device-appliance-performance - serial (string): Serial + - t0 (string): The beginning of the timespan for the data. + - t1 (string): The end of the timespan for the data. t1 can be a maximum of 14 days after t0. + - timespan (number): The timespan for which the information will be fetched. If specifying timespan, do not specify parameters t0 and t1. The value must be in seconds and be greater than or equal to 30 minutes and be less than or equal to 14 days. The default is 30 minutes. """ + kwargs.update(locals()) + metadata = { 'tags': ['appliance', 'monitor', 'performance'], 'operation': 'getDeviceAppliancePerformance' @@ -42,7 +47,10 @@ def getDeviceAppliancePerformance(self, serial: str): serial = urllib.parse.quote(str(serial), safe='') resource = f'/devices/{serial}/appliance/performance' - return self._session.get(metadata, resource) + query_params = ['t0', 't1', 'timespan', ] + params = {k.strip(): v for k, v in kwargs.items() if k.strip() in query_params} + + return self._session.get(metadata, resource, params) @@ -1143,6 +1151,31 @@ def getNetworkApplianceRfProfile(self, networkId: str, rfProfileId: str): + def updateNetworkApplianceSdwanInternetPolicies(self, networkId: str, **kwargs): + """ + **Update SDWAN internet traffic preferences for an MX network** + https://developer.cisco.com/meraki/api-v1/#!update-network-appliance-sdwan-internet-policies + + - networkId (string): Network ID + - wanTrafficUplinkPreferences (array): policies with respective traffic filters for an MX network + """ + + kwargs.update(locals()) + + metadata = { + 'tags': ['appliance', 'configure', 'sdwan', 'internetPolicies'], + 'operation': 'updateNetworkApplianceSdwanInternetPolicies' + } + networkId = urllib.parse.quote(str(networkId), safe='') + resource = f'/networks/{networkId}/appliance/sdwan/internetPolicies' + + body_params = ['wanTrafficUplinkPreferences', ] + payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params} + + return self._session.put(metadata, resource, payload) + + + def getNetworkApplianceSecurityEvents(self, networkId: str, total_pages=1, direction='next', **kwargs): """ **List the security events for a network** @@ -1495,10 +1528,10 @@ def createNetworkApplianceStaticRoute(self, networkId: str, name: str, subnet: s https://developer.cisco.com/meraki/api-v1/#!create-network-appliance-static-route - networkId (string): Network ID - - name (string): The name of the new static route - - subnet (string): The subnet of the static route - - gatewayIp (string): The gateway IP (next hop) of the static route - - gatewayVlanId (string): The gateway IP (next hop) VLAN ID of the static route + - name (string): Name of the route + - subnet (string): Subnet of the route + - gatewayIp (string): Gateway IP address (next hop) + - gatewayVlanId (string): Gateway VLAN ID """ kwargs.update(locals()) @@ -1545,13 +1578,13 @@ def updateNetworkApplianceStaticRoute(self, networkId: str, staticRouteId: str, - networkId (string): Network ID - staticRouteId (string): Static route ID - - name (string): The name of the static route - - subnet (string): The subnet of the static route - - gatewayIp (string): The gateway IP (next hop) of the static route - - gatewayVlanId (string): The gateway IP (next hop) VLAN ID of the static route - - enabled (boolean): The enabled state of the static route - - fixedIpAssignments (object): The DHCP fixed IP assignments on the static route. This should be an object that contains mappings from MAC addresses to objects that themselves each contain "ip" and "name" string fields. See the sample request/response for more details. - - reservedIpRanges (array): The DHCP reserved IP ranges on the static route + - name (string): Name of the route + - subnet (string): Subnet of the route + - gatewayIp (string): Gateway IP address (next hop) + - gatewayVlanId (string): Gateway VLAN ID + - enabled (boolean): Whether the route should be enabled or not + - fixedIpAssignments (object): Fixed DHCP IP assignments on the route + - reservedIpRanges (array): DHCP reserved IP ranges """ kwargs.update(locals()) diff --git a/meraki/api/batch/appliance.py b/meraki/api/batch/appliance.py index 31388a92..1454dba2 100644 --- a/meraki/api/batch/appliance.py +++ b/meraki/api/batch/appliance.py @@ -383,6 +383,37 @@ def deleteNetworkApplianceRfProfile(self, networkId: str, rfProfileId: str): + def updateNetworkApplianceSdwanInternetPolicies(self, networkId: str, **kwargs): + """ + **Update SDWAN internet traffic preferences for an MX network** + https://developer.cisco.com/meraki/api-v1/#!update-network-appliance-sdwan-internet-policies + + - networkId (string): Network ID + - wanTrafficUplinkPreferences (array): policies with respective traffic filters for an MX network + """ + + kwargs.update(locals()) + + metadata = { + 'tags': ['appliance', 'configure', 'sdwan', 'internetPolicies'], + 'operation': 'updateNetworkApplianceSdwanInternetPolicies' + } + resource = f'/networks/{networkId}/appliance/sdwan/internetPolicies' + + body_params = ['wanTrafficUplinkPreferences', ] + payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params} + action = { + "resource": resource, + "operation": "update", + "body": payload + } + return action + + + + + + def updateNetworkApplianceSettings(self, networkId: str, **kwargs): """ **Update the appliance settings for a network** diff --git a/meraki/api/batch/networks.py b/meraki/api/batch/networks.py index 30e61093..80cf68ce 100644 --- a/meraki/api/batch/networks.py +++ b/meraki/api/batch/networks.py @@ -140,7 +140,7 @@ def provisionNetworkClients(self, networkId: str, clients: list, devicePolicy: s def claimNetworkDevices(self, networkId: str, serials: list): """ - **Claim devices into a network. (Note: for recently claimed devices, it may take a few minutes for API requsts against that device to succeed)** + **Claim devices into a network. (Note: for recently claimed devices, it may take a few minutes for API requests against that device to succeed). This operation can be used up to ten times within a single five minute window.** https://developer.cisco.com/meraki/api-v1/#!claim-network-devices - networkId (string): Network ID @@ -521,15 +521,18 @@ def updateNetworkGroupPolicy(self, networkId: str, groupPolicyId: str, **kwargs) - def deleteNetworkGroupPolicy(self, networkId: str, groupPolicyId: str): + def deleteNetworkGroupPolicy(self, networkId: str, groupPolicyId: str, **kwargs): """ **Delete a group policy** https://developer.cisco.com/meraki/api-v1/#!delete-network-group-policy - networkId (string): Network ID - groupPolicyId (string): Group policy ID + - force (boolean): If true, the system deletes the GP even if there are active clients using the GP. After deletion, active clients that were assigned to that Group Policy will be left without any policy applied. Default is false. """ + kwargs.update(locals()) + metadata = { 'tags': ['networks', 'configure', 'groupPolicies'], 'operation': 'deleteNetworkGroupPolicy' diff --git a/meraki/api/batch/sensor.py b/meraki/api/batch/sensor.py index 49cf6a4e..f8f534f4 100644 --- a/meraki/api/batch/sensor.py +++ b/meraki/api/batch/sensor.py @@ -7,6 +7,37 @@ def __init__(self): + def createDeviceSensorCommand(self, serial: str, operation: str): + """ + **Sends a command to a sensor** + https://developer.cisco.com/meraki/api-v1/#!create-device-sensor-command + + - serial (string): Serial + - operation (string): Operation to run on the sensor. 'enableDownstreamPower', 'disableDownstreamPower', and 'cycleDownstreamPower' turn power on/off to the device that is connected downstream of an MT40 power monitor. 'refreshData' causes an MT15 or MT40 device to upload its latest readings so that they are immediately available in the Dashboard API. + """ + + kwargs = locals() + + metadata = { + 'tags': ['sensor', 'configure', 'commands'], + 'operation': 'createDeviceSensorCommand' + } + resource = f'/devices/{serial}/sensor/commands' + + body_params = ['operation', ] + payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params} + action = { + "resource": resource, + "operation": "create", + "body": payload + } + return action + + + + + + def updateDeviceSensorRelationships(self, serial: str, **kwargs): """ **Assign one or more sensor roles to a given sensor or camera device.** diff --git a/meraki/api/batch/switch.py b/meraki/api/batch/switch.py index 2347811b..2c9decc0 100644 --- a/meraki/api/batch/switch.py +++ b/meraki/api/batch/switch.py @@ -49,8 +49,8 @@ def updateDeviceSwitchPort(self, serial: str, portId: str, **kwargs): - tags (array): The list of tags of the switch port. - enabled (boolean): The status of the switch port. - poeEnabled (boolean): The PoE status of the switch port. - - type (string): The type of the switch port ('trunk' or 'access'). - - vlan (integer): The VLAN of the switch port. A null value will clear the value set for trunk ports. + - type (string): The type of the switch port ('trunk', 'access' or 'stack'). + - vlan (integer): The VLAN of the switch port. For a trunk port, this is the native VLAN. A null value will clear the value set for trunk ports. - voiceVlan (integer): The voice VLAN of the switch port. Only applicable to access ports. - allowedVlans (string): The VLANs allowed on the switch port. Only applicable to trunk ports. - isolationEnabled (boolean): The isolation status of the switch port. @@ -75,7 +75,7 @@ def updateDeviceSwitchPort(self, serial: str, portId: str, **kwargs): kwargs.update(locals()) if 'type' in kwargs: - options = ['access', 'trunk'] + options = ['access', 'stack', 'trunk'] assert kwargs['type'] in options, f'''"type" cannot be "{kwargs['type']}", & must be set to one of: {options}''' if 'stpGuard' in kwargs: options = ['bpdu guard', 'disabled', 'loop guard', 'root guard'] @@ -904,12 +904,12 @@ def createNetworkSwitchQosRule(self, networkId: str, vlan: int, **kwargs): - networkId (string): Network ID - vlan (integer): The VLAN of the incoming packet. A null value will match any VLAN. - - protocol (string): The protocol of the incoming packet. Can be one of "ANY", "TCP" or "UDP". Default value is "ANY" + - protocol (string): The protocol of the incoming packet. Default value is "ANY" - srcPort (integer): The source port of the incoming packet. Applicable only if protocol is TCP or UDP. - - srcPortRange (string): The source port range of the incoming packet. Applicable only if protocol is set to TCP or UDP. Example: 70-80 + - srcPortRange (string): The source port range of the incoming packet. Applicable only if protocol is set to TCP or UDP. - dstPort (integer): The destination port of the incoming packet. Applicable only if protocol is TCP or UDP. - - dstPortRange (string): The destination port range of the incoming packet. Applicable only if protocol is set to TCP or UDP. Example: 70-80 - - dscp (integer): DSCP tag. Set this to -1 to trust incoming DSCP. Default value is 0 + - dstPortRange (string): The destination port range of the incoming packet. Applicable only if protocol is set to TCP or UDP. + - dscp (integer): DSCP tag for the incoming packet. Set this to -1 to trust incoming DSCP. Default value is 0 """ kwargs.update(locals()) @@ -1003,12 +1003,12 @@ def updateNetworkSwitchQosRule(self, networkId: str, qosRuleId: str, **kwargs): - networkId (string): Network ID - qosRuleId (string): Qos rule ID - vlan (integer): The VLAN of the incoming packet. A null value will match any VLAN. - - protocol (string): The protocol of the incoming packet. Can be one of "ANY", "TCP" or "UDP". Default value is "ANY". + - protocol (string): The protocol of the incoming packet. Default value is "ANY" - srcPort (integer): The source port of the incoming packet. Applicable only if protocol is TCP or UDP. - - srcPortRange (string): The source port range of the incoming packet. Applicable only if protocol is set to TCP or UDP. Example: 70-80 + - srcPortRange (string): The source port range of the incoming packet. Applicable only if protocol is set to TCP or UDP. - dstPort (integer): The destination port of the incoming packet. Applicable only if protocol is TCP or UDP. - - dstPortRange (string): The destination port range of the incoming packet. Applicable only if protocol is set to TCP or UDP. Example: 70-80 - - dscp (integer): DSCP tag that should be assigned to incoming packet. Set this to -1 to trust incoming DSCP. Default value is 0. + - dstPortRange (string): The destination port range of the incoming packet. Applicable only if protocol is set to TCP or UDP. + - dscp (integer): DSCP tag that should be assigned to incoming packet. Set this to -1 to trust incoming DSCP. Default value is 0 """ kwargs.update(locals()) @@ -1134,7 +1134,7 @@ def updateNetworkSwitchRoutingMulticastRendezvousPoint(self, networkId: str, ren - networkId (string): Network ID - rendezvousPointId (string): Rendezvous point ID - - interfaceIp (string): The IP address of the interface to use + - interfaceIp (string): The IP address of the interface where the RP needs to be created. - multicastGroup (string): 'Any', or the IP address of a multicast group """ @@ -1583,8 +1583,8 @@ def updateOrganizationConfigTemplateSwitchProfilePort(self, organizationId: str, - tags (array): The list of tags of the switch template port. - enabled (boolean): The status of the switch template port. - poeEnabled (boolean): The PoE status of the switch template port. - - type (string): The type of the switch template port ('trunk' or 'access'). - - vlan (integer): The VLAN of the switch template port. A null value will clear the value set for trunk ports. + - type (string): The type of the switch template port ('trunk', 'access' or 'stack'). + - vlan (integer): The VLAN of the switch template port. For a trunk port, this is the native VLAN. A null value will clear the value set for trunk ports. - voiceVlan (integer): The voice VLAN of the switch template port. Only applicable to access ports. - allowedVlans (string): The VLANs allowed on the switch template port. Only applicable to trunk ports. - isolationEnabled (boolean): The isolation status of the switch template port. @@ -1607,7 +1607,7 @@ def updateOrganizationConfigTemplateSwitchProfilePort(self, organizationId: str, kwargs.update(locals()) if 'type' in kwargs: - options = ['access', 'trunk'] + options = ['access', 'stack', 'trunk'] assert kwargs['type'] in options, f'''"type" cannot be "{kwargs['type']}", & must be set to one of: {options}''' if 'stpGuard' in kwargs: options = ['bpdu guard', 'disabled', 'loop guard', 'root guard'] diff --git a/meraki/api/batch/wireless.py b/meraki/api/batch/wireless.py index 925ca402..694721ed 100644 --- a/meraki/api/batch/wireless.py +++ b/meraki/api/batch/wireless.py @@ -458,7 +458,7 @@ def updateNetworkWirelessSettings(self, networkId: str, **kwargs): - meshingEnabled (boolean): Toggle for enabling or disabling meshing in a network - ipv6BridgeEnabled (boolean): Toggle for enabling or disabling IPv6 bridging in a network (Note: if enabled, SSIDs must also be configured to use bridge mode) - locationAnalyticsEnabled (boolean): Toggle for enabling or disabling location analytics for your network - - upgradeStrategy (string): The upgrade strategy to apply to the network. Must be one of 'minimizeUpgradeTime' or 'minimizeClientDowntime'. Requires firmware version MR 26.8 or higher' + - upgradeStrategy (string): The default strategy that network devices will use to perform an upgrade. Requires firmware version MR 26.8 or higher. - ledLightsOn (boolean): Toggle for enabling or disabling LED lights on all APs in the network (making them run dark) - namedVlans (object): Named VLAN settings for wireless networks. """ @@ -713,7 +713,7 @@ def updateNetworkWirelessSsidFirewallL3FirewallRules(self, networkId: str, numbe - networkId (string): Network ID - number (string): Number - - rules (array): An ordered array of the firewall rules for this SSID (not including the local LAN access rule or the default rule) + - rules (array): An ordered array of the firewall rules for this SSID (not including the local LAN access rule or the default rule). - allowLanAccess (boolean): Allow wireless client access to local LAN (boolean value - true allows access and false denies access) (optional) """ diff --git a/meraki/api/camera.py b/meraki/api/camera.py index c4c18060..de7cd417 100644 --- a/meraki/api/camera.py +++ b/meraki/api/camera.py @@ -10,7 +10,7 @@ def __init__(self, session): def getDeviceCameraAnalyticsLive(self, serial: str): """ - **Returns live state from camera of analytics zones** + **Returns live state from camera analytics zones** https://developer.cisco.com/meraki/api-v1/#!get-device-camera-analytics-live - serial (string): Serial diff --git a/meraki/api/licensing.py b/meraki/api/licensing.py index 95e75041..30532bb5 100644 --- a/meraki/api/licensing.py +++ b/meraki/api/licensing.py @@ -126,7 +126,7 @@ def validateAdministeredLicensingSubscriptionSubscriptionsClaimKey(self, claimKe - def getAdministeredLicensingSubscriptionSubscriptionsComplianceStatuses(self, **kwargs): + def getAdministeredLicensingSubscriptionSubscriptionsComplianceStatuses(self, organizationIds: list, **kwargs): """ **Get compliance status for requested subscriptions** https://developer.cisco.com/meraki/api-v1/#!get-administered-licensing-subscription-subscriptions-compliance-statuses diff --git a/meraki/api/networks.py b/meraki/api/networks.py index a4f97053..11f0c6f1 100644 --- a/meraki/api/networks.py +++ b/meraki/api/networks.py @@ -503,7 +503,7 @@ def updateNetworkClientPolicy(self, networkId: str, clientId: str, devicePolicy: - networkId (string): Network ID - clientId (string): Client ID - devicePolicy (string): The policy to assign. Can be 'Whitelisted', 'Blocked', 'Normal' or 'Group policy'. Required. - - groupPolicyId (string): [optional] If 'devicePolicy' is set to 'Group policy' this param is used to specify the group policy ID. + - groupPolicyId (string): [Optional] If 'devicePolicy' is set to 'Group policy' this param is used to specify the group policy ID. """ kwargs.update(locals()) @@ -644,7 +644,7 @@ def getNetworkDevices(self, networkId: str): def claimNetworkDevices(self, networkId: str, serials: list): """ - **Claim devices into a network. (Note: for recently claimed devices, it may take a few minutes for API requsts against that device to succeed)** + **Claim devices into a network. (Note: for recently claimed devices, it may take a few minutes for API requests against that device to succeed)** https://developer.cisco.com/meraki/api-v1/#!claim-network-devices - networkId (string): Network ID @@ -1392,15 +1392,18 @@ def updateNetworkGroupPolicy(self, networkId: str, groupPolicyId: str, **kwargs) - def deleteNetworkGroupPolicy(self, networkId: str, groupPolicyId: str): + def deleteNetworkGroupPolicy(self, networkId: str, groupPolicyId: str, **kwargs): """ **Delete a group policy** https://developer.cisco.com/meraki/api-v1/#!delete-network-group-policy - networkId (string): Network ID - groupPolicyId (string): Group policy ID + - force (boolean): If true, the system deletes the GP even if there are active clients using the GP. After deletion, active clients that were assigned to that Group Policy will be left without any policy applied. Default is false. """ + kwargs.update(locals()) + metadata = { 'tags': ['networks', 'configure', 'groupPolicies'], 'operation': 'deleteNetworkGroupPolicy' diff --git a/meraki/api/organizations.py b/meraki/api/organizations.py index 40b8150c..1aedc0eb 100644 --- a/meraki/api/organizations.py +++ b/meraki/api/organizations.py @@ -1206,7 +1206,7 @@ def deleteOrganizationBrandingPolicy(self, organizationId: str, brandingPolicyId def claimIntoOrganization(self, organizationId: str, **kwargs): """ - **Claim a list of devices, licenses, and/or orders into an organization** + **Claim a list of devices, licenses, and/or orders into an organization inventory** https://developer.cisco.com/meraki/api-v1/#!claim-into-organization - organizationId (string): Organization ID @@ -1260,7 +1260,7 @@ def getOrganizationClientsBandwidthUsageHistory(self, organizationId: str, **kwa def getOrganizationClientsOverview(self, organizationId: str, **kwargs): """ - **Return summary information around client data usage (in mb) across the given organization.** + **Return summary information around client data usage (in kb) across the given organization.** https://developer.cisco.com/meraki/api-v1/#!get-organization-clients-overview - organizationId (string): Organization ID @@ -1308,7 +1308,7 @@ def getOrganizationClientsSearch(self, organizationId: str, mac: str, total_page organizationId = urllib.parse.quote(str(organizationId), safe='') resource = f'/organizations/{organizationId}/clients/search' - query_params = ['mac', 'perPage', 'startingAfter', 'endingBefore', ] + query_params = ['perPage', 'startingAfter', 'endingBefore', 'mac', ] params = {k.strip(): v for k, v in kwargs.items() if k.strip() in query_params} return self._session.get_pages(metadata, resource, params, total_pages, direction) @@ -1386,6 +1386,27 @@ def createOrganizationConfigTemplate(self, organizationId: str, name: str, **kwa + def getOrganizationConfigTemplate(self, organizationId: str, configTemplateId: str): + """ + **Return a single configuration template** + https://developer.cisco.com/meraki/api-v1/#!get-organization-config-template + + - organizationId (string): Organization ID + - configTemplateId (string): Config template ID + """ + + metadata = { + 'tags': ['organizations', 'configure', 'configTemplates'], + 'operation': 'getOrganizationConfigTemplate' + } + organizationId = urllib.parse.quote(str(organizationId), safe='') + configTemplateId = urllib.parse.quote(str(configTemplateId), safe='') + resource = f'/organizations/{organizationId}/configTemplates/{configTemplateId}' + + return self._session.get(metadata, resource) + + + def updateOrganizationConfigTemplate(self, organizationId: str, configTemplateId: str, **kwargs): """ **Update a configuration template** @@ -1435,27 +1456,6 @@ def deleteOrganizationConfigTemplate(self, organizationId: str, configTemplateId - def getOrganizationConfigTemplate(self, organizationId: str, configTemplateId: str): - """ - **Return a single configuration template** - https://developer.cisco.com/meraki/api-v1/#!get-organization-config-template - - - organizationId (string): Organization ID - - configTemplateId (string): Config template ID - """ - - metadata = { - 'tags': ['organizations', 'configure', 'configTemplates'], - 'operation': 'getOrganizationConfigTemplate' - } - organizationId = urllib.parse.quote(str(organizationId), safe='') - configTemplateId = urllib.parse.quote(str(configTemplateId), safe='') - resource = f'/organizations/{organizationId}/configTemplates/{configTemplateId}' - - return self._session.get(metadata, resource) - - - def getOrganizationConfigurationChanges(self, organizationId: str, total_pages=1, direction='prev', **kwargs): """ **View the Change Log for your organization** @@ -2165,6 +2165,52 @@ def getOrganizationInventoryDevices(self, organizationId: str, total_pages=1, di + def createOrganizationInventoryDevicesSwapsBulk(self, organizationId: str, swaps: list): + """ + **Swap the devices identified by devices.old with a devices.new, then perform the :afterAction on the devices.old.** + https://developer.cisco.com/meraki/api-v1/#!create-organization-inventory-devices-swaps-bulk + + - organizationId (string): Organization ID + - swaps (array): List of replacments to perform + """ + + kwargs = locals() + + metadata = { + 'tags': ['organizations', 'configure', 'inventory', 'devices', 'swaps', 'bulk'], + 'operation': 'createOrganizationInventoryDevicesSwapsBulk' + } + organizationId = urllib.parse.quote(str(organizationId), safe='') + resource = f'/organizations/{organizationId}/inventory/devices/swaps/bulk' + + body_params = ['swaps', ] + payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params} + + return self._session.post(metadata, resource, payload) + + + + def getOrganizationInventoryDevicesSwapsBulk(self, organizationId: str, id: str): + """ + **List of device swaps for a given request ID ({id}).** + https://developer.cisco.com/meraki/api-v1/#!get-organization-inventory-devices-swaps-bulk + + - organizationId (string): Organization ID + - id (string): ID + """ + + metadata = { + 'tags': ['organizations', 'configure', 'inventory', 'devices', 'swaps', 'bulk'], + 'operation': 'getOrganizationInventoryDevicesSwapsBulk' + } + organizationId = urllib.parse.quote(str(organizationId), safe='') + id = urllib.parse.quote(str(id), safe='') + resource = f'/organizations/{organizationId}/inventory/devices/swaps/bulk/{id}' + + return self._session.get(metadata, resource) + + + def getOrganizationInventoryDevice(self, organizationId: str, serial: str): """ **Return a single device from the inventory of an organization** diff --git a/meraki/api/sensor.py b/meraki/api/sensor.py index 45f8ae5b..67bf8cf6 100644 --- a/meraki/api/sensor.py +++ b/meraki/api/sensor.py @@ -8,6 +8,96 @@ def __init__(self, session): + def getDeviceSensorCommands(self, serial: str, total_pages=1, direction='next', **kwargs): + """ + **Returns a historical log of all commands** + https://developer.cisco.com/meraki/api-v1/#!get-device-sensor-commands + + - serial (string): Serial + - 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 + - operations (array): Optional parameter to filter commands by operation. Allowed values are disableDownstreamPower, enableDownstreamPower, cycleDownstreamPower, and refreshData. + - perPage (integer): The number of entries per page returned. Acceptable range is 3 - 1000. Default is 10. + - 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. + - sortOrder (string): Sorted order of entries. Order options are 'ascending' and 'descending'. Default is 'descending'. + - t0 (string): The beginning of the timespan for the data. The maximum lookback period is 30 days from today. + - t1 (string): The end of the timespan for the data. t1 can be a maximum of 30 days after t0. + - timespan (number): The timespan for which the information will be fetched. If specifying timespan, do not specify parameters t0 and t1. The value must be in seconds and be less than or equal to 30 days. The default is 30 days. + """ + + kwargs.update(locals()) + + if 'sortOrder' in kwargs: + options = ['ascending', 'descending'] + assert kwargs['sortOrder'] in options, f'''"sortOrder" cannot be "{kwargs['sortOrder']}", & must be set to one of: {options}''' + + metadata = { + 'tags': ['sensor', 'configure', 'commands'], + 'operation': 'getDeviceSensorCommands' + } + serial = urllib.parse.quote(str(serial), safe='') + resource = f'/devices/{serial}/sensor/commands' + + query_params = ['operations', 'perPage', 'startingAfter', 'endingBefore', 'sortOrder', 't0', 't1', 'timespan', ] + params = {k.strip(): v for k, v in kwargs.items() if k.strip() in query_params} + + array_params = ['operations', ] + 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) + + + + def createDeviceSensorCommand(self, serial: str, operation: str): + """ + **Sends a command to a sensor** + https://developer.cisco.com/meraki/api-v1/#!create-device-sensor-command + + - serial (string): Serial + - operation (string): Operation to run on the sensor. 'enableDownstreamPower', 'disableDownstreamPower', and 'cycleDownstreamPower' turn power on/off to the device that is connected downstream of an MT40 power monitor. 'refreshData' causes an MT15 or MT40 device to upload its latest readings so that they are immediately available in the Dashboard API. + """ + + kwargs = locals() + + metadata = { + 'tags': ['sensor', 'configure', 'commands'], + 'operation': 'createDeviceSensorCommand' + } + serial = urllib.parse.quote(str(serial), safe='') + resource = f'/devices/{serial}/sensor/commands' + + body_params = ['operation', ] + payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params} + + return self._session.post(metadata, resource, payload) + + + + def getDeviceSensorCommand(self, serial: str, commandId: str): + """ + **Returns information about the command's execution, including the status** + https://developer.cisco.com/meraki/api-v1/#!get-device-sensor-command + + - serial (string): Serial + - commandId (string): Command ID + """ + + metadata = { + 'tags': ['sensor', 'configure', 'commands'], + 'operation': 'getDeviceSensorCommand' + } + serial = urllib.parse.quote(str(serial), safe='') + commandId = urllib.parse.quote(str(commandId), safe='') + resource = f'/devices/{serial}/sensor/commands/{commandId}' + + return self._session.get(metadata, resource) + + + def getDeviceSensorRelationships(self, serial: str): """ **List the sensor roles for a given sensor or camera device.** diff --git a/meraki/api/switch.py b/meraki/api/switch.py index 8902a3e3..ecdc850e 100644 --- a/meraki/api/switch.py +++ b/meraki/api/switch.py @@ -136,8 +136,8 @@ def updateDeviceSwitchPort(self, serial: str, portId: str, **kwargs): - tags (array): The list of tags of the switch port. - enabled (boolean): The status of the switch port. - poeEnabled (boolean): The PoE status of the switch port. - - type (string): The type of the switch port ('trunk' or 'access'). - - vlan (integer): The VLAN of the switch port. A null value will clear the value set for trunk ports. + - type (string): The type of the switch port ('trunk', 'access' or 'stack'). + - vlan (integer): The VLAN of the switch port. For a trunk port, this is the native VLAN. A null value will clear the value set for trunk ports. - voiceVlan (integer): The voice VLAN of the switch port. Only applicable to access ports. - allowedVlans (string): The VLANs allowed on the switch port. Only applicable to trunk ports. - isolationEnabled (boolean): The isolation status of the switch port. @@ -162,7 +162,7 @@ def updateDeviceSwitchPort(self, serial: str, portId: str, **kwargs): kwargs.update(locals()) if 'type' in kwargs: - options = ['access', 'trunk'] + options = ['access', 'stack', 'trunk'] assert kwargs['type'] in options, f'''"type" cannot be "{kwargs['type']}", & must be set to one of: {options}''' if 'stpGuard' in kwargs: options = ['bpdu guard', 'disabled', 'loop guard', 'root guard'] @@ -1342,12 +1342,12 @@ def createNetworkSwitchQosRule(self, networkId: str, vlan: int, **kwargs): - networkId (string): Network ID - vlan (integer): The VLAN of the incoming packet. A null value will match any VLAN. - - protocol (string): The protocol of the incoming packet. Can be one of "ANY", "TCP" or "UDP". Default value is "ANY" + - protocol (string): The protocol of the incoming packet. Default value is "ANY" - srcPort (integer): The source port of the incoming packet. Applicable only if protocol is TCP or UDP. - - srcPortRange (string): The source port range of the incoming packet. Applicable only if protocol is set to TCP or UDP. Example: 70-80 + - srcPortRange (string): The source port range of the incoming packet. Applicable only if protocol is set to TCP or UDP. - dstPort (integer): The destination port of the incoming packet. Applicable only if protocol is TCP or UDP. - - dstPortRange (string): The destination port range of the incoming packet. Applicable only if protocol is set to TCP or UDP. Example: 70-80 - - dscp (integer): DSCP tag. Set this to -1 to trust incoming DSCP. Default value is 0 + - dstPortRange (string): The destination port range of the incoming packet. Applicable only if protocol is set to TCP or UDP. + - dscp (integer): DSCP tag for the incoming packet. Set this to -1 to trust incoming DSCP. Default value is 0 """ kwargs.update(locals()) @@ -1464,12 +1464,12 @@ def updateNetworkSwitchQosRule(self, networkId: str, qosRuleId: str, **kwargs): - networkId (string): Network ID - qosRuleId (string): Qos rule ID - vlan (integer): The VLAN of the incoming packet. A null value will match any VLAN. - - protocol (string): The protocol of the incoming packet. Can be one of "ANY", "TCP" or "UDP". Default value is "ANY". + - protocol (string): The protocol of the incoming packet. Default value is "ANY" - srcPort (integer): The source port of the incoming packet. Applicable only if protocol is TCP or UDP. - - srcPortRange (string): The source port range of the incoming packet. Applicable only if protocol is set to TCP or UDP. Example: 70-80 + - srcPortRange (string): The source port range of the incoming packet. Applicable only if protocol is set to TCP or UDP. - dstPort (integer): The destination port of the incoming packet. Applicable only if protocol is TCP or UDP. - - dstPortRange (string): The destination port range of the incoming packet. Applicable only if protocol is set to TCP or UDP. Example: 70-80 - - dscp (integer): DSCP tag that should be assigned to incoming packet. Set this to -1 to trust incoming DSCP. Default value is 0. + - dstPortRange (string): The destination port range of the incoming packet. Applicable only if protocol is set to TCP or UDP. + - dscp (integer): DSCP tag that should be assigned to incoming packet. Set this to -1 to trust incoming DSCP. Default value is 0 """ kwargs.update(locals()) @@ -1632,7 +1632,7 @@ def updateNetworkSwitchRoutingMulticastRendezvousPoint(self, networkId: str, ren - networkId (string): Network ID - rendezvousPointId (string): Rendezvous point ID - - interfaceIp (string): The IP address of the interface to use + - interfaceIp (string): The IP address of the interface where the RP needs to be created. - multicastGroup (string): 'Any', or the IP address of a multicast group """ @@ -1772,7 +1772,7 @@ def getNetworkSwitchStacks(self, networkId: str): def createNetworkSwitchStack(self, networkId: str, name: str, serials: list): """ - **Create a stack** + **Create a switch stack** https://developer.cisco.com/meraki/api-v1/#!create-network-switch-stack - networkId (string): Network ID @@ -2419,8 +2419,8 @@ def updateOrganizationConfigTemplateSwitchProfilePort(self, organizationId: str, - tags (array): The list of tags of the switch template port. - enabled (boolean): The status of the switch template port. - poeEnabled (boolean): The PoE status of the switch template port. - - type (string): The type of the switch template port ('trunk' or 'access'). - - vlan (integer): The VLAN of the switch template port. A null value will clear the value set for trunk ports. + - type (string): The type of the switch template port ('trunk', 'access' or 'stack'). + - vlan (integer): The VLAN of the switch template port. For a trunk port, this is the native VLAN. A null value will clear the value set for trunk ports. - voiceVlan (integer): The voice VLAN of the switch template port. Only applicable to access ports. - allowedVlans (string): The VLANs allowed on the switch template port. Only applicable to trunk ports. - isolationEnabled (boolean): The isolation status of the switch template port. @@ -2443,7 +2443,7 @@ def updateOrganizationConfigTemplateSwitchProfilePort(self, organizationId: str, kwargs.update(locals()) if 'type' in kwargs: - options = ['access', 'trunk'] + options = ['access', 'stack', 'trunk'] assert kwargs['type'] in options, f'''"type" cannot be "{kwargs['type']}", & must be set to one of: {options}''' if 'stpGuard' in kwargs: options = ['bpdu guard', 'disabled', 'loop guard', 'root guard'] @@ -2566,3 +2566,30 @@ def getOrganizationSwitchPortsBySwitch(self, organizationId: str, total_pages=1, return self._session.get_pages(metadata, resource, params, total_pages, direction) + + + def getOrganizationSwitchPortsOverview(self, organizationId: str, **kwargs): + """ + **Returns the counts of all active ports for the requested timespan, grouped by speed** + https://developer.cisco.com/meraki/api-v1/#!get-organization-switch-ports-overview + + - organizationId (string): Organization ID + - t0 (string): The beginning of the timespan for the data. + - t1 (string): The end of the timespan for the data. t1 can be a maximum of 31 days after t0. + - timespan (number): The timespan for which the information will be fetched. If specifying timespan, do not specify parameters t0 and t1. The value must be in seconds and be greater than or equal to 12 hours and be less than or equal to 31 days. The default is 1 day. + """ + + kwargs.update(locals()) + + metadata = { + 'tags': ['switch', 'monitor', 'ports', 'overview'], + 'operation': 'getOrganizationSwitchPortsOverview' + } + organizationId = urllib.parse.quote(str(organizationId), safe='') + resource = f'/organizations/{organizationId}/switch/ports/overview' + + query_params = ['t0', 't1', 'timespan', ] + params = {k.strip(): v for k, v in kwargs.items() if k.strip() in query_params} + + return self._session.get(metadata, resource, params) + diff --git a/meraki/api/wireless.py b/meraki/api/wireless.py index ec34feb7..f8c46ef2 100644 --- a/meraki/api/wireless.py +++ b/meraki/api/wireless.py @@ -585,9 +585,9 @@ def getNetworkWirelessClientConnectivityEvents(self, networkId: str, clientId: s - t1 (string): The end of the timespan for the data. t1 can be a maximum of 31 days after t0. - timespan (number): The timespan for which the information will be fetched. If specifying timespan, do not specify parameters t0 and t1. The value must be in seconds and be less than or equal to 31 days. The default is 1 day. - types (array): A list of event types to include. If not specified, events of all types will be returned. Valid types are 'assoc', 'disassoc', 'auth', 'deauth', 'dns', 'dhcp', 'roam', 'connection' and/or 'sticky'. + - band (string): Filter results by band. Valid bands are '2.4', '5' or '6'. + - ssidNumber (integer): Filter results by SSID. If not specified, events for all SSIDs will be returned. - includedSeverities (array): A list of severities to include. If not specified, events of all severities will be returned. Valid severities are 'good', 'info', 'warn' and/or 'bad'. - - band (string): Filter results by band (either '2.4', '5', '6'). - - ssidNumber (integer): An SSID number to include. If not specified, events for all SSIDs will be returned. - deviceSerial (string): Filter results by an AP's serial number. """ @@ -608,7 +608,7 @@ def getNetworkWirelessClientConnectivityEvents(self, networkId: str, clientId: s clientId = urllib.parse.quote(str(clientId), safe='') resource = f'/networks/{networkId}/wireless/clients/{clientId}/connectivityEvents' - query_params = ['perPage', 'startingAfter', 'endingBefore', 't0', 't1', 'timespan', 'types', 'includedSeverities', 'band', 'ssidNumber', 'deviceSerial', ] + query_params = ['perPage', 'startingAfter', 'endingBefore', 't0', 't1', 'timespan', 'types', 'band', 'ssidNumber', 'includedSeverities', 'deviceSerial', ] params = {k.strip(): v for k, v in kwargs.items() if k.strip() in query_params} array_params = ['types', 'includedSeverities', ] @@ -1326,7 +1326,7 @@ def updateNetworkWirelessSettings(self, networkId: str, **kwargs): - meshingEnabled (boolean): Toggle for enabling or disabling meshing in a network - ipv6BridgeEnabled (boolean): Toggle for enabling or disabling IPv6 bridging in a network (Note: if enabled, SSIDs must also be configured to use bridge mode) - locationAnalyticsEnabled (boolean): Toggle for enabling or disabling location analytics for your network - - upgradeStrategy (string): The upgrade strategy to apply to the network. Must be one of 'minimizeUpgradeTime' or 'minimizeClientDowntime'. Requires firmware version MR 26.8 or higher' + - upgradeStrategy (string): The default strategy that network devices will use to perform an upgrade. Requires firmware version MR 26.8 or higher. - ledLightsOn (boolean): Toggle for enabling or disabling LED lights on all APs in the network (making them run dark) - namedVlans (object): Named VLAN settings for wireless networks. """ @@ -1717,7 +1717,7 @@ def updateNetworkWirelessSsidFirewallL3FirewallRules(self, networkId: str, numbe - networkId (string): Network ID - number (string): Number - - rules (array): An ordered array of the firewall rules for this SSID (not including the local LAN access rule or the default rule) + - rules (array): An ordered array of the firewall rules for this SSID (not including the local LAN access rule or the default rule). - allowLanAccess (boolean): Allow wireless client access to local LAN (boolean value - true allows access and false denies access) (optional) """ @@ -2556,3 +2556,86 @@ def getOrganizationWirelessDevicesPacketLossByNetwork(self, organizationId: str, return self._session.get_pages(metadata, resource, params, total_pages, direction) + + + def getOrganizationWirelessRfProfilesAssignmentsByDevice(self, organizationId: str, total_pages=1, direction='next', **kwargs): + """ + **List the RF profiles of an organization by device** + https://developer.cisco.com/meraki/api-v1/#!get-organization-wireless-rf-profiles-assignments-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 + - 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. + - 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, and sensor. + - name (string): Optional parameter to filter RF profiles by device name. All returned devices will have a name that contains the search term or is an exact match. + - mac (string): Optional parameter to filter RF profiles by device MAC address. All returned devices will have a MAC address that contains the search term or is an exact match. + - serial (string): Optional parameter to filter RF profiles by device serial number. All returned devices will have a serial number that contains the search term or is an exact match. + - model (string): Optional parameter to filter RF profiles by device model. All returned devices will have a model that contains the search term or is an exact match. + - macs (array): Optional parameter to filter RF profiles by one or more device MAC addresses. All returned devices will have a MAC address that is an exact match. + - serials (array): Optional parameter to filter RF profiles by one or more device serial numbers. All returned devices will have a serial number that is an exact match. + - models (array): Optional parameter to filter RF profiles by one or more device models. All returned devices will have a model that is an exact match. + """ + + kwargs.update(locals()) + + metadata = { + 'tags': ['wireless', 'configure', 'rfProfiles', 'assignments', 'byDevice'], + 'operation': 'getOrganizationWirelessRfProfilesAssignmentsByDevice' + } + organizationId = urllib.parse.quote(str(organizationId), safe='') + resource = f'/organizations/{organizationId}/wireless/rfProfiles/assignments/byDevice' + + query_params = ['perPage', 'startingAfter', 'endingBefore', 'networkIds', 'productTypes', 'name', 'mac', 'serial', 'model', 'macs', 'serials', 'models', ] + params = {k.strip(): v for k, v in kwargs.items() if k.strip() in query_params} + + array_params = ['networkIds', 'productTypes', 'macs', 'serials', 'models', ] + 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) + + + + def getOrganizationWirelessSsidsStatusesByDevice(self, organizationId: str, total_pages=1, direction='next', **kwargs): + """ + **List status information of all BSSIDs in your organization** + https://developer.cisco.com/meraki/api-v1/#!get-organization-wireless-ssids-statuses-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 + - networkIds (array): Optional parameter to filter the result set by the included set of network IDs + - serials (array): A list of serial numbers. The returned devices will be filtered to only include these serials. + - bssids (array): A list of BSSIDs. The returned devices will be filtered to only include these BSSIDs. + - hideDisabled (boolean): If true, the returned devices will not include disabled SSIDs. (default: false) + - perPage (integer): The number of entries per page returned. Acceptable range is 3 - 500. Default is 100. + - 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': ['wireless', 'configure', 'ssids', 'statuses', 'byDevice'], + 'operation': 'getOrganizationWirelessSsidsStatusesByDevice' + } + organizationId = urllib.parse.quote(str(organizationId), safe='') + resource = f'/organizations/{organizationId}/wireless/ssids/statuses/byDevice' + + query_params = ['networkIds', 'serials', 'bssids', 'hideDisabled', 'perPage', 'startingAfter', 'endingBefore', ] + params = {k.strip(): v for k, v in kwargs.items() if k.strip() in query_params} + + array_params = ['networkIds', 'serials', 'bssids', ] + 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) +