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