B `2u@sGdddeZdS)cseZdZfddZedddZedddZeddd Zedd d Zeed d dZ edddZ edddZ edddZ edddZ edddZedddZedddZedddZeddd Zedd!d"Zeed#d$d%Zed&d'd(Zeed)d*d+Zeed,d-d.Zeed,d/d0Zeed,d1d2Zed&d3d4Zeeed5d6d7Zed&d8d9Zeed:d;d<Zeed:d=d>Zeed:d?d@Z edAdBdCZ!edAdDdEZ"Z#S)FCameracstt|||_dS)N)superr__init___session)selfsession) __class__l/private/var/folders/7j/8686xlfs15q3tgljmghtvg0r0000gn/T/pip-target-isidps9b/lib/python/meraki/api/camera.pyrszCamera.__init__)serialcCs,ddddgdd}d|d}|j||S) z **Returns live state from camera of analytics zones** https://developer.cisco.com/meraki/api-v1/#!get-device-camera-analytics-live - serial (string): (required) cameramonitor analyticsZlivegetDeviceCameraAnalyticsLive)tags operationz /devices/z/camera/analytics/live)rget)rr metadataresourcerrr rs  z#Camera.getDeviceCameraAnalyticsLivec s|td|kr@ddg}|d|ks@td|dd|dddd gd d }d |d }ddddgfdd|D}|j|||S)aJ **Returns an overview of aggregate analytics data for a timespan** https://developer.cisco.com/meraki/api-v1/#!get-device-camera-analytics-overview - serial (string): (required) - t0 (string): The beginning of the timespan for the data. The maximum lookback period is 365 days from today. - t1 (string): The end of the timespan for the data. t1 can be a maximum of 7 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 7 days. The default is 1 hour. - objectType (string): [optional] The object type for which analytics will be retrieved. The default object type is person. The available types are [person, vehicle]. objectTypepersonvehiclez"objectType" cannot be "z", & must be set to one of: r r r Zoverview getDeviceCameraAnalyticsOverview)rrz /devices/z/camera/analytics/overviewt0t1timespancs&i|]\}}|kr||qSr)strip).0kv) query_paramsrr 3sz;Camera.getDeviceCameraAnalyticsOverview..)updatelocalsAssertionErroritemsrr)rr kwargsoptionsrrparamsr)rr rs $   z'Camera.getDeviceCameraAnalyticsOverviewc s|td|kr@ddg}|d|ks@td|dd|dddd gd d }d |d }dgfdd|D}|j|||S)aq **Returns most recent record for analytics zones** https://developer.cisco.com/meraki/api-v1/#!get-device-camera-analytics-recent - serial (string): (required) - objectType (string): [optional] The object type for which analytics will be retrieved. The default object type is person. The available types are [person, vehicle]. rrrz"objectType" cannot be "z", & must be set to one of: r r r ZrecentgetDeviceCameraAnalyticsRecent)rrz /devices/z/camera/analytics/recentcs&i|]\}}|kr||qSr)r)rrr)rrr r Osz9Camera.getDeviceCameraAnalyticsRecent..)r!r"r#r$rr)rr r%r&rrr'r)rr r(9s $  z%Camera.getDeviceCameraAnalyticsRecentcCs,ddddgdd}d|d}|j||S) z **Returns all configured analytic zones for this camera** https://developer.cisco.com/meraki/api-v1/#!get-device-camera-analytics-zones - serial (string): (required) r r r zonesgetDeviceCameraAnalyticsZones)rrz /devices/z/camera/analytics/zones)rr)rr rrrrr r*Us  z$Camera.getDeviceCameraAnalyticsZones)r zoneIdc s|td|kr@ddg}|d|ks@td|dd|dddd d gd d }d |d|d}dddddgfdd|D}|j|||S)a **Return historical records for analytic zones** https://developer.cisco.com/meraki/api-v1/#!get-device-camera-analytics-zone-history - serial (string): (required) - zoneId (string): (required) - t0 (string): The beginning of the timespan for the data. The maximum lookback period is 365 days from today. - t1 (string): The end of the timespan for the data. t1 can be a maximum of 14 hours 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 14 hours. The default is 1 hour. - resolution (integer): The time resolution in seconds for returned data. The valid resolutions are: 60. The default is 60. - objectType (string): [optional] The object type for which analytics will be retrieved. The default object type is person. The available types are [person, vehicle]. rrrz"objectType" cannot be "z", & must be set to one of: r r r r)history#getDeviceCameraAnalyticsZoneHistory)rrz /devices/z/camera/analytics/zones/z/historyrrr resolutioncs&i|]\}}|kr||qSr)r)rrr)rrr r sz>Camera.getDeviceCameraAnalyticsZoneHistory..)r!r"r#r$rr)rr r+r%r&rrr'r)rr r-gs $ z*Camera.getDeviceCameraAnalyticsZoneHistoryc sT|tddgdd}d|d}ddgfd d |D}|j|||S) a] **Generate a snapshot of what the camera sees at the specified time and return a link to that image.** https://developer.cisco.com/meraki/api-v1/#!generate-device-camera-snapshot - serial (string): (required) - timestamp (string): [optional] The snapshot will be taken from this time on the camera. The timestamp is expected to be in ISO 8601 format. If no timestamp is specified, we will assume current time. - fullframe (boolean): [optional] If set to "true" the snapshot will be taken at full sensor resolution. This will error if used with timestamp. r r generateDeviceCameraSnapshot)rrz /devices/z/camera/generateSnapshot timestampZ fullframecs&i|]\}}|kr||qSr)r)rrr) body_paramsrr r sz7Camera.generateDeviceCameraSnapshot..)r!r"r$rpost)rr r%rrpayloadr)r1r r/s  z#Camera.generateDeviceCameraSnapshotcCs*dddgdd}d|d}|j||S)z **Returns quality and retention settings for the given camera** https://developer.cisco.com/meraki/api-v1/#!get-device-camera-quality-and-retention - serial (string): (required) r configurequalityAndRetention"getDeviceCameraQualityAndRetention)rrz /devices/z/camera/qualityAndRetention)rr)rr rrrrr r6s  z)Camera.getDeviceCameraQualityAndRetentionc s|td|krBdddg}|d|ksBtd|dd|d|krzdd d d g}|d|ksztd |dd|d |krddg}|d |kstd|d d|dddgdd}d|d}ddddddd gfdd|D}|j|||S)a **Update quality and retention settings for the given camera** https://developer.cisco.com/meraki/api-v1/#!update-device-camera-quality-and-retention - serial (string): (required) - profileId (string): The ID of a quality and retention profile to assign to the camera. The profile's settings will override all of the per-camera quality and retention settings. If the value of this parameter is null, any existing profile will be unassigned from the camera. - motionBasedRetentionEnabled (boolean): Boolean indicating if motion-based retention is enabled(true) or disabled(false) on the camera. - audioRecordingEnabled (boolean): Boolean indicating if audio recording is enabled(true) or disabled(false) on the camera - restrictedBandwidthModeEnabled (boolean): Boolean indicating if restricted bandwidth is enabled(true) or disabled(false) on the camera - quality (string): Quality of the camera. Can be one of 'Standard', 'High' or 'Enhanced'. Not all qualities are supported by every camera model. - resolution (string): Resolution of the camera. Can be one of '1280x720', '1920x1080', '1080x1080' or '2058x2058'. Not all resolutions are supported by every camera model. - motionDetectorVersion (integer): The version of the motion detector that will be used by the camera. Only applies to Gen 2 cameras. Defaults to v2. ZqualityZStandardZHighZEnhancedz"quality" cannot be "z", & must be set to one of: r.Z1280x720Z 1920x1080Z 1080x1080Z 2058x2058z"resolution" cannot be "motionDetectorVersionz#"motionDetectorVersion" cannot be "r r4r5%updateDeviceCameraQualityAndRetention)rrz /devices/z/camera/qualityAndRetentionZ profileIdmotionBasedRetentionEnabledaudioRecordingEnabledrestrictedBandwidthModeEnabledcs&i|]\}}|kr||qSr)r)rrr)r1rr r sz@Camera.updateDeviceCameraQualityAndRetention..)r!r"r#r$rput)rr r%r&rrr3r)r1r r:s   $ $$ z,Camera.updateDeviceCameraQualityAndRetentioncCs*dddgdd}d|d}|j||S)z **Returns sense settings for a given camera** https://developer.cisco.com/meraki/api-v1/#!get-device-camera-sense - serial (string): (required) r r4sensegetDeviceCameraSense)rrz /devices/z /camera/sense)rr)rr rrrrr r@s  zCamera.getDeviceCameraSensec sZ|tdddgdd}d|d}dd d d gfd d |D}|j|||S)aO **Update sense settings for the given camera** https://developer.cisco.com/meraki/api-v1/#!update-device-camera-sense - serial (string): (required) - senseEnabled (boolean): Boolean indicating if sense(license) is enabled(true) or disabled(false) on the camera - mqttBrokerId (string): The ID of the MQTT broker to be enabled on the camera. A value of null will disable MQTT on the camera - audioDetection (object): The details of the audio detection config. - detectionModelId (string): The ID of the object detection model r r4r?updateDeviceCameraSense)rrz /devices/z /camera/senseZ senseEnabledZ mqttBrokerIdZaudioDetectionZdetectionModelIdcs&i|]\}}|kr||qSr)r)rrr)r1rr r sz2Camera.updateDeviceCameraSense..)r!r"r$rr>)rr r%rrr3r)r1r rAs   zCamera.updateDeviceCameraSensecCs,ddddgdd}d|d}|j||S) z **Returns the MV Sense object detection model list for the given camera** https://developer.cisco.com/meraki/api-v1/#!get-device-camera-sense-object-detection-models - serial (string): (required) r r4r?ZobjectDetectionModels)getDeviceCameraSenseObjectDetectionModels)rrz /devices/z#/camera/sense/objectDetectionModels)rr)rr rrrrr rBs  z0Camera.getDeviceCameraSenseObjectDetectionModelscCs,ddddgdd}d|d}|j||S) z **Returns video settings for the given camera** https://developer.cisco.com/meraki/api-v1/#!get-device-camera-video-settings - serial (string): (required) r r4videosettingsgetDeviceCameraVideoSettings)rrz /devices/z/camera/video/settings)rr)rr rrrrr rEs  z#Camera.getDeviceCameraVideoSettingsc sV|tddddgdd}d|d}d gfd d |D}|j|||S) a **Update video settings for the given camera** https://developer.cisco.com/meraki/api-v1/#!update-device-camera-video-settings - serial (string): (required) - externalRtspEnabled (boolean): Boolean indicating if external rtsp stream is exposed r r4rCrDupdateDeviceCameraVideoSettings)rrz /devices/z/camera/video/settingsZexternalRtspEnabledcs&i|]\}}|kr||qSr)r)rrr)r1rr r >sz:Camera.updateDeviceCameraVideoSettings..)r!r"r$rr>)rr r%rrr3r)r1r rF,s   z&Camera.updateDeviceCameraVideoSettingsc sT|tdddgdd}d|d}dgfd d |D}|j|||S) ax **Returns video link to the specified camera** https://developer.cisco.com/meraki/api-v1/#!get-device-camera-video-link - serial (string): (required) - timestamp (string): [optional] The video link will start at this time. The timestamp should be a string in ISO8601 format. If no timestamp is specified, we will assume current time. r r4Z videoLinkgetDeviceCameraVideoLink)rrz /devices/z/camera/videoLinkr0cs&i|]\}}|kr||qSr)r)rrr)rrr r Vsz3Camera.getDeviceCameraVideoLink..)r!r"r$rr)rr r%rrr'r)rr rGDs  zCamera.getDeviceCameraVideoLinkcCs*dddgdd}d|d}|j||S)z **Returns wireless profile assigned to the given camera** https://developer.cisco.com/meraki/api-v1/#!get-device-camera-wireless-profiles - serial (string): (required) r r4wirelessProfilesgetDeviceCameraWirelessProfiles)rrz /devices/z/camera/wirelessProfiles)rr)rr rrrrr rI\s  z&Camera.getDeviceCameraWirelessProfiles)r idscsNt}dddgdd}d|d}dgfd d |D}|j|||S) a **Assign wireless profiles to the given camera** https://developer.cisco.com/meraki/api-v1/#!update-device-camera-wireless-profiles - serial (string): (required) - ids (object): The ids of the wireless profile to assign to the given camera r r4rH"updateDeviceCameraWirelessProfiles)rrz /devices/z/camera/wirelessProfilesrJcs&i|]\}}|kr||qSr)r)rrr)r1rr r sz=Camera.updateDeviceCameraWirelessProfiles..)r"r$rr>)rr rJr%rrr3r)r1r rKns  z)Camera.updateDeviceCameraWirelessProfiles) networkIdcCs*dddgdd}d|d}|j||S)z **List the quality retention profiles for this network** https://developer.cisco.com/meraki/api-v1/#!get-network-camera-quality-retention-profiles - networkId (string): (required) r r4qualityRetentionProfiles(getNetworkCameraQualityRetentionProfiles)rrz /networks/z /camera/qualityRetentionProfiles)rr)rrLrrrrr rNs  z/Camera.getNetworkCameraQualityRetentionProfiles)rLnamec sd|tdddgdd}d|d}dd d d d d dddg fdd|D}|j|||S)a **Creates new quality retention profile for this network.** https://developer.cisco.com/meraki/api-v1/#!create-network-camera-quality-retention-profile - networkId (string): (required) - name (string): The name of the new profile. Must be unique. This parameter is required. - motionBasedRetentionEnabled (boolean): Deletes footage older than 3 days in which no motion was detected. Can be either true or false. Defaults to false. - restrictedBandwidthModeEnabled (boolean): Disable features that require additional bandwidth such as Motion Recap. Can be either true or false. Defaults to false. - audioRecordingEnabled (boolean): Whether or not to record audio. Can be either true or false. Defaults to false. - cloudArchiveEnabled (boolean): Create redundant video backup using Cloud Archive. Can be either true or false. Defaults to false. - motionDetectorVersion (integer): The version of the motion detector that will be used by the camera. Only applies to Gen 2 cameras. Defaults to v2. - scheduleId (string): Schedule for which this camera will record video, or 'null' to always record. - maxRetentionDays (integer): The maximum number of days for which the data will be stored, or 'null' to keep data until storage space runs out. If the former, it can be one of [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 14, 30, 60, 90] days. - videoSettings (object): Video quality and resolution settings for all the camera models. r r4rM*createNetworkCameraQualityRetentionProfile)rrz /networks/z /camera/qualityRetentionProfilesrOr;r=r<cloudArchiveEnabledr7 scheduleIdmaxRetentionDays videoSettingscs&i|]\}}|kr||qSr)r)rrr)r1rr r szECamera.createNetworkCameraQualityRetentionProfile..)r!r"r$rr2)rrLrOr%rrr3r)r1r rPs  z1Camera.createNetworkCameraQualityRetentionProfile)rLqualityRetentionProfileIdcCs.dddgdd}d|d|}|j||S)a **Retrieve a single quality retention profile** https://developer.cisco.com/meraki/api-v1/#!get-network-camera-quality-retention-profile - networkId (string): (required) - qualityRetentionProfileId (string): (required) r r4rM'getNetworkCameraQualityRetentionProfile)rrz /networks/z!/camera/qualityRetentionProfiles/)rr)rrLrUrrrrr rVs z.Camera.getNetworkCameraQualityRetentionProfilec sh|tdddgdd}d|d|}dd d d d d dddg fdd|D}|j|||S)a **Update an existing quality retention profile for this network.** https://developer.cisco.com/meraki/api-v1/#!update-network-camera-quality-retention-profile - networkId (string): (required) - qualityRetentionProfileId (string): (required) - name (string): The name of the new profile. Must be unique. - motionBasedRetentionEnabled (boolean): Deletes footage older than 3 days in which no motion was detected. Can be either true or false. Defaults to false. - restrictedBandwidthModeEnabled (boolean): Disable features that require additional bandwidth such as Motion Recap. Can be either true or false. Defaults to false. - audioRecordingEnabled (boolean): Whether or not to record audio. Can be either true or false. Defaults to false. - cloudArchiveEnabled (boolean): Create redundant video backup using Cloud Archive. Can be either true or false. Defaults to false. - motionDetectorVersion (integer): The version of the motion detector that will be used by the camera. Only applies to Gen 2 cameras. Defaults to v2. - scheduleId (string): Schedule for which this camera will record video, or 'null' to always record. - maxRetentionDays (integer): The maximum number of days for which the data will be stored, or 'null' to keep data until storage space runs out. If the former, it can be one of [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 14, 30, 60, 90] days. - videoSettings (object): Video quality and resolution settings for all the camera models. r r4rM*updateNetworkCameraQualityRetentionProfile)rrz /networks/z!/camera/qualityRetentionProfiles/rOr;r=r<rQr7rRrSrTcs&i|]\}}|kr||qSr)r)rrr)r1rr r szECamera.updateNetworkCameraQualityRetentionProfile..)r!r"r$rr>)rrLrUr%rrr3r)r1r rWs z1Camera.updateNetworkCameraQualityRetentionProfilecCs.dddgdd}d|d|}|j||S)a **Delete an existing quality retention profile for this network.** https://developer.cisco.com/meraki/api-v1/#!delete-network-camera-quality-retention-profile - networkId (string): (required) - qualityRetentionProfileId (string): (required) r r4rM*deleteNetworkCameraQualityRetentionProfile)rrz /networks/z!/camera/qualityRetentionProfiles/)rdelete)rrLrUrrrrr rXs z1Camera.deleteNetworkCameraQualityRetentionProfilecCs*dddgdd}d|d}|j||S)z **Returns a list of all camera recording schedules.** https://developer.cisco.com/meraki/api-v1/#!get-network-camera-schedules - networkId (string): (required) r r4Z schedulesgetNetworkCameraSchedules)rrz /networks/z/camera/schedules)rr)rrLrrrrr rZs  z Camera.getNetworkCameraSchedules)rLrOssidc sX|tdddgdd}d|d}dd d gfd d |D}|j|||S) a **Creates a new camera wireless profile for this network.** https://developer.cisco.com/meraki/api-v1/#!create-network-camera-wireless-profile - networkId (string): (required) - name (string): The name of the camera wireless profile. This parameter is required. - ssid (object): The details of the SSID config. - identity (object): The identity of the wireless profile. Required for creating wireless profiles in 8021x-radius auth mode. r r4rH"createNetworkCameraWirelessProfile)rrz /networks/z/camera/wirelessProfilesrOr[identitycs&i|]\}}|kr||qSr)r)rrr)r1rr r %sz=Camera.createNetworkCameraWirelessProfile..)r!r"r$rr2)rrLrOr[r%rrr3r)r1r r\s   z)Camera.createNetworkCameraWirelessProfilecCs*dddgdd}d|d}|j||S)z **List the camera wireless profiles for this network.** https://developer.cisco.com/meraki/api-v1/#!get-network-camera-wireless-profiles - networkId (string): (required) r r4rH getNetworkCameraWirelessProfiles)rrz /networks/z/camera/wirelessProfiles)rr)rrLrrrrr r^+s  z'Camera.getNetworkCameraWirelessProfiles)rLwirelessProfileIdcCs.dddgdd}d|d|}|j||S)z **Retrieve a single camera wireless profile.** https://developer.cisco.com/meraki/api-v1/#!get-network-camera-wireless-profile - networkId (string): (required) - wirelessProfileId (string): (required) r r4rHgetNetworkCameraWirelessProfile)rrz /networks/z/camera/wirelessProfiles/)rr)rrLr_rrrrr r`=s z&Camera.getNetworkCameraWirelessProfilec s\|tdddgdd}d|d|}dd d gfd d |D}|j|||S) a **Update an existing camera wireless profile in this network.** https://developer.cisco.com/meraki/api-v1/#!update-network-camera-wireless-profile - networkId (string): (required) - wirelessProfileId (string): (required) - name (string): The name of the camera wireless profile. - ssid (object): The details of the SSID config. - identity (object): The identity of the wireless profile. Required for creating wireless profiles in 8021x-radius auth mode. r r4rH"updateNetworkCameraWirelessProfile)rrz /networks/z/camera/wirelessProfiles/rOr[r]cs&i|]\}}|kr||qSr)r)rrr)r1rr r esz=Camera.updateNetworkCameraWirelessProfile..)r!r"r$rr>)rrLr_r%rrr3r)r1r raPs  z)Camera.updateNetworkCameraWirelessProfilecCs.dddgdd}d|d|}|j||S)a **Delete an existing camera wireless profile for this network.** https://developer.cisco.com/meraki/api-v1/#!delete-network-camera-wireless-profile - networkId (string): (required) - wirelessProfileId (string): (required) r r4rH"deleteNetworkCameraWirelessProfile)rrz /networks/z/camera/wirelessProfiles/)rrY)rrLr_rrrrr rbks z)Camera.deleteNetworkCameraWirelessProfile)organizationIdc  s|tddddgdd}d|d}d d gfd d |D}d d g}xF|D]:\}}||krZ||||d <||qZW|j|||S)a **Fetch onboarding status of cameras** https://developer.cisco.com/meraki/api-v1/#!get-organization-camera-onboarding-statuses - organizationId (string): (required) - serials (array): A list of serial numbers. The returned cameras will be filtered to only include these serials. - networkIds (array): A list of network IDs. The returned cameras will be filtered to only include these networks. r r4 onboardingstatuses'getOrganizationCameraOnboardingStatuses)rrz/organizations/z/camera/onboarding/statusesZserialsZ networkIdscs&i|]\}}|kr||qSr)r)rrr)rrr r szBCamera.getOrganizationCameraOnboardingStatuses..z[])r!r"r$rpoprr) rrcr%rrr'Z array_paramsrrr)rr rf~s    z.Camera.getOrganizationCameraOnboardingStatusesc sX|tddddgdd}d|d}d d gfd d |D}|j|||S) ag **Notify that credential handoff to camera has completed** https://developer.cisco.com/meraki/api-v1/#!update-organization-camera-onboarding-statuses - organizationId (string): (required) - serial (string): Serial of camera - wirelessCredentialsSent (boolean): Note whether credentials were sent successfully r r4rdre*updateOrganizationCameraOnboardingStatuses)rrz/organizations/z/camera/onboarding/statusesr ZwirelessCredentialsSentcs&i|]\}}|kr||qSr)r)rrr)r1rr r szECamera.updateOrganizationCameraOnboardingStatuses..)r!r"r$rr>)rrcr%rrr3r)r1r rhs   z1Camera.updateOrganizationCameraOnboardingStatuses)$__name__ __module__ __qualname__rstrrrr(r*r-r/r6r:r@rArBrErFrGrIdictrKrNrPrVrWrXrZr\r^r`rarbrfrh __classcell__rr)rr rs< !( !rN)objectrrrrr