regions

package
v0.33.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 2, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package regions is the dependency-free public view of the cloud regions disco's scanners support, per provider. The per-provider lists are the source of truth and live next to each provider's scanner (internal/providers/<p>/<p>regions); each of those SDK-free leaf packages self-registers its list here via init(), so this package links no cloud SDK and names no provider — external callers (e.g. the SaaS control plane) can validate scan regions without either.

Registration is triggered by importing the leaf packages: the disco binary gets it for free (each provider package imports its own <p>regions leaf, and cmd pulls the providers in via internal/providers/all). A standalone consumer that does not import the providers should blank-import github.com/icearp/ disco-cli/regions/all, the build-tag-gated aggregator that wires the leaf packages in (and honours the same `slim` tags as internal/providers/all).

Provider keys are the lower-case wire values "aws", "azure", and "gcp".

Alongside the provider → regions view, this package carries a per-SERVICE view: RegisterServices / ServiceRegions / ServiceAvailable answer "which regions does this provider offer this service in", which is what lets a scanner skip a dormant (service × region) cell instead of waiting for it to time out. Only providers whose services have a region axis register a table; the rest report no opinion and callers fail open.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func For

func For(provider string) []string

For returns the supported regions for provider in sorted order, or nil for an unknown provider. The returned slice is a copy the caller may retain or mutate.

func Register

func Register(provider string, list []string)

Register records a provider's supported region list. Leaf packages call this from their init(). Later calls for the same provider overwrite earlier ones.

func RegisterServices added in v0.26.0

func RegisterServices(provider string, m map[string][]string)

RegisterServices records the regions provider offers each of its services in, keyed by the provider-qualified service name ("aws:cassandra"). Leaf packages call this from their init(). Later calls for the same provider replace earlier ones.

It panics if provider is empty or any key lacks the provider's own "<provider>:" prefix. A mis-prefixed key would register a table no lookup can ever reach, so failing at init beats silently scanning everything forever.

func ServiceAvailable added in v0.26.0

func ServiceAvailable(service, region string) (known, avail bool)

ServiceAvailable reports whether the provider offers service in region.

known distinguishes "not offered there" from "no data": it is false when nothing is registered for service, in which case avail is meaningless and the caller MUST fail open and scan anyway. Registration is best-effort per provider — azure and gcp register nothing today — so an unknown service is the normal case, not an error.

func ServiceRegions added in v0.26.0

func ServiceRegions(service string) []string

ServiceRegions returns the regions the provider offers service in, sorted, or nil when nothing is registered for it. service is the provider-qualified name ("aws:cassandra"). The returned slice is a copy the caller may retain or mutate.

func Valid

func Valid(provider, region string) bool

Valid reports whether region is a supported region for provider. It is an exact, case-sensitive membership test.

Types

This section is empty.

Directories

Path Synopsis
Package all is the single wiring point that registers every provider's supported-region list into the github.com/icearp/disco-cli/regions registry for standalone consumers (e.g.
Package all is the single wiring point that registers every provider's supported-region list into the github.com/icearp/disco-cli/regions registry for standalone consumers (e.g.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL