list jobs cli

pull/419/head
Frostebite 2022-07-27 02:32:01 +01:00
parent 39b9932526
commit 024ea4441c
3 changed files with 40 additions and 1 deletions

19
dist/index.js vendored
View File

@ -2099,6 +2099,22 @@ class AwsCliCommands {
}
});
}
static awsListJobs(perResultCallback = false, verbose = false) {
var _a;
return __awaiter(this, void 0, void 0, function* () {
process.env.AWS_REGION = input_1.default.region;
const CF = new aws_sdk_1.default.CloudFormation();
const stacks = ((_a = (yield CF.listStacks().promise()).StackSummaries) === null || _a === void 0 ? void 0 : _a.filter((_x) => _x.StackStatus !== 'DELETE_COMPLETE' && _x.TemplateDescription !== base_stack_formation_1.BaseStackFormation.baseStackDecription)) || [];
cloud_runner_logger_1.default.log(`Stacks ${stacks.length}`);
for (const element of stacks) {
const ageDate = new Date(element.CreationTime.getTime() - Date.now());
if (verbose)
cloud_runner_logger_1.default.log(`Task Stack ${element.StackName} - Age D${ageDate.getDay()} H${ageDate.getHours()} M${ageDate.getMinutes()}`);
if (perResultCallback)
yield perResultCallback(element);
}
});
}
static cleanup(deleteResources = false, OneDayOlderOnly = false) {
return __awaiter(this, void 0, void 0, function* () {
process.env.AWS_REGION = input_1.default.region;
@ -2160,6 +2176,9 @@ __decorate([
__decorate([
cli_functions_repository_1.CliFunction(`aws-list-log-groups`, `List tasks`)
], AwsCliCommands, "awsListLogGroups", null);
__decorate([
cli_functions_repository_1.CliFunction(`aws-list-jobs`, `List tasks`)
], AwsCliCommands, "awsListJobs", null);
exports.AwsCliCommands = AwsCliCommands;

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -137,6 +137,26 @@ export class AwsCliCommands {
}
}
@CliFunction(`aws-list-jobs`, `List tasks`)
static async awsListJobs(perResultCallback: any = false, verbose: boolean = false) {
process.env.AWS_REGION = Input.region;
const CF = new AWS.CloudFormation();
const stacks =
(await CF.listStacks().promise()).StackSummaries?.filter(
(_x) =>
_x.StackStatus !== 'DELETE_COMPLETE' && _x.TemplateDescription !== BaseStackFormation.baseStackDecription,
) || [];
CloudRunnerLogger.log(`Stacks ${stacks.length}`);
for (const element of stacks) {
const ageDate = new Date(element.CreationTime.getTime() - Date.now());
if (verbose)
CloudRunnerLogger.log(
`Task Stack ${element.StackName} - Age D${ageDate.getDay()} H${ageDate.getHours()} M${ageDate.getMinutes()}`,
);
if (perResultCallback) await perResultCallback(element);
}
}
private static async cleanup(deleteResources = false, OneDayOlderOnly: boolean = false) {
process.env.AWS_REGION = Input.region;
const CF = new AWS.CloudFormation();