我有以下CF模板为APIGateway方法设置缓存
{
"Conditions":{
"CreatedProdStage" : {...}
}
...
"Resources":{
"GetMethod": {
...
},
"ApiDeployement":{
...
},
"ProdStage":{
"Type":"AWS::ApiGateway::Stage",
"Condition":"CreatedProdStage",
"Properties": {
"DeploymentId":"...",
"RestApiId":"...",
"MethodSettings":[{
"CachingEnabled":true,
"HttpMethod":{"Ref":"GetMethod"},
"ResourcePath":"/"
}]
}
}
}
}
而且我得到错误
无效的方法设置路径: /〜1/ST-GetMetho-xxxAUMMRWxxx /缓存/启用。必须是以下其中一个: [/ deploymentId,/ description, /cacheClusterEnabled/cacheClusterSize/clientCertificateId/{resourcePath}/{httpMethod}/metrics/enabled, /{resourcePath}/{httpMethod}/logging/dataTrace, /{资源路径}/{httpMethod}/logging/loglevel, /{resourcePath}/{httpMethod}/throttling/burstLimit/{resourcePath}/{httpMethod}/throttling/rateLimit/{resourcePath}/{httpMethod}/caching/ttlInSeconds, /{resourcePath}/{httpMethod} /缓存/启用, /{resourcePath}/{httpMethod}/caching/dataEncrypted, /{resourcePath}/{httpMethod}/caching/requireAuthorizationForCacheControl, /{resourcePath}/caching/unauthorizedCacheControlHeaderStrategy, // /度量/使能时,/ / /记录/ dataTrace,/ / /记录/记录级, // /节流/ burstLimit// /节流/ rateLimit // /缓存/ ttlInSeconds ,/ / /缓存/启用, // /缓存/ dataEncrypted, // /缓存/ requireAuthorizationForCacheControl, // /缓存/ unauthorizedCacheControlH eaderStrategy,/ va
我错过了什么吗?我想ResourcePath
和HttpMethod
是唯一必需的属性
已经尝试过,没有工作。 –
有趣 - 如果它不一样,你能发布错误吗? –
没有错误。 “HttpMethod”和“ResourcePath”创建的堆栈已改变(如您所建议的那样),但缓存尚未启用。 –