private/Functions/Hanwha/Set-HanwhaRecordingStorage.ps1

#https://$($ip)/stw-cgi/recording.cgi?msubmenu=storage&action=set&Enable=True&OverWrite=True&AutoDeleteEnable=True&AutoDeleteDays=90

Function Set-HanwhaRecordingStorage {
    [cmdletBinding()]
    Param(
        [Parameter()]
        [hashtable]$Object
    )
    
    <#
    Object Definition:
    @{
        IP = [String(Mandatory)]
        Credential = [PSCredential(Mandatory)]
        Storage = [int] as [String(Optional)]
    }
    #>


    #Set basic Paramters for Invoke-HanwhaCommand
    $CamCmd = @{
        Arguments = @{
            IP = $Object.IP
            Menu = 'recording'
            SubMenu = 'storage'
            Action = 'set'
            Parameters = @()
        }
        Credential = $Object.Credential
    }

    #Add Action Parameters
    if($Object.Enable) {
        $CamCmd.Arguments.Parameters += "Enable=$($Object.Enable)"
    }
    if($Object.Overwrite) {
        $CamCmd.Arguments.Parameters += "OverWrite=$($Object.Overwrite)"
    }
    if($Object.AutoDeleteEnable) {
        $CamCmd.Arguments.Parameters += "AutoDeleteEnable=$($Object.AutoDeleteEnable)"
    }
    if($Object.RetentionPeriod) {
        $CamCmd.Arguments.Parameters += "AutoDeleteDays=$($Object.RetentionPeriod)"
    }

    Invoke-HanwhaCommand @CamCmd
}