using Amazon.Lambda.APIGatewayEvents;
using Amazon.Lambda.CloudWatchEvents;
using Amazon.Lambda.Core;
using Amazon.CloudWatch.Model;
using Amazon.SQS;
using Amazon.SQS.Model;
using Amazon.ECS;
using Amazon.CloudWatch;
using Microsoft.Extensions.Configuration;
namespace CustomMetric;
public class EntryPoint : IEntryPoint
{
private readonly IAmazonCloudWatch _cloudwatchClient;
private readonly IAmazonSQS _sqsClient;
private readonly IAmazonECS _ecsClient;
private readonly IConfiguration _configuration;
public EntryPoint(IConfiguration configuration, IAmazonCloudWatch cloudwatchClient, IAmazonSQS sqsClient, IAmazonECS ecsClient){
_configuration = configuration;
_cloudwatchClient = cloudwatchClient;
_sqsClient = sqsClient;
_ecsClient = ecsClient;
}
///
/// A function that will be invoked by EventBridge every ____ to determine if a scaling event is needed
/// This function assumes you have 3 lambda environment variables set: ECS_CLUSTER_NAME, ECS_SERVICE_NAME and QUEUE_URL.
///
///
///
/// 200 if successfully published cloudwatch metric. 400 if error
public async Task HandleAsync(CloudWatchEvent