I have a yaml file for the API Gateway integration like this:
/users/{userId}:
get:
description: Get user details
parameters:
- description: Valid user id
in: path
name: userId
required: true
schema:
type: string
responses:
'200':
content: {}
description: Success
headers:
Access-Control-Allow-Origin:
schema:
type: string
'400':
content: {}
description: Invalid user id
security:
- NodeJsAuth: []
summary: Get User Id Details
tags:
- User
x-amazon-apigateway-integration:
connectionId: ${stageVariables.vpcLinkId}
connectionType: VPC_LINK
httpMethod: GET
passthroughBehavior: when_no_match
requestParameters:
integration.request.path.userId: method.request.path.userId
responses:
default:
responseParameters:
method.response.header.Access-Control-Allow-Origin: '''*'''
statusCode: '200'
type: http_proxy
uri: '#{EksElbUri}#/user/{userId}'
I want to enable cache for this method. I know I can enable it manually but I want to do it in YAML file so it could be easier to execute.
I have my stage enabled the cache already (via AWS Console UI). However I could not find anywhere that is mentioning how to enable cache for this method ONLY.
I am aware that once enabled the cache in stage, it will enabled for all GET endpoints and I have many GET endpoints but I only want this one to be cached.
Is there a way that I can specify the cache in OPEN-API so I no need to disable all the other GET endpoint one by one manually?
Thank you.