cleanup cli
parent
3fa703512c
commit
b5bb9fc421
|
|
@ -2466,12 +2466,6 @@ exports["default"] = AWSBuildEnvironment;
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
||||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
||||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
||||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
||||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
||||||
};
|
|
||||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||||
return new (P || (P = Promise))(function (resolve, reject) {
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
|
|
@ -2487,27 +2481,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
exports.GarbageCollectionService = void 0;
|
exports.GarbageCollectionService = void 0;
|
||||||
const aws_sdk_1 = __importDefault(__nccwpck_require__(71786));
|
const aws_sdk_1 = __importDefault(__nccwpck_require__(71786));
|
||||||
const cli_functions_repository_1 = __nccwpck_require__(85301);
|
|
||||||
const input_1 = __importDefault(__nccwpck_require__(91933));
|
const input_1 = __importDefault(__nccwpck_require__(91933));
|
||||||
const cloud_runner_logger_1 = __importDefault(__nccwpck_require__(22855));
|
const cloud_runner_logger_1 = __importDefault(__nccwpck_require__(22855));
|
||||||
const task_service_1 = __nccwpck_require__(67205);
|
const task_service_1 = __nccwpck_require__(67205);
|
||||||
const tertiary_resources_service_1 = __nccwpck_require__(61627);
|
const tertiary_resources_service_1 = __nccwpck_require__(61627);
|
||||||
class GarbageCollectionService {
|
class GarbageCollectionService {
|
||||||
static garbageCollectAws() {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
yield GarbageCollectionService.cleanup(false);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
static garbageCollectAwsAll() {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
yield GarbageCollectionService.cleanup(true);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
static garbageCollectAwsAllOlderThanOneDay() {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
yield GarbageCollectionService.cleanup(true, true);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
static isOlderThan1day(date) {
|
static isOlderThan1day(date) {
|
||||||
const ageDate = new Date(date.getTime() - Date.now());
|
const ageDate = new Date(date.getTime() - Date.now());
|
||||||
return ageDate.getDay() > 0;
|
return ageDate.getDay() > 0;
|
||||||
|
|
@ -2553,15 +2531,6 @@ class GarbageCollectionService {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
__decorate([
|
|
||||||
cli_functions_repository_1.CliFunction(`aws-garbage-collect-list`, `garbage collect aws resources not in use !WIP!`)
|
|
||||||
], GarbageCollectionService, "garbageCollectAws", null);
|
|
||||||
__decorate([
|
|
||||||
cli_functions_repository_1.CliFunction(`aws-garbage-collect-all`, `garbage collect aws resources regardless of whether they are in use`)
|
|
||||||
], GarbageCollectionService, "garbageCollectAwsAll", null);
|
|
||||||
__decorate([
|
|
||||||
cli_functions_repository_1.CliFunction(`aws-garbage-collect-all-1d-older`, `garbage collect aws resources created more than 1d ago (ignore if they are in use)`)
|
|
||||||
], GarbageCollectionService, "garbageCollectAwsAllOlderThanOneDay", null);
|
|
||||||
exports.GarbageCollectionService = GarbageCollectionService;
|
exports.GarbageCollectionService = GarbageCollectionService;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -1,26 +1,10 @@
|
||||||
import AWS from 'aws-sdk';
|
import AWS from 'aws-sdk';
|
||||||
import { CliFunction } from '../../../../cli/cli-functions-repository';
|
|
||||||
import Input from '../../../../input';
|
import Input from '../../../../input';
|
||||||
import CloudRunnerLogger from '../../../services/cloud-runner-logger';
|
import CloudRunnerLogger from '../../../services/cloud-runner-logger';
|
||||||
import { TaskService } from './task-service';
|
import { TaskService } from './task-service';
|
||||||
import { TertiaryResourcesService } from './tertiary-resources-service';
|
import { TertiaryResourcesService } from './tertiary-resources-service';
|
||||||
|
|
||||||
export class GarbageCollectionService {
|
export class GarbageCollectionService {
|
||||||
@CliFunction(`aws-garbage-collect-list`, `garbage collect aws resources not in use !WIP!`)
|
|
||||||
static async garbageCollectAws() {
|
|
||||||
await GarbageCollectionService.cleanup(false);
|
|
||||||
}
|
|
||||||
@CliFunction(`aws-garbage-collect-all`, `garbage collect aws resources regardless of whether they are in use`)
|
|
||||||
static async garbageCollectAwsAll() {
|
|
||||||
await GarbageCollectionService.cleanup(true);
|
|
||||||
}
|
|
||||||
@CliFunction(
|
|
||||||
`aws-garbage-collect-all-1d-older`,
|
|
||||||
`garbage collect aws resources created more than 1d ago (ignore if they are in use)`,
|
|
||||||
)
|
|
||||||
static async garbageCollectAwsAllOlderThanOneDay() {
|
|
||||||
await GarbageCollectionService.cleanup(true, true);
|
|
||||||
}
|
|
||||||
static isOlderThan1day(date: any) {
|
static isOlderThan1day(date: any) {
|
||||||
const ageDate = new Date(date.getTime() - Date.now());
|
const ageDate = new Date(date.getTime() - Date.now());
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue