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

com.azure.resourcemanager.policyinsights.models.CheckRestrictionsResultContentEvaluationResult 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;
import java.util.List;

/**
 * Evaluation results for the provided partial resource content.
 */
@Fluent
public final class CheckRestrictionsResultContentEvaluationResult
    implements JsonSerializable {
    /*
     * Policy evaluation results against the given resource content. This will indicate if the partial content that was
     * provided will be denied as-is.
     */
    private List policyEvaluations;

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

    /**
     * Get the policyEvaluations property: Policy evaluation results against the given resource content. This will
     * indicate if the partial content that was provided will be denied as-is.
     * 
     * @return the policyEvaluations value.
     */
    public List policyEvaluations() {
        return this.policyEvaluations;
    }

    /**
     * Set the policyEvaluations property: Policy evaluation results against the given resource content. This will
     * indicate if the partial content that was provided will be denied as-is.
     * 
     * @param policyEvaluations the policyEvaluations value to set.
     * @return the CheckRestrictionsResultContentEvaluationResult object itself.
     */
    public CheckRestrictionsResultContentEvaluationResult
        withPolicyEvaluations(List policyEvaluations) {
        this.policyEvaluations = policyEvaluations;
        return this;
    }

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (policyEvaluations() != null) {
            policyEvaluations().forEach(e -> e.validate());
        }
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeArrayField("policyEvaluations", this.policyEvaluations,
            (writer, element) -> writer.writeJson(element));
        return jsonWriter.writeEndObject();
    }

    /**
     * Reads an instance of CheckRestrictionsResultContentEvaluationResult from the JsonReader.
     * 
     * @param jsonReader The JsonReader being read.
     * @return An instance of CheckRestrictionsResultContentEvaluationResult 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 CheckRestrictionsResultContentEvaluationResult.
     */
    public static CheckRestrictionsResultContentEvaluationResult fromJson(JsonReader jsonReader) throws IOException {
        return jsonReader.readObject(reader -> {
            CheckRestrictionsResultContentEvaluationResult deserializedCheckRestrictionsResultContentEvaluationResult
                = new CheckRestrictionsResultContentEvaluationResult();
            while (reader.nextToken() != JsonToken.END_OBJECT) {
                String fieldName = reader.getFieldName();
                reader.nextToken();

                if ("policyEvaluations".equals(fieldName)) {
                    List policyEvaluations
                        = reader.readArray(reader1 -> PolicyEvaluationResult.fromJson(reader1));
                    deserializedCheckRestrictionsResultContentEvaluationResult.policyEvaluations = policyEvaluations;
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedCheckRestrictionsResultContentEvaluationResult;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy