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

com.azure.resourcemanager.netapp.models.SnapshotRestoreFiles 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;
import java.util.List;

/**
 * Restore payload for Single File Snapshot Restore.
 */
@Fluent
public final class SnapshotRestoreFiles implements JsonSerializable {
    /*
     * List of files to be restored
     */
    private List filePaths;

    /*
     * Destination folder where the files will be restored
     */
    private String destinationPath;

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

    /**
     * Get the filePaths property: List of files to be restored.
     * 
     * @return the filePaths value.
     */
    public List filePaths() {
        return this.filePaths;
    }

    /**
     * Set the filePaths property: List of files to be restored.
     * 
     * @param filePaths the filePaths value to set.
     * @return the SnapshotRestoreFiles object itself.
     */
    public SnapshotRestoreFiles withFilePaths(List filePaths) {
        this.filePaths = filePaths;
        return this;
    }

    /**
     * Get the destinationPath property: Destination folder where the files will be restored.
     * 
     * @return the destinationPath value.
     */
    public String destinationPath() {
        return this.destinationPath;
    }

    /**
     * Set the destinationPath property: Destination folder where the files will be restored.
     * 
     * @param destinationPath the destinationPath value to set.
     * @return the SnapshotRestoreFiles object itself.
     */
    public SnapshotRestoreFiles withDestinationPath(String destinationPath) {
        this.destinationPath = destinationPath;
        return this;
    }

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

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

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeArrayField("filePaths", this.filePaths, (writer, element) -> writer.writeString(element));
        jsonWriter.writeStringField("destinationPath", this.destinationPath);
        return jsonWriter.writeEndObject();
    }

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

                if ("filePaths".equals(fieldName)) {
                    List filePaths = reader.readArray(reader1 -> reader1.getString());
                    deserializedSnapshotRestoreFiles.filePaths = filePaths;
                } else if ("destinationPath".equals(fieldName)) {
                    deserializedSnapshotRestoreFiles.destinationPath = reader.getString();
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedSnapshotRestoreFiles;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy