-
Notifications
You must be signed in to change notification settings - Fork 247
/
SaaSHelperFunctions.ps1
30 lines (27 loc) · 899 Bytes
/
SaaSHelperFunctions.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
function Create-SaasUrl {
Param(
[Parameter(Mandatory = $true)]
[Hashtable] $bcAuthContext,
[string] $applicationFamily = "",
[string] $environment = "",
[string] $apiVersion = "",
[string] $endPoint = ""
)
$bcAuthContext = Renew-BcAuthContext -bcAuthContext $bcAuthContext
$bearerAuthValue = "Bearer $($bcAuthContext.AccessToken)"
$headers = @{ "Authorization" = $bearerAuthValue }
$endPointURL = "$($bcContainerHelperConfig.apiBaseUrl.TrimEnd('/'))/admin/$apiVersion"
if ($applicationFamily) {
$endPointURL += "/applications/$applicationFamily"
}
if ($environment) {
$endPointURL += "/environments/$environment"
}
else {
$endPointURL += "/environments"
}
if ($endPoint) {
$endPointURL += "/$endPoint"
}
return $bcAuthContext, $headers, $endPointURL
}