mirror of
https://github.com/serverless/serverless.git
synced 2025-12-08 19:46:03 +00:00
Delete bucket was still using them Hopefully all :) Further test fixes. .... worked too long yesterday Fixed Variable tests Remove not used parameters from request() and add options with warning
38 lines
1.1 KiB
JavaScript
38 lines
1.1 KiB
JavaScript
'use strict';
|
|
|
|
const BbPromise = require('bluebird');
|
|
const _ = require('lodash');
|
|
|
|
module.exports = {
|
|
getApiKeyValues() {
|
|
const info = this.gatheredData.info;
|
|
info.apiKeys = [];
|
|
|
|
// check if the user has set api keys
|
|
const apiKeyNames = this.serverless.service.provider.apiKeys || [];
|
|
|
|
if (apiKeyNames.length) {
|
|
return this.provider.request('APIGateway',
|
|
'getApiKeys',
|
|
{ includeValues: true }
|
|
).then((allApiKeys) => {
|
|
const items = allApiKeys.items;
|
|
if (items && items.length) {
|
|
// filter out the API keys only created for this stack
|
|
const filteredItems = items.filter((item) => _.includes(apiKeyNames, item.name));
|
|
|
|
// iterate over all apiKeys and push the API key info and update the info object
|
|
filteredItems.forEach((item) => {
|
|
const apiKeyInfo = {};
|
|
apiKeyInfo.name = item.name;
|
|
apiKeyInfo.value = item.value;
|
|
info.apiKeys.push(apiKeyInfo);
|
|
});
|
|
}
|
|
return BbPromise.resolve();
|
|
});
|
|
}
|
|
return BbPromise.resolve();
|
|
},
|
|
};
|