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

com.azure.resourcemanager.securityinsights.models.InsightQueryItemProperties 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.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;
import java.util.List;

/**
 * Represents Insight Query.
 */
@Fluent
public final class InsightQueryItemProperties extends EntityQueryItemProperties {
    /*
     * The insight display name.
     */
    private String displayName;

    /*
     * The insight description.
     */
    private String description;

    /*
     * The base query of the insight.
     */
    private String baseQuery;

    /*
     * The insight table query.
     */
    private InsightQueryItemPropertiesTableQuery tableQuery;

    /*
     * The insight chart query.
     */
    private Object chartQuery;

    /*
     * The activity query definitions.
     */
    private InsightQueryItemPropertiesAdditionalQuery additionalQuery;

    /*
     * The insight chart query.
     */
    private InsightQueryItemPropertiesDefaultTimeRange defaultTimeRange;

    /*
     * The insight chart query.
     */
    private InsightQueryItemPropertiesReferenceTimeRange referenceTimeRange;

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

    /**
     * Get the displayName property: The insight display name.
     * 
     * @return the displayName value.
     */
    public String displayName() {
        return this.displayName;
    }

    /**
     * Set the displayName property: The insight display name.
     * 
     * @param displayName the displayName value to set.
     * @return the InsightQueryItemProperties object itself.
     */
    public InsightQueryItemProperties withDisplayName(String displayName) {
        this.displayName = displayName;
        return this;
    }

    /**
     * Get the description property: The insight description.
     * 
     * @return the description value.
     */
    public String description() {
        return this.description;
    }

    /**
     * Set the description property: The insight description.
     * 
     * @param description the description value to set.
     * @return the InsightQueryItemProperties object itself.
     */
    public InsightQueryItemProperties withDescription(String description) {
        this.description = description;
        return this;
    }

    /**
     * Get the baseQuery property: The base query of the insight.
     * 
     * @return the baseQuery value.
     */
    public String baseQuery() {
        return this.baseQuery;
    }

    /**
     * Set the baseQuery property: The base query of the insight.
     * 
     * @param baseQuery the baseQuery value to set.
     * @return the InsightQueryItemProperties object itself.
     */
    public InsightQueryItemProperties withBaseQuery(String baseQuery) {
        this.baseQuery = baseQuery;
        return this;
    }

    /**
     * Get the tableQuery property: The insight table query.
     * 
     * @return the tableQuery value.
     */
    public InsightQueryItemPropertiesTableQuery tableQuery() {
        return this.tableQuery;
    }

    /**
     * Set the tableQuery property: The insight table query.
     * 
     * @param tableQuery the tableQuery value to set.
     * @return the InsightQueryItemProperties object itself.
     */
    public InsightQueryItemProperties withTableQuery(InsightQueryItemPropertiesTableQuery tableQuery) {
        this.tableQuery = tableQuery;
        return this;
    }

    /**
     * Get the chartQuery property: The insight chart query.
     * 
     * @return the chartQuery value.
     */
    public Object chartQuery() {
        return this.chartQuery;
    }

    /**
     * Set the chartQuery property: The insight chart query.
     * 
     * @param chartQuery the chartQuery value to set.
     * @return the InsightQueryItemProperties object itself.
     */
    public InsightQueryItemProperties withChartQuery(Object chartQuery) {
        this.chartQuery = chartQuery;
        return this;
    }

    /**
     * Get the additionalQuery property: The activity query definitions.
     * 
     * @return the additionalQuery value.
     */
    public InsightQueryItemPropertiesAdditionalQuery additionalQuery() {
        return this.additionalQuery;
    }

    /**
     * Set the additionalQuery property: The activity query definitions.
     * 
     * @param additionalQuery the additionalQuery value to set.
     * @return the InsightQueryItemProperties object itself.
     */
    public InsightQueryItemProperties withAdditionalQuery(InsightQueryItemPropertiesAdditionalQuery additionalQuery) {
        this.additionalQuery = additionalQuery;
        return this;
    }

    /**
     * Get the defaultTimeRange property: The insight chart query.
     * 
     * @return the defaultTimeRange value.
     */
    public InsightQueryItemPropertiesDefaultTimeRange defaultTimeRange() {
        return this.defaultTimeRange;
    }

    /**
     * Set the defaultTimeRange property: The insight chart query.
     * 
     * @param defaultTimeRange the defaultTimeRange value to set.
     * @return the InsightQueryItemProperties object itself.
     */
    public InsightQueryItemProperties
        withDefaultTimeRange(InsightQueryItemPropertiesDefaultTimeRange defaultTimeRange) {
        this.defaultTimeRange = defaultTimeRange;
        return this;
    }

    /**
     * Get the referenceTimeRange property: The insight chart query.
     * 
     * @return the referenceTimeRange value.
     */
    public InsightQueryItemPropertiesReferenceTimeRange referenceTimeRange() {
        return this.referenceTimeRange;
    }

    /**
     * Set the referenceTimeRange property: The insight chart query.
     * 
     * @param referenceTimeRange the referenceTimeRange value to set.
     * @return the InsightQueryItemProperties object itself.
     */
    public InsightQueryItemProperties
        withReferenceTimeRange(InsightQueryItemPropertiesReferenceTimeRange referenceTimeRange) {
        this.referenceTimeRange = referenceTimeRange;
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public InsightQueryItemProperties withDataTypes(List dataTypes) {
        super.withDataTypes(dataTypes);
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public InsightQueryItemProperties withInputEntityType(EntityType inputEntityType) {
        super.withInputEntityType(inputEntityType);
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public InsightQueryItemProperties withRequiredInputFieldsSets(List> requiredInputFieldsSets) {
        super.withRequiredInputFieldsSets(requiredInputFieldsSets);
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public InsightQueryItemProperties withEntitiesFilter(Object entitiesFilter) {
        super.withEntitiesFilter(entitiesFilter);
        return this;
    }

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

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeArrayField("dataTypes", dataTypes(), (writer, element) -> writer.writeJson(element));
        jsonWriter.writeStringField("inputEntityType", inputEntityType() == null ? null : inputEntityType().toString());
        jsonWriter.writeArrayField("requiredInputFieldsSets", requiredInputFieldsSets(),
            (writer, element) -> writer.writeArray(element, (writer1, element1) -> writer1.writeString(element1)));
        jsonWriter.writeUntypedField("entitiesFilter", entitiesFilter());
        jsonWriter.writeStringField("displayName", this.displayName);
        jsonWriter.writeStringField("description", this.description);
        jsonWriter.writeStringField("baseQuery", this.baseQuery);
        jsonWriter.writeJsonField("tableQuery", this.tableQuery);
        jsonWriter.writeUntypedField("chartQuery", this.chartQuery);
        jsonWriter.writeJsonField("additionalQuery", this.additionalQuery);
        jsonWriter.writeJsonField("defaultTimeRange", this.defaultTimeRange);
        jsonWriter.writeJsonField("referenceTimeRange", this.referenceTimeRange);
        return jsonWriter.writeEndObject();
    }

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

                if ("dataTypes".equals(fieldName)) {
                    List dataTypes
                        = reader.readArray(reader1 -> EntityQueryItemPropertiesDataTypesItem.fromJson(reader1));
                    deserializedInsightQueryItemProperties.withDataTypes(dataTypes);
                } else if ("inputEntityType".equals(fieldName)) {
                    deserializedInsightQueryItemProperties
                        .withInputEntityType(EntityType.fromString(reader.getString()));
                } else if ("requiredInputFieldsSets".equals(fieldName)) {
                    List> requiredInputFieldsSets
                        = reader.readArray(reader1 -> reader1.readArray(reader2 -> reader2.getString()));
                    deserializedInsightQueryItemProperties.withRequiredInputFieldsSets(requiredInputFieldsSets);
                } else if ("entitiesFilter".equals(fieldName)) {
                    deserializedInsightQueryItemProperties.withEntitiesFilter(reader.readUntyped());
                } else if ("displayName".equals(fieldName)) {
                    deserializedInsightQueryItemProperties.displayName = reader.getString();
                } else if ("description".equals(fieldName)) {
                    deserializedInsightQueryItemProperties.description = reader.getString();
                } else if ("baseQuery".equals(fieldName)) {
                    deserializedInsightQueryItemProperties.baseQuery = reader.getString();
                } else if ("tableQuery".equals(fieldName)) {
                    deserializedInsightQueryItemProperties.tableQuery
                        = InsightQueryItemPropertiesTableQuery.fromJson(reader);
                } else if ("chartQuery".equals(fieldName)) {
                    deserializedInsightQueryItemProperties.chartQuery = reader.readUntyped();
                } else if ("additionalQuery".equals(fieldName)) {
                    deserializedInsightQueryItemProperties.additionalQuery
                        = InsightQueryItemPropertiesAdditionalQuery.fromJson(reader);
                } else if ("defaultTimeRange".equals(fieldName)) {
                    deserializedInsightQueryItemProperties.defaultTimeRange
                        = InsightQueryItemPropertiesDefaultTimeRange.fromJson(reader);
                } else if ("referenceTimeRange".equals(fieldName)) {
                    deserializedInsightQueryItemProperties.referenceTimeRange
                        = InsightQueryItemPropertiesReferenceTimeRange.fromJson(reader);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedInsightQueryItemProperties;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy