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

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

/**
 * A copy activity Dynamics CRM sink.
 */
@Fluent
public final class DynamicsCrmSink extends CopySink {
    /*
     * Copy sink type.
     */
    private String type = "DynamicsCrmSink";

    /*
     * The write behavior for the operation.
     */
    private DynamicsSinkWriteBehavior writeBehavior;

    /*
     * The flag indicating whether to ignore null values from input dataset (except key fields) during write operation.
     * Default is false. Type: boolean (or Expression with resultType boolean).
     */
    private Object ignoreNullValues;

    /*
     * The logical name of the alternate key which will be used when upserting records. Type: string (or Expression with
     * resultType string).
     */
    private Object alternateKeyName;

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

    /**
     * Get the type property: Copy sink type.
     * 
     * @return the type value.
     */
    @Override
    public String type() {
        return this.type;
    }

    /**
     * Get the writeBehavior property: The write behavior for the operation.
     * 
     * @return the writeBehavior value.
     */
    public DynamicsSinkWriteBehavior writeBehavior() {
        return this.writeBehavior;
    }

    /**
     * Set the writeBehavior property: The write behavior for the operation.
     * 
     * @param writeBehavior the writeBehavior value to set.
     * @return the DynamicsCrmSink object itself.
     */
    public DynamicsCrmSink withWriteBehavior(DynamicsSinkWriteBehavior writeBehavior) {
        this.writeBehavior = writeBehavior;
        return this;
    }

    /**
     * Get the ignoreNullValues property: The flag indicating whether to ignore null values from input dataset (except
     * key fields) during write operation. Default is false. Type: boolean (or Expression with resultType boolean).
     * 
     * @return the ignoreNullValues value.
     */
    public Object ignoreNullValues() {
        return this.ignoreNullValues;
    }

    /**
     * Set the ignoreNullValues property: The flag indicating whether to ignore null values from input dataset (except
     * key fields) during write operation. Default is false. Type: boolean (or Expression with resultType boolean).
     * 
     * @param ignoreNullValues the ignoreNullValues value to set.
     * @return the DynamicsCrmSink object itself.
     */
    public DynamicsCrmSink withIgnoreNullValues(Object ignoreNullValues) {
        this.ignoreNullValues = ignoreNullValues;
        return this;
    }

    /**
     * Get the alternateKeyName property: The logical name of the alternate key which will be used when upserting
     * records. Type: string (or Expression with resultType string).
     * 
     * @return the alternateKeyName value.
     */
    public Object alternateKeyName() {
        return this.alternateKeyName;
    }

    /**
     * Set the alternateKeyName property: The logical name of the alternate key which will be used when upserting
     * records. Type: string (or Expression with resultType string).
     * 
     * @param alternateKeyName the alternateKeyName value to set.
     * @return the DynamicsCrmSink object itself.
     */
    public DynamicsCrmSink withAlternateKeyName(Object alternateKeyName) {
        this.alternateKeyName = alternateKeyName;
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public DynamicsCrmSink withWriteBatchSize(Object writeBatchSize) {
        super.withWriteBatchSize(writeBatchSize);
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public DynamicsCrmSink withWriteBatchTimeout(Object writeBatchTimeout) {
        super.withWriteBatchTimeout(writeBatchTimeout);
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public DynamicsCrmSink withSinkRetryCount(Object sinkRetryCount) {
        super.withSinkRetryCount(sinkRetryCount);
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public DynamicsCrmSink withSinkRetryWait(Object sinkRetryWait) {
        super.withSinkRetryWait(sinkRetryWait);
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public DynamicsCrmSink withMaxConcurrentConnections(Object maxConcurrentConnections) {
        super.withMaxConcurrentConnections(maxConcurrentConnections);
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public DynamicsCrmSink withDisableMetricsCollection(Object disableMetricsCollection) {
        super.withDisableMetricsCollection(disableMetricsCollection);
        return this;
    }

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

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

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeUntypedField("writeBatchSize", writeBatchSize());
        jsonWriter.writeUntypedField("writeBatchTimeout", writeBatchTimeout());
        jsonWriter.writeUntypedField("sinkRetryCount", sinkRetryCount());
        jsonWriter.writeUntypedField("sinkRetryWait", sinkRetryWait());
        jsonWriter.writeUntypedField("maxConcurrentConnections", maxConcurrentConnections());
        jsonWriter.writeUntypedField("disableMetricsCollection", disableMetricsCollection());
        jsonWriter.writeStringField("writeBehavior", this.writeBehavior == null ? null : this.writeBehavior.toString());
        jsonWriter.writeStringField("type", this.type);
        jsonWriter.writeUntypedField("ignoreNullValues", this.ignoreNullValues);
        jsonWriter.writeUntypedField("alternateKeyName", this.alternateKeyName);
        if (additionalProperties() != null) {
            for (Map.Entry additionalProperty : additionalProperties().entrySet()) {
                jsonWriter.writeUntypedField(additionalProperty.getKey(), additionalProperty.getValue());
            }
        }
        return jsonWriter.writeEndObject();
    }

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

                if ("writeBatchSize".equals(fieldName)) {
                    deserializedDynamicsCrmSink.withWriteBatchSize(reader.readUntyped());
                } else if ("writeBatchTimeout".equals(fieldName)) {
                    deserializedDynamicsCrmSink.withWriteBatchTimeout(reader.readUntyped());
                } else if ("sinkRetryCount".equals(fieldName)) {
                    deserializedDynamicsCrmSink.withSinkRetryCount(reader.readUntyped());
                } else if ("sinkRetryWait".equals(fieldName)) {
                    deserializedDynamicsCrmSink.withSinkRetryWait(reader.readUntyped());
                } else if ("maxConcurrentConnections".equals(fieldName)) {
                    deserializedDynamicsCrmSink.withMaxConcurrentConnections(reader.readUntyped());
                } else if ("disableMetricsCollection".equals(fieldName)) {
                    deserializedDynamicsCrmSink.withDisableMetricsCollection(reader.readUntyped());
                } else if ("writeBehavior".equals(fieldName)) {
                    deserializedDynamicsCrmSink.writeBehavior
                        = DynamicsSinkWriteBehavior.fromString(reader.getString());
                } else if ("type".equals(fieldName)) {
                    deserializedDynamicsCrmSink.type = reader.getString();
                } else if ("ignoreNullValues".equals(fieldName)) {
                    deserializedDynamicsCrmSink.ignoreNullValues = reader.readUntyped();
                } else if ("alternateKeyName".equals(fieldName)) {
                    deserializedDynamicsCrmSink.alternateKeyName = reader.readUntyped();
                } else {
                    if (additionalProperties == null) {
                        additionalProperties = new LinkedHashMap<>();
                    }

                    additionalProperties.put(fieldName, reader.readUntyped());
                }
            }
            deserializedDynamicsCrmSink.withAdditionalProperties(additionalProperties);

            return deserializedDynamicsCrmSink;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy