Public/Start-DuneDeployment.ps1
|
<# .SYNOPSIS Start resources for a deployment. .DESCRIPTION Requests the Dune API to start all resources for a deployment. Identify the deployment by `Id` or pass a `DuneDeployment` object via pipeline. Accepts an optional transaction id (`TxId`). .PARAMETER Id The GUID of the deployment to start resources for. Use the `Id` parameter set. .PARAMETER Deployment A `DuneDeployment` object; pipeline input supported to identify the deployment to start. .PARAMETER TxId Optional transaction id passed to the API. Defaults to a new GUID when not specified. .EXAMPLE PS> Start-DuneDeployment -Id 3d8f6b5a-... Starts resources for the specified deployment. .EXAMPLE PS> Get-DuneDeployment -Name "app" | Start-DuneDeployment Pipeline example using the `Deployment` parameter set. #> function Start-DuneDeployment { [CmdletBinding(DefaultParameterSetName = "Id")] param ( [Parameter(ParameterSetName = "Id")] [guid]$Id, [Parameter(Mandatory, ParameterSetName = "Deployment", ValueFromPipeline)] [DuneDeployment]$Deployment, [Parameter()] [String]$TxId = (New-Guid) ) begin {} process { Write-Debug "$($MyInvocation.MyCommand)|process|$($PSCmdlet.ParameterSetName)" if ($PSCmdlet.ParameterSetName -eq "Deployment") { $Id = $Deployment.Id } $Body = @{TxId = $TxId} $Null = Invoke-DuneApiRequest -Uri "deployments/$($Id)/startresources" -Method POST -Body $Body } end {} } |