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

com.azure.resourcemanager.securityinsights.models.ThreatIntelligenceMetricEntity Maven / Gradle / Ivy

Go to download

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.

There is a newer version: 1.0.0
Show 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;

/**
 * Describes threat intelligence metric entity.
 */
@Fluent
public final class ThreatIntelligenceMetricEntity implements JsonSerializable {
    /*
     * Metric name
     */
    private String metricName;

    /*
     * Metric value
     */
    private Integer metricValue;

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

    /**
     * Get the metricName property: Metric name.
     * 
     * @return the metricName value.
     */
    public String metricName() {
        return this.metricName;
    }

    /**
     * Set the metricName property: Metric name.
     * 
     * @param metricName the metricName value to set.
     * @return the ThreatIntelligenceMetricEntity object itself.
     */
    public ThreatIntelligenceMetricEntity withMetricName(String metricName) {
        this.metricName = metricName;
        return this;
    }

    /**
     * Get the metricValue property: Metric value.
     * 
     * @return the metricValue value.
     */
    public Integer metricValue() {
        return this.metricValue;
    }

    /**
     * Set the metricValue property: Metric value.
     * 
     * @param metricValue the metricValue value to set.
     * @return the ThreatIntelligenceMetricEntity object itself.
     */
    public ThreatIntelligenceMetricEntity withMetricValue(Integer metricValue) {
        this.metricValue = metricValue;
        return this;
    }

    /**
     * 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();
        jsonWriter.writeStringField("metricName", this.metricName);
        jsonWriter.writeNumberField("metricValue", this.metricValue);
        return jsonWriter.writeEndObject();
    }

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

                if ("metricName".equals(fieldName)) {
                    deserializedThreatIntelligenceMetricEntity.metricName = reader.getString();
                } else if ("metricValue".equals(fieldName)) {
                    deserializedThreatIntelligenceMetricEntity.metricValue = reader.getNullable(JsonReader::getInt);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedThreatIntelligenceMetricEntity;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy