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

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

/**
 * Azure blobFS write settings.
 */
@Fluent
public final class AzureBlobFSWriteSettings extends StoreWriteSettings {
    /*
     * The write setting type.
     */
    private String type = "AzureBlobFSWriteSettings";

    /*
     * Indicates the block size(MB) when writing data to blob. Type: integer (or Expression with resultType integer).
     */
    private Object blockSizeInMB;

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

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

    /**
     * Get the blockSizeInMB property: Indicates the block size(MB) when writing data to blob. Type: integer (or
     * Expression with resultType integer).
     * 
     * @return the blockSizeInMB value.
     */
    public Object blockSizeInMB() {
        return this.blockSizeInMB;
    }

    /**
     * Set the blockSizeInMB property: Indicates the block size(MB) when writing data to blob. Type: integer (or
     * Expression with resultType integer).
     * 
     * @param blockSizeInMB the blockSizeInMB value to set.
     * @return the AzureBlobFSWriteSettings object itself.
     */
    public AzureBlobFSWriteSettings withBlockSizeInMB(Object blockSizeInMB) {
        this.blockSizeInMB = blockSizeInMB;
        return this;
    }

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

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

    /**
     * {@inheritDoc}
     */
    @Override
    public AzureBlobFSWriteSettings withCopyBehavior(Object copyBehavior) {
        super.withCopyBehavior(copyBehavior);
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public AzureBlobFSWriteSettings withMetadata(List metadata) {
        super.withMetadata(metadata);
        return this;
    }

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    @Override
    public void validate() {
        if (metadata() != null) {
            metadata().forEach(e -> e.validate());
        }
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeUntypedField("maxConcurrentConnections", maxConcurrentConnections());
        jsonWriter.writeUntypedField("disableMetricsCollection", disableMetricsCollection());
        jsonWriter.writeUntypedField("copyBehavior", copyBehavior());
        jsonWriter.writeArrayField("metadata", metadata(), (writer, element) -> writer.writeJson(element));
        jsonWriter.writeStringField("type", this.type);
        jsonWriter.writeUntypedField("blockSizeInMB", this.blockSizeInMB);
        if (additionalProperties() != null) {
            for (Map.Entry additionalProperty : additionalProperties().entrySet()) {
                jsonWriter.writeUntypedField(additionalProperty.getKey(), additionalProperty.getValue());
            }
        }
        return jsonWriter.writeEndObject();
    }

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

                if ("maxConcurrentConnections".equals(fieldName)) {
                    deserializedAzureBlobFSWriteSettings.withMaxConcurrentConnections(reader.readUntyped());
                } else if ("disableMetricsCollection".equals(fieldName)) {
                    deserializedAzureBlobFSWriteSettings.withDisableMetricsCollection(reader.readUntyped());
                } else if ("copyBehavior".equals(fieldName)) {
                    deserializedAzureBlobFSWriteSettings.withCopyBehavior(reader.readUntyped());
                } else if ("metadata".equals(fieldName)) {
                    List metadata = reader.readArray(reader1 -> MetadataItem.fromJson(reader1));
                    deserializedAzureBlobFSWriteSettings.withMetadata(metadata);
                } else if ("type".equals(fieldName)) {
                    deserializedAzureBlobFSWriteSettings.type = reader.getString();
                } else if ("blockSizeInMB".equals(fieldName)) {
                    deserializedAzureBlobFSWriteSettings.blockSizeInMB = reader.readUntyped();
                } else {
                    if (additionalProperties == null) {
                        additionalProperties = new LinkedHashMap<>();
                    }

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

            return deserializedAzureBlobFSWriteSettings;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy