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

com.azure.resourcemanager.datafactory.models.SapOpenHubTableDataset 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.JsonToken;
import com.azure.json.JsonWriter;
import com.azure.resourcemanager.datafactory.fluent.models.SapOpenHubTableDatasetTypeProperties;
import java.io.IOException;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

/**
 * Sap Business Warehouse Open Hub Destination Table properties.
 */
@Fluent
public final class SapOpenHubTableDataset extends Dataset {
    /*
     * Type of dataset.
     */
    private String type = "SapOpenHubTable";

    /*
     * Sap Business Warehouse Open Hub Destination Table properties.
     */
    private SapOpenHubTableDatasetTypeProperties innerTypeProperties = new SapOpenHubTableDatasetTypeProperties();

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

    /**
     * Get the type property: Type of dataset.
     * 
     * @return the type value.
     */
    @Override
    public String type() {
        return this.type;
    }

    /**
     * Get the innerTypeProperties property: Sap Business Warehouse Open Hub Destination Table properties.
     * 
     * @return the innerTypeProperties value.
     */
    private SapOpenHubTableDatasetTypeProperties innerTypeProperties() {
        return this.innerTypeProperties;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public SapOpenHubTableDataset withDescription(String description) {
        super.withDescription(description);
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public SapOpenHubTableDataset withStructure(Object structure) {
        super.withStructure(structure);
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public SapOpenHubTableDataset withSchema(Object schema) {
        super.withSchema(schema);
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public SapOpenHubTableDataset withLinkedServiceName(LinkedServiceReference linkedServiceName) {
        super.withLinkedServiceName(linkedServiceName);
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public SapOpenHubTableDataset withParameters(Map parameters) {
        super.withParameters(parameters);
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public SapOpenHubTableDataset withAnnotations(List annotations) {
        super.withAnnotations(annotations);
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public SapOpenHubTableDataset withFolder(DatasetFolder folder) {
        super.withFolder(folder);
        return this;
    }

    /**
     * Get the openHubDestinationName property: The name of the Open Hub Destination with destination type as Database
     * Table. Type: string (or Expression with resultType string).
     * 
     * @return the openHubDestinationName value.
     */
    public Object openHubDestinationName() {
        return this.innerTypeProperties() == null ? null : this.innerTypeProperties().openHubDestinationName();
    }

    /**
     * Set the openHubDestinationName property: The name of the Open Hub Destination with destination type as Database
     * Table. Type: string (or Expression with resultType string).
     * 
     * @param openHubDestinationName the openHubDestinationName value to set.
     * @return the SapOpenHubTableDataset object itself.
     */
    public SapOpenHubTableDataset withOpenHubDestinationName(Object openHubDestinationName) {
        if (this.innerTypeProperties() == null) {
            this.innerTypeProperties = new SapOpenHubTableDatasetTypeProperties();
        }
        this.innerTypeProperties().withOpenHubDestinationName(openHubDestinationName);
        return this;
    }

    /**
     * Get the excludeLastRequest property: Whether to exclude the records of the last request. The default value is
     * true. Type: boolean (or Expression with resultType boolean).
     * 
     * @return the excludeLastRequest value.
     */
    public Object excludeLastRequest() {
        return this.innerTypeProperties() == null ? null : this.innerTypeProperties().excludeLastRequest();
    }

    /**
     * Set the excludeLastRequest property: Whether to exclude the records of the last request. The default value is
     * true. Type: boolean (or Expression with resultType boolean).
     * 
     * @param excludeLastRequest the excludeLastRequest value to set.
     * @return the SapOpenHubTableDataset object itself.
     */
    public SapOpenHubTableDataset withExcludeLastRequest(Object excludeLastRequest) {
        if (this.innerTypeProperties() == null) {
            this.innerTypeProperties = new SapOpenHubTableDatasetTypeProperties();
        }
        this.innerTypeProperties().withExcludeLastRequest(excludeLastRequest);
        return this;
    }

    /**
     * Get the baseRequestId property: The ID of request for delta loading. Once it is set, only data with requestId
     * larger than the value of this property will be retrieved. The default value is 0. Type: integer (or Expression
     * with resultType integer ).
     * 
     * @return the baseRequestId value.
     */
    public Object baseRequestId() {
        return this.innerTypeProperties() == null ? null : this.innerTypeProperties().baseRequestId();
    }

    /**
     * Set the baseRequestId property: The ID of request for delta loading. Once it is set, only data with requestId
     * larger than the value of this property will be retrieved. The default value is 0. Type: integer (or Expression
     * with resultType integer ).
     * 
     * @param baseRequestId the baseRequestId value to set.
     * @return the SapOpenHubTableDataset object itself.
     */
    public SapOpenHubTableDataset withBaseRequestId(Object baseRequestId) {
        if (this.innerTypeProperties() == null) {
            this.innerTypeProperties = new SapOpenHubTableDatasetTypeProperties();
        }
        this.innerTypeProperties().withBaseRequestId(baseRequestId);
        return this;
    }

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    @Override
    public void validate() {
        if (innerTypeProperties() == null) {
            throw LOGGER.atError()
                .log(new IllegalArgumentException(
                    "Missing required property innerTypeProperties in model SapOpenHubTableDataset"));
        } else {
            innerTypeProperties().validate();
        }
        if (linkedServiceName() == null) {
            throw LOGGER.atError()
                .log(new IllegalArgumentException(
                    "Missing required property linkedServiceName in model SapOpenHubTableDataset"));
        } else {
            linkedServiceName().validate();
        }
        if (parameters() != null) {
            parameters().values().forEach(e -> {
                if (e != null) {
                    e.validate();
                }
            });
        }
        if (folder() != null) {
            folder().validate();
        }
    }

    private static final ClientLogger LOGGER = new ClientLogger(SapOpenHubTableDataset.class);

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeJsonField("linkedServiceName", linkedServiceName());
        jsonWriter.writeStringField("description", description());
        jsonWriter.writeUntypedField("structure", structure());
        jsonWriter.writeUntypedField("schema", schema());
        jsonWriter.writeMapField("parameters", parameters(), (writer, element) -> writer.writeJson(element));
        jsonWriter.writeArrayField("annotations", annotations(), (writer, element) -> writer.writeUntyped(element));
        jsonWriter.writeJsonField("folder", folder());
        jsonWriter.writeJsonField("typeProperties", this.innerTypeProperties);
        jsonWriter.writeStringField("type", this.type);
        if (additionalProperties() != null) {
            for (Map.Entry additionalProperty : additionalProperties().entrySet()) {
                jsonWriter.writeUntypedField(additionalProperty.getKey(), additionalProperty.getValue());
            }
        }
        return jsonWriter.writeEndObject();
    }

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

                if ("linkedServiceName".equals(fieldName)) {
                    deserializedSapOpenHubTableDataset.withLinkedServiceName(LinkedServiceReference.fromJson(reader));
                } else if ("description".equals(fieldName)) {
                    deserializedSapOpenHubTableDataset.withDescription(reader.getString());
                } else if ("structure".equals(fieldName)) {
                    deserializedSapOpenHubTableDataset.withStructure(reader.readUntyped());
                } else if ("schema".equals(fieldName)) {
                    deserializedSapOpenHubTableDataset.withSchema(reader.readUntyped());
                } else if ("parameters".equals(fieldName)) {
                    Map parameters
                        = reader.readMap(reader1 -> ParameterSpecification.fromJson(reader1));
                    deserializedSapOpenHubTableDataset.withParameters(parameters);
                } else if ("annotations".equals(fieldName)) {
                    List annotations = reader.readArray(reader1 -> reader1.readUntyped());
                    deserializedSapOpenHubTableDataset.withAnnotations(annotations);
                } else if ("folder".equals(fieldName)) {
                    deserializedSapOpenHubTableDataset.withFolder(DatasetFolder.fromJson(reader));
                } else if ("typeProperties".equals(fieldName)) {
                    deserializedSapOpenHubTableDataset.innerTypeProperties
                        = SapOpenHubTableDatasetTypeProperties.fromJson(reader);
                } else if ("type".equals(fieldName)) {
                    deserializedSapOpenHubTableDataset.type = reader.getString();
                } else {
                    if (additionalProperties == null) {
                        additionalProperties = new LinkedHashMap<>();
                    }

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

            return deserializedSapOpenHubTableDataset;
        });
    }
}