From c66315f5f86e4f893644c62488547a91d57c9511 Mon Sep 17 00:00:00 2001 From: Joe Workman <54448601+jworkmanjc@users.noreply.github.com> Date: Mon, 13 Mar 2023 15:01:17 -0600 Subject: [PATCH] userAgent on invoke rest method scripts (#478) * userAgent on invoke rest method scripts * missing $ --- scripts/automation/Radius/Config.ps1 | 6 ++++++ .../Radius/Functions/Private/Clear-JCQueuedCommand.ps1 | 2 +- .../Radius/Functions/Private/Invoke-CommandRun.ps1 | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/scripts/automation/Radius/Config.ps1 b/scripts/automation/Radius/Config.ps1 index d9257e659..9712050c5 100644 --- a/scripts/automation/Radius/Config.ps1 +++ b/scripts/automation/Radius/Config.ps1 @@ -37,6 +37,12 @@ $CertType = "UsernameCn" # Do not modify below ################################################################################ +$UserAgent_ModuleVersion = '1.0.0' +$UserAgent_ModuleName = 'PasswordlessRadiusConfig' +#Build the UserAgent string +$UserAgent_ModuleName = "JumpCloud_$($UserAgent_ModuleName).PowerShellModule" +$Template_UserAgent = "{0}/{1}" +$UserAgent = $Template_UserAgent -f $UserAgent_ModuleName, $UserAgent_ModuleVersion # When we import this config, this function will run and validate the openSSL binary location function Get-OpenSSLVersion { [CmdletBinding()] diff --git a/scripts/automation/Radius/Functions/Private/Clear-JCQueuedCommand.ps1 b/scripts/automation/Radius/Functions/Private/Clear-JCQueuedCommand.ps1 index 3d229791b..23807b64e 100644 --- a/scripts/automation/Radius/Functions/Private/Clear-JCQueuedCommand.ps1 +++ b/scripts/automation/Radius/Functions/Private/Clear-JCQueuedCommand.ps1 @@ -8,7 +8,7 @@ function Clear-JCQueuedCommand { 'x-api-key' = $Env:JCApiKey 'x-org-id' = $Env:JCOrgId } - $response = Invoke-RestMethod -Uri "https://console.jumpcloud.com/api/v2/commandqueue/$workflowId" -Method DELETE -Headers $headers + $response = Invoke-RestMethod -Uri "https://console.jumpcloud.com/api/v2/commandqueue/$workflowId" -Method DELETE -Headers $headers -UserAgent $UserAgent } end { return $response diff --git a/scripts/automation/Radius/Functions/Private/Invoke-CommandRun.ps1 b/scripts/automation/Radius/Functions/Private/Invoke-CommandRun.ps1 index c6b0bd355..4bfe0ae96 100644 --- a/scripts/automation/Radius/Functions/Private/Invoke-CommandRun.ps1 +++ b/scripts/automation/Radius/Functions/Private/Invoke-CommandRun.ps1 @@ -19,7 +19,7 @@ function Invoke-CommandRun { $body = @{ _id = $commandID } | ConvertTo-Json - $response = Invoke-RestMethod -Uri 'https://console.jumpcloud.com/api/runCommand' -Method POST -Headers $headers -ContentType 'application/json' -Body $body + $response = Invoke-RestMethod -Uri 'https://console.jumpcloud.com/api/runCommand' -Method POST -Headers $headers -ContentType 'application/json' -Body $body -UserAgent $UserAgent } end { if (!$response.queueIds) {