-
Notifications
You must be signed in to change notification settings - Fork 59
Open
Description
The ExpressionEvaluationDetails class (https://github.com/Azure/autorest-clientruntime-for-java/blob/a869a9a68d5730e76a469bbe10d0e83b1a5532e3/azure-client-runtime/src/main/java/com/microsoft/azure/ExpressionEvaluationDetails.java) defines targetValue as List<String> but when calling
we see response bodies where targetValue is a String, which causes deserialization failures.
Please fix the class to cover such response bodies.
Example exception:
com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance of `java.util.ArrayList<java.lang.Object>` out of VALUE_STRING token
at [Source: (String)"{"policyDefinitionDisplayName":"Require a tag on resource groups","evaluationDetails":{"evaluatedExpressions":[{"result":"True","expressionKind":"Field","expression":"type","path":"type","expressionValue":"Microsoft.Resources/subscriptions/resourcegroups","targetValue":"Microsoft.Resources/subscriptions/resourceGroups","operator":"Equals"},{"result":"True","expressionKind":"Field","expression":"tags[Owner]","path":"tags[Owner]","targetValue":"false","operator":"Exists"}]},"policyDefinitionId":"/"[truncated 533 chars]; line: 1, column: 271] (through reference chain: com.microsoft.azure.CloudError["additionalInfo"]->java.util.ArrayList[0]->com.microsoft.azure.PolicyViolationErrorInfo["evaluationDetails"]->com.microsoft.azure.EvaluationDetails["evaluatedExpressions"]->java.util.ArrayList[0]->com.microsoft.azure.ExpressionEvaluationDetails["targetValue"])
at rx.exceptions.Exceptions.propagate(Exceptions.java:57) ~[rxjava-1.3.8.jar:1.3.8]
at rx.observables.BlockingObservable.blockForSingle(BlockingObservable.java:463) ~[rxjava-1.3.8.jar:1.3.8]
at rx.observables.BlockingObservable.single(BlockingObservable.java:340) ~[rxjava-1.3.8.jar:1.3.8]
at com.microsoft.azure.management.resources.fluentcore.model.implementation.CreatableUpdatableImpl.create(CreatableUpdatableImpl.java:252) ~[azure-mgmt-resources-1.41.2.jar:1.41.2]
at com.microsoft.azure.management.resources.fluentcore.model.implementation.CreatableUpdatableImpl.create(CreatableUpdatableImpl.java:34) ~[azure-mgmt-resources-1.41.2.jar:1.41.2]
...
Example response body:
{
"error": {
"code": "RequestDisallowedByPolicy",
"target": "myresourcegroup",
"message": "Resource 'myresourcegroup' was disallowed by policy. Policy identifiers: '[{\"policyAssignment\":{\"name\":\"Require Owner tag on resource groups\",\"id\":\"/subscriptions/aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa/providers/Microsoft.Authorization/policyAssignments/cccccccccccccccccccccccc\"},\"policyDefinition\":{\"name\":\"Require a tag on resource groups\",\"id\":\"/providers/Microsoft.Authorization/policyDefinitions/bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb\"}}]'.",
"additionalInfo": [
{
"type": "PolicyViolation",
"info": {
"policyDefinitionDisplayName": "Require a tag on resource groups",
"evaluationDetails": {
"evaluatedExpressions": [
{
"result": "True",
"expressionKind": "Field",
"expression": "type",
"path": "type",
"expressionValue": "Microsoft.Resources/subscriptions/resourcegroups",
"targetValue": "Microsoft.Resources/subscriptions/resourceGroups",
"operator": "Equals"
},
{
"result": "True",
"expressionKind": "Field",
"expression": "tags[Owner]",
"path": "tags[Owner]",
"targetValue": "false",
"operator": "Exists"
}
]
},
"policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb",
"policyDefinitionName": "bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb",
"policyDefinitionEffect": "deny",
"policyAssignmentId": "/subscriptions/aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa/providers/Microsoft.Authorization/policyAssignments/cccccccccccccccccccccccc",
"policyAssignmentName": "cccccccccccccccccccccccc",
"policyAssignmentDisplayName": "Require Owner tag on resource groups",
"policyAssignmentScope": "/subscriptions/aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa"
}
}
]
}
}
Metadata
Metadata
Assignees
Labels
No labels