Class UserAgentConfigurator
java.lang.Object
software.amazon.lambda.powertools.common.internal.UserAgentConfigurator
Can be used to create a string that can server as a User-Agent suffix in requests made with the AWS SDK clients
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic voidconfigureUserAgent(String ptFeature) Configures the AWS SDK to use Powertools user agent by setting the sdk.ua.appId system property.static StringgetUserAgent(String ptFeature) Retrieves the user agent string for the Powertools for AWS Lambda.
-
Field Details
-
NA
- See Also:
-
VERSION_KEY
- See Also:
-
PT_FEATURE_VARIABLE
- See Also:
-
PT_EXEC_ENV_VARIABLE
- See Also:
-
VERSION_PROPERTIES_FILENAME
- See Also:
-
AWS_EXECUTION_ENV
- See Also:
-
-
Method Details
-
configureUserAgent
Configures the AWS SDK to use Powertools user agent by setting the sdk.ua.appId system property. Preserves any user-provided value and replaces any existing Powertools user agent. Enforces a 50 character limit to comply with AWS SDK recommendations. This should be called during library initialization to ensure the user agent is properly configured. -
getUserAgent
Retrieves the user agent string for the Powertools for AWS Lambda. It follows the pattern PT/{PT_FEATURE}/{PT_VERSION} PTENV/{PT_EXEC_ENV} The version of the project is automatically retrieved. The PT_EXEC_ENV is automatically retrieved from the AWS_EXECUTION_ENV environment variable. If it AWS_EXECUTION_ENV is not set, PT_EXEC_ENV defaults to "NA"- Parameters:
ptFeature- a custom feature to be added to the user agent string (e.g. idempotency). If null or empty, the default PT_FEATURE is used. The default PT_FEATURE is "no-op".- Returns:
- the user agent string
-