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

com.azure.resourcemanager.securityinsights.models.InsightQueryItemPropertiesTableQuery Maven / Gradle / Ivy

Go to download

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

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.securityinsights.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;

/**
 * The insight table query.
 */
@Fluent
public final class InsightQueryItemPropertiesTableQuery
    implements JsonSerializable {
    /*
     * List of insight column definitions.
     */
    private List columnsDefinitions;

    /*
     * List of insight queries definitions.
     */
    private List queriesDefinitions;

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

    /**
     * Get the columnsDefinitions property: List of insight column definitions.
     * 
     * @return the columnsDefinitions value.
     */
    public List columnsDefinitions() {
        return this.columnsDefinitions;
    }

    /**
     * Set the columnsDefinitions property: List of insight column definitions.
     * 
     * @param columnsDefinitions the columnsDefinitions value to set.
     * @return the InsightQueryItemPropertiesTableQuery object itself.
     */
    public InsightQueryItemPropertiesTableQuery
        withColumnsDefinitions(List columnsDefinitions) {
        this.columnsDefinitions = columnsDefinitions;
        return this;
    }

    /**
     * Get the queriesDefinitions property: List of insight queries definitions.
     * 
     * @return the queriesDefinitions value.
     */
    public List queriesDefinitions() {
        return this.queriesDefinitions;
    }

    /**
     * Set the queriesDefinitions property: List of insight queries definitions.
     * 
     * @param queriesDefinitions the queriesDefinitions value to set.
     * @return the InsightQueryItemPropertiesTableQuery object itself.
     */
    public InsightQueryItemPropertiesTableQuery
        withQueriesDefinitions(List queriesDefinitions) {
        this.queriesDefinitions = queriesDefinitions;
        return this;
    }

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

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

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

                if ("columnsDefinitions".equals(fieldName)) {
                    List columnsDefinitions
                        = reader.readArray(
                            reader1 -> InsightQueryItemPropertiesTableQueryColumnsDefinitionsItem.fromJson(reader1));
                    deserializedInsightQueryItemPropertiesTableQuery.columnsDefinitions = columnsDefinitions;
                } else if ("queriesDefinitions".equals(fieldName)) {
                    List queriesDefinitions
                        = reader.readArray(
                            reader1 -> InsightQueryItemPropertiesTableQueryQueriesDefinitionsItem.fromJson(reader1));
                    deserializedInsightQueryItemPropertiesTableQuery.queriesDefinitions = queriesDefinitions;
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedInsightQueryItemPropertiesTableQuery;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy