Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions dftimewolf/lib/validators/aws_region.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@

# Source:
# curl -s https://ip-ranges.amazonaws.com/ip-ranges.json | \
# jq -r '.prefixes[] | select(.service == "EC2") | .region' ip-ranges.json \
# | sort | uniq
# Fetched 2023-01-15
# jq -r '.prefixes[] | select(.service == "EC2") | .region' | sort | uniq
# Fetched 2026-09-21
# TODO - Fetch at runtime?
REGIONS = frozenset({
'af-south-1', 'ap-east-1', 'ap-northeast-1', 'ap-northeast-2',
'ap-northeast-3', 'ap-south-1', 'ap-south-2', 'ap-southeast-1',
'ap-southeast-2', 'ap-southeast-3', 'ap-southeast-4', 'ap-southeast-6',
'ca-central-1', 'ca-west-1', 'cn-north-1', 'cn-northwest-1',
'eu-central-1',
'eu-central-2', 'eu-north-1', 'eu-south-1', 'eu-south-2', 'eu-west-1',
'eu-west-2', 'eu-west-3', 'il-central-1', 'me-central-1', 'me-south-1',
'sa-east-1', 'us-east-1', 'us-east-2', 'us-gov-east-1', 'us-gov-west-1',
'us-west-1', 'us-west-2'})
'GLOBAL', 'af-south-1', 'ap-east-1', 'ap-east-2', 'ap-northeast-1',
'ap-northeast-2', 'ap-northeast-3', 'ap-south-1', 'ap-south-2',
'ap-southeast-1', 'ap-southeast-2', 'ap-southeast-3', 'ap-southeast-4',
'ap-southeast-5', 'ap-southeast-6', 'ap-southeast-7', 'ca-central-1',
'ca-west-1', 'cn-north-1', 'cn-northwest-1', 'eu-central-1', 'eu-central-2',
'eu-north-1', 'eu-south-1', 'eu-south-2', 'eu-west-1', 'eu-west-2',
'eu-west-3', 'eusc-de-east-1', 'il-central-1', 'me-central-1', 'me-south-1',
'me-west-1', 'mx-central-1', 'sa-east-1', 'sa-west-1', 'us-east-1',
'us-east-2', 'us-gov-east-1', 'us-gov-west-1', 'us-south-1', 'us-west-1',
'us-west-2'})


class AWSRegionValidator(args_validator.AbstractValidator):
Expand Down
37 changes: 17 additions & 20 deletions dftimewolf/lib/validators/azure_region.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,25 @@
from dftimewolf.lib import errors, resources, args_validator
from dftimewolf.lib.validators import manager as validators_manager

# Source: az account list-locations | jq -r '.[].name' | sort
# Fetched 2023-02-07
# Source: curl https://datacenters.microsoft.com/wp-json/globe/regions | \
# jq -r '.[].id' | sort | uniq
# Fetched 2026-09-21
# TODO - Fetch at runtime?
REGIONS = frozenset({
'asia', 'asiapacific', 'australia', 'australiacentral',
'australiacentral2', 'australiaeast', 'australiasoutheast', 'brazil',
'brazilsouth', 'brazilsoutheast', 'canada', 'canadacentral', 'canadaeast',
'centralindia', 'centralus', 'centraluseuap', 'centralusstage',
'eastasia', 'eastasiastage', 'eastus', 'eastus2', 'eastus2euap',
'eastus2stage', 'eastusstage', 'eastusstg', 'europe', 'france',
'francecentral', 'francesouth', 'germany', 'germanynorth',
'germanywestcentral', 'global', 'india', 'japan', 'japaneast',
'japanwest', 'jioindiacentral', 'jioindiawest', 'korea', 'koreacentral',
'koreasouth', 'northcentralus', 'northcentralusstage', 'northeurope',
'norway', 'norwayeast', 'norwaywest', 'qatarcentral', 'singapore',
'southafrica', 'southafricanorth', 'southafricawest', 'southcentralus',
'southcentralusstage', 'southcentralusstg', 'southeastasia',
'southeastasiastage', 'southindia', 'swedencentral', 'switzerland',
'switzerlandnorth', 'switzerlandwest', 'uae', 'uaecentral', 'uaenorth',
'uk', 'uksouth', 'ukwest', 'unitedstates', 'unitedstateseuap',
'westcentralus', 'westeurope', 'westindia', 'westus', 'westus2',
'westus2stage', 'westus3', 'westusstage'})
'australiacentral', 'australiaeast', 'australiasoutheast', 'austriaeast',
'belgiumcentral', 'brazilsouth', 'canadacentral', 'canadaeast',
'centralindia', 'centralus', 'chilecentral', 'chinaeast2', 'chinanorth2',
'chinanorth3', 'denmark-north-europe-4', 'denmarkeast', 'eastasia',
'eastus', 'eastus2', 'eastus3', 'francecentral', 'germanywestcentral',
'greececentral', 'indonesiacentral', 'israelcentral', 'italynorth',
'japaneast', 'japanwest', 'koreacentral', 'malaysiawest', 'mexicocentral',
'newzealandnorth', 'northcentralus', 'northeurope', 'northeurope3',
'norwayeast', 'polandcentral', 'qatarcentral', 'saudiarabiaeast',
'southafricanorth', 'southcentralindia', 'southcentralus',
'southeast-asia-3', 'southeastasia', 'southindia', 'spaincentral',
'swedencentral', 'switzerlandnorth', 'taiwannorth', 'thailand-south',
'uaenorth', 'uksouth', 'ukwest', 'westcentralus', 'westeurope', 'westus',
'westus2', 'westus3'})


class AzureRegionValidator(args_validator.AbstractValidator):
Expand Down
55 changes: 32 additions & 23 deletions dftimewolf/lib/validators/gcp_zone.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,42 +6,51 @@
from dftimewolf.lib.args_validator import AbstractValidator
from dftimewolf.lib.validators import manager as validators_manager

# Source: https://cloud.google.com/compute/docs/regions-zones/
# Fetched 2023-01-13
# Source: `gcloud compute zones list --format=json | jq -r '.[].name' | sort`
# Fetched 2026-09-21
# TODO - Fetch at runtime?
ZONES = frozenset({
'asia-east1-a', 'asia-east1-b', 'asia-east1-c', 'asia-east2-a',
'asia-east2-b', 'asia-east2-c', 'asia-northeast1-a', 'asia-northeast1-b',
'africa-south1-a', 'africa-south1-b', 'africa-south1-c', 'asia-east1-a',
'asia-east1-b', 'asia-east1-c', 'asia-east2-a', 'asia-east2-b',
'asia-east2-c', 'asia-northeast1-a', 'asia-northeast1-b',
'asia-northeast1-c', 'asia-northeast2-a', 'asia-northeast2-b',
'asia-northeast2-c', 'asia-northeast3-a', 'asia-northeast3-b',
'asia-northeast3-c', 'asia-south1-a', 'asia-south1-b', 'asia-south1-c',
'asia-south2-a', 'asia-south2-b', 'asia-south2-c', 'asia-southeast1-a',
'asia-southeast1-b', 'asia-southeast1-c', 'asia-southeast2-a',
'asia-southeast2-b', 'asia-southeast2-c', 'australia-southeast1-a',
'asia-southeast2-b', 'asia-southeast2-c', 'asia-southeast3-a',
'asia-southeast3-b', 'asia-southeast3-c', 'australia-southeast1-a',
'australia-southeast1-b', 'australia-southeast1-c',
'australia-southeast2-a', 'australia-southeast2-b',
'australia-southeast2-c', 'europe-central2-a', 'europe-central2-b',
'europe-central2-c', 'europe-north1-a', 'europe-north1-b',
'europe-north1-c', 'europe-southwest1-a', 'europe-southwest1-b',
'europe-southwest1-c', 'europe-west1-b', 'europe-west1-c',
'europe-west1-d', 'europe-west2-a', 'europe-west2-b', 'europe-west2-c',
'europe-west3-a', 'europe-west3-b', 'europe-west3-c', 'europe-west4-a',
'europe-west4-b', 'europe-west4-c', 'europe-west6-a', 'europe-west6-b',
'europe-west6-c', 'europe-west8-a', 'europe-west8-b', 'europe-west8-c',
'europe-west9-a', 'europe-west9-b', 'europe-west9-c', 'me-west1-a',
'me-west1-b', 'me-west1-c', 'northamerica-northeast1-a',
'europe-north1-c', 'europe-north2-a', 'europe-north2-b', 'europe-north2-c',
'europe-southwest1-a', 'europe-southwest1-b', 'europe-southwest1-c',
'europe-west10-a', 'europe-west10-b', 'europe-west10-c', 'europe-west12-a',
'europe-west12-b', 'europe-west12-c', 'europe-west15-a', 'europe-west15-b',
'europe-west15-c', 'europe-west1-b', 'europe-west1-c', 'europe-west1-d',
'europe-west2-a', 'europe-west2-b', 'europe-west2-c', 'europe-west3-a',
'europe-west3-b', 'europe-west3-c', 'europe-west4-a', 'europe-west4-b',
'europe-west4-c', 'europe-west6-a', 'europe-west6-b', 'europe-west6-c',
'europe-west8-a', 'europe-west8-b', 'europe-west8-c', 'europe-west9-a',
'europe-west9-b', 'europe-west9-c', 'me-central1-a', 'me-central1-b',
'me-central1-c', 'me-central2-a', 'me-central2-b', 'me-central2-c',
'me-west1-a', 'me-west1-b', 'me-west1-c', 'northamerica-northeast1-a',
'northamerica-northeast1-b', 'northamerica-northeast1-c',
'northamerica-northeast2-a', 'northamerica-northeast2-b',
'northamerica-northeast2-c', 'southamerica-east1-a',
'southamerica-east1-b',
'southamerica-east1-c', 'southamerica-west1-a', 'southamerica-west1-b',
'southamerica-west1-c', 'us-central1-a', 'us-central1-b', 'us-central1-c',
'us-central1-f', 'us-east1-b', 'us-east1-c', 'us-east1-d', 'us-east4-a',
'us-east4-b', 'us-east4-c', 'us-east5-a', 'us-east5-b', 'us-east5-c',
'us-south1-a', 'us-south1-b', 'us-south1-c', 'us-west1-a', 'us-west1-b',
'us-west1-c', 'us-west2-a', 'us-west2-b', 'us-west2-c', 'us-west3-a',
'us-west3-b', 'us-west3-c', 'us-west4-a', 'us-west4-b', 'us-west4-c',
'global'})
'northamerica-northeast2-c', 'northamerica-south1-a',
'northamerica-south1-b', 'northamerica-south1-c', 'southamerica-east1-a',
'southamerica-east1-b', 'southamerica-east1-c', 'southamerica-west1-a',
'southamerica-west1-b', 'southamerica-west1-c', 'us-central1-a',
'us-central1-b', 'us-central1-c', 'us-central1-f', 'us-central2-a',
'us-central2-b', 'us-central2-c', 'us-central2-d', 'us-east1-b',
'us-east1-c', 'us-east1-d', 'us-east4-a', 'us-east4-b', 'us-east4-c',
'us-east5-a', 'us-east5-b', 'us-east5-c', 'us-east7-a', 'us-east7-b',
'us-east7-c', 'us-south1-a', 'us-south1-b', 'us-south1-c', 'us-west1-a',
'us-west1-b', 'us-west1-c', 'us-west2-a', 'us-west2-b', 'us-west2-c',
'us-west3-a', 'us-west3-b', 'us-west3-c', 'us-west4-a', 'us-west4-b',
'us-west4-c', 'us-west8-a', 'us-west8-b', 'us-west8-c', 'global'})


class GCPZoneValidator(AbstractValidator):
"""Validates a GCP zone."""
Expand Down
2 changes: 1 addition & 1 deletion tests/lib/validators/azure_region.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def testInit(self):

def testValidateSuccess(self):
"""Test that correct values do not throw an exception."""
regions = ['eastasia', 'norwaywest', 'westindia']
regions = ['eastasia', 'norwayeast', 'southindia']

for region in regions:
val = self.validator.Validate(region, self.recipe_argument)
Expand Down
Loading