From 252125184e1ccfdb35de6b2ce187d007880863cc Mon Sep 17 00:00:00 2001 From: Nathan Windisch Date: Fri, 26 Jul 2024 13:56:14 +0100 Subject: [PATCH] Updated Get-GraylogStreams function to be stored in the correct file name --- Functions/Public/Get-GraylogStreamIds.ps1 | 24 --------------------- Functions/Public/Get-GraylogStreams.ps1 | 26 +++++++++++++++++++++++ 2 files changed, 26 insertions(+), 24 deletions(-) delete mode 100644 Functions/Public/Get-GraylogStreamIds.ps1 create mode 100644 Functions/Public/Get-GraylogStreams.ps1 diff --git a/Functions/Public/Get-GraylogStreamIds.ps1 b/Functions/Public/Get-GraylogStreamIds.ps1 deleted file mode 100644 index 8f9be9d..0000000 --- a/Functions/Public/Get-GraylogStreamIds.ps1 +++ /dev/null @@ -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 -} \ No newline at end of file diff --git a/Functions/Public/Get-GraylogStreams.ps1 b/Functions/Public/Get-GraylogStreams.ps1 new file mode 100644 index 0000000..f54e61d --- /dev/null +++ b/Functions/Public/Get-GraylogStreams.ps1 @@ -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 + } + } +} \ No newline at end of file