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

com.azure.resourcemanager.hybridcompute.fluent.models.PatchSettings 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.fluent.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 com.azure.resourcemanager.hybridcompute.models.AssessmentModeTypes;
import com.azure.resourcemanager.hybridcompute.models.PatchModeTypes;
import com.azure.resourcemanager.hybridcompute.models.PatchSettingsStatus;
import java.io.IOException;

/**
 * Specifies the patch settings.
 */
@Fluent
public final class PatchSettings implements JsonSerializable {
    /*
     * Specifies the assessment mode.
     */
    private AssessmentModeTypes assessmentMode;

    /*
     * Specifies the patch mode.
     */
    private PatchModeTypes patchMode;

    /*
     * Captures the hotpatch capability enrollment intent of the customers, which enables customers to patch their
     * Windows machines without requiring a reboot.
     */
    private Boolean enableHotpatching;

    /*
     * Status of the hotpatch capability enrollment or disenrollment.
     */
    private PatchSettingsStatus status;

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

    /**
     * Get the assessmentMode property: Specifies the assessment mode.
     * 
     * @return the assessmentMode value.
     */
    public AssessmentModeTypes assessmentMode() {
        return this.assessmentMode;
    }

    /**
     * Set the assessmentMode property: Specifies the assessment mode.
     * 
     * @param assessmentMode the assessmentMode value to set.
     * @return the PatchSettings object itself.
     */
    public PatchSettings withAssessmentMode(AssessmentModeTypes assessmentMode) {
        this.assessmentMode = assessmentMode;
        return this;
    }

    /**
     * Get the patchMode property: Specifies the patch mode.
     * 
     * @return the patchMode value.
     */
    public PatchModeTypes patchMode() {
        return this.patchMode;
    }

    /**
     * Set the patchMode property: Specifies the patch mode.
     * 
     * @param patchMode the patchMode value to set.
     * @return the PatchSettings object itself.
     */
    public PatchSettings withPatchMode(PatchModeTypes patchMode) {
        this.patchMode = patchMode;
        return this;
    }

    /**
     * Get the enableHotpatching property: Captures the hotpatch capability enrollment intent of the customers, which
     * enables customers to patch their Windows machines without requiring a reboot.
     * 
     * @return the enableHotpatching value.
     */
    public Boolean enableHotpatching() {
        return this.enableHotpatching;
    }

    /**
     * Set the enableHotpatching property: Captures the hotpatch capability enrollment intent of the customers, which
     * enables customers to patch their Windows machines without requiring a reboot.
     * 
     * @param enableHotpatching the enableHotpatching value to set.
     * @return the PatchSettings object itself.
     */
    public PatchSettings withEnableHotpatching(Boolean enableHotpatching) {
        this.enableHotpatching = enableHotpatching;
        return this;
    }

    /**
     * Get the status property: Status of the hotpatch capability enrollment or disenrollment.
     * 
     * @return the status value.
     */
    public PatchSettingsStatus status() {
        return this.status;
    }

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (status() != null) {
            status().validate();
        }
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("assessmentMode",
            this.assessmentMode == null ? null : this.assessmentMode.toString());
        jsonWriter.writeStringField("patchMode", this.patchMode == null ? null : this.patchMode.toString());
        jsonWriter.writeBooleanField("enableHotpatching", this.enableHotpatching);
        return jsonWriter.writeEndObject();
    }

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

                if ("assessmentMode".equals(fieldName)) {
                    deserializedPatchSettings.assessmentMode = AssessmentModeTypes.fromString(reader.getString());
                } else if ("patchMode".equals(fieldName)) {
                    deserializedPatchSettings.patchMode = PatchModeTypes.fromString(reader.getString());
                } else if ("enableHotpatching".equals(fieldName)) {
                    deserializedPatchSettings.enableHotpatching = reader.getNullable(JsonReader::getBoolean);
                } else if ("status".equals(fieldName)) {
                    deserializedPatchSettings.status = PatchSettingsStatus.fromJson(reader);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedPatchSettings;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy