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

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

/**
 * Azure ML WebService Input/Output file.
 */
@Fluent
public final class AzureMLWebServiceFile implements JsonSerializable {
    /*
     * The relative file path, including container name, in the Azure Blob Storage specified by the LinkedService. Type:
     * string (or Expression with resultType string).
     */
    private Object filePath;

    /*
     * Reference to an Azure Storage LinkedService, where Azure ML WebService Input/Output file located.
     */
    private LinkedServiceReference linkedServiceName;

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

    /**
     * Get the filePath property: The relative file path, including container name, in the Azure Blob Storage specified
     * by the LinkedService. Type: string (or Expression with resultType string).
     * 
     * @return the filePath value.
     */
    public Object filePath() {
        return this.filePath;
    }

    /**
     * Set the filePath property: The relative file path, including container name, in the Azure Blob Storage specified
     * by the LinkedService. Type: string (or Expression with resultType string).
     * 
     * @param filePath the filePath value to set.
     * @return the AzureMLWebServiceFile object itself.
     */
    public AzureMLWebServiceFile withFilePath(Object filePath) {
        this.filePath = filePath;
        return this;
    }

    /**
     * Get the linkedServiceName property: Reference to an Azure Storage LinkedService, where Azure ML WebService
     * Input/Output file located.
     * 
     * @return the linkedServiceName value.
     */
    public LinkedServiceReference linkedServiceName() {
        return this.linkedServiceName;
    }

    /**
     * Set the linkedServiceName property: Reference to an Azure Storage LinkedService, where Azure ML WebService
     * Input/Output file located.
     * 
     * @param linkedServiceName the linkedServiceName value to set.
     * @return the AzureMLWebServiceFile object itself.
     */
    public AzureMLWebServiceFile withLinkedServiceName(LinkedServiceReference linkedServiceName) {
        this.linkedServiceName = linkedServiceName;
        return this;
    }

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

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

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

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

                if ("filePath".equals(fieldName)) {
                    deserializedAzureMLWebServiceFile.filePath = reader.readUntyped();
                } else if ("linkedServiceName".equals(fieldName)) {
                    deserializedAzureMLWebServiceFile.linkedServiceName = LinkedServiceReference.fromJson(reader);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedAzureMLWebServiceFile;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy