com.azure.resourcemanager.compute.models.LinuxPatchSettings 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;
/**
* Specifies settings related to VM Guest Patching on Linux.
*/
@Fluent
public final class LinuxPatchSettings implements JsonSerializable {
/*
* Specifies the mode of VM Guest Patching to IaaS virtual machine or virtual machines associated to virtual machine
* scale set with OrchestrationMode as Flexible.
Possible values are:
**ImageDefault** - The
* virtual machine's default patching configuration is used.
**AutomaticByPlatform** - The virtual
* machine will be automatically updated by the platform. The property provisionVMAgent must be true
*/
private LinuxVMGuestPatchMode patchMode;
/*
* Specifies the mode of VM Guest Patch Assessment for the IaaS virtual machine.
Possible values are:
**ImageDefault** - You control the timing of patch assessments on a virtual machine.
* **AutomaticByPlatform** - The platform will trigger periodic patch assessments. The property provisionVMAgent
* must be true.
*/
private LinuxPatchAssessmentMode assessmentMode;
/*
* Specifies additional settings for patch mode AutomaticByPlatform in VM Guest Patching on Linux.
*/
private LinuxVMGuestPatchAutomaticByPlatformSettings automaticByPlatformSettings;
/**
* Creates an instance of LinuxPatchSettings class.
*/
public LinuxPatchSettings() {
}
/**
* Get the patchMode property: Specifies the mode of VM Guest Patching to IaaS virtual machine or virtual machines
* associated to virtual machine scale set with OrchestrationMode as Flexible.<br /><br /> Possible
* values are:<br /><br /> **ImageDefault** - The virtual machine's default patching configuration is
* used. <br /><br /> **AutomaticByPlatform** - The virtual machine will be automatically updated by the
* platform. The property provisionVMAgent must be true.
*
* @return the patchMode value.
*/
public LinuxVMGuestPatchMode patchMode() {
return this.patchMode;
}
/**
* Set the patchMode property: Specifies the mode of VM Guest Patching to IaaS virtual machine or virtual machines
* associated to virtual machine scale set with OrchestrationMode as Flexible.<br /><br /> Possible
* values are:<br /><br /> **ImageDefault** - The virtual machine's default patching configuration is
* used. <br /><br /> **AutomaticByPlatform** - The virtual machine will be automatically updated by the
* platform. The property provisionVMAgent must be true.
*
* @param patchMode the patchMode value to set.
* @return the LinuxPatchSettings object itself.
*/
public LinuxPatchSettings withPatchMode(LinuxVMGuestPatchMode patchMode) {
this.patchMode = patchMode;
return this;
}
/**
* Get the assessmentMode property: Specifies the mode of VM Guest Patch Assessment for the IaaS virtual
* machine.<br /><br /> Possible values are:<br /><br /> **ImageDefault** - You control the
* timing of patch assessments on a virtual machine. <br /><br /> **AutomaticByPlatform** - The platform
* will trigger periodic patch assessments. The property provisionVMAgent must be true.
*
* @return the assessmentMode value.
*/
public LinuxPatchAssessmentMode assessmentMode() {
return this.assessmentMode;
}
/**
* Set the assessmentMode property: Specifies the mode of VM Guest Patch Assessment for the IaaS virtual
* machine.<br /><br /> Possible values are:<br /><br /> **ImageDefault** - You control the
* timing of patch assessments on a virtual machine. <br /><br /> **AutomaticByPlatform** - The platform
* will trigger periodic patch assessments. The property provisionVMAgent must be true.
*
* @param assessmentMode the assessmentMode value to set.
* @return the LinuxPatchSettings object itself.
*/
public LinuxPatchSettings withAssessmentMode(LinuxPatchAssessmentMode assessmentMode) {
this.assessmentMode = assessmentMode;
return this;
}
/**
* Get the automaticByPlatformSettings property: Specifies additional settings for patch mode AutomaticByPlatform in
* VM Guest Patching on Linux.
*
* @return the automaticByPlatformSettings value.
*/
public LinuxVMGuestPatchAutomaticByPlatformSettings automaticByPlatformSettings() {
return this.automaticByPlatformSettings;
}
/**
* Set the automaticByPlatformSettings property: Specifies additional settings for patch mode AutomaticByPlatform in
* VM Guest Patching on Linux.
*
* @param automaticByPlatformSettings the automaticByPlatformSettings value to set.
* @return the LinuxPatchSettings object itself.
*/
public LinuxPatchSettings
withAutomaticByPlatformSettings(LinuxVMGuestPatchAutomaticByPlatformSettings automaticByPlatformSettings) {
this.automaticByPlatformSettings = automaticByPlatformSettings;
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (automaticByPlatformSettings() != null) {
automaticByPlatformSettings().validate();
}
}
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeStringField("patchMode", this.patchMode == null ? null : this.patchMode.toString());
jsonWriter.writeStringField("assessmentMode",
this.assessmentMode == null ? null : this.assessmentMode.toString());
jsonWriter.writeJsonField("automaticByPlatformSettings", this.automaticByPlatformSettings);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of LinuxPatchSettings from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of LinuxPatchSettings 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 LinuxPatchSettings.
*/
public static LinuxPatchSettings fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
LinuxPatchSettings deserializedLinuxPatchSettings = new LinuxPatchSettings();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("patchMode".equals(fieldName)) {
deserializedLinuxPatchSettings.patchMode = LinuxVMGuestPatchMode.fromString(reader.getString());
} else if ("assessmentMode".equals(fieldName)) {
deserializedLinuxPatchSettings.assessmentMode
= LinuxPatchAssessmentMode.fromString(reader.getString());
} else if ("automaticByPlatformSettings".equals(fieldName)) {
deserializedLinuxPatchSettings.automaticByPlatformSettings
= LinuxVMGuestPatchAutomaticByPlatformSettings.fromJson(reader);
} else {
reader.skipChildren();
}
}
return deserializedLinuxPatchSettings;
});
}
}