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

com.azure.resourcemanager.hybridcompute.models.PatchSettingsStatus Maven / Gradle / Ivy

Go to download

This package contains Microsoft Azure SDK for HybridCompute Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. The Hybrid Compute Management Client. Package tag package-preview-2024-07.

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.hybridcompute.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.management.exception.ManagementError;
import com.azure.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;

/**
 * Status of the hotpatch capability enrollment or disenrollment.
 */
@Fluent
public final class PatchSettingsStatus implements JsonSerializable {
    /*
     * Indicates the current status of the hotpatch being enabled or disabled.
     */
    private HotpatchEnablementStatus hotpatchEnablementStatus;

    /*
     * The errors that were encountered during the hotpatch capability enrollment or disenrollment.
     */
    private ManagementError error;

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

    /**
     * Get the hotpatchEnablementStatus property: Indicates the current status of the hotpatch being enabled or
     * disabled.
     * 
     * @return the hotpatchEnablementStatus value.
     */
    public HotpatchEnablementStatus hotpatchEnablementStatus() {
        return this.hotpatchEnablementStatus;
    }

    /**
     * Set the hotpatchEnablementStatus property: Indicates the current status of the hotpatch being enabled or
     * disabled.
     * 
     * @param hotpatchEnablementStatus the hotpatchEnablementStatus value to set.
     * @return the PatchSettingsStatus object itself.
     */
    public PatchSettingsStatus withHotpatchEnablementStatus(HotpatchEnablementStatus hotpatchEnablementStatus) {
        this.hotpatchEnablementStatus = hotpatchEnablementStatus;
        return this;
    }

    /**
     * Get the error property: The errors that were encountered during the hotpatch capability enrollment or
     * disenrollment.
     * 
     * @return the error value.
     */
    public ManagementError error() {
        return this.error;
    }

    /**
     * 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("hotpatchEnablementStatus",
            this.hotpatchEnablementStatus == null ? null : this.hotpatchEnablementStatus.toString());
        return jsonWriter.writeEndObject();
    }

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

                if ("hotpatchEnablementStatus".equals(fieldName)) {
                    deserializedPatchSettingsStatus.hotpatchEnablementStatus
                        = HotpatchEnablementStatus.fromString(reader.getString());
                } else if ("error".equals(fieldName)) {
                    deserializedPatchSettingsStatus.error = ManagementError.fromJson(reader);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedPatchSettingsStatus;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy