com.azure.resourcemanager.azurestackhci.models.ExtensionPatchParameters Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-azurestackhci Show documentation
Show all versions of azure-resourcemanager-azurestackhci Show documentation
This package contains Microsoft Azure SDK for AzureStackHci Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Azure Stack HCI management service. 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.azurestackhci.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;
/**
* Describes the properties of a Machine Extension that can be updated.
*/
@Fluent
public final class ExtensionPatchParameters implements JsonSerializable {
/*
* Specifies the version of the script handler. Latest version would be used if not specified.
*/
private String typeHandlerVersion;
/*
* Indicates whether the extension should be automatically upgraded by the platform if there is a newer version
* available.
*/
private Boolean enableAutomaticUpgrade;
/*
* Json formatted public settings for the extension.
*/
private Object settings;
/*
* Protected settings (may contain secrets).
*/
private Object protectedSettings;
/**
* Creates an instance of ExtensionPatchParameters class.
*/
public ExtensionPatchParameters() {
}
/**
* Get the typeHandlerVersion property: Specifies the version of the script handler. Latest version would be used if
* not specified.
*
* @return the typeHandlerVersion value.
*/
public String typeHandlerVersion() {
return this.typeHandlerVersion;
}
/**
* Set the typeHandlerVersion property: Specifies the version of the script handler. Latest version would be used if
* not specified.
*
* @param typeHandlerVersion the typeHandlerVersion value to set.
* @return the ExtensionPatchParameters object itself.
*/
public ExtensionPatchParameters withTypeHandlerVersion(String typeHandlerVersion) {
this.typeHandlerVersion = typeHandlerVersion;
return this;
}
/**
* Get the enableAutomaticUpgrade property: Indicates whether the extension should be automatically upgraded by the
* platform if there is a newer version available.
*
* @return the enableAutomaticUpgrade value.
*/
public Boolean enableAutomaticUpgrade() {
return this.enableAutomaticUpgrade;
}
/**
* Set the enableAutomaticUpgrade property: Indicates whether the extension should be automatically upgraded by the
* platform if there is a newer version available.
*
* @param enableAutomaticUpgrade the enableAutomaticUpgrade value to set.
* @return the ExtensionPatchParameters object itself.
*/
public ExtensionPatchParameters withEnableAutomaticUpgrade(Boolean enableAutomaticUpgrade) {
this.enableAutomaticUpgrade = enableAutomaticUpgrade;
return this;
}
/**
* Get the settings property: Json formatted public settings for the extension.
*
* @return the settings value.
*/
public Object settings() {
return this.settings;
}
/**
* Set the settings property: Json formatted public settings for the extension.
*
* @param settings the settings value to set.
* @return the ExtensionPatchParameters object itself.
*/
public ExtensionPatchParameters withSettings(Object settings) {
this.settings = settings;
return this;
}
/**
* Get the protectedSettings property: Protected settings (may contain secrets).
*
* @return the protectedSettings value.
*/
public Object protectedSettings() {
return this.protectedSettings;
}
/**
* Set the protectedSettings property: Protected settings (may contain secrets).
*
* @param protectedSettings the protectedSettings value to set.
* @return the ExtensionPatchParameters object itself.
*/
public ExtensionPatchParameters withProtectedSettings(Object protectedSettings) {
this.protectedSettings = protectedSettings;
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
}
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeStringField("typeHandlerVersion", this.typeHandlerVersion);
jsonWriter.writeBooleanField("enableAutomaticUpgrade", this.enableAutomaticUpgrade);
jsonWriter.writeUntypedField("settings", this.settings);
jsonWriter.writeUntypedField("protectedSettings", this.protectedSettings);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of ExtensionPatchParameters from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of ExtensionPatchParameters 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 ExtensionPatchParameters.
*/
public static ExtensionPatchParameters fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
ExtensionPatchParameters deserializedExtensionPatchParameters = new ExtensionPatchParameters();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("typeHandlerVersion".equals(fieldName)) {
deserializedExtensionPatchParameters.typeHandlerVersion = reader.getString();
} else if ("enableAutomaticUpgrade".equals(fieldName)) {
deserializedExtensionPatchParameters.enableAutomaticUpgrade
= reader.getNullable(JsonReader::getBoolean);
} else if ("settings".equals(fieldName)) {
deserializedExtensionPatchParameters.settings = reader.readUntyped();
} else if ("protectedSettings".equals(fieldName)) {
deserializedExtensionPatchParameters.protectedSettings = reader.readUntyped();
} else {
reader.skipChildren();
}
}
return deserializedExtensionPatchParameters;
});
}
}