serverless-api-gateway-caching
Advanced tools
Comparing version 1.6.1 to 1.7.0-rc1
@@ -0,0 +0,0 @@ { |
{ | ||
"name": "serverless-api-gateway-caching", | ||
"version": "1.6.1", | ||
"version": "1.7.0-rc1", | ||
"description": "A plugin for the serverless framework which helps with configuring caching for API Gateway endpoints.", | ||
@@ -5,0 +5,0 @@ "main": "src/apiGatewayCachingPlugin.js", |
@@ -268,4 +268,6 @@ # serverless-api-gateway-caching | ||
## Configuring a shared API Gateway | ||
This just means that no changes are applied to the root caching configuration of the API Gateway, however `ttlInSeconds`, `dataEncryption` and `perKeyInvalidation` are still applied to all functions, unless specifically overridden. | ||
Setting `apiGatewayIsShared` to `true` means that no changes are applied to the root caching configuration of the API Gateway. However, `ttlInSeconds`, `dataEncryption` and `perKeyInvalidation` are still applied to all functions, unless specifically overridden. | ||
You can also optionally specify the `restApiId` of the shared API Gateway if you have exported that from a different CloudFormation stack. If a `restApiId` is not specified, the plugin will automatically try to find one in the stack that's being deployed. | ||
```yml | ||
@@ -279,2 +281,3 @@ plugins: | ||
apiGatewayIsShared: true | ||
restApiId: ${cf:api-gateway-${self:provider.stage}.RestApiId} | ||
clusterSize: '0.5' | ||
@@ -300,3 +303,3 @@ ttlInSeconds: 300 | ||
Fn::GetAtt: | ||
- ApiGatewayRestApi # the default Rest API logical ID | ||
- ApiGatewayRestApi # the default REST API logical ID | ||
- RootResourceId | ||
@@ -303,0 +306,0 @@ PathPart: serverless # the endpoint in your API that is set as proxy |
@@ -27,5 +27,5 @@ 'use strict'; | ||
updateCloudFormationTemplate() { | ||
this.thereIsARestApi = restApiExists(this.serverless); | ||
this.thereIsARestApi = restApiExists(this.serverless, this.settings); | ||
if (!this.thereIsARestApi) { | ||
this.serverless.cli.log(`[serverless-api-gateway-caching] No Rest API found. Caching settings will not be updated.`); | ||
this.serverless.cli.log(`[serverless-api-gateway-caching] No REST API found. Caching settings will not be updated.`); | ||
return; | ||
@@ -45,5 +45,5 @@ } | ||
updateStage() { | ||
this.thereIsARestApi = restApiExists(this.serverless); | ||
this.thereIsARestApi = restApiExists(this.serverless, this.settings); | ||
if (!this.thereIsARestApi) { | ||
this.serverless.cli.log(`[serverless-api-gateway-caching] No Rest API found. Caching settings will not be updated.`); | ||
this.serverless.cli.log(`[serverless-api-gateway-caching] No REST API found. Caching settings will not be updated.`); | ||
return; | ||
@@ -50,0 +50,0 @@ } |
@@ -98,2 +98,3 @@ const get = require('lodash.get'); | ||
this.apiGatewayIsShared = cachingSettings.apiGatewayIsShared; | ||
this.restApiId = cachingSettings.restApiId; | ||
@@ -100,0 +101,0 @@ if (options) { |
@@ -0,0 +0,0 @@ const split = require('lodash.split'); |
@@ -10,3 +10,6 @@ 'use strict'; | ||
const restApiExists = (serverless) => { | ||
const restApiExists = (serverless, settings) => { | ||
if (get(settings, 'restApiId')) { | ||
return true; | ||
} | ||
const configuredRestApiId = getConfiguredRestApiId(serverless); | ||
@@ -28,3 +31,3 @@ if (configuredRestApiId) { | ||
serverless.service.provider.compiledCloudFormationTemplate.Outputs[REST_API_ID_KEY] = { | ||
Description: 'Rest API Id', | ||
Description: 'REST API ID', | ||
Value: configuredRestApiId || autoGeneratedRestApiId, | ||
@@ -35,2 +38,6 @@ }; | ||
const retrieveRestApiId = async (serverless, settings) => { | ||
if (settings.restApiId) { | ||
return settings.restApiId; | ||
} | ||
const stackName = serverless.providers.aws.naming.getStackName(settings.stage); | ||
@@ -37,0 +44,0 @@ |
@@ -0,0 +0,0 @@ const isEmpty = require('lodash.isempty'); |
@@ -0,0 +0,0 @@ module.exports = { |
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
39037
578
404
2