BloxOne-Main.psm1

<#
.SYNOPSIS
   BloxOne REST API for PowerShell
.DESCRIPTION
   A collection of PowerShell Cmdlets to interact with the InfoBlox BloxOne DDI & BloxOne Threat Defense REST API located at https://csp.infoblox.com/apidoc
   Also supports some limited Cmdlets for InfoBlox NIOS (Grid).
.NOTES
   Documentation located at: https://ibps.readthedocs.io
.AUTHOR
   Mat Cox
.VERSION
   https://github.com/TehMuffinMoo/ibPS/releases
.CHANGELOG
   https://raw.githubusercontent.com/TehMuffinMoo/ibPS/main/CHANGELOG.md
#>


## Import Functions
$MiscellaneousFunctions = Get-ChildItem "$PSScriptRoot\Functions\Misc\*.ps1"
$B1PublicFunctions = Get-ChildItem "$PSScriptRoot\Functions\BloxOne" -Exclude Private | Get-ChildItem -Recurse
$B1PrivateFunctions = Get-ChildItem "$PSScriptRoot\Functions\BloxOne\Private\*.ps1"
$NIOSPublicFunctions = Get-ChildItem "$PSScriptRoot\Functions\NIOS" -Exclude Private | Get-ChildItem -Recurse
$NIOSPrivateFunctions = Get-ChildItem "$PSScriptRoot\Functions\NIOS\Private\*.ps1"
$AdditionalFunctionsToExport = @('Invoke-CSP')

foreach($FunctionToImport in @($B1PublicFunctions + $B1PrivateFunctions + $NIOSPublicFunctions + $NIOSPrivateFunctions + $MiscellaneousFunctions)) {
  try {
    . $FunctionToImport.fullname
  } catch {
    Write-Error "Failed to import function $($FunctionToImport.fullname)"
  }
}

if ($ENV:IBPSDevelopment -eq "Enabled") {
   $AdditionalFunctionsToExport += DevelopmentFunctions
}
if ($ENV:IBPSDebug -eq "Enabled") {
   $DebugPreference = 'Continue'
} else {
   $DebugPreference = 'SilentlyContinue'
}

Initialize-NIOSConfig
Initialize-B1Config

Export-ModuleMember -Function ($(@($B1PublicFunctions + $NIOSPublicFunctions + ($MiscellaneousFunctions | Where-Object {$_.BaseName -ne 'Misc'})) | Select-Object -ExpandProperty BaseName) + $AdditionalFunctionsToExport) -Alias *