Documentation
¶
Overview ¶
Package awsmeta defines the Metadata struct that carries AWS request-scoped identity (account, region, partition, request ID) and a helper to populate it from an *http.Request.
Storage on context.Context is delegated to pkgs/ctxval — this package exposes a single Key plus thin Set/Get/Region/Account wrappers so service backends pull metadata uniformly without each one defining its own key.
Index ¶
Constants ¶
const DefaultAccount = "000000000000"
DefaultAccount is the gopherstack default 12-digit account ID.
const DefaultPartition = "aws"
DefaultPartition is the public AWS commercial partition.
Variables ¶
var Key = ctxval.NewKey[*Metadata]("awsmeta") //nolint:gochecknoglobals // existing issue.
Key is the context key under which Metadata is stored. Exported so callers that want raw ctxval access (e.g. middleware that wraps Set with logging) can reuse it.
Functions ¶
Types ¶
type Metadata ¶
type Metadata struct {
// Account is the 12-digit AWS account ID.
Account string
// Region is the AWS region (e.g. "us-east-1"). Empty for global services.
Region string
// Partition is the AWS partition (aws, aws-cn, aws-us-gov).
Partition string
// RequestID is the X-Amz-Request-Id correlation value.
RequestID string
}
Metadata carries AWS request-scoped identity and routing fields.
func FromRequest ¶
FromRequest builds a Metadata from r. defaultRegion is applied when no region is derivable from the SigV4 scope. Always returns non-nil with Account and Partition populated.