Updated Get-GraylogStreams function to be stored in the correct file name
This commit is contained in:
parent
9f7ce2c8b0
commit
252125184e
@ -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
|
||||
}
|
26
Functions/Public/Get-GraylogStreams.ps1
Normal file
26
Functions/Public/Get-GraylogStreams.ps1
Normal 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
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user