Functions/Public/Remove-InfluxDbDatabase.ps1
function Remove-InfluxDbDatabase { [CmdletBinding(SupportsShouldProcess, ConfirmImpact='High')] param( [Parameter(Mandatory)] [ValidateNotNullOrEmpty()] [string] $Database ) begin { if (-not $PSBoundParameters.ContainsKey('Confirm')) { $ConfirmPreference = $PSCmdlet.SessionState.PSVariable.GetValue('ConfirmPreference') } if (-not $PSBoundParameters.ContainsKey('WhatIf')) { $WhatIfPreference = $PSCmdlet.SessionState.PSVariable.GetValue('WhatIfPreference') } } process { if ($Force -or $PSCmdlet.ShouldProcess("Remove database '$Database'?")) { Invoke-InfluxDbApi -Query "DROP DATABASE $Database" -Method Post } } } |