com.azure.resourcemanager.compute.models.WindowsConfiguration Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-compute Show documentation
Show all versions of azure-resourcemanager-compute Show documentation
This package contains Microsoft Azure Compute Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.compute.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;
/**
* Specifies Windows operating system settings on the virtual machine.
*/
@Fluent
public final class WindowsConfiguration implements JsonSerializable {
/*
* Indicates whether virtual machine agent should be provisioned on the virtual machine. When this property is not
* specified in the request body, it is set to true by default. This will ensure that VM Agent is installed on the
* VM so that extensions can be added to the VM later.
*/
private Boolean provisionVMAgent;
/*
* Indicates whether Automatic Updates is enabled for the Windows virtual machine. Default value is true. For
* virtual machine scale sets, this property can be updated and updates will take effect on OS reprovisioning.
*/
private Boolean enableAutomaticUpdates;
/*
* Specifies the time zone of the virtual machine. e.g. "Pacific Standard Time". Possible values can be
* [TimeZoneInfo.Id](https://docs.microsoft.com/dotnet/api/system.timezoneinfo.id?#System_TimeZoneInfo_Id) value
* from time zones returned by
* [TimeZoneInfo.GetSystemTimeZones](https://docs.microsoft.com/dotnet/api/system.timezoneinfo.getsystemtimezones).
*/
private String timeZone;
/*
* Specifies additional base-64 encoded XML formatted information that can be included in the Unattend.xml file,
* which is used by Windows Setup.
*/
private List additionalUnattendContent;
/*
* [Preview Feature] Specifies settings related to VM Guest Patching on Windows.
*/
private PatchSettings patchSettings;
/*
* Specifies the Windows Remote Management listeners. This enables remote Windows PowerShell.
*/
private WinRMConfiguration winRM;
/*
* Indicates whether VMAgent Platform Updates are enabled for the Windows Virtual Machine.
*/
private Boolean enableVMAgentPlatformUpdates;
/**
* Creates an instance of WindowsConfiguration class.
*/
public WindowsConfiguration() {
}
/**
* Get the provisionVMAgent property: Indicates whether virtual machine agent should be provisioned on the virtual
* machine. When this property is not specified in the request body, it is set to true by default. This will ensure
* that VM Agent is installed on the VM so that extensions can be added to the VM later.
*
* @return the provisionVMAgent value.
*/
public Boolean provisionVMAgent() {
return this.provisionVMAgent;
}
/**
* Set the provisionVMAgent property: Indicates whether virtual machine agent should be provisioned on the virtual
* machine. When this property is not specified in the request body, it is set to true by default. This will ensure
* that VM Agent is installed on the VM so that extensions can be added to the VM later.
*
* @param provisionVMAgent the provisionVMAgent value to set.
* @return the WindowsConfiguration object itself.
*/
public WindowsConfiguration withProvisionVMAgent(Boolean provisionVMAgent) {
this.provisionVMAgent = provisionVMAgent;
return this;
}
/**
* Get the enableAutomaticUpdates property: Indicates whether Automatic Updates is enabled for the Windows virtual
* machine. Default value is true. For virtual machine scale sets, this property can be updated and updates will
* take effect on OS reprovisioning.
*
* @return the enableAutomaticUpdates value.
*/
public Boolean enableAutomaticUpdates() {
return this.enableAutomaticUpdates;
}
/**
* Set the enableAutomaticUpdates property: Indicates whether Automatic Updates is enabled for the Windows virtual
* machine. Default value is true. For virtual machine scale sets, this property can be updated and updates will
* take effect on OS reprovisioning.
*
* @param enableAutomaticUpdates the enableAutomaticUpdates value to set.
* @return the WindowsConfiguration object itself.
*/
public WindowsConfiguration withEnableAutomaticUpdates(Boolean enableAutomaticUpdates) {
this.enableAutomaticUpdates = enableAutomaticUpdates;
return this;
}
/**
* Get the timeZone property: Specifies the time zone of the virtual machine. e.g. "Pacific Standard Time". Possible
* values can be
* [TimeZoneInfo.Id](https://docs.microsoft.com/dotnet/api/system.timezoneinfo.id?#System_TimeZoneInfo_Id) value
* from time zones returned by
* [TimeZoneInfo.GetSystemTimeZones](https://docs.microsoft.com/dotnet/api/system.timezoneinfo.getsystemtimezones).
*
* @return the timeZone value.
*/
public String timeZone() {
return this.timeZone;
}
/**
* Set the timeZone property: Specifies the time zone of the virtual machine. e.g. "Pacific Standard Time". Possible
* values can be
* [TimeZoneInfo.Id](https://docs.microsoft.com/dotnet/api/system.timezoneinfo.id?#System_TimeZoneInfo_Id) value
* from time zones returned by
* [TimeZoneInfo.GetSystemTimeZones](https://docs.microsoft.com/dotnet/api/system.timezoneinfo.getsystemtimezones).
*
* @param timeZone the timeZone value to set.
* @return the WindowsConfiguration object itself.
*/
public WindowsConfiguration withTimeZone(String timeZone) {
this.timeZone = timeZone;
return this;
}
/**
* Get the additionalUnattendContent property: Specifies additional base-64 encoded XML formatted information that
* can be included in the Unattend.xml file, which is used by Windows Setup.
*
* @return the additionalUnattendContent value.
*/
public List additionalUnattendContent() {
return this.additionalUnattendContent;
}
/**
* Set the additionalUnattendContent property: Specifies additional base-64 encoded XML formatted information that
* can be included in the Unattend.xml file, which is used by Windows Setup.
*
* @param additionalUnattendContent the additionalUnattendContent value to set.
* @return the WindowsConfiguration object itself.
*/
public WindowsConfiguration
withAdditionalUnattendContent(List additionalUnattendContent) {
this.additionalUnattendContent = additionalUnattendContent;
return this;
}
/**
* Get the patchSettings property: [Preview Feature] Specifies settings related to VM Guest Patching on Windows.
*
* @return the patchSettings value.
*/
public PatchSettings patchSettings() {
return this.patchSettings;
}
/**
* Set the patchSettings property: [Preview Feature] Specifies settings related to VM Guest Patching on Windows.
*
* @param patchSettings the patchSettings value to set.
* @return the WindowsConfiguration object itself.
*/
public WindowsConfiguration withPatchSettings(PatchSettings patchSettings) {
this.patchSettings = patchSettings;
return this;
}
/**
* Get the winRM property: Specifies the Windows Remote Management listeners. This enables remote Windows
* PowerShell.
*
* @return the winRM value.
*/
public WinRMConfiguration winRM() {
return this.winRM;
}
/**
* Set the winRM property: Specifies the Windows Remote Management listeners. This enables remote Windows
* PowerShell.
*
* @param winRM the winRM value to set.
* @return the WindowsConfiguration object itself.
*/
public WindowsConfiguration withWinRM(WinRMConfiguration winRM) {
this.winRM = winRM;
return this;
}
/**
* Get the enableVMAgentPlatformUpdates property: Indicates whether VMAgent Platform Updates are enabled for the
* Windows Virtual Machine.
*
* @return the enableVMAgentPlatformUpdates value.
*/
public Boolean enableVMAgentPlatformUpdates() {
return this.enableVMAgentPlatformUpdates;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (additionalUnattendContent() != null) {
additionalUnattendContent().forEach(e -> e.validate());
}
if (patchSettings() != null) {
patchSettings().validate();
}
if (winRM() != null) {
winRM().validate();
}
}
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeBooleanField("provisionVMAgent", this.provisionVMAgent);
jsonWriter.writeBooleanField("enableAutomaticUpdates", this.enableAutomaticUpdates);
jsonWriter.writeStringField("timeZone", this.timeZone);
jsonWriter.writeArrayField("additionalUnattendContent", this.additionalUnattendContent,
(writer, element) -> writer.writeJson(element));
jsonWriter.writeJsonField("patchSettings", this.patchSettings);
jsonWriter.writeJsonField("winRM", this.winRM);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of WindowsConfiguration from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of WindowsConfiguration 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 WindowsConfiguration.
*/
public static WindowsConfiguration fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
WindowsConfiguration deserializedWindowsConfiguration = new WindowsConfiguration();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("provisionVMAgent".equals(fieldName)) {
deserializedWindowsConfiguration.provisionVMAgent = reader.getNullable(JsonReader::getBoolean);
} else if ("enableAutomaticUpdates".equals(fieldName)) {
deserializedWindowsConfiguration.enableAutomaticUpdates
= reader.getNullable(JsonReader::getBoolean);
} else if ("timeZone".equals(fieldName)) {
deserializedWindowsConfiguration.timeZone = reader.getString();
} else if ("additionalUnattendContent".equals(fieldName)) {
List additionalUnattendContent
= reader.readArray(reader1 -> AdditionalUnattendContent.fromJson(reader1));
deserializedWindowsConfiguration.additionalUnattendContent = additionalUnattendContent;
} else if ("patchSettings".equals(fieldName)) {
deserializedWindowsConfiguration.patchSettings = PatchSettings.fromJson(reader);
} else if ("winRM".equals(fieldName)) {
deserializedWindowsConfiguration.winRM = WinRMConfiguration.fromJson(reader);
} else if ("enableVMAgentPlatformUpdates".equals(fieldName)) {
deserializedWindowsConfiguration.enableVMAgentPlatformUpdates
= reader.getNullable(JsonReader::getBoolean);
} else {
reader.skipChildren();
}
}
return deserializedWindowsConfiguration;
});
}
}