Search in sources :

Example 1 with NoGeneratedAMIRule

use of com.netflix.simianarmy.aws.janitor.rule.snapshot.NoGeneratedAMIRule in project SimianArmy by Netflix.

the class BasicJanitorMonkeyContext method getEBSSnapshotJanitor.

private EBSSnapshotJanitor getEBSSnapshotJanitor() {
    JanitorRuleEngine ruleEngine = createJanitorRuleEngine();
    if (configuration().getBoolOrElse("simianarmy.janitor.rule.noGeneratedAMIRule.enabled", false)) {
        ruleEngine.addRule(new NoGeneratedAMIRule(monkeyCalendar, (int) configuration().getNumOrElse("simianarmy.janitor.rule.noGeneratedAMIRule.ageThreshold", 30), (int) configuration().getNumOrElse("simianarmy.janitor.rule.noGeneratedAMIRule.retentionDays", 7), configuration().getStrOrElse("simianarmy.janitor.rule.noGeneratedAMIRule.ownerEmail", null)));
    }
    if (configuration().getBoolOrElse("simianarmy.janitor.rule.untaggedRule.enabled", false) && getUntaggedRuleResourceSet().contains("EBS_SNAPSHOT")) {
        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 snapshotCrawler;
    if (configuration().getBoolOrElse("simianarmy.janitor.edda.enabled", false)) {
        snapshotCrawler = new EddaEBSSnapshotJanitorCrawler(configuration().getStr("simianarmy.janitor.snapshots.ownerId"), createEddaClient(), awsClient().region());
    } else {
        snapshotCrawler = new EBSSnapshotJanitorCrawler(awsClient());
    }
    BasicJanitorContext snapshotJanitorCtx = new BasicJanitorContext(monkeyRegion, ruleEngine, snapshotCrawler, janitorResourceTracker, monkeyCalendar, configuration(), recorder());
    return new EBSSnapshotJanitor(awsClient(), snapshotJanitorCtx);
}
Also used : UntaggedRule(com.netflix.simianarmy.aws.janitor.rule.generic.UntaggedRule) NoGeneratedAMIRule(com.netflix.simianarmy.aws.janitor.rule.snapshot.NoGeneratedAMIRule)

Aggregations

UntaggedRule (com.netflix.simianarmy.aws.janitor.rule.generic.UntaggedRule)1 NoGeneratedAMIRule (com.netflix.simianarmy.aws.janitor.rule.snapshot.NoGeneratedAMIRule)1