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

com.azure.resourcemanager.securityinsights.models.IncidentConfiguration 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-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.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;

/**
 * Incident Configuration property bag.
 */
@Fluent
public final class IncidentConfiguration implements JsonSerializable {
    /*
     * Create incidents from alerts triggered by this analytics rule
     */
    private boolean createIncident;

    /*
     * Set how the alerts that are triggered by this analytics rule, are grouped into incidents
     */
    private GroupingConfiguration groupingConfiguration;

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

    /**
     * Get the createIncident property: Create incidents from alerts triggered by this analytics rule.
     * 
     * @return the createIncident value.
     */
    public boolean createIncident() {
        return this.createIncident;
    }

    /**
     * Set the createIncident property: Create incidents from alerts triggered by this analytics rule.
     * 
     * @param createIncident the createIncident value to set.
     * @return the IncidentConfiguration object itself.
     */
    public IncidentConfiguration withCreateIncident(boolean createIncident) {
        this.createIncident = createIncident;
        return this;
    }

    /**
     * Get the groupingConfiguration property: Set how the alerts that are triggered by this analytics rule, are grouped
     * into incidents.
     * 
     * @return the groupingConfiguration value.
     */
    public GroupingConfiguration groupingConfiguration() {
        return this.groupingConfiguration;
    }

    /**
     * Set the groupingConfiguration property: Set how the alerts that are triggered by this analytics rule, are grouped
     * into incidents.
     * 
     * @param groupingConfiguration the groupingConfiguration value to set.
     * @return the IncidentConfiguration object itself.
     */
    public IncidentConfiguration withGroupingConfiguration(GroupingConfiguration groupingConfiguration) {
        this.groupingConfiguration = groupingConfiguration;
        return this;
    }

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

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeBooleanField("createIncident", this.createIncident);
        jsonWriter.writeJsonField("groupingConfiguration", this.groupingConfiguration);
        return jsonWriter.writeEndObject();
    }

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

                if ("createIncident".equals(fieldName)) {
                    deserializedIncidentConfiguration.createIncident = reader.getBoolean();
                } else if ("groupingConfiguration".equals(fieldName)) {
                    deserializedIncidentConfiguration.groupingConfiguration = GroupingConfiguration.fromJson(reader);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedIncidentConfiguration;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy