Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface MiddlewareStack<Input, Output>

public

A stack storing middleware. It can be resolved into a handler. It supports 2 approaches for adding middleware:

  1. Adding middleware to specific step with add(). The order of middleware added into same step is determined by order of adding them. If one middleware needs to be executed at the front of the step or at the end of step, set priority options to high or low.
  2. Adding middleware to location relative to known middleware with addRelativeTo(). This is useful when given middleware must be executed before or after specific middleware(toMiddleware). You can add a middleware relatively to another middleware which also added relatively. But eventually, this relative middleware chain must be 'anchored' by a middleware that added using add() API with absolute step and priority. This mothod will throw if specified toMiddleware is not found.

Type parameters

  • Input: object

  • Output: object

Hierarchy

Index

Properties

applyToStack

applyToStack: (stack: MiddlewareStack<Input, Output>) => void

A function that mutate the passed in middleware stack. Functions implementing this interface can add, remove, modify existing middleware stack from clients or commands

Type declaration

Methods

add

  • Add middleware to the stack to be executed during the "initialize" step, optionally specifying a priority, tags and name

    Parameters

    Returns void

  • Add middleware to the stack to be executed during the "serialize" step, optionally specifying a priority, tags and name

    Parameters

    Returns void

  • Add middleware to the stack to be executed during the "build" step, optionally specifying a priority, tags and name

    Parameters

    Returns void

  • Add middleware to the stack to be executed during the "finalizeRequest" step, optionally specifying a priority, tags and name

    Parameters

    Returns void

  • Add middleware to the stack to be executed during the "deserialize" step, optionally specifying a priority, tags and name

    Parameters

    Returns void

addRelativeTo

  • Add middleware to a stack position before or after a known middleware,optionally specifying name and tags.

    Parameters

    Returns void

clone

  • Create a shallow clone of this stack. Step bindings and handler priorities and tags are preserved in the copy.

    Returns MiddlewareStack<Input, Output>

concat

  • Create a stack containing the middlewares in this stack as well as the middlewares in the from stack. Neither source is modified, and step bindings and handler priorities and tags are preserved in the copy.

    Type parameters

    • InputType: Input

    • OutputType: Output

    Parameters

    Returns MiddlewareStack<InputType, OutputType>

identify

  • identify(): string[]
  • Returns a list of the current order of middleware in the stack. This does not execute the middleware functions, nor does it provide a reference to the stack itself.

    Returns string[]

remove

  • Removes middleware from the stack.

    If a string is provided, it will be treated as middleware name. If a middleware is inserted with the given name, it will be removed.

    If a middleware class is provided, all usages thereof will be removed.

    Parameters

    Returns boolean

removeByTag

  • removeByTag(toRemove: string): boolean
  • Removes middleware that contains given tag

    Multiple middleware will potentially be removed

    Parameters

    • toRemove: string

    Returns boolean

resolve

  • Builds a single handler function from zero or more middleware classes and a core handler. The core handler is meant to send command objects to AWS services and return promises that will resolve with the operation result or be rejected with an error.

    When a composed handler is invoked, the arguments will pass through all middleware in a defined order, and the return from the innermost handler will pass through all middleware in the reverse of that order.

    Type parameters

    • InputType: Input

    • OutputType: Output

    Parameters

    Returns InitializeHandler<InputType, OutputType>

use

  • use(pluggable: Pluggable<Input, Output>): void
  • Apply a customization function to mutate the middleware stack, often used for customizations that requires mutating multiple middleware.

    Parameters

    Returns void