Functions/Internal/Get-S1Object.ps1

<#
.SYNOPSIS
    Short description
.DESCRIPTION
    Long description
.EXAMPLE
    PS C:\> <example usage>
    Explanation of what the example does
.INPUTS
    Inputs (if any)
.OUTPUTS
    Output (if any)
.NOTES
    General notes
#>

function Get-S1Object {
    [CmdletBinding()]
    param (
        [string] $Type,
        [string] $Connection
    )
    
    begin {
        $listParams = @()
        if ("$Connection" -ne ""){
            $listParams +=@("--connectionName",$connection)
        }

    }
    
    process {
            switch ( $Type){
              "Connection" {$s1Type = "reg"}
              "Packages" {$s1Type = "packages"}
              default {throw "$Type is not valid, should be reg or packages"}
            }
            &so list -t $s1type $listParams
    }
    
    end {
        
    }
}
Write-Host "Loading Get-S1Object"