use of com.netflix.simianarmy.aws.janitor.rule.volume.DeleteOnTerminationRule in project SimianArmy by Netflix.
the class BasicJanitorMonkeyContext method getEBSVolumeJanitor.
private EBSVolumeJanitor getEBSVolumeJanitor() {
JanitorRuleEngine ruleEngine = createJanitorRuleEngine();
if (configuration().getBoolOrElse("simianarmy.janitor.rule.oldDetachedVolumeRule.enabled", false)) {
ruleEngine.addRule(new OldDetachedVolumeRule(monkeyCalendar, (int) configuration().getNumOrElse("simianarmy.janitor.rule.oldDetachedVolumeRule.detachDaysThreshold", 30), (int) configuration().getNumOrElse("simianarmy.janitor.rule.oldDetachedVolumeRule.retentionDays", 7)));
if (configuration().getBoolOrElse("simianarmy.janitor.edda.enabled", false) && configuration().getBoolOrElse("simianarmy.janitor.rule.deleteOnTerminationRule.enabled", false)) {
ruleEngine.addRule(new DeleteOnTerminationRule(monkeyCalendar, (int) configuration().getNumOrElse("simianarmy.janitor.rule.deleteOnTerminationRule.retentionDays", 3)));
}
}
if (configuration().getBoolOrElse("simianarmy.janitor.rule.untaggedRule.enabled", false) && getUntaggedRuleResourceSet().contains("EBS_VOLUME")) {
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 volumeCrawler;
if (configuration().getBoolOrElse("simianarmy.janitor.edda.enabled", false)) {
volumeCrawler = new EddaEBSVolumeJanitorCrawler(createEddaClient(), awsClient().region());
} else {
volumeCrawler = new EBSVolumeJanitorCrawler(awsClient());
}
BasicJanitorContext volumeJanitorCtx = new BasicJanitorContext(monkeyRegion, ruleEngine, volumeCrawler, janitorResourceTracker, monkeyCalendar, configuration(), recorder());
return new EBSVolumeJanitor(awsClient(), volumeJanitorCtx);
}
Aggregations