Public/Remove-DMReplicationPair.ps1
|
function Remove-DMReplicationPair { [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'High', DefaultParameterSetName = 'ById')] param( [Parameter(ValueFromPipelineByPropertyName = $true)] [pscustomobject]$WebSession, [Parameter(ParameterSetName = 'ById', Mandatory = $true, ValueFromPipelineByPropertyName = $true)] [ValidateNotNullOrEmpty()] [string]$Id, [Parameter(ParameterSetName = 'ByName', Mandatory = $true)] [ValidateNotNullOrEmpty()] [string]$Name, [switch]$ForceDeletePair ) $session = if ($WebSession) { $WebSession } else { $script:CurrentOceanstorSession } $pairId = Resolve-DMReplicationPairId -WebSession $session -Id $Id -Name $Name $resource = "REPLICATIONPAIR/$pairId" if ($ForceDeletePair) { $resource += '?ISLOCALDELETE=true' } if ($PSCmdlet.ShouldProcess($pairId, 'Remove remote replication pair')) { $response = Invoke-DeviceManager -WebSession $session -Method 'DELETE' -Resource $resource $response = $response | Assert-DMApiSuccess return $response.error } } |