/** Throws a ValidationException unless this validation is overridden at this time */ public void invalid(ValidationId validationId, String message, Instant now) { if ( ! allows(validationId, now)) throw new ValidationException(validationId, message); }
/** Parse a time window from the given day, hour and time zone specification */ public static TimeWindow from(String daySpec, String hourSpec, String zoneSpec) { List<DayOfWeek> days = parse(daySpec, TimeWindow::parseDays); List<Integer> hours = parse(hourSpec, TimeWindow::parseHours); ZoneId zone = zoneFrom(zoneSpec); return new TimeWindow(days, hours, zone); }
/** Returns whether this deployment spec specifies the given zone, either implicitly or explicitly */ public boolean includes(Environment environment, Optional<RegionName> region) { for (Step step : steps) if (step.deploysTo(environment, region)) return true; return false; }
/** Same as getFiles(pathFromRoot, suffix, false) */ default List<NamedReader> getFiles(Path pathFromRoot, String suffix) { return getFiles(pathFromRoot,suffix,false); }
/** Returns whether upgrade can occur at the given instant */ public boolean canUpgradeAt(Instant instant) { return changeBlockers.stream().filter(block -> block.blocksVersions()) .noneMatch(block -> block.window().includes(instant)); }
/** Returns whether an application revision change can occur at the given instant */ public boolean canChangeRevisionAt(Instant instant) { return changeBlockers.stream().filter(block -> block.blocksRevisions()) .noneMatch(block -> block.window().includes(instant)); }
@Override public boolean skipOldConfigModels(Instant now) { return validationOverrides.allows(ValidationId.skipOldConfigModels, now); }
/** Returns the host which is the source of the files */ public String fileSourceHost() { return fileRegistry.fileSourceHost(); }
/** * Creates a deployment spec from XML. * * @throws IllegalArgumentException if the XML is invalid */ public static DeploymentSpec fromXml(String xmlForm) { return fromXml(xmlForm, true); }
/** * List the files under this directory. If this is file, an empty list is returned. * Only immediate files/subdirectories are returned. * * @return a list of files in this directory. */ public List<ApplicationFile> listFiles() { return listFiles(defaultFilter); }
public String getApplicationName() { return metaData.getApplicationName(); }
@Override public void log(Level level, String message) { deployLogger.log(level, message); }
/** Throw an IllegalArgumentException if any production zone is declared multiple times */ private void validateZones(List<Step> steps) { Set<DeclaredZone> zones = new HashSet<>(); for (Step step : steps) for (DeclaredZone zone : step.zones()) ensureUnique(zone, zones); }
private void validate(int currentSize, int nextSize, String clusterName, ValidationOverrides overrides, Instant now) { // don't allow more than 50% reduction, but always allow to reduce size with 1 if ( nextSize < ((double)currentSize) * 0.5 && nextSize != currentSize - 1) overrides.invalid(ValidationId.clusterSizeReduction, "Size reduction in '" + clusterName + "' is too large. Current size: " + currentSize + ", new size: " + nextSize + ". New size must be at least 50% of the current size", now); }
/** * Returns the content of a ranking expression file */ public Reader getRankingExpression(String fileName) { return applicationPackage.getRankingExpression(fileName); }
/** Does {@link #getFiles} on the query profile directory and gets all xml files */ default List<NamedReader> getQueryProfileFiles() { return getFiles(QUERY_PROFILES_DIR,".xml"); }
/** Does {@link #getFiles} on the page template directory and gets all xml files */ default List<NamedReader> getPageTemplateFiles() { return getFiles(PAGE_TEMPLATES_DIR,".xml"); }