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

com.azure.resourcemanager.datafactory.models.DatasetDebugResource 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.datafactory.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.azure.json.JsonReader;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;

/**
 * Dataset debug resource.
 */
@Fluent
public final class DatasetDebugResource extends SubResourceDebugResource {
    /*
     * Dataset properties.
     */
    private Dataset properties;

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

    /**
     * Get the properties property: Dataset properties.
     * 
     * @return the properties value.
     */
    public Dataset properties() {
        return this.properties;
    }

    /**
     * Set the properties property: Dataset properties.
     * 
     * @param properties the properties value to set.
     * @return the DatasetDebugResource object itself.
     */
    public DatasetDebugResource withProperties(Dataset properties) {
        this.properties = properties;
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public DatasetDebugResource withName(String name) {
        super.withName(name);
        return this;
    }

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    @Override
    public void validate() {
        if (properties() == null) {
            throw LOGGER.atError()
                .log(
                    new IllegalArgumentException("Missing required property properties in model DatasetDebugResource"));
        } else {
            properties().validate();
        }
    }

    private static final ClientLogger LOGGER = new ClientLogger(DatasetDebugResource.class);

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

    /**
     * Reads an instance of DatasetDebugResource from the JsonReader.
     * 
     * @param jsonReader The JsonReader being read.
     * @return An instance of DatasetDebugResource if the JsonReader was pointing to an instance of it, or null if it
     * was pointing to JSON null.
     * @throws IllegalStateException If the deserialized JSON object was missing any required properties.
     * @throws IOException If an error occurs while reading the DatasetDebugResource.
     */
    public static DatasetDebugResource fromJson(JsonReader jsonReader) throws IOException {
        return jsonReader.readObject(reader -> {
            DatasetDebugResource deserializedDatasetDebugResource = new DatasetDebugResource();
            while (reader.nextToken() != JsonToken.END_OBJECT) {
                String fieldName = reader.getFieldName();
                reader.nextToken();

                if ("name".equals(fieldName)) {
                    deserializedDatasetDebugResource.withName(reader.getString());
                } else if ("properties".equals(fieldName)) {
                    deserializedDatasetDebugResource.properties = Dataset.fromJson(reader);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedDatasetDebugResource;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy