PSGraylog/Functions/Public/Get-GraylogStreams.ps1

26 lines
631 B
PowerShell

function Get-GraylogStreams {
<#
.SYNOPSIS
Gets the streams available in Graylog.
.DESCRIPTION
Gets a list of the streams available in Graylog.
.OUTPUTS
The streams available in Graylog.
.EXAMPLE
Get-GraylogStreams
Gets a list of the streams available in Graylog.
#>
param ()
try {
return Get-Secret Graylog_Streams -Vault Graylog -AsPlainText -ErrorAction Stop | ConvertFrom-Json
} catch {
try {
$Response = Invoke-GraylogRequest GET "/streams"
ConvertTo-Json $Response.Streams | Set-Secret Graylog_Streams -Vault Graylog
return $Response.Streams
} catch {
throw $_.Exception.Message
}
}
}