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

com.azure.resourcemanager.datafactory.models.DataFlowDebugCommandPayload 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.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;
import java.util.List;

/**
 * Structure of command payload.
 */
@Fluent
public final class DataFlowDebugCommandPayload implements JsonSerializable {
    /*
     * The stream name which is used for preview.
     */
    private String streamName;

    /*
     * Row limits for preview response.
     */
    private Integer rowLimits;

    /*
     * Array of column names.
     */
    private List columns;

    /*
     * The expression which is used for preview.
     */
    private String expression;

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

    /**
     * Get the streamName property: The stream name which is used for preview.
     * 
     * @return the streamName value.
     */
    public String streamName() {
        return this.streamName;
    }

    /**
     * Set the streamName property: The stream name which is used for preview.
     * 
     * @param streamName the streamName value to set.
     * @return the DataFlowDebugCommandPayload object itself.
     */
    public DataFlowDebugCommandPayload withStreamName(String streamName) {
        this.streamName = streamName;
        return this;
    }

    /**
     * Get the rowLimits property: Row limits for preview response.
     * 
     * @return the rowLimits value.
     */
    public Integer rowLimits() {
        return this.rowLimits;
    }

    /**
     * Set the rowLimits property: Row limits for preview response.
     * 
     * @param rowLimits the rowLimits value to set.
     * @return the DataFlowDebugCommandPayload object itself.
     */
    public DataFlowDebugCommandPayload withRowLimits(Integer rowLimits) {
        this.rowLimits = rowLimits;
        return this;
    }

    /**
     * Get the columns property: Array of column names.
     * 
     * @return the columns value.
     */
    public List columns() {
        return this.columns;
    }

    /**
     * Set the columns property: Array of column names.
     * 
     * @param columns the columns value to set.
     * @return the DataFlowDebugCommandPayload object itself.
     */
    public DataFlowDebugCommandPayload withColumns(List columns) {
        this.columns = columns;
        return this;
    }

    /**
     * Get the expression property: The expression which is used for preview.
     * 
     * @return the expression value.
     */
    public String expression() {
        return this.expression;
    }

    /**
     * Set the expression property: The expression which is used for preview.
     * 
     * @param expression the expression value to set.
     * @return the DataFlowDebugCommandPayload object itself.
     */
    public DataFlowDebugCommandPayload withExpression(String expression) {
        this.expression = expression;
        return this;
    }

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

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

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("streamName", this.streamName);
        jsonWriter.writeNumberField("rowLimits", this.rowLimits);
        jsonWriter.writeArrayField("columns", this.columns, (writer, element) -> writer.writeString(element));
        jsonWriter.writeStringField("expression", this.expression);
        return jsonWriter.writeEndObject();
    }

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

                if ("streamName".equals(fieldName)) {
                    deserializedDataFlowDebugCommandPayload.streamName = reader.getString();
                } else if ("rowLimits".equals(fieldName)) {
                    deserializedDataFlowDebugCommandPayload.rowLimits = reader.getNullable(JsonReader::getInt);
                } else if ("columns".equals(fieldName)) {
                    List columns = reader.readArray(reader1 -> reader1.getString());
                    deserializedDataFlowDebugCommandPayload.columns = columns;
                } else if ("expression".equals(fieldName)) {
                    deserializedDataFlowDebugCommandPayload.expression = reader.getString();
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedDataFlowDebugCommandPayload;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy