
com.azure.resourcemanager.mysqlflexibleserver.models.Storage Maven / Gradle / Ivy
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.mysqlflexibleserver.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;
/**
* Storage Profile properties of a server.
*/
@Fluent
public final class Storage implements JsonSerializable {
/*
* Max storage size allowed for a server.
*/
private Integer storageSizeGB;
/*
* Storage IOPS for a server.
*/
private Integer iops;
/*
* Enable Storage Auto Grow or not.
*/
private EnableStatusEnum autoGrow;
/*
* The sku name of the server storage.
*/
private String storageSku;
/**
* Creates an instance of Storage class.
*/
public Storage() {
}
/**
* Get the storageSizeGB property: Max storage size allowed for a server.
*
* @return the storageSizeGB value.
*/
public Integer storageSizeGB() {
return this.storageSizeGB;
}
/**
* Set the storageSizeGB property: Max storage size allowed for a server.
*
* @param storageSizeGB the storageSizeGB value to set.
* @return the Storage object itself.
*/
public Storage withStorageSizeGB(Integer storageSizeGB) {
this.storageSizeGB = storageSizeGB;
return this;
}
/**
* Get the iops property: Storage IOPS for a server.
*
* @return the iops value.
*/
public Integer iops() {
return this.iops;
}
/**
* Set the iops property: Storage IOPS for a server.
*
* @param iops the iops value to set.
* @return the Storage object itself.
*/
public Storage withIops(Integer iops) {
this.iops = iops;
return this;
}
/**
* Get the autoGrow property: Enable Storage Auto Grow or not.
*
* @return the autoGrow value.
*/
public EnableStatusEnum autoGrow() {
return this.autoGrow;
}
/**
* Set the autoGrow property: Enable Storage Auto Grow or not.
*
* @param autoGrow the autoGrow value to set.
* @return the Storage object itself.
*/
public Storage withAutoGrow(EnableStatusEnum autoGrow) {
this.autoGrow = autoGrow;
return this;
}
/**
* Get the storageSku property: The sku name of the server storage.
*
* @return the storageSku value.
*/
public String storageSku() {
return this.storageSku;
}
/**
* 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("storageSizeGB", this.storageSizeGB);
jsonWriter.writeNumberField("iops", this.iops);
jsonWriter.writeStringField("autoGrow", this.autoGrow == null ? null : this.autoGrow.toString());
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of Storage from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of Storage 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 Storage.
*/
public static Storage fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
Storage deserializedStorage = new Storage();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("storageSizeGB".equals(fieldName)) {
deserializedStorage.storageSizeGB = reader.getNullable(JsonReader::getInt);
} else if ("iops".equals(fieldName)) {
deserializedStorage.iops = reader.getNullable(JsonReader::getInt);
} else if ("autoGrow".equals(fieldName)) {
deserializedStorage.autoGrow = EnableStatusEnum.fromString(reader.getString());
} else if ("storageSku".equals(fieldName)) {
deserializedStorage.storageSku = reader.getString();
} else {
reader.skipChildren();
}
}
return deserializedStorage;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy