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

com.azure.resourcemanager.compute.models.RestorePointInstanceView Maven / Gradle / Ivy

Go to download

This package contains Microsoft Azure Compute Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt

There is a newer version: 2.44.0
Show 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.compute.models;

import com.azure.core.annotation.Fluent;
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;

/**
 * The instance view of a restore point.
 */
@Fluent
public final class RestorePointInstanceView implements JsonSerializable {
    /*
     * The disk restore points information.
     */
    private List diskRestorePoints;

    /*
     * The resource status information.
     */
    private List statuses;

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

    /**
     * Get the diskRestorePoints property: The disk restore points information.
     * 
     * @return the diskRestorePoints value.
     */
    public List diskRestorePoints() {
        return this.diskRestorePoints;
    }

    /**
     * Set the diskRestorePoints property: The disk restore points information.
     * 
     * @param diskRestorePoints the diskRestorePoints value to set.
     * @return the RestorePointInstanceView object itself.
     */
    public RestorePointInstanceView withDiskRestorePoints(List diskRestorePoints) {
        this.diskRestorePoints = diskRestorePoints;
        return this;
    }

    /**
     * Get the statuses property: The resource status information.
     * 
     * @return the statuses value.
     */
    public List statuses() {
        return this.statuses;
    }

    /**
     * Set the statuses property: The resource status information.
     * 
     * @param statuses the statuses value to set.
     * @return the RestorePointInstanceView object itself.
     */
    public RestorePointInstanceView withStatuses(List statuses) {
        this.statuses = statuses;
        return this;
    }

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (diskRestorePoints() != null) {
            diskRestorePoints().forEach(e -> e.validate());
        }
        if (statuses() != null) {
            statuses().forEach(e -> e.validate());
        }
    }

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

    /**
     * Reads an instance of RestorePointInstanceView from the JsonReader.
     * 
     * @param jsonReader The JsonReader being read.
     * @return An instance of RestorePointInstanceView if the JsonReader was pointing to an instance of it, or null if
     * it was pointing to JSON null.
     * @throws IOException If an error occurs while reading the RestorePointInstanceView.
     */
    public static RestorePointInstanceView fromJson(JsonReader jsonReader) throws IOException {
        return jsonReader.readObject(reader -> {
            RestorePointInstanceView deserializedRestorePointInstanceView = new RestorePointInstanceView();
            while (reader.nextToken() != JsonToken.END_OBJECT) {
                String fieldName = reader.getFieldName();
                reader.nextToken();

                if ("diskRestorePoints".equals(fieldName)) {
                    List diskRestorePoints
                        = reader.readArray(reader1 -> DiskRestorePointInstanceView.fromJson(reader1));
                    deserializedRestorePointInstanceView.diskRestorePoints = diskRestorePoints;
                } else if ("statuses".equals(fieldName)) {
                    List statuses
                        = reader.readArray(reader1 -> InstanceViewStatus.fromJson(reader1));
                    deserializedRestorePointInstanceView.statuses = statuses;
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedRestorePointInstanceView;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy