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

com.azure.resourcemanager.automation.models.SoftwareUpdateConfigurationTasks Maven / Gradle / Ivy

Go to download

This package contains Microsoft Azure SDK for Automation Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Automation Client. Package tag package-2022-02-22.

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.automation.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;

/**
 * Task properties of the software update configuration.
 */
@Fluent
public final class SoftwareUpdateConfigurationTasks implements JsonSerializable {
    /*
     * Pre task properties.
     */
    private TaskProperties preTask;

    /*
     * Post task properties.
     */
    private TaskProperties postTask;

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

    /**
     * Get the preTask property: Pre task properties.
     * 
     * @return the preTask value.
     */
    public TaskProperties preTask() {
        return this.preTask;
    }

    /**
     * Set the preTask property: Pre task properties.
     * 
     * @param preTask the preTask value to set.
     * @return the SoftwareUpdateConfigurationTasks object itself.
     */
    public SoftwareUpdateConfigurationTasks withPreTask(TaskProperties preTask) {
        this.preTask = preTask;
        return this;
    }

    /**
     * Get the postTask property: Post task properties.
     * 
     * @return the postTask value.
     */
    public TaskProperties postTask() {
        return this.postTask;
    }

    /**
     * Set the postTask property: Post task properties.
     * 
     * @param postTask the postTask value to set.
     * @return the SoftwareUpdateConfigurationTasks object itself.
     */
    public SoftwareUpdateConfigurationTasks withPostTask(TaskProperties postTask) {
        this.postTask = postTask;
        return this;
    }

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

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeJsonField("preTask", this.preTask);
        jsonWriter.writeJsonField("postTask", this.postTask);
        return jsonWriter.writeEndObject();
    }

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

                if ("preTask".equals(fieldName)) {
                    deserializedSoftwareUpdateConfigurationTasks.preTask = TaskProperties.fromJson(reader);
                } else if ("postTask".equals(fieldName)) {
                    deserializedSoftwareUpdateConfigurationTasks.postTask = TaskProperties.fromJson(reader);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedSoftwareUpdateConfigurationTasks;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy