AWSTemplateFormatVersion: '2010-09-09'
Transform: 'AWS::Serverless-2016-10-31'
Description: 'SAM template for Serverless framework service: '
Resources:
  AwsJavaSimpleHttpEndpointDevCurrentTime:
    Type: 'AWS::Serverless::Function'
    Properties:
      Handler: com.serverless.Handler
      Runtime: java8
      CodeUri: build/distributions/aws-java-simple-http-endpoint.zip
      MemorySize: 128
      Timeout: 3
      Events:
        Event1:
          Type: Api
          Properties:
            Path: /ping
            Method: get
            RestApiId:
              Ref: AwsJavaSimpleHttpEndpoint
  AwsJavaSimpleHttpEndpoint:
    Type: 'AWS::Serverless::Api'
    Properties:
      StageName: dev
      DefinitionBody:
        swagger: '2.0'
        info:
          title:
            Ref: 'AWS::StackName'
        paths:
          /ping:
            get:
              x-amazon-apigateway-integration:
                httpMethod: POST
                type: aws_proxy
                uri:
                  'Fn::Sub': >-
                    arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${AwsJavaSimpleHttpEndpointDevCurrentTime.Arn}/invocations
              responses: {}
  AwsJavaSimpleHttpEndpointDevCurrentTimeLambdaPermission:
    Type: 'AWS::Lambda::Permission'
    DependsOn:
      - AwsJavaSimpleHttpEndpointDevCurrentTime
    Properties:
      Action: 'lambda:InvokeFunction'
      FunctionName:
        Ref: AwsJavaSimpleHttpEndpointDevCurrentTime
      Principal: apigateway.amazonaws.com
