com.azure.resourcemanager.securityinsights.fluent.models.IncidentEntitiesResponseInner 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.fluent.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 com.azure.resourcemanager.securityinsights.models.IncidentEntitiesResultsMetadata;
import java.io.IOException;
import java.util.List;
/**
* The incident related entities response.
*/
@Fluent
public final class IncidentEntitiesResponseInner implements JsonSerializable {
/*
* Array of the incident related entities.
*/
private List entities;
/*
* The metadata from the incident related entities results.
*/
private List metadata;
/**
* Creates an instance of IncidentEntitiesResponseInner class.
*/
public IncidentEntitiesResponseInner() {
}
/**
* Get the entities property: Array of the incident related entities.
*
* @return the entities value.
*/
public List entities() {
return this.entities;
}
/**
* Set the entities property: Array of the incident related entities.
*
* @param entities the entities value to set.
* @return the IncidentEntitiesResponseInner object itself.
*/
public IncidentEntitiesResponseInner withEntities(List entities) {
this.entities = entities;
return this;
}
/**
* Get the metadata property: The metadata from the incident related entities results.
*
* @return the metadata value.
*/
public List metadata() {
return this.metadata;
}
/**
* Set the metadata property: The metadata from the incident related entities results.
*
* @param metadata the metadata value to set.
* @return the IncidentEntitiesResponseInner object itself.
*/
public IncidentEntitiesResponseInner withMetadata(List metadata) {
this.metadata = metadata;
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (entities() != null) {
entities().forEach(e -> e.validate());
}
if (metadata() != null) {
metadata().forEach(e -> e.validate());
}
}
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeArrayField("entities", this.entities, (writer, element) -> writer.writeJson(element));
jsonWriter.writeArrayField("metaData", this.metadata, (writer, element) -> writer.writeJson(element));
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of IncidentEntitiesResponseInner from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of IncidentEntitiesResponseInner 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 IncidentEntitiesResponseInner.
*/
public static IncidentEntitiesResponseInner fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
IncidentEntitiesResponseInner deserializedIncidentEntitiesResponseInner
= new IncidentEntitiesResponseInner();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("entities".equals(fieldName)) {
List entities = reader.readArray(reader1 -> EntityInner.fromJson(reader1));
deserializedIncidentEntitiesResponseInner.entities = entities;
} else if ("metaData".equals(fieldName)) {
List metadata
= reader.readArray(reader1 -> IncidentEntitiesResultsMetadata.fromJson(reader1));
deserializedIncidentEntitiesResponseInner.metadata = metadata;
} else {
reader.skipChildren();
}
}
return deserializedIncidentEntitiesResponseInner;
});
}
}