Editor/Resources/CloudFormation/scenario1_auth_only/cloudformation.yml [202:301]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  ApiDeployment:
    Type: "AWS::ApiGateway::Deployment"
    DependsOn:
      - GameRequestApiMethod
      - ResultsRequestApiMethod
    Properties:
      RestApiId: !Ref RestApi
      StageDescription:
        DataTraceEnabled: true
        LoggingLevel: INFO
        MetricsEnabled: true
      StageName: !Ref ApiGatewayStageNameParameter

  Authorizer:
    Type: "AWS::ApiGateway::Authorizer"
    Properties:
      IdentitySource: method.request.header.Authorization
      Name: CognitoAuthorizer
      ProviderARNs:
        - "Fn::GetAtt":
            - UserPool
            - Arn
      RestApiId: !Ref RestApi
      Type: COGNITO_USER_POOLS

  GameRequestLambdaFunction:
    Type: "AWS::Lambda::Function"
    Properties:
      Code:
        S3Bucket: !Ref LambdaZipS3BucketParameter
        S3Key: !Ref LambdaZipS3KeyParameter
      Description: Lambda function to handle game requests
      Environment:
        Variables:
          GameName: !Ref GameNameParameter
      FunctionName: !Sub ${GameNameParameter}GameRequestLambda
      Handler: game_request.handler
      MemorySize: 128
      Role: !GetAtt GameRequestLambdaFunctionExecutionRole.Arn
      Runtime: python3.8

  ResultsRequestLambdaFunction:
    Type: "AWS::Lambda::Function"
    Properties:
      Code:
        S3Bucket: !Ref LambdaZipS3BucketParameter
        S3Key: !Ref LambdaZipS3KeyParameter
      Description: Lambda function to handle game requests
      Environment:
        Variables:
          GameName: !Ref GameNameParameter
      FunctionName: !Sub ${GameNameParameter}ResultsRequestLambda
      Handler: results_request.handler
      MemorySize: 128
      Role: !GetAtt ResultsRequestLambdaFunctionExecutionRole.Arn
      Runtime: python3.8

  GameRequestApiMethod:
    Type: "AWS::ApiGateway::Method"
    Properties:
      AuthorizationType: COGNITO_USER_POOLS
      AuthorizerId: !Ref Authorizer
      HttpMethod: POST
      Integration:
        Type: AWS_PROXY
        IntegrationHttpMethod: POST
        Uri: !Sub "arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${GameRequestLambdaFunction.Arn}/invocations"
      OperationName: GameRequest
      ResourceId: !Ref GameRequestApiResource
      RestApiId: !Ref RestApi

  GameRequestLambdaFunctionApiGatewayPermission:
    Type: "AWS::Lambda::Permission"
    Properties:
      Action: "lambda:InvokeFunction"
      FunctionName: !GetAtt GameRequestLambdaFunction.Arn
      Principal: apigateway.amazonaws.com
      SourceArn: !Sub "arn:aws:execute-api:${AWS::Region}:${AWS::AccountId}:${RestApi}/*/*/*"

  ResultsRequestApiMethod:
    Type: "AWS::ApiGateway::Method"
    Properties:
      AuthorizationType: COGNITO_USER_POOLS
      AuthorizerId: !Ref Authorizer
      HttpMethod: POST
      Integration:
        Type: AWS_PROXY
        IntegrationHttpMethod: POST
        Uri: !Sub "arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${ResultsRequestLambdaFunction.Arn}/invocations"
      OperationName: ResultsRequest
      ResourceId: !Ref ResultsRequestApiResource
      RestApiId: !Ref RestApi

  ResultsRequestLambdaFunctionApiGatewayPermission:
    Type: "AWS::Lambda::Permission"
    Properties:
      Action: "lambda:InvokeFunction"
      FunctionName: !GetAtt ResultsRequestLambdaFunction.Arn
      Principal: apigateway.amazonaws.com
      SourceArn: !Sub "arn:aws:execute-api:${AWS::Region}:${AWS::AccountId}:${RestApi}/*/*/*"
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



Samples~/CustomScenario/cloudformation.yml [166:265]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  ApiDeployment:
    Type: "AWS::ApiGateway::Deployment"
    DependsOn:
      - GameRequestApiMethod
      - ResultsRequestApiMethod
    Properties:
      RestApiId: !Ref RestApi
      StageDescription:
        DataTraceEnabled: true
        LoggingLevel: INFO
        MetricsEnabled: true
      StageName: !Ref ApiGatewayStageNameParameter

  Authorizer:
    Type: "AWS::ApiGateway::Authorizer"
    Properties:
      IdentitySource: method.request.header.Authorization
      Name: CognitoAuthorizer
      ProviderARNs:
        - "Fn::GetAtt":
            - UserPool
            - Arn
      RestApiId: !Ref RestApi
      Type: COGNITO_USER_POOLS

  GameRequestLambdaFunction:
    Type: "AWS::Lambda::Function"
    Properties:
      Code:
        S3Bucket: !Ref LambdaZipS3BucketParameter
        S3Key: !Ref LambdaZipS3KeyParameter
      Description: Lambda function to handle game requests
      Environment:
        Variables:
          GameName: !Ref GameNameParameter
      FunctionName: !Sub ${GameNameParameter}GameRequestLambda
      Handler: game_request.handler
      MemorySize: 128
      Role: !GetAtt GameRequestLambdaFunctionExecutionRole.Arn
      Runtime: python3.8

  ResultsRequestLambdaFunction:
    Type: "AWS::Lambda::Function"
    Properties:
      Code:
        S3Bucket: !Ref LambdaZipS3BucketParameter
        S3Key: !Ref LambdaZipS3KeyParameter
      Description: Lambda function to handle game requests
      Environment:
        Variables:
          GameName: !Ref GameNameParameter
      FunctionName: !Sub ${GameNameParameter}ResultsRequestLambda
      Handler: results_request.handler
      MemorySize: 128
      Role: !GetAtt ResultsRequestLambdaFunctionExecutionRole.Arn
      Runtime: python3.8

  GameRequestApiMethod:
    Type: "AWS::ApiGateway::Method"
    Properties:
      AuthorizationType: COGNITO_USER_POOLS
      AuthorizerId: !Ref Authorizer
      HttpMethod: POST
      Integration:
        Type: AWS_PROXY
        IntegrationHttpMethod: POST
        Uri: !Sub "arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${GameRequestLambdaFunction.Arn}/invocations"
      OperationName: GameRequest
      ResourceId: !Ref GameRequestApiResource
      RestApiId: !Ref RestApi

  GameRequestLambdaFunctionApiGatewayPermission:
    Type: "AWS::Lambda::Permission"
    Properties:
      Action: "lambda:InvokeFunction"
      FunctionName: !GetAtt GameRequestLambdaFunction.Arn
      Principal: apigateway.amazonaws.com
      SourceArn: !Sub "arn:aws:execute-api:${AWS::Region}:${AWS::AccountId}:${RestApi}/*/*/*"

  ResultsRequestApiMethod:
    Type: "AWS::ApiGateway::Method"
    Properties:
      AuthorizationType: COGNITO_USER_POOLS
      AuthorizerId: !Ref Authorizer
      HttpMethod: POST
      Integration:
        Type: AWS_PROXY
        IntegrationHttpMethod: POST
        Uri: !Sub "arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${ResultsRequestLambdaFunction.Arn}/invocations"
      OperationName: ResultsRequest
      ResourceId: !Ref ResultsRequestApiResource
      RestApiId: !Ref RestApi

  ResultsRequestLambdaFunctionApiGatewayPermission:
    Type: "AWS::Lambda::Permission"
    Properties:
      Action: "lambda:InvokeFunction"
      FunctionName: !GetAtt ResultsRequestLambdaFunction.Arn
      Principal: apigateway.amazonaws.com
      SourceArn: !Sub "arn:aws:execute-api:${AWS::Region}:${AWS::AccountId}:${RestApi}/*/*/*"
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



