Created
October 21, 2021 09:58
-
-
Save nichollsc81/d37290158261ce52bf77cebf9ced1b6d to your computer and use it in GitHub Desktop.
Returns public IPs for given Cloud Elements environment (staging/production)
This file contains hidden or 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
# collect CE IP ranges | |
$AllCEIps = (Invoke-RestMethod https://my.cloudelements.io/ip-ranges.json).prefixes | |
# counter | |
[int] $Count = 0 | |
# CE Environment: staging / production | |
[string] $Environment = 'staging' | |
foreach ($a In $AllCEIps) | |
{ | |
# extract environment and ip | |
$obj = [ordered]@{ | |
Env = $a.environment | |
Ip = $a.ip_prefix | |
} | |
# surface only staging env IPs | |
if ($obj.Values -contains "$($Environment)") | |
{ | |
$obj | ft -auto -HideTableHeaders | |
$Count += 1 | |
} | |
} | |
Write-Host "CE Staging IPs count: [$Count]" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment