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

com.azure.resourcemanager.automation.models.SoftwareUpdateConfigurationRunTasks 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;

/**
 * Software update configuration run tasks model.
 */
@Fluent
public final class SoftwareUpdateConfigurationRunTasks
    implements JsonSerializable {
    /*
     * Pre task properties.
     */
    private SoftwareUpdateConfigurationRunTaskProperties preTask;

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

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

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

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

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

    /**
     * Set the postTask property: Post task properties.
     * 
     * @param postTask the postTask value to set.
     * @return the SoftwareUpdateConfigurationRunTasks object itself.
     */
    public SoftwareUpdateConfigurationRunTasks withPostTask(SoftwareUpdateConfigurationRunTaskProperties 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 SoftwareUpdateConfigurationRunTasks from the JsonReader.
     * 
     * @param jsonReader The JsonReader being read.
     * @return An instance of SoftwareUpdateConfigurationRunTasks 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 SoftwareUpdateConfigurationRunTasks.
     */
    public static SoftwareUpdateConfigurationRunTasks fromJson(JsonReader jsonReader) throws IOException {
        return jsonReader.readObject(reader -> {
            SoftwareUpdateConfigurationRunTasks deserializedSoftwareUpdateConfigurationRunTasks
                = new SoftwareUpdateConfigurationRunTasks();
            while (reader.nextToken() != JsonToken.END_OBJECT) {
                String fieldName = reader.getFieldName();
                reader.nextToken();

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

            return deserializedSoftwareUpdateConfigurationRunTasks;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy