
com.azure.resourcemanager.datafactory.models.DatasetLocation 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.LinkedHashMap;
import java.util.Map;
/**
* Dataset location.
*/
@Fluent
public class DatasetLocation implements JsonSerializable {
/*
* Type of dataset storage location.
*/
private String type = "DatasetLocation";
/*
* Specify the folder path of dataset. Type: string (or Expression with resultType string)
*/
private Object folderPath;
/*
* Specify the file name of dataset. Type: string (or Expression with resultType string).
*/
private Object fileName;
/*
* Dataset location.
*/
private Map additionalProperties;
/**
* Creates an instance of DatasetLocation class.
*/
public DatasetLocation() {
}
/**
* Get the type property: Type of dataset storage location.
*
* @return the type value.
*/
public String type() {
return this.type;
}
/**
* Get the folderPath property: Specify the folder path of dataset. Type: string (or Expression with resultType
* string).
*
* @return the folderPath value.
*/
public Object folderPath() {
return this.folderPath;
}
/**
* Set the folderPath property: Specify the folder path of dataset. Type: string (or Expression with resultType
* string).
*
* @param folderPath the folderPath value to set.
* @return the DatasetLocation object itself.
*/
public DatasetLocation withFolderPath(Object folderPath) {
this.folderPath = folderPath;
return this;
}
/**
* Get the fileName property: Specify the file name of dataset. Type: string (or Expression with resultType string).
*
* @return the fileName value.
*/
public Object fileName() {
return this.fileName;
}
/**
* Set the fileName property: Specify the file name of dataset. Type: string (or Expression with resultType string).
*
* @param fileName the fileName value to set.
* @return the DatasetLocation object itself.
*/
public DatasetLocation withFileName(Object fileName) {
this.fileName = fileName;
return this;
}
/**
* Get the additionalProperties property: Dataset location.
*
* @return the additionalProperties value.
*/
public Map additionalProperties() {
return this.additionalProperties;
}
/**
* Set the additionalProperties property: Dataset location.
*
* @param additionalProperties the additionalProperties value to set.
* @return the DatasetLocation object itself.
*/
public DatasetLocation withAdditionalProperties(Map additionalProperties) {
this.additionalProperties = additionalProperties;
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
}
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeStringField("type", this.type);
jsonWriter.writeUntypedField("folderPath", this.folderPath);
jsonWriter.writeUntypedField("fileName", this.fileName);
if (additionalProperties != null) {
for (Map.Entry additionalProperty : additionalProperties.entrySet()) {
jsonWriter.writeUntypedField(additionalProperty.getKey(), additionalProperty.getValue());
}
}
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of DatasetLocation from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of DatasetLocation 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 DatasetLocation.
*/
public static DatasetLocation fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
String discriminatorValue = null;
try (JsonReader readerToUse = reader.bufferObject()) {
readerToUse.nextToken(); // Prepare for reading
while (readerToUse.nextToken() != JsonToken.END_OBJECT) {
String fieldName = readerToUse.getFieldName();
readerToUse.nextToken();
if ("type".equals(fieldName)) {
discriminatorValue = readerToUse.getString();
break;
} else {
readerToUse.skipChildren();
}
}
// Use the discriminator value to determine which subtype should be deserialized.
if ("AzureBlobStorageLocation".equals(discriminatorValue)) {
return AzureBlobStorageLocation.fromJson(readerToUse.reset());
} else if ("AzureBlobFSLocation".equals(discriminatorValue)) {
return AzureBlobFSLocation.fromJson(readerToUse.reset());
} else if ("AzureDataLakeStoreLocation".equals(discriminatorValue)) {
return AzureDataLakeStoreLocation.fromJson(readerToUse.reset());
} else if ("AmazonS3Location".equals(discriminatorValue)) {
return AmazonS3Location.fromJson(readerToUse.reset());
} else if ("FileServerLocation".equals(discriminatorValue)) {
return FileServerLocation.fromJson(readerToUse.reset());
} else if ("AzureFileStorageLocation".equals(discriminatorValue)) {
return AzureFileStorageLocation.fromJson(readerToUse.reset());
} else if ("AmazonS3CompatibleLocation".equals(discriminatorValue)) {
return AmazonS3CompatibleLocation.fromJson(readerToUse.reset());
} else if ("OracleCloudStorageLocation".equals(discriminatorValue)) {
return OracleCloudStorageLocation.fromJson(readerToUse.reset());
} else if ("GoogleCloudStorageLocation".equals(discriminatorValue)) {
return GoogleCloudStorageLocation.fromJson(readerToUse.reset());
} else if ("FtpServerLocation".equals(discriminatorValue)) {
return FtpServerLocation.fromJson(readerToUse.reset());
} else if ("SftpLocation".equals(discriminatorValue)) {
return SftpLocation.fromJson(readerToUse.reset());
} else if ("HttpServerLocation".equals(discriminatorValue)) {
return HttpServerLocation.fromJson(readerToUse.reset());
} else if ("HdfsLocation".equals(discriminatorValue)) {
return HdfsLocation.fromJson(readerToUse.reset());
} else if ("LakeHouseLocation".equals(discriminatorValue)) {
return LakeHouseLocation.fromJson(readerToUse.reset());
} else {
return fromJsonKnownDiscriminator(readerToUse.reset());
}
}
});
}
static DatasetLocation fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
DatasetLocation deserializedDatasetLocation = new DatasetLocation();
Map additionalProperties = null;
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("type".equals(fieldName)) {
deserializedDatasetLocation.type = reader.getString();
} else if ("folderPath".equals(fieldName)) {
deserializedDatasetLocation.folderPath = reader.readUntyped();
} else if ("fileName".equals(fieldName)) {
deserializedDatasetLocation.fileName = reader.readUntyped();
} else {
if (additionalProperties == null) {
additionalProperties = new LinkedHashMap<>();
}
additionalProperties.put(fieldName, reader.readUntyped());
}
}
deserializedDatasetLocation.additionalProperties = additionalProperties;
return deserializedDatasetLocation;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy