-
-
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
2322f83
commit 4a80a13
Showing
5 changed files
with
147 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
function Get-VMwareAPIPath { | ||
[CmdletBinding(SupportsShouldProcess = $false)] | ||
[OutputType("System.String")] | ||
param ( | ||
[Parameter(Mandatory = $false)] | ||
[ValidateSet('products', 'dlg')] | ||
[System.String] $Endpoint = "products" | ||
) | ||
$ApiPath = "https://customerconnect.vmware.com/channel/public/api/v1.0/${Endpoint}" | ||
Write-Verbose -Message "$($MyInvocation.MyCommand): Return $ApiPath" | ||
return $ApiPath | ||
} |
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,20 @@ | ||
function Get-VMwareDLGDetailsQuery { | ||
[OutputType("System.String")] | ||
param ( | ||
[Parameter(Mandatory = $true)] | ||
[System.String] $DownloadGroup, | ||
|
||
[Parameter(Mandatory = $false)] | ||
[System.String] $Locale = 'en_US' | ||
) | ||
|
||
$APIResource = 'details' | ||
$queryParameters = @{ | ||
locale = $Locale | ||
downloadGroup = $DownloadGroup | ||
} | ||
$queryString = ($queryParameters.GetEnumerator() | ForEach-Object { "&$($_.Key)=$($_.Value)" }) -join '' | ||
$DlgQuery = "$(Get-VMwareAPIPath -Endpoint 'dlg')/$($APIResource)?$($queryString.TrimStart('&'))" | ||
Write-Verbose -Message "$($MyInvocation.MyCommand): $DlgQuery" | ||
return $DlgQuery | ||
} |
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,41 @@ | ||
function Get-VMwareProductDownload { | ||
<# | ||
.EXTERNALHELP Evergreen.VMware-help.xml | ||
#> | ||
param ( | ||
[Parameter(Mandatory = $true, | ||
Position = 0, | ||
ValueFromPipelineByPropertyName)] | ||
[ValidateNotNullOrEmpty()] | ||
[System.String[]] $Name | ||
) | ||
|
||
process { | ||
foreach ($Product in $Name) { | ||
$VMwareProduct = Get-VMwareProductList -Name $Product | ||
$VMwareDLG = $VMwareProduct | Get-VMwareRelatedDLGList | ||
|
||
foreach ($Dlg in $VMwareDLG) { | ||
$params = @{ | ||
Uri = $(Get-VMwareDLGDetailsQuery -DownloadGroup $Dlg.code) | ||
} | ||
$DownloadFiles = $(Invoke-RestMethodWrapper @params).downloadFiles | ||
|
||
foreach ($File in $DownloadFiles) { | ||
if ([System.String]::IsNullOrEmpty($File.title)) { | ||
} | ||
else { | ||
$Result = [PSCustomObject]@{ | ||
Version = $File.version | ||
ReleaseDate = $([System.DateTime]::ParseExact($File.releaseDate, "yyyy-MM-dd", [System.Globalization.CultureInfo]::CurrentUICulture.DateTimeFormat)) | ||
Md5 = $File.md5checksum | ||
Type = Get-FileType -File $File.fileName | ||
URI = "https://download3.vmware.com/software/$($Dlg.code)/$($File.fileName)" | ||
} | ||
Write-Output -InputObject $Result | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
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,32 @@ | ||
function Get-VMwareProductList { | ||
<# | ||
.EXTERNALHELP Evergreen.VMware-help.xml | ||
#> | ||
[CmdletBinding(SupportsShouldProcess = $false)] | ||
param ( | ||
[Parameter(Mandatory = $false)] | ||
[System.String] $Name | ||
) | ||
|
||
$APIResource = 'getProductsAtoZ' | ||
$params = @{ | ||
Uri = "$(Get-VMwareAPIPath)/${APIResource}" | ||
} | ||
$WebResult = Invoke-RestMethodWrapper @params | ||
|
||
$FilteredProductList = $WebResult.productCategoryList.ProductList | ||
if ($PSBoundParameters.ContainsKey('Name')) { | ||
$FilteredProductList = $FilteredProductList | Where-Object -FilterScript { $_.Name -eq $Name } | ||
} | ||
|
||
$Result = $FilteredProductList | ForEach-Object -Process { | ||
$Action = $_.actions | Where-Object -FilterScript { $_.linkname -eq "Download Product" } | ||
[PSCustomObject]@{ | ||
Name = $_.Name | ||
CategoryMap = $($Action.target -split '/')[-3] | ||
ProductMap = $($Action.target -split '/')[-2] | ||
VersionMap = $($Action.target -split '/')[-1] | ||
} | ||
} | ||
Write-Output -InputObject $Result | ||
} |
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,42 @@ | ||
function Get-VMwareRelatedDLGList { | ||
[CmdletBinding(SupportsShouldProcess = $false)] | ||
param ( | ||
[Parameter(Mandatory = $true, | ||
Position = 0, | ||
ValueFromPipelineByPropertyName)] | ||
[ValidateNotNullOrEmpty()] | ||
[System.String] $CategoryMap, | ||
|
||
[Parameter(Mandatory = $true, | ||
Position = 1, | ||
ValueFromPipelineByPropertyName)] | ||
[ValidateNotNullOrEmpty()] | ||
[System.String] $ProductMap, | ||
|
||
[Parameter(Mandatory = $true, | ||
Position = 2, | ||
ValueFromPipelineByPropertyName)] | ||
[ValidateNotNullOrEmpty()] | ||
[System.String] $VersionMap, | ||
|
||
[Parameter(Mandatory = $false)] | ||
[ValidateSet('PRODUCT_BINARY', 'DRIVERS_TOOLS', 'OPEN_SOURCE', 'CUSTOM_ISO', 'ADDONS')] | ||
[System.String] $DLGType = 'PRODUCT_BINARY' | ||
) | ||
|
||
process { | ||
$APIResource = 'getRelatedDLGList' | ||
$queryParameters = @{ | ||
category = $CategoryMap | ||
product = $ProductMap | ||
version = $VersionMap | ||
dlgType = $DLGType | ||
} | ||
$queryString = ( $queryParameters.GetEnumerator() | ForEach-Object { "&$($_.Key)=$($_.Value)" }) -join '' | ||
$params = @{ | ||
Uri = "$(Get-VMwareAPIPath)/$($APIResource)?$($queryString.TrimStart('&'))" | ||
} | ||
$WebResult = Invoke-RestMethodWrapper @params | ||
Write-Output -InputObject $WebResult.dlgEditionsLists.dlgList | ||
} | ||
} |