Functions/Disable-HetznerCloudServerBackup.ps1
function Disable-HetznerCloudServerBackup { [CmdletBinding(SupportsShouldProcess, ConfirmImpact='High')] param( [Parameter(Mandatory)] [ValidateNotNullOrEmpty()] [int] $Id ) 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("Disable backup for server with ID <$Id>?")) { Invoke-HetznerCloudApi -Api 'servers' -Method 'Post' -Id $Id -Action 'disable_backup' } } } |