Replies: 2 comments 3 replies
-
|
By suffix do you need your custom value at the end of the user agent or just looking to a string literal somewhere in the user agent without the SDK adding anything like |
Beta Was this translation helpful? Give feedback.
-
|
There is a back door way in the .NET SDK for modifying the user agent string. Keep in mind you using APIs from our SDK's "Internal" namespace where we don't guarantee backwards compatibility. The "Internal" namespaces we generally put APIs to share with service packages but not necessarily end users. I don't see us changing these APIs anytime soon but want to be clear their is the possibility so code defensively or take note that are using APIs that don't guarantee backwards compatibility. var ddbClient = new Amazon.DynamoDBv2.AmazonDynamoDBClient();
ddbClient.BeforeRequestEvent += ServiceClientBeforeRequestEvent;
void ServiceClientBeforeRequestEvent(object sender, RequestEventArgs e)
{
var userAgentString = "customString";
var args = e as Amazon.Runtime.WebServiceRequestEventArgs;
if (args == null)
return;
((Amazon.Runtime.Internal.IAmazonWebServiceRequest)args.Request).UserAgentDetails.AddUserAgentComponent(userAgentString);
} |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
Our use case requires appending a custom suffix to the existing user agent string so that we can identify S3 requests in our logs.
One option I found is setting
in
AmazonS3Config, but that adds the identifier asapp/customStringin the header.Is there any supported method in the SDK to append a plain suffix (without
app/) to the default user agent, similar to how other AWS SDKs expose user-agent append mechanisms?Beta Was this translation helpful? Give feedback.
All reactions