awssdk

package module
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 13, 2026 License: MIT Imports: 7 Imported by: 7

Documentation

Overview

Package awssdk supplies opt-in Powertools user-agent middleware for AWS SDK v2.

Append UserAgent to an SDK client's APIOptions to identify the utility making requests. The returned stack modifier adds request metadata without initializing an SDK client, loading credentials, or performing network operations.

Optional integration

This is a separate module so the core Commons package stays dependency-free. Configure middleware when constructing clients, then reuse those clients across Lambda invocations. The application owns SDK credentials, retries and endpoints.

For usage and compatibility details, see the user guide.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func UserAgent

func UserAgent(feature string) func(*middleware.Stack) error

UserAgent returns an idempotent per-request stack option. It does not mutate environment variables or a shared client; the first installed feature wins.

Example
package main

import (
	"fmt"

	"github.com/aws/smithy-go/middleware"
	"github.com/rambow-cloud/powertools-lambda-go/commons/awssdk"
)

func main() {
	stack := middleware.NewStack("example", func() any { return nil })
	err := awssdk.UserAgent("parameters")(stack)
	_, installed := stack.Build.Get("PowertoolsUserAgent")
	fmt.Println(installed, err)
}
Output:
true <nil>

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL