
com.azure.resourcemanager.datafactory.models.SqlSink 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.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* A copy activity SQL sink.
*/
@Fluent
public final class SqlSink extends CopySink {
/*
* Copy sink type.
*/
private String type = "SqlSink";
/*
* SQL writer stored procedure name. Type: string (or Expression with resultType string).
*/
private Object sqlWriterStoredProcedureName;
/*
* SQL writer table type. Type: string (or Expression with resultType string).
*/
private Object sqlWriterTableType;
/*
* SQL pre-copy script. Type: string (or Expression with resultType string).
*/
private Object preCopyScript;
/*
* SQL stored procedure parameters.
*/
private Object storedProcedureParameters;
/*
* The stored procedure parameter name of the table type. Type: string (or Expression with resultType string).
*/
private Object storedProcedureTableTypeParameterName;
/*
* The option to handle sink table, such as autoCreate. For now only 'autoCreate' value is supported. Type: string
* (or Expression with resultType string).
*/
private Object tableOption;
/*
* Whether to use table lock during bulk copy. Type: boolean (or Expression with resultType boolean).
*/
private Object sqlWriterUseTableLock;
/*
* Write behavior when copying data into sql. Type: string (or Expression with resultType string).
*/
private Object writeBehavior;
/*
* SQL upsert settings.
*/
private SqlUpsertSettings upsertSettings;
/**
* Creates an instance of SqlSink class.
*/
public SqlSink() {
}
/**
* Get the type property: Copy sink type.
*
* @return the type value.
*/
@Override
public String type() {
return this.type;
}
/**
* Get the sqlWriterStoredProcedureName property: SQL writer stored procedure name. Type: string (or Expression with
* resultType string).
*
* @return the sqlWriterStoredProcedureName value.
*/
public Object sqlWriterStoredProcedureName() {
return this.sqlWriterStoredProcedureName;
}
/**
* Set the sqlWriterStoredProcedureName property: SQL writer stored procedure name. Type: string (or Expression with
* resultType string).
*
* @param sqlWriterStoredProcedureName the sqlWriterStoredProcedureName value to set.
* @return the SqlSink object itself.
*/
public SqlSink withSqlWriterStoredProcedureName(Object sqlWriterStoredProcedureName) {
this.sqlWriterStoredProcedureName = sqlWriterStoredProcedureName;
return this;
}
/**
* Get the sqlWriterTableType property: SQL writer table type. Type: string (or Expression with resultType string).
*
* @return the sqlWriterTableType value.
*/
public Object sqlWriterTableType() {
return this.sqlWriterTableType;
}
/**
* Set the sqlWriterTableType property: SQL writer table type. Type: string (or Expression with resultType string).
*
* @param sqlWriterTableType the sqlWriterTableType value to set.
* @return the SqlSink object itself.
*/
public SqlSink withSqlWriterTableType(Object sqlWriterTableType) {
this.sqlWriterTableType = sqlWriterTableType;
return this;
}
/**
* Get the preCopyScript property: SQL pre-copy script. Type: string (or Expression with resultType string).
*
* @return the preCopyScript value.
*/
public Object preCopyScript() {
return this.preCopyScript;
}
/**
* Set the preCopyScript property: SQL pre-copy script. Type: string (or Expression with resultType string).
*
* @param preCopyScript the preCopyScript value to set.
* @return the SqlSink object itself.
*/
public SqlSink withPreCopyScript(Object preCopyScript) {
this.preCopyScript = preCopyScript;
return this;
}
/**
* Get the storedProcedureParameters property: SQL stored procedure parameters.
*
* @return the storedProcedureParameters value.
*/
public Object storedProcedureParameters() {
return this.storedProcedureParameters;
}
/**
* Set the storedProcedureParameters property: SQL stored procedure parameters.
*
* @param storedProcedureParameters the storedProcedureParameters value to set.
* @return the SqlSink object itself.
*/
public SqlSink withStoredProcedureParameters(Object storedProcedureParameters) {
this.storedProcedureParameters = storedProcedureParameters;
return this;
}
/**
* Get the storedProcedureTableTypeParameterName property: The stored procedure parameter name of the table type.
* Type: string (or Expression with resultType string).
*
* @return the storedProcedureTableTypeParameterName value.
*/
public Object storedProcedureTableTypeParameterName() {
return this.storedProcedureTableTypeParameterName;
}
/**
* Set the storedProcedureTableTypeParameterName property: The stored procedure parameter name of the table type.
* Type: string (or Expression with resultType string).
*
* @param storedProcedureTableTypeParameterName the storedProcedureTableTypeParameterName value to set.
* @return the SqlSink object itself.
*/
public SqlSink withStoredProcedureTableTypeParameterName(Object storedProcedureTableTypeParameterName) {
this.storedProcedureTableTypeParameterName = storedProcedureTableTypeParameterName;
return this;
}
/**
* Get the tableOption property: The option to handle sink table, such as autoCreate. For now only 'autoCreate'
* value is supported. Type: string (or Expression with resultType string).
*
* @return the tableOption value.
*/
public Object tableOption() {
return this.tableOption;
}
/**
* Set the tableOption property: The option to handle sink table, such as autoCreate. For now only 'autoCreate'
* value is supported. Type: string (or Expression with resultType string).
*
* @param tableOption the tableOption value to set.
* @return the SqlSink object itself.
*/
public SqlSink withTableOption(Object tableOption) {
this.tableOption = tableOption;
return this;
}
/**
* Get the sqlWriterUseTableLock property: Whether to use table lock during bulk copy. Type: boolean (or Expression
* with resultType boolean).
*
* @return the sqlWriterUseTableLock value.
*/
public Object sqlWriterUseTableLock() {
return this.sqlWriterUseTableLock;
}
/**
* Set the sqlWriterUseTableLock property: Whether to use table lock during bulk copy. Type: boolean (or Expression
* with resultType boolean).
*
* @param sqlWriterUseTableLock the sqlWriterUseTableLock value to set.
* @return the SqlSink object itself.
*/
public SqlSink withSqlWriterUseTableLock(Object sqlWriterUseTableLock) {
this.sqlWriterUseTableLock = sqlWriterUseTableLock;
return this;
}
/**
* Get the writeBehavior property: Write behavior when copying data into sql. Type: string (or Expression with
* resultType string).
*
* @return the writeBehavior value.
*/
public Object writeBehavior() {
return this.writeBehavior;
}
/**
* Set the writeBehavior property: Write behavior when copying data into sql. Type: string (or Expression with
* resultType string).
*
* @param writeBehavior the writeBehavior value to set.
* @return the SqlSink object itself.
*/
public SqlSink withWriteBehavior(Object writeBehavior) {
this.writeBehavior = writeBehavior;
return this;
}
/**
* Get the upsertSettings property: SQL upsert settings.
*
* @return the upsertSettings value.
*/
public SqlUpsertSettings upsertSettings() {
return this.upsertSettings;
}
/**
* Set the upsertSettings property: SQL upsert settings.
*
* @param upsertSettings the upsertSettings value to set.
* @return the SqlSink object itself.
*/
public SqlSink withUpsertSettings(SqlUpsertSettings upsertSettings) {
this.upsertSettings = upsertSettings;
return this;
}
/**
* {@inheritDoc}
*/
@Override
public SqlSink withWriteBatchSize(Object writeBatchSize) {
super.withWriteBatchSize(writeBatchSize);
return this;
}
/**
* {@inheritDoc}
*/
@Override
public SqlSink withWriteBatchTimeout(Object writeBatchTimeout) {
super.withWriteBatchTimeout(writeBatchTimeout);
return this;
}
/**
* {@inheritDoc}
*/
@Override
public SqlSink withSinkRetryCount(Object sinkRetryCount) {
super.withSinkRetryCount(sinkRetryCount);
return this;
}
/**
* {@inheritDoc}
*/
@Override
public SqlSink withSinkRetryWait(Object sinkRetryWait) {
super.withSinkRetryWait(sinkRetryWait);
return this;
}
/**
* {@inheritDoc}
*/
@Override
public SqlSink withMaxConcurrentConnections(Object maxConcurrentConnections) {
super.withMaxConcurrentConnections(maxConcurrentConnections);
return this;
}
/**
* {@inheritDoc}
*/
@Override
public SqlSink 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 (upsertSettings() != null) {
upsertSettings().validate();
}
}
/**
* {@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("type", this.type);
jsonWriter.writeUntypedField("sqlWriterStoredProcedureName", this.sqlWriterStoredProcedureName);
jsonWriter.writeUntypedField("sqlWriterTableType", this.sqlWriterTableType);
jsonWriter.writeUntypedField("preCopyScript", this.preCopyScript);
jsonWriter.writeUntypedField("storedProcedureParameters", this.storedProcedureParameters);
jsonWriter.writeUntypedField("storedProcedureTableTypeParameterName",
this.storedProcedureTableTypeParameterName);
jsonWriter.writeUntypedField("tableOption", this.tableOption);
jsonWriter.writeUntypedField("sqlWriterUseTableLock", this.sqlWriterUseTableLock);
jsonWriter.writeUntypedField("writeBehavior", this.writeBehavior);
jsonWriter.writeJsonField("upsertSettings", this.upsertSettings);
if (additionalProperties() != null) {
for (Map.Entry additionalProperty : additionalProperties().entrySet()) {
jsonWriter.writeUntypedField(additionalProperty.getKey(), additionalProperty.getValue());
}
}
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of SqlSink from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of SqlSink 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 SqlSink.
*/
public static SqlSink fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
SqlSink deserializedSqlSink = new SqlSink();
Map additionalProperties = null;
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("writeBatchSize".equals(fieldName)) {
deserializedSqlSink.withWriteBatchSize(reader.readUntyped());
} else if ("writeBatchTimeout".equals(fieldName)) {
deserializedSqlSink.withWriteBatchTimeout(reader.readUntyped());
} else if ("sinkRetryCount".equals(fieldName)) {
deserializedSqlSink.withSinkRetryCount(reader.readUntyped());
} else if ("sinkRetryWait".equals(fieldName)) {
deserializedSqlSink.withSinkRetryWait(reader.readUntyped());
} else if ("maxConcurrentConnections".equals(fieldName)) {
deserializedSqlSink.withMaxConcurrentConnections(reader.readUntyped());
} else if ("disableMetricsCollection".equals(fieldName)) {
deserializedSqlSink.withDisableMetricsCollection(reader.readUntyped());
} else if ("type".equals(fieldName)) {
deserializedSqlSink.type = reader.getString();
} else if ("sqlWriterStoredProcedureName".equals(fieldName)) {
deserializedSqlSink.sqlWriterStoredProcedureName = reader.readUntyped();
} else if ("sqlWriterTableType".equals(fieldName)) {
deserializedSqlSink.sqlWriterTableType = reader.readUntyped();
} else if ("preCopyScript".equals(fieldName)) {
deserializedSqlSink.preCopyScript = reader.readUntyped();
} else if ("storedProcedureParameters".equals(fieldName)) {
deserializedSqlSink.storedProcedureParameters = reader.readUntyped();
} else if ("storedProcedureTableTypeParameterName".equals(fieldName)) {
deserializedSqlSink.storedProcedureTableTypeParameterName = reader.readUntyped();
} else if ("tableOption".equals(fieldName)) {
deserializedSqlSink.tableOption = reader.readUntyped();
} else if ("sqlWriterUseTableLock".equals(fieldName)) {
deserializedSqlSink.sqlWriterUseTableLock = reader.readUntyped();
} else if ("writeBehavior".equals(fieldName)) {
deserializedSqlSink.writeBehavior = reader.readUntyped();
} else if ("upsertSettings".equals(fieldName)) {
deserializedSqlSink.upsertSettings = SqlUpsertSettings.fromJson(reader);
} else {
if (additionalProperties == null) {
additionalProperties = new LinkedHashMap<>();
}
additionalProperties.put(fieldName, reader.readUntyped());
}
}
deserializedSqlSink.withAdditionalProperties(additionalProperties);
return deserializedSqlSink;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy