diff --git a/meraki/__init__.py b/meraki/__init__.py index 1c65ec6..1d94ea9 100644 --- a/meraki/__init__.py +++ b/meraki/__init__.py @@ -43,7 +43,7 @@ ) from meraki.rest_session import * -__version__ = '1.42.0' +__version__ = '1.43.0' class DashboardAPI(object): diff --git a/meraki/aio/api/appliance.py b/meraki/aio/api/appliance.py index d04f2ea..f7d18df 100644 --- a/meraki/aio/api/appliance.py +++ b/meraki/aio/api/appliance.py @@ -2472,6 +2472,25 @@ def getOrganizationApplianceUplinkStatuses(self, organizationId: str, total_page + def getOrganizationApplianceUplinksStatusesOverview(self, organizationId: str): + """ + **Returns an overview of uplink statuses** + https://developer.cisco.com/meraki/api-v1/#!get-organization-appliance-uplinks-statuses-overview + + - organizationId (string): Organization ID + """ + + metadata = { + 'tags': ['appliance', 'configure', 'uplinks', 'statuses', 'overview'], + 'operation': 'getOrganizationApplianceUplinksStatusesOverview' + } + organizationId = urllib.parse.quote(str(organizationId), safe='') + resource = f'/organizations/{organizationId}/appliance/uplinks/statuses/overview' + + return self._session.get(metadata, resource) + + + def getOrganizationApplianceUplinksUsageByNetwork(self, organizationId: str, **kwargs): """ **Get the sent and received bytes for each uplink of all MX and Z networks within an organization** diff --git a/meraki/aio/api/camera.py b/meraki/aio/api/camera.py index 415a6a2..d8c6ec6 100644 --- a/meraki/aio/api/camera.py +++ b/meraki/aio/api/camera.py @@ -718,6 +718,68 @@ def deleteNetworkCameraWirelessProfile(self, networkId: str, wirelessProfileId: + def getOrganizationCameraBoundariesAreasByDevice(self, organizationId: str, **kwargs): + """ + **Returns all configured area boundaries of cameras** + https://developer.cisco.com/meraki/api-v1/#!get-organization-camera-boundaries-areas-by-device + + - organizationId (string): Organization ID + - serials (array): A list of serial numbers. The returned cameras will be filtered to only include these serials. + """ + + kwargs.update(locals()) + + metadata = { + 'tags': ['camera', 'configure', 'boundaries', 'areas', 'byDevice'], + 'operation': 'getOrganizationCameraBoundariesAreasByDevice' + } + organizationId = urllib.parse.quote(str(organizationId), safe='') + resource = f'/organizations/{organizationId}/camera/boundaries/areas/byDevice' + + query_params = ['serials', ] + params = {k.strip(): v for k, v in kwargs.items() if k.strip() in query_params} + + array_params = ['serials', ] + for k, v in kwargs.items(): + if k.strip() in array_params: + params[f'{k.strip()}[]'] = kwargs[f'{k}'] + params.pop(k.strip()) + + return self._session.get(metadata, resource, params) + + + + def getOrganizationCameraBoundariesLinesByDevice(self, organizationId: str, **kwargs): + """ + **Returns all configured crossingline boundaries of cameras** + https://developer.cisco.com/meraki/api-v1/#!get-organization-camera-boundaries-lines-by-device + + - organizationId (string): Organization ID + - serials (array): A list of serial numbers. The returned cameras will be filtered to only include these serials. + """ + + kwargs.update(locals()) + + metadata = { + 'tags': ['camera', 'configure', 'boundaries', 'lines', 'byDevice'], + 'operation': 'getOrganizationCameraBoundariesLinesByDevice' + } + organizationId = urllib.parse.quote(str(organizationId), safe='') + resource = f'/organizations/{organizationId}/camera/boundaries/lines/byDevice' + + query_params = ['serials', ] + params = {k.strip(): v for k, v in kwargs.items() if k.strip() in query_params} + + array_params = ['serials', ] + for k, v in kwargs.items(): + if k.strip() in array_params: + params[f'{k.strip()}[]'] = kwargs[f'{k}'] + params.pop(k.strip()) + + return self._session.get(metadata, resource, params) + + + def getOrganizationCameraCustomAnalyticsArtifacts(self, organizationId: str): """ **List Custom Analytics Artifacts** @@ -804,6 +866,42 @@ def deleteOrganizationCameraCustomAnalyticsArtifact(self, organizationId: str, a + def getOrganizationCameraDetectionsHistoryByBoundaryByInterval(self, organizationId: str, boundaryIds: list, total_pages=1, direction='next', **kwargs): + """ + **Returns analytics data for timespans** + https://developer.cisco.com/meraki/api-v1/#!get-organization-camera-detections-history-by-boundary-by-interval + + - organizationId (string): Organization ID + - boundaryIds (array): A list of boundary ids. The returned cameras will be filtered to only include these ids. + - 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 + - duration (integer): The minimum time, in seconds, that the person or car remains in the area to be counted. Defaults to boundary configuration or 60. + - perPage (integer): The number of entries per page returned. Acceptable range is 1 - 1000. Defaults to 1000. + - boundaryTypes (array): The detection types. Defaults to 'person'. + """ + + kwargs.update(locals()) + + metadata = { + 'tags': ['camera', 'configure', 'detections', 'history', 'byBoundary', 'byInterval'], + 'operation': 'getOrganizationCameraDetectionsHistoryByBoundaryByInterval' + } + organizationId = urllib.parse.quote(str(organizationId), safe='') + resource = f'/organizations/{organizationId}/camera/detections/history/byBoundary/byInterval' + + query_params = ['boundaryIds', 'duration', 'perPage', 'boundaryTypes', ] + params = {k.strip(): v for k, v in kwargs.items() if k.strip() in query_params} + + array_params = ['boundaryIds', 'boundaryTypes', ] + 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 getOrganizationCameraOnboardingStatuses(self, organizationId: str, **kwargs): """ **Fetch onboarding status of cameras** diff --git a/meraki/aio/api/devices.py b/meraki/aio/api/devices.py index 25092e5..27e6506 100644 --- a/meraki/aio/api/devices.py +++ b/meraki/aio/api/devices.py @@ -158,6 +158,99 @@ def getDeviceClients(self, serial: str, **kwargs): + def createDeviceLiveToolsArpTable(self, serial: str, **kwargs): + """ + **Enqueue a job to perform a ARP table request for the device** + https://developer.cisco.com/meraki/api-v1/#!create-device-live-tools-arp-table + + - serial (string): Serial + - callback (object): Details for the callback. Please include either an httpServerId OR url and sharedSecret + """ + + kwargs.update(locals()) + + metadata = { + 'tags': ['devices', 'liveTools', 'arpTable'], + 'operation': 'createDeviceLiveToolsArpTable' + } + serial = urllib.parse.quote(str(serial), safe='') + resource = f'/devices/{serial}/liveTools/arpTable' + + body_params = ['callback', ] + payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params} + + return self._session.post(metadata, resource, payload) + + + + def getDeviceLiveToolsArpTable(self, serial: str, arpTableId: str): + """ + **Return an ARP table live tool job.** + https://developer.cisco.com/meraki/api-v1/#!get-device-live-tools-arp-table + + - serial (string): Serial + - arpTableId (string): Arp table ID + """ + + metadata = { + 'tags': ['devices', 'liveTools', 'arpTable'], + 'operation': 'getDeviceLiveToolsArpTable' + } + serial = urllib.parse.quote(str(serial), safe='') + arpTableId = urllib.parse.quote(str(arpTableId), safe='') + resource = f'/devices/{serial}/liveTools/arpTable/{arpTableId}' + + return self._session.get(metadata, resource) + + + + def createDeviceLiveToolsCableTest(self, serial: str, ports: list, **kwargs): + """ + **Enqueue a job to perform a cable test for the device on the specified ports.** + https://developer.cisco.com/meraki/api-v1/#!create-device-live-tools-cable-test + + - serial (string): Serial + - ports (array): A list of ports for which to perform the cable test. + - callback (object): Details for the callback. Please include either an httpServerId OR url and sharedSecret + """ + + kwargs.update(locals()) + + metadata = { + 'tags': ['devices', 'liveTools', 'cableTest'], + 'operation': 'createDeviceLiveToolsCableTest' + } + serial = urllib.parse.quote(str(serial), safe='') + resource = f'/devices/{serial}/liveTools/cableTest' + + body_params = ['ports', 'callback', ] + payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params} + + return self._session.post(metadata, resource, payload) + + + + def getDeviceLiveToolsCableTest(self, serial: str, id: str): + """ + **Return a cable test live tool job.** + https://developer.cisco.com/meraki/api-v1/#!get-device-live-tools-cable-test + + - serial (string): Serial + - id (string): ID + """ + + metadata = { + 'tags': ['devices', 'liveTools', 'cableTest'], + 'operation': 'getDeviceLiveToolsCableTest' + } + serial = urllib.parse.quote(str(serial), safe='') + id = urllib.parse.quote(str(id), safe='') + resource = f'/devices/{serial}/liveTools/cableTest/{id}' + + return self._session.get(metadata, resource) + + + def createDeviceLiveToolsPing(self, serial: str, target: str, **kwargs): """ **Enqueue a job to ping a target host from the device** @@ -253,6 +346,100 @@ def getDeviceLiveToolsPingDevice(self, serial: str, id: str): + def createDeviceLiveToolsThroughputTest(self, serial: str, **kwargs): + """ + **Enqueue a job to test a device throughput, the test will run for 10 secs to test throughput** + https://developer.cisco.com/meraki/api-v1/#!create-device-live-tools-throughput-test + + - serial (string): Serial + - callback (object): Details for the callback. Please include either an httpServerId OR url and sharedSecret + """ + + kwargs.update(locals()) + + metadata = { + 'tags': ['devices', 'liveTools', 'throughputTest'], + 'operation': 'createDeviceLiveToolsThroughputTest' + } + serial = urllib.parse.quote(str(serial), safe='') + resource = f'/devices/{serial}/liveTools/throughputTest' + + body_params = ['callback', ] + payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params} + + return self._session.post(metadata, resource, payload) + + + + def getDeviceLiveToolsThroughputTest(self, serial: str, throughputTestId: str): + """ + **Return a throughput test job** + https://developer.cisco.com/meraki/api-v1/#!get-device-live-tools-throughput-test + + - serial (string): Serial + - throughputTestId (string): Throughput test ID + """ + + metadata = { + 'tags': ['devices', 'liveTools', 'throughputTest'], + 'operation': 'getDeviceLiveToolsThroughputTest' + } + serial = urllib.parse.quote(str(serial), safe='') + throughputTestId = urllib.parse.quote(str(throughputTestId), safe='') + resource = f'/devices/{serial}/liveTools/throughputTest/{throughputTestId}' + + return self._session.get(metadata, resource) + + + + def createDeviceLiveToolsWakeOnLan(self, serial: str, vlanId: int, mac: str, **kwargs): + """ + **Enqueue a job to send a Wake-on-LAN packet from the device** + https://developer.cisco.com/meraki/api-v1/#!create-device-live-tools-wake-on-lan + + - serial (string): Serial + - vlanId (integer): The target's VLAN (1 to 4094) + - mac (string): The target's MAC address + - callback (object): Details for the callback. Please include either an httpServerId OR url and sharedSecret + """ + + kwargs.update(locals()) + + metadata = { + 'tags': ['devices', 'liveTools', 'wakeOnLan'], + 'operation': 'createDeviceLiveToolsWakeOnLan' + } + serial = urllib.parse.quote(str(serial), safe='') + resource = f'/devices/{serial}/liveTools/wakeOnLan' + + body_params = ['vlanId', 'mac', 'callback', ] + payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params} + + return self._session.post(metadata, resource, payload) + + + + def getDeviceLiveToolsWakeOnLan(self, serial: str, wakeOnLanId: str): + """ + **Return a Wake-on-LAN job** + https://developer.cisco.com/meraki/api-v1/#!get-device-live-tools-wake-on-lan + + - serial (string): Serial + - wakeOnLanId (string): Wake on lan ID + """ + + metadata = { + 'tags': ['devices', 'liveTools', 'wakeOnLan'], + 'operation': 'getDeviceLiveToolsWakeOnLan' + } + serial = urllib.parse.quote(str(serial), safe='') + wakeOnLanId = urllib.parse.quote(str(wakeOnLanId), safe='') + resource = f'/devices/{serial}/liveTools/wakeOnLan/{wakeOnLanId}' + + return self._session.get(metadata, resource) + + + def getDeviceLldpCdp(self, serial: str): """ **List LLDP and CDP information for a device** diff --git a/meraki/aio/api/licensing.py b/meraki/aio/api/licensing.py index add68d1..76e606c 100644 --- a/meraki/aio/api/licensing.py +++ b/meraki/aio/api/licensing.py @@ -8,6 +8,35 @@ def __init__(self, session): + def getAdministeredLicensingSubscriptionEntitlements(self, **kwargs): + """ + **Retrieve the list of purchasable entitlements** + https://developer.cisco.com/meraki/api-v1/#!get-administered-licensing-subscription-entitlements + + - skus (array): Filter to entitlements with the specified SKUs + """ + + kwargs.update(locals()) + + metadata = { + 'tags': ['licensing', 'configure', 'subscription', 'entitlements'], + 'operation': 'getAdministeredLicensingSubscriptionEntitlements' + } + resource = f'/administered/licensing/subscription/entitlements' + + query_params = ['skus', ] + params = {k.strip(): v for k, v in kwargs.items() if k.strip() in query_params} + + array_params = ['skus', ] + 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(metadata, resource, params) + + + def getAdministeredLicensingSubscriptionSubscriptions(self, total_pages=1, direction='next', **kwargs): """ **List available subscriptions** @@ -97,6 +126,36 @@ def validateAdministeredLicensingSubscriptionSubscriptionsClaimKey(self, claimKe + def getAdministeredLicensingSubscriptionSubscriptionsComplianceStatuses(self, **kwargs): + """ + **Get compliance status for requested subscriptions** + https://developer.cisco.com/meraki/api-v1/#!get-administered-licensing-subscription-subscriptions-compliance-statuses + + - organizationIds (array): Organizations to get subscription compliance information for + - subscriptionIds (array): Subscription ids + """ + + kwargs.update(locals()) + + metadata = { + 'tags': ['licensing', 'configure', 'subscription', 'subscriptions', 'compliance', 'statuses'], + 'operation': 'getAdministeredLicensingSubscriptionSubscriptionsComplianceStatuses' + } + resource = f'/administered/licensing/subscription/subscriptions/compliance/statuses' + + query_params = ['organizationIds', 'subscriptionIds', ] + params = {k.strip(): v for k, v in kwargs.items() if k.strip() in query_params} + + array_params = ['organizationIds', 'subscriptionIds', ] + 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(metadata, resource, params) + + + def bindAdministeredLicensingSubscriptionSubscription(self, subscriptionId: str, networkIds: list, **kwargs): """ **Bind networks to a subscription** diff --git a/meraki/aio/api/networks.py b/meraki/aio/api/networks.py index c366bf6..3ab04f2 100644 --- a/meraki/aio/api/networks.py +++ b/meraki/aio/api/networks.py @@ -673,13 +673,13 @@ def vmxNetworkDevicesClaim(self, networkId: str, size: str): https://developer.cisco.com/meraki/api-v1/#!vmx-network-devices-claim - networkId (string): Network ID - - size (string): The size of the vMX you claim. It can be one of: small, medium, large, 100 + - size (string): The size of the vMX you claim. It can be one of: small, medium, large, xlarge, 100 """ kwargs = locals() if 'size' in kwargs: - options = ['100', 'large', 'medium', 'small'] + options = ['100', 'large', 'medium', 'small', 'xlarge'] assert kwargs['size'] in options, f'''"size" cannot be "{kwargs['size']}", & must be set to one of: {options}''' metadata = { diff --git a/meraki/aio/api/organizations.py b/meraki/aio/api/organizations.py index 9b5f120..8188f53 100644 --- a/meraki/aio/api/organizations.py +++ b/meraki/aio/api/organizations.py @@ -8,20 +8,30 @@ def __init__(self, session): - def getOrganizations(self): + def getOrganizations(self, total_pages=1, direction='next', **kwargs): """ **List the organizations that the user has privileges on** https://developer.cisco.com/meraki/api-v1/#!get-organizations + - 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 - 9000. Default is 9000. + - 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': ['organizations', 'configure'], 'operation': 'getOrganizations' } resource = f'/organizations' - return self._session.get(metadata, resource) + query_params = ['perPage', 'startingAfter', 'endingBefore', ] + 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) @@ -3478,6 +3488,35 @@ def getOrganizationSummaryTopDevicesModelsByUsage(self, organizationId: str, **k + def getOrganizationSummaryTopNetworksByStatus(self, organizationId: str, total_pages=1, direction='next', **kwargs): + """ + **List the client and status overview information for the networks in an organization** + https://developer.cisco.com/meraki/api-v1/#!get-organization-summary-top-networks-by-status + + - 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 - 5000. + - 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': ['organizations', 'monitor', 'summary', 'top', 'networks', 'byStatus'], + 'operation': 'getOrganizationSummaryTopNetworksByStatus' + } + organizationId = urllib.parse.quote(str(organizationId), safe='') + resource = f'/organizations/{organizationId}/summary/top/networks/byStatus' + + query_params = ['perPage', 'startingAfter', 'endingBefore', ] + 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) + + + def getOrganizationSummaryTopSsidsByUsage(self, organizationId: str, **kwargs): """ **Return metrics for organization's top 10 ssids by data usage over given time range** diff --git a/meraki/aio/api/sensor.py b/meraki/aio/api/sensor.py index 7796a18..82cf653 100644 --- a/meraki/aio/api/sensor.py +++ b/meraki/aio/api/sensor.py @@ -322,7 +322,7 @@ def getOrganizationSensorReadingsHistory(self, organizationId: str, total_pages= - 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 7 days. The default is 2 hours. - networkIds (array): Optional parameter to filter readings by network. - serials (array): Optional parameter to filter readings by sensor. - - metrics (array): Types of sensor readings to retrieve. If no metrics are supplied, all available types of readings will be retrieved. Allowed values are battery, button, door, humidity, indoorAirQuality, noise, pm25, temperature, tvoc, and water. + - metrics (array): Types of sensor readings to retrieve. If no metrics are supplied, all available types of readings will be retrieved. Allowed values are apparentPower, battery, button, co2, current, door, downstreamPower, frequency, humidity, indoorAirQuality, noise, pm25, powerFactor, realPower, remoteLockoutSwitch, temperature, tvoc, voltage, and water. """ kwargs.update(locals()) @@ -360,7 +360,7 @@ def getOrganizationSensorReadingsLatest(self, organizationId: str, total_pages=1 - 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 readings by network. - serials (array): Optional parameter to filter readings by sensor. - - metrics (array): Types of sensor readings to retrieve. If no metrics are supplied, all available types of readings will be retrieved. Allowed values are battery, button, door, humidity, indoorAirQuality, noise, pm25, temperature, tvoc, and water. + - metrics (array): Types of sensor readings to retrieve. If no metrics are supplied, all available types of readings will be retrieved. Allowed values are apparentPower, battery, button, co2, current, door, downstreamPower, frequency, humidity, indoorAirQuality, noise, pm25, powerFactor, realPower, remoteLockoutSwitch, temperature, tvoc, voltage, and water. """ kwargs.update(locals()) diff --git a/meraki/aio/api/sm.py b/meraki/aio/api/sm.py index 300fc3d..fa35b8a 100644 --- a/meraki/aio/api/sm.py +++ b/meraki/aio/api/sm.py @@ -73,6 +73,7 @@ def getNetworkSmDevices(self, networkId: str, total_pages=1, direction='next', * - serials (array): Filter devices by serial(s). - ids (array): Filter devices by id(s). - uuids (array): Filter devices by uuid(s). + - systemTypes (array): Filter devices by system type(s). - scope (array): Specify a scope (one of all, none, withAny, withAll, withoutAny, or withoutAll) and a set of tags. - 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. @@ -88,10 +89,10 @@ def getNetworkSmDevices(self, networkId: str, total_pages=1, direction='next', * networkId = urllib.parse.quote(str(networkId), safe='') resource = f'/networks/{networkId}/sm/devices' - query_params = ['fields', 'wifiMacs', 'serials', 'ids', 'uuids', 'scope', 'perPage', 'startingAfter', 'endingBefore', ] + query_params = ['fields', 'wifiMacs', 'serials', 'ids', 'uuids', 'systemTypes', 'scope', 'perPage', 'startingAfter', 'endingBefore', ] params = {k.strip(): v for k, v in kwargs.items() if k.strip() in query_params} - array_params = ['fields', 'wifiMacs', 'serials', 'ids', 'uuids', 'scope', ] + array_params = ['fields', 'wifiMacs', 'serials', 'ids', 'uuids', 'systemTypes', 'scope', ] for k, v in kwargs.items(): if k.strip() in array_params: params[f'{k.strip()}[]'] = kwargs[f'{k}'] @@ -245,6 +246,66 @@ def moveNetworkSmDevices(self, networkId: str, newNetwork: str, **kwargs): + def rebootNetworkSmDevices(self, networkId: str, **kwargs): + """ + **Reboot a set of endpoints** + https://developer.cisco.com/meraki/api-v1/#!reboot-network-sm-devices + + - networkId (string): Network ID + - wifiMacs (array): The wifiMacs of the endpoints to be rebooted. + - ids (array): The ids of the endpoints to be rebooted. + - serials (array): The serials of the endpoints to be rebooted. + - scope (array): The scope (one of all, none, withAny, withAll, withoutAny, or withoutAll) and a set of tags of the endpoints to be rebooted. + - kextPaths (array): The KextPaths of the endpoints to be rebooted. Available for macOS 11+ + - notifyUser (boolean): Whether or not to notify the user before rebooting the endpoint. Available for macOS 11.3+ + - rebuildKernelCache (boolean): Whether or not to rebuild the kernel cache when rebooting the endpoint. Available for macOS 11+ + - requestRequiresNetworkTether (boolean): Whether or not the request requires network tethering. Available for macOS and supervised iOS or tvOS + """ + + kwargs.update(locals()) + + metadata = { + 'tags': ['sm', 'configure', 'devices'], + 'operation': 'rebootNetworkSmDevices' + } + networkId = urllib.parse.quote(str(networkId), safe='') + resource = f'/networks/{networkId}/sm/devices/reboot' + + body_params = ['wifiMacs', 'ids', 'serials', 'scope', 'kextPaths', 'notifyUser', 'rebuildKernelCache', 'requestRequiresNetworkTether', ] + payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params} + + return self._session.post(metadata, resource, payload) + + + + def shutdownNetworkSmDevices(self, networkId: str, **kwargs): + """ + **Shutdown a set of endpoints** + https://developer.cisco.com/meraki/api-v1/#!shutdown-network-sm-devices + + - networkId (string): Network ID + - wifiMacs (array): The wifiMacs of the endpoints to be shutdown. + - ids (array): The ids of the endpoints to be shutdown. + - serials (array): The serials of the endpoints to be shutdown. + - scope (array): The scope (one of all, none, withAny, withAll, withoutAny, or withoutAll) and a set of tags of the endpoints to be shutdown. + """ + + kwargs.update(locals()) + + metadata = { + 'tags': ['sm', 'configure', 'devices'], + 'operation': 'shutdownNetworkSmDevices' + } + networkId = urllib.parse.quote(str(networkId), safe='') + resource = f'/networks/{networkId}/sm/devices/shutdown' + + body_params = ['wifiMacs', 'ids', 'serials', 'scope', ] + payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params} + + return self._session.post(metadata, resource, payload) + + + def wipeNetworkSmDevices(self, networkId: str, **kwargs): """ **Wipe a device** @@ -662,14 +723,17 @@ def getNetworkSmDeviceWlanLists(self, networkId: str, deviceId: str): - def getNetworkSmProfiles(self, networkId: str): + def getNetworkSmProfiles(self, networkId: str, **kwargs): """ **List all profiles in a network** https://developer.cisco.com/meraki/api-v1/#!get-network-sm-profiles - networkId (string): Network ID + - payloadTypes (array): Filter by payload types """ + kwargs.update(locals()) + metadata = { 'tags': ['sm', 'configure', 'profiles'], 'operation': 'getNetworkSmProfiles' @@ -677,7 +741,16 @@ def getNetworkSmProfiles(self, networkId: str): networkId = urllib.parse.quote(str(networkId), safe='') resource = f'/networks/{networkId}/sm/profiles' - return self._session.get(metadata, resource) + query_params = ['payloadTypes', ] + params = {k.strip(): v for k, v in kwargs.items() if k.strip() in query_params} + + array_params = ['payloadTypes', ] + 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(metadata, resource, params) @@ -963,6 +1036,141 @@ def getNetworkSmUserSoftwares(self, networkId: str, userId: str): + def getOrganizationSmAdminsRoles(self, organizationId: str, total_pages=1, direction='next', **kwargs): + """ + **List the Limited Access Roles for an organization** + https://developer.cisco.com/meraki/api-v1/#!get-organization-sm-admins-roles + + - 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 50. + - 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': ['sm', 'configure', 'admins', 'roles'], + 'operation': 'getOrganizationSmAdminsRoles' + } + organizationId = urllib.parse.quote(str(organizationId), safe='') + resource = f'/organizations/{organizationId}/sm/admins/roles' + + query_params = ['perPage', 'startingAfter', 'endingBefore', ] + 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) + + + + def createOrganizationSmAdminsRole(self, organizationId: str, name: str, **kwargs): + """ + **Create a Limited Access Role** + https://developer.cisco.com/meraki/api-v1/#!create-organization-sm-admins-role + + - organizationId (string): Organization ID + - name (string): The name of the Limited Access Role + - scope (string): The scope of the Limited Access Role + - tags (array): The tags of the Limited Access Role + """ + + kwargs.update(locals()) + + if 'scope' in kwargs: + options = ['all_tags', 'some', 'without_all_tags', 'without_some'] + assert kwargs['scope'] in options, f'''"scope" cannot be "{kwargs['scope']}", & must be set to one of: {options}''' + + metadata = { + 'tags': ['sm', 'configure', 'admins', 'roles'], + 'operation': 'createOrganizationSmAdminsRole' + } + organizationId = urllib.parse.quote(str(organizationId), safe='') + resource = f'/organizations/{organizationId}/sm/admins/roles' + + body_params = ['name', 'scope', 'tags', ] + payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params} + + return self._session.post(metadata, resource, payload) + + + + def getOrganizationSmAdminsRole(self, organizationId: str, roleId: str): + """ + **Return a Limited Access Role** + https://developer.cisco.com/meraki/api-v1/#!get-organization-sm-admins-role + + - organizationId (string): Organization ID + - roleId (string): Role ID + """ + + metadata = { + 'tags': ['sm', 'configure', 'admins', 'roles'], + 'operation': 'getOrganizationSmAdminsRole' + } + organizationId = urllib.parse.quote(str(organizationId), safe='') + roleId = urllib.parse.quote(str(roleId), safe='') + resource = f'/organizations/{organizationId}/sm/admins/roles/{roleId}' + + return self._session.get(metadata, resource) + + + + def updateOrganizationSmAdminsRole(self, organizationId: str, roleId: str, **kwargs): + """ + **Update a Limited Access Role** + https://developer.cisco.com/meraki/api-v1/#!update-organization-sm-admins-role + + - organizationId (string): Organization ID + - roleId (string): Role ID + - name (string): The name of the Limited Access Role + - scope (string): The scope of the Limited Access Role + - tags (array): The tags of the Limited Access Role + """ + + kwargs.update(locals()) + + if 'scope' in kwargs: + options = ['all_tags', 'some', 'without_all_tags', 'without_some'] + assert kwargs['scope'] in options, f'''"scope" cannot be "{kwargs['scope']}", & must be set to one of: {options}''' + + metadata = { + 'tags': ['sm', 'configure', 'admins', 'roles'], + 'operation': 'updateOrganizationSmAdminsRole' + } + organizationId = urllib.parse.quote(str(organizationId), safe='') + roleId = urllib.parse.quote(str(roleId), safe='') + resource = f'/organizations/{organizationId}/sm/admins/roles/{roleId}' + + body_params = ['name', 'scope', 'tags', ] + payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params} + + return self._session.put(metadata, resource, payload) + + + + def deleteOrganizationSmAdminsRole(self, organizationId: str, roleId: str): + """ + **Delete a Limited Access Role** + https://developer.cisco.com/meraki/api-v1/#!delete-organization-sm-admins-role + + - organizationId (string): Organization ID + - roleId (string): Role ID + """ + + metadata = { + 'tags': ['sm', 'configure', 'admins', 'roles'], + 'operation': 'deleteOrganizationSmAdminsRole' + } + organizationId = urllib.parse.quote(str(organizationId), safe='') + roleId = urllib.parse.quote(str(roleId), safe='') + resource = f'/organizations/{organizationId}/sm/admins/roles/{roleId}' + + return self._session.delete(metadata, resource) + + + def getOrganizationSmApnsCert(self, organizationId: str): """ **Get the organization's APNS certificate** @@ -982,6 +1190,67 @@ def getOrganizationSmApnsCert(self, organizationId: str): + def updateOrganizationSmSentryPoliciesAssignments(self, organizationId: str, items: list): + """ + **Update an Organizations Sentry Policies using the provided list** + https://developer.cisco.com/meraki/api-v1/#!update-organization-sm-sentry-policies-assignments + + - organizationId (string): Organization ID + - items (array): Sentry Group Policies for the Organization keyed by Network Id + """ + + kwargs = locals() + + metadata = { + 'tags': ['sm', 'configure', 'sentry', 'policies', 'assignments'], + 'operation': 'updateOrganizationSmSentryPoliciesAssignments' + } + organizationId = urllib.parse.quote(str(organizationId), safe='') + resource = f'/organizations/{organizationId}/sm/sentry/policies/assignments' + + body_params = ['items', ] + payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params} + + return self._session.put(metadata, resource, payload) + + + + def getOrganizationSmSentryPoliciesAssignmentsByNetwork(self, organizationId: str, total_pages=1, direction='next', **kwargs): + """ + **List the Sentry Policies for an organization ordered in ascending order of priority** + https://developer.cisco.com/meraki/api-v1/#!get-organization-sm-sentry-policies-assignments-by-network + + - 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 50. + - 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 Sentry Policies by Network Id + """ + + kwargs.update(locals()) + + metadata = { + 'tags': ['sm', 'configure', 'sentry', 'policies', 'assignments', 'byNetwork'], + 'operation': 'getOrganizationSmSentryPoliciesAssignmentsByNetwork' + } + organizationId = urllib.parse.quote(str(organizationId), safe='') + resource = f'/organizations/{organizationId}/sm/sentry/policies/assignments/byNetwork' + + query_params = ['perPage', 'startingAfter', 'endingBefore', 'networkIds', ] + params = {k.strip(): v for k, v in kwargs.items() if k.strip() in query_params} + + array_params = ['networkIds', ] + 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 getOrganizationSmVppAccounts(self, organizationId: str): """ **List the VPP accounts in the organization** diff --git a/meraki/aio/api/wireless.py b/meraki/aio/api/wireless.py index df523ec..4b89edd 100644 --- a/meraki/aio/api/wireless.py +++ b/meraki/aio/api/wireless.py @@ -2058,6 +2058,7 @@ def updateNetworkWirelessSsidSplashSettings(self, networkId: str, number: str, * - redirectUrl (string): The custom redirect URL where the users will go after the splash page. - useRedirectUrl (boolean): The Boolean indicating whether the the user will be redirected to the custom redirect URL after the splash page. A custom redirect URL must be set if this is true. - welcomeMessage (string): The welcome message for the users on the splash page. + - themeId (string): The id of the selected splash theme. - splashLogo (object): The logo used in the splash page. - splashImage (object): The image used in the splash page. - splashPrepaidFront (object): The prepaid front image used in the splash page. @@ -2083,7 +2084,7 @@ def updateNetworkWirelessSsidSplashSettings(self, networkId: str, number: str, * number = urllib.parse.quote(str(number), safe='') resource = f'/networks/{networkId}/wireless/ssids/{number}/splash/settings' - body_params = ['splashUrl', 'useSplashUrl', 'splashTimeout', 'redirectUrl', 'useRedirectUrl', 'welcomeMessage', 'splashLogo', 'splashImage', 'splashPrepaidFront', 'blockAllTrafficBeforeSignOn', 'controllerDisconnectionBehavior', 'allowSimultaneousLogins', 'guestSponsorship', 'billing', 'sentryEnrollment', ] + body_params = ['splashUrl', 'useSplashUrl', 'splashTimeout', 'redirectUrl', 'useRedirectUrl', 'welcomeMessage', 'themeId', 'splashLogo', 'splashImage', 'splashPrepaidFront', 'blockAllTrafficBeforeSignOn', 'controllerDisconnectionBehavior', 'allowSimultaneousLogins', 'guestSponsorship', 'billing', 'sentryEnrollment', ] payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params} return self._session.put(metadata, resource, payload) diff --git a/meraki/api/appliance.py b/meraki/api/appliance.py index eafeea5..f0a93fc 100644 --- a/meraki/api/appliance.py +++ b/meraki/api/appliance.py @@ -2472,6 +2472,25 @@ def getOrganizationApplianceUplinkStatuses(self, organizationId: str, total_page + def getOrganizationApplianceUplinksStatusesOverview(self, organizationId: str): + """ + **Returns an overview of uplink statuses** + https://developer.cisco.com/meraki/api-v1/#!get-organization-appliance-uplinks-statuses-overview + + - organizationId (string): Organization ID + """ + + metadata = { + 'tags': ['appliance', 'configure', 'uplinks', 'statuses', 'overview'], + 'operation': 'getOrganizationApplianceUplinksStatusesOverview' + } + organizationId = urllib.parse.quote(str(organizationId), safe='') + resource = f'/organizations/{organizationId}/appliance/uplinks/statuses/overview' + + return self._session.get(metadata, resource) + + + def getOrganizationApplianceUplinksUsageByNetwork(self, organizationId: str, **kwargs): """ **Get the sent and received bytes for each uplink of all MX and Z networks within an organization** diff --git a/meraki/api/batch/devices.py b/meraki/api/batch/devices.py index b6cf9e2..5357a50 100644 --- a/meraki/api/batch/devices.py +++ b/meraki/api/batch/devices.py @@ -46,6 +46,37 @@ def updateDevice(self, serial: str, **kwargs): + def createDeviceLiveToolsThroughputTest(self, serial: str, **kwargs): + """ + **Enqueue a job to test a device throughput, the test will run for 10 secs to test throughput** + https://developer.cisco.com/meraki/api-v1/#!create-device-live-tools-throughput-test + + - serial (string): Serial + - callback (object): Details for the callback. Please include either an httpServerId OR url and sharedSecret + """ + + kwargs.update(locals()) + + metadata = { + 'tags': ['devices', 'liveTools', 'throughputTest'], + 'operation': 'createDeviceLiveToolsThroughputTest' + } + resource = f'/devices/{serial}/liveTools/throughputTest' + + body_params = ['callback', ] + payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params} + action = { + "resource": resource, + "operation": "test", + "body": payload + } + return action + + + + + + def updateDeviceManagementInterface(self, serial: str, **kwargs): """ **Update the management interface settings for a device** diff --git a/meraki/api/batch/networks.py b/meraki/api/batch/networks.py index fbe95f6..30e6109 100644 --- a/meraki/api/batch/networks.py +++ b/meraki/api/batch/networks.py @@ -175,13 +175,13 @@ def vmxNetworkDevicesClaim(self, networkId: str, size: str): https://developer.cisco.com/meraki/api-v1/#!vmx-network-devices-claim - networkId (string): Network ID - - size (string): The size of the vMX you claim. It can be one of: small, medium, large, 100 + - size (string): The size of the vMX you claim. It can be one of: small, medium, large, xlarge, 100 """ kwargs = locals() if 'size' in kwargs: - options = ['100', 'large', 'medium', 'small'] + options = ['100', 'large', 'medium', 'small', 'xlarge'] assert kwargs['size'] in options, f'''"size" cannot be "{kwargs['size']}", & must be set to one of: {options}''' metadata = { diff --git a/meraki/api/batch/sm.py b/meraki/api/batch/sm.py index 0aac4e6..3f1c94c 100644 --- a/meraki/api/batch/sm.py +++ b/meraki/api/batch/sm.py @@ -31,3 +31,135 @@ def deleteNetworkSmUserAccessDevice(self, networkId: str, userAccessDeviceId: st + + + def createOrganizationSmAdminsRole(self, organizationId: str, name: str, **kwargs): + """ + **Create a Limited Access Role** + https://developer.cisco.com/meraki/api-v1/#!create-organization-sm-admins-role + + - organizationId (string): Organization ID + - name (string): The name of the Limited Access Role + - scope (string): The scope of the Limited Access Role + - tags (array): The tags of the Limited Access Role + """ + + kwargs.update(locals()) + + if 'scope' in kwargs: + options = ['all_tags', 'some', 'without_all_tags', 'without_some'] + assert kwargs['scope'] in options, f'''"scope" cannot be "{kwargs['scope']}", & must be set to one of: {options}''' + + metadata = { + 'tags': ['sm', 'configure', 'admins', 'roles'], + 'operation': 'createOrganizationSmAdminsRole' + } + resource = f'/organizations/{organizationId}/sm/admins/roles' + + body_params = ['name', 'scope', 'tags', ] + 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 updateOrganizationSmAdminsRole(self, organizationId: str, roleId: str, **kwargs): + """ + **Update a Limited Access Role** + https://developer.cisco.com/meraki/api-v1/#!update-organization-sm-admins-role + + - organizationId (string): Organization ID + - roleId (string): Role ID + - name (string): The name of the Limited Access Role + - scope (string): The scope of the Limited Access Role + - tags (array): The tags of the Limited Access Role + """ + + kwargs.update(locals()) + + if 'scope' in kwargs: + options = ['all_tags', 'some', 'without_all_tags', 'without_some'] + assert kwargs['scope'] in options, f'''"scope" cannot be "{kwargs['scope']}", & must be set to one of: {options}''' + + metadata = { + 'tags': ['sm', 'configure', 'admins', 'roles'], + 'operation': 'updateOrganizationSmAdminsRole' + } + resource = f'/organizations/{organizationId}/sm/admins/roles/{roleId}' + + body_params = ['name', 'scope', 'tags', ] + 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 deleteOrganizationSmAdminsRole(self, organizationId: str, roleId: str): + """ + **Delete a Limited Access Role** + https://developer.cisco.com/meraki/api-v1/#!delete-organization-sm-admins-role + + - organizationId (string): Organization ID + - roleId (string): Role ID + """ + + metadata = { + 'tags': ['sm', 'configure', 'admins', 'roles'], + 'operation': 'deleteOrganizationSmAdminsRole' + } + resource = f'/organizations/{organizationId}/sm/admins/roles/{roleId}' + + action = { + "resource": resource, + "operation": "destroy", + } + return action + + + + + + + def updateOrganizationSmSentryPoliciesAssignments(self, organizationId: str, items: list): + """ + **Update an Organizations Sentry Policies using the provided list. Sentry Policies are ordered in descending order of priority (i.e. highest priority at the bottom, this is opposite the Dashboard UI). Policies not present in the request will be deleted.** + https://developer.cisco.com/meraki/api-v1/#!update-organization-sm-sentry-policies-assignments + + - organizationId (string): Organization ID + - items (array): Sentry Group Policies for the Organization keyed by Network Id + """ + + kwargs = locals() + + metadata = { + 'tags': ['sm', 'configure', 'sentry', 'policies', 'assignments'], + 'operation': 'updateOrganizationSmSentryPoliciesAssignments' + } + resource = f'/organizations/{organizationId}/sm/sentry/policies/assignments' + + body_params = ['items', ] + 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 + + + + diff --git a/meraki/api/batch/wireless.py b/meraki/api/batch/wireless.py index 1d8a69a..925ca40 100644 --- a/meraki/api/batch/wireless.py +++ b/meraki/api/batch/wireless.py @@ -959,6 +959,7 @@ def updateNetworkWirelessSsidSplashSettings(self, networkId: str, number: str, * - redirectUrl (string): The custom redirect URL where the users will go after the splash page. - useRedirectUrl (boolean): The Boolean indicating whether the the user will be redirected to the custom redirect URL after the splash page. A custom redirect URL must be set if this is true. - welcomeMessage (string): The welcome message for the users on the splash page. + - themeId (string): The id of the selected splash theme. - splashLogo (object): The logo used in the splash page. - splashImage (object): The image used in the splash page. - splashPrepaidFront (object): The prepaid front image used in the splash page. @@ -982,7 +983,7 @@ def updateNetworkWirelessSsidSplashSettings(self, networkId: str, number: str, * } resource = f'/networks/{networkId}/wireless/ssids/{number}/splash/settings' - body_params = ['splashUrl', 'useSplashUrl', 'splashTimeout', 'redirectUrl', 'useRedirectUrl', 'welcomeMessage', 'splashLogo', 'splashImage', 'splashPrepaidFront', 'blockAllTrafficBeforeSignOn', 'controllerDisconnectionBehavior', 'allowSimultaneousLogins', 'guestSponsorship', 'billing', 'sentryEnrollment', ] + body_params = ['splashUrl', 'useSplashUrl', 'splashTimeout', 'redirectUrl', 'useRedirectUrl', 'welcomeMessage', 'themeId', 'splashLogo', 'splashImage', 'splashPrepaidFront', 'blockAllTrafficBeforeSignOn', 'controllerDisconnectionBehavior', 'allowSimultaneousLogins', 'guestSponsorship', 'billing', 'sentryEnrollment', ] payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params} action = { "resource": resource, diff --git a/meraki/api/camera.py b/meraki/api/camera.py index ce7d199..c4c1806 100644 --- a/meraki/api/camera.py +++ b/meraki/api/camera.py @@ -718,6 +718,68 @@ def deleteNetworkCameraWirelessProfile(self, networkId: str, wirelessProfileId: + def getOrganizationCameraBoundariesAreasByDevice(self, organizationId: str, **kwargs): + """ + **Returns all configured area boundaries of cameras** + https://developer.cisco.com/meraki/api-v1/#!get-organization-camera-boundaries-areas-by-device + + - organizationId (string): Organization ID + - serials (array): A list of serial numbers. The returned cameras will be filtered to only include these serials. + """ + + kwargs.update(locals()) + + metadata = { + 'tags': ['camera', 'configure', 'boundaries', 'areas', 'byDevice'], + 'operation': 'getOrganizationCameraBoundariesAreasByDevice' + } + organizationId = urllib.parse.quote(str(organizationId), safe='') + resource = f'/organizations/{organizationId}/camera/boundaries/areas/byDevice' + + query_params = ['serials', ] + params = {k.strip(): v for k, v in kwargs.items() if k.strip() in query_params} + + array_params = ['serials', ] + for k, v in kwargs.items(): + if k.strip() in array_params: + params[f'{k.strip()}[]'] = kwargs[f'{k}'] + params.pop(k.strip()) + + return self._session.get(metadata, resource, params) + + + + def getOrganizationCameraBoundariesLinesByDevice(self, organizationId: str, **kwargs): + """ + **Returns all configured crossingline boundaries of cameras** + https://developer.cisco.com/meraki/api-v1/#!get-organization-camera-boundaries-lines-by-device + + - organizationId (string): Organization ID + - serials (array): A list of serial numbers. The returned cameras will be filtered to only include these serials. + """ + + kwargs.update(locals()) + + metadata = { + 'tags': ['camera', 'configure', 'boundaries', 'lines', 'byDevice'], + 'operation': 'getOrganizationCameraBoundariesLinesByDevice' + } + organizationId = urllib.parse.quote(str(organizationId), safe='') + resource = f'/organizations/{organizationId}/camera/boundaries/lines/byDevice' + + query_params = ['serials', ] + params = {k.strip(): v for k, v in kwargs.items() if k.strip() in query_params} + + array_params = ['serials', ] + for k, v in kwargs.items(): + if k.strip() in array_params: + params[f'{k.strip()}[]'] = kwargs[f'{k}'] + params.pop(k.strip()) + + return self._session.get(metadata, resource, params) + + + def getOrganizationCameraCustomAnalyticsArtifacts(self, organizationId: str): """ **List Custom Analytics Artifacts** @@ -804,6 +866,42 @@ def deleteOrganizationCameraCustomAnalyticsArtifact(self, organizationId: str, a + def getOrganizationCameraDetectionsHistoryByBoundaryByInterval(self, organizationId: str, boundaryIds: list, total_pages=1, direction='next', **kwargs): + """ + **Returns analytics data for timespans** + https://developer.cisco.com/meraki/api-v1/#!get-organization-camera-detections-history-by-boundary-by-interval + + - organizationId (string): Organization ID + - boundaryIds (array): A list of boundary ids. The returned cameras will be filtered to only include these ids. + - 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 + - duration (integer): The minimum time, in seconds, that the person or car remains in the area to be counted. Defaults to boundary configuration or 60. + - perPage (integer): The number of entries per page returned. Acceptable range is 1 - 1000. Defaults to 1000. + - boundaryTypes (array): The detection types. Defaults to 'person'. + """ + + kwargs.update(locals()) + + metadata = { + 'tags': ['camera', 'configure', 'detections', 'history', 'byBoundary', 'byInterval'], + 'operation': 'getOrganizationCameraDetectionsHistoryByBoundaryByInterval' + } + organizationId = urllib.parse.quote(str(organizationId), safe='') + resource = f'/organizations/{organizationId}/camera/detections/history/byBoundary/byInterval' + + query_params = ['boundaryIds', 'duration', 'perPage', 'boundaryTypes', ] + params = {k.strip(): v for k, v in kwargs.items() if k.strip() in query_params} + + array_params = ['boundaryIds', 'boundaryTypes', ] + 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 getOrganizationCameraOnboardingStatuses(self, organizationId: str, **kwargs): """ **Fetch onboarding status of cameras** diff --git a/meraki/api/devices.py b/meraki/api/devices.py index 874a031..72865b4 100644 --- a/meraki/api/devices.py +++ b/meraki/api/devices.py @@ -158,6 +158,99 @@ def getDeviceClients(self, serial: str, **kwargs): + def createDeviceLiveToolsArpTable(self, serial: str, **kwargs): + """ + **Enqueue a job to perform a ARP table request for the device** + https://developer.cisco.com/meraki/api-v1/#!create-device-live-tools-arp-table + + - serial (string): Serial + - callback (object): Details for the callback. Please include either an httpServerId OR url and sharedSecret + """ + + kwargs.update(locals()) + + metadata = { + 'tags': ['devices', 'liveTools', 'arpTable'], + 'operation': 'createDeviceLiveToolsArpTable' + } + serial = urllib.parse.quote(str(serial), safe='') + resource = f'/devices/{serial}/liveTools/arpTable' + + body_params = ['callback', ] + payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params} + + return self._session.post(metadata, resource, payload) + + + + def getDeviceLiveToolsArpTable(self, serial: str, arpTableId: str): + """ + **Return an ARP table live tool job.** + https://developer.cisco.com/meraki/api-v1/#!get-device-live-tools-arp-table + + - serial (string): Serial + - arpTableId (string): Arp table ID + """ + + metadata = { + 'tags': ['devices', 'liveTools', 'arpTable'], + 'operation': 'getDeviceLiveToolsArpTable' + } + serial = urllib.parse.quote(str(serial), safe='') + arpTableId = urllib.parse.quote(str(arpTableId), safe='') + resource = f'/devices/{serial}/liveTools/arpTable/{arpTableId}' + + return self._session.get(metadata, resource) + + + + def createDeviceLiveToolsCableTest(self, serial: str, ports: list, **kwargs): + """ + **Enqueue a job to perform a cable test for the device on the specified ports.** + https://developer.cisco.com/meraki/api-v1/#!create-device-live-tools-cable-test + + - serial (string): Serial + - ports (array): A list of ports for which to perform the cable test. + - callback (object): Details for the callback. Please include either an httpServerId OR url and sharedSecret + """ + + kwargs.update(locals()) + + metadata = { + 'tags': ['devices', 'liveTools', 'cableTest'], + 'operation': 'createDeviceLiveToolsCableTest' + } + serial = urllib.parse.quote(str(serial), safe='') + resource = f'/devices/{serial}/liveTools/cableTest' + + body_params = ['ports', 'callback', ] + payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params} + + return self._session.post(metadata, resource, payload) + + + + def getDeviceLiveToolsCableTest(self, serial: str, id: str): + """ + **Return a cable test live tool job.** + https://developer.cisco.com/meraki/api-v1/#!get-device-live-tools-cable-test + + - serial (string): Serial + - id (string): ID + """ + + metadata = { + 'tags': ['devices', 'liveTools', 'cableTest'], + 'operation': 'getDeviceLiveToolsCableTest' + } + serial = urllib.parse.quote(str(serial), safe='') + id = urllib.parse.quote(str(id), safe='') + resource = f'/devices/{serial}/liveTools/cableTest/{id}' + + return self._session.get(metadata, resource) + + + def createDeviceLiveToolsPing(self, serial: str, target: str, **kwargs): """ **Enqueue a job to ping a target host from the device** @@ -253,6 +346,100 @@ def getDeviceLiveToolsPingDevice(self, serial: str, id: str): + def createDeviceLiveToolsThroughputTest(self, serial: str, **kwargs): + """ + **Enqueue a job to test a device throughput, the test will run for 10 secs to test throughput** + https://developer.cisco.com/meraki/api-v1/#!create-device-live-tools-throughput-test + + - serial (string): Serial + - callback (object): Details for the callback. Please include either an httpServerId OR url and sharedSecret + """ + + kwargs.update(locals()) + + metadata = { + 'tags': ['devices', 'liveTools', 'throughputTest'], + 'operation': 'createDeviceLiveToolsThroughputTest' + } + serial = urllib.parse.quote(str(serial), safe='') + resource = f'/devices/{serial}/liveTools/throughputTest' + + body_params = ['callback', ] + payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params} + + return self._session.post(metadata, resource, payload) + + + + def getDeviceLiveToolsThroughputTest(self, serial: str, throughputTestId: str): + """ + **Return a throughput test job** + https://developer.cisco.com/meraki/api-v1/#!get-device-live-tools-throughput-test + + - serial (string): Serial + - throughputTestId (string): Throughput test ID + """ + + metadata = { + 'tags': ['devices', 'liveTools', 'throughputTest'], + 'operation': 'getDeviceLiveToolsThroughputTest' + } + serial = urllib.parse.quote(str(serial), safe='') + throughputTestId = urllib.parse.quote(str(throughputTestId), safe='') + resource = f'/devices/{serial}/liveTools/throughputTest/{throughputTestId}' + + return self._session.get(metadata, resource) + + + + def createDeviceLiveToolsWakeOnLan(self, serial: str, vlanId: int, mac: str, **kwargs): + """ + **Enqueue a job to send a Wake-on-LAN packet from the device** + https://developer.cisco.com/meraki/api-v1/#!create-device-live-tools-wake-on-lan + + - serial (string): Serial + - vlanId (integer): The target's VLAN (1 to 4094) + - mac (string): The target's MAC address + - callback (object): Details for the callback. Please include either an httpServerId OR url and sharedSecret + """ + + kwargs.update(locals()) + + metadata = { + 'tags': ['devices', 'liveTools', 'wakeOnLan'], + 'operation': 'createDeviceLiveToolsWakeOnLan' + } + serial = urllib.parse.quote(str(serial), safe='') + resource = f'/devices/{serial}/liveTools/wakeOnLan' + + body_params = ['vlanId', 'mac', 'callback', ] + payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params} + + return self._session.post(metadata, resource, payload) + + + + def getDeviceLiveToolsWakeOnLan(self, serial: str, wakeOnLanId: str): + """ + **Return a Wake-on-LAN job** + https://developer.cisco.com/meraki/api-v1/#!get-device-live-tools-wake-on-lan + + - serial (string): Serial + - wakeOnLanId (string): Wake on lan ID + """ + + metadata = { + 'tags': ['devices', 'liveTools', 'wakeOnLan'], + 'operation': 'getDeviceLiveToolsWakeOnLan' + } + serial = urllib.parse.quote(str(serial), safe='') + wakeOnLanId = urllib.parse.quote(str(wakeOnLanId), safe='') + resource = f'/devices/{serial}/liveTools/wakeOnLan/{wakeOnLanId}' + + return self._session.get(metadata, resource) + + + def getDeviceLldpCdp(self, serial: str): """ **List LLDP and CDP information for a device** diff --git a/meraki/api/licensing.py b/meraki/api/licensing.py index 378d341..95e7504 100644 --- a/meraki/api/licensing.py +++ b/meraki/api/licensing.py @@ -8,6 +8,35 @@ def __init__(self, session): + def getAdministeredLicensingSubscriptionEntitlements(self, **kwargs): + """ + **Retrieve the list of purchasable entitlements** + https://developer.cisco.com/meraki/api-v1/#!get-administered-licensing-subscription-entitlements + + - skus (array): Filter to entitlements with the specified SKUs + """ + + kwargs.update(locals()) + + metadata = { + 'tags': ['licensing', 'configure', 'subscription', 'entitlements'], + 'operation': 'getAdministeredLicensingSubscriptionEntitlements' + } + resource = f'/administered/licensing/subscription/entitlements' + + query_params = ['skus', ] + params = {k.strip(): v for k, v in kwargs.items() if k.strip() in query_params} + + array_params = ['skus', ] + 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(metadata, resource, params) + + + def getAdministeredLicensingSubscriptionSubscriptions(self, total_pages=1, direction='next', **kwargs): """ **List available subscriptions** @@ -97,6 +126,36 @@ def validateAdministeredLicensingSubscriptionSubscriptionsClaimKey(self, claimKe + def getAdministeredLicensingSubscriptionSubscriptionsComplianceStatuses(self, **kwargs): + """ + **Get compliance status for requested subscriptions** + https://developer.cisco.com/meraki/api-v1/#!get-administered-licensing-subscription-subscriptions-compliance-statuses + + - organizationIds (array): Organizations to get subscription compliance information for + - subscriptionIds (array): Subscription ids + """ + + kwargs.update(locals()) + + metadata = { + 'tags': ['licensing', 'configure', 'subscription', 'subscriptions', 'compliance', 'statuses'], + 'operation': 'getAdministeredLicensingSubscriptionSubscriptionsComplianceStatuses' + } + resource = f'/administered/licensing/subscription/subscriptions/compliance/statuses' + + query_params = ['organizationIds', 'subscriptionIds', ] + params = {k.strip(): v for k, v in kwargs.items() if k.strip() in query_params} + + array_params = ['organizationIds', 'subscriptionIds', ] + 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(metadata, resource, params) + + + def bindAdministeredLicensingSubscriptionSubscription(self, subscriptionId: str, networkIds: list, **kwargs): """ **Bind networks to a subscription** diff --git a/meraki/api/networks.py b/meraki/api/networks.py index 898f668..a4f9705 100644 --- a/meraki/api/networks.py +++ b/meraki/api/networks.py @@ -673,13 +673,13 @@ def vmxNetworkDevicesClaim(self, networkId: str, size: str): https://developer.cisco.com/meraki/api-v1/#!vmx-network-devices-claim - networkId (string): Network ID - - size (string): The size of the vMX you claim. It can be one of: small, medium, large, 100 + - size (string): The size of the vMX you claim. It can be one of: small, medium, large, xlarge, 100 """ kwargs = locals() if 'size' in kwargs: - options = ['100', 'large', 'medium', 'small'] + options = ['100', 'large', 'medium', 'small', 'xlarge'] assert kwargs['size'] in options, f'''"size" cannot be "{kwargs['size']}", & must be set to one of: {options}''' metadata = { diff --git a/meraki/api/organizations.py b/meraki/api/organizations.py index fde4069..40b8150 100644 --- a/meraki/api/organizations.py +++ b/meraki/api/organizations.py @@ -8,20 +8,30 @@ def __init__(self, session): - def getOrganizations(self): + def getOrganizations(self, total_pages=1, direction='next', **kwargs): """ **List the organizations that the user has privileges on** https://developer.cisco.com/meraki/api-v1/#!get-organizations + - 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 - 9000. Default is 9000. + - 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': ['organizations', 'configure'], 'operation': 'getOrganizations' } resource = f'/organizations' - return self._session.get(metadata, resource) + query_params = ['perPage', 'startingAfter', 'endingBefore', ] + 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) @@ -3478,6 +3488,35 @@ def getOrganizationSummaryTopDevicesModelsByUsage(self, organizationId: str, **k + def getOrganizationSummaryTopNetworksByStatus(self, organizationId: str, total_pages=1, direction='next', **kwargs): + """ + **List the client and status overview information for the networks in an organization** + https://developer.cisco.com/meraki/api-v1/#!get-organization-summary-top-networks-by-status + + - 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 - 5000. + - 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': ['organizations', 'monitor', 'summary', 'top', 'networks', 'byStatus'], + 'operation': 'getOrganizationSummaryTopNetworksByStatus' + } + organizationId = urllib.parse.quote(str(organizationId), safe='') + resource = f'/organizations/{organizationId}/summary/top/networks/byStatus' + + query_params = ['perPage', 'startingAfter', 'endingBefore', ] + 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) + + + def getOrganizationSummaryTopSsidsByUsage(self, organizationId: str, **kwargs): """ **Return metrics for organization's top 10 ssids by data usage over given time range** diff --git a/meraki/api/sensor.py b/meraki/api/sensor.py index 4f56c3d..45f8ae5 100644 --- a/meraki/api/sensor.py +++ b/meraki/api/sensor.py @@ -322,7 +322,7 @@ def getOrganizationSensorReadingsHistory(self, organizationId: str, total_pages= - 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 7 days. The default is 2 hours. - networkIds (array): Optional parameter to filter readings by network. - serials (array): Optional parameter to filter readings by sensor. - - metrics (array): Types of sensor readings to retrieve. If no metrics are supplied, all available types of readings will be retrieved. Allowed values are battery, button, door, humidity, indoorAirQuality, noise, pm25, temperature, tvoc, and water. + - metrics (array): Types of sensor readings to retrieve. If no metrics are supplied, all available types of readings will be retrieved. Allowed values are apparentPower, battery, button, co2, current, door, downstreamPower, frequency, humidity, indoorAirQuality, noise, pm25, powerFactor, realPower, remoteLockoutSwitch, temperature, tvoc, voltage, and water. """ kwargs.update(locals()) @@ -360,7 +360,7 @@ def getOrganizationSensorReadingsLatest(self, organizationId: str, total_pages=1 - 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 readings by network. - serials (array): Optional parameter to filter readings by sensor. - - metrics (array): Types of sensor readings to retrieve. If no metrics are supplied, all available types of readings will be retrieved. Allowed values are battery, button, door, humidity, indoorAirQuality, noise, pm25, temperature, tvoc, and water. + - metrics (array): Types of sensor readings to retrieve. If no metrics are supplied, all available types of readings will be retrieved. Allowed values are apparentPower, battery, button, co2, current, door, downstreamPower, frequency, humidity, indoorAirQuality, noise, pm25, powerFactor, realPower, remoteLockoutSwitch, temperature, tvoc, voltage, and water. """ kwargs.update(locals()) diff --git a/meraki/api/sm.py b/meraki/api/sm.py index eb931be..c38195e 100644 --- a/meraki/api/sm.py +++ b/meraki/api/sm.py @@ -73,6 +73,7 @@ def getNetworkSmDevices(self, networkId: str, total_pages=1, direction='next', * - serials (array): Filter devices by serial(s). - ids (array): Filter devices by id(s). - uuids (array): Filter devices by uuid(s). + - systemTypes (array): Filter devices by system type(s). - scope (array): Specify a scope (one of all, none, withAny, withAll, withoutAny, or withoutAll) and a set of tags. - 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. @@ -88,10 +89,10 @@ def getNetworkSmDevices(self, networkId: str, total_pages=1, direction='next', * networkId = urllib.parse.quote(str(networkId), safe='') resource = f'/networks/{networkId}/sm/devices' - query_params = ['fields', 'wifiMacs', 'serials', 'ids', 'uuids', 'scope', 'perPage', 'startingAfter', 'endingBefore', ] + query_params = ['fields', 'wifiMacs', 'serials', 'ids', 'uuids', 'systemTypes', 'scope', 'perPage', 'startingAfter', 'endingBefore', ] params = {k.strip(): v for k, v in kwargs.items() if k.strip() in query_params} - array_params = ['fields', 'wifiMacs', 'serials', 'ids', 'uuids', 'scope', ] + array_params = ['fields', 'wifiMacs', 'serials', 'ids', 'uuids', 'systemTypes', 'scope', ] for k, v in kwargs.items(): if k.strip() in array_params: params[f'{k.strip()}[]'] = kwargs[f'{k}'] @@ -245,6 +246,66 @@ def moveNetworkSmDevices(self, networkId: str, newNetwork: str, **kwargs): + def rebootNetworkSmDevices(self, networkId: str, **kwargs): + """ + **Reboot a set of endpoints** + https://developer.cisco.com/meraki/api-v1/#!reboot-network-sm-devices + + - networkId (string): Network ID + - wifiMacs (array): The wifiMacs of the endpoints to be rebooted. + - ids (array): The ids of the endpoints to be rebooted. + - serials (array): The serials of the endpoints to be rebooted. + - scope (array): The scope (one of all, none, withAny, withAll, withoutAny, or withoutAll) and a set of tags of the endpoints to be rebooted. + - kextPaths (array): The KextPaths of the endpoints to be rebooted. Available for macOS 11+ + - notifyUser (boolean): Whether or not to notify the user before rebooting the endpoint. Available for macOS 11.3+ + - rebuildKernelCache (boolean): Whether or not to rebuild the kernel cache when rebooting the endpoint. Available for macOS 11+ + - requestRequiresNetworkTether (boolean): Whether or not the request requires network tethering. Available for macOS and supervised iOS or tvOS + """ + + kwargs.update(locals()) + + metadata = { + 'tags': ['sm', 'configure', 'devices'], + 'operation': 'rebootNetworkSmDevices' + } + networkId = urllib.parse.quote(str(networkId), safe='') + resource = f'/networks/{networkId}/sm/devices/reboot' + + body_params = ['wifiMacs', 'ids', 'serials', 'scope', 'kextPaths', 'notifyUser', 'rebuildKernelCache', 'requestRequiresNetworkTether', ] + payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params} + + return self._session.post(metadata, resource, payload) + + + + def shutdownNetworkSmDevices(self, networkId: str, **kwargs): + """ + **Shutdown a set of endpoints** + https://developer.cisco.com/meraki/api-v1/#!shutdown-network-sm-devices + + - networkId (string): Network ID + - wifiMacs (array): The wifiMacs of the endpoints to be shutdown. + - ids (array): The ids of the endpoints to be shutdown. + - serials (array): The serials of the endpoints to be shutdown. + - scope (array): The scope (one of all, none, withAny, withAll, withoutAny, or withoutAll) and a set of tags of the endpoints to be shutdown. + """ + + kwargs.update(locals()) + + metadata = { + 'tags': ['sm', 'configure', 'devices'], + 'operation': 'shutdownNetworkSmDevices' + } + networkId = urllib.parse.quote(str(networkId), safe='') + resource = f'/networks/{networkId}/sm/devices/shutdown' + + body_params = ['wifiMacs', 'ids', 'serials', 'scope', ] + payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params} + + return self._session.post(metadata, resource, payload) + + + def wipeNetworkSmDevices(self, networkId: str, **kwargs): """ **Wipe a device** @@ -662,14 +723,17 @@ def getNetworkSmDeviceWlanLists(self, networkId: str, deviceId: str): - def getNetworkSmProfiles(self, networkId: str): + def getNetworkSmProfiles(self, networkId: str, **kwargs): """ **List all profiles in a network** https://developer.cisco.com/meraki/api-v1/#!get-network-sm-profiles - networkId (string): Network ID + - payloadTypes (array): Filter by payload types """ + kwargs.update(locals()) + metadata = { 'tags': ['sm', 'configure', 'profiles'], 'operation': 'getNetworkSmProfiles' @@ -677,7 +741,16 @@ def getNetworkSmProfiles(self, networkId: str): networkId = urllib.parse.quote(str(networkId), safe='') resource = f'/networks/{networkId}/sm/profiles' - return self._session.get(metadata, resource) + query_params = ['payloadTypes', ] + params = {k.strip(): v for k, v in kwargs.items() if k.strip() in query_params} + + array_params = ['payloadTypes', ] + 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(metadata, resource, params) @@ -963,6 +1036,141 @@ def getNetworkSmUserSoftwares(self, networkId: str, userId: str): + def getOrganizationSmAdminsRoles(self, organizationId: str, total_pages=1, direction='next', **kwargs): + """ + **List the Limited Access Roles for an organization** + https://developer.cisco.com/meraki/api-v1/#!get-organization-sm-admins-roles + + - 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 50. + - 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': ['sm', 'configure', 'admins', 'roles'], + 'operation': 'getOrganizationSmAdminsRoles' + } + organizationId = urllib.parse.quote(str(organizationId), safe='') + resource = f'/organizations/{organizationId}/sm/admins/roles' + + query_params = ['perPage', 'startingAfter', 'endingBefore', ] + 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) + + + + def createOrganizationSmAdminsRole(self, organizationId: str, name: str, **kwargs): + """ + **Create a Limited Access Role** + https://developer.cisco.com/meraki/api-v1/#!create-organization-sm-admins-role + + - organizationId (string): Organization ID + - name (string): The name of the Limited Access Role + - scope (string): The scope of the Limited Access Role + - tags (array): The tags of the Limited Access Role + """ + + kwargs.update(locals()) + + if 'scope' in kwargs: + options = ['all_tags', 'some', 'without_all_tags', 'without_some'] + assert kwargs['scope'] in options, f'''"scope" cannot be "{kwargs['scope']}", & must be set to one of: {options}''' + + metadata = { + 'tags': ['sm', 'configure', 'admins', 'roles'], + 'operation': 'createOrganizationSmAdminsRole' + } + organizationId = urllib.parse.quote(str(organizationId), safe='') + resource = f'/organizations/{organizationId}/sm/admins/roles' + + body_params = ['name', 'scope', 'tags', ] + payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params} + + return self._session.post(metadata, resource, payload) + + + + def getOrganizationSmAdminsRole(self, organizationId: str, roleId: str): + """ + **Return a Limited Access Role** + https://developer.cisco.com/meraki/api-v1/#!get-organization-sm-admins-role + + - organizationId (string): Organization ID + - roleId (string): Role ID + """ + + metadata = { + 'tags': ['sm', 'configure', 'admins', 'roles'], + 'operation': 'getOrganizationSmAdminsRole' + } + organizationId = urllib.parse.quote(str(organizationId), safe='') + roleId = urllib.parse.quote(str(roleId), safe='') + resource = f'/organizations/{organizationId}/sm/admins/roles/{roleId}' + + return self._session.get(metadata, resource) + + + + def updateOrganizationSmAdminsRole(self, organizationId: str, roleId: str, **kwargs): + """ + **Update a Limited Access Role** + https://developer.cisco.com/meraki/api-v1/#!update-organization-sm-admins-role + + - organizationId (string): Organization ID + - roleId (string): Role ID + - name (string): The name of the Limited Access Role + - scope (string): The scope of the Limited Access Role + - tags (array): The tags of the Limited Access Role + """ + + kwargs.update(locals()) + + if 'scope' in kwargs: + options = ['all_tags', 'some', 'without_all_tags', 'without_some'] + assert kwargs['scope'] in options, f'''"scope" cannot be "{kwargs['scope']}", & must be set to one of: {options}''' + + metadata = { + 'tags': ['sm', 'configure', 'admins', 'roles'], + 'operation': 'updateOrganizationSmAdminsRole' + } + organizationId = urllib.parse.quote(str(organizationId), safe='') + roleId = urllib.parse.quote(str(roleId), safe='') + resource = f'/organizations/{organizationId}/sm/admins/roles/{roleId}' + + body_params = ['name', 'scope', 'tags', ] + payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params} + + return self._session.put(metadata, resource, payload) + + + + def deleteOrganizationSmAdminsRole(self, organizationId: str, roleId: str): + """ + **Delete a Limited Access Role** + https://developer.cisco.com/meraki/api-v1/#!delete-organization-sm-admins-role + + - organizationId (string): Organization ID + - roleId (string): Role ID + """ + + metadata = { + 'tags': ['sm', 'configure', 'admins', 'roles'], + 'operation': 'deleteOrganizationSmAdminsRole' + } + organizationId = urllib.parse.quote(str(organizationId), safe='') + roleId = urllib.parse.quote(str(roleId), safe='') + resource = f'/organizations/{organizationId}/sm/admins/roles/{roleId}' + + return self._session.delete(metadata, resource) + + + def getOrganizationSmApnsCert(self, organizationId: str): """ **Get the organization's APNS certificate** @@ -982,6 +1190,67 @@ def getOrganizationSmApnsCert(self, organizationId: str): + def updateOrganizationSmSentryPoliciesAssignments(self, organizationId: str, items: list): + """ + **Update an Organizations Sentry Policies using the provided list** + https://developer.cisco.com/meraki/api-v1/#!update-organization-sm-sentry-policies-assignments + + - organizationId (string): Organization ID + - items (array): Sentry Group Policies for the Organization keyed by Network Id + """ + + kwargs = locals() + + metadata = { + 'tags': ['sm', 'configure', 'sentry', 'policies', 'assignments'], + 'operation': 'updateOrganizationSmSentryPoliciesAssignments' + } + organizationId = urllib.parse.quote(str(organizationId), safe='') + resource = f'/organizations/{organizationId}/sm/sentry/policies/assignments' + + body_params = ['items', ] + payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params} + + return self._session.put(metadata, resource, payload) + + + + def getOrganizationSmSentryPoliciesAssignmentsByNetwork(self, organizationId: str, total_pages=1, direction='next', **kwargs): + """ + **List the Sentry Policies for an organization ordered in ascending order of priority** + https://developer.cisco.com/meraki/api-v1/#!get-organization-sm-sentry-policies-assignments-by-network + + - 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 50. + - 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 Sentry Policies by Network Id + """ + + kwargs.update(locals()) + + metadata = { + 'tags': ['sm', 'configure', 'sentry', 'policies', 'assignments', 'byNetwork'], + 'operation': 'getOrganizationSmSentryPoliciesAssignmentsByNetwork' + } + organizationId = urllib.parse.quote(str(organizationId), safe='') + resource = f'/organizations/{organizationId}/sm/sentry/policies/assignments/byNetwork' + + query_params = ['perPage', 'startingAfter', 'endingBefore', 'networkIds', ] + params = {k.strip(): v for k, v in kwargs.items() if k.strip() in query_params} + + array_params = ['networkIds', ] + 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 getOrganizationSmVppAccounts(self, organizationId: str): """ **List the VPP accounts in the organization** diff --git a/meraki/api/wireless.py b/meraki/api/wireless.py index 0604109..ec34feb 100644 --- a/meraki/api/wireless.py +++ b/meraki/api/wireless.py @@ -2058,6 +2058,7 @@ def updateNetworkWirelessSsidSplashSettings(self, networkId: str, number: str, * - redirectUrl (string): The custom redirect URL where the users will go after the splash page. - useRedirectUrl (boolean): The Boolean indicating whether the the user will be redirected to the custom redirect URL after the splash page. A custom redirect URL must be set if this is true. - welcomeMessage (string): The welcome message for the users on the splash page. + - themeId (string): The id of the selected splash theme. - splashLogo (object): The logo used in the splash page. - splashImage (object): The image used in the splash page. - splashPrepaidFront (object): The prepaid front image used in the splash page. @@ -2083,7 +2084,7 @@ def updateNetworkWirelessSsidSplashSettings(self, networkId: str, number: str, * number = urllib.parse.quote(str(number), safe='') resource = f'/networks/{networkId}/wireless/ssids/{number}/splash/settings' - body_params = ['splashUrl', 'useSplashUrl', 'splashTimeout', 'redirectUrl', 'useRedirectUrl', 'welcomeMessage', 'splashLogo', 'splashImage', 'splashPrepaidFront', 'blockAllTrafficBeforeSignOn', 'controllerDisconnectionBehavior', 'allowSimultaneousLogins', 'guestSponsorship', 'billing', 'sentryEnrollment', ] + body_params = ['splashUrl', 'useSplashUrl', 'splashTimeout', 'redirectUrl', 'useRedirectUrl', 'welcomeMessage', 'themeId', 'splashLogo', 'splashImage', 'splashPrepaidFront', 'blockAllTrafficBeforeSignOn', 'controllerDisconnectionBehavior', 'allowSimultaneousLogins', 'guestSponsorship', 'billing', 'sentryEnrollment', ] payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params} return self._session.put(metadata, resource, payload)