Search in sources :

Example 1 with OldUnusedLaunchConfigRule

use of com.netflix.simianarmy.aws.janitor.rule.launchconfig.OldUnusedLaunchConfigRule in project SimianArmy by Netflix.

the class BasicJanitorMonkeyContext method getLaunchConfigJanitor.

private LaunchConfigJanitor getLaunchConfigJanitor() {
    JanitorRuleEngine ruleEngine = createJanitorRuleEngine();
    if (configuration().getBoolOrElse("simianarmy.janitor.rule.oldUnusedLaunchConfigRule.enabled", false)) {
        ruleEngine.addRule(new OldUnusedLaunchConfigRule(monkeyCalendar, (int) configuration().getNumOrElse("simianarmy.janitor.rule.oldUnusedLaunchConfigRule.ageThreshold", 4), (int) configuration().getNumOrElse("simianarmy.janitor.rule.oldUnusedLaunchConfigRule.retentionDays", 3)));
    }
    if (configuration().getBoolOrElse("simianarmy.janitor.rule.untaggedRule.enabled", false) && getUntaggedRuleResourceSet().contains("LAUNCH_CONFIG")) {
        ruleEngine.addRule(new UntaggedRule(monkeyCalendar, getPropertySet("simianarmy.janitor.rule.untaggedRule.requiredTags"), (int) configuration().getNumOrElse("simianarmy.janitor.rule.untaggedRule.retentionDaysWithOwner", 3), (int) configuration().getNumOrElse("simianarmy.janitor.rule.untaggedRule.retentionDaysWithoutOwner", 8)));
    }
    JanitorCrawler crawler;
    if (configuration().getBoolOrElse("simianarmy.janitor.edda.enabled", false)) {
        crawler = new EddaLaunchConfigJanitorCrawler(createEddaClient(), awsClient().region());
    } else {
        crawler = new LaunchConfigJanitorCrawler(awsClient());
    }
    BasicJanitorContext janitorCtx = new BasicJanitorContext(monkeyRegion, ruleEngine, crawler, janitorResourceTracker, monkeyCalendar, configuration(), recorder());
    return new LaunchConfigJanitor(awsClient(), janitorCtx);
}
Also used : UntaggedRule(com.netflix.simianarmy.aws.janitor.rule.generic.UntaggedRule) OldUnusedLaunchConfigRule(com.netflix.simianarmy.aws.janitor.rule.launchconfig.OldUnusedLaunchConfigRule)

Aggregations

UntaggedRule (com.netflix.simianarmy.aws.janitor.rule.generic.UntaggedRule)1 OldUnusedLaunchConfigRule (com.netflix.simianarmy.aws.janitor.rule.launchconfig.OldUnusedLaunchConfigRule)1