fix jslint issue

This commit is contained in:
Quan HL
2023-06-28 05:27:49 +07:00
parent 11f0a9fb99
commit 11677c8954
+23 -16
View File
@@ -6,9 +6,15 @@ const {LifeCycleEvents} = require('./constants');
const express = require('express');
const app = express();
const getString = bent('string');
import { SNSClient, SubscribeCommand, UnsubscribeCommand } from "@aws-sdk/client-sns";
const {
SNSClient,
SubscribeCommand,
UnsubscribeCommand } = require('@aws-sdk/client-sns');
const snsClient = new SNSClient({ region: process.env.AWS_REGION, apiVersion: '2010-03-31' });
import { AutoScalingClient, DescribeAutoScalingGroupsCommand, CompleteLifecycleActionCommand } from "@aws-sdk/client-auto-scaling";
const {
AutoScalingClient,
DescribeAutoScalingGroupsCommand,
CompleteLifecycleActionCommand } = require('@aws-sdk/client-auto-scaling');
const autoScalingClient = new AutoScalingClient({ region: process.env.AWS_REGION, apiVersion: '2011-01-01' });
const {Parser} = require('xml2js');
const parser = new Parser();
@@ -157,12 +163,13 @@ class SnsNotifier extends Emitter {
completeScaleIn() {
assert(this.scaleInParams);
autoScalingClient.send(new CompleteLifecycleActionCommand(this.scaleInParams))
.then(() => {
this.logger.info({response}, 'Successfully completed scale-in action');
})
.catch((err) => {
this.logger.error({err}, 'Error completing scale-in');
})
.then((data) => {
this.logger.info({data}, 'Successfully completed scale-in action');
return 0;
})
.catch((err) => {
this.logger.error({err}, 'Error completing scale-in');
});
}
describeInstance() {
@@ -171,14 +178,14 @@ class SnsNotifier extends Emitter {
autoScalingClient.send(new DescribeAutoScalingGroupsCommand({
InstanceIds: [this.instanceId]
}))
.then((data) => {
this.logger.info({data}, 'SnsNotifier: describeInstance');
resolve(data);
})
.catch((err) => {
his.logger.error({err}, 'Error describing instances');
reject(err);
})
.then((data) => {
this.logger.info({data}, 'SnsNotifier: describeInstance');
return resolve(data);
})
.catch((err) => {
this.logger.error({err}, 'Error describing instances');
reject(err);
});
});
}