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

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

/**
 * Describes related incident information for the bookmark.
 */
@Fluent
public final class IncidentInfo implements JsonSerializable {
    /*
     * Incident Id
     */
    private String incidentId;

    /*
     * The severity of the incident
     */
    private IncidentSeverity severity;

    /*
     * The title of the incident
     */
    private String title;

    /*
     * Relation Name
     */
    private String relationName;

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

    /**
     * Get the incidentId property: Incident Id.
     * 
     * @return the incidentId value.
     */
    public String incidentId() {
        return this.incidentId;
    }

    /**
     * Set the incidentId property: Incident Id.
     * 
     * @param incidentId the incidentId value to set.
     * @return the IncidentInfo object itself.
     */
    public IncidentInfo withIncidentId(String incidentId) {
        this.incidentId = incidentId;
        return this;
    }

    /**
     * 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 IncidentInfo object itself.
     */
    public IncidentInfo withSeverity(IncidentSeverity severity) {
        this.severity = severity;
        return this;
    }

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

    /**
     * Set the title property: The title of the incident.
     * 
     * @param title the title value to set.
     * @return the IncidentInfo object itself.
     */
    public IncidentInfo withTitle(String title) {
        this.title = title;
        return this;
    }

    /**
     * Get the relationName property: Relation Name.
     * 
     * @return the relationName value.
     */
    public String relationName() {
        return this.relationName;
    }

    /**
     * Set the relationName property: Relation Name.
     * 
     * @param relationName the relationName value to set.
     * @return the IncidentInfo object itself.
     */
    public IncidentInfo withRelationName(String relationName) {
        this.relationName = relationName;
        return this;
    }

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

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("incidentId", this.incidentId);
        jsonWriter.writeStringField("severity", this.severity == null ? null : this.severity.toString());
        jsonWriter.writeStringField("title", this.title);
        jsonWriter.writeStringField("relationName", this.relationName);
        return jsonWriter.writeEndObject();
    }

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

                if ("incidentId".equals(fieldName)) {
                    deserializedIncidentInfo.incidentId = reader.getString();
                } else if ("severity".equals(fieldName)) {
                    deserializedIncidentInfo.severity = IncidentSeverity.fromString(reader.getString());
                } else if ("title".equals(fieldName)) {
                    deserializedIncidentInfo.title = reader.getString();
                } else if ("relationName".equals(fieldName)) {
                    deserializedIncidentInfo.relationName = reader.getString();
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedIncidentInfo;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy