com.azure.resourcemanager.securityinsights.models.IncidentEntitiesResultsMetadata 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.core.util.logging.ClientLogger;
import com.azure.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;
/**
* Information of a specific aggregation in the incident related entities result.
*/
@Fluent
public final class IncidentEntitiesResultsMetadata implements JsonSerializable {
/*
* Total number of aggregations of the given kind in the incident related entities result.
*/
private int count;
/*
* The kind of the aggregated entity.
*/
private EntityKind entityKind;
/**
* Creates an instance of IncidentEntitiesResultsMetadata class.
*/
public IncidentEntitiesResultsMetadata() {
}
/**
* Get the count property: Total number of aggregations of the given kind in the incident related entities result.
*
* @return the count value.
*/
public int count() {
return this.count;
}
/**
* Set the count property: Total number of aggregations of the given kind in the incident related entities result.
*
* @param count the count value to set.
* @return the IncidentEntitiesResultsMetadata object itself.
*/
public IncidentEntitiesResultsMetadata withCount(int count) {
this.count = count;
return this;
}
/**
* Get the entityKind property: The kind of the aggregated entity.
*
* @return the entityKind value.
*/
public EntityKind entityKind() {
return this.entityKind;
}
/**
* Set the entityKind property: The kind of the aggregated entity.
*
* @param entityKind the entityKind value to set.
* @return the IncidentEntitiesResultsMetadata object itself.
*/
public IncidentEntitiesResultsMetadata withEntityKind(EntityKind entityKind) {
this.entityKind = entityKind;
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (entityKind() == null) {
throw LOGGER.atError()
.log(new IllegalArgumentException(
"Missing required property entityKind in model IncidentEntitiesResultsMetadata"));
}
}
private static final ClientLogger LOGGER = new ClientLogger(IncidentEntitiesResultsMetadata.class);
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeIntField("count", this.count);
jsonWriter.writeStringField("entityKind", this.entityKind == null ? null : this.entityKind.toString());
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of IncidentEntitiesResultsMetadata from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of IncidentEntitiesResultsMetadata if the JsonReader was pointing to an instance of it, or
* null if it was pointing to JSON null.
* @throws IllegalStateException If the deserialized JSON object was missing any required properties.
* @throws IOException If an error occurs while reading the IncidentEntitiesResultsMetadata.
*/
public static IncidentEntitiesResultsMetadata fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
IncidentEntitiesResultsMetadata deserializedIncidentEntitiesResultsMetadata
= new IncidentEntitiesResultsMetadata();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("count".equals(fieldName)) {
deserializedIncidentEntitiesResultsMetadata.count = reader.getInt();
} else if ("entityKind".equals(fieldName)) {
deserializedIncidentEntitiesResultsMetadata.entityKind = EntityKind.fromString(reader.getString());
} else {
reader.skipChildren();
}
}
return deserializedIncidentEntitiesResultsMetadata;
});
}
}