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

com.azure.resourcemanager.datafactory.models.DWCopyCommandSettings 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.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;
import java.util.Map;

/**
 * DW Copy Command settings.
 */
@Fluent
public final class DWCopyCommandSettings implements JsonSerializable {
    /*
     * Specifies the default values for each target column in SQL DW. The default values in the property overwrite the
     * DEFAULT constraint set in the DB, and identity column cannot have a default value. Type: array of objects (or
     * Expression with resultType array of objects).
     */
    private List defaultValues;

    /*
     * Additional options directly passed to SQL DW in Copy Command. Type: key value pairs (value should be string type)
     * (or Expression with resultType object). Example: "additionalOptions": { "MAXERRORS": "1000", "DATEFORMAT":
     * "'ymd'" }
     */
    private Map additionalOptions;

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

    /**
     * Get the defaultValues property: Specifies the default values for each target column in SQL DW. The default values
     * in the property overwrite the DEFAULT constraint set in the DB, and identity column cannot have a default value.
     * Type: array of objects (or Expression with resultType array of objects).
     * 
     * @return the defaultValues value.
     */
    public List defaultValues() {
        return this.defaultValues;
    }

    /**
     * Set the defaultValues property: Specifies the default values for each target column in SQL DW. The default values
     * in the property overwrite the DEFAULT constraint set in the DB, and identity column cannot have a default value.
     * Type: array of objects (or Expression with resultType array of objects).
     * 
     * @param defaultValues the defaultValues value to set.
     * @return the DWCopyCommandSettings object itself.
     */
    public DWCopyCommandSettings withDefaultValues(List defaultValues) {
        this.defaultValues = defaultValues;
        return this;
    }

    /**
     * Get the additionalOptions property: Additional options directly passed to SQL DW in Copy Command. Type: key value
     * pairs (value should be string type) (or Expression with resultType object). Example: "additionalOptions": {
     * "MAXERRORS": "1000", "DATEFORMAT": "'ymd'" }.
     * 
     * @return the additionalOptions value.
     */
    public Map additionalOptions() {
        return this.additionalOptions;
    }

    /**
     * Set the additionalOptions property: Additional options directly passed to SQL DW in Copy Command. Type: key value
     * pairs (value should be string type) (or Expression with resultType object). Example: "additionalOptions": {
     * "MAXERRORS": "1000", "DATEFORMAT": "'ymd'" }.
     * 
     * @param additionalOptions the additionalOptions value to set.
     * @return the DWCopyCommandSettings object itself.
     */
    public DWCopyCommandSettings withAdditionalOptions(Map additionalOptions) {
        this.additionalOptions = additionalOptions;
        return this;
    }

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

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeArrayField("defaultValues", this.defaultValues, (writer, element) -> writer.writeJson(element));
        jsonWriter.writeMapField("additionalOptions", this.additionalOptions,
            (writer, element) -> writer.writeString(element));
        return jsonWriter.writeEndObject();
    }

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

                if ("defaultValues".equals(fieldName)) {
                    List defaultValues
                        = reader.readArray(reader1 -> DWCopyCommandDefaultValue.fromJson(reader1));
                    deserializedDWCopyCommandSettings.defaultValues = defaultValues;
                } else if ("additionalOptions".equals(fieldName)) {
                    Map additionalOptions = reader.readMap(reader1 -> reader1.getString());
                    deserializedDWCopyCommandSettings.additionalOptions = additionalOptions;
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedDWCopyCommandSettings;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy