public class TaskEnvCannotChange extends java.lang.Object implements ConfigValidator<ServiceSpec>
| Modifier and Type | Class and Description |
|---|---|
static class |
TaskEnvCannotChange.Rule
Variances to how enforcement should be performed.
|
| Constructor and Description |
|---|
TaskEnvCannotChange(java.lang.String podType,
java.lang.String taskName,
java.lang.String envName,
TaskEnvCannotChange.Rule... rules)
Creates a new validator restricting changes to an environment value.
|
| Modifier and Type | Method and Description |
|---|---|
java.util.Collection<ConfigValidationError> |
validate(java.util.Optional<ServiceSpec> oldConfig,
ServiceSpec newConfig)
Returns
List of ConfigurationValidationErrors for the newly supplied
Configuration object. |
public TaskEnvCannotChange(java.lang.String podType,
java.lang.String taskName,
java.lang.String envName,
TaskEnvCannotChange.Rule... rules)
podType - The type of the pod to enforce (see PodSpec.getType())taskName - The name of the task to enforce (see TaskSpec.getName())envName - The environment variable to restrict within the above pod/taskrules - A list of any allowances to be made in the enforcementpublic java.util.Collection<ConfigValidationError> validate(java.util.Optional<ServiceSpec> oldConfig, ServiceSpec newConfig)
ConfigValidatorList of ConfigurationValidationErrors for the newly supplied
Configuration object.
A validation can validate a newConfig in following ways:
1. Validate newConfig parameters against the oldConfig paramater.
Ex: If DiskType was ROOT in oldConfig, then it cannot be changed to, ex: MOUNT, in the newConfig.
2. Validate just newConfig parameter(s). Ex: CPU value > 0validate in interface ConfigValidator<ServiceSpec>oldConfig - Currently persisted Configuration, or an empty Optional if none is available
(first launch of service)newConfig - Proposed new Configuration