Skip to content

Commit eb84fdf

Browse files
authored
Merge pull request #11 from aws-samples/app/upgrade/nodejs
Fix SDK Javascript V3 for ElastiCache Serverless
2 parents eb6b248 + d59e115 commit eb84fdf

File tree

2 files changed

+24
-17
lines changed

2 files changed

+24
-17
lines changed

frontend/src/pages/Sm-clustersElasticache-01.js

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -345,21 +345,28 @@ function Login() {
345345
else
346346
authMode = "modeNonAuth";
347347

348-
rdsItems.push({
349-
identifier : item['ServerlessCacheName'],
350-
status : item['Status'] ,
351-
size : (parseFloat(item['CacheUsageLimits']['ECPUPerSecond']['Maximum'])).toLocaleString('en-US', {minimumFractionDigits:0, maximumFractionDigits:0}) + " (ECPUs)",
352-
engine : "elasticache:redis-serverless" ,
353-
shards : "-",
354-
nodes: "-",
355-
mode: "-",
356-
endpoint: item['Endpoint']['Address'],
357-
port : item['Endpoint']['Port'],
358-
multiaz : "true",
359-
ssl : "required",
360-
auth : authMode,
361-
authmode : authMode,
362-
});
348+
if ( item['Engine'] == "redis") {
349+
rdsItems.push({
350+
identifier : item['ServerlessCacheName'],
351+
status : item['Status'] ,
352+
size : (
353+
( parseFloat(item['CacheUsageLimits']?.['ECPUPerSecond']?.['Maximum']) || 0 ) > 0 ?
354+
( parseFloat(item['CacheUsageLimits']?.['ECPUPerSecond']?.['Maximum']) || 0 ).toLocaleString('en-US', {minimumFractionDigits:0, maximumFractionDigits:0}) + " (ECPUs)"
355+
:
356+
""
357+
),
358+
engine : "elasticache:" + item['Engine'] + "-serverless" ,
359+
shards : "-",
360+
nodes: "-",
361+
mode: "-",
362+
endpoint: item['Endpoint']['Address'],
363+
port : item['Endpoint']['Port'],
364+
multiaz : "true",
365+
ssl : "required",
366+
auth : authMode,
367+
authmode : authMode,
368+
});
369+
}
363370

364371

365372
}

server/class.aws.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const { RDSClient, DescribeDBClustersCommand, DescribeDBInstancesCommand } = req
1212
const { DocDBClient, /*DescribeDBClustersCommand*/ } = require("@aws-sdk/client-docdb");
1313
const { CloudWatchClient, GetMetricDataCommand } = require("@aws-sdk/client-cloudwatch");
1414
const { CloudWatchLogsClient, GetLogEventsCommand } = require("@aws-sdk/client-cloudwatch-logs");
15-
const { DocDBElasticClient, GetClusterCommand } = require("@aws-sdk/client-docdb-elastic");
15+
const { DocDBElasticClient, GetClusterCommand, ListClustersCommand } = require("@aws-sdk/client-docdb-elastic");
1616
const { DynamoDBClient, DescribeTableCommand, ListTablesCommand } = require("@aws-sdk/client-dynamodb");
1717
const { STSClient, GetCallerIdentityCommand } = require("@aws-sdk/client-sts");
1818

@@ -1446,7 +1446,7 @@ class classAWS {
14461446

14471447
try {
14481448

1449-
const command = new GetClusterCommand(parameter);
1449+
const command = new ListClustersCommand(parameter);
14501450
const data = await docdbelastic.send(command);
14511451
return data;
14521452

0 commit comments

Comments
 (0)