regionsgen

package
v0.34.2 Latest Latest
Warning

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

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

Documentation

Overview

Package regionsgen derives, for each disco AWS service, the regions AWS offers that service in — by reading the region table the AWS SDK already embeds in every service package.

The join key is the SDK PACKAGE, not the service name. Each scanner file imports exactly the SDK service package it scans, and that package carries AWS's own generated endpoint table at internal/endpoints/endpoints.go. So the import IS the mapping, and no name-to-catalog-code translation is needed — which matters because disco service names diverge from AWS's global-infrastructure codes for 83 of 297 services (keyspaces is filed as "mcs", connectcampaignsv2 as "connectcampaigns"), and no derivation from the name gets that right.

Build is separate from the tools/genregions command so the staleness guard can call it: a test rebuilds the table in memory and diffs it against the committed one. disco's CI runs `go test ./...` and no make targets, so a test is the only guard that actually gates.

Index

Constants

View Source
const GeneratedFile = "services_generated.go"

GeneratedFile is the basename tools/genregions writes and the staleness test points at.

Variables

This section is empty.

Functions

func Build

func Build(root string) (map[string][]string, error)

Build returns disco AWS service name → the regions AWS offers it in, derived from the SDK endpoint tables at the versions pinned in root's go.mod.

root is the disco repository root. The result omits services whose scanner imports no SDK service package, or whose SDK tables list no region disco supports; an absent service means "no opinion", and callers must fail open.

Build reports an error rather than an empty table when it parses no scanner files or resolves no SDK modules. A silently empty table would disable region scoping everywhere while looking perfectly healthy.

func Render

func Render(table map[string][]string) ([]byte, error)

Render formats table as the source of the generated awsregions file.

Types

This section is empty.

Jump to

Keyboard shortcuts

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