com.azure.resourcemanager.netapp.models.BackupRestoreFiles Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-netapp Show documentation
Show all versions of azure-resourcemanager-netapp Show documentation
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-2024-03.
// 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 Backup Restore.
*/
@Fluent
public final class BackupRestoreFiles implements JsonSerializable {
/*
* List of files to be restored
*/
private List fileList;
/*
* Destination folder where the files will be restored. The path name should start with a forward slash. If it is
* omitted from request then restore is done at the root folder of the destination volume by default
*/
private String restoreFilePath;
/*
* Resource Id of the destination volume on which the files need to be restored
*/
private String destinationVolumeId;
/**
* Creates an instance of BackupRestoreFiles class.
*/
public BackupRestoreFiles() {
}
/**
* Get the fileList property: List of files to be restored.
*
* @return the fileList value.
*/
public List fileList() {
return this.fileList;
}
/**
* Set the fileList property: List of files to be restored.
*
* @param fileList the fileList value to set.
* @return the BackupRestoreFiles object itself.
*/
public BackupRestoreFiles withFileList(List fileList) {
this.fileList = fileList;
return this;
}
/**
* Get the restoreFilePath property: Destination folder where the files will be restored. The path name should start
* with a forward slash. If it is omitted from request then restore is done at the root folder of the destination
* volume by default.
*
* @return the restoreFilePath value.
*/
public String restoreFilePath() {
return this.restoreFilePath;
}
/**
* Set the restoreFilePath property: Destination folder where the files will be restored. The path name should start
* with a forward slash. If it is omitted from request then restore is done at the root folder of the destination
* volume by default.
*
* @param restoreFilePath the restoreFilePath value to set.
* @return the BackupRestoreFiles object itself.
*/
public BackupRestoreFiles withRestoreFilePath(String restoreFilePath) {
this.restoreFilePath = restoreFilePath;
return this;
}
/**
* Get the destinationVolumeId property: Resource Id of the destination volume on which the files need to be
* restored.
*
* @return the destinationVolumeId value.
*/
public String destinationVolumeId() {
return this.destinationVolumeId;
}
/**
* Set the destinationVolumeId property: Resource Id of the destination volume on which the files need to be
* restored.
*
* @param destinationVolumeId the destinationVolumeId value to set.
* @return the BackupRestoreFiles object itself.
*/
public BackupRestoreFiles withDestinationVolumeId(String destinationVolumeId) {
this.destinationVolumeId = destinationVolumeId;
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (fileList() == null) {
throw LOGGER.atError()
.log(new IllegalArgumentException("Missing required property fileList in model BackupRestoreFiles"));
}
if (destinationVolumeId() == null) {
throw LOGGER.atError()
.log(new IllegalArgumentException(
"Missing required property destinationVolumeId in model BackupRestoreFiles"));
}
}
private static final ClientLogger LOGGER = new ClientLogger(BackupRestoreFiles.class);
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeArrayField("fileList", this.fileList, (writer, element) -> writer.writeString(element));
jsonWriter.writeStringField("destinationVolumeId", this.destinationVolumeId);
jsonWriter.writeStringField("restoreFilePath", this.restoreFilePath);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of BackupRestoreFiles from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of BackupRestoreFiles 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 BackupRestoreFiles.
*/
public static BackupRestoreFiles fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
BackupRestoreFiles deserializedBackupRestoreFiles = new BackupRestoreFiles();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("fileList".equals(fieldName)) {
List fileList = reader.readArray(reader1 -> reader1.getString());
deserializedBackupRestoreFiles.fileList = fileList;
} else if ("destinationVolumeId".equals(fieldName)) {
deserializedBackupRestoreFiles.destinationVolumeId = reader.getString();
} else if ("restoreFilePath".equals(fieldName)) {
deserializedBackupRestoreFiles.restoreFilePath = reader.getString();
} else {
reader.skipChildren();
}
}
return deserializedBackupRestoreFiles;
});
}
}