in agent/agent-tooling/src/main/java/com/microsoft/applicationinsights/agent/internal/configuration/Configuration.java [968:1080]
public void validate() {
if (key == null) {
throw new FriendlyException(
"An attribute processor configuration has an action section that is missing a \"key\".",
"Please provide a \"key\" under the action section of the attribute processor configuration. "
+ "Learn more about attribute processors here: https://go.microsoft.com/fwlink/?linkid=2151557");
}
if (action == null) {
throw new FriendlyException(
"An attribute processor configuration has an action section that is missing an \"action\".",
"Please provide an \"action\" under the action section of the attribute processor configuration. "
+ "Learn more about attribute processors here: https://go.microsoft.com/fwlink/?linkid=2151557");
}
if (action == ProcessorActionType.INSERT || action == ProcessorActionType.UPDATE) {
if (isEmpty(value) && fromAttribute == null) {
throw new FriendlyException(
"An attribute processor configuration has an "
+ action
+ " action that is missing a \"value\" or a \"fromAttribute\".",
"Please provide exactly one of \"value\" or \"fromAttributes\" under the "
+ action
+ " action. "
+ "Learn more about attribute processors here: https://go.microsoft.com/fwlink/?linkid=2151557");
}
if (!isEmpty(value) && fromAttribute != null) {
throw new FriendlyException(
"An attribute processor configuration has an "
+ action
+ " action that has both a \"value\" and a \"fromAttribute\".",
"Please provide exactly one of \"value\" or \"fromAttributes\" under the "
+ action
+ " action. "
+ "Learn more about attribute processors here: https://go.microsoft.com/fwlink/?linkid=2151557");
}
if (extractAttribute != null) {
throw new FriendlyException(
"An attribute processor configuration has an "
+ action
+ " action with an \"pattern\" section.",
"Please do not provide an \"pattern\" under the "
+ action
+ " action. "
+ "Learn more about attribute processors here: https://go.microsoft.com/fwlink/?linkid=2151557");
}
if (maskAttribute != null) {
throw new FriendlyException(
"An attribute processor configuration has an "
+ action
+ " action with an \"replace\" section.",
"Please do not provide an \"replace\" under the "
+ action
+ " action. "
+ "Learn more about attribute processors here: https://go.microsoft.com/fwlink/?linkid=2151557");
}
}
if (action == ProcessorActionType.EXTRACT) {
if (extractAttribute == null) {
throw new FriendlyException(
"An attribute processor configuration has an extract action that is missing an \"pattern\" section.",
"Please provide an \"pattern\" section under the extract action. "
+ "Learn more about attribute processors here: https://go.microsoft.com/fwlink/?linkid=2151557");
}
if (!isEmpty(value)) {
throw new FriendlyException(
"An attribute processor configuration has an " + action + " action with a \"value\".",
"Please do not provide a \"value\" under the "
+ action
+ " action. "
+ "Learn more about attribute processors here: https://go.microsoft.com/fwlink/?linkid=2151557");
}
if (fromAttribute != null) {
throw new FriendlyException(
"An attribute processor configuration has an "
+ action
+ " action with a \"fromAttribute\".",
"Please do not provide a \"fromAttribute\" under the "
+ action
+ " action. "
+ "Learn more about attribute processors here: https://go.microsoft.com/fwlink/?linkid=2151557");
}
extractAttribute.validate();
}
if (action == ProcessorActionType.MASK) {
if (maskAttribute == null) {
throw new FriendlyException(
"An attribute processor configuration has an mask action that is missing an \"pattern\" or \"replace\" section.",
"Please provide an \"pattern\" section and \"replace\" section under the mask action. "
+ "Learn more about attribute processors here: https://go.microsoft.com/fwlink/?linkid=2151557");
}
if (!isEmpty(value)) {
throw new FriendlyException(
"An attribute processor configuration has an " + action + " action with a \"value\".",
"Please do not provide a \"value\" under the "
+ action
+ " action. "
+ "Learn more about attribute processors here: https://go.microsoft.com/fwlink/?linkid=2151557");
}
if (fromAttribute != null) {
throw new FriendlyException(
"An attribute processor configuration has an "
+ action
+ " action with a \"fromAttribute\".",
"Please do not provide a \"fromAttribute\" under the "
+ action
+ " action. "
+ "Learn more about attribute processors here: https://go.microsoft.com/fwlink/?linkid=2151557");
}
maskAttribute.validate();
}
}