Documentation
¶
Overview ¶
Code generated by cmd/awsmodelgen; DO NOT EDIT.
Package awsapi contains shared constants for the AWS Query protocol.
Index ¶
- Constants
- func HasOperation(service, name string) bool
- func IsServiceKey(service string) bool
- func IsSigningName(name string) bool
- func KnownOperation(service, name string) bool
- func ServiceKey(modelService string) string
- func ServiceShapeName(serviceShape string) string
- func WalkOperations(visit func(Operation) bool)
- func WalkSigningNames(visit func(service, signingName string) bool)
- type Claim
- type ErrorProfile
- type Operation
- type Protocol
- type ProtocolSet
- type Registry
- func (r *Registry) Claim(req *http.Request) (Claim, bool)
- func (r *Registry) ClaimQuery(version, action string) (Claim, bool)
- func (r *Registry) ClaimREST(method, path string) (Claim, bool)
- func (r *Registry) ClaimRESTQuery(method, path, rawQuery string) (Claim, bool)
- func (r *Registry) ClaimRPC(protocol Protocol, serviceShape, operation string) (Claim, bool)
- func (r *Registry) ClaimTarget(target string) (Claim, bool)
- func (r *Registry) RESTOperation(service, method, path, rawQuery string) string
Constants ¶
const ( VersionCloudFormation = "2010-05-15" VersionCloudWatch = "2010-08-01" VersionEC2 = "2016-11-15" VersionRDS = "2014-10-31" VersionElastiCache = "2015-02-02" VersionELBv2 = "2015-12-01" VersionAutoScaling = "2011-01-01" )
AWS Query-protocol API versions. Each version uniquely identifies a service, which is how the router disambiguates Query-protocol requests that share action names across services (e.g. CloudFormation and SES both have GetTemplate).
Source: https://docs.aws.amazon.com/general/latest/gr/aws-apis.html
const SourceRevision = "56df161c2ae2797c7127dec62cb068a95852a204"
Variables ¶
This section is empty.
Functions ¶
func HasOperation ¶
HasOperation reports whether the immutable model corpus contains an operation for the established Overcast service key. It is the build-tool spelling of KnownOperation and delegates to it: capgen reads better asking whether the corpus "has" a capability's operation, and a build tool has no reason to care that the answer comes from an index.
It answers only "is this a real AWS operation name?". Use Operations when the question is where AWS serves it — see that function's comment for why the difference matters.
func IsServiceKey ¶
IsServiceKey reports whether service is an established Overcast service key — the name detectService answers with and IAM enforcement authorises against — rather than a modeled identity that aliases to one, or a string a caller invented.
It exists for Smithy RPC v2, which is the one protocol that names its service in a URI label. Every other wire attaches the service to something the registry can resolve — a target, an (Action, Version) pair, a path — and so answers "is this a service?" incidentally. A label has nothing attached, and the router will dispatch on it before consulting the registry, so the classifier has to be able to ask the question directly or believe whatever arrives.
A key is either a modeled identity that no alias moves, or the target of an alias. Both halves are needed: "ecs" is a modeled identity Overcast keeps, "apigateway" is spelled by no model at all (the models say "api-gateway" and "apigatewayv2"), and "cloudwatch-events" is a modeled identity that is *not* a key, because it aliases to eventbridge.
func IsSigningName ¶
IsSigningName reports whether name is a SigV4 signing name a pinned model actually declares for some real AWS service — as opposed to a value a caller invented, a typo, or Overcast's own service key where that key happens to differ from the name an SDK signs with (see WalkSigningNames). Comparison folds case: a credential scope's service component is conventionally lower-case, but nothing enforces that on the wire.
This exists so a caller can tell "signed for a different, real AWS service" apart from "signed for something that isn't a service at all" — the distinction the router's scope-mismatch answer depends on (#887): only the first is evidence a genuine SDK produced the request.
func KnownOperation ¶
KnownOperation reports whether the pinned AWS models carry an operation of this name for the established Overcast service key — the question a service asks when every handler lookup has already missed and it must choose between "AWS has no such operation" (400) and "Overcast has not implemented it" (501).
It is a single map lookup against an index built once, so unlike the linear walk it replaced it belongs on a request path — BenchmarkKnownOperationMiss against BenchmarkCorpusScanMiss is the difference. service must be an Overcast service key (IsServiceKey), not a modeled identity that aliases to one; a key the models do not carry answers false for every name, which is why serviceutil validates the keys its callers pass at init.
Like HasOperation it answers only "is this a real AWS operation name?". Use Operations when the question is where AWS serves it.
func ServiceKey ¶
ServiceKey maps a modeled service identity to Overcast's established key.
func ServiceShapeName ¶
ServiceShapeName reduces a Smithy service identifier to the bare shape name the generated indexes are keyed by. The Smithy RPC v2 protocol specifies the `{service}` URI label as the service's shape name, but the absolute shape ID ("com.amazonaws.example#Example_20200101") and the namespace-qualified form are both spellings a caller can reasonably produce, and both name the same service. Exported because the router has to normalise the same label the same way when it resolves the shape to an implementation — two normalisations that could drift apart is how a request gets a claim but no dispatcher.
func WalkOperations ¶
WalkOperations visits immutable copies of every modeled operation. It is intended for build tools such as stub-report; request routing must use the generated indexes instead of scanning this complete corpus.
func WalkSigningNames ¶
WalkSigningNames visits each distinct (Overcast service key, SigV4 signing name) pair the pinned models declare, stopping early if visit returns false. A service key can appear more than once: "apigateway" answers for API Gateway v1 and v2, and "bedrock" for the runtime and agent identities.
The signing name is the service component of a SigV4 credential scope — what an AWS SDK actually writes into the Authorization header — and it is the third name a service has, alongside the modeled identity and the Overcast key. Exposed because middleware has to translate a scope back to a key before anything downstream can use it, and a hand-written table of which names differ would be a copy of data the models already carry.
Only REST bindings declare it in the generated indexes today, which is enough for the classification path that needs it: the Query and JSON protocols carry the operation in the request itself and are claimed before the scope is read.
Types ¶
type Claim ¶
type Claim struct {
Service string
ModelService string
SigningName string
Operation string
Protocol Protocol
ErrorProfile ErrorProfile
Ambiguous bool
}
Claim is immutable routing metadata for one modeled AWS operation. Service uses Overcast's service key where it differs from the modeled SDK identity; ModelService retains that source identity for diagnostics.
type ErrorProfile ¶
type ErrorProfile uint8
ErrorProfile identifies the AWS error envelope an unsupported operation expects. It is derived from the modeled wire protocol, with the router retaining responsibility for writing the response.
const ( ErrorProfileJSON ErrorProfile = iota + 1 ErrorProfileQueryXML ErrorProfileEC2QueryXML ErrorProfileXML ErrorProfileRPCV2CBOR ErrorProfileRPCV2JSON )
type Operation ¶
type Operation struct {
Service string
ServiceShape string
SDKID string
APIVersion string
Name string
Protocol Protocol
Protocols ProtocolSet
// TargetPrefix is the X-Amz-Target service shape name, including its trailing
// dot (for example "DynamoDB_20120810."). It is empty for non-AWS JSON APIs.
TargetPrefix string
HTTPMethod string
URI string
}
Operation is static routing metadata generated from the pinned AWS Smithy models. It deliberately contains no request or response shapes: service packages remain responsible for implemented behavior. The generated corpus is private so it cannot be mutated outside this package.
func Operations ¶
Operations returns every modeled binding an established Overcast service key carries for the given AWS operation name, so a build tool can assert where the operation is served rather than merely that it exists. A name-only check cannot distinguish a route AWS models from one the emulator invented, which is how ten services came to serve working implementations at paths and methods no SDK sends (#864).
The result is a slice because one Overcast key can resolve to several modeled identities: "ses" answers for both SES v1 (Query) and SES v2 (REST-JSON), and "apigateway" for both API Gateway v1 and v2. Callers that need one specific binding must select on Protocol or APIVersion.
Returned values are copies; the corpus stays immutable.
type Protocol ¶
type Protocol string
Protocol identifies the wire protocol declared by an AWS Smithy service model.
const ( ProtocolUnknown Protocol = "" ProtocolAWSJSON10 Protocol = "awsJson1_0" ProtocolAWSJSON11 Protocol = "awsJson1_1" ProtocolAWSQuery Protocol = "awsQuery" ProtocolEC2Query Protocol = "ec2Query" ProtocolRESTJSON Protocol = "restJson1" ProtocolRESTXML Protocol = "restXml" ProtocolRPCV2CBOR Protocol = "rpcv2Cbor" ProtocolRPCV2JSON Protocol = "rpcv2Json" )
type ProtocolSet ¶
type ProtocolSet uint16
ProtocolSet retains every recognized protocol trait carried by a Smithy service. It is a compact build-time-generated bitset, not runtime model data.
const ( ProtocolsAWSJSON10 ProtocolSet = 1 << iota ProtocolsAWSJSON11 ProtocolsAWSQuery ProtocolsEC2Query ProtocolsRESTJSON ProtocolsRESTXML ProtocolsRPCV2CBOR ProtocolsRPCV2JSON )
type Registry ¶
type Registry struct{}
Registry classifies modeled, non-S3 operations that no service handler has claimed. Its generated indexes are sorted static data, so a lookup performs no model parsing, I/O, startup allocation, or linear manifest scan.
func NewRegistry ¶
func NewRegistry() *Registry
NewRegistry returns the immutable generated operation registry.
func (*Registry) Claim ¶
Claim classifies the model-backed request forms that can be distinguished without decoding an AWS JSON body. REST bindings are exposed separately via ClaimREST because their late fallback must preserve S3's legitimate paths. For an AWS Query request it calls ParseForm, which consumes the request body; callers must therefore invoke it only where Query form parsing is already intended.
func (*Registry) ClaimQuery ¶
ClaimQuery classifies a fully specified AWS Query operation. Version is required because action names are shared across services.
func (*Registry) ClaimREST ¶
ClaimREST classifies a modeled REST JSON or REST XML HTTP binding. Literal edges take precedence over labels, matching Smithy's URI binding semantics. It walks generated static tables only: no model parsing, map construction, or whole-manifest scan occurs on the request path.
func (*Registry) ClaimRESTQuery ¶
ClaimRESTQuery classifies a modeled REST binding including any literal query components declared by Smithy (for example ?operation=tag-resource). Query matching is allocation-free and accepts additional client parameters.
func (*Registry) ClaimRPC ¶
ClaimRPC classifies a Smithy RPC v2 operation by the explicit service and operation names carried in /service/{service}/operation/{operation}. The index includes additive protocol traits, not only each model's canonical protocol.
func (*Registry) ClaimTarget ¶
ClaimTarget classifies a full X-Amz-Target value such as "DynamoDB_20120810.ListTables".
func (*Registry) RESTOperation ¶
RESTOperation returns the operation the pinned models bind to this request for one already-classified service, or "" when that service binds no operation to this method and URI shape.
It answers the question ClaimRESTQuery deliberately cannot. A Claim describes the binding — enough to choose a 501 envelope — and where several services share the binding it names no owner, because picking one would invent an attribution the models do not support. A caller that has already established the service (from the SigV4 credential scope, a path prefix, or a matched route) does not need an owner picked for it: intersecting the generated candidate set with that service is exact. Every service outside the set gets "", so no request can borrow another service's operation name.
service is an Overcast service key, as ServiceKey reports it. Where several modeled identities alias to one key, the lowest modeled identity in the binding's generated order wins; TestGeneratedRESTCandidates_haveOneOperationPerServiceKey asserts that no such pair disagrees about the operation name.
Like ClaimREST it walks static tables only and allocates nothing, so it needs no request-path cache. Intersecting a candidate set is a scan, but the sets are small: 285 shared bindings hold 1,062 candidates between them, and three tag bindings account for a third of those. BenchmarkRegistryRESTOperation* (Go 1.24 in Docker on a Ryzen 5900X, -benchtime=200000x, best of three) measures 88ns for an unshared binding and 601ns for GET /tags/{resourceArn}, the 122-candidate worst case, both at zero allocations.