MCPcopy Create free account
hub / github.com/aws/smithy-go / Stack

Struct Stack

middleware/stack.go:25–73  ·  view source on GitHub ↗

Stack provides protocol and transport agnostic set of middleware split into distinct steps. Steps have specific transitions between them, that are managed by the individual step. Steps are composed as middleware around the underlying handler in the following order: Initialize -> Serialize -> Build

Source from the content-addressed store, hash-verified

23//
24// Initialize <- Serialize -> Build -> Finalize <- Deserialize <- Handler
25type Stack struct {
26 // Initialize prepares the input, and sets any default parameters as
27 // needed, (e.g. idempotency token, and presigned URLs).
28 //
29 // Takes Input Parameters, and returns result or error.
30 //
31 // Receives result or error from Serialize step.
32 Initialize *InitializeStep
33
34 // Serialize serializes the prepared input into a data structure that can be consumed
35 // by the target transport's message, (e.g. REST-JSON serialization)
36 //
37 // Converts Input Parameters into a Request, and returns the result or error.
38 //
39 // Receives result or error from Build step.
40 Serialize *SerializeStep
41
42 // Build adds additional metadata to the serialized transport message
43 // (e.g. HTTP's Content-Length header, or body checksum). Decorations and
44 // modifications to the message should be copied to all message attempts.
45 //
46 // Takes Request, and returns result or error.
47 //
48 // Receives result or error from Finalize step.
49 Build *BuildStep
50
51 // Finalize performs final preparations needed before sending the message. The
52 // message should already be complete by this stage, and is only alternated
53 // to meet the expectations of the recipient (e.g. Retry and AWS SigV4
54 // request signing)
55 //
56 // Takes Request, and returns result or error.
57 //
58 // Receives result or error from Deserialize step.
59 Finalize *FinalizeStep
60
61 // Deserialize reacts to the handler's response returned by the recipient of the request
62 // message. Deserializes the response into a structured type or error above
63 // stacks can react to.
64 //
65 // Should only forward Request to underlying handler.
66 //
67 // Takes Request, and returns result or error.
68 //
69 // Receives raw response, or error from underlying handler.
70 Deserialize *DeserializeStep
71
72 id string
73}
74
75// NewStack returns an initialize empty stack.
76func NewStack(id string, newRequestFn func() interface{}) *Stack {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected