Private/ConfideDataCenterConfig.ps1

<#
.SYNOPSIS
Data Center URL mapping configuration for Confide Public API
 
.DESCRIPTION
Maintains the mapping between Data Center names and their corresponding Confide API URLs.
This file can be updated independently when new data centers are added or URLs change.
#>


# Data Center to URL Mapping
# Format: 'Data Center Name' = 'API URL'
# Empty string means the data center is not yet supported
$Script:DataCenterUrlMap = @{
    'Australia Southeast (Victoria)'  = 'https://graph-au.avepointonlineservices.com/confide'
    'Canada Central (Toronto)'        = 'https://graph-ca.avepointonlineservices.com/confide'
    'Germany West Central (Frankfurt)' = ''
    'East US (Virginia)'              = 'https://graph-us.avepointonlineservices.com/confide'
    'France Central (Paris)'          = ''
    'Japan West (Osaka)'              = 'https://graph-jp.avepointonlineservices.com/confide'
    'North Europe (Ireland)'          = 'https://graph-ne.avepointonlineservices.com/confide'
    'Southeast Asia (Singapore)'      = 'https://graph-sg.avepointonlineservices.com/confide'
    'Switzerland North (Zurich)'      = 'https://graph-ch.avepointonlineservices.com/confide'
    'UK South (London)'               = 'https://graph-uk.avepointonlineservices.com/confide'
    'West Europe (Netherlands)'       = ''
    'Korea Central (Seoul)'           = ''
    'South Africa North (Johannesburg)' = ''
    'United Arab Emirates (Dubai)'    = ''
    'A2G3Prod AOS (Gov Virginia)'     = 'https://graphusgovapi.online15.net/confide'
}

<#
.SYNOPSIS
Get the API URL for a specified data center
 
Retrieves the Confide Public API URL for a given data center name.
Throws an error if the data center is not supported or not found.
 
.PARAMETER DataCenterName
The name of the data center (e.g., 'Australia Southeast (Victoria)')
 
.OUTPUTS
[String] The API URL for the specified data center
 
.EXAMPLE
Get-ConfideDataCenterUrl -DataCenterName 'Canada Central (Toronto)'
Returns: https://graph-ca.avepointonlineservices.com/confide
#>

function Get-ConfideDataCenterUrl {
    [CmdletBinding()]
    [OutputType([String])]
    Param(
        [Parameter(Mandatory = $true, Position = 0)]
        [ValidateNotNullOrEmpty()]
        [String]$DataCenterName
    )

    if ($Script:DataCenterUrlMap.ContainsKey($DataCenterName)) {
        $url = $Script:DataCenterUrlMap[$DataCenterName]
        if ([string]::IsNullOrEmpty($url)) {
            throw "Data Center '$DataCenterName' is not supported (no URL available)."
        }
        return $url
    } else {
        throw "Data Center '$DataCenterName' is not found in the supported list."
    }
}

<#
.SYNOPSIS
Get all supported data centers
 
.DESCRIPTION
Returns a list of all supported data center names.
 
.OUTPUTS
[Array] Array of data center names
 
.EXAMPLE
Get-ConfideDataCenterList
Returns list of all supported data centers
#>

function Get-ConfideDataCenterList {
    [CmdletBinding()]
    [OutputType([Array])]
    Param()

    return @($Script:DataCenterUrlMap.Keys | Sort-Object)
}

<#
.SYNOPSIS
Get all supported data centers with their URLs
 
.DESCRIPTION
Returns a hashtable of all data center names and their corresponding URLs.
Entries with empty URLs indicate unsupported data centers.
 
.OUTPUTS
[Hashtable] Data center name and URL pairs
 
.EXAMPLE
Get-ConfideDataCenterMap
#>

function Get-ConfideDataCenterMap {
    [CmdletBinding()]
    [OutputType([Hashtable])]
    Param()

    return $Script:DataCenterUrlMap.Clone()
}