
com.azure.resourcemanager.recoveryservices.models.MonitoringSettings 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.recoveryservices.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;
/**
* Monitoring Settings of the vault.
*/
@Fluent
public final class MonitoringSettings implements JsonSerializable {
/*
* Settings for Azure Monitor based alerts
*/
private AzureMonitorAlertSettings azureMonitorAlertSettings;
/*
* Settings for classic alerts
*/
private ClassicAlertSettings classicAlertSettings;
/**
* Creates an instance of MonitoringSettings class.
*/
public MonitoringSettings() {
}
/**
* Get the azureMonitorAlertSettings property: Settings for Azure Monitor based alerts.
*
* @return the azureMonitorAlertSettings value.
*/
public AzureMonitorAlertSettings azureMonitorAlertSettings() {
return this.azureMonitorAlertSettings;
}
/**
* Set the azureMonitorAlertSettings property: Settings for Azure Monitor based alerts.
*
* @param azureMonitorAlertSettings the azureMonitorAlertSettings value to set.
* @return the MonitoringSettings object itself.
*/
public MonitoringSettings withAzureMonitorAlertSettings(AzureMonitorAlertSettings azureMonitorAlertSettings) {
this.azureMonitorAlertSettings = azureMonitorAlertSettings;
return this;
}
/**
* Get the classicAlertSettings property: Settings for classic alerts.
*
* @return the classicAlertSettings value.
*/
public ClassicAlertSettings classicAlertSettings() {
return this.classicAlertSettings;
}
/**
* Set the classicAlertSettings property: Settings for classic alerts.
*
* @param classicAlertSettings the classicAlertSettings value to set.
* @return the MonitoringSettings object itself.
*/
public MonitoringSettings withClassicAlertSettings(ClassicAlertSettings classicAlertSettings) {
this.classicAlertSettings = classicAlertSettings;
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (azureMonitorAlertSettings() != null) {
azureMonitorAlertSettings().validate();
}
if (classicAlertSettings() != null) {
classicAlertSettings().validate();
}
}
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeJsonField("azureMonitorAlertSettings", this.azureMonitorAlertSettings);
jsonWriter.writeJsonField("classicAlertSettings", this.classicAlertSettings);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of MonitoringSettings from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of MonitoringSettings 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 MonitoringSettings.
*/
public static MonitoringSettings fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
MonitoringSettings deserializedMonitoringSettings = new MonitoringSettings();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("azureMonitorAlertSettings".equals(fieldName)) {
deserializedMonitoringSettings.azureMonitorAlertSettings
= AzureMonitorAlertSettings.fromJson(reader);
} else if ("classicAlertSettings".equals(fieldName)) {
deserializedMonitoringSettings.classicAlertSettings = ClassicAlertSettings.fromJson(reader);
} else {
reader.skipChildren();
}
}
return deserializedMonitoringSettings;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy