Skip to content

Commit

Permalink
feat: add support for aria suite lifecycle load balancer (#414)
Browse files Browse the repository at this point in the history
- Added `Get-vRSLCMLoadbalancer` cmdlet to support retrieving a list of load balancers configure in VMware Aria Suite Lifecycle.
- Added `New-vRSLCMLoadbalancer` cmdlet to support adding a new load balancer to VMware Aria Suite Lifecycle.
- Added `Remove-vRSLCMLoadbalancer` cmdlet to support removing a load balancer from VMware Aria Suite Lifecycle.
- Enhanced `New-WSADeployment` cmdlet to check for existence of the a load balancer in VMware Aria Suite Lifecycle and if missing create it.
- Enhanced `New-vROPSDeployment` cmdlet to check for existence of the a load balancer in VMware Aria Suite Lifecycle and if missing create it.
- Enhanced `New-vRADeployment` cmdlet to check for existence of the a load balancer in VMware Aria Suite Lifecycle and if missing create it.

Signed-off-by: Gary Blake <gblake@vmware.com>
  • Loading branch information
GaryJBlake authored Nov 27, 2023
1 parent 9605139 commit d647f5a
Show file tree
Hide file tree
Showing 3 changed files with 124 additions and 4 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,20 @@
- Added `Add-NsxtLdapRole` cmdlet to assign an LDAP user or group role-based access control in NSX Manager.
- Added `Undo-NsxtLdapRole` cmdlet to remove an LDAP user or group role-based access control from NSX Manager.
- Added `Undo-vRLIAuthenticationWSA` cmdlet to support disable Workspace ONE Access integration with VMware Aria Operations for Logs.
- Added `Get-vRSLCMLoadbalancer` cmdlet to support retrieving a list of load balancers configured in VMware Aria Suite Lifecycle.
- Added `New-vRSLCMLoadbalancer` cmdlet to support adding a new load balancer to VMware Aria Suite Lifecycle.
- Added `Remove-vRSLCMLoadbalancer` cmdlet to support removing a load balancer from VMware Aria Suite Lifecycle.
- Enhanced `Add-WorkspaceOneRole` cmdlet for better pre and post validation.
- Enhanced `Add-vRLIAuthenticationWSA` cmdlet to check for connectivity and authentication to Workspace ONE Access.
- Enhanced `Set-NsxtRole` cmdlet to support adding roles to LDAP users.
- Enhanced `Get-vRLIGroup` cmdlet to support v2 API for retrieving group membership by authentication provider in VMware Aria Operations for Logs.
- Enhanced `Add-vRLIGroup` cmdlet to support v2 API for adding group membership by authentication provider in VMware Aria Operations for Logs.
- Enhanced `Remove-vRLIGroup` cmdlet to support v2 API for removing group membership by authentication provider in VMware Aria Operations for Logs.
- Enhanced `Add-vRLIAuthenticationGroup` cmdlet to support updated `Add-vRLIGroup` cmdlet usage and Active Directory support.
- Enhanced `New-WSADeployment` cmdlet to better handle checking for reporting a missing Cross-Instance Datacenter.
- Enhanced `New-WSADeployment` cmdlet to better handle checking for and reporting a missing Cross-Instance Datacenter.
- Enhanced `New-WSADeployment` cmdlet to check for the existence of a load balancer in VMware Aria Suite Lifecycle and if missing create it.
- Enhanced `New-vROPSDeployment` cmdlet to check for the existence of the a load balancer in VMware Aria Suite Lifecycle and if missing create it.
- Enhanced `New-vRADeployment` cmdlet to check for the existence of the a load balancer in VMware Aria Suite Lifecycle and if missing create it.

## v2.7.1

Expand Down
2 changes: 1 addition & 1 deletion PowerValidatedSolutions.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
RootModule = 'PowerValidatedSolutions.psm1'

# Version number of this module.
ModuleVersion = '2.8.0.1009'
ModuleVersion = '2.8.0.1010'

# Supported PSEditions
# CompatiblePSEditions = @()
Expand Down
118 changes: 116 additions & 2 deletions PowerValidatedSolutions.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -11066,6 +11066,12 @@ Function New-vROPSDeployment {
$jsonSpecFileName = (((Get-VCFWorkloadDomain | Where-Object {$_.type -eq "MANAGEMENT"}).name) + "-" + "vropsDeploymentSpec.json")
$json = (Get-Content -Raw $jsonSpecFileName)
$jsonSpec = $json | ConvertFrom-Json
$pnpWorkbook = Open-ExcelPackage -Path $workbook
$loadBalancerFqdn = $pnpWorkbook.Workbook.Names["xreg_vrops_virtual_fqdn"].Value
$loadBalancerIp = $pnpWorkbook.Workbook.Names["xreg_vrops_virtual_ip"].Value
if (!(((Get-vRSLCMLoadbalancer -type NSX_T) | Where-Object {$_.loadBalancerDetails -match $loadBalancerFqdn}))) {
New-vRSLCMLoadbalancer -type NSX_T -loadBalancerIp $loadBalancerIp -loadBalancerFqdn $loadBalancerFqdn | Out-Null
}
if (!((Get-vRSLCMEnvironment | Where-Object {$_.environmentName -eq $jsonSpec.environmentName}).products.id -contains $jsonSpec.products.id)) {
if (Get-vRSLCMLockerPassword -alias $($jsonSpec.products.properties.productPassword.Split(":")[3])) {
if (Get-vRSLCMLockerCertificate | Where-Object {$_.alias -Match $($jsonSpec.products.properties.certificate.Split(":")[3])}) {
Expand Down Expand Up @@ -13546,6 +13552,12 @@ Function New-vRADeployment {
$jsonSpecFileName = (((Get-VCFWorkloadDomain | Where-Object {$_.type -eq "MANAGEMENT"}).name) + "-" + "vraDeploymentSpec.json")
$json = (Get-Content -Raw $jsonSpecFileName)
$jsonSpec = $json | ConvertFrom-Json
$pnpWorkbook = Open-ExcelPackage -Path $workbook
$loadBalancerFqdn = $pnpWorkbook.Workbook.Names["xreg_vra_virtual_fqdn"].Value
$loadBalancerIp = $pnpWorkbook.Workbook.Names["xreg_vra_virtual_ip"].Value
if (!(((Get-vRSLCMLoadbalancer -type NSX_T) | Where-Object {$_.loadBalancerDetails -match $loadBalancerFqdn}))) {
New-vRSLCMLoadbalancer -type NSX_T -loadBalancerIp $loadBalancerIp -loadBalancerFqdn $loadBalancerFqdn | Out-Null
}
if (!((Get-vRSLCMEnvironment | Where-Object {$_.environmentName -eq $jsonSpec.environmentName}).products.id -contains $jsonSpec.products.id)) {
if (Get-vRSLCMLockerPassword -alias $($jsonSpec.products.properties.productPassword.Split(":")[3])) {
if (Get-vRSLCMLockerCertificate | Where-Object {$_.alias -Match $($jsonSpec.products.properties.certificate.Split(":")[3])}) {
Expand Down Expand Up @@ -26200,6 +26212,102 @@ Function Remove-vRSLCMEnvironment {
}
Export-ModuleMember -Function Remove-vRSLCMEnvironment


Function Get-vRSLCMLoadbalancer {
<#
.SYNOPSIS
Get paginated list of load balancers from VMware Aria Suite Lifecycle

.DESCRIPTION
The Get-vRSLCMLoadbalancer cmdlet gets a paginated list of load balancers from VMware Aria Suite Lifecycle

.EXAMPLE
Get-vRSLCMLoadbalancer -type NSX_T
This example gets all load balancers in VMware Aria Suite Lifecycle with a type of NSX_T
#>

Param (
[Parameter (Mandatory = $true)] [ValidateSet('NSX_T','NSX_ALB','OTHERS')] [String]$type,
[Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [Bool]$available=$false
)

Try {
$uri = "https://$vrslcmAppliance/lcm/lcops/api/controller/all?isAvailable=$available&type=$type"
Invoke-RestMethod $uri -Method 'GET' -Headers $vrslcmHeaders
} Catch {
Write-Error $_.Exception.Message
}
}
Export-ModuleMember -Function Get-vRSLCMLoadbalancer

Function New-vRSLCMLoadbalancer {
<#
.SYNOPSIS
Add a load balancer to VMware Aria Suite Lifecycle

.DESCRIPTION
The New-vRSLCMLoadbalancer cmdlet adds a new loadbalancers to VMware Aria Suite Lifecycle

.EXAMPLE
New-vRSLCMLoadbalancer -type NSX_T -loadBalancerIp 192.168.11.60 -loadBalancerFqdn xint-wsa01.rainpole.io
This example adds load balancers in VMware Aria Suite Lifecycle with a type of NSX_T
#>

Param (
[Parameter (Mandatory = $true)] [ValidateSet('NSX_T')] [String]$type,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$loadBalancerIp,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$loadBalancerFqdn
)

Try {
$uri = "https://$vrslcmAppliance/lcm/lcops/api/controller/save"
$Global:body = ' {
"type": "'+ $type +'",
"userName": "",
"controllerFqdn": "",
"passwordReference": "",
"loadBalancerFQDN": "'+ $loadBalancerFqdn +'",
"loadBalancerIP": "'+ $loadBalancerIp +'",
"controllerMeta": {},
"loadBalancerMeta": {},
"controllerIP": "",
"controllerID": ""
}'
Invoke-RestMethod $uri -Method 'POST' -Headers $vrslcmHeaders -Body $body
} Catch {
Write-Error $_.Exception.Message
}
}
Export-ModuleMember -Function New-vRSLCMLoadbalancer

Function Remove-vRSLCMLoadbalancer {
<#
.SYNOPSIS
Delete a load balancer from VMware Aria Suite Lifecycle

.DESCRIPTION
The Remove-vRSLCMLoadbalancer cmdlet removes a load balancer from VMware Aria Suite Lifecycle

.EXAMPLE
Remove-vRSLCMLoadbalancer -type NSX_T -loadBalancerFqdn xint-wsa01.rainpole.io
This example deletes the load balancer from VMware Aria Suite Lifecycle
#>

Param (
[Parameter (Mandatory = $true)] [ValidateSet('NSX_T','NSX_ALB','OTHERS')] [String]$type,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$loadBalancerFqdn
)

Try {
$controllerId = ((Get-vRSLCMLoadbalancer -type $type) | Where-Object {$_.loadBalancerDetails -match $loadBalancerFqdn}).controller_id
$uri = "https://$vrslcmAppliance/lcm/lcops/api/controller/loadbalancer/delete?controllerID=$controllerId&loadBalancerFQDN=$loadBalancerFqdn"
Invoke-RestMethod $uri -Method 'DELETE' -Headers $vrslcmHeaders
} Catch {
Write-Error $_.Exception.Message
}
}
Export-ModuleMember -Function Remove-vRSLCMLoadbalancer

Function Get-vRSLCMRequest {
<#
.SYNOPSIS
Expand Down Expand Up @@ -26674,7 +26782,13 @@ Function New-WSADeployment {
$commandSwitch = $commandSwitch + " -useContentLibrary -contentLibrary $contentLibrary"
}
Invoke-Expression "Export-WSAJsonSpec -server $server -user $user -pass $pass -workbook $workbook $($commandSwitch) -ErrorAction SilentlyContinue -ErrorVariable ErrorMsg"
if (!$ErrorMsg) {
if (!$ErrorMsg) {
$pnpWorkbook = Open-ExcelPackage -Path $workbook
$loadBalancerFqdn = $pnpWorkbook.Workbook.Names["xreg_wsa_virtual_fqdn"].Value
$loadBalancerIp = $pnpWorkbook.Workbook.Names["xreg_wsa_virtual_ip"].Value
if (!(((Get-vRSLCMLoadbalancer -type NSX_T) | Where-Object {$_.loadBalancerDetails -match $loadBalancerFqdn}))) {
New-vRSLCMLoadbalancer -type NSX_T -loadBalancerIp $loadBalancerIp -loadBalancerFqdn $loadBalancerFqdn | Out-Null
}
$jsonSpecFileName = (((Get-VCFWorkloadDomain | Where-Object {$_.type -eq "MANAGEMENT"}).name) + "-" + "wsaDeploymentSpec.json")
$json = (Get-Content -Raw $jsonSpecFileName)
$jsonSpec = $json | ConvertFrom-Json
Expand Down Expand Up @@ -31425,7 +31539,7 @@ Function Set-vRLIAuthenticationAD {
)

Try {
$Global:jsonSpec = New-Object -TypeName psobject
$jsonSpec = New-Object -TypeName psobject
$jsonSpec | Add-Member -notepropertyname 'enableAD' -notepropertyvalue $true
$jsonSpec | Add-Member -notepropertyname 'domain' -notepropertyvalue $domain
$jsonSpec | Add-Member -notepropertyname 'domainServers' -notepropertyvalue $domainServers
Expand Down

0 comments on commit d647f5a

Please sign in to comment.