File size: 1,643 Bytes
e6c137b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: 'Caltrans Payment Tracking API - Lambda deployment'

Globals:
  Function:
    Timeout: 30
    MemorySize: 512
    Runtime: python3.10

Resources:
  CaltransPaymentTrackingAPI:
    Type: AWS::Serverless::Function
    Properties:
      FunctionName: caltrans-payment-tracking-api
      CodeUri: .
      Handler: lambda_function.lambda_handler
      Runtime: python3.10
      Timeout: 30
      MemorySize: 512
      Environment:
        Variables:
          PYTHONPATH: /var/task
      Events:
        HttpApiEvent:
          Type: Api
          Properties:
            Path: /{proxy+}
            Method: ANY
            RestApiId: !Ref ApiGateway
        RootHttpApiEvent:
          Type: Api
          Properties:
            Path: /
            Method: ANY
            RestApiId: !Ref ApiGateway

  ApiGateway:
    Type: AWS::Serverless::Api
    Properties:
      Name: caltrans-payment-tracking-api
      StageName: prod
      Cors:
        AllowMethods: "'GET,POST,OPTIONS'"
        AllowHeaders: "'Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token'"
        AllowOrigin: "'*'"
      BinaryMediaTypes:
        - "*/*"

Outputs:
  ApiUrl:
    Description: "API Gateway endpoint URL for the Caltrans Payment Tracking API"
    Value: !Sub "https://${ApiGateway}.execute-api.${AWS::Region}.amazonaws.com/prod/"
    Export:
      Name: !Sub "${AWS::StackName}-ApiUrl"
  
  FunctionArn:
    Description: "Lambda Function ARN"
    Value: !GetAtt CaltransPaymentTrackingAPI.Arn
    Export:
      Name: !Sub "${AWS::StackName}-FunctionArn"