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

com.azure.resourcemanager.security.models.RulesResultsInput Maven / Gradle / Ivy

Go to download

This package contains Microsoft Azure SDK for Security Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. API spec for Microsoft.Security (Azure Security Center) resource provider. Package tag package-composite-v3.

There is a newer version: 1.0.0
Show newest version
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.security.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;
import java.util.Map;

/**
 * Rules results input.
 */
@Fluent
public final class RulesResultsInput implements JsonSerializable {
    /*
     * Take results from latest scan.
     */
    private Boolean latestScan;

    /*
     * Expected results to be inserted into the baseline.
     * Leave this field empty it LatestScan == true.
     */
    private Map>> results;

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

    /**
     * Get the latestScan property: Take results from latest scan.
     * 
     * @return the latestScan value.
     */
    public Boolean latestScan() {
        return this.latestScan;
    }

    /**
     * Set the latestScan property: Take results from latest scan.
     * 
     * @param latestScan the latestScan value to set.
     * @return the RulesResultsInput object itself.
     */
    public RulesResultsInput withLatestScan(Boolean latestScan) {
        this.latestScan = latestScan;
        return this;
    }

    /**
     * Get the results property: Expected results to be inserted into the baseline.
     * Leave this field empty it LatestScan == true.
     * 
     * @return the results value.
     */
    public Map>> results() {
        return this.results;
    }

    /**
     * Set the results property: Expected results to be inserted into the baseline.
     * Leave this field empty it LatestScan == true.
     * 
     * @param results the results value to set.
     * @return the RulesResultsInput object itself.
     */
    public RulesResultsInput withResults(Map>> results) {
        this.results = results;
        return this;
    }

    /**
     * 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.writeBooleanField("latestScan", this.latestScan);
        jsonWriter.writeMapField("results", this.results, (writer, element) -> writer.writeArray(element,
            (writer1, element1) -> writer1.writeArray(element1, (writer2, element2) -> writer2.writeString(element2))));
        return jsonWriter.writeEndObject();
    }

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

                if ("latestScan".equals(fieldName)) {
                    deserializedRulesResultsInput.latestScan = reader.getNullable(JsonReader::getBoolean);
                } else if ("results".equals(fieldName)) {
                    Map>> results = reader.readMap(
                        reader1 -> reader1.readArray(reader2 -> reader2.readArray(reader3 -> reader3.getString())));
                    deserializedRulesResultsInput.results = results;
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedRulesResultsInput;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy