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

com.azure.resourcemanager.maintenance.models.InputWindowsParameters Maven / Gradle / Ivy

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.maintenance.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;
import java.util.List;

/**
 * Input properties for patching a Windows machine.
 */
@Fluent
public final class InputWindowsParameters implements JsonSerializable {
    /*
     * Windows KBID to be excluded for patching.
     */
    private List kbNumbersToExclude;

    /*
     * Windows KBID to be included for patching.
     */
    private List kbNumbersToInclude;

    /*
     * Classification category of patches to be patched
     */
    private List classificationsToInclude;

    /*
     * Exclude patches which need reboot
     */
    private Boolean excludeKbsRequiringReboot;

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

    /**
     * Get the kbNumbersToExclude property: Windows KBID to be excluded for patching.
     * 
     * @return the kbNumbersToExclude value.
     */
    public List kbNumbersToExclude() {
        return this.kbNumbersToExclude;
    }

    /**
     * Set the kbNumbersToExclude property: Windows KBID to be excluded for patching.
     * 
     * @param kbNumbersToExclude the kbNumbersToExclude value to set.
     * @return the InputWindowsParameters object itself.
     */
    public InputWindowsParameters withKbNumbersToExclude(List kbNumbersToExclude) {
        this.kbNumbersToExclude = kbNumbersToExclude;
        return this;
    }

    /**
     * Get the kbNumbersToInclude property: Windows KBID to be included for patching.
     * 
     * @return the kbNumbersToInclude value.
     */
    public List kbNumbersToInclude() {
        return this.kbNumbersToInclude;
    }

    /**
     * Set the kbNumbersToInclude property: Windows KBID to be included for patching.
     * 
     * @param kbNumbersToInclude the kbNumbersToInclude value to set.
     * @return the InputWindowsParameters object itself.
     */
    public InputWindowsParameters withKbNumbersToInclude(List kbNumbersToInclude) {
        this.kbNumbersToInclude = kbNumbersToInclude;
        return this;
    }

    /**
     * Get the classificationsToInclude property: Classification category of patches to be patched.
     * 
     * @return the classificationsToInclude value.
     */
    public List classificationsToInclude() {
        return this.classificationsToInclude;
    }

    /**
     * Set the classificationsToInclude property: Classification category of patches to be patched.
     * 
     * @param classificationsToInclude the classificationsToInclude value to set.
     * @return the InputWindowsParameters object itself.
     */
    public InputWindowsParameters withClassificationsToInclude(List classificationsToInclude) {
        this.classificationsToInclude = classificationsToInclude;
        return this;
    }

    /**
     * Get the excludeKbsRequiringReboot property: Exclude patches which need reboot.
     * 
     * @return the excludeKbsRequiringReboot value.
     */
    public Boolean excludeKbsRequiringReboot() {
        return this.excludeKbsRequiringReboot;
    }

    /**
     * Set the excludeKbsRequiringReboot property: Exclude patches which need reboot.
     * 
     * @param excludeKbsRequiringReboot the excludeKbsRequiringReboot value to set.
     * @return the InputWindowsParameters object itself.
     */
    public InputWindowsParameters withExcludeKbsRequiringReboot(Boolean excludeKbsRequiringReboot) {
        this.excludeKbsRequiringReboot = excludeKbsRequiringReboot;
        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.writeArrayField("kbNumbersToExclude", this.kbNumbersToExclude,
            (writer, element) -> writer.writeString(element));
        jsonWriter.writeArrayField("kbNumbersToInclude", this.kbNumbersToInclude,
            (writer, element) -> writer.writeString(element));
        jsonWriter.writeArrayField("classificationsToInclude", this.classificationsToInclude,
            (writer, element) -> writer.writeString(element));
        jsonWriter.writeBooleanField("excludeKbsRequiringReboot", this.excludeKbsRequiringReboot);
        return jsonWriter.writeEndObject();
    }

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

                if ("kbNumbersToExclude".equals(fieldName)) {
                    List kbNumbersToExclude = reader.readArray(reader1 -> reader1.getString());
                    deserializedInputWindowsParameters.kbNumbersToExclude = kbNumbersToExclude;
                } else if ("kbNumbersToInclude".equals(fieldName)) {
                    List kbNumbersToInclude = reader.readArray(reader1 -> reader1.getString());
                    deserializedInputWindowsParameters.kbNumbersToInclude = kbNumbersToInclude;
                } else if ("classificationsToInclude".equals(fieldName)) {
                    List classificationsToInclude = reader.readArray(reader1 -> reader1.getString());
                    deserializedInputWindowsParameters.classificationsToInclude = classificationsToInclude;
                } else if ("excludeKbsRequiringReboot".equals(fieldName)) {
                    deserializedInputWindowsParameters.excludeKbsRequiringReboot
                        = reader.getNullable(JsonReader::getBoolean);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedInputWindowsParameters;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy