Private/Invoke-DuneDeploymentStage.ps1
|
<#
.SYNOPSIS Trigger the staging process for a deployment. .DESCRIPTION Posts to the deployment stage API endpoint to initiate the staging process. Accepts a deployment by object or by ID. .PARAMETER Deployment A DuneDeployment object. Accepts pipeline input. .PARAMETER DeploymentId The GUID string of the deployment. .EXAMPLE PS> Get-DuneDeployment -Name "app" | Invoke-DuneDeploymentStage Stages the deployment received from the pipeline. #> function Invoke-DuneDeploymentStage { [CmdletBinding(DefaultParameterSetName = "Deployment")] param ( [Parameter(ParameterSetName = "Deployment", ValueFromPipeline)] [DuneDeployment]$Deployment, [Parameter(ParameterSetName = "DeploymentId")] [string]$DeploymentId ) begin { Write-Debug "$($MyInvocation.MyCommand)|begin" } process { Write-Debug "$($MyInvocation.MyCommand)|process|$($PSCmdlet.ParameterSetName)" if ($PSCmdlet.ParameterSetName -eq 'Deployment') { $DeploymentId = $Deployment.Id } Invoke-DuneApiRequest -Uri "deployments/$($DeploymentId)/stage" -Method POST } end { Write-Debug "$($MyInvocation.MyCommand)|end" } } |