Skip to content
This repository was archived by the owner on Jun 15, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
*/

package com.microsoft.azure;

import java.util.List;

public class EvaluationDetails {

private List<ExpressionEvaluationDetails> evaluatedExpressions;

public List<ExpressionEvaluationDetails> getEvaluatedExpressions() {
return evaluatedExpressions;
}

@Override
public String toString() {
return "EvaluationDetails{"
+ "evaluatedExpressions=" + evaluatedExpressions
+ '}';
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
*/

package com.microsoft.azure;

import java.util.List;

public class ExpressionEvaluationDetails {

private String expression;

private String expressionValue;

private String operator;

private String path;

private String result;

private List<String> targetValue;

public String getExpression() {
return expression;
}

public String getExpressionValue() {
return expressionValue;
}

public String getOperator() {
return operator;
}

public String getPath() {
return path;
}

public String getResult() {
return result;
}

public List<String> getTargetValue() {
return targetValue;
}

@Override
public String toString() {
return "ExpressionEvaluationDetails{"
+ "expression='" + expression + '\''
+ ", expressionValue='" + expressionValue + '\''
+ ", operator='" + operator + '\''
+ ", path='" + path + '\''
+ ", result='" + result + '\''
+ ", targetValue=" + targetValue
+ '}';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import java.io.IOException;

import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.MapperFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
Expand All @@ -22,22 +23,24 @@ public class PolicyViolation extends TypedErrorInfo {
* Policy violation error details.
*/
private PolicyViolationErrorInfo policyErrorInfo;

/**
* Initializes a new instance of PolicyViolation.
* @param type the error type
*
* @param type the error type
* @param policyErrorInfo the error details
* @throws JsonParseException if the policyErrorInfo has invalid content.
* @throws JsonMappingException if the policyErrorInfo's JSON does not match the expected schema.
* @throws IOException if an IO error occurs.
* @throws JsonParseException if the policyErrorInfo has invalid content.
* @throws JsonMappingException if the policyErrorInfo's JSON does not match the expected schema.
* @throws IOException if an IO error occurs.
*/
public PolicyViolation(String type, ObjectNode policyErrorInfo) throws JsonParseException, JsonMappingException, IOException {
super(type, policyErrorInfo);
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.configure(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES, true);
ObjectMapper objectMapper = new ObjectMapper()
.configure(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES, true)
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
this.policyErrorInfo = objectMapper.readValue(policyErrorInfo.toString(), PolicyViolationErrorInfo.class);
}

/**
* @return the policy violation error details.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@ public class PolicyViolationErrorInfo {
* The policy set definition display name.
*/
private String policySetDefinitionDisplayName;


private EvaluationDetails evaluationDetails;

/**
* @return the policy definition id.
*/
Expand Down Expand Up @@ -170,17 +172,48 @@ public String getPolicySetDefinitionDisplayName() {
return policySetDefinitionDisplayName;
}

public EvaluationDetails getEvaluationDetails() {
return evaluationDetails;
}

@Override
public String toString() {
return "PolicyViolationErrorInfo{"
+ "policyDefinitionId='" + policyDefinitionId + '\''
+ ", policySetDefinitionId='" + policySetDefinitionId + '\''
+ ", policyDefinitionReferenceId='" + policyDefinitionReferenceId + '\''
+ ", policySetDefinitionName='" + policySetDefinitionName + '\''
+ ", policyDefinitionName='" + policyDefinitionName + '\''
+ ", policyDefinitionEffect='" + policyDefinitionEffect + '\''
+ ", policyAssignmentId='" + policyAssignmentId + '\''
+ ", policyAssignmentName='" + policyAssignmentName + '\''
+ ", policyAssignmentDisplayName='" + policyAssignmentDisplayName + '\''
+ ", policyAssignmentScope='" + policyAssignmentScope + '\''
+ ", policyAssignmentParameters=" + policyAssignmentParameters
+ ", policyDefinitionDisplayName='" + policyDefinitionDisplayName + '\''
+ ", policySetDefinitionDisplayName='" + policySetDefinitionDisplayName + '\''
+ ", evaluationDetails=" + evaluationDetails
+ '}';
}

/**
* An instance of this class provides policy parameter value.
*/
public static class PolicyParameter {
private JsonNode value;

/**
* @return the parameter value.
*/
public JsonNode getValue() {
return value;
}

@Override
public String toString() {
return "PolicyParameter{"
+ "value=" + value
+ '}';
}
}
}
Loading