-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #240 from mpuckett159/master
Add new Get functions
- Loading branch information
Showing
29 changed files
with
2,955 additions
and
5 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,146 @@ | ||
function Get-vRABlueprint { | ||
<# | ||
.SYNOPSIS | ||
Get a vRA Blueprint | ||
.DESCRIPTION | ||
Get a vRA Blueprint | ||
.PARAMETER Id | ||
The ID of the Blueprint | ||
.PARAMETER Name | ||
The Name of the Blueprint | ||
.INPUTS | ||
System.String | ||
.OUTPUTS | ||
System.Management.Automation.PSObject | ||
.EXAMPLE | ||
Get-vRABlueprint | ||
.EXAMPLE | ||
Get-vRABlueprint -Id '3492a6e8-r5d4-1293-b6c4-39037ba693f9' | ||
.EXAMPLE | ||
Get-vRABlueprint -Name 'TestBlueprint' | ||
#> | ||
[CmdletBinding(DefaultParameterSetName="Standard")][OutputType('System.Management.Automation.PSObject')] | ||
|
||
Param ( | ||
|
||
[Parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,ParameterSetName="ById")] | ||
[ValidateNotNullOrEmpty()] | ||
[String[]]$Id, | ||
|
||
[Parameter(Mandatory=$true,ParameterSetName="ByName")] | ||
[ValidateNotNullOrEmpty()] | ||
[String[]]$Name | ||
) | ||
|
||
begin { | ||
$APIUrl = '/blueprint/api/blueprints' | ||
|
||
function CalculateOutput([PSCustomObject]$Blueprint) { | ||
|
||
[PSCustomObject] @{ | ||
Name = $Blueprint.name | ||
Content = $Blueprint.content | ||
Id = $Blueprint.id | ||
CreatedAt = $Blueprint.createdAt | ||
CreatedBy = $Blueprint.createdBy | ||
UpdatedAt = $Blueprint.updatedAt | ||
UpdatedBy = $Blueprint.updatedBy | ||
OrgId = $Blueprint.orgId | ||
ProjectId = $Blueprint.projectId | ||
ProjectName = $Blueprint.projectName | ||
Description = $Blueprint.description | ||
Status = $Blueprint.status | ||
TotalVersions = $Blueprint.totalVersions | ||
TotalReleasedVersions = $Blueprint.totalReleasedVersions | ||
RequestScopeOrg = $Blueprint.requestScopeOrg | ||
Valid = $Blueprint.valid | ||
ValidationMessages = $Blueprint.validationMessages | ||
ContentSourceSyncMessages = $Blueprint.contentSourceSyncMessages | ||
} | ||
} | ||
} | ||
|
||
process { | ||
|
||
try { | ||
|
||
switch ($PsCmdlet.ParameterSetName) { | ||
|
||
# --- Get Blueprint by Id | ||
'ById' { | ||
|
||
foreach ($BlueprintId in $Id){ | ||
|
||
$URI = "$($APIUrl)/$($BlueprintId)" | ||
$Response = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference | ||
|
||
foreach($Blueprint in $Response){ | ||
CalculateOutput $Blueprint | ||
} | ||
} | ||
|
||
break | ||
} | ||
# --- Get Blueprint by Name | ||
'ByName' { | ||
|
||
foreach ($BlueprintName in $Name){ | ||
|
||
$URI = "$($APIUrl)" | ||
$Response = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference | ||
|
||
foreach ($Blueprint in $Response.content) { | ||
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 | ||
} | ||
} | ||
} | ||
} | ||
|
||
break | ||
} | ||
# --- No parameters passed so return all Blueprints | ||
'Standard' { | ||
|
||
$URI = $APIUrl | ||
$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 | ||
} | ||
} | ||
} | ||
} | ||
} | ||
catch [Exception]{ | ||
|
||
throw | ||
} | ||
} | ||
|
||
end { | ||
|
||
} | ||
} | ||
|
97 changes: 97 additions & 0 deletions
97
src/Functions/Public/blueprint/Get-vRABlueprintVersion.ps1
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,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 { | ||
|
||
} | ||
} | ||
|
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,126 @@ | ||
function Get-vRACatalogItem { | ||
<# | ||
.SYNOPSIS | ||
Get a vRA Catalog Item | ||
.DESCRIPTION | ||
Get a vRA Catalog Item | ||
.PARAMETER Id | ||
The ID of the Catalog Item | ||
.PARAMETER Name | ||
The Name of the Catalog Item | ||
.INPUTS | ||
System.String | ||
.OUTPUTS | ||
System.Management.Automation.PSObject | ||
.EXAMPLE | ||
Get-vRACatalogItem | ||
.EXAMPLE | ||
Get-vRACatalogItem -Id '3492a6e8-r5d4-1293-b6c4-39037ba693f9' | ||
.EXAMPLE | ||
Get-vRACatalogItem -Name 'TestCatalogItem' | ||
#> | ||
[CmdletBinding(DefaultParameterSetName="Standard")][OutputType('System.Management.Automation.PSObject')] | ||
|
||
Param ( | ||
|
||
[Parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,ParameterSetName="ById")] | ||
[ValidateNotNullOrEmpty()] | ||
[String[]]$Id, | ||
|
||
[Parameter(Mandatory=$true,ParameterSetName="ByName")] | ||
[ValidateNotNullOrEmpty()] | ||
[String[]]$Name | ||
) | ||
|
||
begin { | ||
$APIUrl = '/catalog/api/items' | ||
|
||
function CalculateOutput([PSCustomObject]$CatalogItem) { | ||
|
||
[PSCustomObject] @{ | ||
Id = $CatalogItem.id | ||
Name = $CatalogItem.name | ||
Description = $CatalogItem.description | ||
Type = $CatalogItem.type | ||
ProjectIds = $CatalogItem.projectIds | ||
CreatedAt = $CatalogItem.createdAt | ||
CreatedBy = $CatalogItem.createdBy | ||
LastUpdatedAt = $CatalogItem.lastUpdatedAt | ||
LastUpdatedBy = $CatalogItem.lastUpdatedBy | ||
IconId = $CatalogItem.iconId | ||
BulkRequestLimit = $CatalogItem.bulkRequestLimit | ||
} | ||
} | ||
} | ||
|
||
process { | ||
|
||
try { | ||
|
||
switch ($PsCmdlet.ParameterSetName) { | ||
|
||
# --- Get Catalog Item by Id | ||
'ById' { | ||
|
||
foreach ($CatalogItemId in $Id){ | ||
|
||
$URI = "$($APIUrl)?`$filter=id eq '$($CatalogItemId)'" | ||
$Response = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference | ||
|
||
foreach ($CatalogItem in $Response.content) { | ||
|
||
CalculateOutput $CatalogItem | ||
} | ||
} | ||
|
||
break | ||
} | ||
# --- Get Catalog Item by Name | ||
'ByName' { | ||
|
||
foreach ($CatalogItemName in $Name){ | ||
|
||
$URI = "$($APIUrl)?`$filter=name eq '$($CatalogItemName)'" | ||
$Response = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference | ||
|
||
foreach ($CatalogItem in $Response.content){ | ||
|
||
CalculateOutput $CatalogItem | ||
} | ||
} | ||
|
||
break | ||
} | ||
# --- No parameters passed so return all Catalog Items | ||
'Standard' { | ||
|
||
$URI = $APIUrl | ||
$Response = Invoke-vRARestMethod -Method GET -URI $URI -Verbose:$VerbosePreference | ||
|
||
foreach ($CatalogItem in $Response.content){ | ||
|
||
CalculateOutput $CatalogItem | ||
} | ||
} | ||
} | ||
} | ||
catch [Exception]{ | ||
|
||
throw | ||
} | ||
} | ||
|
||
end { | ||
|
||
} | ||
} | ||
|
Oops, something went wrong.