From 1b0b13e1b25d5cb3792e7bf135f43efbf69350e6 Mon Sep 17 00:00:00 2001 From: Luke Hagar Date: Wed, 4 Mar 2026 13:04:45 -0600 Subject: [PATCH 1/2] Standardize User-Agent and add telemetry headers Replace generic OpenAPI-Generator User-Agent with SailPoint-SDK/powershell/{ver} format. Add ConsumerIdentifier/ConsumerVersion fields to Configuration for consumers to identify themselves in the User-Agent via parenthetical suffix. Standardize X-SailPoint-SDK to powershell/{ver} format and add X-SailPoint-SDK-Runtime and X-SailPoint-SDK-OS telemetry headers. Co-Authored-By: Claude Opus 4.6 --- PSSailpoint/Configuration.ps1 | 18 ++++++++++++++++++ sdk-resources/resources/api_client.mustache | 12 +++++++++--- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/PSSailpoint/Configuration.ps1 b/PSSailpoint/Configuration.ps1 index fd38a6dd1..e4432a822 100644 --- a/PSSailpoint/Configuration.ps1 +++ b/PSSailpoint/Configuration.ps1 @@ -66,6 +66,14 @@ function Get-DefaultConfiguration { $Configuration["Experimental"] = $false } + if (!$Configuration.containsKey("ConsumerIdentifier")) { + $Configuration["ConsumerIdentifier"] = $null + } + + if (!$Configuration.containsKey("ConsumerVersion")) { + $Configuration["ConsumerVersion"] = $null + } + Return $Configuration } @@ -134,6 +142,8 @@ function Set-DefaultConfiguration { [System.Nullable[Int32]]$RetryIntervalSeconds, [System.Nullable[Boolean]]$Experimental, [System.Object]$Proxy, + [string]$ConsumerIdentifier, + [string]$ConsumerVersion, [switch]$PassThru ) @@ -184,6 +194,14 @@ function Set-DefaultConfiguration { $Script:Configuration['Experimental'] = $Experimental } + If ($ConsumerIdentifier) { + $Script:Configuration['ConsumerIdentifier'] = $ConsumerIdentifier + } + + If ($ConsumerVersion) { + $Script:Configuration['ConsumerVersion'] = $ConsumerVersion + } + If ($null -ne $Proxy) { If ($Proxy.GetType().FullName -ne "System.Net.SystemWebProxy" -and $Proxy.GetType().FullName -ne "System.Net.WebProxy" -and $Proxy.GetType().FullName -ne "System.Net.WebRequest+WebProxyWrapperOpaque") { throw "Incorrect Proxy type '$($Proxy.GetType().FullName)'. Must be System.Net.WebProxy or System.Net.SystemWebProxy or System.Net.WebRequest+WebProxyWrapperOpaque." diff --git a/sdk-resources/resources/api_client.mustache b/sdk-resources/resources/api_client.mustache index 7fdd0c7a7..8446a288d 100644 --- a/sdk-resources/resources/api_client.mustache +++ b/sdk-resources/resources/api_client.mustache @@ -75,9 +75,15 @@ function Invoke-{{{apiNamePrefix}}}ApiClient { break } - # Add Custom Header - $HeaderParameters['X-SailPoint-SDK'] = "Powershell-{{packageVersion}}" - $HeaderParameters['User-Agent'] = "OpenAPI-Generator/{{{packageVersion}}}/ps" + # Add SailPoint SDK telemetry headers + $HeaderParameters['X-SailPoint-SDK'] = "powershell/{{packageVersion}}" + $UserAgent = "SailPoint-SDK/powershell/{{{packageVersion}}}" + if ($Configuration["ConsumerIdentifier"] -and $Configuration["ConsumerVersion"]) { + $UserAgent = "$UserAgent ($($Configuration["ConsumerIdentifier"])/$($Configuration["ConsumerVersion"]))" + } + $HeaderParameters['User-Agent'] = $UserAgent + $HeaderParameters['X-SailPoint-SDK-Runtime'] = "powershell/$($PSVersionTable.PSVersion.ToString())" + $HeaderParameters['X-SailPoint-SDK-OS'] = "$([System.Runtime.InteropServices.RuntimeInformation]::OSDescription.Trim())/$([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture)" $HasFormData = $False From b43e21564b87346f951fdc4a0fc7ea94fa968985 Mon Sep 17 00:00:00 2001 From: Luke Hagar Date: Thu, 5 Mar 2026 10:39:36 -0600 Subject: [PATCH 2/2] Consolidate telemetry into User-Agent header, remove custom X-SailPoint-* headers Format: SailPoint-SDK-PowerShell/{version} ({os}; {arch}) PowerShell/{ps-version} (openapi-generator/{gen-version}) Co-Authored-By: Claude Opus 4.6 --- sdk-resources/resources/api_client.mustache | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sdk-resources/resources/api_client.mustache b/sdk-resources/resources/api_client.mustache index 8446a288d..134bfac1a 100644 --- a/sdk-resources/resources/api_client.mustache +++ b/sdk-resources/resources/api_client.mustache @@ -75,15 +75,15 @@ function Invoke-{{{apiNamePrefix}}}ApiClient { break } - # Add SailPoint SDK telemetry headers - $HeaderParameters['X-SailPoint-SDK'] = "powershell/{{packageVersion}}" - $UserAgent = "SailPoint-SDK/powershell/{{{packageVersion}}}" + # Build User-Agent header + $UserAgent = "SailPoint-SDK-PowerShell/{{{packageVersion}}}" if ($Configuration["ConsumerIdentifier"] -and $Configuration["ConsumerVersion"]) { $UserAgent = "$UserAgent ($($Configuration["ConsumerIdentifier"])/$($Configuration["ConsumerVersion"]))" } + if ($IsWindows) { $OSPlatform = "windows" } elseif ($IsLinux) { $OSPlatform = "linux" } elseif ($IsMacOS) { $OSPlatform = "darwin" } else { $OSPlatform = "unknown" } + $OSArch = [System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture.ToString().ToLower() + $UserAgent = "$UserAgent ($OSPlatform; $OSArch) PowerShell/$($PSVersionTable.PSVersion.ToString()) (openapi-generator/{{generatorVersion}})" $HeaderParameters['User-Agent'] = $UserAgent - $HeaderParameters['X-SailPoint-SDK-Runtime'] = "powershell/$($PSVersionTable.PSVersion.ToString())" - $HeaderParameters['X-SailPoint-SDK-OS'] = "$([System.Runtime.InteropServices.RuntimeInformation]::OSDescription.Trim())/$([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture)" $HasFormData = $False