Colleague Discount Collection Lambda

Overview

This class is the entry point for AWS when it invokes the endpoint from the load balancer. The event that comes in from the load balancer has all the request details within and follows the structure in AWS

{
  "requestContext": {
    "elb": {
      "targetGroupArn": "arn:aws:elasticloadbalancing:eu-west-1:333073960552:targetgroup/df3c0bbacb9d1df1944493326d86c766/360c5a185a6b4e89"
    }
  },
  "httpMethod": "PUT",
  "path": "/discount/v1/colleagues/{employee_id}",
  "queryStringParameters": {
    "apikey": "The API Key"
  },
  "headers": {
    "accept": "application/json, text/plain, */*",
    "authorization": "Basic some_token_here==",
    "content-length": "58",
    "content-type": "application/json;charset=utf-8",
    "host": "storepick-services.p.digital.morconnect.com",
    "user-agent": "axios/0.20.0",
    "x-amzn-trace-id": "Root=1-5f99b395-4159633d186ac3ae5a99c2d4",
    "x-forwarded-for": "source IPS ",
    "x-forwarded-port": "443",
    "x-forwarded-proto": "https"
  },
  "body": "{\"customerId\":\"{primary_customer_id\",\"additionalDiscountMembers\":[]}",
  "isBase64Encoded": false
}

The attribute “httpMethod” determines the method on the handler class get called: See Colleague Discount API Endpoints

Overview Diagram

../_images/colleague_discount_overview.jpg

Dependencies

SSM Attribute

See SSM Key

Configuration(from config service)

See Configuration(from config service)

Code