-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
+ moved and renamed Communication.psm1 as only required by powerJobs jobs + refactored connection logic with same implementation as Sample.ConnectToPowerGateServer
- Loading branch information
1 parent
aa5282c
commit b25c2a7
Showing
4 changed files
with
36 additions
and
75 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
$services = @( | ||
'/PGS/ERP/BomService', | ||
'/PGS/ERP/MaterialService' | ||
) | ||
|
||
$vaultToPgsMapping = @{ | ||
'Vault' = '$($vaultConnection.Server)'; | ||
'TestVault' = '$env:COMPUTERNAME'; | ||
} | ||
|
||
function ConnectToPowerGateServer() { | ||
$connectedVault = $vaultConnection.Vault | ||
if ($connectedVault -in $vaultToPgsMapping.Keys) { | ||
$pgsHost = "http://" + $ExecutionContext.InvokeCommand.ExpandString($vaultToPgsMapping[$connectedVault]) + ":8080" | ||
foreach ($serviceUrl in $services) { | ||
$powerGateServerPluginUrl = $pgsHost + $serviceUrl | ||
Write-Host "Connecting to: $powerGateServerPluginUrl" | ||
$connected = Connect-ERP -Service $powerGateServerPluginUrl | ||
Write-Host "Connected: $connected" | ||
} | ||
} | ||
else { | ||
throw "The currently connected Vault '$($vaultConnection.Vault)' is not mapped in the configuration to any powerGateServer.`r`nPlease extend the configuration and restart the application." | ||
} | ||
} |