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

com.azure.resourcemanager.datafactory.models.StoreReadSettings 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;

/**
 * Connector read setting.
 */
@Fluent
public class StoreReadSettings implements JsonSerializable {
    /*
     * The read setting type.
     */
    private String type = "StoreReadSettings";

    /*
     * The maximum concurrent connection count for the source data store. Type: integer (or Expression with resultType
     * integer).
     */
    private Object maxConcurrentConnections;

    /*
     * If true, disable data store metrics collection. Default is false. Type: boolean (or Expression with resultType
     * boolean).
     */
    private Object disableMetricsCollection;

    /*
     * Connector read setting.
     */
    private Map additionalProperties;

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

    /**
     * Get the type property: The read setting type.
     * 
     * @return the type value.
     */
    public String type() {
        return this.type;
    }

    /**
     * Get the maxConcurrentConnections property: The maximum concurrent connection count for the source data store.
     * Type: integer (or Expression with resultType integer).
     * 
     * @return the maxConcurrentConnections value.
     */
    public Object maxConcurrentConnections() {
        return this.maxConcurrentConnections;
    }

    /**
     * Set the maxConcurrentConnections property: The maximum concurrent connection count for the source data store.
     * Type: integer (or Expression with resultType integer).
     * 
     * @param maxConcurrentConnections the maxConcurrentConnections value to set.
     * @return the StoreReadSettings object itself.
     */
    public StoreReadSettings withMaxConcurrentConnections(Object maxConcurrentConnections) {
        this.maxConcurrentConnections = maxConcurrentConnections;
        return this;
    }

    /**
     * Get the disableMetricsCollection property: If true, disable data store metrics collection. Default is false.
     * Type: boolean (or Expression with resultType boolean).
     * 
     * @return the disableMetricsCollection value.
     */
    public Object disableMetricsCollection() {
        return this.disableMetricsCollection;
    }

    /**
     * Set the disableMetricsCollection property: If true, disable data store metrics collection. Default is false.
     * Type: boolean (or Expression with resultType boolean).
     * 
     * @param disableMetricsCollection the disableMetricsCollection value to set.
     * @return the StoreReadSettings object itself.
     */
    public StoreReadSettings withDisableMetricsCollection(Object disableMetricsCollection) {
        this.disableMetricsCollection = disableMetricsCollection;
        return this;
    }

    /**
     * Get the additionalProperties property: Connector read setting.
     * 
     * @return the additionalProperties value.
     */
    public Map additionalProperties() {
        return this.additionalProperties;
    }

    /**
     * Set the additionalProperties property: Connector read setting.
     * 
     * @param additionalProperties the additionalProperties value to set.
     * @return the StoreReadSettings object itself.
     */
    public StoreReadSettings 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("maxConcurrentConnections", this.maxConcurrentConnections);
        jsonWriter.writeUntypedField("disableMetricsCollection", this.disableMetricsCollection);
        if (additionalProperties != null) {
            for (Map.Entry additionalProperty : additionalProperties.entrySet()) {
                jsonWriter.writeUntypedField(additionalProperty.getKey(), additionalProperty.getValue());
            }
        }
        return jsonWriter.writeEndObject();
    }

    /**
     * Reads an instance of StoreReadSettings from the JsonReader.
     * 
     * @param jsonReader The JsonReader being read.
     * @return An instance of StoreReadSettings 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 StoreReadSettings.
     */
    public static StoreReadSettings 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 ("AzureBlobStorageReadSettings".equals(discriminatorValue)) {
                    return AzureBlobStorageReadSettings.fromJson(readerToUse.reset());
                } else if ("AzureBlobFSReadSettings".equals(discriminatorValue)) {
                    return AzureBlobFSReadSettings.fromJson(readerToUse.reset());
                } else if ("AzureDataLakeStoreReadSettings".equals(discriminatorValue)) {
                    return AzureDataLakeStoreReadSettings.fromJson(readerToUse.reset());
                } else if ("AmazonS3ReadSettings".equals(discriminatorValue)) {
                    return AmazonS3ReadSettings.fromJson(readerToUse.reset());
                } else if ("FileServerReadSettings".equals(discriminatorValue)) {
                    return FileServerReadSettings.fromJson(readerToUse.reset());
                } else if ("AzureFileStorageReadSettings".equals(discriminatorValue)) {
                    return AzureFileStorageReadSettings.fromJson(readerToUse.reset());
                } else if ("AmazonS3CompatibleReadSettings".equals(discriminatorValue)) {
                    return AmazonS3CompatibleReadSettings.fromJson(readerToUse.reset());
                } else if ("OracleCloudStorageReadSettings".equals(discriminatorValue)) {
                    return OracleCloudStorageReadSettings.fromJson(readerToUse.reset());
                } else if ("GoogleCloudStorageReadSettings".equals(discriminatorValue)) {
                    return GoogleCloudStorageReadSettings.fromJson(readerToUse.reset());
                } else if ("FtpReadSettings".equals(discriminatorValue)) {
                    return FtpReadSettings.fromJson(readerToUse.reset());
                } else if ("SftpReadSettings".equals(discriminatorValue)) {
                    return SftpReadSettings.fromJson(readerToUse.reset());
                } else if ("HttpReadSettings".equals(discriminatorValue)) {
                    return HttpReadSettings.fromJson(readerToUse.reset());
                } else if ("HdfsReadSettings".equals(discriminatorValue)) {
                    return HdfsReadSettings.fromJson(readerToUse.reset());
                } else if ("LakeHouseReadSettings".equals(discriminatorValue)) {
                    return LakeHouseReadSettings.fromJson(readerToUse.reset());
                } else {
                    return fromJsonKnownDiscriminator(readerToUse.reset());
                }
            }
        });
    }

    static StoreReadSettings fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException {
        return jsonReader.readObject(reader -> {
            StoreReadSettings deserializedStoreReadSettings = new StoreReadSettings();
            Map additionalProperties = null;
            while (reader.nextToken() != JsonToken.END_OBJECT) {
                String fieldName = reader.getFieldName();
                reader.nextToken();

                if ("type".equals(fieldName)) {
                    deserializedStoreReadSettings.type = reader.getString();
                } else if ("maxConcurrentConnections".equals(fieldName)) {
                    deserializedStoreReadSettings.maxConcurrentConnections = reader.readUntyped();
                } else if ("disableMetricsCollection".equals(fieldName)) {
                    deserializedStoreReadSettings.disableMetricsCollection = reader.readUntyped();
                } else {
                    if (additionalProperties == null) {
                        additionalProperties = new LinkedHashMap<>();
                    }

                    additionalProperties.put(fieldName, reader.readUntyped());
                }
            }
            deserializedStoreReadSettings.additionalProperties = additionalProperties;

            return deserializedStoreReadSettings;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy