integration/resources/templates/combination/api_with_request_models_openapi.yaml (42 lines of code) (raw):
Resources:
MyApi:
Type: AWS::Serverless::Api
Properties:
OpenApiVersion: 3.0.1
StageName: Prod
Models:
User:
type: object
properties:
username:
type: string
MyFunction:
Type: AWS::Serverless::Function
Properties:
Handler: index.handler
Runtime: nodejs18.x
InlineCode: |
exports.handler = async (event, context, callback) => {
return {
statusCode: 200,
body: 'Success'
}
}
Events:
None:
Type: Api
Properties:
RequestModel:
Model: User
Required: true
RestApiId:
Ref: MyApi
Method: get
Path: /none
Outputs:
ApiUrl:
Description: API endpoint URL for Prod environment
Value:
Fn::Sub: https://${MyApi}.execute-api.${AWS::Region}.${AWS::URLSuffix}/Prod/
Metadata:
SamTransformTest: true