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

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

/**
 * The Amazon S3 settings needed for the interim Amazon S3 when copying from Amazon Redshift with unload. With this,
 * data from Amazon Redshift source will be unloaded into S3 first and then copied into the targeted sink from the
 * interim S3.
 */
@Fluent
public final class RedshiftUnloadSettings implements JsonSerializable {
    /*
     * The name of the Amazon S3 linked service which will be used for the unload operation when copying from the Amazon
     * Redshift source.
     */
    private LinkedServiceReference s3LinkedServiceName;

    /*
     * The bucket of the interim Amazon S3 which will be used to store the unloaded data from Amazon Redshift source.
     * The bucket must be in the same region as the Amazon Redshift source. Type: string (or Expression with resultType
     * string).
     */
    private Object bucketName;

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

    /**
     * Get the s3LinkedServiceName property: The name of the Amazon S3 linked service which will be used for the unload
     * operation when copying from the Amazon Redshift source.
     * 
     * @return the s3LinkedServiceName value.
     */
    public LinkedServiceReference s3LinkedServiceName() {
        return this.s3LinkedServiceName;
    }

    /**
     * Set the s3LinkedServiceName property: The name of the Amazon S3 linked service which will be used for the unload
     * operation when copying from the Amazon Redshift source.
     * 
     * @param s3LinkedServiceName the s3LinkedServiceName value to set.
     * @return the RedshiftUnloadSettings object itself.
     */
    public RedshiftUnloadSettings withS3LinkedServiceName(LinkedServiceReference s3LinkedServiceName) {
        this.s3LinkedServiceName = s3LinkedServiceName;
        return this;
    }

    /**
     * Get the bucketName property: The bucket of the interim Amazon S3 which will be used to store the unloaded data
     * from Amazon Redshift source. The bucket must be in the same region as the Amazon Redshift source. Type: string
     * (or Expression with resultType string).
     * 
     * @return the bucketName value.
     */
    public Object bucketName() {
        return this.bucketName;
    }

    /**
     * Set the bucketName property: The bucket of the interim Amazon S3 which will be used to store the unloaded data
     * from Amazon Redshift source. The bucket must be in the same region as the Amazon Redshift source. Type: string
     * (or Expression with resultType string).
     * 
     * @param bucketName the bucketName value to set.
     * @return the RedshiftUnloadSettings object itself.
     */
    public RedshiftUnloadSettings withBucketName(Object bucketName) {
        this.bucketName = bucketName;
        return this;
    }

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (s3LinkedServiceName() == null) {
            throw LOGGER.atError()
                .log(new IllegalArgumentException(
                    "Missing required property s3LinkedServiceName in model RedshiftUnloadSettings"));
        } else {
            s3LinkedServiceName().validate();
        }
        if (bucketName() == null) {
            throw LOGGER.atError()
                .log(new IllegalArgumentException(
                    "Missing required property bucketName in model RedshiftUnloadSettings"));
        }
    }

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

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeJsonField("s3LinkedServiceName", this.s3LinkedServiceName);
        jsonWriter.writeUntypedField("bucketName", this.bucketName);
        return jsonWriter.writeEndObject();
    }

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

                if ("s3LinkedServiceName".equals(fieldName)) {
                    deserializedRedshiftUnloadSettings.s3LinkedServiceName = LinkedServiceReference.fromJson(reader);
                } else if ("bucketName".equals(fieldName)) {
                    deserializedRedshiftUnloadSettings.bucketName = reader.readUntyped();
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedRedshiftUnloadSettings;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy