Resources:
  HttpApiFunction:
    Type: AWS::Serverless::Function
    Properties:
      CodeUri: s3://sam-demo-bucket/todo_list.zip
      Handler: index.restapi
      Runtime: python3.7
      Events:
        SimpleCase:
          Type: HttpApi
          Properties:
            ApiId: !Ref MyApi
        BasePath:
          Type: HttpApi
          Properties:
            ApiId: !Ref MyApi2
            Path: /
            Method: get
  MyApi:
    Type: AWS::Serverless::HttpApi
    Properties:
      FailOnWarnings: true
      Auth:
        Authorizers:
          OAuth2:
            AuthorizationScopes:
            - scope4
            JwtConfiguration:
              issuer: https://www.example.com/v1/connect/oidc
              audience:
              - MyApi
            IdentitySource: $request.querystring.param
        DefaultAuthorizer: OAuth2

  MyApi2:
    Type: AWS::Serverless::HttpApi
    Properties:
      Auth:
        Authorizers:
          OAuth2:
            JwtConfiguration:
              issuer: https://www.example.com/v1/connect/oidc
              audience:
              - MyApi
            IdentitySource: $request.querystring.param
        DefaultAuthorizer: OAuth2
      DefinitionBody:
        openapi: '3.0'
        info:
          title: !Sub ${AWS::StackName}-Apiv2
        paths:
          /:
            get:
              responses: {}
          $default:
            x-amazon-apigateway-any-method:
              isDefaultRoute: true
              x-amazon-apigateway-integration:
                httpMethod: ANY
                type: http_proxy
                uri: https://www.alphavantage.co/
                payloadFormatVersion: '1.0'