-
-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6aa82ad
commit 76d31bc
Showing
8 changed files
with
82 additions
and
175 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
Function Get-HashicorpApp { | ||
<# | ||
.SYNOPSIS | ||
Get the current versions and download URLs for Hashicorp apps. | ||
.NOTES | ||
Author: Aaron Parker | ||
Twitter: @stealthpuppy | ||
#> | ||
[OutputType([System.Management.Automation.PSObject])] | ||
[CmdletBinding(SupportsShouldProcess = $false)] | ||
param ( | ||
[Parameter(Mandatory = $false, Position = 0)] | ||
[ValidateNotNullOrEmpty()] | ||
[System.Management.Automation.PSObject] $res | ||
) | ||
|
||
# Pass the repo releases API URL and return a formatted object | ||
$params = @{ | ||
Uri = $res.Get.Update.Uri | ||
MatchVersion = $res.Get.Update.MatchVersion | ||
Filter = $res.Get.Update.MatchFileTypes | ||
ReturnVersionOnly = $true | ||
} | ||
$object = Get-GitHubRepoRelease @params | ||
|
||
# Build the output object | ||
if ($null -ne $object) { | ||
foreach ($Architecture in $res.Get.Download.Uri.GetEnumerator()) { | ||
$Uri = $res.Get.Download.Uri[$Architecture.Key] -replace $res.Get.Download.ReplaceText, $object.Version | ||
$PSObject = [PSCustomObject] @{ | ||
Version = $object.Version | ||
Type = Get-FileType -File $Uri | ||
Architecture = $Architecture.Name | ||
URI = $Uri | ||
} | ||
Write-Output -InputObject $PSObject | ||
} | ||
} | ||
} |