Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aossey/02d793af9a1460f134a49a65eed97d12 to your computer and use it in GitHub Desktop.
Save aossey/02d793af9a1460f134a49a65eed97d12 to your computer and use it in GitHub Desktop.
AWS SDK (.NET) Example of Adding Custom User-Agent Value by Extending the AmazonEC2Config Class and Overriding the UserAgent Get Method
using System;
using Amazon.EC2;
namespace aws_sdk_user_agent_header_examples_dotnet
{
class Program
{
static void Main(string[] args)
{
var uaconfig = new UaEC2Config("test-ua-header");
AmazonEC2Client ec2 = new AmazonEC2Client(uaconfig);
}
}
class UaEC2Config: AmazonEC2Config
{
private string _uaString;
public UaEC2Config(string UaValue): base(){
_uaString = UaValue;
}
public override string UserAgent{
get
{
return string.Format("{0}, {1}", _uaString, base.UserAgent);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment