From 5fc32d5674e8741ac4d38516c6731a825e96cfb4 Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Wed, 6 May 2026 01:26:29 +0000 Subject: [PATCH] Auto-generated library v3.0.2 for API v1.69.0. --- meraki/_version.py | 2 +- meraki/aio/api/appliance.py | 54 ++++ meraki/aio/api/devices.py | 75 ++++++ meraki/aio/api/organizations.py | 415 ++++++++++++++++++++++++++++-- meraki/aio/api/switch.py | 2 +- meraki/api/appliance.py | 54 ++++ meraki/api/batch/appliance.py | 29 +++ meraki/api/batch/devices.py | 61 +++++ meraki/api/batch/organizations.py | 57 +++- meraki/api/batch/switch.py | 2 +- meraki/api/batch/wireless.py | 2 +- meraki/api/devices.py | 75 ++++++ meraki/api/organizations.py | 415 ++++++++++++++++++++++++++++-- meraki/api/switch.py | 2 +- pyproject.toml | 2 +- uv.lock | 2 +- 16 files changed, 1200 insertions(+), 49 deletions(-) diff --git a/meraki/_version.py b/meraki/_version.py index 05527687..131942e7 100644 --- a/meraki/_version.py +++ b/meraki/_version.py @@ -1 +1 @@ -__version__ = "3.0.1" +__version__ = "3.0.2" diff --git a/meraki/aio/api/appliance.py b/meraki/aio/api/appliance.py index af94a02c..db28a668 100644 --- a/meraki/aio/api/appliance.py +++ b/meraki/aio/api/appliance.py @@ -2488,6 +2488,7 @@ def createNetworkApplianceVlan(self, networkId: str, id: str, name: str, **kwarg - dhcpBootNextServer (string): DHCP boot option to direct boot clients to the server to load the boot file from - dhcpBootFilename (string): DHCP boot option for boot filename - 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. + - vrf (object): VRF configuration on the VLAN - uplinks (array): Per-uplink NAT exception override configuration on the VLAN. Applicable only for networks that support NAT exceptions. """ @@ -2534,6 +2535,7 @@ def createNetworkApplianceVlan(self, networkId: str, id: str, name: str, **kwarg "dhcpBootNextServer", "dhcpBootFilename", "dhcpOptions", + "vrf", "uplinks", ] payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params} @@ -2640,6 +2642,7 @@ def updateNetworkApplianceVlan(self, networkId: str, vlanId: str, **kwargs): - 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 - 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 + - vrf (object): VRF configuration on the VLAN - uplinks (array): Per-uplink NAT exception override configuration on the VLAN. Applicable only for networks that support NAT exceptions. """ @@ -2690,6 +2693,7 @@ def updateNetworkApplianceVlan(self, networkId: str, vlanId: str, **kwargs): "mask", "ipv6", "mandatoryDhcp", + "vrf", "uplinks", ] payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params} @@ -3628,6 +3632,56 @@ def getOrganizationApplianceFirewallMulticastForwardingByNetwork( return self._session.get_pages(metadata, resource, params, total_pages, direction) + def getOrganizationApplianceRoutingVrfsSettings(self, organizationId: str): + """ + **Return the VRF setting for an organization.** + https://developer.cisco.com/meraki/api-v1/#!get-organization-appliance-routing-vrfs-settings + + - organizationId (string): Organization ID + """ + + metadata = { + "tags": ["appliance", "configure", "routing", "vrfs", "settings"], + "operation": "getOrganizationApplianceRoutingVrfsSettings", + } + organizationId = urllib.parse.quote(str(organizationId), safe="") + resource = f"/organizations/{organizationId}/appliance/routing/vrfs/settings" + + return self._session.get(metadata, resource) + + def updateOrganizationApplianceRoutingVrfsSettings(self, organizationId: str, enabled: bool, **kwargs): + """ + **Update the VRF setting for an organization.** + https://developer.cisco.com/meraki/api-v1/#!update-organization-appliance-routing-vrfs-settings + + - organizationId (string): Organization ID + - enabled (boolean): Boolean indicating whether VRFs are enabled for the organization. + """ + + kwargs = locals() + + metadata = { + "tags": ["appliance", "configure", "routing", "vrfs", "settings"], + "operation": "updateOrganizationApplianceRoutingVrfsSettings", + } + organizationId = urllib.parse.quote(str(organizationId), safe="") + resource = f"/organizations/{organizationId}/appliance/routing/vrfs/settings" + + body_params = [ + "enabled", + ] + payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params} + + if self._session._validate_kwargs: + all_params = [] + body_params + invalid = [k for k in kwargs if k.strip() not in all_params and k != "self"] + if invalid and self._session._logger: + self._session._logger.warning( + f"updateOrganizationApplianceRoutingVrfsSettings: ignoring unrecognized kwargs: {invalid}" + ) + + return self._session.put(metadata, resource, payload) + def getOrganizationApplianceSecurityEvents(self, organizationId: str, total_pages=1, direction="next", **kwargs): """ **List the security events for an organization** diff --git a/meraki/aio/api/devices.py b/meraki/aio/api/devices.py index 956709e3..0b12c407 100644 --- a/meraki/aio/api/devices.py +++ b/meraki/aio/api/devices.py @@ -105,6 +105,37 @@ def blinkDeviceLeds(self, serial: str, **kwargs): return self._session.post(metadata, resource, payload) + def updateDeviceCellularGeolocations(self, serial: str, enabled: bool, **kwargs): + """ + **Update the enablement of the geolocation feature for a device** + https://developer.cisco.com/meraki/api-v1/#!update-device-cellular-geolocations + + - serial (string): Serial + - enabled (boolean): Required parameter for the state to update the geolocation settings to (true to enable, false to disable) + """ + + kwargs = locals() + + metadata = { + "tags": ["devices", "configure", "cellular", "geolocations"], + "operation": "updateDeviceCellularGeolocations", + } + serial = urllib.parse.quote(str(serial), safe="") + resource = f"/devices/{serial}/cellular/geolocations" + + body_params = [ + "enabled", + ] + payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params} + + if self._session._validate_kwargs: + all_params = [] + body_params + invalid = [k for k in kwargs if k.strip() not in all_params and k != "self"] + if invalid and self._session._logger: + self._session._logger.warning(f"updateDeviceCellularGeolocations: ignoring unrecognized kwargs: {invalid}") + + return self._session.put(metadata, resource, payload) + def getDeviceCellularSims(self, serial: str): """ **Return the SIM and APN configurations for a cellular device.** @@ -157,6 +188,50 @@ def updateDeviceCellularSims(self, serial: str, **kwargs): return self._session.put(metadata, resource, payload) + def createDeviceCellularUplinksBandsMasksUpdate(self, serial: str, slot: str, type: str, masked: list, **kwargs): + """ + **Update the cellular band masks for a device** + https://developer.cisco.com/meraki/api-v1/#!create-device-cellular-uplinks-bands-masks-update + + - serial (string): Serial + - slot (string): Required parameter for the SIM slot to update the cellular band mask for + - type (string): Required parameter for the signal type to update the cellular band mask for + - masked (array): Required parameter for the band identifiers to mask for the given SIM slot and signal type. For LTE use bands identifiers like '30' and for 5G use band identifiers like 'n30'. Maximum 256 bands. + """ + + kwargs = locals() + + if "slot" in kwargs: + options = ["sim1", "sim2", "sim3"] + assert kwargs["slot"] in options, f'''"slot" cannot be "{kwargs["slot"]}", & must be set to one of: {options}''' + if "type" in kwargs: + options = ["5GNSA", "5GSA", "LTE"] + assert kwargs["type"] in options, f'''"type" cannot be "{kwargs["type"]}", & must be set to one of: {options}''' + + metadata = { + "tags": ["devices", "configure", "cellular", "uplinks", "bands", "masks", "update"], + "operation": "createDeviceCellularUplinksBandsMasksUpdate", + } + serial = urllib.parse.quote(str(serial), safe="") + resource = f"/devices/{serial}/cellular/uplinks/bands/masks/update" + + body_params = [ + "slot", + "type", + "masked", + ] + payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params} + + if self._session._validate_kwargs: + all_params = [] + body_params + invalid = [k for k in kwargs if k.strip() not in all_params and k != "self"] + if invalid and self._session._logger: + self._session._logger.warning( + f"createDeviceCellularUplinksBandsMasksUpdate: ignoring unrecognized kwargs: {invalid}" + ) + + return self._session.post(metadata, resource, payload) + def getDeviceClients(self, serial: str, **kwargs): """ **List the clients of a device, up to a maximum of a month ago** diff --git a/meraki/aio/api/organizations.py b/meraki/aio/api/organizations.py index 74a9a387..57076563 100644 --- a/meraki/aio/api/organizations.py +++ b/meraki/aio/api/organizations.py @@ -2747,6 +2747,58 @@ def getOrganizationDevicesCellularDataDevices(self, organizationId: str, total_p return self._session.get_pages(metadata, resource, params, total_pages, direction) + def getOrganizationDevicesCellularDataProfiles(self, organizationId: str, total_pages=1, direction="next", **kwargs): + """ + **List cellular data management profiles in this organization** + https://developer.cisco.com/meraki/api-v1/#!get-organization-devices-cellular-data-profiles + + - 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 + - profileIds (array): Optional parameter to filter the results by Data Management Profile ID. + - serials (array): Devices to find Cellular Data Management Profiles for. + - perPage (integer): The number of entries per page returned. Acceptable range is 3 - 1000. Default is 100. + - startingAfter (string): A token used by the server to indicate the start of the page. Often this is a timestamp or an ID but it is not limited to those. This parameter should not be defined by client applications. The link for the first, last, prev, or next page in the HTTP Link header should define it. + - endingBefore (string): A token used by the server to indicate the end of the page. Often this is a timestamp or an ID but it is not limited to those. This parameter should not be defined by client applications. The link for the first, last, prev, or next page in the HTTP Link header should define it. + """ + + kwargs.update(locals()) + + metadata = { + "tags": ["organizations", "configure", "devices", "cellular", "data", "profiles"], + "operation": "getOrganizationDevicesCellularDataProfiles", + } + organizationId = urllib.parse.quote(str(organizationId), safe="") + resource = f"/organizations/{organizationId}/devices/cellular/data/profiles" + + query_params = [ + "profileIds", + "serials", + "perPage", + "startingAfter", + "endingBefore", + ] + params = {k.strip(): v for k, v in kwargs.items() if k.strip() in query_params} + + array_params = [ + "profileIds", + "serials", + ] + for k, v in kwargs.items(): + if k.strip() in array_params: + params[f"{k.strip()}[]"] = kwargs[f"{k}"] + params.pop(k.strip()) + + if self._session._validate_kwargs: + all_params = query_params + array_params + invalid = [k for k in kwargs if k.strip() not in all_params and k != "self"] + if invalid and self._session._logger: + self._session._logger.warning( + f"getOrganizationDevicesCellularDataProfiles: ignoring unrecognized kwargs: {invalid}" + ) + + return self._session.get_pages(metadata, resource, params, total_pages, direction) + def createOrganizationDevicesCellularDataProfile( self, organizationId: str, name: str, description: str, rules: list, **kwargs ): @@ -2786,16 +2838,18 @@ def createOrganizationDevicesCellularDataProfile( return self._session.post(metadata, resource, payload) - def getOrganizationDevicesCellularDataProfiles(self, organizationId: str, total_pages=1, direction="next", **kwargs): + def getOrganizationDevicesCellularDataProfilesAssignments( + self, organizationId: str, total_pages=1, direction="next", **kwargs + ): """ - **List cellular data management profiles in this organization** - https://developer.cisco.com/meraki/api-v1/#!get-organization-devices-cellular-data-profiles + **List Cellular Data Management Profile assignments in this organization** + https://developer.cisco.com/meraki/api-v1/#!get-organization-devices-cellular-data-profiles-assignments - 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 - - profileIds (array): Optional parameter to filter the results by Data Management Profile ID. - - serials (array): Devices to find Cellular Data Management Profiles for. + - profileIds (array): Optional parameter to find assignments by Profile IDs. Maximum 1000 profile IDs. + - serials (array): Optional parameter to find assignments by Device Serials. Maximum 1000 serials. - perPage (integer): The number of entries per page returned. Acceptable range is 3 - 1000. 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. @@ -2804,11 +2858,11 @@ def getOrganizationDevicesCellularDataProfiles(self, organizationId: str, total_ kwargs.update(locals()) metadata = { - "tags": ["organizations", "configure", "devices", "cellular", "data", "profiles"], - "operation": "getOrganizationDevicesCellularDataProfiles", + "tags": ["organizations", "configure", "devices", "cellular", "data", "profiles", "assignments"], + "operation": "getOrganizationDevicesCellularDataProfilesAssignments", } organizationId = urllib.parse.quote(str(organizationId), safe="") - resource = f"/organizations/{organizationId}/devices/cellular/data/profiles" + resource = f"/organizations/{organizationId}/devices/cellular/data/profiles/assignments" query_params = [ "profileIds", @@ -2833,29 +2887,76 @@ def getOrganizationDevicesCellularDataProfiles(self, organizationId: str, total_ invalid = [k for k in kwargs if k.strip() not in all_params and k != "self"] if invalid and self._session._logger: self._session._logger.warning( - f"getOrganizationDevicesCellularDataProfiles: ignoring unrecognized kwargs: {invalid}" + f"getOrganizationDevicesCellularDataProfilesAssignments: ignoring unrecognized kwargs: {invalid}" ) return self._session.get_pages(metadata, resource, params, total_pages, direction) - def deleteOrganizationDevicesCellularDataProfile(self, organizationId: str, profileId: str): + def batchOrganizationDevicesCellularDataProfilesAssignmentsCreate(self, organizationId: str, items: list, **kwargs): """ - **Delete a cellular data management profile from this organization** - https://developer.cisco.com/meraki/api-v1/#!delete-organization-devices-cellular-data-profile + **Assign devices to a Cellular Data Management Profile in batch** + https://developer.cisco.com/meraki/api-v1/#!batch-organization-devices-cellular-data-profiles-assignments-create - organizationId (string): Organization ID - - profileId (string): Profile ID + - items (array): List of device-to-profile assignments to create. """ + kwargs = locals() + metadata = { - "tags": ["organizations", "configure", "devices", "cellular", "data", "profiles"], - "operation": "deleteOrganizationDevicesCellularDataProfile", + "tags": ["organizations", "configure", "devices", "cellular", "data", "profiles", "assignments"], + "operation": "batchOrganizationDevicesCellularDataProfilesAssignmentsCreate", } organizationId = urllib.parse.quote(str(organizationId), safe="") - profileId = urllib.parse.quote(str(profileId), safe="") - resource = f"/organizations/{organizationId}/devices/cellular/data/profiles/{profileId}" + resource = f"/organizations/{organizationId}/devices/cellular/data/profiles/assignments/batchCreate" - return self._session.delete(metadata, resource) + body_params = [ + "items", + ] + payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params} + + if self._session._validate_kwargs: + all_params = [] + body_params + invalid = [k for k in kwargs if k.strip() not in all_params and k != "self"] + if invalid and self._session._logger: + self._session._logger.warning( + f"batchOrganizationDevicesCellularDataProfilesAssignmentsCreate: ignoring unrecognized kwargs: {invalid}" + ) + + return self._session.post(metadata, resource, payload) + + def bulkOrganizationDevicesCellularDataProfilesAssignmentsDelete(self, organizationId: str, items: list, **kwargs): + """ + **Unassign devices from a Cellular Data Management Profile in batch** + https://developer.cisco.com/meraki/api-v1/#!bulk-organization-devices-cellular-data-profiles-assignments-delete + + - organizationId (string): Organization ID + - items (array): List of device-to-profile assignments to remove. + """ + + kwargs = locals() + + metadata = { + "tags": ["organizations", "configure", "devices", "cellular", "data", "profiles", "assignments"], + "operation": "bulkOrganizationDevicesCellularDataProfilesAssignmentsDelete", + } + organizationId = urllib.parse.quote(str(organizationId), safe="") + resource = f"/organizations/{organizationId}/devices/cellular/data/profiles/assignments/bulkDelete" + + body_params = [ + "items", + ] + payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params} + + if self._session._validate_kwargs: + all_params = [] + body_params + invalid = [k for k in kwargs if k.strip() not in all_params and k != "self"] + if invalid and self._session._logger: + self._session._logger.warning( + f"bulkOrganizationDevicesCellularDataProfilesAssignmentsDelete: ignoring unrecognized kwargs: {invalid}" + ) + + return self._session.post(metadata, resource, payload) def updateOrganizationDevicesCellularDataProfile(self, organizationId: str, rules: list, profileId: str, **kwargs): """ @@ -2895,6 +2996,284 @@ def updateOrganizationDevicesCellularDataProfile(self, organizationId: str, rule return self._session.put(metadata, resource, payload) + def deleteOrganizationDevicesCellularDataProfile(self, organizationId: str, profileId: str): + """ + **Delete a cellular data management profile from this organization** + https://developer.cisco.com/meraki/api-v1/#!delete-organization-devices-cellular-data-profile + + - organizationId (string): Organization ID + - profileId (string): Profile ID + """ + + metadata = { + "tags": ["organizations", "configure", "devices", "cellular", "data", "profiles"], + "operation": "deleteOrganizationDevicesCellularDataProfile", + } + organizationId = urllib.parse.quote(str(organizationId), safe="") + profileId = urllib.parse.quote(str(profileId), safe="") + resource = f"/organizations/{organizationId}/devices/cellular/data/profiles/{profileId}" + + return self._session.delete(metadata, resource) + + def getOrganizationDevicesCellularDataUsageByDevice(self, organizationId: str, total_pages=1, direction="next", **kwargs): + """ + **List current cellular data usage for devices in this organization** + https://developer.cisco.com/meraki/api-v1/#!get-organization-devices-cellular-data-usage-by-device + + - organizationId (string): Organization ID + - total_pages (integer or string): use with perPage to get total results up to total_pages*perPage; -1 or "all" for all pages + - direction (string): direction to paginate, either "next" (default) or "prev" page + - serials (array): Filter the results by device serials. Maximum 1000 serials. + - perPage (integer): The number of entries per page returned. Acceptable range is 3 - 1000. Default is 100. + - startingAfter (string): A token used by the server to indicate the start of the page. Often this is a timestamp or an ID but it is not limited to those. This parameter should not be defined by client applications. The link for the first, last, prev, or next page in the HTTP Link header should define it. + - endingBefore (string): A token used by the server to indicate the end of the page. Often this is a timestamp or an ID but it is not limited to those. This parameter should not be defined by client applications. The link for the first, last, prev, or next page in the HTTP Link header should define it. + """ + + kwargs.update(locals()) + + metadata = { + "tags": ["organizations", "monitor", "devices", "cellular", "data", "usage", "byDevice"], + "operation": "getOrganizationDevicesCellularDataUsageByDevice", + } + organizationId = urllib.parse.quote(str(organizationId), safe="") + resource = f"/organizations/{organizationId}/devices/cellular/data/usage/byDevice" + + query_params = [ + "serials", + "perPage", + "startingAfter", + "endingBefore", + ] + params = {k.strip(): v for k, v in kwargs.items() if k.strip() in query_params} + + array_params = [ + "serials", + ] + for k, v in kwargs.items(): + if k.strip() in array_params: + params[f"{k.strip()}[]"] = kwargs[f"{k}"] + params.pop(k.strip()) + + if self._session._validate_kwargs: + all_params = query_params + array_params + invalid = [k for k in kwargs if k.strip() not in all_params and k != "self"] + if invalid and self._session._logger: + self._session._logger.warning( + f"getOrganizationDevicesCellularDataUsageByDevice: ignoring unrecognized kwargs: {invalid}" + ) + + return self._session.get_pages(metadata, resource, params, total_pages, direction) + + def getOrganizationDevicesCellularDataUsageHistoryByDeviceByInterval( + self, organizationId: str, serials: list, total_pages=1, direction="next", **kwargs + ): + """ + **List historical cellular data usage grouped by device and interval in this organization** + https://developer.cisco.com/meraki/api-v1/#!get-organization-devices-cellular-data-usage-history-by-device-by-interval + + - organizationId (string): Organization ID + - serials (array): Required parameter to filter the results by device serials. Maximum 10 serials. + - 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 - 10. Default is 5. + - 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. + - t0 (string): The beginning of the timespan for the data. The maximum lookback period is 366 days from today. + - t1 (string): The end of the timespan for the data. t1 can be a maximum of 31 days after t0. + - timespan (number): The timespan for which the information will be fetched. If specifying timespan, do not specify parameters t0 and t1. The value must be in seconds and be less than or equal to 31 days. The default is 1 day. If interval is provided, the timespan will be autocalculated. + - interval (integer): The time interval in seconds for returned data. The valid intervals are: 300, 1200, 14400, 86400. The default is 86400. Interval is calculated if time params are provided. + """ + + kwargs.update(locals()) + + metadata = { + "tags": ["organizations", "monitor", "devices", "cellular", "data", "usage", "history", "byDevice", "byInterval"], + "operation": "getOrganizationDevicesCellularDataUsageHistoryByDeviceByInterval", + } + organizationId = urllib.parse.quote(str(organizationId), safe="") + resource = f"/organizations/{organizationId}/devices/cellular/data/usage/history/byDevice/byInterval" + + query_params = [ + "serials", + "perPage", + "startingAfter", + "endingBefore", + "t0", + "t1", + "timespan", + "interval", + ] + params = {k.strip(): v for k, v in kwargs.items() if k.strip() in query_params} + + array_params = [ + "serials", + ] + for k, v in kwargs.items(): + if k.strip() in array_params: + params[f"{k.strip()}[]"] = kwargs[f"{k}"] + params.pop(k.strip()) + + if self._session._validate_kwargs: + all_params = query_params + array_params + invalid = [k for k in kwargs if k.strip() not in all_params and k != "self"] + if invalid and self._session._logger: + self._session._logger.warning( + f"getOrganizationDevicesCellularDataUsageHistoryByDeviceByInterval: ignoring unrecognized kwargs: {invalid}" + ) + + return self._session.get_pages(metadata, resource, params, total_pages, direction) + + def getOrganizationDevicesCellularGeolocations(self, organizationId: str, total_pages=1, direction="next", **kwargs): + """ + **List the latest cellular geolocation telemetry for devices in an organization** + https://developer.cisco.com/meraki/api-v1/#!get-organization-devices-cellular-geolocations + + - 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 + - serials (array): Optional parameter to filter the results by device serials. Maximum 1000 serials. + - perPage (integer): The number of entries per page returned. Acceptable range is 3 - 1000. Default is 100. + - startingAfter (string): A token used by the server to indicate the start of the page. Often this is a timestamp or an ID but it is not limited to those. This parameter should not be defined by client applications. The link for the first, last, prev, or next page in the HTTP Link header should define it. + - endingBefore (string): A token used by the server to indicate the end of the page. Often this is a timestamp or an ID but it is not limited to those. This parameter should not be defined by client applications. The link for the first, last, prev, or next page in the HTTP Link header should define it. + """ + + kwargs.update(locals()) + + metadata = { + "tags": ["organizations", "monitor", "devices", "cellular", "geolocations"], + "operation": "getOrganizationDevicesCellularGeolocations", + } + organizationId = urllib.parse.quote(str(organizationId), safe="") + resource = f"/organizations/{organizationId}/devices/cellular/geolocations" + + query_params = [ + "serials", + "perPage", + "startingAfter", + "endingBefore", + ] + params = {k.strip(): v for k, v in kwargs.items() if k.strip() in query_params} + + array_params = [ + "serials", + ] + for k, v in kwargs.items(): + if k.strip() in array_params: + params[f"{k.strip()}[]"] = kwargs[f"{k}"] + params.pop(k.strip()) + + if self._session._validate_kwargs: + all_params = query_params + array_params + invalid = [k for k in kwargs if k.strip() not in all_params and k != "self"] + if invalid and self._session._logger: + self._session._logger.warning( + f"getOrganizationDevicesCellularGeolocations: ignoring unrecognized kwargs: {invalid}" + ) + + return self._session.get_pages(metadata, resource, params, total_pages, direction) + + def getOrganizationDevicesCellularUplinksBandsByDevice( + self, organizationId: str, total_pages=1, direction="next", **kwargs + ): + """ + **List the latest cellular uplink signal information for devices in an organization** + https://developer.cisco.com/meraki/api-v1/#!get-organization-devices-cellular-uplinks-bands-by-device + + - organizationId (string): Organization ID + - total_pages (integer or string): use with perPage to get total results up to total_pages*perPage; -1 or "all" for all pages + - direction (string): direction to paginate, either "next" (default) or "prev" page + - serials (array): Optional parameter to filter the results by device serials. Maximum 1000 serials. + - perPage (integer): The number of entries per page returned. Acceptable range is 3 - 1000. Default is 100. + - startingAfter (string): A token used by the server to indicate the start of the page. Often this is a timestamp or an ID but it is not limited to those. This parameter should not be defined by client applications. The link for the first, last, prev, or next page in the HTTP Link header should define it. + - endingBefore (string): A token used by the server to indicate the end of the page. Often this is a timestamp or an ID but it is not limited to those. This parameter should not be defined by client applications. The link for the first, last, prev, or next page in the HTTP Link header should define it. + """ + + kwargs.update(locals()) + + metadata = { + "tags": ["organizations", "monitor", "devices", "cellular", "uplinks", "bands", "byDevice"], + "operation": "getOrganizationDevicesCellularUplinksBandsByDevice", + } + organizationId = urllib.parse.quote(str(organizationId), safe="") + resource = f"/organizations/{organizationId}/devices/cellular/uplinks/bands/byDevice" + + query_params = [ + "serials", + "perPage", + "startingAfter", + "endingBefore", + ] + params = {k.strip(): v for k, v in kwargs.items() if k.strip() in query_params} + + array_params = [ + "serials", + ] + for k, v in kwargs.items(): + if k.strip() in array_params: + params[f"{k.strip()}[]"] = kwargs[f"{k}"] + params.pop(k.strip()) + + if self._session._validate_kwargs: + all_params = query_params + array_params + invalid = [k for k in kwargs if k.strip() not in all_params and k != "self"] + if invalid and self._session._logger: + self._session._logger.warning( + f"getOrganizationDevicesCellularUplinksBandsByDevice: ignoring unrecognized kwargs: {invalid}" + ) + + return self._session.get_pages(metadata, resource, params, total_pages, direction) + + def getOrganizationDevicesCellularUplinksTowersByDevice( + self, organizationId: str, total_pages=1, direction="next", **kwargs + ): + """ + **List the latest cellular tower information for devices in an organization** + https://developer.cisco.com/meraki/api-v1/#!get-organization-devices-cellular-uplinks-towers-by-device + + - organizationId (string): Organization ID + - total_pages (integer or string): use with perPage to get total results up to total_pages*perPage; -1 or "all" for all pages + - direction (string): direction to paginate, either "next" (default) or "prev" page + - serials (array): Optional parameter to filter the results by device serials. Maximum 1000 serials. + - perPage (integer): The number of entries per page returned. Acceptable range is 3 - 1000. Default is 100. + - startingAfter (string): A token used by the server to indicate the start of the page. Often this is a timestamp or an ID but it is not limited to those. This parameter should not be defined by client applications. The link for the first, last, prev, or next page in the HTTP Link header should define it. + - endingBefore (string): A token used by the server to indicate the end of the page. Often this is a timestamp or an ID but it is not limited to those. This parameter should not be defined by client applications. The link for the first, last, prev, or next page in the HTTP Link header should define it. + """ + + kwargs.update(locals()) + + metadata = { + "tags": ["organizations", "monitor", "devices", "cellular", "uplinks", "towers", "byDevice"], + "operation": "getOrganizationDevicesCellularUplinksTowersByDevice", + } + organizationId = urllib.parse.quote(str(organizationId), safe="") + resource = f"/organizations/{organizationId}/devices/cellular/uplinks/towers/byDevice" + + query_params = [ + "serials", + "perPage", + "startingAfter", + "endingBefore", + ] + params = {k.strip(): v for k, v in kwargs.items() if k.strip() in query_params} + + array_params = [ + "serials", + ] + for k, v in kwargs.items(): + if k.strip() in array_params: + params[f"{k.strip()}[]"] = kwargs[f"{k}"] + params.pop(k.strip()) + + if self._session._validate_kwargs: + all_params = query_params + array_params + invalid = [k for k in kwargs if k.strip() not in all_params and k != "self"] + if invalid and self._session._logger: + self._session._logger.warning( + f"getOrganizationDevicesCellularUplinksTowersByDevice: ignoring unrecognized kwargs: {invalid}" + ) + + return self._session.get_pages(metadata, resource, params, total_pages, direction) + def createOrganizationDevicesControllerMigration(self, organizationId: str, serials: list, target: str, **kwargs): """ **Migrate devices to another controller or management mode** diff --git a/meraki/aio/api/switch.py b/meraki/aio/api/switch.py index 27071f3b..b164485f 100644 --- a/meraki/aio/api/switch.py +++ b/meraki/aio/api/switch.py @@ -25,7 +25,7 @@ def getDeviceSwitchPorts(self, serial: str): def cycleDeviceSwitchPorts(self, serial: str, ports: list, **kwargs): """ - **Cycle a set of switch ports** + **Cycle a set of switch ports on non-Catalyst MS devices** https://developer.cisco.com/meraki/api-v1/#!cycle-device-switch-ports - serial (string): Serial diff --git a/meraki/api/appliance.py b/meraki/api/appliance.py index 620c45eb..88d35b2b 100644 --- a/meraki/api/appliance.py +++ b/meraki/api/appliance.py @@ -2488,6 +2488,7 @@ def createNetworkApplianceVlan(self, networkId: str, id: str, name: str, **kwarg - dhcpBootNextServer (string): DHCP boot option to direct boot clients to the server to load the boot file from - dhcpBootFilename (string): DHCP boot option for boot filename - 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. + - vrf (object): VRF configuration on the VLAN - uplinks (array): Per-uplink NAT exception override configuration on the VLAN. Applicable only for networks that support NAT exceptions. """ @@ -2534,6 +2535,7 @@ def createNetworkApplianceVlan(self, networkId: str, id: str, name: str, **kwarg "dhcpBootNextServer", "dhcpBootFilename", "dhcpOptions", + "vrf", "uplinks", ] payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params} @@ -2640,6 +2642,7 @@ def updateNetworkApplianceVlan(self, networkId: str, vlanId: str, **kwargs): - 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 - 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 + - vrf (object): VRF configuration on the VLAN - uplinks (array): Per-uplink NAT exception override configuration on the VLAN. Applicable only for networks that support NAT exceptions. """ @@ -2690,6 +2693,7 @@ def updateNetworkApplianceVlan(self, networkId: str, vlanId: str, **kwargs): "mask", "ipv6", "mandatoryDhcp", + "vrf", "uplinks", ] payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params} @@ -3628,6 +3632,56 @@ def getOrganizationApplianceFirewallMulticastForwardingByNetwork( return self._session.get_pages(metadata, resource, params, total_pages, direction) + def getOrganizationApplianceRoutingVrfsSettings(self, organizationId: str): + """ + **Return the VRF setting for an organization.** + https://developer.cisco.com/meraki/api-v1/#!get-organization-appliance-routing-vrfs-settings + + - organizationId (string): Organization ID + """ + + metadata = { + "tags": ["appliance", "configure", "routing", "vrfs", "settings"], + "operation": "getOrganizationApplianceRoutingVrfsSettings", + } + organizationId = urllib.parse.quote(str(organizationId), safe="") + resource = f"/organizations/{organizationId}/appliance/routing/vrfs/settings" + + return self._session.get(metadata, resource) + + def updateOrganizationApplianceRoutingVrfsSettings(self, organizationId: str, enabled: bool, **kwargs): + """ + **Update the VRF setting for an organization.** + https://developer.cisco.com/meraki/api-v1/#!update-organization-appliance-routing-vrfs-settings + + - organizationId (string): Organization ID + - enabled (boolean): Boolean indicating whether VRFs are enabled for the organization. + """ + + kwargs = locals() + + metadata = { + "tags": ["appliance", "configure", "routing", "vrfs", "settings"], + "operation": "updateOrganizationApplianceRoutingVrfsSettings", + } + organizationId = urllib.parse.quote(str(organizationId), safe="") + resource = f"/organizations/{organizationId}/appliance/routing/vrfs/settings" + + body_params = [ + "enabled", + ] + payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params} + + if self._session._validate_kwargs: + all_params = [] + body_params + invalid = [k for k in kwargs if k.strip() not in all_params and k != "self"] + if invalid and self._session._logger: + self._session._logger.warning( + f"updateOrganizationApplianceRoutingVrfsSettings: ignoring unrecognized kwargs: {invalid}" + ) + + return self._session.put(metadata, resource, payload) + def getOrganizationApplianceSecurityEvents(self, organizationId: str, total_pages=1, direction="next", **kwargs): """ **List the security events for an organization** diff --git a/meraki/api/batch/appliance.py b/meraki/api/batch/appliance.py index 585380d9..3e5585e0 100644 --- a/meraki/api/batch/appliance.py +++ b/meraki/api/batch/appliance.py @@ -853,6 +853,7 @@ def createNetworkApplianceVlan(self, networkId: str, id: str, name: str, **kwarg - dhcpBootNextServer (string): DHCP boot option to direct boot clients to the server to load the boot file from - dhcpBootFilename (string): DHCP boot option for boot filename - 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. + - vrf (object): VRF configuration on the VLAN - uplinks (array): Per-uplink NAT exception override configuration on the VLAN. Applicable only for networks that support NAT exceptions. """ @@ -895,6 +896,7 @@ def createNetworkApplianceVlan(self, networkId: str, id: str, name: str, **kwarg "dhcpBootNextServer", "dhcpBootFilename", "dhcpOptions", + "vrf", "uplinks", ] payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params} @@ -957,6 +959,7 @@ def updateNetworkApplianceVlan(self, networkId: str, vlanId: str, **kwargs): - 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 - 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 + - vrf (object): VRF configuration on the VLAN - uplinks (array): Per-uplink NAT exception override configuration on the VLAN. Applicable only for networks that support NAT exceptions. """ @@ -1003,6 +1006,7 @@ def updateNetworkApplianceVlan(self, networkId: str, vlanId: str, **kwargs): "mask", "ipv6", "mandatoryDhcp", + "vrf", "uplinks", ] payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params} @@ -1485,6 +1489,31 @@ def deleteOrganizationApplianceDnsSplitProfile(self, organizationId: str, profil } return action + def updateOrganizationApplianceRoutingVrfsSettings(self, organizationId: str, enabled: bool, **kwargs): + """ + **Update the VRF setting for an organization.** + https://developer.cisco.com/meraki/api-v1/#!update-organization-appliance-routing-vrfs-settings + + - organizationId (string): Organization ID + - enabled (boolean): Boolean indicating whether VRFs are enabled for the organization. + """ + + kwargs = locals() + + organizationId = urllib.parse.quote(organizationId, safe="") + resource = f"/organizations/{organizationId}/appliance/routing/vrfs/settings" + + body_params = [ + "enabled", + ] + 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 updateOrganizationApplianceVpnSiteToSiteIpsecPeersSlas(self, organizationId: str, **kwargs): """ **Update the IPsec SLA policies for an organization** diff --git a/meraki/api/batch/devices.py b/meraki/api/batch/devices.py index 026f19b4..edc67a68 100644 --- a/meraki/api/batch/devices.py +++ b/meraki/api/batch/devices.py @@ -46,6 +46,67 @@ def updateDevice(self, serial: str, **kwargs): } return action + def updateDeviceCellularGeolocations(self, serial: str, enabled: bool, **kwargs): + """ + **Update the enablement of the geolocation feature for a device** + https://developer.cisco.com/meraki/api-v1/#!update-device-cellular-geolocations + + - serial (string): Serial + - enabled (boolean): Required parameter for the state to update the geolocation settings to (true to enable, false to disable) + """ + + kwargs = locals() + + serial = urllib.parse.quote(serial, safe="") + resource = f"/devices/{serial}/cellular/geolocations" + + body_params = [ + "enabled", + ] + 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 createDeviceCellularUplinksBandsMasksUpdate(self, serial: str, slot: str, type: str, masked: list, **kwargs): + """ + **Update the cellular band masks for a device** + https://developer.cisco.com/meraki/api-v1/#!create-device-cellular-uplinks-bands-masks-update + + - serial (string): Serial + - slot (string): Required parameter for the SIM slot to update the cellular band mask for + - type (string): Required parameter for the signal type to update the cellular band mask for + - masked (array): Required parameter for the band identifiers to mask for the given SIM slot and signal type. For LTE use bands identifiers like '30' and for 5G use band identifiers like 'n30'. Maximum 256 bands. + """ + + kwargs = locals() + + if "slot" in kwargs: + options = ["sim1", "sim2", "sim3"] + assert kwargs["slot"] in options, f'''"slot" cannot be "{kwargs["slot"]}", & must be set to one of: {options}''' + if "type" in kwargs: + options = ["5GNSA", "5GSA", "LTE"] + assert kwargs["type"] in options, f'''"type" cannot be "{kwargs["type"]}", & must be set to one of: {options}''' + + serial = urllib.parse.quote(serial, safe="") + resource = f"/devices/{serial}/cellular/uplinks/bands/masks/update" + + body_params = [ + "slot", + "type", + "masked", + ] + 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 createDeviceLiveToolsLedsBlink(self, serial: str, duration: int, **kwargs): """ **Enqueue a job to blink LEDs on a device. This endpoint has a rate limit of one request every 10 seconds.** diff --git a/meraki/api/batch/organizations.py b/meraki/api/batch/organizations.py index 9041517f..4b8adf62 100644 --- a/meraki/api/batch/organizations.py +++ b/meraki/api/batch/organizations.py @@ -630,18 +630,44 @@ def createOrganizationDevicesCellularDataProfile( } return action - def deleteOrganizationDevicesCellularDataProfile(self, organizationId: str, profileId: str): + def batchOrganizationDevicesCellularDataProfilesAssignmentsCreate(self, organizationId: str, items: list, **kwargs): """ - **Delete a cellular data management profile from this organization. Removes the profile, including its associated rules and node assignments, and notifies affected devices of the resulting configuration change.** - https://developer.cisco.com/meraki/api-v1/#!delete-organization-devices-cellular-data-profile + **Assign devices to a Cellular Data Management Profile in batch. Creates up to 100 device-to-profile assignments and returns the created assignment IDs.** + https://developer.cisco.com/meraki/api-v1/#!batch-organization-devices-cellular-data-profiles-assignments-create - organizationId (string): Organization ID - - profileId (string): Profile ID + - items (array): List of device-to-profile assignments to create. """ + kwargs = locals() + organizationId = urllib.parse.quote(organizationId, safe="") - profileId = urllib.parse.quote(profileId, safe="") - resource = f"/organizations/{organizationId}/devices/cellular/data/profiles/{profileId}" + resource = f"/organizations/{organizationId}/devices/cellular/data/profiles/assignments/batchCreate" + + body_params = [ + "items", + ] + 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 bulkOrganizationDevicesCellularDataProfilesAssignmentsDelete(self, organizationId: str, items: list, **kwargs): + """ + **Unassign devices from a Cellular Data Management Profile in batch. Removes up to 100 device-to-profile assignments and returns no response body on success.** + https://developer.cisco.com/meraki/api-v1/#!bulk-organization-devices-cellular-data-profiles-assignments-delete + + - organizationId (string): Organization ID + - items (array): List of device-to-profile assignments to remove. + """ + + kwargs = locals() + + organizationId = urllib.parse.quote(organizationId, safe="") + resource = f"/organizations/{organizationId}/devices/cellular/data/profiles/assignments/bulkDelete" action = { "resource": resource, @@ -679,6 +705,25 @@ def updateOrganizationDevicesCellularDataProfile(self, organizationId: str, rule } return action + def deleteOrganizationDevicesCellularDataProfile(self, organizationId: str, profileId: str): + """ + **Delete a cellular data management profile from this organization. Removes the profile, including its associated rules and node assignments, and notifies affected devices of the resulting configuration change.** + https://developer.cisco.com/meraki/api-v1/#!delete-organization-devices-cellular-data-profile + + - organizationId (string): Organization ID + - profileId (string): Profile ID + """ + + organizationId = urllib.parse.quote(organizationId, safe="") + profileId = urllib.parse.quote(profileId, safe="") + resource = f"/organizations/{organizationId}/devices/cellular/data/profiles/{profileId}" + + action = { + "resource": resource, + "operation": "destroy", + } + return action + def createOrganizationDevicesControllerMigration(self, organizationId: str, serials: list, target: str, **kwargs): """ **Migrate devices to another controller or management mode** diff --git a/meraki/api/batch/switch.py b/meraki/api/batch/switch.py index 436f449e..c469c7ba 100644 --- a/meraki/api/batch/switch.py +++ b/meraki/api/batch/switch.py @@ -7,7 +7,7 @@ def __init__(self): def cycleDeviceSwitchPorts(self, serial: str, ports: list, **kwargs): """ - **Cycle a set of switch ports** + **Cycle a set of switch ports on non-Catalyst MS devices. For Catalyst support, use /devices/{serial}/liveTools/ports/cycle, which supports all switch product families.** https://developer.cisco.com/meraki/api-v1/#!cycle-device-switch-ports - serial (string): Serial diff --git a/meraki/api/batch/wireless.py b/meraki/api/batch/wireless.py index 7f0b4308..f2983d22 100644 --- a/meraki/api/batch/wireless.py +++ b/meraki/api/batch/wireless.py @@ -144,7 +144,7 @@ def createNetworkWirelessAirMarshalRule(self, networkId: str, type: str, match: payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params} action = { "resource": resource, - "operation": "update", + "operation": "create", "body": payload, } return action diff --git a/meraki/api/devices.py b/meraki/api/devices.py index a972f626..ab404ce2 100644 --- a/meraki/api/devices.py +++ b/meraki/api/devices.py @@ -105,6 +105,37 @@ def blinkDeviceLeds(self, serial: str, **kwargs): return self._session.post(metadata, resource, payload) + def updateDeviceCellularGeolocations(self, serial: str, enabled: bool, **kwargs): + """ + **Update the enablement of the geolocation feature for a device** + https://developer.cisco.com/meraki/api-v1/#!update-device-cellular-geolocations + + - serial (string): Serial + - enabled (boolean): Required parameter for the state to update the geolocation settings to (true to enable, false to disable) + """ + + kwargs = locals() + + metadata = { + "tags": ["devices", "configure", "cellular", "geolocations"], + "operation": "updateDeviceCellularGeolocations", + } + serial = urllib.parse.quote(str(serial), safe="") + resource = f"/devices/{serial}/cellular/geolocations" + + body_params = [ + "enabled", + ] + payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params} + + if self._session._validate_kwargs: + all_params = [] + body_params + invalid = [k for k in kwargs if k.strip() not in all_params and k != "self"] + if invalid and self._session._logger: + self._session._logger.warning(f"updateDeviceCellularGeolocations: ignoring unrecognized kwargs: {invalid}") + + return self._session.put(metadata, resource, payload) + def getDeviceCellularSims(self, serial: str): """ **Return the SIM and APN configurations for a cellular device.** @@ -157,6 +188,50 @@ def updateDeviceCellularSims(self, serial: str, **kwargs): return self._session.put(metadata, resource, payload) + def createDeviceCellularUplinksBandsMasksUpdate(self, serial: str, slot: str, type: str, masked: list, **kwargs): + """ + **Update the cellular band masks for a device** + https://developer.cisco.com/meraki/api-v1/#!create-device-cellular-uplinks-bands-masks-update + + - serial (string): Serial + - slot (string): Required parameter for the SIM slot to update the cellular band mask for + - type (string): Required parameter for the signal type to update the cellular band mask for + - masked (array): Required parameter for the band identifiers to mask for the given SIM slot and signal type. For LTE use bands identifiers like '30' and for 5G use band identifiers like 'n30'. Maximum 256 bands. + """ + + kwargs = locals() + + if "slot" in kwargs: + options = ["sim1", "sim2", "sim3"] + assert kwargs["slot"] in options, f'''"slot" cannot be "{kwargs["slot"]}", & must be set to one of: {options}''' + if "type" in kwargs: + options = ["5GNSA", "5GSA", "LTE"] + assert kwargs["type"] in options, f'''"type" cannot be "{kwargs["type"]}", & must be set to one of: {options}''' + + metadata = { + "tags": ["devices", "configure", "cellular", "uplinks", "bands", "masks", "update"], + "operation": "createDeviceCellularUplinksBandsMasksUpdate", + } + serial = urllib.parse.quote(str(serial), safe="") + resource = f"/devices/{serial}/cellular/uplinks/bands/masks/update" + + body_params = [ + "slot", + "type", + "masked", + ] + payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params} + + if self._session._validate_kwargs: + all_params = [] + body_params + invalid = [k for k in kwargs if k.strip() not in all_params and k != "self"] + if invalid and self._session._logger: + self._session._logger.warning( + f"createDeviceCellularUplinksBandsMasksUpdate: ignoring unrecognized kwargs: {invalid}" + ) + + return self._session.post(metadata, resource, payload) + def getDeviceClients(self, serial: str, **kwargs): """ **List the clients of a device, up to a maximum of a month ago** diff --git a/meraki/api/organizations.py b/meraki/api/organizations.py index 8190a410..ae425f85 100644 --- a/meraki/api/organizations.py +++ b/meraki/api/organizations.py @@ -2747,6 +2747,58 @@ def getOrganizationDevicesCellularDataDevices(self, organizationId: str, total_p return self._session.get_pages(metadata, resource, params, total_pages, direction) + def getOrganizationDevicesCellularDataProfiles(self, organizationId: str, total_pages=1, direction="next", **kwargs): + """ + **List cellular data management profiles in this organization** + https://developer.cisco.com/meraki/api-v1/#!get-organization-devices-cellular-data-profiles + + - 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 + - profileIds (array): Optional parameter to filter the results by Data Management Profile ID. + - serials (array): Devices to find Cellular Data Management Profiles for. + - perPage (integer): The number of entries per page returned. Acceptable range is 3 - 1000. Default is 100. + - startingAfter (string): A token used by the server to indicate the start of the page. Often this is a timestamp or an ID but it is not limited to those. This parameter should not be defined by client applications. The link for the first, last, prev, or next page in the HTTP Link header should define it. + - endingBefore (string): A token used by the server to indicate the end of the page. Often this is a timestamp or an ID but it is not limited to those. This parameter should not be defined by client applications. The link for the first, last, prev, or next page in the HTTP Link header should define it. + """ + + kwargs.update(locals()) + + metadata = { + "tags": ["organizations", "configure", "devices", "cellular", "data", "profiles"], + "operation": "getOrganizationDevicesCellularDataProfiles", + } + organizationId = urllib.parse.quote(str(organizationId), safe="") + resource = f"/organizations/{organizationId}/devices/cellular/data/profiles" + + query_params = [ + "profileIds", + "serials", + "perPage", + "startingAfter", + "endingBefore", + ] + params = {k.strip(): v for k, v in kwargs.items() if k.strip() in query_params} + + array_params = [ + "profileIds", + "serials", + ] + for k, v in kwargs.items(): + if k.strip() in array_params: + params[f"{k.strip()}[]"] = kwargs[f"{k}"] + params.pop(k.strip()) + + if self._session._validate_kwargs: + all_params = query_params + array_params + invalid = [k for k in kwargs if k.strip() not in all_params and k != "self"] + if invalid and self._session._logger: + self._session._logger.warning( + f"getOrganizationDevicesCellularDataProfiles: ignoring unrecognized kwargs: {invalid}" + ) + + return self._session.get_pages(metadata, resource, params, total_pages, direction) + def createOrganizationDevicesCellularDataProfile( self, organizationId: str, name: str, description: str, rules: list, **kwargs ): @@ -2786,16 +2838,18 @@ def createOrganizationDevicesCellularDataProfile( return self._session.post(metadata, resource, payload) - def getOrganizationDevicesCellularDataProfiles(self, organizationId: str, total_pages=1, direction="next", **kwargs): + def getOrganizationDevicesCellularDataProfilesAssignments( + self, organizationId: str, total_pages=1, direction="next", **kwargs + ): """ - **List cellular data management profiles in this organization** - https://developer.cisco.com/meraki/api-v1/#!get-organization-devices-cellular-data-profiles + **List Cellular Data Management Profile assignments in this organization** + https://developer.cisco.com/meraki/api-v1/#!get-organization-devices-cellular-data-profiles-assignments - 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 - - profileIds (array): Optional parameter to filter the results by Data Management Profile ID. - - serials (array): Devices to find Cellular Data Management Profiles for. + - profileIds (array): Optional parameter to find assignments by Profile IDs. Maximum 1000 profile IDs. + - serials (array): Optional parameter to find assignments by Device Serials. Maximum 1000 serials. - perPage (integer): The number of entries per page returned. Acceptable range is 3 - 1000. 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. @@ -2804,11 +2858,11 @@ def getOrganizationDevicesCellularDataProfiles(self, organizationId: str, total_ kwargs.update(locals()) metadata = { - "tags": ["organizations", "configure", "devices", "cellular", "data", "profiles"], - "operation": "getOrganizationDevicesCellularDataProfiles", + "tags": ["organizations", "configure", "devices", "cellular", "data", "profiles", "assignments"], + "operation": "getOrganizationDevicesCellularDataProfilesAssignments", } organizationId = urllib.parse.quote(str(organizationId), safe="") - resource = f"/organizations/{organizationId}/devices/cellular/data/profiles" + resource = f"/organizations/{organizationId}/devices/cellular/data/profiles/assignments" query_params = [ "profileIds", @@ -2833,29 +2887,76 @@ def getOrganizationDevicesCellularDataProfiles(self, organizationId: str, total_ invalid = [k for k in kwargs if k.strip() not in all_params and k != "self"] if invalid and self._session._logger: self._session._logger.warning( - f"getOrganizationDevicesCellularDataProfiles: ignoring unrecognized kwargs: {invalid}" + f"getOrganizationDevicesCellularDataProfilesAssignments: ignoring unrecognized kwargs: {invalid}" ) return self._session.get_pages(metadata, resource, params, total_pages, direction) - def deleteOrganizationDevicesCellularDataProfile(self, organizationId: str, profileId: str): + def batchOrganizationDevicesCellularDataProfilesAssignmentsCreate(self, organizationId: str, items: list, **kwargs): """ - **Delete a cellular data management profile from this organization** - https://developer.cisco.com/meraki/api-v1/#!delete-organization-devices-cellular-data-profile + **Assign devices to a Cellular Data Management Profile in batch** + https://developer.cisco.com/meraki/api-v1/#!batch-organization-devices-cellular-data-profiles-assignments-create - organizationId (string): Organization ID - - profileId (string): Profile ID + - items (array): List of device-to-profile assignments to create. """ + kwargs = locals() + metadata = { - "tags": ["organizations", "configure", "devices", "cellular", "data", "profiles"], - "operation": "deleteOrganizationDevicesCellularDataProfile", + "tags": ["organizations", "configure", "devices", "cellular", "data", "profiles", "assignments"], + "operation": "batchOrganizationDevicesCellularDataProfilesAssignmentsCreate", } organizationId = urllib.parse.quote(str(organizationId), safe="") - profileId = urllib.parse.quote(str(profileId), safe="") - resource = f"/organizations/{organizationId}/devices/cellular/data/profiles/{profileId}" + resource = f"/organizations/{organizationId}/devices/cellular/data/profiles/assignments/batchCreate" - return self._session.delete(metadata, resource) + body_params = [ + "items", + ] + payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params} + + if self._session._validate_kwargs: + all_params = [] + body_params + invalid = [k for k in kwargs if k.strip() not in all_params and k != "self"] + if invalid and self._session._logger: + self._session._logger.warning( + f"batchOrganizationDevicesCellularDataProfilesAssignmentsCreate: ignoring unrecognized kwargs: {invalid}" + ) + + return self._session.post(metadata, resource, payload) + + def bulkOrganizationDevicesCellularDataProfilesAssignmentsDelete(self, organizationId: str, items: list, **kwargs): + """ + **Unassign devices from a Cellular Data Management Profile in batch** + https://developer.cisco.com/meraki/api-v1/#!bulk-organization-devices-cellular-data-profiles-assignments-delete + + - organizationId (string): Organization ID + - items (array): List of device-to-profile assignments to remove. + """ + + kwargs = locals() + + metadata = { + "tags": ["organizations", "configure", "devices", "cellular", "data", "profiles", "assignments"], + "operation": "bulkOrganizationDevicesCellularDataProfilesAssignmentsDelete", + } + organizationId = urllib.parse.quote(str(organizationId), safe="") + resource = f"/organizations/{organizationId}/devices/cellular/data/profiles/assignments/bulkDelete" + + body_params = [ + "items", + ] + payload = {k.strip(): v for k, v in kwargs.items() if k.strip() in body_params} + + if self._session._validate_kwargs: + all_params = [] + body_params + invalid = [k for k in kwargs if k.strip() not in all_params and k != "self"] + if invalid and self._session._logger: + self._session._logger.warning( + f"bulkOrganizationDevicesCellularDataProfilesAssignmentsDelete: ignoring unrecognized kwargs: {invalid}" + ) + + return self._session.post(metadata, resource, payload) def updateOrganizationDevicesCellularDataProfile(self, organizationId: str, rules: list, profileId: str, **kwargs): """ @@ -2895,6 +2996,284 @@ def updateOrganizationDevicesCellularDataProfile(self, organizationId: str, rule return self._session.put(metadata, resource, payload) + def deleteOrganizationDevicesCellularDataProfile(self, organizationId: str, profileId: str): + """ + **Delete a cellular data management profile from this organization** + https://developer.cisco.com/meraki/api-v1/#!delete-organization-devices-cellular-data-profile + + - organizationId (string): Organization ID + - profileId (string): Profile ID + """ + + metadata = { + "tags": ["organizations", "configure", "devices", "cellular", "data", "profiles"], + "operation": "deleteOrganizationDevicesCellularDataProfile", + } + organizationId = urllib.parse.quote(str(organizationId), safe="") + profileId = urllib.parse.quote(str(profileId), safe="") + resource = f"/organizations/{organizationId}/devices/cellular/data/profiles/{profileId}" + + return self._session.delete(metadata, resource) + + def getOrganizationDevicesCellularDataUsageByDevice(self, organizationId: str, total_pages=1, direction="next", **kwargs): + """ + **List current cellular data usage for devices in this organization** + https://developer.cisco.com/meraki/api-v1/#!get-organization-devices-cellular-data-usage-by-device + + - organizationId (string): Organization ID + - total_pages (integer or string): use with perPage to get total results up to total_pages*perPage; -1 or "all" for all pages + - direction (string): direction to paginate, either "next" (default) or "prev" page + - serials (array): Filter the results by device serials. Maximum 1000 serials. + - perPage (integer): The number of entries per page returned. Acceptable range is 3 - 1000. Default is 100. + - startingAfter (string): A token used by the server to indicate the start of the page. Often this is a timestamp or an ID but it is not limited to those. This parameter should not be defined by client applications. The link for the first, last, prev, or next page in the HTTP Link header should define it. + - endingBefore (string): A token used by the server to indicate the end of the page. Often this is a timestamp or an ID but it is not limited to those. This parameter should not be defined by client applications. The link for the first, last, prev, or next page in the HTTP Link header should define it. + """ + + kwargs.update(locals()) + + metadata = { + "tags": ["organizations", "monitor", "devices", "cellular", "data", "usage", "byDevice"], + "operation": "getOrganizationDevicesCellularDataUsageByDevice", + } + organizationId = urllib.parse.quote(str(organizationId), safe="") + resource = f"/organizations/{organizationId}/devices/cellular/data/usage/byDevice" + + query_params = [ + "serials", + "perPage", + "startingAfter", + "endingBefore", + ] + params = {k.strip(): v for k, v in kwargs.items() if k.strip() in query_params} + + array_params = [ + "serials", + ] + for k, v in kwargs.items(): + if k.strip() in array_params: + params[f"{k.strip()}[]"] = kwargs[f"{k}"] + params.pop(k.strip()) + + if self._session._validate_kwargs: + all_params = query_params + array_params + invalid = [k for k in kwargs if k.strip() not in all_params and k != "self"] + if invalid and self._session._logger: + self._session._logger.warning( + f"getOrganizationDevicesCellularDataUsageByDevice: ignoring unrecognized kwargs: {invalid}" + ) + + return self._session.get_pages(metadata, resource, params, total_pages, direction) + + def getOrganizationDevicesCellularDataUsageHistoryByDeviceByInterval( + self, organizationId: str, serials: list, total_pages=1, direction="next", **kwargs + ): + """ + **List historical cellular data usage grouped by device and interval in this organization** + https://developer.cisco.com/meraki/api-v1/#!get-organization-devices-cellular-data-usage-history-by-device-by-interval + + - organizationId (string): Organization ID + - serials (array): Required parameter to filter the results by device serials. Maximum 10 serials. + - 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 - 10. Default is 5. + - 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. + - t0 (string): The beginning of the timespan for the data. The maximum lookback period is 366 days from today. + - t1 (string): The end of the timespan for the data. t1 can be a maximum of 31 days after t0. + - timespan (number): The timespan for which the information will be fetched. If specifying timespan, do not specify parameters t0 and t1. The value must be in seconds and be less than or equal to 31 days. The default is 1 day. If interval is provided, the timespan will be autocalculated. + - interval (integer): The time interval in seconds for returned data. The valid intervals are: 300, 1200, 14400, 86400. The default is 86400. Interval is calculated if time params are provided. + """ + + kwargs.update(locals()) + + metadata = { + "tags": ["organizations", "monitor", "devices", "cellular", "data", "usage", "history", "byDevice", "byInterval"], + "operation": "getOrganizationDevicesCellularDataUsageHistoryByDeviceByInterval", + } + organizationId = urllib.parse.quote(str(organizationId), safe="") + resource = f"/organizations/{organizationId}/devices/cellular/data/usage/history/byDevice/byInterval" + + query_params = [ + "serials", + "perPage", + "startingAfter", + "endingBefore", + "t0", + "t1", + "timespan", + "interval", + ] + params = {k.strip(): v for k, v in kwargs.items() if k.strip() in query_params} + + array_params = [ + "serials", + ] + for k, v in kwargs.items(): + if k.strip() in array_params: + params[f"{k.strip()}[]"] = kwargs[f"{k}"] + params.pop(k.strip()) + + if self._session._validate_kwargs: + all_params = query_params + array_params + invalid = [k for k in kwargs if k.strip() not in all_params and k != "self"] + if invalid and self._session._logger: + self._session._logger.warning( + f"getOrganizationDevicesCellularDataUsageHistoryByDeviceByInterval: ignoring unrecognized kwargs: {invalid}" + ) + + return self._session.get_pages(metadata, resource, params, total_pages, direction) + + def getOrganizationDevicesCellularGeolocations(self, organizationId: str, total_pages=1, direction="next", **kwargs): + """ + **List the latest cellular geolocation telemetry for devices in an organization** + https://developer.cisco.com/meraki/api-v1/#!get-organization-devices-cellular-geolocations + + - 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 + - serials (array): Optional parameter to filter the results by device serials. Maximum 1000 serials. + - perPage (integer): The number of entries per page returned. Acceptable range is 3 - 1000. Default is 100. + - startingAfter (string): A token used by the server to indicate the start of the page. Often this is a timestamp or an ID but it is not limited to those. This parameter should not be defined by client applications. The link for the first, last, prev, or next page in the HTTP Link header should define it. + - endingBefore (string): A token used by the server to indicate the end of the page. Often this is a timestamp or an ID but it is not limited to those. This parameter should not be defined by client applications. The link for the first, last, prev, or next page in the HTTP Link header should define it. + """ + + kwargs.update(locals()) + + metadata = { + "tags": ["organizations", "monitor", "devices", "cellular", "geolocations"], + "operation": "getOrganizationDevicesCellularGeolocations", + } + organizationId = urllib.parse.quote(str(organizationId), safe="") + resource = f"/organizations/{organizationId}/devices/cellular/geolocations" + + query_params = [ + "serials", + "perPage", + "startingAfter", + "endingBefore", + ] + params = {k.strip(): v for k, v in kwargs.items() if k.strip() in query_params} + + array_params = [ + "serials", + ] + for k, v in kwargs.items(): + if k.strip() in array_params: + params[f"{k.strip()}[]"] = kwargs[f"{k}"] + params.pop(k.strip()) + + if self._session._validate_kwargs: + all_params = query_params + array_params + invalid = [k for k in kwargs if k.strip() not in all_params and k != "self"] + if invalid and self._session._logger: + self._session._logger.warning( + f"getOrganizationDevicesCellularGeolocations: ignoring unrecognized kwargs: {invalid}" + ) + + return self._session.get_pages(metadata, resource, params, total_pages, direction) + + def getOrganizationDevicesCellularUplinksBandsByDevice( + self, organizationId: str, total_pages=1, direction="next", **kwargs + ): + """ + **List the latest cellular uplink signal information for devices in an organization** + https://developer.cisco.com/meraki/api-v1/#!get-organization-devices-cellular-uplinks-bands-by-device + + - organizationId (string): Organization ID + - total_pages (integer or string): use with perPage to get total results up to total_pages*perPage; -1 or "all" for all pages + - direction (string): direction to paginate, either "next" (default) or "prev" page + - serials (array): Optional parameter to filter the results by device serials. Maximum 1000 serials. + - perPage (integer): The number of entries per page returned. Acceptable range is 3 - 1000. Default is 100. + - startingAfter (string): A token used by the server to indicate the start of the page. Often this is a timestamp or an ID but it is not limited to those. This parameter should not be defined by client applications. The link for the first, last, prev, or next page in the HTTP Link header should define it. + - endingBefore (string): A token used by the server to indicate the end of the page. Often this is a timestamp or an ID but it is not limited to those. This parameter should not be defined by client applications. The link for the first, last, prev, or next page in the HTTP Link header should define it. + """ + + kwargs.update(locals()) + + metadata = { + "tags": ["organizations", "monitor", "devices", "cellular", "uplinks", "bands", "byDevice"], + "operation": "getOrganizationDevicesCellularUplinksBandsByDevice", + } + organizationId = urllib.parse.quote(str(organizationId), safe="") + resource = f"/organizations/{organizationId}/devices/cellular/uplinks/bands/byDevice" + + query_params = [ + "serials", + "perPage", + "startingAfter", + "endingBefore", + ] + params = {k.strip(): v for k, v in kwargs.items() if k.strip() in query_params} + + array_params = [ + "serials", + ] + for k, v in kwargs.items(): + if k.strip() in array_params: + params[f"{k.strip()}[]"] = kwargs[f"{k}"] + params.pop(k.strip()) + + if self._session._validate_kwargs: + all_params = query_params + array_params + invalid = [k for k in kwargs if k.strip() not in all_params and k != "self"] + if invalid and self._session._logger: + self._session._logger.warning( + f"getOrganizationDevicesCellularUplinksBandsByDevice: ignoring unrecognized kwargs: {invalid}" + ) + + return self._session.get_pages(metadata, resource, params, total_pages, direction) + + def getOrganizationDevicesCellularUplinksTowersByDevice( + self, organizationId: str, total_pages=1, direction="next", **kwargs + ): + """ + **List the latest cellular tower information for devices in an organization** + https://developer.cisco.com/meraki/api-v1/#!get-organization-devices-cellular-uplinks-towers-by-device + + - organizationId (string): Organization ID + - total_pages (integer or string): use with perPage to get total results up to total_pages*perPage; -1 or "all" for all pages + - direction (string): direction to paginate, either "next" (default) or "prev" page + - serials (array): Optional parameter to filter the results by device serials. Maximum 1000 serials. + - perPage (integer): The number of entries per page returned. Acceptable range is 3 - 1000. Default is 100. + - startingAfter (string): A token used by the server to indicate the start of the page. Often this is a timestamp or an ID but it is not limited to those. This parameter should not be defined by client applications. The link for the first, last, prev, or next page in the HTTP Link header should define it. + - endingBefore (string): A token used by the server to indicate the end of the page. Often this is a timestamp or an ID but it is not limited to those. This parameter should not be defined by client applications. The link for the first, last, prev, or next page in the HTTP Link header should define it. + """ + + kwargs.update(locals()) + + metadata = { + "tags": ["organizations", "monitor", "devices", "cellular", "uplinks", "towers", "byDevice"], + "operation": "getOrganizationDevicesCellularUplinksTowersByDevice", + } + organizationId = urllib.parse.quote(str(organizationId), safe="") + resource = f"/organizations/{organizationId}/devices/cellular/uplinks/towers/byDevice" + + query_params = [ + "serials", + "perPage", + "startingAfter", + "endingBefore", + ] + params = {k.strip(): v for k, v in kwargs.items() if k.strip() in query_params} + + array_params = [ + "serials", + ] + for k, v in kwargs.items(): + if k.strip() in array_params: + params[f"{k.strip()}[]"] = kwargs[f"{k}"] + params.pop(k.strip()) + + if self._session._validate_kwargs: + all_params = query_params + array_params + invalid = [k for k in kwargs if k.strip() not in all_params and k != "self"] + if invalid and self._session._logger: + self._session._logger.warning( + f"getOrganizationDevicesCellularUplinksTowersByDevice: ignoring unrecognized kwargs: {invalid}" + ) + + return self._session.get_pages(metadata, resource, params, total_pages, direction) + def createOrganizationDevicesControllerMigration(self, organizationId: str, serials: list, target: str, **kwargs): """ **Migrate devices to another controller or management mode** diff --git a/meraki/api/switch.py b/meraki/api/switch.py index 46b9aa8b..d5cbf2dd 100644 --- a/meraki/api/switch.py +++ b/meraki/api/switch.py @@ -25,7 +25,7 @@ def getDeviceSwitchPorts(self, serial: str): def cycleDeviceSwitchPorts(self, serial: str, ports: list, **kwargs): """ - **Cycle a set of switch ports** + **Cycle a set of switch ports on non-Catalyst MS devices** https://developer.cisco.com/meraki/api-v1/#!cycle-device-switch-ports - serial (string): Serial diff --git a/pyproject.toml b/pyproject.toml index 8dddfcf2..43f78060 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "meraki" -version = "3.0.1" +version = "3.0.2" description = "Cisco Meraki Dashboard API library" authors = [ {name = "Cisco Meraki", email = "api-feedback@meraki.net"} diff --git a/uv.lock b/uv.lock index 14040f9a..9f2ad7e2 100644 --- a/uv.lock +++ b/uv.lock @@ -521,7 +521,7 @@ wheels = [ [[package]] name = "meraki" -version = "3.0.1" +version = "3.0.2" source = { editable = "." } dependencies = [ { name = "aiohttp" },