From 2696790041afd70ab62d49dbd29d1b75a38724eb Mon Sep 17 00:00:00 2001 From: "John M. Kuchta" Date: Thu, 2 May 2024 13:35:33 -0700 Subject: [PATCH] Automatically regenerated library. (#255) Co-authored-by: GitHub Action --- meraki/__init__.py | 2 +- meraki/aio/api/appliance.py | 12 +- meraki/aio/api/devices.py | 2 +- meraki/aio/api/networks.py | 6 +- meraki/aio/api/organizations.py | 496 +++++++++++++++++++++++++++++- meraki/aio/api/switch.py | 6 +- meraki/aio/api/wireless.py | 232 ++++++++++++-- meraki/api/appliance.py | 12 +- meraki/api/batch/appliance.py | 12 +- meraki/api/batch/networks.py | 2 +- meraki/api/batch/organizations.py | 117 +++++++ meraki/api/batch/switch.py | 6 +- meraki/api/batch/wireless.py | 136 +++++++- meraki/api/devices.py | 2 +- meraki/api/networks.py | 6 +- meraki/api/organizations.py | 496 +++++++++++++++++++++++++++++- meraki/api/switch.py | 6 +- meraki/api/wireless.py | 232 ++++++++++++-- 18 files changed, 1701 insertions(+), 82 deletions(-) diff --git a/meraki/__init__.py b/meraki/__init__.py index 5b64dff..8c6ea07 100644 --- a/meraki/__init__.py +++ b/meraki/__init__.py @@ -43,7 +43,7 @@ ) from meraki.rest_session import * -__version__ = '1.45.0' +__version__ = '1.46.0' class DashboardAPI(object): diff --git a/meraki/aio/api/appliance.py b/meraki/aio/api/appliance.py index 5b1f44d..2f7b6dd 100644 --- a/meraki/aio/api/appliance.py +++ b/meraki/aio/api/appliance.py @@ -2021,7 +2021,11 @@ def createNetworkApplianceVlan(self, networkId: str, id: str, name: str, **kwarg - cidr (string): CIDR of the pool of subnets. Applicable only for template network. Each network bound to the template will automatically pick a subnet from this pool to build its own VLAN. - mask (integer): Mask used for the subnet of all bound to the template networks. Applicable only for template network. - ipv6 (object): IPv6 configuration on the VLAN + - dhcpHandling (string): The appliance's handling of DHCP requests on this VLAN. One of: 'Run a DHCP server', 'Relay DHCP to another server' or 'Do not respond to DHCP requests' + - dhcpLeaseTime (string): The term of DHCP leases if the appliance is running a DHCP server on this VLAN. One of: '30 minutes', '1 hour', '4 hours', '12 hours', '1 day' or '1 week' - mandatoryDhcp (object): Mandatory DHCP will enforce that clients connecting to this VLAN must use the IP address assigned by the DHCP server. Clients who use a static IP address won't be able to associate. Only available on firmware versions 17.0 and above + - dhcpBootOptionsEnabled (boolean): Use DHCP boot options specified in other properties + - dhcpOptions (array): The list of DHCP options that will be included in DHCP responses. Each object in the list should have "code", "type", and "value" properties. """ kwargs.update(locals()) @@ -2029,6 +2033,12 @@ def createNetworkApplianceVlan(self, networkId: str, id: str, name: str, **kwarg if 'templateVlanType' in kwargs: options = ['same', 'unique'] assert kwargs['templateVlanType'] in options, f'''"templateVlanType" cannot be "{kwargs['templateVlanType']}", & must be set to one of: {options}''' + if 'dhcpHandling' in kwargs: + options = ['Do not respond to DHCP requests', 'Relay DHCP to another server', 'Run a DHCP server'] + assert kwargs['dhcpHandling'] in options, f'''"dhcpHandling" cannot be "{kwargs['dhcpHandling']}", & must be set to one of: {options}''' + if 'dhcpLeaseTime' in kwargs: + options = ['1 day', '1 hour', '1 week', '12 hours', '30 minutes', '4 hours'] + assert kwargs['dhcpLeaseTime'] in options, f'''"dhcpLeaseTime" cannot be "{kwargs['dhcpLeaseTime']}", & must be set to one of: {options}''' metadata = { 'tags': ['appliance', 'configure', 'vlans'], @@ -2037,7 +2047,7 @@ def createNetworkApplianceVlan(self, networkId: str, id: str, name: str, **kwarg networkId = urllib.parse.quote(str(networkId), safe='') resource = f'/networks/{networkId}/appliance/vlans' - body_params = ['id', 'name', 'subnet', 'applianceIp', 'groupPolicyId', 'templateVlanType', 'cidr', 'mask', 'ipv6', 'mandatoryDhcp', ] + body_params = ['id', 'name', 'subnet', 'applianceIp', 'groupPolicyId', 'templateVlanType', 'cidr', 'mask', 'ipv6', 'dhcpHandling', 'dhcpLeaseTime', 'mandatoryDhcp', 'dhcpBootOptionsEnabled', 'dhcpOptions', ] payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params} return self._session.post(metadata, resource, payload) diff --git a/meraki/aio/api/devices.py b/meraki/aio/api/devices.py index 27e6506..2c0a458 100644 --- a/meraki/aio/api/devices.py +++ b/meraki/aio/api/devices.py @@ -206,7 +206,7 @@ def getDeviceLiveToolsArpTable(self, serial: str, arpTableId: str): def createDeviceLiveToolsCableTest(self, serial: str, ports: list, **kwargs): """ - **Enqueue a job to perform a cable test for the device on the specified ports.** + **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 diff --git a/meraki/aio/api/networks.py b/meraki/aio/api/networks.py index 1e6d949..96e6634 100644 --- a/meraki/aio/api/networks.py +++ b/meraki/aio/api/networks.py @@ -730,7 +730,7 @@ def getNetworkEvents(self, networkId: str, total_pages=1, direction='prev', even - total_pages (integer or string): use with perPage to get total results up to total_pages*perPage; -1 or "all" for all pages - direction (string): direction to paginate, either "next" or "prev" (default) page - event_log_end_time (string): ISO8601 Zulu/UTC time, to use in conjunction with startingAfter, to retrieve events within a time window - - productType (string): The product type to fetch events for. This parameter is required for networks with multiple device types. Valid types are wireless, appliance, switch, systemsManager, camera, and cellularGateway + - productType (string): The product type to fetch events for. This parameter is required for networks with multiple device types. Valid types are wireless, appliance, switch, systemsManager, camera, cellularGateway, and secureConnect - includedEventTypes (array): A list of event types. The returned events will be filtered to only include events with these types. - excludedEventTypes (array): A list of event types. The returned events will be filtered to exclude events with these types. - deviceMac (string): The MAC address of the Meraki device which the list of events will be filtered with @@ -749,7 +749,7 @@ def getNetworkEvents(self, networkId: str, total_pages=1, direction='prev', even kwargs.update(locals()) if 'productType' in kwargs: - options = ['appliance', 'camera', 'cellularGateway', 'switch', 'systemsManager', 'wireless'] + options = ['appliance', 'camera', 'cellularGateway', 'secureConnect', 'switch', 'systemsManager', 'wireless'] assert kwargs['productType'] in options, f'''"productType" cannot be "{kwargs['productType']}", & must be set to one of: {options}''' metadata = { @@ -852,7 +852,7 @@ def createNetworkFirmwareUpgradesRollback(self, networkId: str, reasons: list, * kwargs.update(locals()) if 'product' in kwargs: - options = ['appliance', 'camera', 'cellularGateway', 'switch', 'switchCatalyst', 'wireless'] + options = ['appliance', 'camera', 'cellularGateway', 'secureConnect', 'switch', 'switchCatalyst', 'wireless'] assert kwargs['product'] in options, f'''"product" cannot be "{kwargs['product']}", & must be set to one of: {options}''' metadata = { diff --git a/meraki/aio/api/organizations.py b/meraki/aio/api/organizations.py index e06d278..dc998c4 100644 --- a/meraki/aio/api/organizations.py +++ b/meraki/aio/api/organizations.py @@ -1030,6 +1030,325 @@ def getOrganizationApiRequestsOverviewResponseCodesByInterval(self, organization + def getOrganizationAssuranceAlerts(self, organizationId: str, total_pages=1, direction='next', **kwargs): + """ + **Return all health alerts for an organization** + https://developer.cisco.com/meraki/api-v1/#!get-organization-assurance-alerts + + - 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 4 - 300. Default is 30. + - 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 'ascending'. + - networkId (string): Optional parameter to filter alerts by network ids. + - severity (string): Optional parameter to filter by severity type. + - types (array): Optional parameter to filter by alert type. + - tsStart (string): Optional parameter to filter by starting timestamp + - tsEnd (string): Optional parameter to filter by end timestamp + - category (string): Optional parameter to filter by category. + - sortBy (string): Optional parameter to set column to sort by. + - serials (array): Optional parameter to filter by primary device serial + - deviceTypes (array): Optional parameter to filter by device types + - deviceTags (array): Optional parameter to filter by device tags + - active (boolean): Optional parameter to filter by active alerts defaults to true + - dismissed (boolean): Optional parameter to filter by dismissed alerts defaults to false + - resolved (boolean): Optional parameter to filter by resolved alerts defaults to false + - suppressAlertsForOfflineNodes (boolean): When set to true the api will only return connectivity alerts for a given device if that device is in an offline state. This only applies to devices. This is ignored when resolved is true. Example: If a Switch has a VLan Mismatch and is Unreachable. only the Unreachable alert will be returned. Defaults to false. + """ + + 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}''' + if 'category' in kwargs: + options = ['configuration', 'connectivity', 'device_health', 'insights'] + assert kwargs['category'] in options, f'''"category" cannot be "{kwargs['category']}", & must be set to one of: {options}''' + if 'sortBy' in kwargs: + options = ['category', 'dismissedAt', 'resolvedAt', 'severity', 'startedAt'] + assert kwargs['sortBy'] in options, f'''"sortBy" cannot be "{kwargs['sortBy']}", & must be set to one of: {options}''' + + metadata = { + 'tags': ['organizations', 'configure', 'alerts'], + 'operation': 'getOrganizationAssuranceAlerts' + } + organizationId = urllib.parse.quote(str(organizationId), safe='') + resource = f'/organizations/{organizationId}/assurance/alerts' + + query_params = ['perPage', 'startingAfter', 'endingBefore', 'sortOrder', 'networkId', 'severity', 'types', 'tsStart', 'tsEnd', 'category', 'sortBy', 'serials', 'deviceTypes', 'deviceTags', 'active', 'dismissed', 'resolved', 'suppressAlertsForOfflineNodes', ] + params = {k.strip(): v for k, v in kwargs.items() if k.strip() in query_params} + + array_params = ['types', 'serials', 'deviceTypes', 'deviceTags', ] + 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 dismissOrganizationAssuranceAlerts(self, organizationId: str, alertIds: list): + """ + **Dismiss health alerts** + https://developer.cisco.com/meraki/api-v1/#!dismiss-organization-assurance-alerts + + - organizationId (string): Organization ID + - alertIds (array): Parameter to dismiss alerts by ID + """ + + kwargs = locals() + + metadata = { + 'tags': ['organizations', 'configure', 'alerts'], + 'operation': 'dismissOrganizationAssuranceAlerts' + } + organizationId = urllib.parse.quote(str(organizationId), safe='') + resource = f'/organizations/{organizationId}/assurance/alerts/dismiss' + + body_params = ['alertIds', ] + payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params} + + return self._session.post(metadata, resource, payload) + + + + def getOrganizationAssuranceAlertsOverview(self, organizationId: str, **kwargs): + """ + **Return overview of active health alerts for an organization** + https://developer.cisco.com/meraki/api-v1/#!get-organization-assurance-alerts-overview + + - organizationId (string): Organization ID + - networkId (string): Optional parameter to filter alerts overview by network ids. + - severity (string): Optional parameter to filter alerts overview by severity type. + - types (array): Optional parameter to filter by alert type. + - tsStart (string): Optional parameter to filter by starting timestamp + - tsEnd (string): Optional parameter to filter by end timestamp + - serials (array): Optional parameter to filter by primary device serial + - deviceTypes (array): Optional parameter to filter by device types + - deviceTags (array): Optional parameter to filter by device tags + - active (boolean): Optional parameter to filter by active alerts defaults to true + - dismissed (boolean): Optional parameter to filter by dismissed alerts defaults to false + - resolved (boolean): Optional parameter to filter by resolved alerts defaults to false + - suppressAlertsForOfflineNodes (boolean): When set to true the api will only return connectivity alerts for a given device if that device is in an offline state. This only applies to devices. This is ignored when resolved is true. Example: If a Switch has a VLan Mismatch and is Unreachable. only the Unreachable alert will be returned. Defaults to false. + """ + + kwargs.update(locals()) + + metadata = { + 'tags': ['organizations', 'configure', 'alerts', 'overview'], + 'operation': 'getOrganizationAssuranceAlertsOverview' + } + organizationId = urllib.parse.quote(str(organizationId), safe='') + resource = f'/organizations/{organizationId}/assurance/alerts/overview' + + query_params = ['networkId', 'severity', 'types', 'tsStart', 'tsEnd', 'serials', 'deviceTypes', 'deviceTags', 'active', 'dismissed', 'resolved', 'suppressAlertsForOfflineNodes', ] + params = {k.strip(): v for k, v in kwargs.items() if k.strip() in query_params} + + array_params = ['types', 'serials', 'deviceTypes', 'deviceTags', ] + 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 getOrganizationAssuranceAlertsOverviewByNetwork(self, organizationId: str, total_pages=1, direction='next', **kwargs): + """ + **Return a Summary of Alerts grouped by network and severity** + https://developer.cisco.com/meraki/api-v1/#!get-organization-assurance-alerts-overview-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 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. + - sortOrder (string): Sorted order of entries. Order options are 'ascending' and 'descending'. Default is 'ascending'. + - networkId (string): Optional parameter to filter alerts overview by network id. + - severity (string): Optional parameter to filter alerts overview by severity type. + - types (array): Optional parameter to filter by alert type. + - tsStart (string): Optional parameter to filter by starting timestamp + - tsEnd (string): Optional parameter to filter by end timestamp + - serials (array): Optional parameter to filter by primary device serial + - deviceTypes (array): Optional parameter to filter by device types + - deviceTags (array): Optional parameter to filter by device tags + - active (boolean): Optional parameter to filter by active alerts defaults to true + - dismissed (boolean): Optional parameter to filter by dismissed alerts defaults to false + - resolved (boolean): Optional parameter to filter by resolved alerts defaults to false + - suppressAlertsForOfflineNodes (boolean): When set to true the api will only return connectivity alerts for a given device if that device is in an offline state. This only applies to devices. This is ignored when resolved is true. Example: If a Switch has a VLan Mismatch and is Unreachable. only the Unreachable alert will be returned. Defaults to false. + """ + + 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': ['organizations', 'configure', 'alerts', 'overview', 'byNetwork'], + 'operation': 'getOrganizationAssuranceAlertsOverviewByNetwork' + } + organizationId = urllib.parse.quote(str(organizationId), safe='') + resource = f'/organizations/{organizationId}/assurance/alerts/overview/byNetwork' + + query_params = ['perPage', 'startingAfter', 'endingBefore', 'sortOrder', 'networkId', 'severity', 'types', 'tsStart', 'tsEnd', 'serials', 'deviceTypes', 'deviceTags', 'active', 'dismissed', 'resolved', 'suppressAlertsForOfflineNodes', ] + params = {k.strip(): v for k, v in kwargs.items() if k.strip() in query_params} + + array_params = ['types', 'serials', 'deviceTypes', 'deviceTags', ] + 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 getOrganizationAssuranceAlertsOverviewByType(self, organizationId: str, total_pages=1, direction='next', **kwargs): + """ + **Return a Summary of Alerts grouped by type and severity** + https://developer.cisco.com/meraki/api-v1/#!get-organization-assurance-alerts-overview-by-type + + - 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. + - sortOrder (string): Sorted order of entries. Order options are 'ascending' and 'descending'. Default is 'ascending'. + - networkId (string): Optional parameter to filter alerts overview by network ids. + - severity (string): Optional parameter to filter alerts overview by severity type. + - types (array): Optional parameter to filter by alert type. + - tsStart (string): Optional parameter to filter by starting timestamp + - tsEnd (string): Optional parameter to filter by end timestamp + - sortBy (string): Optional parameter to set column to sort by. + - serials (array): Optional parameter to filter by primary device serial + - deviceTypes (array): Optional parameter to filter by device types + - deviceTags (array): Optional parameter to filter by device tags + - active (boolean): Optional parameter to filter by active alerts defaults to true + - dismissed (boolean): Optional parameter to filter by dismissed alerts defaults to false + - resolved (boolean): Optional parameter to filter by resolved alerts defaults to false + - suppressAlertsForOfflineNodes (boolean): When set to true the api will only return connectivity alerts for a given device if that device is in an offline state. This only applies to devices. This is ignored when resolved is true. Example: If a Switch has a VLan Mismatch and is Unreachable. only the Unreachable alert will be returned. Defaults to false. + """ + + 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}''' + if 'sortBy' in kwargs: + options = ['count', 'lastAlertedAt', 'networkCount', 'severity', 'startedAt'] + assert kwargs['sortBy'] in options, f'''"sortBy" cannot be "{kwargs['sortBy']}", & must be set to one of: {options}''' + + metadata = { + 'tags': ['organizations', 'configure', 'alerts', 'overview', 'byType'], + 'operation': 'getOrganizationAssuranceAlertsOverviewByType' + } + organizationId = urllib.parse.quote(str(organizationId), safe='') + resource = f'/organizations/{organizationId}/assurance/alerts/overview/byType' + + query_params = ['perPage', 'startingAfter', 'endingBefore', 'sortOrder', 'networkId', 'severity', 'types', 'tsStart', 'tsEnd', 'sortBy', 'serials', 'deviceTypes', 'deviceTags', 'active', 'dismissed', 'resolved', 'suppressAlertsForOfflineNodes', ] + params = {k.strip(): v for k, v in kwargs.items() if k.strip() in query_params} + + array_params = ['types', 'serials', 'deviceTypes', 'deviceTags', ] + 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 getOrganizationAssuranceAlertsOverviewHistorical(self, organizationId: str, segmentDuration: int, tsStart: str, **kwargs): + """ + **Returns historical health alert overviews** + https://developer.cisco.com/meraki/api-v1/#!get-organization-assurance-alerts-overview-historical + + - organizationId (string): Organization ID + - segmentDuration (integer): Amount of time in seconds for each segment in the returned dataset + - tsStart (string): Parameter to define starting timestamp of historical totals + - networkId (string): Optional parameter to filter alerts overview by network ids. + - severity (string): Optional parameter to filter alerts overview by severity type. + - types (array): Optional parameter to filter by alert type. + - tsEnd (string): Optional parameter to filter by end timestamp defaults to the current time + - serials (array): Optional parameter to filter by primary device serial + - deviceTypes (array): Optional parameter to filter by device types + """ + + kwargs.update(locals()) + + metadata = { + 'tags': ['organizations', 'configure', 'alerts', 'overview', 'historical'], + 'operation': 'getOrganizationAssuranceAlertsOverviewHistorical' + } + organizationId = urllib.parse.quote(str(organizationId), safe='') + resource = f'/organizations/{organizationId}/assurance/alerts/overview/historical' + + query_params = ['segmentDuration', 'networkId', 'severity', 'types', 'tsStart', 'tsEnd', 'serials', 'deviceTypes', ] + params = {k.strip(): v for k, v in kwargs.items() if k.strip() in query_params} + + array_params = ['types', 'serials', 'deviceTypes', ] + 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 restoreOrganizationAssuranceAlerts(self, organizationId: str, alertIds: list): + """ + **Restore health alerts from dismissed** + https://developer.cisco.com/meraki/api-v1/#!restore-organization-assurance-alerts + + - organizationId (string): Organization ID + - alertIds (array): Parameter to restore alerts by ID + """ + + kwargs = locals() + + metadata = { + 'tags': ['organizations', 'configure', 'alerts'], + 'operation': 'restoreOrganizationAssuranceAlerts' + } + organizationId = urllib.parse.quote(str(organizationId), safe='') + resource = f'/organizations/{organizationId}/assurance/alerts/restore' + + body_params = ['alertIds', ] + payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params} + + return self._session.post(metadata, resource, payload) + + + + def getOrganizationAssuranceAlert(self, organizationId: str, id: str): + """ + **Return a singular Health Alert by its id** + https://developer.cisco.com/meraki/api-v1/#!get-organization-assurance-alert + + - organizationId (string): Organization ID + - id (string): ID + """ + + metadata = { + 'tags': ['organizations', 'configure', 'alerts'], + 'operation': 'getOrganizationAssuranceAlert' + } + organizationId = urllib.parse.quote(str(organizationId), safe='') + id = urllib.parse.quote(str(id), safe='') + resource = f'/organizations/{organizationId}/assurance/alerts/{id}' + + return self._session.get(metadata, resource) + + + def getOrganizationBrandingPolicies(self, organizationId: str): """ **List the branding policies of an organization** @@ -1503,7 +1822,7 @@ def getOrganizationDevices(self, organizationId: str, total_pages=1, direction=' - endingBefore (string): A token used by the server to indicate the end of the page. Often this is a timestamp or an ID but it is not limited to those. This parameter should not be defined by client applications. The link for the first, last, prev, or next page in the HTTP Link header should define it. - configurationUpdatedAfter (string): Filter results by whether or not the device's configuration has been updated after the given timestamp - networkIds (array): Optional parameter to filter devices by network. - - productTypes (array): Optional parameter to filter devices by product type. Valid types are wireless, appliance, switch, systemsManager, camera, cellularGateway, and sensor. + - productTypes (array): Optional parameter to filter devices by product type. Valid types are wireless, appliance, switch, systemsManager, camera, cellularGateway, sensor, and secureConnect. - tags (array): Optional parameter to filter devices by tags. - tagsFilterType (string): Optional parameter of value 'withAnyTags' or 'withAllTags' to indicate whether to return networks which contain ANY or ALL of the included tags. If no type is included, 'withAnyTags' will be selected. - name (string): Optional parameter to filter devices by name. All returned devices will have a name that contains the search term or is an exact match. @@ -1629,6 +1948,39 @@ def getOrganizationDevicesAvailabilitiesChangeHistory(self, organizationId: str, + def getOrganizationDevicesOverviewByModel(self, organizationId: str, **kwargs): + """ + **Lists the count for each device model** + https://developer.cisco.com/meraki/api-v1/#!get-organization-devices-overview-by-model + + - organizationId (string): Organization ID + - models (array): Optional parameter to filter devices by one or more models. All returned devices will have a model that is an exact match. + - networkIds (array): Optional parameter to filter devices by networkId. + - productTypes (array): Optional parameter to filter device by device product types. This filter uses multiple exact matches. + """ + + kwargs.update(locals()) + + metadata = { + 'tags': ['organizations', 'configure', 'devices', 'overview', 'byModel'], + 'operation': 'getOrganizationDevicesOverviewByModel' + } + organizationId = urllib.parse.quote(str(organizationId), safe='') + resource = f'/organizations/{organizationId}/devices/overview/byModel' + + query_params = ['models', 'networkIds', 'productTypes', ] + params = {k.strip(): v for k, v in kwargs.items() if k.strip() in query_params} + + array_params = ['models', 'networkIds', 'productTypes', ] + 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 getOrganizationDevicesPowerModulesStatusesByDevice(self, organizationId: str, total_pages=1, direction='next', **kwargs): """ **List the most recent status information for power modules in rackmount MX and MS devices that support them** @@ -1735,7 +2087,7 @@ def getOrganizationDevicesStatuses(self, organizationId: str, total_pages=1, dir - networkIds (array): Optional parameter to filter devices by network ids. - serials (array): Optional parameter to filter devices by serials. - statuses (array): Optional parameter to filter devices by statuses. Valid statuses are ["online", "alerting", "offline", "dormant"]. - - productTypes (array): An optional parameter to filter device statuses by product type. Valid types are wireless, appliance, switch, systemsManager, camera, cellularGateway, and sensor. + - productTypes (array): An optional parameter to filter device statuses by product type. Valid types are wireless, appliance, switch, systemsManager, camera, cellularGateway, sensor, and secureConnect. - models (array): Optional parameter to filter devices by models. - tags (array): An optional parameter to filter devices by tags. The filtering is case-sensitive. If tags are included, 'tagsFilterType' should also be included (see below). - tagsFilterType (string): An optional parameter of value 'withAnyTags' or 'withAllTags' to indicate whether to return devices which contain ANY or ALL of the included tags. If no type is included, 'withAnyTags' will be selected. @@ -1773,7 +2125,7 @@ def getOrganizationDevicesStatusesOverview(self, organizationId: str, **kwargs): https://developer.cisco.com/meraki/api-v1/#!get-organization-devices-statuses-overview - organizationId (string): Organization ID - - productTypes (array): An optional parameter to filter device statuses by product type. Valid types are wireless, appliance, switch, systemsManager, camera, cellularGateway, and sensor. + - productTypes (array): An optional parameter to filter device statuses by product type. Valid types are wireless, appliance, switch, systemsManager, camera, cellularGateway, sensor, and secureConnect. - networkIds (array): An optional parameter to filter device statuses by network. """ @@ -2133,7 +2485,7 @@ def getOrganizationInventoryDevices(self, organizationId: str, total_pages=1, di - orderNumbers (array): Search for devices in inventory based on order numbers. - tags (array): Filter devices by tags. The filtering is case-sensitive. If tags are included, 'tagsFilterType' should also be included (see below). - tagsFilterType (string): To use with 'tags' parameter, to filter devices which contain ANY or ALL given tags. Accepted values are 'withAnyTags' or 'withAllTags', default is 'withAnyTags'. - - productTypes (array): Filter devices by product type. Accepted values are appliance, camera, cellularGateway, sensor, switch, systemsManager, and wireless. + - productTypes (array): Filter devices by product type. Accepted values are appliance, camera, cellularGateway, secureConnect, sensor, switch, systemsManager, and wireless. """ kwargs.update(locals()) @@ -3399,6 +3751,142 @@ def updateOrganizationSnmp(self, organizationId: str, **kwargs): + def getOrganizationSplashAsset(self, organizationId: str, id: str): + """ + **Get a Splash Theme Asset** + https://developer.cisco.com/meraki/api-v1/#!get-organization-splash-asset + + - organizationId (string): Organization ID + - id (string): ID + """ + + metadata = { + 'tags': ['organizations', 'configure', 'splash', 'assets'], + 'operation': 'getOrganizationSplashAsset' + } + organizationId = urllib.parse.quote(str(organizationId), safe='') + id = urllib.parse.quote(str(id), safe='') + resource = f'/organizations/{organizationId}/splash/assets/{id}' + + return self._session.get(metadata, resource) + + + + def deleteOrganizationSplashAsset(self, organizationId: str, id: str): + """ + **Delete a Splash Theme Asset** + https://developer.cisco.com/meraki/api-v1/#!delete-organization-splash-asset + + - organizationId (string): Organization ID + - id (string): ID + """ + + metadata = { + 'tags': ['organizations', 'configure', 'splash', 'assets'], + 'operation': 'deleteOrganizationSplashAsset' + } + organizationId = urllib.parse.quote(str(organizationId), safe='') + id = urllib.parse.quote(str(id), safe='') + resource = f'/organizations/{organizationId}/splash/assets/{id}' + + return self._session.delete(metadata, resource) + + + + def getOrganizationSplashThemes(self, organizationId: str): + """ + **List Splash Themes** + https://developer.cisco.com/meraki/api-v1/#!get-organization-splash-themes + + - organizationId (string): Organization ID + """ + + metadata = { + 'tags': ['organizations', 'configure', 'splash', 'themes'], + 'operation': 'getOrganizationSplashThemes' + } + organizationId = urllib.parse.quote(str(organizationId), safe='') + resource = f'/organizations/{organizationId}/splash/themes' + + return self._session.get(metadata, resource) + + + + def createOrganizationSplashTheme(self, organizationId: str, **kwargs): + """ + **Create a Splash Theme** + https://developer.cisco.com/meraki/api-v1/#!create-organization-splash-theme + + - organizationId (string): Organization ID + - name (string): theme name + - baseTheme (string): base theme id + """ + + kwargs.update(locals()) + + metadata = { + 'tags': ['organizations', 'configure', 'splash', 'themes'], + 'operation': 'createOrganizationSplashTheme' + } + organizationId = urllib.parse.quote(str(organizationId), safe='') + resource = f'/organizations/{organizationId}/splash/themes' + + body_params = ['name', 'baseTheme', ] + payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params} + + return self._session.post(metadata, resource, payload) + + + + def deleteOrganizationSplashTheme(self, organizationId: str, id: str): + """ + **Delete a Splash Theme** + https://developer.cisco.com/meraki/api-v1/#!delete-organization-splash-theme + + - organizationId (string): Organization ID + - id (string): ID + """ + + metadata = { + 'tags': ['organizations', 'configure', 'splash', 'themes'], + 'operation': 'deleteOrganizationSplashTheme' + } + organizationId = urllib.parse.quote(str(organizationId), safe='') + id = urllib.parse.quote(str(id), safe='') + resource = f'/organizations/{organizationId}/splash/themes/{id}' + + return self._session.delete(metadata, resource) + + + + def createOrganizationSplashThemeAsset(self, organizationId: str, themeIdentifier: str, **kwargs): + """ + **Create a Splash Theme Asset** + https://developer.cisco.com/meraki/api-v1/#!create-organization-splash-theme-asset + + - organizationId (string): Organization ID + - themeIdentifier (string): Theme identifier + - name (string): File name. Will overwrite files with same name. + - content (string): a file containing the asset content + """ + + kwargs.update(locals()) + + metadata = { + 'tags': ['organizations', 'configure', 'splash', 'themes', 'assets'], + 'operation': 'createOrganizationSplashThemeAsset' + } + organizationId = urllib.parse.quote(str(organizationId), safe='') + themeIdentifier = urllib.parse.quote(str(themeIdentifier), safe='') + resource = f'/organizations/{organizationId}/splash/themes/{themeIdentifier}/assets' + + body_params = ['name', 'content', ] + payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params} + + return self._session.post(metadata, resource, payload) + + + def getOrganizationSummaryTopAppliancesByUtilization(self, organizationId: str, **kwargs): """ **Return the top 10 appliances sorted by utilization over given time range.** diff --git a/meraki/aio/api/switch.py b/meraki/aio/api/switch.py index 991bb8e..a714cec 100644 --- a/meraki/aio/api/switch.py +++ b/meraki/aio/api/switch.py @@ -221,7 +221,6 @@ def createDeviceSwitchRoutingInterface(self, serial: str, **kwargs): - vlanId (integer): The VLAN this routed interface is on. VLAN must be between 1 and 4094. - defaultGateway (string): The next hop for any traffic that isn't going to a directly connected subnet or over a static route. This IP address must exist in a subnet with a routed interface. Required if this is the first IPv4 interface. - ospfSettings (object): The OSPF routing settings of the interface. - - ospfV3 (object): The OSPFv3 routing settings of the interface. - ipv6 (object): The IPv6 settings of the interface. """ @@ -238,7 +237,7 @@ def createDeviceSwitchRoutingInterface(self, serial: str, **kwargs): serial = urllib.parse.quote(str(serial), safe='') resource = f'/devices/{serial}/switch/routing/interfaces' - body_params = ['name', 'subnet', 'interfaceIp', 'multicastRouting', 'vlanId', 'defaultGateway', 'ospfSettings', 'ospfV3', 'ipv6', ] + body_params = ['name', 'subnet', 'interfaceIp', 'multicastRouting', 'vlanId', 'defaultGateway', 'ospfSettings', 'ipv6', ] payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params} return self._session.post(metadata, resource, payload) @@ -280,7 +279,6 @@ def updateDeviceSwitchRoutingInterface(self, serial: str, interfaceId: str, **kw - vlanId (integer): The VLAN this routed interface is on. VLAN must be between 1 and 4094. - defaultGateway (string): The next hop for any traffic that isn't going to a directly connected subnet or over a static route. This IP address must exist in a subnet with a routed interface. Required if this is the first IPv4 interface. - ospfSettings (object): The OSPF routing settings of the interface. - - ospfV3 (object): The OSPFv3 routing settings of the interface. - ipv6 (object): The IPv6 settings of the interface. """ @@ -298,7 +296,7 @@ def updateDeviceSwitchRoutingInterface(self, serial: str, interfaceId: str, **kw interfaceId = urllib.parse.quote(str(interfaceId), safe='') resource = f'/devices/{serial}/switch/routing/interfaces/{interfaceId}' - body_params = ['name', 'subnet', 'interfaceIp', 'multicastRouting', 'vlanId', 'defaultGateway', 'ospfSettings', 'ospfV3', 'ipv6', ] + body_params = ['name', 'subnet', 'interfaceIp', 'multicastRouting', 'vlanId', 'defaultGateway', 'ospfSettings', 'ipv6', ] 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/aio/api/wireless.py b/meraki/aio/api/wireless.py index 37df2d4..b58d954 100644 --- a/meraki/aio/api/wireless.py +++ b/meraki/aio/api/wireless.py @@ -241,6 +241,118 @@ def getNetworkWirelessAirMarshal(self, networkId: str, **kwargs): + def createNetworkWirelessAirMarshalRule(self, networkId: str, type: str, match: dict): + """ + **Creates a new rule** + https://developer.cisco.com/meraki/api-v1/#!create-network-wireless-air-marshal-rule + + - networkId (string): Network ID + - type (string): Indicates if this rule will allow, block, or alert. + - match (object): Object describing the rule specification. + """ + + kwargs = locals() + + if 'type' in kwargs: + options = ['alert', 'allow', 'block'] + assert kwargs['type'] in options, f'''"type" cannot be "{kwargs['type']}", & must be set to one of: {options}''' + + metadata = { + 'tags': ['wireless', 'configure', 'airMarshal', 'rules'], + 'operation': 'createNetworkWirelessAirMarshalRule' + } + networkId = urllib.parse.quote(str(networkId), safe='') + resource = f'/networks/{networkId}/wireless/airMarshal/rules' + + body_params = ['type', 'match', ] + payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params} + + return self._session.post(metadata, resource, payload) + + + + def updateNetworkWirelessAirMarshalRule(self, networkId: str, ruleId: str, **kwargs): + """ + **Update a rule** + https://developer.cisco.com/meraki/api-v1/#!update-network-wireless-air-marshal-rule + + - networkId (string): Network ID + - ruleId (string): Rule ID + - type (string): Indicates if this rule will allow, block, or alert. + - match (object): Object describing the rule specification. + """ + + kwargs.update(locals()) + + if 'type' in kwargs: + options = ['alert', 'allow', 'block'] + assert kwargs['type'] in options, f'''"type" cannot be "{kwargs['type']}", & must be set to one of: {options}''' + + metadata = { + 'tags': ['wireless', 'configure', 'airMarshal', 'rules'], + 'operation': 'updateNetworkWirelessAirMarshalRule' + } + networkId = urllib.parse.quote(str(networkId), safe='') + ruleId = urllib.parse.quote(str(ruleId), safe='') + resource = f'/networks/{networkId}/wireless/airMarshal/rules/{ruleId}' + + body_params = ['type', 'match', ] + payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params} + + return self._session.put(metadata, resource, payload) + + + + def deleteNetworkWirelessAirMarshalRule(self, networkId: str, ruleId: str): + """ + **Delete an Air Marshal rule.** + https://developer.cisco.com/meraki/api-v1/#!delete-network-wireless-air-marshal-rule + + - networkId (string): Network ID + - ruleId (string): Rule ID + """ + + metadata = { + 'tags': ['wireless', 'configure', 'airMarshal', 'rules'], + 'operation': 'deleteNetworkWirelessAirMarshalRule' + } + networkId = urllib.parse.quote(str(networkId), safe='') + ruleId = urllib.parse.quote(str(ruleId), safe='') + resource = f'/networks/{networkId}/wireless/airMarshal/rules/{ruleId}' + + return self._session.delete(metadata, resource) + + + + def updateNetworkWirelessAirMarshalSettings(self, networkId: str, defaultPolicy: str): + """ + **Updates Air Marshal settings.** + https://developer.cisco.com/meraki/api-v1/#!update-network-wireless-air-marshal-settings + + - networkId (string): Network ID + - defaultPolicy (string): Allows clients to access rogue networks. Blocked by default. + """ + + kwargs = locals() + + if 'defaultPolicy' in kwargs: + options = ['allow', 'block'] + assert kwargs['defaultPolicy'] in options, f'''"defaultPolicy" cannot be "{kwargs['defaultPolicy']}", & must be set to one of: {options}''' + + metadata = { + 'tags': ['wireless', 'configure', 'airMarshal', 'settings'], + 'operation': 'updateNetworkWirelessAirMarshalSettings' + } + networkId = urllib.parse.quote(str(networkId), safe='') + resource = f'/networks/{networkId}/wireless/airMarshal/settings' + + body_params = ['defaultPolicy', ] + payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params} + + return self._session.put(metadata, resource, payload) + + + def getNetworkWirelessAlternateManagementInterface(self, networkId: str): """ **Return alternate management interface and devices with IP assigned** @@ -1506,7 +1618,7 @@ def updateNetworkWirelessSsid(self, networkId: str, number: str, **kwargs): options = ['access disabled', 'access enabled'] assert kwargs['enterpriseAdminAccess'] in options, f'''"enterpriseAdminAccess" cannot be "{kwargs['enterpriseAdminAccess']}", & must be set to one of: {options}''' if 'encryptionMode' in kwargs: - options = ['wep', 'wpa'] + options = ['open', 'wep', 'wpa', 'wpa-eap'] assert kwargs['encryptionMode'] in options, f'''"encryptionMode" cannot be "{kwargs['encryptionMode']}", & must be set to one of: {options}''' if 'wpaEncryptionMode' in kwargs: options = ['WPA1 and WPA2', 'WPA1 only', 'WPA2 only', 'WPA3 192-bit Security', 'WPA3 Transition Mode', 'WPA3 only'] @@ -1786,6 +1898,27 @@ def updateNetworkWirelessSsidFirewallL7FirewallRules(self, networkId: str, numbe + def getNetworkWirelessSsidHotspot20(self, networkId: str, number: str): + """ + **Return the Hotspot 2.0 settings for an SSID** + https://developer.cisco.com/meraki/api-v1/#!get-network-wireless-ssid-hotspot-2-0 + + - networkId (string): Network ID + - number (string): Number + """ + + metadata = { + 'tags': ['wireless', 'configure', 'ssids', 'hotspot20'], + 'operation': 'getNetworkWirelessSsidHotspot20' + } + networkId = urllib.parse.quote(str(networkId), safe='') + number = urllib.parse.quote(str(number), safe='') + resource = f'/networks/{networkId}/wireless/ssids/{number}/hotspot20' + + return self._session.get(metadata, resource) + + + def updateNetworkWirelessSsidHotspot20(self, networkId: str, number: str, **kwargs): """ **Update the Hotspot 2.0 settings of an SSID** @@ -1824,27 +1957,6 @@ def updateNetworkWirelessSsidHotspot20(self, networkId: str, number: str, **kwar - def getNetworkWirelessSsidHotspot20(self, networkId: str, number: str): - """ - **Return the Hotspot 2.0 settings for an SSID** - https://developer.cisco.com/meraki/api-v1/#!get-network-wireless-ssid-hotspot-2-0 - - - networkId (string): Network ID - - number (string): Number - """ - - metadata = { - 'tags': ['wireless', 'configure', 'ssids', 'hotspot20'], - 'operation': 'getNetworkWirelessSsidHotspot20' - } - networkId = urllib.parse.quote(str(networkId), safe='') - number = urllib.parse.quote(str(number), safe='') - resource = f'/networks/{networkId}/wireless/ssids/{number}/hotspot20' - - return self._session.get(metadata, resource) - - - def getNetworkWirelessSsidIdentityPsks(self, networkId: str, number: str): """ **List all Identity PSKs in a wireless network** @@ -2232,6 +2344,78 @@ def getNetworkWirelessUsageHistory(self, networkId: str, **kwargs): + def getOrganizationWirelessAirMarshalRules(self, organizationId: str, total_pages=1, direction='next', **kwargs): + """ + **Returns the current Air Marshal rules for this organization** + https://developer.cisco.com/meraki/api-v1/#!get-organization-wireless-air-marshal-rules + + - 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) The set of network IDs to include. + - perPage (integer): The number of entries per page returned. Acceptable range is 3 - 1000. Default is 1000. + - startingAfter (string): A token used by the server to indicate the start of the page. Often this is a timestamp or an ID but it is not limited to those. This parameter should not be defined by client applications. The link for the first, last, prev, or next page in the HTTP Link header should define it. + - endingBefore (string): A token used by the server to indicate the end of the page. Often this is a timestamp or an ID but it is not limited to those. This parameter should not be defined by client applications. The link for the first, last, prev, or next page in the HTTP Link header should define it. + """ + + kwargs.update(locals()) + + metadata = { + 'tags': ['wireless', 'configure', 'airMarshal', 'rules'], + 'operation': 'getOrganizationWirelessAirMarshalRules' + } + organizationId = urllib.parse.quote(str(organizationId), safe='') + resource = f'/organizations/{organizationId}/wireless/airMarshal/rules' + + query_params = ['networkIds', 'perPage', 'startingAfter', 'endingBefore', ] + 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 getOrganizationWirelessAirMarshalSettingsByNetwork(self, organizationId: str, total_pages=1, direction='next', **kwargs): + """ + **Returns the current Air Marshal settings for this network** + https://developer.cisco.com/meraki/api-v1/#!get-organization-wireless-air-marshal-settings-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 + - networkIds (array): The network IDs to include in the result set. + - perPage (integer): The number of entries per page returned. Acceptable range is 3 - 1000. Default is 1000. + - startingAfter (string): A token used by the server to indicate the start of the page. Often this is a timestamp or an ID but it is not limited to those. This parameter should not be defined by client applications. The link for the first, last, prev, or next page in the HTTP Link header should define it. + - endingBefore (string): A token used by the server to indicate the end of the page. Often this is a timestamp or an ID but it is not limited to those. This parameter should not be defined by client applications. The link for the first, last, prev, or next page in the HTTP Link header should define it. + """ + + kwargs.update(locals()) + + metadata = { + 'tags': ['wireless', 'configure', 'airMarshal', 'settings', 'byNetwork'], + 'operation': 'getOrganizationWirelessAirMarshalSettingsByNetwork' + } + organizationId = urllib.parse.quote(str(organizationId), safe='') + resource = f'/organizations/{organizationId}/wireless/airMarshal/settings/byNetwork' + + query_params = ['networkIds', 'perPage', 'startingAfter', 'endingBefore', ] + 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 getOrganizationWirelessDevicesChannelUtilizationByDevice(self, organizationId: str, total_pages=1, direction='next', **kwargs): """ **Get average channel utilization for all bands in a network, split by AP** @@ -2570,7 +2754,7 @@ def getOrganizationWirelessRfProfilesAssignmentsByDevice(self, organizationId: s - 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. + - productTypes (array): Optional parameter to filter devices by product type. Valid types are wireless, appliance, switch, systemsManager, camera, cellularGateway, sensor, and secureConnect. - 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. @@ -2613,7 +2797,7 @@ def getOrganizationWirelessSsidsStatusesByDevice(self, organizationId: str, tota - 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) + - hideDisabled (boolean): If true, the returned devices will not include disabled SSIDs. (default: true) - 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. diff --git a/meraki/api/appliance.py b/meraki/api/appliance.py index 708e290..1e57fb4 100644 --- a/meraki/api/appliance.py +++ b/meraki/api/appliance.py @@ -2021,7 +2021,11 @@ def createNetworkApplianceVlan(self, networkId: str, id: str, name: str, **kwarg - cidr (string): CIDR of the pool of subnets. Applicable only for template network. Each network bound to the template will automatically pick a subnet from this pool to build its own VLAN. - mask (integer): Mask used for the subnet of all bound to the template networks. Applicable only for template network. - ipv6 (object): IPv6 configuration on the VLAN + - dhcpHandling (string): The appliance's handling of DHCP requests on this VLAN. One of: 'Run a DHCP server', 'Relay DHCP to another server' or 'Do not respond to DHCP requests' + - dhcpLeaseTime (string): The term of DHCP leases if the appliance is running a DHCP server on this VLAN. One of: '30 minutes', '1 hour', '4 hours', '12 hours', '1 day' or '1 week' - mandatoryDhcp (object): Mandatory DHCP will enforce that clients connecting to this VLAN must use the IP address assigned by the DHCP server. Clients who use a static IP address won't be able to associate. Only available on firmware versions 17.0 and above + - dhcpBootOptionsEnabled (boolean): Use DHCP boot options specified in other properties + - dhcpOptions (array): The list of DHCP options that will be included in DHCP responses. Each object in the list should have "code", "type", and "value" properties. """ kwargs.update(locals()) @@ -2029,6 +2033,12 @@ def createNetworkApplianceVlan(self, networkId: str, id: str, name: str, **kwarg if 'templateVlanType' in kwargs: options = ['same', 'unique'] assert kwargs['templateVlanType'] in options, f'''"templateVlanType" cannot be "{kwargs['templateVlanType']}", & must be set to one of: {options}''' + if 'dhcpHandling' in kwargs: + options = ['Do not respond to DHCP requests', 'Relay DHCP to another server', 'Run a DHCP server'] + assert kwargs['dhcpHandling'] in options, f'''"dhcpHandling" cannot be "{kwargs['dhcpHandling']}", & must be set to one of: {options}''' + if 'dhcpLeaseTime' in kwargs: + options = ['1 day', '1 hour', '1 week', '12 hours', '30 minutes', '4 hours'] + assert kwargs['dhcpLeaseTime'] in options, f'''"dhcpLeaseTime" cannot be "{kwargs['dhcpLeaseTime']}", & must be set to one of: {options}''' metadata = { 'tags': ['appliance', 'configure', 'vlans'], @@ -2037,7 +2047,7 @@ def createNetworkApplianceVlan(self, networkId: str, id: str, name: str, **kwarg networkId = urllib.parse.quote(str(networkId), safe='') resource = f'/networks/{networkId}/appliance/vlans' - body_params = ['id', 'name', 'subnet', 'applianceIp', 'groupPolicyId', 'templateVlanType', 'cidr', 'mask', 'ipv6', 'mandatoryDhcp', ] + body_params = ['id', 'name', 'subnet', 'applianceIp', 'groupPolicyId', 'templateVlanType', 'cidr', 'mask', 'ipv6', 'dhcpHandling', 'dhcpLeaseTime', 'mandatoryDhcp', 'dhcpBootOptionsEnabled', 'dhcpOptions', ] payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params} return self._session.post(metadata, resource, payload) diff --git a/meraki/api/batch/appliance.py b/meraki/api/batch/appliance.py index 1454dba..d3fd2e0 100644 --- a/meraki/api/batch/appliance.py +++ b/meraki/api/batch/appliance.py @@ -788,7 +788,11 @@ def createNetworkApplianceVlan(self, networkId: str, id: str, name: str, **kwarg - cidr (string): CIDR of the pool of subnets. Applicable only for template network. Each network bound to the template will automatically pick a subnet from this pool to build its own VLAN. - mask (integer): Mask used for the subnet of all bound to the template networks. Applicable only for template network. - ipv6 (object): IPv6 configuration on the VLAN + - dhcpHandling (string): The appliance's handling of DHCP requests on this VLAN. One of: 'Run a DHCP server', 'Relay DHCP to another server' or 'Do not respond to DHCP requests' + - dhcpLeaseTime (string): The term of DHCP leases if the appliance is running a DHCP server on this VLAN. One of: '30 minutes', '1 hour', '4 hours', '12 hours', '1 day' or '1 week' - mandatoryDhcp (object): Mandatory DHCP will enforce that clients connecting to this VLAN must use the IP address assigned by the DHCP server. Clients who use a static IP address won't be able to associate. Only available on firmware versions 17.0 and above + - dhcpBootOptionsEnabled (boolean): Use DHCP boot options specified in other properties + - dhcpOptions (array): The list of DHCP options that will be included in DHCP responses. Each object in the list should have "code", "type", and "value" properties. """ kwargs.update(locals()) @@ -796,6 +800,12 @@ def createNetworkApplianceVlan(self, networkId: str, id: str, name: str, **kwarg if 'templateVlanType' in kwargs: options = ['same', 'unique'] assert kwargs['templateVlanType'] in options, f'''"templateVlanType" cannot be "{kwargs['templateVlanType']}", & must be set to one of: {options}''' + if 'dhcpHandling' in kwargs: + options = ['Do not respond to DHCP requests', 'Relay DHCP to another server', 'Run a DHCP server'] + assert kwargs['dhcpHandling'] in options, f'''"dhcpHandling" cannot be "{kwargs['dhcpHandling']}", & must be set to one of: {options}''' + if 'dhcpLeaseTime' in kwargs: + options = ['1 day', '1 hour', '1 week', '12 hours', '30 minutes', '4 hours'] + assert kwargs['dhcpLeaseTime'] in options, f'''"dhcpLeaseTime" cannot be "{kwargs['dhcpLeaseTime']}", & must be set to one of: {options}''' metadata = { 'tags': ['appliance', 'configure', 'vlans'], @@ -803,7 +813,7 @@ def createNetworkApplianceVlan(self, networkId: str, id: str, name: str, **kwarg } resource = f'/networks/{networkId}/appliance/vlans' - body_params = ['id', 'name', 'subnet', 'applianceIp', 'groupPolicyId', 'templateVlanType', 'cidr', 'mask', 'ipv6', 'mandatoryDhcp', ] + body_params = ['id', 'name', 'subnet', 'applianceIp', 'groupPolicyId', 'templateVlanType', 'cidr', 'mask', 'ipv6', 'dhcpHandling', 'dhcpLeaseTime', 'mandatoryDhcp', 'dhcpBootOptionsEnabled', 'dhcpOptions', ] payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params} action = { "resource": resource, diff --git a/meraki/api/batch/networks.py b/meraki/api/batch/networks.py index 80cf68c..65e05fa 100644 --- a/meraki/api/batch/networks.py +++ b/meraki/api/batch/networks.py @@ -283,7 +283,7 @@ def createNetworkFirmwareUpgradesRollback(self, networkId: str, reasons: list, * kwargs.update(locals()) if 'product' in kwargs: - options = ['appliance', 'camera', 'cellularGateway', 'switch', 'switchCatalyst', 'wireless'] + options = ['appliance', 'camera', 'cellularGateway', 'secureConnect', 'switch', 'switchCatalyst', 'wireless'] assert kwargs['product'] in options, f'''"product" cannot be "{kwargs['product']}", & must be set to one of: {options}''' metadata = { diff --git a/meraki/api/batch/organizations.py b/meraki/api/batch/organizations.py index e2354e3..bec1048 100644 --- a/meraki/api/batch/organizations.py +++ b/meraki/api/batch/organizations.py @@ -1236,3 +1236,120 @@ def deleteOrganizationSamlIdp(self, organizationId: str, idpId: str): + + + def deleteOrganizationSplashAsset(self, organizationId: str, id: str): + """ + **Delete a Splash Theme Asset** + https://developer.cisco.com/meraki/api-v1/#!delete-organization-splash-asset + + - organizationId (string): Organization ID + - id (string): ID + """ + + metadata = { + 'tags': ['organizations', 'configure', 'splash', 'assets'], + 'operation': 'deleteOrganizationSplashAsset' + } + resource = f'/organizations/{organizationId}/splash/assets/{id}' + + action = { + "resource": resource, + "operation": "destroy", + } + return action + + + + + + + def createOrganizationSplashTheme(self, organizationId: str, **kwargs): + """ + **Create a Splash Theme** + https://developer.cisco.com/meraki/api-v1/#!create-organization-splash-theme + + - organizationId (string): Organization ID + - name (string): theme name + - baseTheme (string): base theme id + """ + + kwargs.update(locals()) + + metadata = { + 'tags': ['organizations', 'configure', 'splash', 'themes'], + 'operation': 'createOrganizationSplashTheme' + } + resource = f'/organizations/{organizationId}/splash/themes' + + body_params = ['name', 'baseTheme', ] + 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 deleteOrganizationSplashTheme(self, organizationId: str, id: str): + """ + **Delete a Splash Theme** + https://developer.cisco.com/meraki/api-v1/#!delete-organization-splash-theme + + - organizationId (string): Organization ID + - id (string): ID + """ + + metadata = { + 'tags': ['organizations', 'configure', 'splash', 'themes'], + 'operation': 'deleteOrganizationSplashTheme' + } + resource = f'/organizations/{organizationId}/splash/themes/{id}' + + action = { + "resource": resource, + "operation": "destroy", + } + return action + + + + + + + def createOrganizationSplashThemeAsset(self, organizationId: str, themeIdentifier: str, **kwargs): + """ + **Create a Splash Theme Asset** + https://developer.cisco.com/meraki/api-v1/#!create-organization-splash-theme-asset + + - organizationId (string): Organization ID + - themeIdentifier (string): Theme identifier + - name (string): File name. Will overwrite files with same name. + - content (string): a file containing the asset content + """ + + kwargs.update(locals()) + + metadata = { + 'tags': ['organizations', 'configure', 'splash', 'themes', 'assets'], + 'operation': 'createOrganizationSplashThemeAsset' + } + resource = f'/organizations/{organizationId}/splash/themes/{themeIdentifier}/assets' + + body_params = ['name', 'content', ] + 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 + + + + diff --git a/meraki/api/batch/switch.py b/meraki/api/batch/switch.py index 2c9decc..f91673f 100644 --- a/meraki/api/batch/switch.py +++ b/meraki/api/batch/switch.py @@ -120,7 +120,6 @@ def createDeviceSwitchRoutingInterface(self, serial: str, **kwargs): - vlanId (integer): The VLAN this routed interface is on. VLAN must be between 1 and 4094. - defaultGateway (string): The next hop for any traffic that isn't going to a directly connected subnet or over a static route. This IP address must exist in a subnet with a routed interface. Required if this is the first IPv4 interface. - ospfSettings (object): The OSPF routing settings of the interface. - - ospfV3 (object): The OSPFv3 routing settings of the interface. - ipv6 (object): The IPv6 settings of the interface. """ @@ -136,7 +135,7 @@ def createDeviceSwitchRoutingInterface(self, serial: str, **kwargs): } resource = f'/devices/{serial}/switch/routing/interfaces' - body_params = ['name', 'subnet', 'interfaceIp', 'multicastRouting', 'vlanId', 'defaultGateway', 'ospfSettings', 'ospfV3', 'ipv6', ] + body_params = ['name', 'subnet', 'interfaceIp', 'multicastRouting', 'vlanId', 'defaultGateway', 'ospfSettings', 'ipv6', ] payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params} action = { "resource": resource, @@ -164,7 +163,6 @@ def updateDeviceSwitchRoutingInterface(self, serial: str, interfaceId: str, **kw - vlanId (integer): The VLAN this routed interface is on. VLAN must be between 1 and 4094. - defaultGateway (string): The next hop for any traffic that isn't going to a directly connected subnet or over a static route. This IP address must exist in a subnet with a routed interface. Required if this is the first IPv4 interface. - ospfSettings (object): The OSPF routing settings of the interface. - - ospfV3 (object): The OSPFv3 routing settings of the interface. - ipv6 (object): The IPv6 settings of the interface. """ @@ -180,7 +178,7 @@ def updateDeviceSwitchRoutingInterface(self, serial: str, interfaceId: str, **kw } resource = f'/devices/{serial}/switch/routing/interfaces/{interfaceId}' - body_params = ['name', 'subnet', 'interfaceIp', 'multicastRouting', 'vlanId', 'defaultGateway', 'ospfSettings', 'ospfV3', 'ipv6', ] + body_params = ['name', 'subnet', 'interfaceIp', 'multicastRouting', 'vlanId', 'defaultGateway', 'ospfSettings', 'ipv6', ] payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params} action = { "resource": resource, diff --git a/meraki/api/batch/wireless.py b/meraki/api/batch/wireless.py index 694721e..d58c9fa 100644 --- a/meraki/api/batch/wireless.py +++ b/meraki/api/batch/wireless.py @@ -104,6 +104,140 @@ def updateDeviceWirelessRadioSettings(self, serial: str, **kwargs): + def createNetworkWirelessAirMarshalRule(self, networkId: str, type: str, match: dict): + """ + **Creates a new rule** + https://developer.cisco.com/meraki/api-v1/#!create-network-wireless-air-marshal-rule + + - networkId (string): Network ID + - type (string): Indicates if this rule will allow, block, or alert. + - match (object): Object describing the rule specification. + """ + + kwargs = locals() + + if 'type' in kwargs: + options = ['alert', 'allow', 'block'] + assert kwargs['type'] in options, f'''"type" cannot be "{kwargs['type']}", & must be set to one of: {options}''' + + metadata = { + 'tags': ['wireless', 'configure', 'airMarshal', 'rules'], + 'operation': 'createNetworkWirelessAirMarshalRule' + } + resource = f'/networks/{networkId}/wireless/airMarshal/rules' + + body_params = ['type', 'match', ] + 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 updateNetworkWirelessAirMarshalRule(self, networkId: str, ruleId: str, **kwargs): + """ + **Update a rule** + https://developer.cisco.com/meraki/api-v1/#!update-network-wireless-air-marshal-rule + + - networkId (string): Network ID + - ruleId (string): Rule ID + - type (string): Indicates if this rule will allow, block, or alert. + - match (object): Object describing the rule specification. + """ + + kwargs.update(locals()) + + if 'type' in kwargs: + options = ['alert', 'allow', 'block'] + assert kwargs['type'] in options, f'''"type" cannot be "{kwargs['type']}", & must be set to one of: {options}''' + + metadata = { + 'tags': ['wireless', 'configure', 'airMarshal', 'rules'], + 'operation': 'updateNetworkWirelessAirMarshalRule' + } + resource = f'/networks/{networkId}/wireless/airMarshal/rules/{ruleId}' + + body_params = ['type', 'match', ] + 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 deleteNetworkWirelessAirMarshalRule(self, networkId: str, ruleId: str): + """ + **Delete an Air Marshal rule.** + https://developer.cisco.com/meraki/api-v1/#!delete-network-wireless-air-marshal-rule + + - networkId (string): Network ID + - ruleId (string): Rule ID + """ + + metadata = { + 'tags': ['wireless', 'configure', 'airMarshal', 'rules'], + 'operation': 'deleteNetworkWirelessAirMarshalRule' + } + resource = f'/networks/{networkId}/wireless/airMarshal/rules/{ruleId}' + + action = { + "resource": resource, + "operation": "destroy", + } + return action + + + + + + + def updateNetworkWirelessAirMarshalSettings(self, networkId: str, defaultPolicy: str): + """ + **Updates Air Marshal settings.** + https://developer.cisco.com/meraki/api-v1/#!update-network-wireless-air-marshal-settings + + - networkId (string): Network ID + - defaultPolicy (string): Allows clients to access rogue networks. Blocked by default. + """ + + kwargs = locals() + + if 'defaultPolicy' in kwargs: + options = ['allow', 'block'] + assert kwargs['defaultPolicy'] in options, f'''"defaultPolicy" cannot be "{kwargs['defaultPolicy']}", & must be set to one of: {options}''' + + metadata = { + 'tags': ['wireless', 'configure', 'airMarshal', 'settings'], + 'operation': 'updateNetworkWirelessAirMarshalSettings' + } + resource = f'/networks/{networkId}/wireless/airMarshal/settings' + + body_params = ['defaultPolicy', ] + 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 updateNetworkWirelessAlternateManagementInterface(self, networkId: str, **kwargs): """ **Update alternate management interface and device static IP** @@ -566,7 +700,7 @@ def updateNetworkWirelessSsid(self, networkId: str, number: str, **kwargs): options = ['access disabled', 'access enabled'] assert kwargs['enterpriseAdminAccess'] in options, f'''"enterpriseAdminAccess" cannot be "{kwargs['enterpriseAdminAccess']}", & must be set to one of: {options}''' if 'encryptionMode' in kwargs: - options = ['wep', 'wpa'] + options = ['open', 'wep', 'wpa', 'wpa-eap'] assert kwargs['encryptionMode'] in options, f'''"encryptionMode" cannot be "{kwargs['encryptionMode']}", & must be set to one of: {options}''' if 'wpaEncryptionMode' in kwargs: options = ['WPA1 and WPA2', 'WPA1 only', 'WPA2 only', 'WPA3 192-bit Security', 'WPA3 Transition Mode', 'WPA3 only'] diff --git a/meraki/api/devices.py b/meraki/api/devices.py index 72865b4..902e9a6 100644 --- a/meraki/api/devices.py +++ b/meraki/api/devices.py @@ -206,7 +206,7 @@ def getDeviceLiveToolsArpTable(self, serial: str, arpTableId: str): def createDeviceLiveToolsCableTest(self, serial: str, ports: list, **kwargs): """ - **Enqueue a job to perform a cable test for the device on the specified ports.** + **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 diff --git a/meraki/api/networks.py b/meraki/api/networks.py index 11f0c6f..3b744a5 100644 --- a/meraki/api/networks.py +++ b/meraki/api/networks.py @@ -730,7 +730,7 @@ def getNetworkEvents(self, networkId: str, total_pages=1, direction='prev', even - total_pages (integer or string): use with perPage to get total results up to total_pages*perPage; -1 or "all" for all pages - direction (string): direction to paginate, either "next" or "prev" (default) page - event_log_end_time (string): ISO8601 Zulu/UTC time, to use in conjunction with startingAfter, to retrieve events within a time window - - productType (string): The product type to fetch events for. This parameter is required for networks with multiple device types. Valid types are wireless, appliance, switch, systemsManager, camera, and cellularGateway + - productType (string): The product type to fetch events for. This parameter is required for networks with multiple device types. Valid types are wireless, appliance, switch, systemsManager, camera, cellularGateway, and secureConnect - includedEventTypes (array): A list of event types. The returned events will be filtered to only include events with these types. - excludedEventTypes (array): A list of event types. The returned events will be filtered to exclude events with these types. - deviceMac (string): The MAC address of the Meraki device which the list of events will be filtered with @@ -749,7 +749,7 @@ def getNetworkEvents(self, networkId: str, total_pages=1, direction='prev', even kwargs.update(locals()) if 'productType' in kwargs: - options = ['appliance', 'camera', 'cellularGateway', 'switch', 'systemsManager', 'wireless'] + options = ['appliance', 'camera', 'cellularGateway', 'secureConnect', 'switch', 'systemsManager', 'wireless'] assert kwargs['productType'] in options, f'''"productType" cannot be "{kwargs['productType']}", & must be set to one of: {options}''' metadata = { @@ -852,7 +852,7 @@ def createNetworkFirmwareUpgradesRollback(self, networkId: str, reasons: list, * kwargs.update(locals()) if 'product' in kwargs: - options = ['appliance', 'camera', 'cellularGateway', 'switch', 'switchCatalyst', 'wireless'] + options = ['appliance', 'camera', 'cellularGateway', 'secureConnect', 'switch', 'switchCatalyst', 'wireless'] assert kwargs['product'] in options, f'''"product" cannot be "{kwargs['product']}", & must be set to one of: {options}''' metadata = { diff --git a/meraki/api/organizations.py b/meraki/api/organizations.py index 1aedc0e..d159e82 100644 --- a/meraki/api/organizations.py +++ b/meraki/api/organizations.py @@ -1030,6 +1030,325 @@ def getOrganizationApiRequestsOverviewResponseCodesByInterval(self, organization + def getOrganizationAssuranceAlerts(self, organizationId: str, total_pages=1, direction='next', **kwargs): + """ + **Return all health alerts for an organization** + https://developer.cisco.com/meraki/api-v1/#!get-organization-assurance-alerts + + - 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 4 - 300. Default is 30. + - 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 'ascending'. + - networkId (string): Optional parameter to filter alerts by network ids. + - severity (string): Optional parameter to filter by severity type. + - types (array): Optional parameter to filter by alert type. + - tsStart (string): Optional parameter to filter by starting timestamp + - tsEnd (string): Optional parameter to filter by end timestamp + - category (string): Optional parameter to filter by category. + - sortBy (string): Optional parameter to set column to sort by. + - serials (array): Optional parameter to filter by primary device serial + - deviceTypes (array): Optional parameter to filter by device types + - deviceTags (array): Optional parameter to filter by device tags + - active (boolean): Optional parameter to filter by active alerts defaults to true + - dismissed (boolean): Optional parameter to filter by dismissed alerts defaults to false + - resolved (boolean): Optional parameter to filter by resolved alerts defaults to false + - suppressAlertsForOfflineNodes (boolean): When set to true the api will only return connectivity alerts for a given device if that device is in an offline state. This only applies to devices. This is ignored when resolved is true. Example: If a Switch has a VLan Mismatch and is Unreachable. only the Unreachable alert will be returned. Defaults to false. + """ + + 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}''' + if 'category' in kwargs: + options = ['configuration', 'connectivity', 'device_health', 'insights'] + assert kwargs['category'] in options, f'''"category" cannot be "{kwargs['category']}", & must be set to one of: {options}''' + if 'sortBy' in kwargs: + options = ['category', 'dismissedAt', 'resolvedAt', 'severity', 'startedAt'] + assert kwargs['sortBy'] in options, f'''"sortBy" cannot be "{kwargs['sortBy']}", & must be set to one of: {options}''' + + metadata = { + 'tags': ['organizations', 'configure', 'alerts'], + 'operation': 'getOrganizationAssuranceAlerts' + } + organizationId = urllib.parse.quote(str(organizationId), safe='') + resource = f'/organizations/{organizationId}/assurance/alerts' + + query_params = ['perPage', 'startingAfter', 'endingBefore', 'sortOrder', 'networkId', 'severity', 'types', 'tsStart', 'tsEnd', 'category', 'sortBy', 'serials', 'deviceTypes', 'deviceTags', 'active', 'dismissed', 'resolved', 'suppressAlertsForOfflineNodes', ] + params = {k.strip(): v for k, v in kwargs.items() if k.strip() in query_params} + + array_params = ['types', 'serials', 'deviceTypes', 'deviceTags', ] + 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 dismissOrganizationAssuranceAlerts(self, organizationId: str, alertIds: list): + """ + **Dismiss health alerts** + https://developer.cisco.com/meraki/api-v1/#!dismiss-organization-assurance-alerts + + - organizationId (string): Organization ID + - alertIds (array): Parameter to dismiss alerts by ID + """ + + kwargs = locals() + + metadata = { + 'tags': ['organizations', 'configure', 'alerts'], + 'operation': 'dismissOrganizationAssuranceAlerts' + } + organizationId = urllib.parse.quote(str(organizationId), safe='') + resource = f'/organizations/{organizationId}/assurance/alerts/dismiss' + + body_params = ['alertIds', ] + payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params} + + return self._session.post(metadata, resource, payload) + + + + def getOrganizationAssuranceAlertsOverview(self, organizationId: str, **kwargs): + """ + **Return overview of active health alerts for an organization** + https://developer.cisco.com/meraki/api-v1/#!get-organization-assurance-alerts-overview + + - organizationId (string): Organization ID + - networkId (string): Optional parameter to filter alerts overview by network ids. + - severity (string): Optional parameter to filter alerts overview by severity type. + - types (array): Optional parameter to filter by alert type. + - tsStart (string): Optional parameter to filter by starting timestamp + - tsEnd (string): Optional parameter to filter by end timestamp + - serials (array): Optional parameter to filter by primary device serial + - deviceTypes (array): Optional parameter to filter by device types + - deviceTags (array): Optional parameter to filter by device tags + - active (boolean): Optional parameter to filter by active alerts defaults to true + - dismissed (boolean): Optional parameter to filter by dismissed alerts defaults to false + - resolved (boolean): Optional parameter to filter by resolved alerts defaults to false + - suppressAlertsForOfflineNodes (boolean): When set to true the api will only return connectivity alerts for a given device if that device is in an offline state. This only applies to devices. This is ignored when resolved is true. Example: If a Switch has a VLan Mismatch and is Unreachable. only the Unreachable alert will be returned. Defaults to false. + """ + + kwargs.update(locals()) + + metadata = { + 'tags': ['organizations', 'configure', 'alerts', 'overview'], + 'operation': 'getOrganizationAssuranceAlertsOverview' + } + organizationId = urllib.parse.quote(str(organizationId), safe='') + resource = f'/organizations/{organizationId}/assurance/alerts/overview' + + query_params = ['networkId', 'severity', 'types', 'tsStart', 'tsEnd', 'serials', 'deviceTypes', 'deviceTags', 'active', 'dismissed', 'resolved', 'suppressAlertsForOfflineNodes', ] + params = {k.strip(): v for k, v in kwargs.items() if k.strip() in query_params} + + array_params = ['types', 'serials', 'deviceTypes', 'deviceTags', ] + 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 getOrganizationAssuranceAlertsOverviewByNetwork(self, organizationId: str, total_pages=1, direction='next', **kwargs): + """ + **Return a Summary of Alerts grouped by network and severity** + https://developer.cisco.com/meraki/api-v1/#!get-organization-assurance-alerts-overview-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 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. + - sortOrder (string): Sorted order of entries. Order options are 'ascending' and 'descending'. Default is 'ascending'. + - networkId (string): Optional parameter to filter alerts overview by network id. + - severity (string): Optional parameter to filter alerts overview by severity type. + - types (array): Optional parameter to filter by alert type. + - tsStart (string): Optional parameter to filter by starting timestamp + - tsEnd (string): Optional parameter to filter by end timestamp + - serials (array): Optional parameter to filter by primary device serial + - deviceTypes (array): Optional parameter to filter by device types + - deviceTags (array): Optional parameter to filter by device tags + - active (boolean): Optional parameter to filter by active alerts defaults to true + - dismissed (boolean): Optional parameter to filter by dismissed alerts defaults to false + - resolved (boolean): Optional parameter to filter by resolved alerts defaults to false + - suppressAlertsForOfflineNodes (boolean): When set to true the api will only return connectivity alerts for a given device if that device is in an offline state. This only applies to devices. This is ignored when resolved is true. Example: If a Switch has a VLan Mismatch and is Unreachable. only the Unreachable alert will be returned. Defaults to false. + """ + + 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': ['organizations', 'configure', 'alerts', 'overview', 'byNetwork'], + 'operation': 'getOrganizationAssuranceAlertsOverviewByNetwork' + } + organizationId = urllib.parse.quote(str(organizationId), safe='') + resource = f'/organizations/{organizationId}/assurance/alerts/overview/byNetwork' + + query_params = ['perPage', 'startingAfter', 'endingBefore', 'sortOrder', 'networkId', 'severity', 'types', 'tsStart', 'tsEnd', 'serials', 'deviceTypes', 'deviceTags', 'active', 'dismissed', 'resolved', 'suppressAlertsForOfflineNodes', ] + params = {k.strip(): v for k, v in kwargs.items() if k.strip() in query_params} + + array_params = ['types', 'serials', 'deviceTypes', 'deviceTags', ] + 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 getOrganizationAssuranceAlertsOverviewByType(self, organizationId: str, total_pages=1, direction='next', **kwargs): + """ + **Return a Summary of Alerts grouped by type and severity** + https://developer.cisco.com/meraki/api-v1/#!get-organization-assurance-alerts-overview-by-type + + - 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. + - sortOrder (string): Sorted order of entries. Order options are 'ascending' and 'descending'. Default is 'ascending'. + - networkId (string): Optional parameter to filter alerts overview by network ids. + - severity (string): Optional parameter to filter alerts overview by severity type. + - types (array): Optional parameter to filter by alert type. + - tsStart (string): Optional parameter to filter by starting timestamp + - tsEnd (string): Optional parameter to filter by end timestamp + - sortBy (string): Optional parameter to set column to sort by. + - serials (array): Optional parameter to filter by primary device serial + - deviceTypes (array): Optional parameter to filter by device types + - deviceTags (array): Optional parameter to filter by device tags + - active (boolean): Optional parameter to filter by active alerts defaults to true + - dismissed (boolean): Optional parameter to filter by dismissed alerts defaults to false + - resolved (boolean): Optional parameter to filter by resolved alerts defaults to false + - suppressAlertsForOfflineNodes (boolean): When set to true the api will only return connectivity alerts for a given device if that device is in an offline state. This only applies to devices. This is ignored when resolved is true. Example: If a Switch has a VLan Mismatch and is Unreachable. only the Unreachable alert will be returned. Defaults to false. + """ + + 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}''' + if 'sortBy' in kwargs: + options = ['count', 'lastAlertedAt', 'networkCount', 'severity', 'startedAt'] + assert kwargs['sortBy'] in options, f'''"sortBy" cannot be "{kwargs['sortBy']}", & must be set to one of: {options}''' + + metadata = { + 'tags': ['organizations', 'configure', 'alerts', 'overview', 'byType'], + 'operation': 'getOrganizationAssuranceAlertsOverviewByType' + } + organizationId = urllib.parse.quote(str(organizationId), safe='') + resource = f'/organizations/{organizationId}/assurance/alerts/overview/byType' + + query_params = ['perPage', 'startingAfter', 'endingBefore', 'sortOrder', 'networkId', 'severity', 'types', 'tsStart', 'tsEnd', 'sortBy', 'serials', 'deviceTypes', 'deviceTags', 'active', 'dismissed', 'resolved', 'suppressAlertsForOfflineNodes', ] + params = {k.strip(): v for k, v in kwargs.items() if k.strip() in query_params} + + array_params = ['types', 'serials', 'deviceTypes', 'deviceTags', ] + 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 getOrganizationAssuranceAlertsOverviewHistorical(self, organizationId: str, segmentDuration: int, tsStart: str, **kwargs): + """ + **Returns historical health alert overviews** + https://developer.cisco.com/meraki/api-v1/#!get-organization-assurance-alerts-overview-historical + + - organizationId (string): Organization ID + - segmentDuration (integer): Amount of time in seconds for each segment in the returned dataset + - tsStart (string): Parameter to define starting timestamp of historical totals + - networkId (string): Optional parameter to filter alerts overview by network ids. + - severity (string): Optional parameter to filter alerts overview by severity type. + - types (array): Optional parameter to filter by alert type. + - tsEnd (string): Optional parameter to filter by end timestamp defaults to the current time + - serials (array): Optional parameter to filter by primary device serial + - deviceTypes (array): Optional parameter to filter by device types + """ + + kwargs.update(locals()) + + metadata = { + 'tags': ['organizations', 'configure', 'alerts', 'overview', 'historical'], + 'operation': 'getOrganizationAssuranceAlertsOverviewHistorical' + } + organizationId = urllib.parse.quote(str(organizationId), safe='') + resource = f'/organizations/{organizationId}/assurance/alerts/overview/historical' + + query_params = ['segmentDuration', 'networkId', 'severity', 'types', 'tsStart', 'tsEnd', 'serials', 'deviceTypes', ] + params = {k.strip(): v for k, v in kwargs.items() if k.strip() in query_params} + + array_params = ['types', 'serials', 'deviceTypes', ] + 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 restoreOrganizationAssuranceAlerts(self, organizationId: str, alertIds: list): + """ + **Restore health alerts from dismissed** + https://developer.cisco.com/meraki/api-v1/#!restore-organization-assurance-alerts + + - organizationId (string): Organization ID + - alertIds (array): Parameter to restore alerts by ID + """ + + kwargs = locals() + + metadata = { + 'tags': ['organizations', 'configure', 'alerts'], + 'operation': 'restoreOrganizationAssuranceAlerts' + } + organizationId = urllib.parse.quote(str(organizationId), safe='') + resource = f'/organizations/{organizationId}/assurance/alerts/restore' + + body_params = ['alertIds', ] + payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params} + + return self._session.post(metadata, resource, payload) + + + + def getOrganizationAssuranceAlert(self, organizationId: str, id: str): + """ + **Return a singular Health Alert by its id** + https://developer.cisco.com/meraki/api-v1/#!get-organization-assurance-alert + + - organizationId (string): Organization ID + - id (string): ID + """ + + metadata = { + 'tags': ['organizations', 'configure', 'alerts'], + 'operation': 'getOrganizationAssuranceAlert' + } + organizationId = urllib.parse.quote(str(organizationId), safe='') + id = urllib.parse.quote(str(id), safe='') + resource = f'/organizations/{organizationId}/assurance/alerts/{id}' + + return self._session.get(metadata, resource) + + + def getOrganizationBrandingPolicies(self, organizationId: str): """ **List the branding policies of an organization** @@ -1503,7 +1822,7 @@ def getOrganizationDevices(self, organizationId: str, total_pages=1, direction=' - endingBefore (string): A token used by the server to indicate the end of the page. Often this is a timestamp or an ID but it is not limited to those. This parameter should not be defined by client applications. The link for the first, last, prev, or next page in the HTTP Link header should define it. - configurationUpdatedAfter (string): Filter results by whether or not the device's configuration has been updated after the given timestamp - networkIds (array): Optional parameter to filter devices by network. - - productTypes (array): Optional parameter to filter devices by product type. Valid types are wireless, appliance, switch, systemsManager, camera, cellularGateway, and sensor. + - productTypes (array): Optional parameter to filter devices by product type. Valid types are wireless, appliance, switch, systemsManager, camera, cellularGateway, sensor, and secureConnect. - tags (array): Optional parameter to filter devices by tags. - tagsFilterType (string): Optional parameter of value 'withAnyTags' or 'withAllTags' to indicate whether to return networks which contain ANY or ALL of the included tags. If no type is included, 'withAnyTags' will be selected. - name (string): Optional parameter to filter devices by name. All returned devices will have a name that contains the search term or is an exact match. @@ -1629,6 +1948,39 @@ def getOrganizationDevicesAvailabilitiesChangeHistory(self, organizationId: str, + def getOrganizationDevicesOverviewByModel(self, organizationId: str, **kwargs): + """ + **Lists the count for each device model** + https://developer.cisco.com/meraki/api-v1/#!get-organization-devices-overview-by-model + + - organizationId (string): Organization ID + - models (array): Optional parameter to filter devices by one or more models. All returned devices will have a model that is an exact match. + - networkIds (array): Optional parameter to filter devices by networkId. + - productTypes (array): Optional parameter to filter device by device product types. This filter uses multiple exact matches. + """ + + kwargs.update(locals()) + + metadata = { + 'tags': ['organizations', 'configure', 'devices', 'overview', 'byModel'], + 'operation': 'getOrganizationDevicesOverviewByModel' + } + organizationId = urllib.parse.quote(str(organizationId), safe='') + resource = f'/organizations/{organizationId}/devices/overview/byModel' + + query_params = ['models', 'networkIds', 'productTypes', ] + params = {k.strip(): v for k, v in kwargs.items() if k.strip() in query_params} + + array_params = ['models', 'networkIds', 'productTypes', ] + 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 getOrganizationDevicesPowerModulesStatusesByDevice(self, organizationId: str, total_pages=1, direction='next', **kwargs): """ **List the most recent status information for power modules in rackmount MX and MS devices that support them** @@ -1735,7 +2087,7 @@ def getOrganizationDevicesStatuses(self, organizationId: str, total_pages=1, dir - networkIds (array): Optional parameter to filter devices by network ids. - serials (array): Optional parameter to filter devices by serials. - statuses (array): Optional parameter to filter devices by statuses. Valid statuses are ["online", "alerting", "offline", "dormant"]. - - productTypes (array): An optional parameter to filter device statuses by product type. Valid types are wireless, appliance, switch, systemsManager, camera, cellularGateway, and sensor. + - productTypes (array): An optional parameter to filter device statuses by product type. Valid types are wireless, appliance, switch, systemsManager, camera, cellularGateway, sensor, and secureConnect. - models (array): Optional parameter to filter devices by models. - tags (array): An optional parameter to filter devices by tags. The filtering is case-sensitive. If tags are included, 'tagsFilterType' should also be included (see below). - tagsFilterType (string): An optional parameter of value 'withAnyTags' or 'withAllTags' to indicate whether to return devices which contain ANY or ALL of the included tags. If no type is included, 'withAnyTags' will be selected. @@ -1773,7 +2125,7 @@ def getOrganizationDevicesStatusesOverview(self, organizationId: str, **kwargs): https://developer.cisco.com/meraki/api-v1/#!get-organization-devices-statuses-overview - organizationId (string): Organization ID - - productTypes (array): An optional parameter to filter device statuses by product type. Valid types are wireless, appliance, switch, systemsManager, camera, cellularGateway, and sensor. + - productTypes (array): An optional parameter to filter device statuses by product type. Valid types are wireless, appliance, switch, systemsManager, camera, cellularGateway, sensor, and secureConnect. - networkIds (array): An optional parameter to filter device statuses by network. """ @@ -2133,7 +2485,7 @@ def getOrganizationInventoryDevices(self, organizationId: str, total_pages=1, di - orderNumbers (array): Search for devices in inventory based on order numbers. - tags (array): Filter devices by tags. The filtering is case-sensitive. If tags are included, 'tagsFilterType' should also be included (see below). - tagsFilterType (string): To use with 'tags' parameter, to filter devices which contain ANY or ALL given tags. Accepted values are 'withAnyTags' or 'withAllTags', default is 'withAnyTags'. - - productTypes (array): Filter devices by product type. Accepted values are appliance, camera, cellularGateway, sensor, switch, systemsManager, and wireless. + - productTypes (array): Filter devices by product type. Accepted values are appliance, camera, cellularGateway, secureConnect, sensor, switch, systemsManager, and wireless. """ kwargs.update(locals()) @@ -3399,6 +3751,142 @@ def updateOrganizationSnmp(self, organizationId: str, **kwargs): + def getOrganizationSplashAsset(self, organizationId: str, id: str): + """ + **Get a Splash Theme Asset** + https://developer.cisco.com/meraki/api-v1/#!get-organization-splash-asset + + - organizationId (string): Organization ID + - id (string): ID + """ + + metadata = { + 'tags': ['organizations', 'configure', 'splash', 'assets'], + 'operation': 'getOrganizationSplashAsset' + } + organizationId = urllib.parse.quote(str(organizationId), safe='') + id = urllib.parse.quote(str(id), safe='') + resource = f'/organizations/{organizationId}/splash/assets/{id}' + + return self._session.get(metadata, resource) + + + + def deleteOrganizationSplashAsset(self, organizationId: str, id: str): + """ + **Delete a Splash Theme Asset** + https://developer.cisco.com/meraki/api-v1/#!delete-organization-splash-asset + + - organizationId (string): Organization ID + - id (string): ID + """ + + metadata = { + 'tags': ['organizations', 'configure', 'splash', 'assets'], + 'operation': 'deleteOrganizationSplashAsset' + } + organizationId = urllib.parse.quote(str(organizationId), safe='') + id = urllib.parse.quote(str(id), safe='') + resource = f'/organizations/{organizationId}/splash/assets/{id}' + + return self._session.delete(metadata, resource) + + + + def getOrganizationSplashThemes(self, organizationId: str): + """ + **List Splash Themes** + https://developer.cisco.com/meraki/api-v1/#!get-organization-splash-themes + + - organizationId (string): Organization ID + """ + + metadata = { + 'tags': ['organizations', 'configure', 'splash', 'themes'], + 'operation': 'getOrganizationSplashThemes' + } + organizationId = urllib.parse.quote(str(organizationId), safe='') + resource = f'/organizations/{organizationId}/splash/themes' + + return self._session.get(metadata, resource) + + + + def createOrganizationSplashTheme(self, organizationId: str, **kwargs): + """ + **Create a Splash Theme** + https://developer.cisco.com/meraki/api-v1/#!create-organization-splash-theme + + - organizationId (string): Organization ID + - name (string): theme name + - baseTheme (string): base theme id + """ + + kwargs.update(locals()) + + metadata = { + 'tags': ['organizations', 'configure', 'splash', 'themes'], + 'operation': 'createOrganizationSplashTheme' + } + organizationId = urllib.parse.quote(str(organizationId), safe='') + resource = f'/organizations/{organizationId}/splash/themes' + + body_params = ['name', 'baseTheme', ] + payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params} + + return self._session.post(metadata, resource, payload) + + + + def deleteOrganizationSplashTheme(self, organizationId: str, id: str): + """ + **Delete a Splash Theme** + https://developer.cisco.com/meraki/api-v1/#!delete-organization-splash-theme + + - organizationId (string): Organization ID + - id (string): ID + """ + + metadata = { + 'tags': ['organizations', 'configure', 'splash', 'themes'], + 'operation': 'deleteOrganizationSplashTheme' + } + organizationId = urllib.parse.quote(str(organizationId), safe='') + id = urllib.parse.quote(str(id), safe='') + resource = f'/organizations/{organizationId}/splash/themes/{id}' + + return self._session.delete(metadata, resource) + + + + def createOrganizationSplashThemeAsset(self, organizationId: str, themeIdentifier: str, **kwargs): + """ + **Create a Splash Theme Asset** + https://developer.cisco.com/meraki/api-v1/#!create-organization-splash-theme-asset + + - organizationId (string): Organization ID + - themeIdentifier (string): Theme identifier + - name (string): File name. Will overwrite files with same name. + - content (string): a file containing the asset content + """ + + kwargs.update(locals()) + + metadata = { + 'tags': ['organizations', 'configure', 'splash', 'themes', 'assets'], + 'operation': 'createOrganizationSplashThemeAsset' + } + organizationId = urllib.parse.quote(str(organizationId), safe='') + themeIdentifier = urllib.parse.quote(str(themeIdentifier), safe='') + resource = f'/organizations/{organizationId}/splash/themes/{themeIdentifier}/assets' + + body_params = ['name', 'content', ] + payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params} + + return self._session.post(metadata, resource, payload) + + + def getOrganizationSummaryTopAppliancesByUtilization(self, organizationId: str, **kwargs): """ **Return the top 10 appliances sorted by utilization over given time range.** diff --git a/meraki/api/switch.py b/meraki/api/switch.py index ecdc850..429ace2 100644 --- a/meraki/api/switch.py +++ b/meraki/api/switch.py @@ -221,7 +221,6 @@ def createDeviceSwitchRoutingInterface(self, serial: str, **kwargs): - vlanId (integer): The VLAN this routed interface is on. VLAN must be between 1 and 4094. - defaultGateway (string): The next hop for any traffic that isn't going to a directly connected subnet or over a static route. This IP address must exist in a subnet with a routed interface. Required if this is the first IPv4 interface. - ospfSettings (object): The OSPF routing settings of the interface. - - ospfV3 (object): The OSPFv3 routing settings of the interface. - ipv6 (object): The IPv6 settings of the interface. """ @@ -238,7 +237,7 @@ def createDeviceSwitchRoutingInterface(self, serial: str, **kwargs): serial = urllib.parse.quote(str(serial), safe='') resource = f'/devices/{serial}/switch/routing/interfaces' - body_params = ['name', 'subnet', 'interfaceIp', 'multicastRouting', 'vlanId', 'defaultGateway', 'ospfSettings', 'ospfV3', 'ipv6', ] + body_params = ['name', 'subnet', 'interfaceIp', 'multicastRouting', 'vlanId', 'defaultGateway', 'ospfSettings', 'ipv6', ] payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params} return self._session.post(metadata, resource, payload) @@ -280,7 +279,6 @@ def updateDeviceSwitchRoutingInterface(self, serial: str, interfaceId: str, **kw - vlanId (integer): The VLAN this routed interface is on. VLAN must be between 1 and 4094. - defaultGateway (string): The next hop for any traffic that isn't going to a directly connected subnet or over a static route. This IP address must exist in a subnet with a routed interface. Required if this is the first IPv4 interface. - ospfSettings (object): The OSPF routing settings of the interface. - - ospfV3 (object): The OSPFv3 routing settings of the interface. - ipv6 (object): The IPv6 settings of the interface. """ @@ -298,7 +296,7 @@ def updateDeviceSwitchRoutingInterface(self, serial: str, interfaceId: str, **kw interfaceId = urllib.parse.quote(str(interfaceId), safe='') resource = f'/devices/{serial}/switch/routing/interfaces/{interfaceId}' - body_params = ['name', 'subnet', 'interfaceIp', 'multicastRouting', 'vlanId', 'defaultGateway', 'ospfSettings', 'ospfV3', 'ipv6', ] + body_params = ['name', 'subnet', 'interfaceIp', 'multicastRouting', 'vlanId', 'defaultGateway', 'ospfSettings', 'ipv6', ] 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/wireless.py b/meraki/api/wireless.py index f8c46ef..89d31b3 100644 --- a/meraki/api/wireless.py +++ b/meraki/api/wireless.py @@ -241,6 +241,118 @@ def getNetworkWirelessAirMarshal(self, networkId: str, **kwargs): + def createNetworkWirelessAirMarshalRule(self, networkId: str, type: str, match: dict): + """ + **Creates a new rule** + https://developer.cisco.com/meraki/api-v1/#!create-network-wireless-air-marshal-rule + + - networkId (string): Network ID + - type (string): Indicates if this rule will allow, block, or alert. + - match (object): Object describing the rule specification. + """ + + kwargs = locals() + + if 'type' in kwargs: + options = ['alert', 'allow', 'block'] + assert kwargs['type'] in options, f'''"type" cannot be "{kwargs['type']}", & must be set to one of: {options}''' + + metadata = { + 'tags': ['wireless', 'configure', 'airMarshal', 'rules'], + 'operation': 'createNetworkWirelessAirMarshalRule' + } + networkId = urllib.parse.quote(str(networkId), safe='') + resource = f'/networks/{networkId}/wireless/airMarshal/rules' + + body_params = ['type', 'match', ] + payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params} + + return self._session.post(metadata, resource, payload) + + + + def updateNetworkWirelessAirMarshalRule(self, networkId: str, ruleId: str, **kwargs): + """ + **Update a rule** + https://developer.cisco.com/meraki/api-v1/#!update-network-wireless-air-marshal-rule + + - networkId (string): Network ID + - ruleId (string): Rule ID + - type (string): Indicates if this rule will allow, block, or alert. + - match (object): Object describing the rule specification. + """ + + kwargs.update(locals()) + + if 'type' in kwargs: + options = ['alert', 'allow', 'block'] + assert kwargs['type'] in options, f'''"type" cannot be "{kwargs['type']}", & must be set to one of: {options}''' + + metadata = { + 'tags': ['wireless', 'configure', 'airMarshal', 'rules'], + 'operation': 'updateNetworkWirelessAirMarshalRule' + } + networkId = urllib.parse.quote(str(networkId), safe='') + ruleId = urllib.parse.quote(str(ruleId), safe='') + resource = f'/networks/{networkId}/wireless/airMarshal/rules/{ruleId}' + + body_params = ['type', 'match', ] + payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params} + + return self._session.put(metadata, resource, payload) + + + + def deleteNetworkWirelessAirMarshalRule(self, networkId: str, ruleId: str): + """ + **Delete an Air Marshal rule.** + https://developer.cisco.com/meraki/api-v1/#!delete-network-wireless-air-marshal-rule + + - networkId (string): Network ID + - ruleId (string): Rule ID + """ + + metadata = { + 'tags': ['wireless', 'configure', 'airMarshal', 'rules'], + 'operation': 'deleteNetworkWirelessAirMarshalRule' + } + networkId = urllib.parse.quote(str(networkId), safe='') + ruleId = urllib.parse.quote(str(ruleId), safe='') + resource = f'/networks/{networkId}/wireless/airMarshal/rules/{ruleId}' + + return self._session.delete(metadata, resource) + + + + def updateNetworkWirelessAirMarshalSettings(self, networkId: str, defaultPolicy: str): + """ + **Updates Air Marshal settings.** + https://developer.cisco.com/meraki/api-v1/#!update-network-wireless-air-marshal-settings + + - networkId (string): Network ID + - defaultPolicy (string): Allows clients to access rogue networks. Blocked by default. + """ + + kwargs = locals() + + if 'defaultPolicy' in kwargs: + options = ['allow', 'block'] + assert kwargs['defaultPolicy'] in options, f'''"defaultPolicy" cannot be "{kwargs['defaultPolicy']}", & must be set to one of: {options}''' + + metadata = { + 'tags': ['wireless', 'configure', 'airMarshal', 'settings'], + 'operation': 'updateNetworkWirelessAirMarshalSettings' + } + networkId = urllib.parse.quote(str(networkId), safe='') + resource = f'/networks/{networkId}/wireless/airMarshal/settings' + + body_params = ['defaultPolicy', ] + payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params} + + return self._session.put(metadata, resource, payload) + + + def getNetworkWirelessAlternateManagementInterface(self, networkId: str): """ **Return alternate management interface and devices with IP assigned** @@ -1506,7 +1618,7 @@ def updateNetworkWirelessSsid(self, networkId: str, number: str, **kwargs): options = ['access disabled', 'access enabled'] assert kwargs['enterpriseAdminAccess'] in options, f'''"enterpriseAdminAccess" cannot be "{kwargs['enterpriseAdminAccess']}", & must be set to one of: {options}''' if 'encryptionMode' in kwargs: - options = ['wep', 'wpa'] + options = ['open', 'wep', 'wpa', 'wpa-eap'] assert kwargs['encryptionMode'] in options, f'''"encryptionMode" cannot be "{kwargs['encryptionMode']}", & must be set to one of: {options}''' if 'wpaEncryptionMode' in kwargs: options = ['WPA1 and WPA2', 'WPA1 only', 'WPA2 only', 'WPA3 192-bit Security', 'WPA3 Transition Mode', 'WPA3 only'] @@ -1786,6 +1898,27 @@ def updateNetworkWirelessSsidFirewallL7FirewallRules(self, networkId: str, numbe + def getNetworkWirelessSsidHotspot20(self, networkId: str, number: str): + """ + **Return the Hotspot 2.0 settings for an SSID** + https://developer.cisco.com/meraki/api-v1/#!get-network-wireless-ssid-hotspot-2-0 + + - networkId (string): Network ID + - number (string): Number + """ + + metadata = { + 'tags': ['wireless', 'configure', 'ssids', 'hotspot20'], + 'operation': 'getNetworkWirelessSsidHotspot20' + } + networkId = urllib.parse.quote(str(networkId), safe='') + number = urllib.parse.quote(str(number), safe='') + resource = f'/networks/{networkId}/wireless/ssids/{number}/hotspot20' + + return self._session.get(metadata, resource) + + + def updateNetworkWirelessSsidHotspot20(self, networkId: str, number: str, **kwargs): """ **Update the Hotspot 2.0 settings of an SSID** @@ -1824,27 +1957,6 @@ def updateNetworkWirelessSsidHotspot20(self, networkId: str, number: str, **kwar - def getNetworkWirelessSsidHotspot20(self, networkId: str, number: str): - """ - **Return the Hotspot 2.0 settings for an SSID** - https://developer.cisco.com/meraki/api-v1/#!get-network-wireless-ssid-hotspot-2-0 - - - networkId (string): Network ID - - number (string): Number - """ - - metadata = { - 'tags': ['wireless', 'configure', 'ssids', 'hotspot20'], - 'operation': 'getNetworkWirelessSsidHotspot20' - } - networkId = urllib.parse.quote(str(networkId), safe='') - number = urllib.parse.quote(str(number), safe='') - resource = f'/networks/{networkId}/wireless/ssids/{number}/hotspot20' - - return self._session.get(metadata, resource) - - - def getNetworkWirelessSsidIdentityPsks(self, networkId: str, number: str): """ **List all Identity PSKs in a wireless network** @@ -2232,6 +2344,78 @@ def getNetworkWirelessUsageHistory(self, networkId: str, **kwargs): + def getOrganizationWirelessAirMarshalRules(self, organizationId: str, total_pages=1, direction='next', **kwargs): + """ + **Returns the current Air Marshal rules for this organization** + https://developer.cisco.com/meraki/api-v1/#!get-organization-wireless-air-marshal-rules + + - 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) The set of network IDs to include. + - perPage (integer): The number of entries per page returned. Acceptable range is 3 - 1000. Default is 1000. + - startingAfter (string): A token used by the server to indicate the start of the page. Often this is a timestamp or an ID but it is not limited to those. This parameter should not be defined by client applications. The link for the first, last, prev, or next page in the HTTP Link header should define it. + - endingBefore (string): A token used by the server to indicate the end of the page. Often this is a timestamp or an ID but it is not limited to those. This parameter should not be defined by client applications. The link for the first, last, prev, or next page in the HTTP Link header should define it. + """ + + kwargs.update(locals()) + + metadata = { + 'tags': ['wireless', 'configure', 'airMarshal', 'rules'], + 'operation': 'getOrganizationWirelessAirMarshalRules' + } + organizationId = urllib.parse.quote(str(organizationId), safe='') + resource = f'/organizations/{organizationId}/wireless/airMarshal/rules' + + query_params = ['networkIds', 'perPage', 'startingAfter', 'endingBefore', ] + 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 getOrganizationWirelessAirMarshalSettingsByNetwork(self, organizationId: str, total_pages=1, direction='next', **kwargs): + """ + **Returns the current Air Marshal settings for this network** + https://developer.cisco.com/meraki/api-v1/#!get-organization-wireless-air-marshal-settings-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 + - networkIds (array): The network IDs to include in the result set. + - perPage (integer): The number of entries per page returned. Acceptable range is 3 - 1000. Default is 1000. + - startingAfter (string): A token used by the server to indicate the start of the page. Often this is a timestamp or an ID but it is not limited to those. This parameter should not be defined by client applications. The link for the first, last, prev, or next page in the HTTP Link header should define it. + - endingBefore (string): A token used by the server to indicate the end of the page. Often this is a timestamp or an ID but it is not limited to those. This parameter should not be defined by client applications. The link for the first, last, prev, or next page in the HTTP Link header should define it. + """ + + kwargs.update(locals()) + + metadata = { + 'tags': ['wireless', 'configure', 'airMarshal', 'settings', 'byNetwork'], + 'operation': 'getOrganizationWirelessAirMarshalSettingsByNetwork' + } + organizationId = urllib.parse.quote(str(organizationId), safe='') + resource = f'/organizations/{organizationId}/wireless/airMarshal/settings/byNetwork' + + query_params = ['networkIds', 'perPage', 'startingAfter', 'endingBefore', ] + 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 getOrganizationWirelessDevicesChannelUtilizationByDevice(self, organizationId: str, total_pages=1, direction='next', **kwargs): """ **Get average channel utilization for all bands in a network, split by AP** @@ -2570,7 +2754,7 @@ def getOrganizationWirelessRfProfilesAssignmentsByDevice(self, organizationId: s - 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. + - productTypes (array): Optional parameter to filter devices by product type. Valid types are wireless, appliance, switch, systemsManager, camera, cellularGateway, sensor, and secureConnect. - 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. @@ -2613,7 +2797,7 @@ def getOrganizationWirelessSsidsStatusesByDevice(self, organizationId: str, tota - 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) + - hideDisabled (boolean): If true, the returned devices will not include disabled SSIDs. (default: true) - 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.