notifers.psm1


$EmailNotifiersDefaultProperties = ('name', 'obj-severity', 'recipients', 'company-name', 'transport', 'enabled')
$SNMPNotifiersDefaultProperties = ('name', 'community', 'obj-severity', 'recipients', 'enabled')
$SYSLOGNotifiersDefaultProperties = ('name', 'targets', 'obj-severity', 'recipients', 'enabled')

.(commonLib) 

Function Get-XtremEmailNotifiers {
  <#
    .DESCRIPTION
    displays the list of Email Notifiers.
 
    .PARAMETER Properties
    Array of properties requested from this call.
 
    .PARAMETER Filters
    Array of filters for this call.
 
    .PARAMETER ShowRest
    Return an object represents the REST operation including URI , Method and JSON
 
    .EXAMPLE
    Get-XtremEmailNotifiers
  #>

    [cmdletbinding()]
    Param (
        [parameter()]
        [Alias("Properties")]
        [string[]]$Property = $EmailNotifiersDefaultProperties,
        [parameter()]
        [Alias("Filters")]
        [string[]]$Filter,
        [Parameter()]
        [object]$Session =  (Get-XtremDefaultSession),
        [Parameter()]
        [switch]$ShowRest,
        [Parameter()]
        [switch]$Full = $false
    )
    initCommand
    $Route = '/types/email-notifier'

    if ($Full) { $Property = '' }
    
    $result = NewXtremRequest -Method GET -Endpoint $Route -Session $Session -Properties $Property -Filters $Filter -ObjectSelection $ObjectSelection -ShowRest:$ShowRest.IsPresent -Multi -Full:$Full.IsPresent
    
    $result = formatOutPut $Property $result
    
    finalizeCommand
    return $result
}

Function Get-XtremEmailNotifier {
   <#
    .DESCRIPTION
    Displays the details of the selected Email Notifier.
 
    .PARAMETER EmailNotifierName
    Email Notifier name or index number
 
    .PARAMETER Properties
    Array of properties requested from this call.
 
    .PARAMETER ShowRest
    Return an object represents the REST operation including URI , Method and JSON
 
    .EXAMPLE
    Get-XtremEmailNotifier -EmailNotifierName notifier
  #>

    [cmdletbinding()]
    Param (
        [parameter(Mandatory = $true, Position = 0)]
        [Alias("Name")]
        [Argumentcompleter( { doComplete $args 'email-notifier' name })]
        $EmailNotifierName,
        [Parameter()]
        [Alias("Properties")]
        [string[]]$Property,
        [Parameter()]
        [object]$Session =  (Get-XtremDefaultSession),
        [Parameter()]
        [switch]$ShowRest
    )
    initCommand
    $Route = '/types/email-notifier'
    $Route, $GetProperty = SetParametersForRequest $Route $EmailNotifierName
    
    $result = NewXtremRequest -Method GET -Endpoint $Route -Session $Session -ObjectSelection $ObjectSelection -GetProperty $GetProperty -Properties $Property -ShowRest:$ShowRest.IsPresent
    
    $result = formatOutPut $Property $result
    
    finalizeCommand
    return $result
}

Function Get-XtremSNMPNotifiers {
  <#
    .DESCRIPTION
    displays the list of SNMP Notifiers.
 
    .PARAMETER Properties
    Array of properties requested from this call.
 
    .PARAMETER Filters
    Array of filters for this call.
 
    .PARAMETER ShowRest
    Return an object represents the REST operation including URI , Method and JSON
 
    .EXAMPLE
    Get-XtremSNMPNotifiers
  #>

    [cmdletbinding()]
    Param (
        [parameter()]
        [Alias("Properties")]
        [string[]]$Property = $SNMPNotifiersDefaultProperties,
        [parameter()]
        [Alias("Filters")]
        [string[]]$Filter,
        [Parameter()]
        [switch]$ShowRest,
        [Parameter()]
        [object]$Session =  (Get-XtremDefaultSession),
        [Parameter()]
        [switch]$Full = $false
    )
    initCommand
    $Route = '/types/snmp-notifier'

    if ($Full) { $Property = '' }

    $result = NewXtremRequest -Method GET -Endpoint $Route -Session $Session -Properties $Property -Filters $Filter -ObjectSelection $ObjectSelection -ShowRest:$ShowRest.IsPresent -Multi -Full:$Full.IsPresent
    
    $result = formatOutPut $Property $result
    
    finalizeCommand
    return $result
}

