com.azure.resourcemanager.netapp.models.BackupPolicyPatch 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.management.Resource;
import com.azure.json.JsonReader;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import com.azure.resourcemanager.netapp.fluent.models.BackupPolicyProperties;
import java.io.IOException;
import java.util.List;
import java.util.Map;
/**
* Backup policy Details for create and update.
*/
@Fluent
public final class BackupPolicyPatch extends Resource {
/*
* Backup policy Properties
*/
private BackupPolicyProperties innerProperties;
/*
* The type of the resource.
*/
private String type;
/*
* The name of the resource.
*/
private String name;
/*
* Fully qualified resource Id for the resource.
*/
private String id;
/**
* Creates an instance of BackupPolicyPatch class.
*/
public BackupPolicyPatch() {
}
/**
* Get the innerProperties property: Backup policy Properties.
*
* @return the innerProperties value.
*/
private BackupPolicyProperties innerProperties() {
return this.innerProperties;
}
/**
* Get the type property: The type of the resource.
*
* @return the type value.
*/
@Override
public String type() {
return this.type;
}
/**
* Get the name property: The name of the resource.
*
* @return the name value.
*/
@Override
public String name() {
return this.name;
}
/**
* Get the id property: Fully qualified resource Id for the resource.
*
* @return the id value.
*/
@Override
public String id() {
return this.id;
}
/**
* {@inheritDoc}
*/
@Override
public BackupPolicyPatch withLocation(String location) {
super.withLocation(location);
return this;
}
/**
* {@inheritDoc}
*/
@Override
public BackupPolicyPatch withTags(Map tags) {
super.withTags(tags);
return this;
}
/**
* Get the backupPolicyId property: Backup Policy Resource ID.
*
* @return the backupPolicyId value.
*/
public String backupPolicyId() {
return this.innerProperties() == null ? null : this.innerProperties().backupPolicyId();
}
/**
* Get the provisioningState property: Azure lifecycle management.
*
* @return the provisioningState value.
*/
public String provisioningState() {
return this.innerProperties() == null ? null : this.innerProperties().provisioningState();
}
/**
* Get the dailyBackupsToKeep property: Daily backups count to keep.
*
* @return the dailyBackupsToKeep value.
*/
public Integer dailyBackupsToKeep() {
return this.innerProperties() == null ? null : this.innerProperties().dailyBackupsToKeep();
}
/**
* Set the dailyBackupsToKeep property: Daily backups count to keep.
*
* @param dailyBackupsToKeep the dailyBackupsToKeep value to set.
* @return the BackupPolicyPatch object itself.
*/
public BackupPolicyPatch withDailyBackupsToKeep(Integer dailyBackupsToKeep) {
if (this.innerProperties() == null) {
this.innerProperties = new BackupPolicyProperties();
}
this.innerProperties().withDailyBackupsToKeep(dailyBackupsToKeep);
return this;
}
/**
* Get the weeklyBackupsToKeep property: Weekly backups count to keep.
*
* @return the weeklyBackupsToKeep value.
*/
public Integer weeklyBackupsToKeep() {
return this.innerProperties() == null ? null : this.innerProperties().weeklyBackupsToKeep();
}
/**
* Set the weeklyBackupsToKeep property: Weekly backups count to keep.
*
* @param weeklyBackupsToKeep the weeklyBackupsToKeep value to set.
* @return the BackupPolicyPatch object itself.
*/
public BackupPolicyPatch withWeeklyBackupsToKeep(Integer weeklyBackupsToKeep) {
if (this.innerProperties() == null) {
this.innerProperties = new BackupPolicyProperties();
}
this.innerProperties().withWeeklyBackupsToKeep(weeklyBackupsToKeep);
return this;
}
/**
* Get the monthlyBackupsToKeep property: Monthly backups count to keep.
*
* @return the monthlyBackupsToKeep value.
*/
public Integer monthlyBackupsToKeep() {
return this.innerProperties() == null ? null : this.innerProperties().monthlyBackupsToKeep();
}
/**
* Set the monthlyBackupsToKeep property: Monthly backups count to keep.
*
* @param monthlyBackupsToKeep the monthlyBackupsToKeep value to set.
* @return the BackupPolicyPatch object itself.
*/
public BackupPolicyPatch withMonthlyBackupsToKeep(Integer monthlyBackupsToKeep) {
if (this.innerProperties() == null) {
this.innerProperties = new BackupPolicyProperties();
}
this.innerProperties().withMonthlyBackupsToKeep(monthlyBackupsToKeep);
return this;
}
/**
* Get the volumesAssigned property: Volumes using current backup policy.
*
* @return the volumesAssigned value.
*/
public Integer volumesAssigned() {
return this.innerProperties() == null ? null : this.innerProperties().volumesAssigned();
}
/**
* Get the enabled property: The property to decide policy is enabled or not.
*
* @return the enabled value.
*/
public Boolean enabled() {
return this.innerProperties() == null ? null : this.innerProperties().enabled();
}
/**
* Set the enabled property: The property to decide policy is enabled or not.
*
* @param enabled the enabled value to set.
* @return the BackupPolicyPatch object itself.
*/
public BackupPolicyPatch withEnabled(Boolean enabled) {
if (this.innerProperties() == null) {
this.innerProperties = new BackupPolicyProperties();
}
this.innerProperties().withEnabled(enabled);
return this;
}
/**
* Get the volumeBackups property: A list of volumes assigned to this policy.
*
* @return the volumeBackups value.
*/
public List volumeBackups() {
return this.innerProperties() == null ? null : this.innerProperties().volumeBackups();
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (innerProperties() != null) {
innerProperties().validate();
}
}
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeStringField("location", location());
jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element));
jsonWriter.writeJsonField("properties", this.innerProperties);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of BackupPolicyPatch from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of BackupPolicyPatch 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 BackupPolicyPatch.
*/
public static BackupPolicyPatch fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
BackupPolicyPatch deserializedBackupPolicyPatch = new BackupPolicyPatch();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("id".equals(fieldName)) {
deserializedBackupPolicyPatch.id = reader.getString();
} else if ("name".equals(fieldName)) {
deserializedBackupPolicyPatch.name = reader.getString();
} else if ("type".equals(fieldName)) {
deserializedBackupPolicyPatch.type = reader.getString();
} else if ("location".equals(fieldName)) {
deserializedBackupPolicyPatch.withLocation(reader.getString());
} else if ("tags".equals(fieldName)) {
Map tags = reader.readMap(reader1 -> reader1.getString());
deserializedBackupPolicyPatch.withTags(tags);
} else if ("properties".equals(fieldName)) {
deserializedBackupPolicyPatch.innerProperties = BackupPolicyProperties.fromJson(reader);
} else {
reader.skipChildren();
}
}
return deserializedBackupPolicyPatch;
});
}
}