com.azure.resourcemanager.security.models.NotificationsSourceAttackPath Maven / Gradle / Ivy
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.security.models;
import com.azure.core.annotation.Fluent;
import com.azure.json.JsonReader;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;
/**
* Attack path notification source.
*/
@Fluent
public final class NotificationsSourceAttackPath extends NotificationsSource {
/*
* The source type that will trigger the notification
*/
private SourceType sourceType = SourceType.ATTACK_PATH;
/*
* Defines the minimal attach path risk level which will be sent as email notifications
*/
private MinimalRiskLevel minimalRiskLevel;
/**
* Creates an instance of NotificationsSourceAttackPath class.
*/
public NotificationsSourceAttackPath() {
}
/**
* Get the sourceType property: The source type that will trigger the notification.
*
* @return the sourceType value.
*/
@Override
public SourceType sourceType() {
return this.sourceType;
}
/**
* Get the minimalRiskLevel property: Defines the minimal attach path risk level which will be sent as email
* notifications.
*
* @return the minimalRiskLevel value.
*/
public MinimalRiskLevel minimalRiskLevel() {
return this.minimalRiskLevel;
}
/**
* Set the minimalRiskLevel property: Defines the minimal attach path risk level which will be sent as email
* notifications.
*
* @param minimalRiskLevel the minimalRiskLevel value to set.
* @return the NotificationsSourceAttackPath object itself.
*/
public NotificationsSourceAttackPath withMinimalRiskLevel(MinimalRiskLevel minimalRiskLevel) {
this.minimalRiskLevel = minimalRiskLevel;
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
@Override
public void validate() {
}
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeStringField("sourceType", this.sourceType == null ? null : this.sourceType.toString());
jsonWriter.writeStringField("minimalRiskLevel",
this.minimalRiskLevel == null ? null : this.minimalRiskLevel.toString());
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of NotificationsSourceAttackPath from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of NotificationsSourceAttackPath 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 NotificationsSourceAttackPath.
*/
public static NotificationsSourceAttackPath fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
NotificationsSourceAttackPath deserializedNotificationsSourceAttackPath
= new NotificationsSourceAttackPath();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("sourceType".equals(fieldName)) {
deserializedNotificationsSourceAttackPath.sourceType = SourceType.fromString(reader.getString());
} else if ("minimalRiskLevel".equals(fieldName)) {
deserializedNotificationsSourceAttackPath.minimalRiskLevel
= MinimalRiskLevel.fromString(reader.getString());
} else {
reader.skipChildren();
}
}
return deserializedNotificationsSourceAttackPath;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy