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

com.azure.resourcemanager.securityinsights.models.NrtAlertRule 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.core.management.SystemData;
import com.azure.json.JsonReader;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import com.azure.resourcemanager.securityinsights.fluent.models.AlertRuleInner;
import com.azure.resourcemanager.securityinsights.fluent.models.NrtAlertRuleProperties;
import java.io.IOException;
import java.time.Duration;
import java.time.OffsetDateTime;
import java.util.List;
import java.util.Map;

/**
 * Represents NRT alert rule.
 */
@Fluent
public final class NrtAlertRule extends AlertRuleInner {
    /*
     * The kind of the alert rule
     */
    private AlertRuleKind kind = AlertRuleKind.NRT;

    /*
     * NRT alert rule properties
     */
    private NrtAlertRuleProperties innerProperties;

    /*
     * Azure Resource Manager metadata containing createdBy and modifiedBy information.
     */
    private SystemData systemData;

    /*
     * The type of the resource.
     */
    private String type;

    /*
     * The name of the resource.
     */
    private String name;

    /*
     * Fully qualified resource Id for the resource.
     */
    private String id;

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

    /**
     * Get the kind property: The kind of the alert rule.
     * 
     * @return the kind value.
     */
    @Override
    public AlertRuleKind kind() {
        return this.kind;
    }

    /**
     * Get the innerProperties property: NRT alert rule properties.
     * 
     * @return the innerProperties value.
     */
    private NrtAlertRuleProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information.
     * 
     * @return the systemData value.
     */
    @Override
    public SystemData systemData() {
        return this.systemData;
    }

    /**
     * Get the type property: The type of the resource.
     * 
     * @return the type value.
     */
    @Override
    public String type() {
        return this.type;
    }

    /**
     * Get the name property: The name of the resource.
     * 
     * @return the name value.
     */
    @Override
    public String name() {
        return this.name;
    }

    /**
     * Get the id property: Fully qualified resource Id for the resource.
     * 
     * @return the id value.
     */
    @Override
    public String id() {
        return this.id;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public NrtAlertRule withEtag(String etag) {
        super.withEtag(etag);
        return this;
    }

    /**
     * Get the alertRuleTemplateName property: The Name of the alert rule template used to create this rule.
     * 
     * @return the alertRuleTemplateName value.
     */
    public String alertRuleTemplateName() {
        return this.innerProperties() == null ? null : this.innerProperties().alertRuleTemplateName();
    }

    /**
     * Set the alertRuleTemplateName property: The Name of the alert rule template used to create this rule.
     * 
     * @param alertRuleTemplateName the alertRuleTemplateName value to set.
     * @return the NrtAlertRule object itself.
     */
    public NrtAlertRule withAlertRuleTemplateName(String alertRuleTemplateName) {
        if (this.innerProperties() == null) {
            this.innerProperties = new NrtAlertRuleProperties();
        }
        this.innerProperties().withAlertRuleTemplateName(alertRuleTemplateName);
        return this;
    }

    /**
     * Get the templateVersion property: The version of the alert rule template used to create this rule - in format
     * <a.b.c>, where all are numbers, for example 0 <1.0.2>.
     * 
     * @return the templateVersion value.
     */
    public String templateVersion() {
        return this.innerProperties() == null ? null : this.innerProperties().templateVersion();
    }

    /**
     * Set the templateVersion property: The version of the alert rule template used to create this rule - in format
     * <a.b.c>, where all are numbers, for example 0 <1.0.2>.
     * 
     * @param templateVersion the templateVersion value to set.
     * @return the NrtAlertRule object itself.
     */
    public NrtAlertRule withTemplateVersion(String templateVersion) {
        if (this.innerProperties() == null) {
            this.innerProperties = new NrtAlertRuleProperties();
        }
        this.innerProperties().withTemplateVersion(templateVersion);
        return this;
    }

    /**
     * Get the description property: The description of the alert rule.
     * 
     * @return the description value.
     */
    public String description() {
        return this.innerProperties() == null ? null : this.innerProperties().description();
    }

    /**
     * Set the description property: The description of the alert rule.
     * 
     * @param description the description value to set.
     * @return the NrtAlertRule object itself.
     */
    public NrtAlertRule withDescription(String description) {
        if (this.innerProperties() == null) {
            this.innerProperties = new NrtAlertRuleProperties();
        }
        this.innerProperties().withDescription(description);
        return this;
    }

    /**
     * Get the query property: The query that creates alerts for this rule.
     * 
     * @return the query value.
     */
    public String query() {
        return this.innerProperties() == null ? null : this.innerProperties().query();
    }

    /**
     * Set the query property: The query that creates alerts for this rule.
     * 
     * @param query the query value to set.
     * @return the NrtAlertRule object itself.
     */
    public NrtAlertRule withQuery(String query) {
        if (this.innerProperties() == null) {
            this.innerProperties = new NrtAlertRuleProperties();
        }
        this.innerProperties().withQuery(query);
        return this;
    }

    /**
     * Get the tactics property: The tactics of the alert rule.
     * 
     * @return the tactics value.
     */
    public List tactics() {
        return this.innerProperties() == null ? null : this.innerProperties().tactics();
    }

    /**
     * Set the tactics property: The tactics of the alert rule.
     * 
     * @param tactics the tactics value to set.
     * @return the NrtAlertRule object itself.
     */
    public NrtAlertRule withTactics(List tactics) {
        if (this.innerProperties() == null) {
            this.innerProperties = new NrtAlertRuleProperties();
        }
        this.innerProperties().withTactics(tactics);
        return this;
    }

    /**
     * Get the techniques property: The techniques of the alert rule.
     * 
     * @return the techniques value.
     */
    public List techniques() {
        return this.innerProperties() == null ? null : this.innerProperties().techniques();
    }

    /**
     * Set the techniques property: The techniques of the alert rule.
     * 
     * @param techniques the techniques value to set.
     * @return the NrtAlertRule object itself.
     */
    public NrtAlertRule withTechniques(List techniques) {
        if (this.innerProperties() == null) {
            this.innerProperties = new NrtAlertRuleProperties();
        }
        this.innerProperties().withTechniques(techniques);
        return this;
    }

    /**
     * Get the displayName property: The display name for alerts created by this alert rule.
     * 
     * @return the displayName value.
     */
    public String displayName() {
        return this.innerProperties() == null ? null : this.innerProperties().displayName();
    }

    /**
     * Set the displayName property: The display name for alerts created by this alert rule.
     * 
     * @param displayName the displayName value to set.
     * @return the NrtAlertRule object itself.
     */
    public NrtAlertRule withDisplayName(String displayName) {
        if (this.innerProperties() == null) {
            this.innerProperties = new NrtAlertRuleProperties();
        }
        this.innerProperties().withDisplayName(displayName);
        return this;
    }

    /**
     * Get the enabled property: Determines whether this alert rule is enabled or disabled.
     * 
     * @return the enabled value.
     */
    public Boolean enabled() {
        return this.innerProperties() == null ? null : this.innerProperties().enabled();
    }

    /**
     * Set the enabled property: Determines whether this alert rule is enabled or disabled.
     * 
     * @param enabled the enabled value to set.
     * @return the NrtAlertRule object itself.
     */
    public NrtAlertRule withEnabled(Boolean enabled) {
        if (this.innerProperties() == null) {
            this.innerProperties = new NrtAlertRuleProperties();
        }
        this.innerProperties().withEnabled(enabled);
        return this;
    }

    /**
     * Get the lastModifiedUtc property: The last time that this alert rule has been modified.
     * 
     * @return the lastModifiedUtc value.
     */
    public OffsetDateTime lastModifiedUtc() {
        return this.innerProperties() == null ? null : this.innerProperties().lastModifiedUtc();
    }

    /**
     * Get the suppressionDuration property: The suppression (in ISO 8601 duration format) to wait since last time this
     * alert rule been triggered.
     * 
     * @return the suppressionDuration value.
     */
    public Duration suppressionDuration() {
        return this.innerProperties() == null ? null : this.innerProperties().suppressionDuration();
    }

    /**
     * Set the suppressionDuration property: The suppression (in ISO 8601 duration format) to wait since last time this
     * alert rule been triggered.
     * 
     * @param suppressionDuration the suppressionDuration value to set.
     * @return the NrtAlertRule object itself.
     */
    public NrtAlertRule withSuppressionDuration(Duration suppressionDuration) {
        if (this.innerProperties() == null) {
            this.innerProperties = new NrtAlertRuleProperties();
        }
        this.innerProperties().withSuppressionDuration(suppressionDuration);
        return this;
    }

    /**
     * Get the suppressionEnabled property: Determines whether the suppression for this alert rule is enabled or
     * disabled.
     * 
     * @return the suppressionEnabled value.
     */
    public Boolean suppressionEnabled() {
        return this.innerProperties() == null ? null : this.innerProperties().suppressionEnabled();
    }

    /**
     * Set the suppressionEnabled property: Determines whether the suppression for this alert rule is enabled or
     * disabled.
     * 
     * @param suppressionEnabled the suppressionEnabled value to set.
     * @return the NrtAlertRule object itself.
     */
    public NrtAlertRule withSuppressionEnabled(Boolean suppressionEnabled) {
        if (this.innerProperties() == null) {
            this.innerProperties = new NrtAlertRuleProperties();
        }
        this.innerProperties().withSuppressionEnabled(suppressionEnabled);
        return this;
    }

    /**
     * Get the severity property: The severity for alerts created by this alert rule.
     * 
     * @return the severity value.
     */
    public AlertSeverity severity() {
        return this.innerProperties() == null ? null : this.innerProperties().severity();
    }

    /**
     * Set the severity property: The severity for alerts created by this alert rule.
     * 
     * @param severity the severity value to set.
     * @return the NrtAlertRule object itself.
     */
    public NrtAlertRule withSeverity(AlertSeverity severity) {
        if (this.innerProperties() == null) {
            this.innerProperties = new NrtAlertRuleProperties();
        }
        this.innerProperties().withSeverity(severity);
        return this;
    }

    /**
     * Get the incidentConfiguration property: The settings of the incidents that created from alerts triggered by this
     * analytics rule.
     * 
     * @return the incidentConfiguration value.
     */
    public IncidentConfiguration incidentConfiguration() {
        return this.innerProperties() == null ? null : this.innerProperties().incidentConfiguration();
    }

    /**
     * Set the incidentConfiguration property: The settings of the incidents that created from alerts triggered by this
     * analytics rule.
     * 
     * @param incidentConfiguration the incidentConfiguration value to set.
     * @return the NrtAlertRule object itself.
     */
    public NrtAlertRule withIncidentConfiguration(IncidentConfiguration incidentConfiguration) {
        if (this.innerProperties() == null) {
            this.innerProperties = new NrtAlertRuleProperties();
        }
        this.innerProperties().withIncidentConfiguration(incidentConfiguration);
        return this;
    }

    /**
     * Get the customDetails property: Dictionary of string key-value pairs of columns to be attached to the alert.
     * 
     * @return the customDetails value.
     */
    public Map customDetails() {
        return this.innerProperties() == null ? null : this.innerProperties().customDetails();
    }

    /**
     * Set the customDetails property: Dictionary of string key-value pairs of columns to be attached to the alert.
     * 
     * @param customDetails the customDetails value to set.
     * @return the NrtAlertRule object itself.
     */
    public NrtAlertRule withCustomDetails(Map customDetails) {
        if (this.innerProperties() == null) {
            this.innerProperties = new NrtAlertRuleProperties();
        }
        this.innerProperties().withCustomDetails(customDetails);
        return this;
    }

    /**
     * Get the entityMappings property: Array of the entity mappings of the alert rule.
     * 
     * @return the entityMappings value.
     */
    public List entityMappings() {
        return this.innerProperties() == null ? null : this.innerProperties().entityMappings();
    }

    /**
     * Set the entityMappings property: Array of the entity mappings of the alert rule.
     * 
     * @param entityMappings the entityMappings value to set.
     * @return the NrtAlertRule object itself.
     */
    public NrtAlertRule withEntityMappings(List entityMappings) {
        if (this.innerProperties() == null) {
            this.innerProperties = new NrtAlertRuleProperties();
        }
        this.innerProperties().withEntityMappings(entityMappings);
        return this;
    }

    /**
     * Get the alertDetailsOverride property: The alert details override settings.
     * 
     * @return the alertDetailsOverride value.
     */
    public AlertDetailsOverride alertDetailsOverride() {
        return this.innerProperties() == null ? null : this.innerProperties().alertDetailsOverride();
    }

    /**
     * Set the alertDetailsOverride property: The alert details override settings.
     * 
     * @param alertDetailsOverride the alertDetailsOverride value to set.
     * @return the NrtAlertRule object itself.
     */
    public NrtAlertRule withAlertDetailsOverride(AlertDetailsOverride alertDetailsOverride) {
        if (this.innerProperties() == null) {
            this.innerProperties = new NrtAlertRuleProperties();
        }
        this.innerProperties().withAlertDetailsOverride(alertDetailsOverride);
        return this;
    }

    /**
     * Get the eventGroupingSettings property: The event grouping settings.
     * 
     * @return the eventGroupingSettings value.
     */
    public EventGroupingSettings eventGroupingSettings() {
        return this.innerProperties() == null ? null : this.innerProperties().eventGroupingSettings();
    }

    /**
     * Set the eventGroupingSettings property: The event grouping settings.
     * 
     * @param eventGroupingSettings the eventGroupingSettings value to set.
     * @return the NrtAlertRule object itself.
     */
    public NrtAlertRule withEventGroupingSettings(EventGroupingSettings eventGroupingSettings) {
        if (this.innerProperties() == null) {
            this.innerProperties = new NrtAlertRuleProperties();
        }
        this.innerProperties().withEventGroupingSettings(eventGroupingSettings);
        return this;
    }

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

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("etag", etag());
        jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString());
        jsonWriter.writeJsonField("properties", this.innerProperties);
        return jsonWriter.writeEndObject();
    }

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

                if ("id".equals(fieldName)) {
                    deserializedNrtAlertRule.id = reader.getString();
                } else if ("name".equals(fieldName)) {
                    deserializedNrtAlertRule.name = reader.getString();
                } else if ("type".equals(fieldName)) {
                    deserializedNrtAlertRule.type = reader.getString();
                } else if ("etag".equals(fieldName)) {
                    deserializedNrtAlertRule.withEtag(reader.getString());
                } else if ("systemData".equals(fieldName)) {
                    deserializedNrtAlertRule.systemData = SystemData.fromJson(reader);
                } else if ("kind".equals(fieldName)) {
                    deserializedNrtAlertRule.kind = AlertRuleKind.fromString(reader.getString());
                } else if ("properties".equals(fieldName)) {
                    deserializedNrtAlertRule.innerProperties = NrtAlertRuleProperties.fromJson(reader);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedNrtAlertRule;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy