com.azure.resourcemanager.securityinsights.models.InsightsTableResult 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-2022-09.
The 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;
/**
* Query results for table insights query.
*/
@Fluent
public final class InsightsTableResult implements JsonSerializable {
/*
* Columns Metadata of the table
*/
private List columns;
/*
* Rows data of the table
*/
private List> rows;
/**
* Creates an instance of InsightsTableResult class.
*/
public InsightsTableResult() {
}
/**
* Get the columns property: Columns Metadata of the table.
*
* @return the columns value.
*/
public List columns() {
return this.columns;
}
/**
* Set the columns property: Columns Metadata of the table.
*
* @param columns the columns value to set.
* @return the InsightsTableResult object itself.
*/
public InsightsTableResult withColumns(List columns) {
this.columns = columns;
return this;
}
/**
* Get the rows property: Rows data of the table.
*
* @return the rows value.
*/
public List> rows() {
return this.rows;
}
/**
* Set the rows property: Rows data of the table.
*
* @param rows the rows value to set.
* @return the InsightsTableResult object itself.
*/
public InsightsTableResult withRows(List> rows) {
this.rows = rows;
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (columns() != null) {
columns().forEach(e -> e.validate());
}
}
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeArrayField("columns", this.columns, (writer, element) -> writer.writeJson(element));
jsonWriter.writeArrayField("rows", this.rows,
(writer, element) -> writer.writeArray(element, (writer1, element1) -> writer1.writeString(element1)));
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of InsightsTableResult from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of InsightsTableResult 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 InsightsTableResult.
*/
public static InsightsTableResult fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
InsightsTableResult deserializedInsightsTableResult = new InsightsTableResult();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("columns".equals(fieldName)) {
List columns
= reader.readArray(reader1 -> InsightsTableResultColumnsItem.fromJson(reader1));
deserializedInsightsTableResult.columns = columns;
} else if ("rows".equals(fieldName)) {
List> rows
= reader.readArray(reader1 -> reader1.readArray(reader2 -> reader2.getString()));
deserializedInsightsTableResult.rows = rows;
} else {
reader.skipChildren();
}
}
return deserializedInsightsTableResult;
});
}
}