Public/Remove-DunePatchingWindowAssignment.ps1
|
function Remove-DunePatchingWindowAssignment { [CmdletBinding( SupportsShouldProcess, ConfirmImpact = 'None' )] param ( [Parameter(ParameterSetName = 'PatchingWindow')] [guid]$DeploymentId, [Parameter(ValueFromPipeline, ParameterSetName = 'Deployment')] [DuneDeployment]$Deployment, [Parameter(ParameterSetName = 'Deployment')] [guid]$PatchingWindowId, #inPS7 use System.TimeOnly [Parameter(ValueFromPipeline, ParameterSetName = 'PatchingWindow')] [DunePatchingWindow]$PatchingWindow ) begin {} process { Write-Debug "$($MyInvocation.MyCommand)|process" switch ($PSCmdlet.ParameterSetName) { 'Deployment' { $DeploymentId = $Deployment.Id } 'PatchingWindow' { $PatchingWindowId = $PatchingWindow.Id } } $Uri = "deployments/$DeploymentId/patchingwindows/$PatchingWindowId" if ($PSCmdlet.ShouldProcess($PatchingWindow.Name)) { $Null = Invoke-DuneApiRequest $Uri -Method DELETE } } end {} } |