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

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

/**
 * (Deprecated. Please use LogSettings) Log storage settings.
 */
@Fluent
public final class LogStorageSettings implements JsonSerializable {
    /*
     * Log storage linked service reference.
     */
    private LinkedServiceReference linkedServiceName;

    /*
     * The path to storage for storing detailed logs of activity execution. Type: string (or Expression with resultType
     * string).
     */
    private Object path;

    /*
     * Gets or sets the log level, support: Info, Warning. Type: string (or Expression with resultType string).
     */
    private Object logLevel;

    /*
     * Specifies whether to enable reliable logging. Type: boolean (or Expression with resultType boolean).
     */
    private Object enableReliableLogging;

    /*
     * (Deprecated. Please use LogSettings) Log storage settings.
     */
    private Map additionalProperties;

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

    /**
     * Get the linkedServiceName property: Log storage linked service reference.
     * 
     * @return the linkedServiceName value.
     */
    public LinkedServiceReference linkedServiceName() {
        return this.linkedServiceName;
    }

    /**
     * Set the linkedServiceName property: Log storage linked service reference.
     * 
     * @param linkedServiceName the linkedServiceName value to set.
     * @return the LogStorageSettings object itself.
     */
    public LogStorageSettings withLinkedServiceName(LinkedServiceReference linkedServiceName) {
        this.linkedServiceName = linkedServiceName;
        return this;
    }

    /**
     * Get the path property: The path to storage for storing detailed logs of activity execution. Type: string (or
     * Expression with resultType string).
     * 
     * @return the path value.
     */
    public Object path() {
        return this.path;
    }

    /**
     * Set the path property: The path to storage for storing detailed logs of activity execution. Type: string (or
     * Expression with resultType string).
     * 
     * @param path the path value to set.
     * @return the LogStorageSettings object itself.
     */
    public LogStorageSettings withPath(Object path) {
        this.path = path;
        return this;
    }

    /**
     * Get the logLevel property: Gets or sets the log level, support: Info, Warning. Type: string (or Expression with
     * resultType string).
     * 
     * @return the logLevel value.
     */
    public Object logLevel() {
        return this.logLevel;
    }

    /**
     * Set the logLevel property: Gets or sets the log level, support: Info, Warning. Type: string (or Expression with
     * resultType string).
     * 
     * @param logLevel the logLevel value to set.
     * @return the LogStorageSettings object itself.
     */
    public LogStorageSettings withLogLevel(Object logLevel) {
        this.logLevel = logLevel;
        return this;
    }

    /**
     * Get the enableReliableLogging property: Specifies whether to enable reliable logging. Type: boolean (or
     * Expression with resultType boolean).
     * 
     * @return the enableReliableLogging value.
     */
    public Object enableReliableLogging() {
        return this.enableReliableLogging;
    }

    /**
     * Set the enableReliableLogging property: Specifies whether to enable reliable logging. Type: boolean (or
     * Expression with resultType boolean).
     * 
     * @param enableReliableLogging the enableReliableLogging value to set.
     * @return the LogStorageSettings object itself.
     */
    public LogStorageSettings withEnableReliableLogging(Object enableReliableLogging) {
        this.enableReliableLogging = enableReliableLogging;
        return this;
    }

    /**
     * Get the additionalProperties property: (Deprecated. Please use LogSettings) Log storage settings.
     * 
     * @return the additionalProperties value.
     */
    public Map additionalProperties() {
        return this.additionalProperties;
    }

    /**
     * Set the additionalProperties property: (Deprecated. Please use LogSettings) Log storage settings.
     * 
     * @param additionalProperties the additionalProperties value to set.
     * @return the LogStorageSettings object itself.
     */
    public LogStorageSettings withAdditionalProperties(Map additionalProperties) {
        this.additionalProperties = additionalProperties;
        return this;
    }

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

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

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeJsonField("linkedServiceName", this.linkedServiceName);
        jsonWriter.writeUntypedField("path", this.path);
        jsonWriter.writeUntypedField("logLevel", this.logLevel);
        jsonWriter.writeUntypedField("enableReliableLogging", this.enableReliableLogging);
        if (additionalProperties != null) {
            for (Map.Entry additionalProperty : additionalProperties.entrySet()) {
                jsonWriter.writeUntypedField(additionalProperty.getKey(), additionalProperty.getValue());
            }
        }
        return jsonWriter.writeEndObject();
    }

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

                if ("linkedServiceName".equals(fieldName)) {
                    deserializedLogStorageSettings.linkedServiceName = LinkedServiceReference.fromJson(reader);
                } else if ("path".equals(fieldName)) {
                    deserializedLogStorageSettings.path = reader.readUntyped();
                } else if ("logLevel".equals(fieldName)) {
                    deserializedLogStorageSettings.logLevel = reader.readUntyped();
                } else if ("enableReliableLogging".equals(fieldName)) {
                    deserializedLogStorageSettings.enableReliableLogging = reader.readUntyped();
                } else {
                    if (additionalProperties == null) {
                        additionalProperties = new LinkedHashMap<>();
                    }

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

            return deserializedLogStorageSettings;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy