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

com.azure.resourcemanager.netapp.fluent.models.BackupPolicyProperties 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.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import com.azure.resourcemanager.netapp.models.VolumeBackups;
import java.io.IOException;
import java.util.List;

/**
 * Backup policy properties.
 */
@Fluent
public final class BackupPolicyProperties implements JsonSerializable {
    /*
     * Backup Policy Resource ID
     */
    private String backupPolicyId;

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

    /*
     * Daily backups count to keep
     */
    private Integer dailyBackupsToKeep;

    /*
     * Weekly backups count to keep
     */
    private Integer weeklyBackupsToKeep;

    /*
     * Monthly backups count to keep
     */
    private Integer monthlyBackupsToKeep;

    /*
     * Volumes using current backup policy
     */
    private Integer volumesAssigned;

    /*
     * The property to decide policy is enabled or not
     */
    private Boolean enabled;

    /*
     * A list of volumes assigned to this policy
     */
    private List volumeBackups;

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

    /**
     * Get the backupPolicyId property: Backup Policy Resource ID.
     * 
     * @return the backupPolicyId value.
     */
    public String backupPolicyId() {
        return this.backupPolicyId;
    }

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

    /**
     * Get the dailyBackupsToKeep property: Daily backups count to keep.
     * 
     * @return the dailyBackupsToKeep value.
     */
    public Integer dailyBackupsToKeep() {
        return this.dailyBackupsToKeep;
    }

    /**
     * Set the dailyBackupsToKeep property: Daily backups count to keep.
     * 
     * @param dailyBackupsToKeep the dailyBackupsToKeep value to set.
     * @return the BackupPolicyProperties object itself.
     */
    public BackupPolicyProperties withDailyBackupsToKeep(Integer dailyBackupsToKeep) {
        this.dailyBackupsToKeep = dailyBackupsToKeep;
        return this;
    }

    /**
     * Get the weeklyBackupsToKeep property: Weekly backups count to keep.
     * 
     * @return the weeklyBackupsToKeep value.
     */
    public Integer weeklyBackupsToKeep() {
        return this.weeklyBackupsToKeep;
    }

    /**
     * Set the weeklyBackupsToKeep property: Weekly backups count to keep.
     * 
     * @param weeklyBackupsToKeep the weeklyBackupsToKeep value to set.
     * @return the BackupPolicyProperties object itself.
     */
    public BackupPolicyProperties withWeeklyBackupsToKeep(Integer weeklyBackupsToKeep) {
        this.weeklyBackupsToKeep = weeklyBackupsToKeep;
        return this;
    }

    /**
     * Get the monthlyBackupsToKeep property: Monthly backups count to keep.
     * 
     * @return the monthlyBackupsToKeep value.
     */
    public Integer monthlyBackupsToKeep() {
        return this.monthlyBackupsToKeep;
    }

    /**
     * Set the monthlyBackupsToKeep property: Monthly backups count to keep.
     * 
     * @param monthlyBackupsToKeep the monthlyBackupsToKeep value to set.
     * @return the BackupPolicyProperties object itself.
     */
    public BackupPolicyProperties withMonthlyBackupsToKeep(Integer monthlyBackupsToKeep) {
        this.monthlyBackupsToKeep = monthlyBackupsToKeep;
        return this;
    }

    /**
     * Get the volumesAssigned property: Volumes using current backup policy.
     * 
     * @return the volumesAssigned value.
     */
    public Integer volumesAssigned() {
        return this.volumesAssigned;
    }

    /**
     * Get the enabled property: The property to decide policy is enabled or not.
     * 
     * @return the enabled value.
     */
    public Boolean enabled() {
        return this.enabled;
    }

    /**
     * Set the enabled property: The property to decide policy is enabled or not.
     * 
     * @param enabled the enabled value to set.
     * @return the BackupPolicyProperties object itself.
     */
    public BackupPolicyProperties withEnabled(Boolean enabled) {
        this.enabled = enabled;
        return this;
    }

    /**
     * Get the volumeBackups property: A list of volumes assigned to this policy.
     * 
     * @return the volumeBackups value.
     */
    public List volumeBackups() {
        return this.volumeBackups;
    }

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

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeNumberField("dailyBackupsToKeep", this.dailyBackupsToKeep);
        jsonWriter.writeNumberField("weeklyBackupsToKeep", this.weeklyBackupsToKeep);
        jsonWriter.writeNumberField("monthlyBackupsToKeep", this.monthlyBackupsToKeep);
        jsonWriter.writeBooleanField("enabled", this.enabled);
        return jsonWriter.writeEndObject();
    }

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

                if ("backupPolicyId".equals(fieldName)) {
                    deserializedBackupPolicyProperties.backupPolicyId = reader.getString();
                } else if ("provisioningState".equals(fieldName)) {
                    deserializedBackupPolicyProperties.provisioningState = reader.getString();
                } else if ("dailyBackupsToKeep".equals(fieldName)) {
                    deserializedBackupPolicyProperties.dailyBackupsToKeep = reader.getNullable(JsonReader::getInt);
                } else if ("weeklyBackupsToKeep".equals(fieldName)) {
                    deserializedBackupPolicyProperties.weeklyBackupsToKeep = reader.getNullable(JsonReader::getInt);
                } else if ("monthlyBackupsToKeep".equals(fieldName)) {
                    deserializedBackupPolicyProperties.monthlyBackupsToKeep = reader.getNullable(JsonReader::getInt);
                } else if ("volumesAssigned".equals(fieldName)) {
                    deserializedBackupPolicyProperties.volumesAssigned = reader.getNullable(JsonReader::getInt);
                } else if ("enabled".equals(fieldName)) {
                    deserializedBackupPolicyProperties.enabled = reader.getNullable(JsonReader::getBoolean);
                } else if ("volumeBackups".equals(fieldName)) {
                    List volumeBackups = reader.readArray(reader1 -> VolumeBackups.fromJson(reader1));
                    deserializedBackupPolicyProperties.volumeBackups = volumeBackups;
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedBackupPolicyProperties;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy