![JAR search and dependency download from the Maven repository](/logo.png)
com.azure.resourcemanager.securityinsights.models.InsightQueryItem Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-securityinsights Show documentation
Show all versions of azure-resourcemanager-securityinsights Show documentation
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.
// 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;
/**
* Represents Insight Query.
*/
@Fluent
public final class InsightQueryItem extends EntityQueryItem {
/*
* The kind of the entity query
*/
private EntityQueryKind kind = EntityQueryKind.INSIGHT;
/*
* Properties bag for InsightQueryItem
*/
private InsightQueryItemProperties properties;
/*
* Query Template ARM ID
*/
private String id;
/**
* Creates an instance of InsightQueryItem class.
*/
public InsightQueryItem() {
}
/**
* Get the kind property: The kind of the entity query.
*
* @return the kind value.
*/
@Override
public EntityQueryKind kind() {
return this.kind;
}
/**
* Get the properties property: Properties bag for InsightQueryItem.
*
* @return the properties value.
*/
public InsightQueryItemProperties properties() {
return this.properties;
}
/**
* Set the properties property: Properties bag for InsightQueryItem.
*
* @param properties the properties value to set.
* @return the InsightQueryItem object itself.
*/
public InsightQueryItem withProperties(InsightQueryItemProperties properties) {
this.properties = properties;
return this;
}
/**
* Get the id property: Query Template ARM ID.
*
* @return the id value.
*/
@Override
public String id() {
return this.id;
}
/**
* {@inheritDoc}
*/
@Override
public InsightQueryItem withName(String name) {
super.withName(name);
return this;
}
/**
* {@inheritDoc}
*/
@Override
public InsightQueryItem withType(String type) {
super.withType(type);
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
@Override
public void validate() {
if (properties() != null) {
properties().validate();
}
}
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeStringField("name", name());
jsonWriter.writeStringField("type", type());
jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString());
jsonWriter.writeJsonField("properties", this.properties);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of InsightQueryItem from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of InsightQueryItem 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 InsightQueryItem.
*/
public static InsightQueryItem fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
InsightQueryItem deserializedInsightQueryItem = new InsightQueryItem();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("id".equals(fieldName)) {
deserializedInsightQueryItem.id = reader.getString();
} else if ("name".equals(fieldName)) {
deserializedInsightQueryItem.withName(reader.getString());
} else if ("type".equals(fieldName)) {
deserializedInsightQueryItem.withType(reader.getString());
} else if ("kind".equals(fieldName)) {
deserializedInsightQueryItem.kind = EntityQueryKind.fromString(reader.getString());
} else if ("properties".equals(fieldName)) {
deserializedInsightQueryItem.properties = InsightQueryItemProperties.fromJson(reader);
} else {
reader.skipChildren();
}
}
return deserializedInsightQueryItem;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy