Public/Remove-DuneDeploymentTemplate.ps1
|
<# .SYNOPSIS Removes DuneDeploymentTemplate object. .DESCRIPTION Removes DuneDeploymentTemplate object. .PARAMETER Id Specifies the DuneDeploymentTemplate id. .PARAMETER DeploymentTemplate Specifies the DuneDeploymentTemplate object. .INPUTS DuneDeploymentTemplate object. .OUTPUTS Invoke-WebRequest output. .EXAMPLE > Get-DuneDeploymentTemplate foo | Remove-DuneDeploymentTemplate .LINK https://gitlab.com/yendico1/products/starburst/backend-workflow/ps-modules/starburst/-/blob/main/Starburst/Public/Remove-DuneDeploymentTemplate.ps1 #> function Remove-DuneDeploymentTemplate { [CmdletBinding( SupportsShouldProcess, ConfirmImpact = 'High', DefaultParameterSetName = 'Id' )] param ( [Parameter(Mandatory, ParameterSetName = "Id")] [guid]$Id, [Parameter(Mandatory, ParameterSetName = "DeploymentTemplate", ValueFromPipeline)] [DuneDeploymentTemplate]$DeploymentTemplate ) begin { Write-Debug "$($MyInvocation.MyCommand)|begin" $Uri = "deploymenttemplates" } process { Write-Debug "$($MyInvocation.MyCommand)|process|$($PSCmdlet.ParameterSetName)" switch ($PSCmdlet.ParameterSetName) { 'Id' { Write-Debug "$($MyInvocation.MyCommand)|process|$($PSCmdlet.ParameterSetName)|$($Id)" $DeploymentTemplate = Get-DuneDeploymentTemplate -Id $Id } 'DeploymentTemplate' { Write-Debug "$($MyInvocation.MyCommand)|process|$($PSCmdlet.ParameterSetName)|$($DeploymentTemplate.Id)" } Default { return } } $Url = $("{0}/{1}" -f $Uri, $DeploymentTemplate.Id) if ($PSCmdlet.ShouldProcess($DeploymentTemplate.Name)) { $Null = Invoke-DuneApiRequest $Url -Method DELETE } } end { Write-Debug "$($MyInvocation.MyCommand)|end" } } |