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

com.azure.resourcemanager.netapp.models.VolumePatchPropertiesDataProtection 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-2024-03.

There is a newer version: 1.4.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.netapp.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;

/**
 * DataProtection
 * 
 * DataProtection type volumes include an object containing details of the replication.
 */
@Fluent
public final class VolumePatchPropertiesDataProtection
    implements JsonSerializable {
    /*
     * Backup Properties
     */
    private VolumeBackupProperties backup;

    /*
     * Snapshot properties.
     */
    private VolumeSnapshotProperties snapshot;

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

    /**
     * Get the backup property: Backup Properties.
     * 
     * @return the backup value.
     */
    public VolumeBackupProperties backup() {
        return this.backup;
    }

    /**
     * Set the backup property: Backup Properties.
     * 
     * @param backup the backup value to set.
     * @return the VolumePatchPropertiesDataProtection object itself.
     */
    public VolumePatchPropertiesDataProtection withBackup(VolumeBackupProperties backup) {
        this.backup = backup;
        return this;
    }

    /**
     * Get the snapshot property: Snapshot properties.
     * 
     * @return the snapshot value.
     */
    public VolumeSnapshotProperties snapshot() {
        return this.snapshot;
    }

    /**
     * Set the snapshot property: Snapshot properties.
     * 
     * @param snapshot the snapshot value to set.
     * @return the VolumePatchPropertiesDataProtection object itself.
     */
    public VolumePatchPropertiesDataProtection withSnapshot(VolumeSnapshotProperties snapshot) {
        this.snapshot = snapshot;
        return this;
    }

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (backup() != null) {
            backup().validate();
        }
        if (snapshot() != null) {
            snapshot().validate();
        }
    }

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

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

                if ("backup".equals(fieldName)) {
                    deserializedVolumePatchPropertiesDataProtection.backup = VolumeBackupProperties.fromJson(reader);
                } else if ("snapshot".equals(fieldName)) {
                    deserializedVolumePatchPropertiesDataProtection.snapshot
                        = VolumeSnapshotProperties.fromJson(reader);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedVolumePatchPropertiesDataProtection;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy