Resources:
  MyLambdaFunction:
    Type: AWS::Serverless::Function
    Properties:
      Handler: index.handler
      Runtime: python3.11
      InlineCode: |
        def handler(event, context):
            return {'body': 'Hello World!', 'statusCode': 200}
      MemorySize: 128
      Events:
        GetApi:
          Type: HttpApi
          Properties:
            ApiId:
              Ref: MyApi
            Method: ANY
            Path: /$default

  MyApi:
    Type: AWS::Serverless::HttpApi
    Properties:
      DefinitionBody:
        info:
          version: '1.0'
          title:
            Ref: AWS::StackName
        paths:
          /$default:
            x-amazon-apigateway-any-method:
              responses: {}
              isDefaultRoute: true
        openapi: 3.0.1

Outputs:
  ApiUrl:
    Description: API endpoint URL for Prod environment
    Value:
      Fn::Sub: https://${MyApi}.execute-api.${AWS::Region}.${AWS::URLSuffix}/
Metadata:
  SamTransformTest: true
