
com.azure.resourcemanager.datafactory.models.MapperConnection 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;
/**
* Source connection details.
*/
@Fluent
public final class MapperConnection implements JsonSerializable {
/*
* Linked service reference.
*/
private LinkedServiceReference linkedService;
/*
* Type of the linked service e.g.: AzureBlobFS.
*/
private String linkedServiceType;
/*
* Type of connection via linked service or dataset.
*/
private ConnectionType type;
/*
* A boolean indicating whether linked service is of type inline dataset. Currently only inline datasets are
* supported.
*/
private Boolean isInlineDataset;
/*
* List of name/value pairs for connection properties.
*/
private List commonDslConnectorProperties;
/**
* Creates an instance of MapperConnection class.
*/
public MapperConnection() {
}
/**
* Get the linkedService property: Linked service reference.
*
* @return the linkedService value.
*/
public LinkedServiceReference linkedService() {
return this.linkedService;
}
/**
* Set the linkedService property: Linked service reference.
*
* @param linkedService the linkedService value to set.
* @return the MapperConnection object itself.
*/
public MapperConnection withLinkedService(LinkedServiceReference linkedService) {
this.linkedService = linkedService;
return this;
}
/**
* Get the linkedServiceType property: Type of the linked service e.g.: AzureBlobFS.
*
* @return the linkedServiceType value.
*/
public String linkedServiceType() {
return this.linkedServiceType;
}
/**
* Set the linkedServiceType property: Type of the linked service e.g.: AzureBlobFS.
*
* @param linkedServiceType the linkedServiceType value to set.
* @return the MapperConnection object itself.
*/
public MapperConnection withLinkedServiceType(String linkedServiceType) {
this.linkedServiceType = linkedServiceType;
return this;
}
/**
* Get the type property: Type of connection via linked service or dataset.
*
* @return the type value.
*/
public ConnectionType type() {
return this.type;
}
/**
* Set the type property: Type of connection via linked service or dataset.
*
* @param type the type value to set.
* @return the MapperConnection object itself.
*/
public MapperConnection withType(ConnectionType type) {
this.type = type;
return this;
}
/**
* Get the isInlineDataset property: A boolean indicating whether linked service is of type inline dataset.
* Currently only inline datasets are supported.
*
* @return the isInlineDataset value.
*/
public Boolean isInlineDataset() {
return this.isInlineDataset;
}
/**
* Set the isInlineDataset property: A boolean indicating whether linked service is of type inline dataset.
* Currently only inline datasets are supported.
*
* @param isInlineDataset the isInlineDataset value to set.
* @return the MapperConnection object itself.
*/
public MapperConnection withIsInlineDataset(Boolean isInlineDataset) {
this.isInlineDataset = isInlineDataset;
return this;
}
/**
* Get the commonDslConnectorProperties property: List of name/value pairs for connection properties.
*
* @return the commonDslConnectorProperties value.
*/
public List commonDslConnectorProperties() {
return this.commonDslConnectorProperties;
}
/**
* Set the commonDslConnectorProperties property: List of name/value pairs for connection properties.
*
* @param commonDslConnectorProperties the commonDslConnectorProperties value to set.
* @return the MapperConnection object itself.
*/
public MapperConnection
withCommonDslConnectorProperties(List commonDslConnectorProperties) {
this.commonDslConnectorProperties = commonDslConnectorProperties;
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (linkedService() != null) {
linkedService().validate();
}
if (type() == null) {
throw LOGGER.atError()
.log(new IllegalArgumentException("Missing required property type in model MapperConnection"));
}
if (commonDslConnectorProperties() != null) {
commonDslConnectorProperties().forEach(e -> e.validate());
}
}
private static final ClientLogger LOGGER = new ClientLogger(MapperConnection.class);
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString());
jsonWriter.writeJsonField("linkedService", this.linkedService);
jsonWriter.writeStringField("linkedServiceType", this.linkedServiceType);
jsonWriter.writeBooleanField("isInlineDataset", this.isInlineDataset);
jsonWriter.writeArrayField("commonDslConnectorProperties", this.commonDslConnectorProperties,
(writer, element) -> writer.writeJson(element));
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of MapperConnection from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of MapperConnection 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 MapperConnection.
*/
public static MapperConnection fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
MapperConnection deserializedMapperConnection = new MapperConnection();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("type".equals(fieldName)) {
deserializedMapperConnection.type = ConnectionType.fromString(reader.getString());
} else if ("linkedService".equals(fieldName)) {
deserializedMapperConnection.linkedService = LinkedServiceReference.fromJson(reader);
} else if ("linkedServiceType".equals(fieldName)) {
deserializedMapperConnection.linkedServiceType = reader.getString();
} else if ("isInlineDataset".equals(fieldName)) {
deserializedMapperConnection.isInlineDataset = reader.getNullable(JsonReader::getBoolean);
} else if ("commonDslConnectorProperties".equals(fieldName)) {
List commonDslConnectorProperties
= reader.readArray(reader1 -> MapperDslConnectorProperties.fromJson(reader1));
deserializedMapperConnection.commonDslConnectorProperties = commonDslConnectorProperties;
} else {
reader.skipChildren();
}
}
return deserializedMapperConnection;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy