com.azure.resourcemanager.securityinsights.models.AlertRuleTemplateWithMitreProperties 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.models;
import com.azure.core.annotation.Fluent;
import com.azure.core.util.CoreUtils;
import com.azure.json.JsonReader;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;
import java.time.OffsetDateTime;
import java.util.List;
/**
* Alert rule template with MITRE property bag.
*/
@Fluent
public class AlertRuleTemplateWithMitreProperties extends AlertRuleTemplatePropertiesBase {
/*
* The tactics of the alert rule
*/
private List tactics;
/*
* The techniques of the alert rule
*/
private List techniques;
/*
* The time that this alert rule template has been added.
*/
private OffsetDateTime createdDateUtc;
/*
* The last time that this alert rule template has been updated.
*/
private OffsetDateTime lastUpdatedDateUtc;
/**
* Creates an instance of AlertRuleTemplateWithMitreProperties class.
*/
public AlertRuleTemplateWithMitreProperties() {
}
/**
* Get the tactics property: The tactics of the alert rule.
*
* @return the tactics value.
*/
public List tactics() {
return this.tactics;
}
/**
* Set the tactics property: The tactics of the alert rule.
*
* @param tactics the tactics value to set.
* @return the AlertRuleTemplateWithMitreProperties object itself.
*/
public AlertRuleTemplateWithMitreProperties withTactics(List tactics) {
this.tactics = tactics;
return this;
}
/**
* Get the techniques property: The techniques of the alert rule.
*
* @return the techniques value.
*/
public List techniques() {
return this.techniques;
}
/**
* Set the techniques property: The techniques of the alert rule.
*
* @param techniques the techniques value to set.
* @return the AlertRuleTemplateWithMitreProperties object itself.
*/
public AlertRuleTemplateWithMitreProperties withTechniques(List techniques) {
this.techniques = techniques;
return this;
}
/**
* Get the createdDateUtc property: The time that this alert rule template has been added.
*
* @return the createdDateUtc value.
*/
@Override
public OffsetDateTime createdDateUtc() {
return this.createdDateUtc;
}
/**
* Get the lastUpdatedDateUtc property: The last time that this alert rule template has been updated.
*
* @return the lastUpdatedDateUtc value.
*/
@Override
public OffsetDateTime lastUpdatedDateUtc() {
return this.lastUpdatedDateUtc;
}
/**
* {@inheritDoc}
*/
@Override
public AlertRuleTemplateWithMitreProperties
withAlertRulesCreatedByTemplateCount(Integer alertRulesCreatedByTemplateCount) {
super.withAlertRulesCreatedByTemplateCount(alertRulesCreatedByTemplateCount);
return this;
}
/**
* {@inheritDoc}
*/
@Override
public AlertRuleTemplateWithMitreProperties withDescription(String description) {
super.withDescription(description);
return this;
}
/**
* {@inheritDoc}
*/
@Override
public AlertRuleTemplateWithMitreProperties withDisplayName(String displayName) {
super.withDisplayName(displayName);
return this;
}
/**
* {@inheritDoc}
*/
@Override
public AlertRuleTemplateWithMitreProperties
withRequiredDataConnectors(List requiredDataConnectors) {
super.withRequiredDataConnectors(requiredDataConnectors);
return this;
}
/**
* {@inheritDoc}
*/
@Override
public AlertRuleTemplateWithMitreProperties withStatus(TemplateStatus status) {
super.withStatus(status);
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
@Override
public void validate() {
if (requiredDataConnectors() != null) {
requiredDataConnectors().forEach(e -> e.validate());
}
}
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeNumberField("alertRulesCreatedByTemplateCount", alertRulesCreatedByTemplateCount());
jsonWriter.writeStringField("description", description());
jsonWriter.writeStringField("displayName", displayName());
jsonWriter.writeArrayField("requiredDataConnectors", requiredDataConnectors(),
(writer, element) -> writer.writeJson(element));
jsonWriter.writeStringField("status", status() == null ? null : status().toString());
jsonWriter.writeArrayField("tactics", this.tactics,
(writer, element) -> writer.writeString(element == null ? null : element.toString()));
jsonWriter.writeArrayField("techniques", this.techniques, (writer, element) -> writer.writeString(element));
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of AlertRuleTemplateWithMitreProperties from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of AlertRuleTemplateWithMitreProperties 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 AlertRuleTemplateWithMitreProperties.
*/
public static AlertRuleTemplateWithMitreProperties fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
AlertRuleTemplateWithMitreProperties deserializedAlertRuleTemplateWithMitreProperties
= new AlertRuleTemplateWithMitreProperties();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("alertRulesCreatedByTemplateCount".equals(fieldName)) {
deserializedAlertRuleTemplateWithMitreProperties
.withAlertRulesCreatedByTemplateCount(reader.getNullable(JsonReader::getInt));
} else if ("lastUpdatedDateUTC".equals(fieldName)) {
deserializedAlertRuleTemplateWithMitreProperties.lastUpdatedDateUtc = reader
.getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
} else if ("createdDateUTC".equals(fieldName)) {
deserializedAlertRuleTemplateWithMitreProperties.createdDateUtc = reader
.getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
} else if ("description".equals(fieldName)) {
deserializedAlertRuleTemplateWithMitreProperties.withDescription(reader.getString());
} else if ("displayName".equals(fieldName)) {
deserializedAlertRuleTemplateWithMitreProperties.withDisplayName(reader.getString());
} else if ("requiredDataConnectors".equals(fieldName)) {
List requiredDataConnectors
= reader.readArray(reader1 -> AlertRuleTemplateDataSource.fromJson(reader1));
deserializedAlertRuleTemplateWithMitreProperties.withRequiredDataConnectors(requiredDataConnectors);
} else if ("status".equals(fieldName)) {
deserializedAlertRuleTemplateWithMitreProperties
.withStatus(TemplateStatus.fromString(reader.getString()));
} else if ("tactics".equals(fieldName)) {
List tactics
= reader.readArray(reader1 -> AttackTactic.fromString(reader1.getString()));
deserializedAlertRuleTemplateWithMitreProperties.tactics = tactics;
} else if ("techniques".equals(fieldName)) {
List techniques = reader.readArray(reader1 -> reader1.getString());
deserializedAlertRuleTemplateWithMitreProperties.techniques = techniques;
} else {
reader.skipChildren();
}
}
return deserializedAlertRuleTemplateWithMitreProperties;
});
}
}