-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add memory and timeout to lambda table
- Loading branch information
1 parent
20f2dce
commit 047dfc1
Showing
3 changed files
with
56 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
async function getFunctionConfig(lambdaApi, params) { | ||
return lambdaApi | ||
.getFunctionConfiguration(params) | ||
.promise() | ||
.catch(() => null); | ||
} | ||
|
||
async function getFunctionMemoryAndTimeout(lambdaApi, funcName) { | ||
const params = { FunctionName: funcName }; | ||
|
||
const config = await getFunctionConfig(lambdaApi, params); | ||
if (config) { | ||
const details = { | ||
timeout: config.Timeout.toString(), | ||
memory: config.MemorySize.toString(), | ||
}; | ||
return details; | ||
} | ||
return null; | ||
} | ||
|
||
module.exports = { | ||
getFunctionMemoryAndTimeout, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// Add whitespace to the front of a string until it's at least numCharacters long | ||
function padString(s, numCharacters) { | ||
let result = s; | ||
while (result.length < numCharacters) { | ||
result = ` ${result}`; | ||
} | ||
return result; | ||
} | ||
|
||
module.exports = { | ||
padString, | ||
}; |