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

com.azure.resourcemanager.netapp.fluent.models.BackupProperties 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.fluent.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.util.CoreUtils;
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 com.azure.resourcemanager.netapp.models.BackupType;
import java.io.IOException;
import java.time.OffsetDateTime;

/**
 * Backup properties.
 */
@Fluent
public final class BackupProperties implements JsonSerializable {
    /*
     * UUID v4 used to identify the Backup
     */
    private String backupId;

    /*
     * The creation date of the backup
     */
    private OffsetDateTime creationDate;

    /*
     * Azure lifecycle management
     */
    private String provisioningState;

    /*
     * Size of backup in bytes
     */
    private Long size;

    /*
     * Label for backup
     */
    private String label;

    /*
     * Type of backup Manual or Scheduled
     */
    private BackupType backupType;

    /*
     * Failure reason
     */
    private String failureReason;

    /*
     * ResourceId used to identify the Volume
     */
    private String volumeResourceId;

    /*
     * Manual backup an already existing snapshot. This will always be false for scheduled backups and true/false for
     * manual backups
     */
    private Boolean useExistingSnapshot;

    /*
     * The name of the snapshot
     */
    private String snapshotName;

    /*
     * ResourceId used to identify the backup policy
     */
    private String backupPolicyResourceId;

    /*
     * Specifies if the backup is for a large volume.
     */
    private Boolean isLargeVolume;

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

    /**
     * Get the backupId property: UUID v4 used to identify the Backup.
     * 
     * @return the backupId value.
     */
    public String backupId() {
        return this.backupId;
    }

    /**
     * Get the creationDate property: The creation date of the backup.
     * 
     * @return the creationDate value.
     */
    public OffsetDateTime creationDate() {
        return this.creationDate;
    }

    /**
     * Get the provisioningState property: Azure lifecycle management.
     * 
     * @return the provisioningState value.
     */
    public String provisioningState() {
        return this.provisioningState;
    }

    /**
     * Get the size property: Size of backup in bytes.
     * 
     * @return the size value.
     */
    public Long size() {
        return this.size;
    }

    /**
     * Get the label property: Label for backup.
     * 
     * @return the label value.
     */
    public String label() {
        return this.label;
    }

    /**
     * Set the label property: Label for backup.
     * 
     * @param label the label value to set.
     * @return the BackupProperties object itself.
     */
    public BackupProperties withLabel(String label) {
        this.label = label;
        return this;
    }

    /**
     * Get the backupType property: Type of backup Manual or Scheduled.
     * 
     * @return the backupType value.
     */
    public BackupType backupType() {
        return this.backupType;
    }

    /**
     * Get the failureReason property: Failure reason.
     * 
     * @return the failureReason value.
     */
    public String failureReason() {
        return this.failureReason;
    }

    /**
     * Get the volumeResourceId property: ResourceId used to identify the Volume.
     * 
     * @return the volumeResourceId value.
     */
    public String volumeResourceId() {
        return this.volumeResourceId;
    }

    /**
     * Set the volumeResourceId property: ResourceId used to identify the Volume.
     * 
     * @param volumeResourceId the volumeResourceId value to set.
     * @return the BackupProperties object itself.
     */
    public BackupProperties withVolumeResourceId(String volumeResourceId) {
        this.volumeResourceId = volumeResourceId;
        return this;
    }

    /**
     * Get the useExistingSnapshot property: Manual backup an already existing snapshot. This will always be false for
     * scheduled backups and true/false for manual backups.
     * 
     * @return the useExistingSnapshot value.
     */
    public Boolean useExistingSnapshot() {
        return this.useExistingSnapshot;
    }

    /**
     * Set the useExistingSnapshot property: Manual backup an already existing snapshot. This will always be false for
     * scheduled backups and true/false for manual backups.
     * 
     * @param useExistingSnapshot the useExistingSnapshot value to set.
     * @return the BackupProperties object itself.
     */
    public BackupProperties withUseExistingSnapshot(Boolean useExistingSnapshot) {
        this.useExistingSnapshot = useExistingSnapshot;
        return this;
    }

    /**
     * Get the snapshotName property: The name of the snapshot.
     * 
     * @return the snapshotName value.
     */
    public String snapshotName() {
        return this.snapshotName;
    }

    /**
     * Set the snapshotName property: The name of the snapshot.
     * 
     * @param snapshotName the snapshotName value to set.
     * @return the BackupProperties object itself.
     */
    public BackupProperties withSnapshotName(String snapshotName) {
        this.snapshotName = snapshotName;
        return this;
    }

    /**
     * Get the backupPolicyResourceId property: ResourceId used to identify the backup policy.
     * 
     * @return the backupPolicyResourceId value.
     */
    public String backupPolicyResourceId() {
        return this.backupPolicyResourceId;
    }

    /**
     * Get the isLargeVolume property: Specifies if the backup is for a large volume.
     * 
     * @return the isLargeVolume value.
     */
    public Boolean isLargeVolume() {
        return this.isLargeVolume;
    }

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

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

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("volumeResourceId", this.volumeResourceId);
        jsonWriter.writeStringField("label", this.label);
        jsonWriter.writeBooleanField("useExistingSnapshot", this.useExistingSnapshot);
        jsonWriter.writeStringField("snapshotName", this.snapshotName);
        return jsonWriter.writeEndObject();
    }

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

                if ("volumeResourceId".equals(fieldName)) {
                    deserializedBackupProperties.volumeResourceId = reader.getString();
                } else if ("backupId".equals(fieldName)) {
                    deserializedBackupProperties.backupId = reader.getString();
                } else if ("creationDate".equals(fieldName)) {
                    deserializedBackupProperties.creationDate = reader
                        .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
                } else if ("provisioningState".equals(fieldName)) {
                    deserializedBackupProperties.provisioningState = reader.getString();
                } else if ("size".equals(fieldName)) {
                    deserializedBackupProperties.size = reader.getNullable(JsonReader::getLong);
                } else if ("label".equals(fieldName)) {
                    deserializedBackupProperties.label = reader.getString();
                } else if ("backupType".equals(fieldName)) {
                    deserializedBackupProperties.backupType = BackupType.fromString(reader.getString());
                } else if ("failureReason".equals(fieldName)) {
                    deserializedBackupProperties.failureReason = reader.getString();
                } else if ("useExistingSnapshot".equals(fieldName)) {
                    deserializedBackupProperties.useExistingSnapshot = reader.getNullable(JsonReader::getBoolean);
                } else if ("snapshotName".equals(fieldName)) {
                    deserializedBackupProperties.snapshotName = reader.getString();
                } else if ("backupPolicyResourceId".equals(fieldName)) {
                    deserializedBackupProperties.backupPolicyResourceId = reader.getString();
                } else if ("isLargeVolume".equals(fieldName)) {
                    deserializedBackupProperties.isLargeVolume = reader.getNullable(JsonReader::getBoolean);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedBackupProperties;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy