com.azure.resourcemanager.automation.fluent.models.ScheduleProperties Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-automation Show documentation
Show all versions of azure-resourcemanager-automation Show documentation
This package contains Microsoft Azure SDK for Automation Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Automation Client. Package tag package-2022-02-22.
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.automation.fluent.models;
import com.azure.core.annotation.Fluent;
import com.azure.core.util.CoreUtils;
import com.azure.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import com.azure.resourcemanager.automation.models.AdvancedSchedule;
import com.azure.resourcemanager.automation.models.ScheduleFrequency;
import java.io.IOException;
import java.time.OffsetDateTime;
import java.time.format.DateTimeFormatter;
/**
* Definition of schedule parameters.
*/
@Fluent
public final class ScheduleProperties implements JsonSerializable {
/*
* Gets or sets the start time of the schedule.
*/
private OffsetDateTime startTime;
/*
* Gets the start time's offset in minutes.
*/
private Double startTimeOffsetMinutes;
/*
* Gets or sets the end time of the schedule.
*/
private OffsetDateTime expiryTime;
/*
* Gets or sets the expiry time's offset in minutes.
*/
private Double expiryTimeOffsetMinutes;
/*
* Gets or sets a value indicating whether this schedule is enabled.
*/
private Boolean isEnabled;
/*
* Gets or sets the next run time of the schedule.
*/
private OffsetDateTime nextRun;
/*
* Gets or sets the next run time's offset in minutes.
*/
private Double nextRunOffsetMinutes;
/*
* Gets or sets the interval of the schedule.
*/
private Object interval;
/*
* Gets or sets the frequency of the schedule.
*/
private ScheduleFrequency frequency;
/*
* Gets or sets the time zone of the schedule.
*/
private String timeZone;
/*
* Gets or sets the advanced schedule.
*/
private AdvancedSchedule advancedSchedule;
/*
* Gets or sets the creation time.
*/
private OffsetDateTime creationTime;
/*
* Gets or sets the last modified time.
*/
private OffsetDateTime lastModifiedTime;
/*
* Gets or sets the description.
*/
private String description;
/**
* Creates an instance of ScheduleProperties class.
*/
public ScheduleProperties() {
}
/**
* Get the startTime property: Gets or sets the start time of the schedule.
*
* @return the startTime value.
*/
public OffsetDateTime startTime() {
return this.startTime;
}
/**
* Set the startTime property: Gets or sets the start time of the schedule.
*
* @param startTime the startTime value to set.
* @return the ScheduleProperties object itself.
*/
public ScheduleProperties withStartTime(OffsetDateTime startTime) {
this.startTime = startTime;
return this;
}
/**
* Get the startTimeOffsetMinutes property: Gets the start time's offset in minutes.
*
* @return the startTimeOffsetMinutes value.
*/
public Double startTimeOffsetMinutes() {
return this.startTimeOffsetMinutes;
}
/**
* Get the expiryTime property: Gets or sets the end time of the schedule.
*
* @return the expiryTime value.
*/
public OffsetDateTime expiryTime() {
return this.expiryTime;
}
/**
* Set the expiryTime property: Gets or sets the end time of the schedule.
*
* @param expiryTime the expiryTime value to set.
* @return the ScheduleProperties object itself.
*/
public ScheduleProperties withExpiryTime(OffsetDateTime expiryTime) {
this.expiryTime = expiryTime;
return this;
}
/**
* Get the expiryTimeOffsetMinutes property: Gets or sets the expiry time's offset in minutes.
*
* @return the expiryTimeOffsetMinutes value.
*/
public Double expiryTimeOffsetMinutes() {
return this.expiryTimeOffsetMinutes;
}
/**
* Set the expiryTimeOffsetMinutes property: Gets or sets the expiry time's offset in minutes.
*
* @param expiryTimeOffsetMinutes the expiryTimeOffsetMinutes value to set.
* @return the ScheduleProperties object itself.
*/
public ScheduleProperties withExpiryTimeOffsetMinutes(Double expiryTimeOffsetMinutes) {
this.expiryTimeOffsetMinutes = expiryTimeOffsetMinutes;
return this;
}
/**
* Get the isEnabled property: Gets or sets a value indicating whether this schedule is enabled.
*
* @return the isEnabled value.
*/
public Boolean isEnabled() {
return this.isEnabled;
}
/**
* Set the isEnabled property: Gets or sets a value indicating whether this schedule is enabled.
*
* @param isEnabled the isEnabled value to set.
* @return the ScheduleProperties object itself.
*/
public ScheduleProperties withIsEnabled(Boolean isEnabled) {
this.isEnabled = isEnabled;
return this;
}
/**
* Get the nextRun property: Gets or sets the next run time of the schedule.
*
* @return the nextRun value.
*/
public OffsetDateTime nextRun() {
return this.nextRun;
}
/**
* Set the nextRun property: Gets or sets the next run time of the schedule.
*
* @param nextRun the nextRun value to set.
* @return the ScheduleProperties object itself.
*/
public ScheduleProperties withNextRun(OffsetDateTime nextRun) {
this.nextRun = nextRun;
return this;
}
/**
* Get the nextRunOffsetMinutes property: Gets or sets the next run time's offset in minutes.
*
* @return the nextRunOffsetMinutes value.
*/
public Double nextRunOffsetMinutes() {
return this.nextRunOffsetMinutes;
}
/**
* Set the nextRunOffsetMinutes property: Gets or sets the next run time's offset in minutes.
*
* @param nextRunOffsetMinutes the nextRunOffsetMinutes value to set.
* @return the ScheduleProperties object itself.
*/
public ScheduleProperties withNextRunOffsetMinutes(Double nextRunOffsetMinutes) {
this.nextRunOffsetMinutes = nextRunOffsetMinutes;
return this;
}
/**
* Get the interval property: Gets or sets the interval of the schedule.
*
* @return the interval value.
*/
public Object interval() {
return this.interval;
}
/**
* Set the interval property: Gets or sets the interval of the schedule.
*
* @param interval the interval value to set.
* @return the ScheduleProperties object itself.
*/
public ScheduleProperties withInterval(Object interval) {
this.interval = interval;
return this;
}
/**
* Get the frequency property: Gets or sets the frequency of the schedule.
*
* @return the frequency value.
*/
public ScheduleFrequency frequency() {
return this.frequency;
}
/**
* Set the frequency property: Gets or sets the frequency of the schedule.
*
* @param frequency the frequency value to set.
* @return the ScheduleProperties object itself.
*/
public ScheduleProperties withFrequency(ScheduleFrequency frequency) {
this.frequency = frequency;
return this;
}
/**
* Get the timeZone property: Gets or sets the time zone of the schedule.
*
* @return the timeZone value.
*/
public String timeZone() {
return this.timeZone;
}
/**
* Set the timeZone property: Gets or sets the time zone of the schedule.
*
* @param timeZone the timeZone value to set.
* @return the ScheduleProperties object itself.
*/
public ScheduleProperties withTimeZone(String timeZone) {
this.timeZone = timeZone;
return this;
}
/**
* Get the advancedSchedule property: Gets or sets the advanced schedule.
*
* @return the advancedSchedule value.
*/
public AdvancedSchedule advancedSchedule() {
return this.advancedSchedule;
}
/**
* Set the advancedSchedule property: Gets or sets the advanced schedule.
*
* @param advancedSchedule the advancedSchedule value to set.
* @return the ScheduleProperties object itself.
*/
public ScheduleProperties withAdvancedSchedule(AdvancedSchedule advancedSchedule) {
this.advancedSchedule = advancedSchedule;
return this;
}
/**
* Get the creationTime property: Gets or sets the creation time.
*
* @return the creationTime value.
*/
public OffsetDateTime creationTime() {
return this.creationTime;
}
/**
* Set the creationTime property: Gets or sets the creation time.
*
* @param creationTime the creationTime value to set.
* @return the ScheduleProperties object itself.
*/
public ScheduleProperties withCreationTime(OffsetDateTime creationTime) {
this.creationTime = creationTime;
return this;
}
/**
* Get the lastModifiedTime property: Gets or sets the last modified time.
*
* @return the lastModifiedTime value.
*/
public OffsetDateTime lastModifiedTime() {
return this.lastModifiedTime;
}
/**
* Set the lastModifiedTime property: Gets or sets the last modified time.
*
* @param lastModifiedTime the lastModifiedTime value to set.
* @return the ScheduleProperties object itself.
*/
public ScheduleProperties withLastModifiedTime(OffsetDateTime lastModifiedTime) {
this.lastModifiedTime = lastModifiedTime;
return this;
}
/**
* Get the description property: Gets or sets the description.
*
* @return the description value.
*/
public String description() {
return this.description;
}
/**
* Set the description property: Gets or sets the description.
*
* @param description the description value to set.
* @return the ScheduleProperties object itself.
*/
public ScheduleProperties withDescription(String description) {
this.description = description;
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (advancedSchedule() != null) {
advancedSchedule().validate();
}
}
/**
* {@inheritDoc}
*/
@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("expiryTime",
this.expiryTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.expiryTime));
jsonWriter.writeNumberField("expiryTimeOffsetMinutes", this.expiryTimeOffsetMinutes);
jsonWriter.writeBooleanField("isEnabled", this.isEnabled);
jsonWriter.writeStringField("nextRun",
this.nextRun == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.nextRun));
jsonWriter.writeNumberField("nextRunOffsetMinutes", this.nextRunOffsetMinutes);
jsonWriter.writeUntypedField("interval", this.interval);
jsonWriter.writeStringField("frequency", this.frequency == null ? null : this.frequency.toString());
jsonWriter.writeStringField("timeZone", this.timeZone);
jsonWriter.writeJsonField("advancedSchedule", this.advancedSchedule);
jsonWriter.writeStringField("creationTime",
this.creationTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.creationTime));
jsonWriter.writeStringField("lastModifiedTime",
this.lastModifiedTime == null
? null
: DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.lastModifiedTime));
jsonWriter.writeStringField("description", this.description);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of ScheduleProperties from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of ScheduleProperties 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 ScheduleProperties.
*/
public static ScheduleProperties fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
ScheduleProperties deserializedScheduleProperties = new ScheduleProperties();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("startTime".equals(fieldName)) {
deserializedScheduleProperties.startTime = reader
.getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
} else if ("startTimeOffsetMinutes".equals(fieldName)) {
deserializedScheduleProperties.startTimeOffsetMinutes = reader.getNullable(JsonReader::getDouble);
} else if ("expiryTime".equals(fieldName)) {
deserializedScheduleProperties.expiryTime = reader
.getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
} else if ("expiryTimeOffsetMinutes".equals(fieldName)) {
deserializedScheduleProperties.expiryTimeOffsetMinutes = reader.getNullable(JsonReader::getDouble);
} else if ("isEnabled".equals(fieldName)) {
deserializedScheduleProperties.isEnabled = reader.getNullable(JsonReader::getBoolean);
} else if ("nextRun".equals(fieldName)) {
deserializedScheduleProperties.nextRun = reader
.getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
} else if ("nextRunOffsetMinutes".equals(fieldName)) {
deserializedScheduleProperties.nextRunOffsetMinutes = reader.getNullable(JsonReader::getDouble);
} else if ("interval".equals(fieldName)) {
deserializedScheduleProperties.interval = reader.readUntyped();
} else if ("frequency".equals(fieldName)) {
deserializedScheduleProperties.frequency = ScheduleFrequency.fromString(reader.getString());
} else if ("timeZone".equals(fieldName)) {
deserializedScheduleProperties.timeZone = reader.getString();
} else if ("advancedSchedule".equals(fieldName)) {
deserializedScheduleProperties.advancedSchedule = AdvancedSchedule.fromJson(reader);
} else if ("creationTime".equals(fieldName)) {
deserializedScheduleProperties.creationTime = reader
.getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
} else if ("lastModifiedTime".equals(fieldName)) {
deserializedScheduleProperties.lastModifiedTime = reader
.getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
} else if ("description".equals(fieldName)) {
deserializedScheduleProperties.description = reader.getString();
} else {
reader.skipChildren();
}
}
return deserializedScheduleProperties;
});
}
}