
com.azure.resourcemanager.logz.fluent.models.MonitoredResourceInner 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.logz.fluent.models;
import com.azure.core.annotation.Fluent;
import com.azure.core.management.SystemData;
import com.azure.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;
/**
* The properties of a resource currently being monitored by the Logz monitor resource.
*/
@Fluent
public final class MonitoredResourceInner implements JsonSerializable {
/*
* The ARM id of the resource.
*/
private String id;
/*
* Flag indicating if resource is sending metrics to Logz.
*/
private Boolean sendingMetrics;
/*
* Reason for why the resource is sending metrics (or why it is not sending).
*/
private String reasonForMetricsStatus;
/*
* Flag indicating if resource is sending logs to Logz.
*/
private Boolean sendingLogs;
/*
* Metadata pertaining to creation and last modification of the resource.
*/
private SystemData systemData;
/*
* Reason for why the resource is sending logs (or why it is not sending).
*/
private String reasonForLogsStatus;
/**
* Creates an instance of MonitoredResourceInner class.
*/
public MonitoredResourceInner() {
}
/**
* Get the id property: The ARM id of the resource.
*
* @return the id value.
*/
public String id() {
return this.id;
}
/**
* Set the id property: The ARM id of the resource.
*
* @param id the id value to set.
* @return the MonitoredResourceInner object itself.
*/
public MonitoredResourceInner withId(String id) {
this.id = id;
return this;
}
/**
* Get the sendingMetrics property: Flag indicating if resource is sending metrics to Logz.
*
* @return the sendingMetrics value.
*/
public Boolean sendingMetrics() {
return this.sendingMetrics;
}
/**
* Set the sendingMetrics property: Flag indicating if resource is sending metrics to Logz.
*
* @param sendingMetrics the sendingMetrics value to set.
* @return the MonitoredResourceInner object itself.
*/
public MonitoredResourceInner withSendingMetrics(Boolean sendingMetrics) {
this.sendingMetrics = sendingMetrics;
return this;
}
/**
* Get the reasonForMetricsStatus property: Reason for why the resource is sending metrics (or why it is not
* sending).
*
* @return the reasonForMetricsStatus value.
*/
public String reasonForMetricsStatus() {
return this.reasonForMetricsStatus;
}
/**
* Set the reasonForMetricsStatus property: Reason for why the resource is sending metrics (or why it is not
* sending).
*
* @param reasonForMetricsStatus the reasonForMetricsStatus value to set.
* @return the MonitoredResourceInner object itself.
*/
public MonitoredResourceInner withReasonForMetricsStatus(String reasonForMetricsStatus) {
this.reasonForMetricsStatus = reasonForMetricsStatus;
return this;
}
/**
* Get the sendingLogs property: Flag indicating if resource is sending logs to Logz.
*
* @return the sendingLogs value.
*/
public Boolean sendingLogs() {
return this.sendingLogs;
}
/**
* Set the sendingLogs property: Flag indicating if resource is sending logs to Logz.
*
* @param sendingLogs the sendingLogs value to set.
* @return the MonitoredResourceInner object itself.
*/
public MonitoredResourceInner withSendingLogs(Boolean sendingLogs) {
this.sendingLogs = sendingLogs;
return this;
}
/**
* Get the systemData property: Metadata pertaining to creation and last modification of the resource.
*
* @return the systemData value.
*/
public SystemData systemData() {
return this.systemData;
}
/**
* Get the reasonForLogsStatus property: Reason for why the resource is sending logs (or why it is not sending).
*
* @return the reasonForLogsStatus value.
*/
public String reasonForLogsStatus() {
return this.reasonForLogsStatus;
}
/**
* Set the reasonForLogsStatus property: Reason for why the resource is sending logs (or why it is not sending).
*
* @param reasonForLogsStatus the reasonForLogsStatus value to set.
* @return the MonitoredResourceInner object itself.
*/
public MonitoredResourceInner withReasonForLogsStatus(String reasonForLogsStatus) {
this.reasonForLogsStatus = reasonForLogsStatus;
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("id", this.id);
jsonWriter.writeBooleanField("sendingMetrics", this.sendingMetrics);
jsonWriter.writeStringField("reasonForMetricsStatus", this.reasonForMetricsStatus);
jsonWriter.writeBooleanField("sendingLogs", this.sendingLogs);
jsonWriter.writeStringField("reasonForLogsStatus", this.reasonForLogsStatus);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of MonitoredResourceInner from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of MonitoredResourceInner 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 MonitoredResourceInner.
*/
public static MonitoredResourceInner fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
MonitoredResourceInner deserializedMonitoredResourceInner = new MonitoredResourceInner();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("id".equals(fieldName)) {
deserializedMonitoredResourceInner.id = reader.getString();
} else if ("sendingMetrics".equals(fieldName)) {
deserializedMonitoredResourceInner.sendingMetrics = reader.getNullable(JsonReader::getBoolean);
} else if ("reasonForMetricsStatus".equals(fieldName)) {
deserializedMonitoredResourceInner.reasonForMetricsStatus = reader.getString();
} else if ("sendingLogs".equals(fieldName)) {
deserializedMonitoredResourceInner.sendingLogs = reader.getNullable(JsonReader::getBoolean);
} else if ("systemData".equals(fieldName)) {
deserializedMonitoredResourceInner.systemData = SystemData.fromJson(reader);
} else if ("reasonForLogsStatus".equals(fieldName)) {
deserializedMonitoredResourceInner.reasonForLogsStatus = reader.getString();
} else {
reader.skipChildren();
}
}
return deserializedMonitoredResourceInner;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy