-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into bugfix-update-calculateOutput-function
- Loading branch information
Showing
6 changed files
with
627 additions
and
0 deletions.
There are no files selected for viewing
123 changes: 123 additions & 0 deletions
123
src/Functions/Public/codestream/Get-vRACodeStreamExecution.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,123 @@ | ||
function Get-vRACodeStreamExecution { | ||
<# | ||
.SYNOPSIS | ||
Retrieve vRA Code Stream Execution depending on input | ||
.DESCRIPTION | ||
Retrieve a list of vRA Code Stream Executions or a single Execution depending on input | ||
.PARAMETER Id | ||
The ID of the vRA Code Stream Execution | ||
.PARAMETER Pipeline | ||
The name of the Pipeline of the vRA Code Stream Execution | ||
.PARAMETER Project | ||
The name of the Project of the vRA Code Stream Execution | ||
.OUTPUTS | ||
System.Management.Automation.PSObject. | ||
.EXAMPLE | ||
Get-vRACodeStreamExecution | ||
.EXAMPLE | ||
Get-vRACodeStreamExecution -Id '96afe0f9-a2ac-4468-8671-a2ca6fdbca37' | ||
.EXAMPLE | ||
Get-vRACodeStreamExecution -Pipeline 'My Pipeline' | ||
.EXAMPLE | ||
Get-vRACodeStreamExecution -Project 'My Project' | ||
#> | ||
[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[]]$Pipeline, | ||
|
||
[Parameter(Mandatory=$true,ParameterSetName="ByProject")] | ||
[ValidateNotNullOrEmpty()] | ||
[String[]]$Project | ||
|
||
) | ||
Begin { | ||
|
||
$APIUrl = "/pipeline/api/executions" | ||
|
||
function CalculateOutput($responseObject) { | ||
foreach ($Record in $responseObject.documents.PsObject.Properties) { | ||
[PSCustomObject]@{ | ||
Name = $Record.value.name+" #"+$Record.value.index | ||
Project = $Record.value.project | ||
Id = $Record.value.id | ||
LastUpdated = $Record.value.updatedAt | ||
Status = $Record.value.status | ||
StatusMessage = $Record.value.statusMessage | ||
ExecutedBy = $Record.value._executedBy | ||
} | ||
} | ||
} | ||
} | ||
Process { | ||
|
||
try { | ||
|
||
switch ($PsCmdlet.ParameterSetName) { | ||
|
||
# --- Get Execution by its id | ||
'ById' { | ||
foreach ($executionId in $Id) { | ||
$Response = Invoke-vRARestMethod -URI "$APIUrl`?`$filter=id eq '$executionId'" -Method GET | ||
CalculateOutput($Response) | ||
} | ||
|
||
break | ||
} | ||
|
||
# --- Get Execution by its pipeline name | ||
'ByName' { | ||
foreach ($pipelineName in $Pipeline) { | ||
$Response = Invoke-vRARestMethod -URI "$APIUrl`?`$filter=name eq '$pipelineName'" -Method GET | ||
CalculateOutput($Response) | ||
} | ||
|
||
break | ||
} | ||
|
||
# --- Get Execution by its project name | ||
'ByProject' { | ||
foreach ($projectName in $Project) { | ||
$Response = Invoke-vRARestMethod -URI "$APIUrl`?`$filter=project eq '$projectName'" -Method GET | ||
CalculateOutput($Response) | ||
} | ||
|
||
break | ||
} | ||
|
||
# --- No parameters passed so return all executions | ||
'Standard' { | ||
$Response = Invoke-vRARestMethod -URI $APIUrl -Method GET | ||
CalculateOutput($Response) | ||
} | ||
|
||
} | ||
|
||
|
||
} | ||
catch [Exception]{ | ||
|
||
throw | ||
} | ||
} | ||
End { | ||
|
||
} | ||
} |
122 changes: 122 additions & 0 deletions
122
src/Functions/Public/codestream/Get-vRACodeStreamPipeline.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,122 @@ | ||
function Get-vRACodeStreamPipeline { | ||
<# | ||
.SYNOPSIS | ||
Retrieve vRA Code Stream Pipeline depending on input | ||
.DESCRIPTION | ||
Retrieve a list of vRA Code Stream Pipelines or a single Pipeline depending on input | ||
.PARAMETER Id | ||
The ID of the vRA Code Stream Pipeline | ||
.PARAMETER Pipeline | ||
The name of the Pipeline of the vRA Code Stream Pipeline | ||
.PARAMETER Project | ||
The name of the Project of the vRA Code Stream Pipeline | ||
.OUTPUTS | ||
System.Management.Automation.PSObject. | ||
.EXAMPLE | ||
Get-vRACodeStreamPipeline | ||
.EXAMPLE | ||
Get-vRACodeStreamPipeline -Id '96afe0f9-a2ac-4468-8671-a2ca6fdbca37' | ||
.EXAMPLE | ||
Get-vRACodeStreamPipeline -Pipeline 'My Pipeline' | ||
.EXAMPLE | ||
Get-vRACodeStreamPipeline -Project 'My Project' | ||
#> | ||
[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[]]$Pipeline, | ||
|
||
[Parameter(Mandatory=$true,ParameterSetName="ByProject")] | ||
[ValidateNotNullOrEmpty()] | ||
[String[]]$Project | ||
|
||
) | ||
Begin { | ||
|
||
$APIUrl = "/pipeline/api/pipelines" | ||
|
||
function CalculateOutput($responseObject) { | ||
foreach ($Record in $responseObject.documents.PsObject.Properties) { | ||
[PSCustomObject]@{ | ||
Name = $Record.value.name | ||
Project = $Record.value.project | ||
Id = $Record.value.id | ||
LastUpdated = $Record.value.updatedAt | ||
UpdatedBy = $Record.value._updatedBy | ||
State = $Record.value.state | ||
} | ||
} | ||
} | ||
} | ||
Process { | ||
|
||
try { | ||
|
||
switch ($PsCmdlet.ParameterSetName) { | ||
|
||
# --- Get Pipeline by its id | ||
'ById' { | ||
foreach ($pipelineId in $Id) { | ||
$Response = Invoke-vRARestMethod -URI "$APIUrl`?`$filter=id eq '$pipelineId'" -Method GET | ||
CalculateOutput($Response) | ||
} | ||
|
||
break | ||
} | ||
|
||
# --- Get Pipeline by its pipeline name | ||
'ByName' { | ||
foreach ($pipelineName in $Pipeline) { | ||
$Response = Invoke-vRARestMethod -URI "$APIUrl`?`$filter=name eq '$pipelineName'" -Method GET | ||
CalculateOutput($Response) | ||
} | ||
|
||
break | ||
} | ||
|
||
# --- Get Pipeline by its project name | ||
'ByProject' { | ||
foreach ($projectName in $Project) { | ||
$Response = Invoke-vRARestMethod -URI "$APIUrl`?`$filter=project eq '$projectName'" -Method GET | ||
CalculateOutput($Response) | ||
} | ||
|
||
break | ||
} | ||
|
||
# --- No parameters passed so return all Pipelines | ||
'Standard' { | ||
$Response = Invoke-vRARestMethod -URI $APIUrl -Method GET | ||
CalculateOutput($Response) | ||
} | ||
|
||
} | ||
|
||
|
||
} | ||
catch [Exception]{ | ||
|
||
throw | ||
} | ||
} | ||
End { | ||
|
||
} | ||
} |
123 changes: 123 additions & 0 deletions
123
src/Functions/Public/codestream/Get-vRACodeStreamVariable.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,123 @@ | ||
function Get-vRACodeStreamVariable { | ||
<# | ||
.SYNOPSIS | ||
Retrieve vRA Code Stream Variable depending on input | ||
.DESCRIPTION | ||
Retrieve a list of vRA Code Stream Variables or a single Variable depending on input | ||
.PARAMETER Id | ||
The ID of the vRA Code Stream Variable | ||
.PARAMETER Variable | ||
The name of the Variable of the vRA Code Stream Variable | ||
.PARAMETER Project | ||
The name of the Project of the vRA Code Stream Variable | ||
.OUTPUTS | ||
System.Management.Automation.PSObject. | ||
.EXAMPLE | ||
Get-vRACodeStreamVariable | ||
.EXAMPLE | ||
Get-vRACodeStreamVariable -Id '96afe0f9-a2ac-4468-8671-a2ca6fdbca37' | ||
.EXAMPLE | ||
Get-vRACodeStreamVariable -Variable 'My Variable' | ||
.EXAMPLE | ||
Get-vRACodeStreamVariable -Project 'My Project' | ||
#> | ||
[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[]]$Variable, | ||
|
||
[Parameter(Mandatory=$true,ParameterSetName="ByProject")] | ||
[ValidateNotNullOrEmpty()] | ||
[String[]]$Project | ||
|
||
) | ||
Begin { | ||
|
||
$APIUrl = "/pipeline/api/variables" | ||
|
||
function CalculateOutput($responseObject) { | ||
foreach ($Record in $responseObject.documents.PsObject.Properties) { | ||
[PSCustomObject]@{ | ||
Name = $Record.value.name | ||
Project = $Record.value.project | ||
Id = $Record.value.id | ||
Type = $Record.value.type | ||
LastUpdated = $Record.value.updatedAt | ||
CreatedBy = $Record.value._createdBy | ||
Value = $Record.value.value | ||
} | ||
} | ||
} | ||
} | ||
Process { | ||
|
||
try { | ||
|
||
switch ($PsCmdlet.ParameterSetName) { | ||
|
||
# --- Get Variable by its id | ||
'ById' { | ||
foreach ($variableId in $Id) { | ||
$Response = Invoke-vRARestMethod -URI "$APIUrl`?`$filter=id eq '$variableId'" -Method GET | ||
CalculateOutput($Response) | ||
} | ||
|
||
break | ||
} | ||
|
||
# --- Get Variable by its name | ||
'ByName' { | ||
foreach ($variableName in $Variable) { | ||
$Response = Invoke-vRARestMethod -URI "$APIUrl`?`$filter=name eq '$variableName'" -Method GET | ||
CalculateOutput($Response) | ||
} | ||
|
||
break | ||
} | ||
|
||
# --- Get Variable by its project name | ||
'ByProject' { | ||
foreach ($projectName in $Project) { | ||
$Response = Invoke-vRARestMethod -URI "$APIUrl`?`$filter=project eq '$projectName'" -Method GET | ||
CalculateOutput($Response) | ||
} | ||
|
||
break | ||
} | ||
|
||
# --- No parameters passed so return all Variables | ||
'Standard' { | ||
$Response = Invoke-vRARestMethod -URI $APIUrl -Method GET | ||
CalculateOutput($Response) | ||
} | ||
|
||
} | ||
|
||
|
||
} | ||
catch [Exception]{ | ||
|
||
throw | ||
} | ||
} | ||
End { | ||
|
||
} | ||
} |
Oops, something went wrong.