
com.azure.resourcemanager.devcenter.fluent.models.ScheduleUpdateProperties 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.devcenter.fluent.models;
import com.azure.core.annotation.Fluent;
import com.azure.json.JsonReader;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import com.azure.resourcemanager.devcenter.models.ScheduleEnableStatus;
import com.azure.resourcemanager.devcenter.models.ScheduledFrequency;
import com.azure.resourcemanager.devcenter.models.ScheduledType;
import com.azure.resourcemanager.devcenter.models.TrackedResourceUpdate;
import java.io.IOException;
import java.util.Map;
/**
* Updatable properties of a Schedule.
*/
@Fluent
public class ScheduleUpdateProperties extends TrackedResourceUpdate {
/*
* Supported type this scheduled task represents.
*/
private ScheduledType type;
/*
* The frequency of this scheduled task.
*/
private ScheduledFrequency frequency;
/*
* The target time to trigger the action. The format is HH:MM.
*/
private String time;
/*
* The IANA timezone id at which the schedule should execute.
*/
private String timeZone;
/*
* Indicates whether or not this scheduled task is enabled.
*/
private ScheduleEnableStatus state;
/**
* Creates an instance of ScheduleUpdateProperties class.
*/
public ScheduleUpdateProperties() {
}
/**
* Get the type property: Supported type this scheduled task represents.
*
* @return the type value.
*/
public ScheduledType type() {
return this.type;
}
/**
* Set the type property: Supported type this scheduled task represents.
*
* @param type the type value to set.
* @return the ScheduleUpdateProperties object itself.
*/
public ScheduleUpdateProperties withType(ScheduledType type) {
this.type = type;
return this;
}
/**
* Get the frequency property: The frequency of this scheduled task.
*
* @return the frequency value.
*/
public ScheduledFrequency frequency() {
return this.frequency;
}
/**
* Set the frequency property: The frequency of this scheduled task.
*
* @param frequency the frequency value to set.
* @return the ScheduleUpdateProperties object itself.
*/
public ScheduleUpdateProperties withFrequency(ScheduledFrequency frequency) {
this.frequency = frequency;
return this;
}
/**
* Get the time property: The target time to trigger the action. The format is HH:MM.
*
* @return the time value.
*/
public String time() {
return this.time;
}
/**
* Set the time property: The target time to trigger the action. The format is HH:MM.
*
* @param time the time value to set.
* @return the ScheduleUpdateProperties object itself.
*/
public ScheduleUpdateProperties withTime(String time) {
this.time = time;
return this;
}
/**
* Get the timeZone property: The IANA timezone id at which the schedule should execute.
*
* @return the timeZone value.
*/
public String timeZone() {
return this.timeZone;
}
/**
* Set the timeZone property: The IANA timezone id at which the schedule should execute.
*
* @param timeZone the timeZone value to set.
* @return the ScheduleUpdateProperties object itself.
*/
public ScheduleUpdateProperties withTimeZone(String timeZone) {
this.timeZone = timeZone;
return this;
}
/**
* Get the state property: Indicates whether or not this scheduled task is enabled.
*
* @return the state value.
*/
public ScheduleEnableStatus state() {
return this.state;
}
/**
* Set the state property: Indicates whether or not this scheduled task is enabled.
*
* @param state the state value to set.
* @return the ScheduleUpdateProperties object itself.
*/
public ScheduleUpdateProperties withState(ScheduleEnableStatus state) {
this.state = state;
return this;
}
/**
* {@inheritDoc}
*/
@Override
public ScheduleUpdateProperties withTags(Map tags) {
super.withTags(tags);
return this;
}
/**
* {@inheritDoc}
*/
@Override
public ScheduleUpdateProperties withLocation(String location) {
super.withLocation(location);
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.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element));
jsonWriter.writeStringField("location", location());
jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString());
jsonWriter.writeStringField("frequency", this.frequency == null ? null : this.frequency.toString());
jsonWriter.writeStringField("time", this.time);
jsonWriter.writeStringField("timeZone", this.timeZone);
jsonWriter.writeStringField("state", this.state == null ? null : this.state.toString());
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of ScheduleUpdateProperties from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of ScheduleUpdateProperties 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 ScheduleUpdateProperties.
*/
public static ScheduleUpdateProperties fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
ScheduleUpdateProperties deserializedScheduleUpdateProperties = new ScheduleUpdateProperties();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("tags".equals(fieldName)) {
Map tags = reader.readMap(reader1 -> reader1.getString());
deserializedScheduleUpdateProperties.withTags(tags);
} else if ("location".equals(fieldName)) {
deserializedScheduleUpdateProperties.withLocation(reader.getString());
} else if ("type".equals(fieldName)) {
deserializedScheduleUpdateProperties.type = ScheduledType.fromString(reader.getString());
} else if ("frequency".equals(fieldName)) {
deserializedScheduleUpdateProperties.frequency = ScheduledFrequency.fromString(reader.getString());
} else if ("time".equals(fieldName)) {
deserializedScheduleUpdateProperties.time = reader.getString();
} else if ("timeZone".equals(fieldName)) {
deserializedScheduleUpdateProperties.timeZone = reader.getString();
} else if ("state".equals(fieldName)) {
deserializedScheduleUpdateProperties.state = ScheduleEnableStatus.fromString(reader.getString());
} else {
reader.skipChildren();
}
}
return deserializedScheduleUpdateProperties;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy