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

com.azure.resourcemanager.servicelinker.fluent.models.DryrunProperties 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.servicelinker.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.servicelinker.models.DryrunOperationPreview;
import com.azure.resourcemanager.servicelinker.models.DryrunParameters;
import com.azure.resourcemanager.servicelinker.models.DryrunPrerequisiteResult;
import java.io.IOException;
import java.util.List;

/**
 * The properties of the dryrun job.
 */
@Fluent
public final class DryrunProperties implements JsonSerializable {
    /*
     * The parameters of the dryrun
     */
    private DryrunParameters parameters;

    /*
     * the result of the dryrun
     */
    private List prerequisiteResults;

    /*
     * the preview of the operations for creation
     */
    private List operationPreviews;

    /*
     * The provisioning state.
     */
    private String provisioningState;

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

    /**
     * Get the parameters property: The parameters of the dryrun.
     * 
     * @return the parameters value.
     */
    public DryrunParameters parameters() {
        return this.parameters;
    }

    /**
     * Set the parameters property: The parameters of the dryrun.
     * 
     * @param parameters the parameters value to set.
     * @return the DryrunProperties object itself.
     */
    public DryrunProperties withParameters(DryrunParameters parameters) {
        this.parameters = parameters;
        return this;
    }

    /**
     * Get the prerequisiteResults property: the result of the dryrun.
     * 
     * @return the prerequisiteResults value.
     */
    public List prerequisiteResults() {
        return this.prerequisiteResults;
    }

    /**
     * Get the operationPreviews property: the preview of the operations for creation.
     * 
     * @return the operationPreviews value.
     */
    public List operationPreviews() {
        return this.operationPreviews;
    }

    /**
     * Get the provisioningState property: The provisioning state.
     * 
     * @return the provisioningState value.
     */
    public String provisioningState() {
        return this.provisioningState;
    }

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (parameters() != null) {
            parameters().validate();
        }
        if (prerequisiteResults() != null) {
            prerequisiteResults().forEach(e -> e.validate());
        }
        if (operationPreviews() != null) {
            operationPreviews().forEach(e -> e.validate());
        }
    }

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

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

                if ("parameters".equals(fieldName)) {
                    deserializedDryrunProperties.parameters = DryrunParameters.fromJson(reader);
                } else if ("prerequisiteResults".equals(fieldName)) {
                    List prerequisiteResults
                        = reader.readArray(reader1 -> DryrunPrerequisiteResult.fromJson(reader1));
                    deserializedDryrunProperties.prerequisiteResults = prerequisiteResults;
                } else if ("operationPreviews".equals(fieldName)) {
                    List operationPreviews
                        = reader.readArray(reader1 -> DryrunOperationPreview.fromJson(reader1));
                    deserializedDryrunProperties.operationPreviews = operationPreviews;
                } else if ("provisioningState".equals(fieldName)) {
                    deserializedDryrunProperties.provisioningState = reader.getString();
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedDryrunProperties;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy