public/Set-CTRecordingStorage.ps1

Function Set-CTRecordingStorage {
    [cmdletBinding(
        DefaultParameterSetName='All',
        #SupportsShouldProcess = $true,
        ConfirmImpact='high'
        )]
    Param(
        [Parameter(
            Mandatory=$true,
            ParameterSetName='All'
        )]
        [String]$IP,

        [Parameter(
            Mandatory=$true,
            ParameterSetName='All'
        )]
        [pscredential]$Credential,

        [Parameter(
            Mandatory=$false,
            ParameterSetName='All'
        )]
        [switch]$Enable,

        [Parameter(
            Mandatory=$false,
            ParameterSetName='All'
        )]
        [switch]$Overwrite,

        [Parameter(
            Mandatory=$false,
            ParameterSetName='All'
        )]
        [switch]$AutoDeleteEnable,

        [Parameter(
            Mandatory=$false,
            ParameterSetName='All'
        )]
        [int]$RetentionPeriod

    )
    DynamicParam {
        $DynamicParameters = @{
            CameraType = @{
                Mandatory = $true
                Position = 1
                ParameterSetName = "All"
                Enum = $Script:SupportedCameraModels
            }
        }

        return New-DynamicParameterSet -ParameterTable $DynamicParameters
    }
    Begin {
        Write-Debug "[Set-CTRecordingStorage] Started"
        $CameraType = $PSBoundParameters.CameraType

        #Build Submission Object
        $obj = @{
            IP = $IP
            Credential = $Credential
            Enable = $Enable
            Overwrite = $Overwrite
            AutoDeleteEnable = $AutoDeleteEnable
            RetentionPeriod = $RetentionPeriod
        }

        #Choose Camera Model
        Switch ($CameraType) {
            Hanwha {
                return Set-HanwhaRecordingStorage -Object $obj
            }
        }
    }
}