Function Get-XtremSNMPNotifier {
   <#
    .DESCRIPTION
    Displays the details of the SNMP Notifier.
 
    .PARAMETER SNMPNotifierName
    SNMP Notifier name or index number
 
    .PARAMETER Properties
    Array of properties requested from this call.
 
    .PARAMETER ShowRest
    Return an object represents the REST operation including URI , Method and JSON
 
    .EXAMPLE
    Get-XtremSNMPNotifier -SNMPNotifierName notifier
  #>

    [cmdletbinding()]
    Param (
        [parameter(Mandatory = $true, Position = 0)]
        [Alias("Name")]
        [Argumentcompleter( { doComplete $args 'snmp-notifier' name })]
        $SNMPNotifierName,
        [Parameter()]
        [Alias("Properties")]
        [string[]]$Property,
        [Parameter()]
        [object]$Session =  (Get-XtremDefaultSession),
        [Parameter()]
        [switch]$ShowRest
    )
    initCommand
    $Route = '/types/snmp-notifier'
    $Route, $GetProperty = SetParametersForRequest $Route $SNMPNotifierName

    $result = NewXtremRequest -Method GET -Endpoint $Route -Session $Session -ObjectSelection $ObjectSelection -GetProperty $GetProperty -Properties $Property -ShowRest:$ShowRest.IsPresent

    $result = formatOutPut $Property $result
    
    finalizeCommand
    return $result
}

Function Get-XtremSYSLOGNotifiers
{
    
  <#
    .DESCRIPTION
    displays the list of SYSLOG Notifiers.
 
    .PARAMETER Properties
    Array of properties requested from this call.
 
    .PARAMETER Filters
    Array of filters for this call.
 
    .PARAMETER ShowRest
    Return an object represents the REST operation including URI , Method and JSON
Get-XtremLDAPConfigs
    .EXAMPLE
    Get-XtremSYSLOGNotifiers
  #>

    
    [cmdletbinding()]
    Param (
        [parameter()]
        [Alias("Properties")]
        [string[]]$Property = $SYSLOGNotifiersDefaultProperties,
        [parameter()]
        [Alias("Filters")]
        [string[]]$Filter,
        [Parameter()]
        [object]$Session =  (Get-XtremDefaultSession),
        [Parameter()]
        [switch]$ShowRest,
        [Parameter()]
        [switch]$Full = $false
    )
    initCommand
    $Route = '/types/syslog-notifier'

    if ($Full) { $Property = '' }
    
    $result = NewXtremRequest -Method GET -Endpoint $Route -Session $Session -Properties $Property -Filters $Filter -ObjectSelection $ObjectSelection -ShowRest:$ShowRest.IsPresent -Multi -Full:$Full.IsPresent
    
    $result = formatOutPut $Property $result
    
    finalizeCommand
    return $result
}

Function Get-XtremSYSLOGNotifier {
  <#
    .DESCRIPTION
    displays the details of a specific SYSLOG Notifier.
 
    .PARAMETER Properties
    Array of properties requested from this call.
 
    .PARAMETER ShowRest
    Return an object represents the REST operation including URI , Method and JSON
 
    .EXAMPLE
    Get-XtremSYSLOGNotifier -SYSLogNotifierName name
  #>

    [cmdletbinding()]
    Param (
        [parameter(Mandatory = $true, Position = 0)]
        [Alias("Name")]
        [Argumentcompleter( { doComplete $args 'syslog-notifier' name })]
        $SYSLOGNotifierName,
        [Parameter()]
        [Alias("Properties")]
        [string[]]$Property,
        [Parameter()]
        [object]$Session =  (Get-XtremDefaultSession),
        [Parameter()]
        [switch]$ShowRest
    )
    initCommand
    $Route = '/types/syslog-notifier'
    $Route, $GetProperty = SetParametersForRequest $Route $SYSLOGNotifierName
    
    $result = NewXtremRequest -Method GET -Endpoint $Route -Session $Session -ObjectSelection $ObjectSelection -GetProperty $GetProperty -Properties $Property -ShowRest:$ShowRest.IsPresent
    
    $result = formatOutPut $Property $result
    
    finalizeCommand
    return $result
}

Export-ModuleMember *-*