public/Add-VSANotification.ps1
function Add-VSANotification { <# .Synopsis Adds a single notification record. .DESCRIPTION Adds a single notification record. Takes either persistent or non-persistent connection information. .PARAMETER VSAConnection Specifies existing non-persistent VSAConnection. .PARAMETER URISuffix Specifies URI suffix if it differs from the default. .PARAMETER Title Specifies numeric id of agent machine .PARAMETER Text Specifies email address of administrator .EXAMPLE Add-VSANotification -Title "Title goes here" -Text "Text message goes here" .EXAMPLE Add-VSANotification -VSAConnection $VSAConnection -Title "Title goes here" -Text "Text message goes here" .INPUTS Accepts piped non-persistent VSAConnection .OUTPUTS No output #> [CmdletBinding()] param ( [parameter(Mandatory = $true, ValueFromPipelineByPropertyName = $true, ParameterSetName = 'NonPersistent')] [VSAConnection] $VSAConnection, [parameter(Mandatory=$false, ValueFromPipelineByPropertyName=$true, ParameterSetName = 'NonPersistent')] [parameter(Mandatory=$false, ValueFromPipelineByPropertyName=$true, ParameterSetName = 'Persistent')] [ValidateNotNullOrEmpty()] [string] $URISuffix = "api/v1.0/notification", [parameter(ParameterSetName = 'Persistent', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [parameter(ParameterSetName = 'NonPersistent', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [string] $Title, [parameter(ParameterSetName = 'Persistent', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [parameter(ParameterSetName = 'NonPersistent', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [ValidateNotNullOrEmpty()] [string] $Text ) [hashtable]$Params =@{ URISuffix = $URISuffix Method = 'POST' } $Body = ConvertTo-Json @{"Title"="$Title"; "Body"="$Text";} $Params.Add('Body', $Body) if($VSAConnection) {$Params.Add('VSAConnection', $VSAConnection)} return Update-VSAItems @Params } Export-ModuleMember -Function Add-VSANotification |