com.azure.ai.metricsadvisor.implementation.models.AlertingResultQuery Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-ai-metricsadvisor Show documentation
Show all versions of azure-ai-metricsadvisor Show documentation
This package contains the Microsoft Azure Cognitive Services Metrics Advisor SDK.
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.ai.metricsadvisor.implementation.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;
import java.time.OffsetDateTime;
import java.time.format.DateTimeFormatter;
/**
* The AlertingResultQuery model.
*/
@Fluent
public final class AlertingResultQuery implements JsonSerializable {
/*
* start time
*/
private OffsetDateTime startTime;
/*
* end time
*/
private OffsetDateTime endTime;
/*
* time mode
*/
private TimeMode timeMode;
/**
* Creates an instance of AlertingResultQuery class.
*/
public AlertingResultQuery() {
}
/**
* Get the startTime property: start time.
*
* @return the startTime value.
*/
public OffsetDateTime getStartTime() {
return this.startTime;
}
/**
* Set the startTime property: start time.
*
* @param startTime the startTime value to set.
* @return the AlertingResultQuery object itself.
*/
public AlertingResultQuery setStartTime(OffsetDateTime startTime) {
this.startTime = startTime;
return this;
}
/**
* Get the endTime property: end time.
*
* @return the endTime value.
*/
public OffsetDateTime getEndTime() {
return this.endTime;
}
/**
* Set the endTime property: end time.
*
* @param endTime the endTime value to set.
* @return the AlertingResultQuery object itself.
*/
public AlertingResultQuery setEndTime(OffsetDateTime endTime) {
this.endTime = endTime;
return this;
}
/**
* Get the timeMode property: time mode.
*
* @return the timeMode value.
*/
public TimeMode getTimeMode() {
return this.timeMode;
}
/**
* Set the timeMode property: time mode.
*
* @param timeMode the timeMode value to set.
* @return the AlertingResultQuery object itself.
*/
public AlertingResultQuery setTimeMode(TimeMode timeMode) {
this.timeMode = timeMode;
return this;
}
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeStringField("startTime",
this.startTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.startTime));
jsonWriter.writeStringField("endTime",
this.endTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.endTime));
jsonWriter.writeStringField("timeMode", this.timeMode == null ? null : this.timeMode.toString());
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of AlertingResultQuery from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of AlertingResultQuery 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 AlertingResultQuery.
*/
public static AlertingResultQuery fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
AlertingResultQuery deserializedAlertingResultQuery = new AlertingResultQuery();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("startTime".equals(fieldName)) {
deserializedAlertingResultQuery.startTime
= reader.getNullable(nonNullReader -> OffsetDateTime.parse(nonNullReader.getString()));
} else if ("endTime".equals(fieldName)) {
deserializedAlertingResultQuery.endTime
= reader.getNullable(nonNullReader -> OffsetDateTime.parse(nonNullReader.getString()));
} else if ("timeMode".equals(fieldName)) {
deserializedAlertingResultQuery.timeMode = TimeMode.fromString(reader.getString());
} else {
reader.skipChildren();
}
}
return deserializedAlertingResultQuery;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy