in java/com/google/cloud/deploymentmanager/autogen/SoyFunctions.java [595:633]
public static String apply(BooleanExpression spec, SoyValue tiersList,
SoyFunctions.TierPrefixed tierPrefixedFunction,
SoyFunctions.FindVmTier findVmTierFunction) {
List<String> result = new ArrayList<>();
if (spec.hasBooleanDeployInputField()) {
BooleanDeployInputField field = spec.getBooleanDeployInputField();
String fieldName = DeployInputFieldName.formatFieldName(field.getName());
String propertyExpression = String.format("properties().%s", fieldName);
if (field.getNegated()) {
propertyExpression = "!" + propertyExpression;
}
result.add(propertyExpression);
}
if (spec.hasHasExternalIp()) {
ExternalIpAvailability externalIp = spec.getHasExternalIp();
String noneType = Type.NONE.name();
SoyValue tierName = StringData.forValue(externalIp.getTier());
SoyValue tierSpec = NullData.INSTANCE;
if (!externalIp.getTier().isEmpty()) {
tierSpec = findVmTierFunction.computeForJava(ImmutableList.of(tierName, tiersList));
}
String externalIpProperty = tierPrefixedFunction
.computeForJava(ImmutableList.of(StringData.forValue("externalIP"), tierSpec))
.stringValue();
if (externalIp.getNegated()) {
result.add(String.format("properties().%s == \"%s\"", externalIpProperty, noneType));
} else {
result.add(String.format("properties().%s != \"%s\"", externalIpProperty, noneType));
}
}
if (result.isEmpty()) {
throw new IllegalArgumentException("No property or hasExternalIP was set.");
}
return String.join(String.format(" %s ", AND), result);
}