Public/Stop-DuneComputeNode.ps1
|
<# .SYNOPSIS Stop a compute node (resource). .DESCRIPTION Requests the Dune API to stop a compute node resource. Identify the resource by `Id` or pass a `DuneResource` object via pipeline. An optional transaction id (`TxId`) can be supplied. .PARAMETER Id The GUID of the resource to stop. Use the `Id` parameter set. .PARAMETER Resource A `DuneResource` object; pipeline input supported to identify the resource to stop. .PARAMETER TxId Optional transaction id passed to the API. Defaults to a new GUID when not specified. .EXAMPLE PS> Stop-DuneComputeNode -Id 3d8f6b5a-... Stops the compute node with the given id. .EXAMPLE PS> Get-DuneResource -Name "webvm" | Stop-DuneComputeNode Pipeline example using the `Resource` parameter set. #> function Stop-DuneComputeNode { [CmdletBinding(DefaultParameterSetName = "Id")] param ( [Parameter(ParameterSetName = "Id")] [guid]$Id, [Parameter(Mandatory, ParameterSetName = "Resource", ValueFromPipeline)] [DuneResource]$Resource, [Parameter()] [String]$TxId = (New-Guid) ) begin {} process { Write-Debug "$($MyInvocation.MyCommand)|process|$($PSCmdlet.ParameterSetName)" if ($PSCmdlet.ParameterSetName -eq "Resource") { $Id = $Resource.Id } $Body = @{TxId = $TxId} $Null = Invoke-DuneApiRequest -Uri "resources/$($Id)/stop" -Method POST -Body $Body } end {} } |