我有以下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」創建的堆棧已改變(如您所建議的那樣),但緩存尚未啓用。 –