All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.azure.resourcemanager.azurestackhci.models.UpdatePrerequisite Maven / Gradle / Ivy

Go to download

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;

/**
 * If update State is HasPrerequisite, this property contains an array of objects describing prerequisite updates before
 * installing this update. Otherwise, it is empty.
 */
@Fluent
public final class UpdatePrerequisite implements JsonSerializable {
    /*
     * Updatable component type.
     */
    private String updateType;

    /*
     * Version of the prerequisite.
     */
    private String version;

    /*
     * Friendly name of the prerequisite.
     */
    private String packageName;

    /**
     * Creates an instance of UpdatePrerequisite class.
     */
    public UpdatePrerequisite() {
    }

    /**
     * Get the updateType property: Updatable component type.
     * 
     * @return the updateType value.
     */
    public String updateType() {
        return this.updateType;
    }

    /**
     * Set the updateType property: Updatable component type.
     * 
     * @param updateType the updateType value to set.
     * @return the UpdatePrerequisite object itself.
     */
    public UpdatePrerequisite withUpdateType(String updateType) {
        this.updateType = updateType;
        return this;
    }

    /**
     * Get the version property: Version of the prerequisite.
     * 
     * @return the version value.
     */
    public String version() {
        return this.version;
    }

    /**
     * Set the version property: Version of the prerequisite.
     * 
     * @param version the version value to set.
     * @return the UpdatePrerequisite object itself.
     */
    public UpdatePrerequisite withVersion(String version) {
        this.version = version;
        return this;
    }

    /**
     * Get the packageName property: Friendly name of the prerequisite.
     * 
     * @return the packageName value.
     */
    public String packageName() {
        return this.packageName;
    }

    /**
     * Set the packageName property: Friendly name of the prerequisite.
     * 
     * @param packageName the packageName value to set.
     * @return the UpdatePrerequisite object itself.
     */
    public UpdatePrerequisite withPackageName(String packageName) {
        this.packageName = packageName;
        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("updateType", this.updateType);
        jsonWriter.writeStringField("version", this.version);
        jsonWriter.writeStringField("packageName", this.packageName);
        return jsonWriter.writeEndObject();
    }

    /**
     * Reads an instance of UpdatePrerequisite from the JsonReader.
     * 
     * @param jsonReader The JsonReader being read.
     * @return An instance of UpdatePrerequisite 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 UpdatePrerequisite.
     */
    public static UpdatePrerequisite fromJson(JsonReader jsonReader) throws IOException {
        return jsonReader.readObject(reader -> {
            UpdatePrerequisite deserializedUpdatePrerequisite = new UpdatePrerequisite();
            while (reader.nextToken() != JsonToken.END_OBJECT) {
                String fieldName = reader.getFieldName();
                reader.nextToken();

                if ("updateType".equals(fieldName)) {
                    deserializedUpdatePrerequisite.updateType = reader.getString();
                } else if ("version".equals(fieldName)) {
                    deserializedUpdatePrerequisite.version = reader.getString();
                } else if ("packageName".equals(fieldName)) {
                    deserializedUpdatePrerequisite.packageName = reader.getString();
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedUpdatePrerequisite;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy