<# FPS:Containers:Make:SN-Load-DataResources-Dependencies:ACTIVE #>

 

<#

.DESCRIPTION

Module: Make

Core Snippet: SN-Load-DataResources-Dependencies

 

When called, this snippet loads all of the functions used by a CmdLet with the DataResources module.

 

.USAGE

Similiar variations are used throughout FPS to load the dependencies for a module's public path

 

.EXAMPLE

 

# This should be within the Initialization region in any CmdLet that has dependencies

. (Get-ActiveFileNm -PS1 Load-DataResources-Dependencies) }

 

Expected Result:

 

All CmdLets registered for a CmdLet are loaded

 

.CC

 

[2024.12.29 JD] Set $depPrintValue as an else to if ($overrideSnippet -gt "")

[2024.11.16 JD] Reconfigured the snippet to use the second tier Load-Dependency snippet

[2024.09.25 JD] Original code release

 

.NOTES

 

$testCmdLet = "Get-Stub"

. (Get-ActiveFileNm -PS1 load-DataResources-Dependencies)

 

-or-

$overrideSnippet = "CfgAuthMbrs"

. (Get-ActiveFileNm -PS1 Load-DataResources-Dependencies)

 

Then the locational values associated with the Get-Stub CmdLet will be displayed.

 

 

DO NOT LOAD THE KEY CMDLETS: Get-Answer, Get-ActiveFileNm, Push-NeededFor, and Mount-Path

 

#>

 

if (($testCmdLet -gt "") -or ($overrideSnippet -gt "")) {

    if ($testCmdLet -gt "") { $drcCallingCode = $testCmdLet }

    if ($overrideSnippet -gt "") { $drcCallingCode = $overrideSnippet } else { $depPrintValue = $true }

} else {

    if ($overrideSnippet -gt "") {

        $drcCallingCode = $overrideSnippet

    } else {

        $drcCallingCode = $PSCmdlet.MyInvocation.MyCommand.Name

    }

    $depPrintValue = $false

}

 

# Some overrides will use the full filename, but for shortcuts we only want the shortcut name

if ($drcCallingCode -like 'SC-*') { $drcCallingCode = $drcCallingCode.replace('SC-','') }

 

#Update log is pretty common, so lets define it here so it is only called out once

if ($drcCallingCode -in ("Confirm-AuthMember","Get-KeePass","Put-KeePass","Put-AuthMembers","SN-OpenKP","SN-CloseKP")) {

    $ThisDependency = "Update-Log";. (Get-ActiveFileNm -PS1 Load-Dependency)

}

 

switch ($drcCallingCode) {

 

    # Shortcuts

    'CfgAuthMbrs'       { $ThisDependency = "Approve-AuthMember";. (Get-ActiveFileNm -PS1 Load-Dependency)

                          $ThisDependency = "Put-AuthMember";. (Get-ActiveFileNm -PS1 Load-Dependency)

                        }

    'GetKPEntry'        { $ThisDependency = "Get-KPEntry";. (Get-ActiveFileNm -PS1 Load-Dependency)

                          $ThisDependency = "Get-KPGroup";. (Get-ActiveFileNm -PS1 Load-Dependency)

                          $ThisDependency = "ConvertTo-KPPSObject";. (Get-ActiveFileNm -PS1 Load-Dependency)

                        }

    'GetKPGroup'        { $ThisDependency = "ConvertTo-KPPSObject";. (Get-ActiveFileNm -PS1 Load-Dependency)

                          $ThisDependency = "Get-KPGroup";. (Get-ActiveFileNm -PS1 Load-Dependency)

                        }

    'NewKPEntry'        { $ThisDependency = "Add-KPEntry";. (Get-ActiveFileNm -PS1 Load-Dependency)

                          $ThisDependency = "Get-KPGroup";. (Get-ActiveFileNm -PS1 Load-Dependency)

                          $ThisDependency = "ConvertTo-KPPSObject";. (Get-ActiveFileNm -PS1 Load-Dependency)

                          $ThisDependency = "Test-Bound";. (Get-ActiveFileNm -PS1 Load-Dependency)

                        }

    'NewKPPwd'          { $ThisDependency = "Get-KPPwdProfile";. (Get-ActiveFileNm -PS1 Load-Dependency) }

    'UpdateKPEntry'     { $ThisDependency = "Get-KPEntry";. (Get-ActiveFileNm -PS1 Load-Dependency)

                          $ThisDependency = "Get-KPGroup";. (Get-ActiveFileNm -PS1 Load-Dependency)

                          $ThisDependency = "Set-KPEntry";. (Get-ActiveFileNm -PS1 Load-Dependency)

                          $ThisDependency = "Test-Bound";. (Get-ActiveFileNm -PS1 Load-Dependency)

                        }

    'UpdateKPGroup'     { $ThisDependency = "Get-KPGroup";. (Get-ActiveFileNm -PS1 Load-Dependency)

                          $ThisDependency = "Set-KPGroup";. (Get-ActiveFileNm -PS1 Load-Dependency)

                          $ThisDependency = "Test-Bound";. (Get-ActiveFileNm -PS1 Load-Dependency)

                        }

 

    # Snippets

    'SN-Stub'           { $ThisDependency = "Format-Stub";. (Get-ActiveFileNm -PS1 Load-Dependency) }

    # CmdLets

    'Add-KPEntry'       { $ThisDependency = "Test-Bound";. (Get-ActiveFileNm -PS1 Load-Dependency) }

 

    'Get-KPEntry'       { $ThisDependency = "Test-KPConnection";. (Get-ActiveFileNm -PS1 Load-Dependency) }

    'Put-AuthMembers'   { $ThisDependency = "ConvertTo-ZeroFill";. (Get-ActiveFileNm -PS1 Load-Dependency) }

    'Update-KPEntry'    {

                          $ThisDependency = "Get-KPEntry";. (Get-ActiveFileNm -PS1 Load-Dependency)

                          $ThisDependency = "Get-KPGroup";. (Get-ActiveFileNm -PS1 Load-Dependency)

                          $ThisDependency = "Set-KPEntry";. (Get-ActiveFileNm -PS1 Load-Dependency)

                        }

    'SetKPEntry'        { $ThisDependency = "Test-Bound";. (Get-ActiveFileNm -PS1 Load-Dependency) }

    'SetKPGroup'        { $ThisDependency = "Test-Bound";. (Get-ActiveFileNm -PS1 Load-Dependency) }

 

    default { if ($depPrintValue -gt "") { Write-Host "$drcCallingCode is not a configured option" } }

}