com.azure.resourcemanager.netapp.models.WeeklySchedule 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.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;
/**
* Weekly Schedule properties, make a snapshot every week at a specific day or days.
*/
@Fluent
public final class WeeklySchedule implements JsonSerializable {
/*
* Weekly snapshot count to keep
*/
private Integer snapshotsToKeep;
/*
* Indicates which weekdays snapshot should be taken, accepts a comma separated list of week day names in english
*/
private String day;
/*
* Indicates which hour in UTC timezone a snapshot should be taken
*/
private Integer hour;
/*
* Indicates which minute snapshot should be taken
*/
private Integer minute;
/*
* Resource size in bytes, current storage usage for the volume in bytes
*/
private Long usedBytes;
/**
* Creates an instance of WeeklySchedule class.
*/
public WeeklySchedule() {
}
/**
* Get the snapshotsToKeep property: Weekly snapshot count to keep.
*
* @return the snapshotsToKeep value.
*/
public Integer snapshotsToKeep() {
return this.snapshotsToKeep;
}
/**
* Set the snapshotsToKeep property: Weekly snapshot count to keep.
*
* @param snapshotsToKeep the snapshotsToKeep value to set.
* @return the WeeklySchedule object itself.
*/
public WeeklySchedule withSnapshotsToKeep(Integer snapshotsToKeep) {
this.snapshotsToKeep = snapshotsToKeep;
return this;
}
/**
* Get the day property: Indicates which weekdays snapshot should be taken, accepts a comma separated list of week
* day names in english.
*
* @return the day value.
*/
public String day() {
return this.day;
}
/**
* Set the day property: Indicates which weekdays snapshot should be taken, accepts a comma separated list of week
* day names in english.
*
* @param day the day value to set.
* @return the WeeklySchedule object itself.
*/
public WeeklySchedule withDay(String day) {
this.day = day;
return this;
}
/**
* Get the hour property: Indicates which hour in UTC timezone a snapshot should be taken.
*
* @return the hour value.
*/
public Integer hour() {
return this.hour;
}
/**
* Set the hour property: Indicates which hour in UTC timezone a snapshot should be taken.
*
* @param hour the hour value to set.
* @return the WeeklySchedule object itself.
*/
public WeeklySchedule withHour(Integer hour) {
this.hour = hour;
return this;
}
/**
* Get the minute property: Indicates which minute snapshot should be taken.
*
* @return the minute value.
*/
public Integer minute() {
return this.minute;
}
/**
* Set the minute property: Indicates which minute snapshot should be taken.
*
* @param minute the minute value to set.
* @return the WeeklySchedule object itself.
*/
public WeeklySchedule withMinute(Integer minute) {
this.minute = minute;
return this;
}
/**
* Get the usedBytes property: Resource size in bytes, current storage usage for the volume in bytes.
*
* @return the usedBytes value.
*/
public Long usedBytes() {
return this.usedBytes;
}
/**
* Set the usedBytes property: Resource size in bytes, current storage usage for the volume in bytes.
*
* @param usedBytes the usedBytes value to set.
* @return the WeeklySchedule object itself.
*/
public WeeklySchedule withUsedBytes(Long usedBytes) {
this.usedBytes = usedBytes;
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
}
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeNumberField("snapshotsToKeep", this.snapshotsToKeep);
jsonWriter.writeStringField("day", this.day);
jsonWriter.writeNumberField("hour", this.hour);
jsonWriter.writeNumberField("minute", this.minute);
jsonWriter.writeNumberField("usedBytes", this.usedBytes);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of WeeklySchedule from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of WeeklySchedule 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 WeeklySchedule.
*/
public static WeeklySchedule fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
WeeklySchedule deserializedWeeklySchedule = new WeeklySchedule();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("snapshotsToKeep".equals(fieldName)) {
deserializedWeeklySchedule.snapshotsToKeep = reader.getNullable(JsonReader::getInt);
} else if ("day".equals(fieldName)) {
deserializedWeeklySchedule.day = reader.getString();
} else if ("hour".equals(fieldName)) {
deserializedWeeklySchedule.hour = reader.getNullable(JsonReader::getInt);
} else if ("minute".equals(fieldName)) {
deserializedWeeklySchedule.minute = reader.getNullable(JsonReader::getInt);
} else if ("usedBytes".equals(fieldName)) {
deserializedWeeklySchedule.usedBytes = reader.getNullable(JsonReader::getLong);
} else {
reader.skipChildren();
}
}
return deserializedWeeklySchedule;
});
}
}