@cloudchipr/cloudchipr-engine
Advanced tools
Comparing version 0.1.86 to 0.1.87
@@ -140,4 +140,5 @@ "use strict"; | ||
var _this = this; | ||
var metadata = resource.metadata; | ||
return new Promise(function (resolve, reject) { | ||
_this.getClient(resource.region).send(AwsRdsClient.getCleanCommand(resource.id, resource.action)) | ||
_this.getClient(resource.region).send(AwsRdsClient.getCleanCommand(resource.id, resource.action, !!metadata.snapshot)) | ||
.then(function () { return resolve(resource.id); }) | ||
@@ -219,7 +220,14 @@ .catch(function (e) { | ||
}; | ||
AwsRdsClient.getCleanCommand = function (instanceIdentifier, action) { | ||
AwsRdsClient.getCleanCommand = function (instanceIdentifier, action, snapshot) { | ||
var props = { DBInstanceIdentifier: instanceIdentifier }; | ||
if (action === constant_1.CleanAction.STOP) { | ||
return new client_rds_1.StopDBInstanceCommand({ DBInstanceIdentifier: instanceIdentifier }); | ||
return new client_rds_1.StopDBInstanceCommand(props); | ||
} | ||
return new client_rds_1.DeleteDBInstanceCommand({ DBInstanceIdentifier: instanceIdentifier, SkipFinalSnapshot: true }); | ||
if (!snapshot) { | ||
props.SkipFinalSnapshot = true; | ||
} | ||
else { | ||
props.FinalDBSnapshotIdentifier = "snapshot-".concat(instanceIdentifier, "-").concat((0, moment_1.default)().unix()); | ||
} | ||
return new client_rds_1.DeleteDBInstanceCommand(props); | ||
}; | ||
@@ -226,0 +234,0 @@ AwsRdsClient.getMetricStatisticsCommand = function (instanceIdentifier, metricName, unit) { |
@@ -13,2 +13,5 @@ export interface CleanAwsEbsMetadataInterface { | ||
} | ||
export interface CleanAwsRdsMetadataInterface { | ||
snapshot?: boolean; | ||
} | ||
export interface CleanGcpVmMetadataInterface { | ||
@@ -25,2 +28,2 @@ zone: string; | ||
} | ||
export declare type CleanRequestResourceMetadataInterface = CleanAwsEbsMetadataInterface | CleanAwsEipMetadataInterface | CleanAwsElbMetadataInterface | CleanGcpVmMetadataInterface | CleanGcpDisksMetadataInterface | CleanGcpLbEipMetadataInterface; | ||
export declare type CleanRequestResourceMetadataInterface = CleanAwsEbsMetadataInterface | CleanAwsEipMetadataInterface | CleanAwsElbMetadataInterface | CleanAwsRdsMetadataInterface | CleanGcpVmMetadataInterface | CleanGcpDisksMetadataInterface | CleanGcpLbEipMetadataInterface; |
{ | ||
"name": "@cloudchipr/cloudchipr-engine", | ||
"version": "0.1.86", | ||
"version": "0.1.87", | ||
"description": "Cloudchipr engine", | ||
@@ -33,3 +33,3 @@ "main": "lib/index.js", | ||
"@aws-sdk/client-pricing": "^3.121.0", | ||
"@aws-sdk/client-rds": "^3.47.1", | ||
"@aws-sdk/client-rds": "^3.180.0", | ||
"@aws-sdk/credential-providers": "^3.41.0", | ||
@@ -36,0 +36,0 @@ "fs": "0.0.1-security", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
573388
11164
Updated@aws-sdk/client-rds@^3.180.0