cfn.yaml (146 lines of code) (raw):

AWSTemplateFormatVersion: 2010-09-09 Transform: AWS::Serverless-2016-10-31 Description: Stores pa feed on s3 to replay them later Parameters: Stack: Description: Stack name Type: String Default: mobile App: Description: Application name Type: String Default: football-time-machine Stage: Description: Stage name Type: String AllowedValues: - CODE - PROD Default: CODE DeployBucket: Description: Bucket where RiffRaff uploads artifacts on deploy Type: String Default: mobile-dist Resources: ArchiveLambda: Type: AWS::Serverless::Function Properties: Handler: com.gu.footballtimemachine.ArchiveLambda::handler Runtime: java21 CodeUri: Bucket: !Ref DeployBucket Key: !Sub ${Stack}/${Stage}/${App}-archive/${App}-archive.jar FunctionName: !Sub ${App}-archive-${Stage} Environment: Variables: Stage: !Ref Stage Stack: !Ref Stack App: !Sub ${App}-archive Description: Stores pa feed on s3 MemorySize: 512 Timeout: 60 Events: Timer: Type: Schedule Properties: Schedule: rate(1 minute) Policies: - Version: '2012-10-17' Statement: - Effect: Allow Action: - s3:* Resource: arn:aws:s3:::pa-football-time-machine/* - Effect: Allow Action: - ssm:GetParametersByPath Resource: !Sub arn:aws:ssm:${AWS::Region}:${AWS::AccountId}:parameter/${App}-archive/${Stage}/${Stack} ApiLambda: Type: AWS::Serverless::Function Properties: Handler: com.gu.footballtimemachine.ApiLambda::getPaData Runtime: java21 CodeUri: Bucket: !Ref DeployBucket Key: !Sub ${Stack}/${Stage}/${App}-api/${App}-api.jar FunctionName: !Sub ${App}-api-${Stage} Environment: Variables: Stage: !Ref Stage Stack: !Ref Stack App: !Sub ${App}-api Description: Restitutes PA data through a mocked API MemorySize: 256 Timeout: 60 Events: Api: Type: Api Properties: Path: /{proxy+} Method: ANY Policies: - Version: '2012-10-17' Statement: - Effect: Allow Action: - s3:* Resource: arn:aws:s3:::pa-football-time-machine/* - Effect: Allow Action: - s3:* Resource: arn:aws:s3:::pa-football-time-machine SetDateLambda: Type: AWS::Serverless::Function Properties: Handler: com.gu.footballtimemachine.ApiLambda::setDate Runtime: java21 CodeUri: Bucket: !Ref DeployBucket Key: !Sub ${Stack}/${Stage}/${App}-api/${App}-api.jar FunctionName: !Sub ${App}-setDate-${Stage} Environment: Variables: Stage: !Ref Stage Stack: !Ref Stack App: !Sub ${App}-api Description: Sets the fake date in order to replay a game MemorySize: 256 Timeout: 60 Events: Api: Type: Api Properties: Path: /setDate Method: ANY Policies: - Version: '2012-10-17' Statement: - Effect: Allow Action: - s3:* Resource: arn:aws:s3:::pa-football-time-machine/* GetTimeLambda: Type: AWS::Serverless::Function Properties: Handler: com.gu.footballtimemachine.ApiLambda::getTime Runtime: java21 CodeUri: Bucket: !Ref DeployBucket Key: !Sub ${Stack}/${Stage}/${App}-api/${App}-api.jar FunctionName: !Sub ${App}-getTime-${Stage} Environment: Variables: Stage: !Ref Stage Stack: !Ref Stack App: !Sub ${App}-api Description: Displays what time it currently is in order to debug what's happening MemorySize: 256 Timeout: 60 Events: Api: Type: Api Properties: Path: /getTime Method: ANY Policies: - Version: '2012-10-17' Statement: - Effect: Allow Action: - s3:* Resource: arn:aws:s3:::pa-football-time-machine/*