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

com.azure.resourcemanager.securityinsights.models.ThreatIntelligenceMetric 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;
import java.util.List;

/**
 * Describes threat intelligence metric.
 */
@Fluent
public final class ThreatIntelligenceMetric implements JsonSerializable {
    /*
     * Last updated indicator metric
     */
    private String lastUpdatedTimeUtc;

    /*
     * Threat type metrics
     */
    private List threatTypeMetrics;

    /*
     * Pattern type metrics
     */
    private List patternTypeMetrics;

    /*
     * Source metrics
     */
    private List sourceMetrics;

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

    /**
     * Get the lastUpdatedTimeUtc property: Last updated indicator metric.
     * 
     * @return the lastUpdatedTimeUtc value.
     */
    public String lastUpdatedTimeUtc() {
        return this.lastUpdatedTimeUtc;
    }

    /**
     * Set the lastUpdatedTimeUtc property: Last updated indicator metric.
     * 
     * @param lastUpdatedTimeUtc the lastUpdatedTimeUtc value to set.
     * @return the ThreatIntelligenceMetric object itself.
     */
    public ThreatIntelligenceMetric withLastUpdatedTimeUtc(String lastUpdatedTimeUtc) {
        this.lastUpdatedTimeUtc = lastUpdatedTimeUtc;
        return this;
    }

    /**
     * Get the threatTypeMetrics property: Threat type metrics.
     * 
     * @return the threatTypeMetrics value.
     */
    public List threatTypeMetrics() {
        return this.threatTypeMetrics;
    }

    /**
     * Set the threatTypeMetrics property: Threat type metrics.
     * 
     * @param threatTypeMetrics the threatTypeMetrics value to set.
     * @return the ThreatIntelligenceMetric object itself.
     */
    public ThreatIntelligenceMetric withThreatTypeMetrics(List threatTypeMetrics) {
        this.threatTypeMetrics = threatTypeMetrics;
        return this;
    }

    /**
     * Get the patternTypeMetrics property: Pattern type metrics.
     * 
     * @return the patternTypeMetrics value.
     */
    public List patternTypeMetrics() {
        return this.patternTypeMetrics;
    }

    /**
     * Set the patternTypeMetrics property: Pattern type metrics.
     * 
     * @param patternTypeMetrics the patternTypeMetrics value to set.
     * @return the ThreatIntelligenceMetric object itself.
     */
    public ThreatIntelligenceMetric withPatternTypeMetrics(List patternTypeMetrics) {
        this.patternTypeMetrics = patternTypeMetrics;
        return this;
    }

    /**
     * Get the sourceMetrics property: Source metrics.
     * 
     * @return the sourceMetrics value.
     */
    public List sourceMetrics() {
        return this.sourceMetrics;
    }

    /**
     * Set the sourceMetrics property: Source metrics.
     * 
     * @param sourceMetrics the sourceMetrics value to set.
     * @return the ThreatIntelligenceMetric object itself.
     */
    public ThreatIntelligenceMetric withSourceMetrics(List sourceMetrics) {
        this.sourceMetrics = sourceMetrics;
        return this;
    }

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (threatTypeMetrics() != null) {
            threatTypeMetrics().forEach(e -> e.validate());
        }
        if (patternTypeMetrics() != null) {
            patternTypeMetrics().forEach(e -> e.validate());
        }
        if (sourceMetrics() != null) {
            sourceMetrics().forEach(e -> e.validate());
        }
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("lastUpdatedTimeUtc", this.lastUpdatedTimeUtc);
        jsonWriter.writeArrayField("threatTypeMetrics", this.threatTypeMetrics,
            (writer, element) -> writer.writeJson(element));
        jsonWriter.writeArrayField("patternTypeMetrics", this.patternTypeMetrics,
            (writer, element) -> writer.writeJson(element));
        jsonWriter.writeArrayField("sourceMetrics", this.sourceMetrics, (writer, element) -> writer.writeJson(element));
        return jsonWriter.writeEndObject();
    }

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

                if ("lastUpdatedTimeUtc".equals(fieldName)) {
                    deserializedThreatIntelligenceMetric.lastUpdatedTimeUtc = reader.getString();
                } else if ("threatTypeMetrics".equals(fieldName)) {
                    List threatTypeMetrics
                        = reader.readArray(reader1 -> ThreatIntelligenceMetricEntity.fromJson(reader1));
                    deserializedThreatIntelligenceMetric.threatTypeMetrics = threatTypeMetrics;
                } else if ("patternTypeMetrics".equals(fieldName)) {
                    List patternTypeMetrics
                        = reader.readArray(reader1 -> ThreatIntelligenceMetricEntity.fromJson(reader1));
                    deserializedThreatIntelligenceMetric.patternTypeMetrics = patternTypeMetrics;
                } else if ("sourceMetrics".equals(fieldName)) {
                    List sourceMetrics
                        = reader.readArray(reader1 -> ThreatIntelligenceMetricEntity.fromJson(reader1));
                    deserializedThreatIntelligenceMetric.sourceMetrics = sourceMetrics;
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedThreatIntelligenceMetric;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy