With “AWS::ApiGateway::Method” , we can define a RestAPI + Method as below:
functions:
getToken:
handler: index.getToken
resources:
Resources:
RestApi:
Type: AWS::ApiGateway::RestApi
Properties:
Name: ARestService
Description: "A Token API"
RestApiMethod:
Type: "AWS::ApiGateway::Method"
Properties:
RestApiId:
Ref: "RestApi"
ResourceId:
Fn::GetAtt:
- "RestApi"
- "RootResourceId"
HttpMethod: "POST"
AuthorizationType: "NONE"
Integration:
IntegrationHttpMethod: POST
Type: HTTP
Uri: "www.xxxx.com/getToken"
IntegrationResponses:
- StatusCode: 200
.....
And for the method integration, found there is NO Support for Lambda type but others like HTTP.
is it a way to set type as lambda and uri as lambda uri or better with getAttr fn from defined function above , like below
Integration:
IntegrationHttpMethod: POST
Type: LAMBDA
Uri: "ref: getToken" # getToken function was defined first
IntegrationResponses:
- StatusCode: 200
I know this may be done by events - http structure, but feel the Method Integration is a better place ( supposedly)