Skip to content

Commit

Permalink
Merge branch 'complete-iaas-uris'
Browse files Browse the repository at this point in the history
  • Loading branch information
mpuckett159 committed Sep 14, 2020
2 parents c6ee4f6 + 2a93e4a commit f1dd43d
Show file tree
Hide file tree
Showing 3 changed files with 110 additions and 18 deletions.
29 changes: 12 additions & 17 deletions src/Functions/Public/blueprint/Get-vRABlueprint.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -80,18 +80,11 @@ function Get-vRABlueprint {

foreach ($BlueprintId in $Id){

$URI = "$($APIUrl)?`$filter=id eq '$($BlueprintId)'"
$URI = "$($APIUrl)/$($BlueprintId)"
$Response = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference

foreach ($Blueprint in $Response.content) {
# Get individual blueprint link
$BlueprintSelfLink = $blueprint.selfLink

# Get full blueprint resource info
$FullBlueprints = Invoke-vRARestMethod -Method GET -URI $BlueprintSelfLink -Verbose:$VerbosePreference
foreach ($FullBlueprint in $FullBlueprints){
CalculateOutput $FullBlueprint
}
foreach($Blueprint in $Response){
CalculateOutput $Blueprint
}
}

Expand All @@ -102,17 +95,19 @@ function Get-vRABlueprint {

foreach ($BlueprintName in $Name){

$URI = "$($APIUrl)?`$filter=name eq '$($BlueprintName)'"
$URI = "$($APIUrl)"
$Response = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference

foreach ($Blueprint in $Response.content) {
# Get individual blueprint link
$BlueprintSelfLink = $blueprint.selfLink
if($Blueprint.name -eq $BlueprintName){
# Get individual blueprint link
$BlueprintSelfLink = $blueprint.selfLink

# Get full blueprint resource info
$FullBlueprints = Invoke-vRARestMethod -Method GET -URI $BlueprintSelfLink -Verbose:$VerbosePreference
foreach ($FullBlueprint in $FullBlueprints){
CalculateOutput $FullBlueprint
# Get full blueprint resource info
$FullBlueprints = Invoke-vRARestMethod -Method GET -URI $BlueprintSelfLink -Verbose:$VerbosePreference
foreach ($FullBlueprint in $FullBlueprints){
CalculateOutput $FullBlueprint
}
}
}
}
Expand Down
97 changes: 97 additions & 0 deletions src/Functions/Public/blueprint/Get-vRABlueprintVersion.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
function Get-vRABlueprintVersion {
<#
.SYNOPSIS
Get a vRA Blueprint's Versions
.DESCRIPTION
Get a vRA Blueprint's Versions
.PARAMETER Blueprint
The vRA Blueprint object as returned by Get-vRABlueprint
.INPUTS
System.String
.OUTPUTS
System.Management.Automation.PSObject
.EXAMPLE
Get-vRABlueprint | Get-vRABlueprintVersion
.EXAMPLE
Get-vRABlueprintVersion -Blueprint (Get-vRABlueprint -Id '3492a6e8-r5d4-1293-b6c4-39037ba693f9')
.EXAMPLE
Get-vRABlueprintVersion -Blueprint (Get-vRABlueprint -Name 'TestBlueprint')
#>
[CmdletBinding(DefaultParameterSetName="Standard")][OutputType('System.Management.Automation.PSObject')]

Param (

[Parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,ParameterSetName="Blueprint")]
[ValidateNotNullOrEmpty()]
[PSCustomObject[]]$Blueprint
)

begin {
$APIUrl = '/blueprint/api/blueprints'

function CalculateOutput([PSCustomObject]$BlueprintVersion) {

[PSCustomObject] @{
Id = $BlueprintVersion.id
CreatedAt = $BlueprintVersion.createdAt
CreatedBy = $BlueprintVersion.createdBy
UpdatedAt = $BlueprintVersion.updatedAt
UpdatedBy = $BlueprintVersion.updatedBy
OrganizationId = $BlueprintVersion.orgId
ProjectId = $BlueprintVersion.projectId
ProjectName = $BlueprintVersion.projectName
SelfLink = $BlueprintVersion.selfLink
BlueprintId = $BlueprintVersion.blueprintId
Name = $BlueprintVersion.name
Description = $BlueprintVersion.description
Version = $BlueprintVersion.version
Status = $BlueprintVersion.status
VersionDescription = $BlueprintVersion.versionDescription
VersionChangeLog = $BlueprintVersion.versionChangeLog
Valid = $BlueprintVersion.valid
}
}
}

process {

try {

switch ($PsCmdlet.ParameterSetName) {

# --- Get BlueprintVersion from Blueprint object
'Blueprint' {

foreach ($Blueprintobj in $Blueprint){

$URI = "$($APIUrl)/$($Blueprintobj.Id)/versions"
$Response = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference

foreach($version in $Response.content){
CalculateOutput $version
}
}

break
}
}
}
catch [Exception]{

throw
}
}

end {

}
}

2 changes: 1 addition & 1 deletion src/PowervRA.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ PowerShellVersion = '5.1'
# NestedModules = @()

# Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export.
FunctionsToExport = @('Connect-vRAServer','Disconnect-vRAServer','Get-vRAAPIVersion','Get-vRABlockDevice','Get-vRABlueprint','Get-vRACatalogItem','Get-vRACloudAccount','Get-vRACloudZone','Get-vRACodeStreamExecution','Get-vRACodeStreamPipeline','Get-vRACodeStreamVariable','Get-vRAContentSource','Get-vRADeployment','Get-vRAExternalNetworkIPRange','Get-vRAFabricAWSVolumeType','Get-vRAFabricAzureStorageAccount','Get-vRAFabricCompute','Get-vRAFabricImage','Get-vRAFabricNetwork','Get-vRAFlavorProfile','Get-vRAImageProfile','Get-vRALoadBalancer','Get-vRAMachine','Get-vRAMachineDisk','Get-vRANetwork','Get-vRANetworkDomain','Get-vRANetworkIPRange','Get-vRANetworkProfile','Get-vRAOnboardingDeployment','Get-vRAOnboardingPlan','Get-vRAOnboardingPlanExecution','Get-vRAOnboardingResource','Get-vRAProject','Get-vRARegion','Get-vRARegionEnumerationvSphere','Get-vRARequest','Get-vRASecurityGroup','Get-vRAStorageProfile','Get-vRATag','Get-vRAvSphereFabricDatastore','Get-vRAFabricNetwork','Get-vRAvSphereFabricStoragePolicy','Invoke-vRAOnboardingPlan','Invoke-vRARestMethod','New-vRACloudAccountAzure','New-vRACloudAccountGCP','New-vRACloudAccountvSphere','New-vRAMachineAttachedDisk','New-vRAOnboardingDeployment','New-vRAOnboardingPlan','New-vRAOnboardingResource','New-vRAProject','New-vRAVirtualDisk','Remove-vRACloudAccount','Remove-vRACodeStreamExecution','Remove-vRACodeStreamVariable','Remove-vRAOnboardingDeployment','Remove-vRAOnboardingPlan','Remove-vRAOnboardingResource','Remove-vRAProject','Resize-vRAMachine','Restart-vRAMachine','Restart-vRAMachineGuestOS','Start-vRAMachine','Stop-vRAMachine','Stop-vRAMachineGuestOS','Suspend-vRAMachine','Update-vRACodeStreamVariable')
FunctionsToExport = @('Connect-vRAServer','Disconnect-vRAServer','Get-vRAAPIVersion','Get-vRABlockDevice','Get-vRABlueprint','Get-vRABlueprintVersion','Get-vRACatalogItem','Get-vRACloudAccount','Get-vRACloudZone','Get-vRACodeStreamExecution','Get-vRACodeStreamPipeline','Get-vRACodeStreamVariable','Get-vRAContentSource','Get-vRADeployment','Get-vRAExternalNetworkIPRange','Get-vRAFabricAWSVolumeType','Get-vRAFabricAzureStorageAccount','Get-vRAFabricCompute','Get-vRAFabricImage','Get-vRAFabricNetwork','Get-vRAFlavorProfile','Get-vRAImageProfile','Get-vRALoadBalancer','Get-vRAMachine','Get-vRAMachineDisk','Get-vRANetwork','Get-vRANetworkDomain','Get-vRANetworkIPRange','Get-vRANetworkProfile','Get-vRAOnboardingDeployment','Get-vRAOnboardingPlan','Get-vRAOnboardingPlanExecution','Get-vRAOnboardingResource','Get-vRAProject','Get-vRARegion','Get-vRARegionEnumerationvSphere','Get-vRARequest','Get-vRASecurityGroup','Get-vRAStorageProfile','Get-vRATag','Get-vRAvSphereFabricDatastore','Get-vRAFabricNetwork','Get-vRAvSphereFabricStoragePolicy','Invoke-vRAOnboardingPlan','Invoke-vRARestMethod','New-vRACloudAccountAzure','New-vRACloudAccountGCP','New-vRACloudAccountvSphere','New-vRAMachineAttachedDisk','New-vRAOnboardingDeployment','New-vRAOnboardingPlan','New-vRAOnboardingResource','New-vRAProject','New-vRAVirtualDisk','Remove-vRACloudAccount','Remove-vRACodeStreamExecution','Remove-vRACodeStreamVariable','Remove-vRAOnboardingDeployment','Remove-vRAOnboardingPlan','Remove-vRAOnboardingResource','Remove-vRAProject','Resize-vRAMachine','Restart-vRAMachine','Restart-vRAMachineGuestOS','Start-vRAMachine','Stop-vRAMachine','Stop-vRAMachineGuestOS','Suspend-vRAMachine','Update-vRACodeStreamVariable')

# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export.
CmdletsToExport = @()
Expand Down

0 comments on commit f1dd43d

Please sign in to comment.