Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions PSSailpoint/Configuration.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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

}
Expand Down Expand Up @@ -134,6 +142,8 @@ function Set-DefaultConfiguration {
[System.Nullable[Int32]]$RetryIntervalSeconds,
[System.Nullable[Boolean]]$Experimental,
[System.Object]$Proxy,
[string]$ConsumerIdentifier,
[string]$ConsumerVersion,
[switch]$PassThru
)

Expand Down Expand Up @@ -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."
Expand Down
12 changes: 9 additions & 3 deletions sdk-resources/resources/api_client.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -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"
# 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


$HasFormData = $False
Expand Down