list jobs cli
parent
39b9932526
commit
024ea4441c
|
|
@ -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) {
|
static cleanup(deleteResources = false, OneDayOlderOnly = false) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
process.env.AWS_REGION = input_1.default.region;
|
process.env.AWS_REGION = input_1.default.region;
|
||||||
|
|
@ -2160,6 +2176,9 @@ __decorate([
|
||||||
__decorate([
|
__decorate([
|
||||||
cli_functions_repository_1.CliFunction(`aws-list-log-groups`, `List tasks`)
|
cli_functions_repository_1.CliFunction(`aws-list-log-groups`, `List tasks`)
|
||||||
], AwsCliCommands, "awsListLogGroups", null);
|
], AwsCliCommands, "awsListLogGroups", null);
|
||||||
|
__decorate([
|
||||||
|
cli_functions_repository_1.CliFunction(`aws-list-jobs`, `List tasks`)
|
||||||
|
], AwsCliCommands, "awsListJobs", null);
|
||||||
exports.AwsCliCommands = AwsCliCommands;
|
exports.AwsCliCommands = AwsCliCommands;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -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) {
|
private static async cleanup(deleteResources = false, OneDayOlderOnly: boolean = false) {
|
||||||
process.env.AWS_REGION = Input.region;
|
process.env.AWS_REGION = Input.region;
|
||||||
const CF = new AWS.CloudFormation();
|
const CF = new AWS.CloudFormation();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue