Skip to content

Commit

Permalink
rename camera with serial (#14)
Browse files Browse the repository at this point in the history
* Create LICENSE

* starting to create documentation framework

* Initial docs creation

* more documentation structure

* Streamline auth processing

* little clean-up

* auth streamlining

* version bump 0.0.7

* add serial input for setting camera name

Added ability to just specify the serial of a camera to rename it.  will run get-verkadacameras -serial to obtain the camera_id to rename it
  • Loading branch information
bepsoccer authored Mar 7, 2023
2 parents 9619b34 + 6d6d99b commit 96a6c61
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions Public/Set-VerkadaCameraName.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,17 @@ function Set-VerkadaCameraName
#>

[CmdletBinding(PositionalBinding = $true, DefaultParameterSetName = 'email')]
[CmdletBinding(PositionalBinding = $true)]
Param(
[Parameter(ValueFromPipelineByPropertyName = $true)]
[ValidateNotNullOrEmpty()]
[String]$org_id = $Global:verkadaConnection.org_id,
[Parameter(Mandatory = $true, ValueFromPipelineByPropertyName = $true)]
[Parameter(Mandatory = $true, ValueFromPipelineByPropertyName = $true, ParameterSetName = 'cameraId')]
[Alias("cameraId")]
[String]$camera_id,
[Parameter(Mandatory = $true, ValueFromPipelineByPropertyName = $true, ParameterSetName = 'serial')]
[Parameter(ValueFromPipelineByPropertyName = $true, ParameterSetName = 'cameraId')]
[String]$serial,
[Parameter(Mandatory = $true, ValueFromPipelineByPropertyName = $true)]
[Alias("name")]
[String]$camera_name,
Expand All @@ -29,7 +32,10 @@ function Set-VerkadaCameraName
[string]$x_verkada_token = $Global:verkadaConnection.csrfToken,
[Parameter()]
[ValidateNotNullOrEmpty()]
[string]$x_verkada_auth = $Global:verkadaConnection.userToken
[string]$x_verkada_auth = $Global:verkadaConnection.userToken,
[Parameter(ParameterSetName = 'serial')]
[ValidateNotNullOrEmpty()]
[String]$x_api_key = $Global:verkadaConnection.token
)

Begin {
Expand All @@ -38,6 +44,10 @@ function Set-VerkadaCameraName
} #end begin

Process {
if ($PSCmdlet.ParameterSetName -eq 'serial'){
$camera_id = Get-VerkadaCameras -serial $_.serial | Select-Object -ExpandProperty camera_id
}

$body_params = @{
"cameraId" = $camera_id
"name" = $camera_name
Expand Down

0 comments on commit 96a6c61

Please sign in to comment.