Updated Get-GraylogStreams function to be stored in the correct file name

This commit is contained in:
Nathan Windisch 2024-07-26 13:56:14 +01:00
parent 9f7ce2c8b0
commit 252125184e
2 changed files with 26 additions and 24 deletions

View File

@ -1,24 +0,0 @@
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 { $null = Get-Secret Graylog_BaseURI -Vault Graylog -AsPlainText -ErrorAction Stop }
catch {
try { $Response = Invoke-GraylogRequest GET "/streams" }
catch { throw $_.Exception.Message }
ConvertTo-Json $Response.Streams | Set-Secret Graylog_Streams -Vault Graylog -AsPlainText
}
$Streams = Get-Secret Graylog_Streams -Vault Graylog -AsPlainText -ErrorAction Stop
return ConvertFrom-Json $Streams
}

View File

@ -0,0 +1,26 @@
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
}
}
}