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

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

/**
 * The IncidentPropertiesAction model.
 */
@Fluent
public final class IncidentPropertiesAction implements JsonSerializable {
    /*
     * The severity of the incident
     */
    private IncidentSeverity severity;

    /*
     * The status of the incident
     */
    private IncidentStatus status;

    /*
     * The reason the incident was closed
     */
    private IncidentClassification classification;

    /*
     * The classification reason the incident was closed with
     */
    private IncidentClassificationReason classificationReason;

    /*
     * Describes the reason the incident was closed.
     */
    private String classificationComment;

    /*
     * Information on the user an incident is assigned to
     */
    private IncidentOwnerInfo owner;

    /*
     * List of labels to add to the incident.
     */
    private List labels;

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

    /**
     * Get the severity property: The severity of the incident.
     * 
     * @return the severity value.
     */
    public IncidentSeverity severity() {
        return this.severity;
    }

    /**
     * Set the severity property: The severity of the incident.
     * 
     * @param severity the severity value to set.
     * @return the IncidentPropertiesAction object itself.
     */
    public IncidentPropertiesAction withSeverity(IncidentSeverity severity) {
        this.severity = severity;
        return this;
    }

    /**
     * Get the status property: The status of the incident.
     * 
     * @return the status value.
     */
    public IncidentStatus status() {
        return this.status;
    }

    /**
     * Set the status property: The status of the incident.
     * 
     * @param status the status value to set.
     * @return the IncidentPropertiesAction object itself.
     */
    public IncidentPropertiesAction withStatus(IncidentStatus status) {
        this.status = status;
        return this;
    }

    /**
     * Get the classification property: The reason the incident was closed.
     * 
     * @return the classification value.
     */
    public IncidentClassification classification() {
        return this.classification;
    }

    /**
     * Set the classification property: The reason the incident was closed.
     * 
     * @param classification the classification value to set.
     * @return the IncidentPropertiesAction object itself.
     */
    public IncidentPropertiesAction withClassification(IncidentClassification classification) {
        this.classification = classification;
        return this;
    }

    /**
     * Get the classificationReason property: The classification reason the incident was closed with.
     * 
     * @return the classificationReason value.
     */
    public IncidentClassificationReason classificationReason() {
        return this.classificationReason;
    }

    /**
     * Set the classificationReason property: The classification reason the incident was closed with.
     * 
     * @param classificationReason the classificationReason value to set.
     * @return the IncidentPropertiesAction object itself.
     */
    public IncidentPropertiesAction withClassificationReason(IncidentClassificationReason classificationReason) {
        this.classificationReason = classificationReason;
        return this;
    }

    /**
     * Get the classificationComment property: Describes the reason the incident was closed.
     * 
     * @return the classificationComment value.
     */
    public String classificationComment() {
        return this.classificationComment;
    }

    /**
     * Set the classificationComment property: Describes the reason the incident was closed.
     * 
     * @param classificationComment the classificationComment value to set.
     * @return the IncidentPropertiesAction object itself.
     */
    public IncidentPropertiesAction withClassificationComment(String classificationComment) {
        this.classificationComment = classificationComment;
        return this;
    }

    /**
     * Get the owner property: Information on the user an incident is assigned to.
     * 
     * @return the owner value.
     */
    public IncidentOwnerInfo owner() {
        return this.owner;
    }

    /**
     * Set the owner property: Information on the user an incident is assigned to.
     * 
     * @param owner the owner value to set.
     * @return the IncidentPropertiesAction object itself.
     */
    public IncidentPropertiesAction withOwner(IncidentOwnerInfo owner) {
        this.owner = owner;
        return this;
    }

    /**
     * Get the labels property: List of labels to add to the incident.
     * 
     * @return the labels value.
     */
    public List labels() {
        return this.labels;
    }

    /**
     * Set the labels property: List of labels to add to the incident.
     * 
     * @param labels the labels value to set.
     * @return the IncidentPropertiesAction object itself.
     */
    public IncidentPropertiesAction withLabels(List labels) {
        this.labels = labels;
        return this;
    }

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

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("severity", this.severity == null ? null : this.severity.toString());
        jsonWriter.writeStringField("status", this.status == null ? null : this.status.toString());
        jsonWriter.writeStringField("classification",
            this.classification == null ? null : this.classification.toString());
        jsonWriter.writeStringField("classificationReason",
            this.classificationReason == null ? null : this.classificationReason.toString());
        jsonWriter.writeStringField("classificationComment", this.classificationComment);
        jsonWriter.writeJsonField("owner", this.owner);
        jsonWriter.writeArrayField("labels", this.labels, (writer, element) -> writer.writeJson(element));
        return jsonWriter.writeEndObject();
    }

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

                if ("severity".equals(fieldName)) {
                    deserializedIncidentPropertiesAction.severity = IncidentSeverity.fromString(reader.getString());
                } else if ("status".equals(fieldName)) {
                    deserializedIncidentPropertiesAction.status = IncidentStatus.fromString(reader.getString());
                } else if ("classification".equals(fieldName)) {
                    deserializedIncidentPropertiesAction.classification
                        = IncidentClassification.fromString(reader.getString());
                } else if ("classificationReason".equals(fieldName)) {
                    deserializedIncidentPropertiesAction.classificationReason
                        = IncidentClassificationReason.fromString(reader.getString());
                } else if ("classificationComment".equals(fieldName)) {
                    deserializedIncidentPropertiesAction.classificationComment = reader.getString();
                } else if ("owner".equals(fieldName)) {
                    deserializedIncidentPropertiesAction.owner = IncidentOwnerInfo.fromJson(reader);
                } else if ("labels".equals(fieldName)) {
                    List labels = reader.readArray(reader1 -> IncidentLabel.fromJson(reader1));
                    deserializedIncidentPropertiesAction.labels = labels;
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedIncidentPropertiesAction;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy