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

com.azure.resourcemanager.securityinsights.fluent.models.ThreatIntelligenceAlertRuleProperties 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.fluent.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.util.CoreUtils;
import com.azure.core.util.logging.ClientLogger;
import com.azure.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import com.azure.resourcemanager.securityinsights.models.AlertSeverity;
import com.azure.resourcemanager.securityinsights.models.AttackTactic;
import java.io.IOException;
import java.time.OffsetDateTime;
import java.util.List;

/**
 * Threat Intelligence alert rule base property bag.
 */
@Fluent
public final class ThreatIntelligenceAlertRuleProperties
    implements JsonSerializable {
    /*
     * The Name of the alert rule template used to create this rule.
     */
    private String alertRuleTemplateName;

    /*
     * The description of the alert rule.
     */
    private String description;

    /*
     * The display name for alerts created by this alert rule.
     */
    private String displayName;

    /*
     * Determines whether this alert rule is enabled or disabled.
     */
    private boolean enabled;

    /*
     * The last time that this alert has been modified.
     */
    private OffsetDateTime lastModifiedUtc;

    /*
     * The severity for alerts created by this alert rule.
     */
    private AlertSeverity severity;

    /*
     * The tactics of the alert rule
     */
    private List tactics;

    /*
     * The techniques of the alert rule
     */
    private List techniques;

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

    /**
     * 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.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 ThreatIntelligenceAlertRuleProperties object itself.
     */
    public ThreatIntelligenceAlertRuleProperties withAlertRuleTemplateName(String alertRuleTemplateName) {
        this.alertRuleTemplateName = alertRuleTemplateName;
        return this;
    }

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

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

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

    /**
     * Set the enabled property: Determines whether this alert rule is enabled or disabled.
     * 
     * @param enabled the enabled value to set.
     * @return the ThreatIntelligenceAlertRuleProperties object itself.
     */
    public ThreatIntelligenceAlertRuleProperties withEnabled(boolean enabled) {
        this.enabled = enabled;
        return this;
    }

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

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

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

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

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (alertRuleTemplateName() == null) {
            throw LOGGER.atError()
                .log(new IllegalArgumentException(
                    "Missing required property alertRuleTemplateName in model ThreatIntelligenceAlertRuleProperties"));
        }
    }

    private static final ClientLogger LOGGER = new ClientLogger(ThreatIntelligenceAlertRuleProperties.class);

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

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

                if ("alertRuleTemplateName".equals(fieldName)) {
                    deserializedThreatIntelligenceAlertRuleProperties.alertRuleTemplateName = reader.getString();
                } else if ("enabled".equals(fieldName)) {
                    deserializedThreatIntelligenceAlertRuleProperties.enabled = reader.getBoolean();
                } else if ("description".equals(fieldName)) {
                    deserializedThreatIntelligenceAlertRuleProperties.description = reader.getString();
                } else if ("displayName".equals(fieldName)) {
                    deserializedThreatIntelligenceAlertRuleProperties.displayName = reader.getString();
                } else if ("lastModifiedUtc".equals(fieldName)) {
                    deserializedThreatIntelligenceAlertRuleProperties.lastModifiedUtc = reader
                        .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
                } else if ("severity".equals(fieldName)) {
                    deserializedThreatIntelligenceAlertRuleProperties.severity
                        = AlertSeverity.fromString(reader.getString());
                } else if ("tactics".equals(fieldName)) {
                    List tactics
                        = reader.readArray(reader1 -> AttackTactic.fromString(reader1.getString()));
                    deserializedThreatIntelligenceAlertRuleProperties.tactics = tactics;
                } else if ("techniques".equals(fieldName)) {
                    List techniques = reader.readArray(reader1 -> reader1.getString());
                    deserializedThreatIntelligenceAlertRuleProperties.techniques = techniques;
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedThreatIntelligenceAlertRuleProperties;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy