com.azure.resourcemanager.hdinsight.models.AutoscaleRecurrence Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-hdinsight Show documentation
Show all versions of azure-resourcemanager-hdinsight Show documentation
This package contains Microsoft Azure SDK for HDInsight Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. HDInsight Management Client. Package tag package-2024-08-preview.
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.hdinsight.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.util.List;
/**
* Schedule-based autoscale request parameters.
*/
@Fluent
public final class AutoscaleRecurrence implements JsonSerializable {
/*
* The time zone for the autoscale schedule times
*/
private String timeZone;
/*
* Array of schedule-based autoscale rules
*/
private List schedule;
/**
* Creates an instance of AutoscaleRecurrence class.
*/
public AutoscaleRecurrence() {
}
/**
* Get the timeZone property: The time zone for the autoscale schedule times.
*
* @return the timeZone value.
*/
public String timeZone() {
return this.timeZone;
}
/**
* Set the timeZone property: The time zone for the autoscale schedule times.
*
* @param timeZone the timeZone value to set.
* @return the AutoscaleRecurrence object itself.
*/
public AutoscaleRecurrence withTimeZone(String timeZone) {
this.timeZone = timeZone;
return this;
}
/**
* Get the schedule property: Array of schedule-based autoscale rules.
*
* @return the schedule value.
*/
public List schedule() {
return this.schedule;
}
/**
* Set the schedule property: Array of schedule-based autoscale rules.
*
* @param schedule the schedule value to set.
* @return the AutoscaleRecurrence object itself.
*/
public AutoscaleRecurrence withSchedule(List schedule) {
this.schedule = schedule;
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (schedule() != null) {
schedule().forEach(e -> e.validate());
}
}
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeStringField("timeZone", this.timeZone);
jsonWriter.writeArrayField("schedule", this.schedule, (writer, element) -> writer.writeJson(element));
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of AutoscaleRecurrence from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of AutoscaleRecurrence 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 AutoscaleRecurrence.
*/
public static AutoscaleRecurrence fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
AutoscaleRecurrence deserializedAutoscaleRecurrence = new AutoscaleRecurrence();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("timeZone".equals(fieldName)) {
deserializedAutoscaleRecurrence.timeZone = reader.getString();
} else if ("schedule".equals(fieldName)) {
List schedule = reader.readArray(reader1 -> AutoscaleSchedule.fromJson(reader1));
deserializedAutoscaleRecurrence.schedule = schedule;
} else {
reader.skipChildren();
}
}
return deserializedAutoscaleRecurrence;
});
}
}