Public/ps1/Configuration/FileWatcher/Set-ApprxrFileWatcherLocation.ps1
|
<##
.SYNOPSIS Sets up a monitored location configuration for the Apprxr file watcher. .DESCRIPTION Uses Set-ApprxrConfigurationValue to store location settings for the file watcher. Each location setting includes: - InputFolder: The folder to monitor for incoming files - VdbName: The associated VDB name - InProgressFolder: (Optional) Folder for files being processed - Filter: (Optional) File type filters for monitoring (e.g., '*.txt', '*.csv') .PARAMETER Name The unique name for this location setting (used as the configuration key). .PARAMETER InputFolder The folder path to monitor for new files. .PARAMETER VdbName The VDB name associated with this location. .PARAMETER InProgressFolder (Optional) The folder path for files in progress. .PARAMETER Filter (Optional) One or more file type filters for monitoring. .EXAMPLE Set-ApprxrFileWatcherLocation -Name 'Location1' -InputFolder 'C:\Input' -VdbName 'VDB1' -InProgressFolder 'C:\Input\InProgress' -Filter '*.txt','*.csv' Sets up a monitored location with the specified properties, filtering for .txt and .csv files. ##> function Set-ApprxrFileWatcherLocation { param( [Parameter(Mandatory)] [string]$Name, [Parameter(Mandatory)] [string]$InputFolder, [Parameter(Mandatory)] [string]$VdbName, [string]$InProgressFolder, [string[]]$Filter, # Accepts one or more file type filters (e.g., '*.txt', '*.csv') [switch]$RemoveFilter # If specified, removes the Filter property from the config ) $locationConfig = @{ InputFolder = $InputFolder VdbName = $VdbName } if ($InProgressFolder) { $locationConfig["InProgressFolder"] = $InProgressFolder } if ($RemoveFilter) { # Explicitly remove the Filter property # Do not add Filter to config } elseif ($Filter) { $locationConfig["Filter"] = $Filter } # Store the location configuration using the new private function Set-ApprxrFileWatcherLocationEntry -Name $Name -LocationConfig $locationConfig } |