All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.azure.resourcemanager.policyinsights.models.ComponentExpressionEvaluationDetails Maven / Gradle / Ivy

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.policyinsights.models;

import com.azure.core.annotation.Fluent;
import com.azure.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;

/**
 * Evaluation details of policy language expressions.
 */
@Fluent
public final class ComponentExpressionEvaluationDetails
    implements JsonSerializable {
    /*
     * Evaluation result.
     */
    private String result;

    /*
     * Expression evaluated.
     */
    private String expression;

    /*
     * The kind of expression that was evaluated.
     */
    private String expressionKind;

    /*
     * Property path if the expression is a field or an alias.
     */
    private String path;

    /*
     * Value of the expression.
     */
    private Object expressionValue;

    /*
     * Target value to be compared with the expression value.
     */
    private Object targetValue;

    /*
     * Operator to compare the expression value and the target value.
     */
    private String operator;

    /**
     * Creates an instance of ComponentExpressionEvaluationDetails class.
     */
    public ComponentExpressionEvaluationDetails() {
    }

    /**
     * Get the result property: Evaluation result.
     * 
     * @return the result value.
     */
    public String result() {
        return this.result;
    }

    /**
     * Set the result property: Evaluation result.
     * 
     * @param result the result value to set.
     * @return the ComponentExpressionEvaluationDetails object itself.
     */
    public ComponentExpressionEvaluationDetails withResult(String result) {
        this.result = result;
        return this;
    }

    /**
     * Get the expression property: Expression evaluated.
     * 
     * @return the expression value.
     */
    public String expression() {
        return this.expression;
    }

    /**
     * Get the expressionKind property: The kind of expression that was evaluated.
     * 
     * @return the expressionKind value.
     */
    public String expressionKind() {
        return this.expressionKind;
    }

    /**
     * Get the path property: Property path if the expression is a field or an alias.
     * 
     * @return the path value.
     */
    public String path() {
        return this.path;
    }

    /**
     * Get the expressionValue property: Value of the expression.
     * 
     * @return the expressionValue value.
     */
    public Object expressionValue() {
        return this.expressionValue;
    }

    /**
     * Get the targetValue property: Target value to be compared with the expression value.
     * 
     * @return the targetValue value.
     */
    public Object targetValue() {
        return this.targetValue;
    }

    /**
     * Get the operator property: Operator to compare the expression value and the target value.
     * 
     * @return the operator value.
     */
    public String operator() {
        return this.operator;
    }

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("result", this.result);
        return jsonWriter.writeEndObject();
    }

    /**
     * Reads an instance of ComponentExpressionEvaluationDetails from the JsonReader.
     * 
     * @param jsonReader The JsonReader being read.
     * @return An instance of ComponentExpressionEvaluationDetails if the JsonReader was pointing to an instance of it,
     * or null if it was pointing to JSON null.
     * @throws IOException If an error occurs while reading the ComponentExpressionEvaluationDetails.
     */
    public static ComponentExpressionEvaluationDetails fromJson(JsonReader jsonReader) throws IOException {
        return jsonReader.readObject(reader -> {
            ComponentExpressionEvaluationDetails deserializedComponentExpressionEvaluationDetails
                = new ComponentExpressionEvaluationDetails();
            while (reader.nextToken() != JsonToken.END_OBJECT) {
                String fieldName = reader.getFieldName();
                reader.nextToken();

                if ("result".equals(fieldName)) {
                    deserializedComponentExpressionEvaluationDetails.result = reader.getString();
                } else if ("expression".equals(fieldName)) {
                    deserializedComponentExpressionEvaluationDetails.expression = reader.getString();
                } else if ("expressionKind".equals(fieldName)) {
                    deserializedComponentExpressionEvaluationDetails.expressionKind = reader.getString();
                } else if ("path".equals(fieldName)) {
                    deserializedComponentExpressionEvaluationDetails.path = reader.getString();
                } else if ("expressionValue".equals(fieldName)) {
                    deserializedComponentExpressionEvaluationDetails.expressionValue = reader.readUntyped();
                } else if ("targetValue".equals(fieldName)) {
                    deserializedComponentExpressionEvaluationDetails.targetValue = reader.readUntyped();
                } else if ("operator".equals(fieldName)) {
                    deserializedComponentExpressionEvaluationDetails.operator = reader.getString();
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedComponentExpressionEvaluationDetails;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy