com.azure.resourcemanager.securityinsights.fluent.models.IncidentPropertiesInner Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-securityinsights Show documentation
Show all versions of azure-resourcemanager-securityinsights Show documentation
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.IncidentAdditionalData;
import com.azure.resourcemanager.securityinsights.models.IncidentClassification;
import com.azure.resourcemanager.securityinsights.models.IncidentClassificationReason;
import com.azure.resourcemanager.securityinsights.models.IncidentLabel;
import com.azure.resourcemanager.securityinsights.models.IncidentOwnerInfo;
import com.azure.resourcemanager.securityinsights.models.IncidentSeverity;
import com.azure.resourcemanager.securityinsights.models.IncidentStatus;
import java.io.IOException;
import java.time.OffsetDateTime;
import java.time.format.DateTimeFormatter;
import java.util.List;
/**
* Describes incident properties.
*/
@Fluent
public final class IncidentPropertiesInner implements JsonSerializable {
/*
* Additional data on the incident
*/
private IncidentAdditionalData additionalData;
/*
* The reason the incident was closed
*/
private IncidentClassification classification;
/*
* Describes the reason the incident was closed
*/
private String classificationComment;
/*
* The classification reason the incident was closed with
*/
private IncidentClassificationReason classificationReason;
/*
* The time the incident was created
*/
private OffsetDateTime createdTimeUtc;
/*
* The description of the incident
*/
private String description;
/*
* The time of the first activity in the incident
*/
private OffsetDateTime firstActivityTimeUtc;
/*
* The deep-link url to the incident in Azure portal
*/
private String incidentUrl;
/*
* A sequential number
*/
private Integer incidentNumber;
/*
* List of labels relevant to this incident
*/
private List labels;
/*
* The name of the source provider that generated the incident
*/
private String providerName;
/*
* The incident ID assigned by the incident provider
*/
private String providerIncidentId;
/*
* The time of the last activity in the incident
*/
private OffsetDateTime lastActivityTimeUtc;
/*
* The last time the incident was updated
*/
private OffsetDateTime lastModifiedTimeUtc;
/*
* Describes a user that the incident is assigned to
*/
private IncidentOwnerInfo owner;
/*
* List of resource ids of Analytic rules related to the incident
*/
private List relatedAnalyticRuleIds;
/*
* The severity of the incident
*/
private IncidentSeverity severity;
/*
* The status of the incident
*/
private IncidentStatus status;
/*
* Describes a team for the incident
*/
private TeamInformationInner teamInformation;
/*
* The title of the incident
*/
private String title;
/**
* Creates an instance of IncidentPropertiesInner class.
*/
public IncidentPropertiesInner() {
}
/**
* Get the additionalData property: Additional data on the incident.
*
* @return the additionalData value.
*/
public IncidentAdditionalData additionalData() {
return this.additionalData;
}
/**
* 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 IncidentPropertiesInner object itself.
*/
public IncidentPropertiesInner withClassification(IncidentClassification classification) {
this.classification = classification;
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 IncidentPropertiesInner object itself.
*/
public IncidentPropertiesInner withClassificationComment(String classificationComment) {
this.classificationComment = classificationComment;
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 IncidentPropertiesInner object itself.
*/
public IncidentPropertiesInner withClassificationReason(IncidentClassificationReason classificationReason) {
this.classificationReason = classificationReason;
return this;
}
/**
* Get the createdTimeUtc property: The time the incident was created.
*
* @return the createdTimeUtc value.
*/
public OffsetDateTime createdTimeUtc() {
return this.createdTimeUtc;
}
/**
* Get the description property: The description of the incident.
*
* @return the description value.
*/
public String description() {
return this.description;
}
/**
* Set the description property: The description of the incident.
*
* @param description the description value to set.
* @return the IncidentPropertiesInner object itself.
*/
public IncidentPropertiesInner withDescription(String description) {
this.description = description;
return this;
}
/**
* Get the firstActivityTimeUtc property: The time of the first activity in the incident.
*
* @return the firstActivityTimeUtc value.
*/
public OffsetDateTime firstActivityTimeUtc() {
return this.firstActivityTimeUtc;
}
/**
* Set the firstActivityTimeUtc property: The time of the first activity in the incident.
*
* @param firstActivityTimeUtc the firstActivityTimeUtc value to set.
* @return the IncidentPropertiesInner object itself.
*/
public IncidentPropertiesInner withFirstActivityTimeUtc(OffsetDateTime firstActivityTimeUtc) {
this.firstActivityTimeUtc = firstActivityTimeUtc;
return this;
}
/**
* Get the incidentUrl property: The deep-link url to the incident in Azure portal.
*
* @return the incidentUrl value.
*/
public String incidentUrl() {
return this.incidentUrl;
}
/**
* Get the incidentNumber property: A sequential number.
*
* @return the incidentNumber value.
*/
public Integer incidentNumber() {
return this.incidentNumber;
}
/**
* Get the labels property: List of labels relevant to this incident.
*
* @return the labels value.
*/
public List labels() {
return this.labels;
}
/**
* Set the labels property: List of labels relevant to this incident.
*
* @param labels the labels value to set.
* @return the IncidentPropertiesInner object itself.
*/
public IncidentPropertiesInner withLabels(List labels) {
this.labels = labels;
return this;
}
/**
* Get the providerName property: The name of the source provider that generated the incident.
*
* @return the providerName value.
*/
public String providerName() {
return this.providerName;
}
/**
* Set the providerName property: The name of the source provider that generated the incident.
*
* @param providerName the providerName value to set.
* @return the IncidentPropertiesInner object itself.
*/
public IncidentPropertiesInner withProviderName(String providerName) {
this.providerName = providerName;
return this;
}
/**
* Get the providerIncidentId property: The incident ID assigned by the incident provider.
*
* @return the providerIncidentId value.
*/
public String providerIncidentId() {
return this.providerIncidentId;
}
/**
* Set the providerIncidentId property: The incident ID assigned by the incident provider.
*
* @param providerIncidentId the providerIncidentId value to set.
* @return the IncidentPropertiesInner object itself.
*/
public IncidentPropertiesInner withProviderIncidentId(String providerIncidentId) {
this.providerIncidentId = providerIncidentId;
return this;
}
/**
* Get the lastActivityTimeUtc property: The time of the last activity in the incident.
*
* @return the lastActivityTimeUtc value.
*/
public OffsetDateTime lastActivityTimeUtc() {
return this.lastActivityTimeUtc;
}
/**
* Set the lastActivityTimeUtc property: The time of the last activity in the incident.
*
* @param lastActivityTimeUtc the lastActivityTimeUtc value to set.
* @return the IncidentPropertiesInner object itself.
*/
public IncidentPropertiesInner withLastActivityTimeUtc(OffsetDateTime lastActivityTimeUtc) {
this.lastActivityTimeUtc = lastActivityTimeUtc;
return this;
}
/**
* Get the lastModifiedTimeUtc property: The last time the incident was updated.
*
* @return the lastModifiedTimeUtc value.
*/
public OffsetDateTime lastModifiedTimeUtc() {
return this.lastModifiedTimeUtc;
}
/**
* Get the owner property: Describes a user that the incident is assigned to.
*
* @return the owner value.
*/
public IncidentOwnerInfo owner() {
return this.owner;
}
/**
* Set the owner property: Describes a user that the incident is assigned to.
*
* @param owner the owner value to set.
* @return the IncidentPropertiesInner object itself.
*/
public IncidentPropertiesInner withOwner(IncidentOwnerInfo owner) {
this.owner = owner;
return this;
}
/**
* Get the relatedAnalyticRuleIds property: List of resource ids of Analytic rules related to the incident.
*
* @return the relatedAnalyticRuleIds value.
*/
public List relatedAnalyticRuleIds() {
return this.relatedAnalyticRuleIds;
}
/**
* 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 IncidentPropertiesInner object itself.
*/
public IncidentPropertiesInner 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 IncidentPropertiesInner object itself.
*/
public IncidentPropertiesInner withStatus(IncidentStatus status) {
this.status = status;
return this;
}
/**
* Get the teamInformation property: Describes a team for the incident.
*
* @return the teamInformation value.
*/
public TeamInformationInner teamInformation() {
return this.teamInformation;
}
/**
* Set the teamInformation property: Describes a team for the incident.
*
* @param teamInformation the teamInformation value to set.
* @return the IncidentPropertiesInner object itself.
*/
public IncidentPropertiesInner withTeamInformation(TeamInformationInner teamInformation) {
this.teamInformation = teamInformation;
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 IncidentPropertiesInner object itself.
*/
public IncidentPropertiesInner withTitle(String title) {
this.title = title;
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (additionalData() != null) {
additionalData().validate();
}
if (labels() != null) {
labels().forEach(e -> e.validate());
}
if (owner() != null) {
owner().validate();
}
if (severity() == null) {
throw LOGGER.atError()
.log(new IllegalArgumentException(
"Missing required property severity in model IncidentPropertiesInner"));
}
if (status() == null) {
throw LOGGER.atError()
.log(new IllegalArgumentException("Missing required property status in model IncidentPropertiesInner"));
}
if (teamInformation() != null) {
teamInformation().validate();
}
if (title() == null) {
throw LOGGER.atError()
.log(new IllegalArgumentException("Missing required property title in model IncidentPropertiesInner"));
}
}
private static final ClientLogger LOGGER = new ClientLogger(IncidentPropertiesInner.class);
/**
* {@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("title", this.title);
jsonWriter.writeStringField("classification",
this.classification == null ? null : this.classification.toString());
jsonWriter.writeStringField("classificationComment", this.classificationComment);
jsonWriter.writeStringField("classificationReason",
this.classificationReason == null ? null : this.classificationReason.toString());
jsonWriter.writeStringField("description", this.description);
jsonWriter.writeStringField("firstActivityTimeUtc",
this.firstActivityTimeUtc == null
? null
: DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.firstActivityTimeUtc));
jsonWriter.writeArrayField("labels", this.labels, (writer, element) -> writer.writeJson(element));
jsonWriter.writeStringField("providerName", this.providerName);
jsonWriter.writeStringField("providerIncidentId", this.providerIncidentId);
jsonWriter.writeStringField("lastActivityTimeUtc",
this.lastActivityTimeUtc == null
? null
: DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.lastActivityTimeUtc));
jsonWriter.writeJsonField("owner", this.owner);
jsonWriter.writeJsonField("teamInformation", this.teamInformation);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of IncidentPropertiesInner from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of IncidentPropertiesInner 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 IncidentPropertiesInner.
*/
public static IncidentPropertiesInner fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
IncidentPropertiesInner deserializedIncidentPropertiesInner = new IncidentPropertiesInner();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("severity".equals(fieldName)) {
deserializedIncidentPropertiesInner.severity = IncidentSeverity.fromString(reader.getString());
} else if ("status".equals(fieldName)) {
deserializedIncidentPropertiesInner.status = IncidentStatus.fromString(reader.getString());
} else if ("title".equals(fieldName)) {
deserializedIncidentPropertiesInner.title = reader.getString();
} else if ("additionalData".equals(fieldName)) {
deserializedIncidentPropertiesInner.additionalData = IncidentAdditionalData.fromJson(reader);
} else if ("classification".equals(fieldName)) {
deserializedIncidentPropertiesInner.classification
= IncidentClassification.fromString(reader.getString());
} else if ("classificationComment".equals(fieldName)) {
deserializedIncidentPropertiesInner.classificationComment = reader.getString();
} else if ("classificationReason".equals(fieldName)) {
deserializedIncidentPropertiesInner.classificationReason
= IncidentClassificationReason.fromString(reader.getString());
} else if ("createdTimeUtc".equals(fieldName)) {
deserializedIncidentPropertiesInner.createdTimeUtc = reader
.getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
} else if ("description".equals(fieldName)) {
deserializedIncidentPropertiesInner.description = reader.getString();
} else if ("firstActivityTimeUtc".equals(fieldName)) {
deserializedIncidentPropertiesInner.firstActivityTimeUtc = reader
.getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
} else if ("incidentUrl".equals(fieldName)) {
deserializedIncidentPropertiesInner.incidentUrl = reader.getString();
} else if ("incidentNumber".equals(fieldName)) {
deserializedIncidentPropertiesInner.incidentNumber = reader.getNullable(JsonReader::getInt);
} else if ("labels".equals(fieldName)) {
List labels = reader.readArray(reader1 -> IncidentLabel.fromJson(reader1));
deserializedIncidentPropertiesInner.labels = labels;
} else if ("providerName".equals(fieldName)) {
deserializedIncidentPropertiesInner.providerName = reader.getString();
} else if ("providerIncidentId".equals(fieldName)) {
deserializedIncidentPropertiesInner.providerIncidentId = reader.getString();
} else if ("lastActivityTimeUtc".equals(fieldName)) {
deserializedIncidentPropertiesInner.lastActivityTimeUtc = reader
.getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
} else if ("lastModifiedTimeUtc".equals(fieldName)) {
deserializedIncidentPropertiesInner.lastModifiedTimeUtc = reader
.getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
} else if ("owner".equals(fieldName)) {
deserializedIncidentPropertiesInner.owner = IncidentOwnerInfo.fromJson(reader);
} else if ("relatedAnalyticRuleIds".equals(fieldName)) {
List relatedAnalyticRuleIds = reader.readArray(reader1 -> reader1.getString());
deserializedIncidentPropertiesInner.relatedAnalyticRuleIds = relatedAnalyticRuleIds;
} else if ("teamInformation".equals(fieldName)) {
deserializedIncidentPropertiesInner.teamInformation = TeamInformationInner.fromJson(reader);
} else {
reader.skipChildren();
}
}
return deserializedIncidentPropertiesInner;
});
}
}