Breaking News: Grepper is joining You.com. Read the official announcement!
Check it out

aws-sdk-go-v2 - Passing Metadata Up the Stack

CL answered on March 1, 2023 Popularity 1/10 Helpfulness 1/10

Contents


More Related Answers

  • aws-sdk-go-v2 - Loading AWS Shared Configuration
  • aws-sdk-go-v2 - Assume Role
  • aws-sdk-go-v2 - Setting a timeout
  • aws-sdk-go-v2 - Invoke an Operation
  • aws-sdk-go-v2 - NewFromConfig
  • aws-sdk-go-v2 - Overriding NewFromConfig
  • aws-sdk-go-v2 - New Configuration
  • aws-sdk-go-v2 - Calling Service Operations
  • aws-sdk-go-v2 - Passing Parameters to a Service Operation
  • aws-sdk-go-v2 - Overriding Client Options For Operation Call
  • aws-sdk-go-v2 - Handling Operation Responses
  • aws-sdk-go-v2 - Responses with io.ReadCloser
  • aws-sdk-go-v2 - Response Metadata
  • aws-sdk-go-v2 - Concurrently Using Service Clients
  • aws-sdk-go-v2 - Concurrently Upload to S3 using PutObject
  • aws-sdk-go-v2 - Using Operation Paginators
  • aws-sdk-go-v2 - Using Waiters
  • aws-sdk-go-v2 - Overriding waiter configuration
  • aws-sdk-go-v2 - Overriding waiter configuration per `Wait` request
  • aws-sdk-go-v2 - Advanced waiter configuration overrides
  • aws-sdk-go-v2 - Handling Errors in the AWS SDK for Go V2
  • aws-sdk-go-v2 - Amazon S3 Request Identifiers
  • aws-sdk-go-v2 - Upload Manager
  • aws-sdk-go-v2 - Upload Manager - Handling Failed Uploads
  • aws-sdk-go-v2 - Upload Manager - Overriding Uploader Options Per Upload

  • aws-sdk-go-v2 - Passing Metadata Up the Stack

    0

    You can pass metadata up through the stack by adding metadata key and value pairs using the [middleware.Metadata](https://pkg.go.dev/github.com/aws/smithy-go/middleware#Metadata). Each middleware step returns an output structure, metadata, and an error. Your custom middleware must return the metadata received from calling the next handler in the step. This ensures that metadata added by downstream middleware propagates to the application invoking the service operation. The resulting metadata is accessible to the invoking application by either the operation’s output shape via the `ResultMetadata` structure member.

    The following examples shows how a custom middleware can add metadata that is returned as part of the operation output. 

    Popularity 1/10 Helpfulness 1/10 Language go
    Source: aws.github.io
    Link to this answer
    Share Copy Link
    Contributed on Mar 01 2023
    CL
    0 Answers  Avg Quality 2/10

    Closely Related Answers



    0

    In certain situations, you may find that you require two or more middleware to function in tandem by sharing information or state. You can use [context.Context](https://golang.org/pkg/context/#Context) to pass this metadata by using [middleware.WithStackValue](https://pkg.go.dev/github.com/aws/smithy-go/middleware#WithStackValue). `middleware.WithStackValue` attaches the given key-value pair to the provided context, and safely limits the scope to the currently executing stack. These stack-scoped values can be retrieved from a context using [middleware.GetStackValue](https://pkg.go.dev/github.com/aws/smithy-go/middleware#GetStackValue) and providing the key used to stored the corresponding value. Keys must be comparable, and you must define your own types as context keys to avoid collisions. The following examples shows how two middleware can use `context.Context` to pass information down the stack. 

    Popularity 1/10 Helpfulness 1/10 Language go
    Source: aws.github.io
    Link to this answer
    Share Copy Link
    Contributed on Mar 01 2023
    CL
    0 Answers  Avg Quality 2/10


    X

    Continue with Google

    By continuing, I agree that I have read and agree to Greppers's Terms of Service and Privacy Policy.
    X
    Grepper Account Login Required

    Oops, You will need to install Grepper and log-in to perform this action.