Functions/Connection/Update-CdsConnection.ps1

<#
    .SYNOPSIS
    Update connection settings.
#>

function Update-CdsConnection {
    [CmdletBinding()]
    param
    (
        [Parameter(Mandatory, ValueFromPipeline = $True)]
        [Object]
        $CdsConnection
    )
    begin {   
        $StopWatch = [System.Diagnostics.Stopwatch]::StartNew(); 
        Trace-CdsFunction -Name $MyInvocation.MyCommand.Name -Stage Start -Parameters ($MyInvocation.MyCommand.Parameters); 
    }    
    process {
        $CdsConnection.Instances = Get-CdsInstances -Region $CdsConnection.Region -AuthType $CdsConnection.AuthType -Credentials $Global:CdsContext.Credentials;
        $CdsConnection | Export-CdsConnection;
        
    }
    end {
        $StopWatch.Stop();
        Trace-CdsFunction -Name $MyInvocation.MyCommand.Name -Stage Stop -StopWatch $StopWatch;
    }    
}

Export-ModuleMember -Function Update-CdsConnection -Alias *;