Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.1.1 #4

Merged
merged 2 commits into from
Oct 8, 2024
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
4 changes: 2 additions & 2 deletions PSAYX.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# Generated by: Florian Carrier
#
# Generated on: 07/10/2024
# Generated on: 08/10/2024
#

@{
Expand All @@ -12,7 +12,7 @@
RootModule = 'PSAYX.psm1'

# Version number of this module.
ModuleVersion = '1.1.0'
ModuleVersion = '1.1.1'

# Supported PSEditions
# CompatiblePSEditions = @()
Expand Down
84 changes: 57 additions & 27 deletions Public/API/License/Get-LatestRelease.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function Get-LatestRelease {
File name: Get-LatestRelease.ps1
Author: Florian Carrier
Creation date: 2024-09-03
Last modified: 2024-09-04
Last modified: 2024-10-08

.LINK
https://us1.alteryxcloud.com/license-portal/api/swagger-ui/index.html
Expand Down Expand Up @@ -81,38 +81,68 @@ function Get-LatestRelease {
# Parse release date
$Response.Add("Date", $Release.releaseDate)
# Fetch corresponding product installer download URL
if ($Patch) {
$Product = "$ProductID Patch"
} else {
$Product = $ProductID
switch ($ProductID) {
"Alteryx Designer" {
if ($Patch) {
$Product = "$ProductID (Admin version) Patch"
} else {
$Product = "$ProductID (Admin version)"
}
}
"Alteryx Server" {
if ($Patch) {
$Product = "$ProductID Patch"
} else {
$Product = $ProductID
}
}
"Alteryx Intelligence Suite" {
$Product = "$ProductID (Admin)"
}
"Data Packages" {
# TODO handle asynchronous release cycle & demographic packages
$Product = $ProductID.Replace("Spatial", "Location Insights")
}
default {
Write-Log -Type "WARN" -Message "$ProductID is not (yet) supported"
$Product = $ProductID
}
}
$Installer = Get-AlteryxProductEditions -AccountID $AccountID -Token $Token -ReleaseID $Release.id | Where-Object -Property "description" -EQ -Value $Product
# Parse file name
if ((Split-Path -Path $Installer.downloadLink -Leaf) -match '(.+?\.exe)') {
$FileName = $matches[1]
} else {
Write-Log -Type "WARN" -Message "Unable to parse file name"
$FileName = $Null
}
$Response.Add("FileName", $FileName)
# Parse complete version number
if ($Installer.downloadLink -match '_(\d+\.\d+(\.\d+)?(\.\d+)?(\.\d+)?)\.exe') {
$ParsedVersion = $matches[1]
# Hotfix for messed up patch version formatting
if ($Patch) {
$PatchVersion = Select-String -InputObject $ParsedVersion -Pattern '(\d+\.\d+\.\d+)(?:\.\d+)(\.\d+)' -AllMatches
$Version = [System.String]::Concat($PatchVersion.Matches.Groups[1].Value, $PatchVersion.Matches.Groups[2].Value)
try {
if ((Split-Path -Path $Installer.downloadLink -Leaf) -match '(.+?\.exe)') {
$FileName = $matches[1]
} else {
$Version = $ParsedVersion
Write-Log -Type "WARN" -Message "Unable to parse file name"
$FileName = $Null
}
} else {
$Version = $Release.version
$Response.Add("FileName", $FileName)
# Parse complete version number
if ($Installer.downloadLink -match '_(\d+\.\d+(\.\d+)?(\.\d+)?(\.\d+)?)\.exe') {
$ParsedVersion = $matches[1]
# Hotfix for messed up patch version formatting
if ($Patch) {
$PatchVersion = Select-String -InputObject $ParsedVersion -Pattern '(\d+\.\d+\.\d+)(?:\.\d+)(\.\d+)' -AllMatches
$Version = [System.String]::Concat($PatchVersion.Matches.Groups[1].Value, $PatchVersion.Matches.Groups[2].Value)
} else {
$Version = $ParsedVersion
}
} else {
$Version = $Release.version
}
$Response.Add("Version", $Version)
# Expose direct download link
$Response.Add("URL", $Installer.downloadLink)
# Return formatted response object
Write-Log -Type "DEBUG" -Message $Response
}
catch {
Write-Log -Type "ERROR" -Message "Failed to fetch latest release of $ProductID"
$Response = $null
}
$Response.Add("Version", $Version)
# Expose direct download link
$Response.Add("URL", $Installer.downloadLink)
# Return formatted response object
Write-Log -Type "DEBUG" -Message $Response
}
End {
return $Response
}
}
4 changes: 2 additions & 2 deletions Public/API/License/Get-LicensedProducts.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function Get-LicensedProducts {
File name: Get-LicensedProducts.ps1
Author: Florian Carrier
Creation date: 2024-08-22
Last modified: 2024-08-22
Last modified: 2024-10-08

.LINK
https://us1.alteryxcloud.com/license-portal/api/swagger-ui/index.html
Expand Down Expand Up @@ -43,7 +43,7 @@ function Get-LicensedProducts {
Write-Log -Type "DEBUG" -Message $MyInvocation.MyCommand.Name
}
Process {
$Products = Invoke-AlteryxLicenseAPI -Token $AccessToken -Endpoint "v1/products" -AccountID $AccountID
$Products = Invoke-AlteryxLicenseAPI -Token $Token -Endpoint "v1/products" -AccountID $AccountID
return ($Products | ConvertFrom-Json)
}
}
Loading