better aws commands
parent
1ff1597a05
commit
fa7bd794ae
|
|
@ -2011,10 +2011,12 @@ class AwsCliCommands {
|
|||
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')) || [];
|
||||
cloud_runner_logger_1.default.log(`DescribeStacksRequest ${stacks.length}`);
|
||||
for (const element of stacks) {
|
||||
cloud_runner_logger_1.default.log(JSON.stringify(element, undefined, 4));
|
||||
cloud_runner_logger_1.default.log(`${element.StackName}`);
|
||||
perResultCallback(element);
|
||||
if (perResultCallback)
|
||||
yield perResultCallback(element);
|
||||
}
|
||||
if (stacks === undefined) {
|
||||
return;
|
||||
|
|
@ -2033,13 +2035,12 @@ class AwsCliCommands {
|
|||
};
|
||||
const list = (yield ecs.listTasks(input).promise()).taskArns || [];
|
||||
if (list.length > 0) {
|
||||
cloud_runner_logger_1.default.log(`DescribeTasksRequest`);
|
||||
cloud_runner_logger_1.default.log(JSON.stringify(list, undefined, 4));
|
||||
const describeInput = { tasks: list, cluster: element };
|
||||
const describeList = (yield ecs.describeTasks(describeInput).promise()).tasks || [];
|
||||
if (describeList === []) {
|
||||
continue;
|
||||
}
|
||||
cloud_runner_logger_1.default.log(`DescribeTasksRequest ${describeList.length}`);
|
||||
for (const taskElement of describeList) {
|
||||
if (taskElement === undefined) {
|
||||
continue;
|
||||
|
|
@ -2051,7 +2052,8 @@ class AwsCliCommands {
|
|||
cloud_runner_logger_1.default.log(`Skipping ${taskElement.taskDefinitionArn} no createdAt date`);
|
||||
continue;
|
||||
}
|
||||
perResultCallback(taskElement, element);
|
||||
if (perResultCallback)
|
||||
yield perResultCallback(taskElement, element);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -10,10 +10,11 @@ export class AwsCliCommands {
|
|||
const CF = new AWS.CloudFormation();
|
||||
const stacks =
|
||||
(await CF.listStacks().promise()).StackSummaries?.filter((_x) => _x.StackStatus !== 'DELETE_COMPLETE') || [];
|
||||
CloudRunnerLogger.log(`DescribeStacksRequest ${stacks.length}`);
|
||||
for (const element of stacks) {
|
||||
CloudRunnerLogger.log(JSON.stringify(element, undefined, 4));
|
||||
CloudRunnerLogger.log(`${element.StackName}`);
|
||||
perResultCallback(element);
|
||||
if (perResultCallback) await perResultCallback(element);
|
||||
}
|
||||
if (stacks === undefined) {
|
||||
return;
|
||||
|
|
@ -31,13 +32,12 @@ export class AwsCliCommands {
|
|||
};
|
||||
const list = (await ecs.listTasks(input).promise()).taskArns || [];
|
||||
if (list.length > 0) {
|
||||
CloudRunnerLogger.log(`DescribeTasksRequest`);
|
||||
CloudRunnerLogger.log(JSON.stringify(list, undefined, 4));
|
||||
const describeInput: AWS.ECS.DescribeTasksRequest = { tasks: list, cluster: element };
|
||||
const describeList = (await ecs.describeTasks(describeInput).promise()).tasks || [];
|
||||
if (describeList === []) {
|
||||
continue;
|
||||
}
|
||||
CloudRunnerLogger.log(`DescribeTasksRequest ${describeList.length}`);
|
||||
for (const taskElement of describeList) {
|
||||
if (taskElement === undefined) {
|
||||
continue;
|
||||
|
|
@ -49,7 +49,7 @@ export class AwsCliCommands {
|
|||
CloudRunnerLogger.log(`Skipping ${taskElement.taskDefinitionArn} no createdAt date`);
|
||||
continue;
|
||||
}
|
||||
perResultCallback(taskElement, element);
|
||||
if (perResultCallback) await perResultCallback(taskElement, element);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue