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

com.azure.resourcemanager.security.models.IoTSecurityAlertedDevice Maven / Gradle / Ivy

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.security.models;

import com.azure.core.annotation.Immutable;
import com.azure.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;

/**
 * Statistical information about the number of alerts per device during last set number of days.
 */
@Immutable
public final class IoTSecurityAlertedDevice implements JsonSerializable {
    /*
     * Device identifier.
     */
    private String deviceId;

    /*
     * Number of alerts raised for this device.
     */
    private Long alertsCount;

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

    /**
     * Get the deviceId property: Device identifier.
     * 
     * @return the deviceId value.
     */
    public String deviceId() {
        return this.deviceId;
    }

    /**
     * Get the alertsCount property: Number of alerts raised for this device.
     * 
     * @return the alertsCount value.
     */
    public Long alertsCount() {
        return this.alertsCount;
    }

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        return jsonWriter.writeEndObject();
    }

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

                if ("deviceId".equals(fieldName)) {
                    deserializedIoTSecurityAlertedDevice.deviceId = reader.getString();
                } else if ("alertsCount".equals(fieldName)) {
                    deserializedIoTSecurityAlertedDevice.alertsCount = reader.getNullable(JsonReader::getLong);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedIoTSecurityAlertedDevice;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy