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

com.azure.resourcemanager.netapp.models.RemotePath Maven / Gradle / Ivy

Go to download

This package contains Microsoft Azure SDK for NetAppFiles Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Microsoft NetApp Files Azure Resource Provider specification. Package tag package-preview-2024-07-01-preview.

The newest version!
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.netapp.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 full path to a volume that is to be migrated into ANF. Required for Migration volumes.
 */
@Fluent
public final class RemotePath implements JsonSerializable {
    /*
     * The Path to a ONTAP Host
     */
    private String externalHostname;

    /*
     * The name of a server on the ONTAP Host
     */
    private String serverName;

    /*
     * The name of a volume on the server
     */
    private String volumeName;

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

    /**
     * Get the externalHostname property: The Path to a ONTAP Host.
     * 
     * @return the externalHostname value.
     */
    public String externalHostname() {
        return this.externalHostname;
    }

    /**
     * Set the externalHostname property: The Path to a ONTAP Host.
     * 
     * @param externalHostname the externalHostname value to set.
     * @return the RemotePath object itself.
     */
    public RemotePath withExternalHostname(String externalHostname) {
        this.externalHostname = externalHostname;
        return this;
    }

    /**
     * Get the serverName property: The name of a server on the ONTAP Host.
     * 
     * @return the serverName value.
     */
    public String serverName() {
        return this.serverName;
    }

    /**
     * Set the serverName property: The name of a server on the ONTAP Host.
     * 
     * @param serverName the serverName value to set.
     * @return the RemotePath object itself.
     */
    public RemotePath withServerName(String serverName) {
        this.serverName = serverName;
        return this;
    }

    /**
     * Get the volumeName property: The name of a volume on the server.
     * 
     * @return the volumeName value.
     */
    public String volumeName() {
        return this.volumeName;
    }

    /**
     * Set the volumeName property: The name of a volume on the server.
     * 
     * @param volumeName the volumeName value to set.
     * @return the RemotePath object itself.
     */
    public RemotePath withVolumeName(String volumeName) {
        this.volumeName = volumeName;
        return this;
    }

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

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

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("externalHostName", this.externalHostname);
        jsonWriter.writeStringField("serverName", this.serverName);
        jsonWriter.writeStringField("volumeName", this.volumeName);
        return jsonWriter.writeEndObject();
    }

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

                if ("externalHostName".equals(fieldName)) {
                    deserializedRemotePath.externalHostname = reader.getString();
                } else if ("serverName".equals(fieldName)) {
                    deserializedRemotePath.serverName = reader.getString();
                } else if ("volumeName".equals(fieldName)) {
                    deserializedRemotePath.volumeName = reader.getString();
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedRemotePath;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy