![JAR search and dependency download from the Maven repository](/logo.png)
com.azure.resourcemanager.desktopvirtualization.models.AgentUpdatePatchProperties Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-desktopvirtualization Show documentation
Show all versions of azure-resourcemanager-desktopvirtualization Show documentation
This package contains Microsoft Azure SDK for DesktopVirtualization Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Package tag package-2024-04.
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.desktopvirtualization.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;
/**
* The session host configuration for updating agent, monitoring agent, and stack component.
*/
@Fluent
public final class AgentUpdatePatchProperties implements JsonSerializable {
/*
* The type of maintenance for session host components.
*/
private SessionHostComponentUpdateType type;
/*
* Whether to use localTime of the virtual machine.
*/
private Boolean useSessionHostLocalTime;
/*
* Time zone for maintenance as defined in
* https://docs.microsoft.com/en-us/dotnet/api/system.timezoneinfo.findsystemtimezonebyid?view=net-5.0. Must be set
* if useLocalTime is true.
*/
private String maintenanceWindowTimeZone;
/*
* List of maintenance windows. Maintenance windows are 2 hours long.
*/
private List maintenanceWindows;
/**
* Creates an instance of AgentUpdatePatchProperties class.
*/
public AgentUpdatePatchProperties() {
}
/**
* Get the type property: The type of maintenance for session host components.
*
* @return the type value.
*/
public SessionHostComponentUpdateType type() {
return this.type;
}
/**
* Set the type property: The type of maintenance for session host components.
*
* @param type the type value to set.
* @return the AgentUpdatePatchProperties object itself.
*/
public AgentUpdatePatchProperties withType(SessionHostComponentUpdateType type) {
this.type = type;
return this;
}
/**
* Get the useSessionHostLocalTime property: Whether to use localTime of the virtual machine.
*
* @return the useSessionHostLocalTime value.
*/
public Boolean useSessionHostLocalTime() {
return this.useSessionHostLocalTime;
}
/**
* Set the useSessionHostLocalTime property: Whether to use localTime of the virtual machine.
*
* @param useSessionHostLocalTime the useSessionHostLocalTime value to set.
* @return the AgentUpdatePatchProperties object itself.
*/
public AgentUpdatePatchProperties withUseSessionHostLocalTime(Boolean useSessionHostLocalTime) {
this.useSessionHostLocalTime = useSessionHostLocalTime;
return this;
}
/**
* Get the maintenanceWindowTimeZone property: Time zone for maintenance as defined in
* https://docs.microsoft.com/en-us/dotnet/api/system.timezoneinfo.findsystemtimezonebyid?view=net-5.0. Must be set
* if useLocalTime is true.
*
* @return the maintenanceWindowTimeZone value.
*/
public String maintenanceWindowTimeZone() {
return this.maintenanceWindowTimeZone;
}
/**
* Set the maintenanceWindowTimeZone property: Time zone for maintenance as defined in
* https://docs.microsoft.com/en-us/dotnet/api/system.timezoneinfo.findsystemtimezonebyid?view=net-5.0. Must be set
* if useLocalTime is true.
*
* @param maintenanceWindowTimeZone the maintenanceWindowTimeZone value to set.
* @return the AgentUpdatePatchProperties object itself.
*/
public AgentUpdatePatchProperties withMaintenanceWindowTimeZone(String maintenanceWindowTimeZone) {
this.maintenanceWindowTimeZone = maintenanceWindowTimeZone;
return this;
}
/**
* Get the maintenanceWindows property: List of maintenance windows. Maintenance windows are 2 hours long.
*
* @return the maintenanceWindows value.
*/
public List maintenanceWindows() {
return this.maintenanceWindows;
}
/**
* Set the maintenanceWindows property: List of maintenance windows. Maintenance windows are 2 hours long.
*
* @param maintenanceWindows the maintenanceWindows value to set.
* @return the AgentUpdatePatchProperties object itself.
*/
public AgentUpdatePatchProperties
withMaintenanceWindows(List maintenanceWindows) {
this.maintenanceWindows = maintenanceWindows;
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (maintenanceWindows() != null) {
maintenanceWindows().forEach(e -> e.validate());
}
}
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString());
jsonWriter.writeBooleanField("useSessionHostLocalTime", this.useSessionHostLocalTime);
jsonWriter.writeStringField("maintenanceWindowTimeZone", this.maintenanceWindowTimeZone);
jsonWriter.writeArrayField("maintenanceWindows", this.maintenanceWindows,
(writer, element) -> writer.writeJson(element));
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of AgentUpdatePatchProperties from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of AgentUpdatePatchProperties 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 AgentUpdatePatchProperties.
*/
public static AgentUpdatePatchProperties fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
AgentUpdatePatchProperties deserializedAgentUpdatePatchProperties = new AgentUpdatePatchProperties();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("type".equals(fieldName)) {
deserializedAgentUpdatePatchProperties.type
= SessionHostComponentUpdateType.fromString(reader.getString());
} else if ("useSessionHostLocalTime".equals(fieldName)) {
deserializedAgentUpdatePatchProperties.useSessionHostLocalTime
= reader.getNullable(JsonReader::getBoolean);
} else if ("maintenanceWindowTimeZone".equals(fieldName)) {
deserializedAgentUpdatePatchProperties.maintenanceWindowTimeZone = reader.getString();
} else if ("maintenanceWindows".equals(fieldName)) {
List maintenanceWindows
= reader.readArray(reader1 -> MaintenanceWindowPatchProperties.fromJson(reader1));
deserializedAgentUpdatePatchProperties.maintenanceWindows = maintenanceWindows;
} else {
reader.skipChildren();
}
}
return deserializedAgentUpdatePatchProperties;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy