public Handler( DnsResolver dnsResolver, IAmazonElasticLoadBalancingV2 elbClient, UpdateTargetsRequestFactory requestFactory, ILogger <Handler> logger ) { this.dnsResolver = dnsResolver; this.elbClient = elbClient; this.requestFactory = requestFactory; this.logger = logger; }
public void FromSnsEventReturnsRequest() { var targetGroupArn = "arn:aws:elb:us-east-1:1:targetgroup/test/test"; var dnsName = "http://example.com"; var alarm = new AlarmEvent { Trigger = new Trigger { Metrics = new List <MetricDataQuery> { new MetricDataQuery { Id = "healthy", }, new MetricDataQuery { Id = "customdata", MetricStat = new MetricStat { Metric = new Metric { Dimensions = new List <Dimension> { new Dimension { Name = "TargetGroupArn", Value = targetGroupArn }, new Dimension { Name = "TargetDnsName", Value = dnsName } } } } } } } }; var evnt = new SNSEvent { Records = new List <SNSRecord> { new SNSRecord { Sns = new SNSMessage { Message = Serialize(alarm) } } } }; var factory = new UpdateTargetsRequestFactory(); var request = factory.CreateFromSnsEvent(evnt); Assert.That(request.TargetGroupArn, Is.EqualTo(targetGroupArn)); Assert.That(request.TargetDnsName, Is.EqualTo(dnsName)); }