/
Get-AdoptiumTemurin17.ps1
31 lines (30 loc) · 1.21 KB
/
Get-AdoptiumTemurin17.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
Function Get-AdoptiumTemurin17 {
<#
.NOTES
Author: Aaron Parker
Twitter: @stealthpuppy
#>
[OutputType([System.Management.Automation.PSObject])]
[CmdletBinding(SupportsShouldProcess = $False)]
param (
[Parameter(Mandatory = $False, Position = 0)]
[ValidateNotNull()]
[System.Management.Automation.PSObject]
$res = (Get-FunctionResource -AppName ("$($MyInvocation.MyCommand)".Split("-"))[1])
)
# Pass the repo releases API URL and return a formatted object
$Releases = Invoke-RestMethodWrapper -Uri $res.Get.Update.Uri
$Targets = $Releases.binary | Where-Object { $_.os -eq $res.Get.Update.MatchOS `
-and $_.image_type -match $res.Get.Update.MatchImage }
ForEach ($Release in $Targets) {
$PSObject = [PSCustomObject]@{
Version = ($Release.scm_ref -split "_")[0]
Type = $Release.image_type
Architecture = Get-Architecture -String $Release.architecture
Checksum = $Release.installer.checksum
Size = $Release.installer.size
URI = $Release.installer.link
}
Write-Output -InputObject $PSObject
}
}