com.azure.resourcemanager.hybridcompute.models.StorageProfile Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-hybridcompute Show documentation
Show all versions of azure-resourcemanager-hybridcompute Show documentation
This package contains Microsoft Azure SDK for HybridCompute Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. The Hybrid Compute Management Client. Package tag package-preview-2024-07.
The 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.hybridcompute.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;
import java.util.List;
/**
* Describes the storage configuration of the machine.
*/
@Fluent
public final class StorageProfile implements JsonSerializable {
/*
* The disks on the machine.
*/
private List disks;
/**
* Creates an instance of StorageProfile class.
*/
public StorageProfile() {
}
/**
* Get the disks property: The disks on the machine.
*
* @return the disks value.
*/
public List disks() {
return this.disks;
}
/**
* Set the disks property: The disks on the machine.
*
* @param disks the disks value to set.
* @return the StorageProfile object itself.
*/
public StorageProfile withDisks(List disks) {
this.disks = disks;
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (disks() != null) {
disks().forEach(e -> e.validate());
}
}
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeArrayField("disks", this.disks, (writer, element) -> writer.writeJson(element));
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of StorageProfile from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of StorageProfile 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 StorageProfile.
*/
public static StorageProfile fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
StorageProfile deserializedStorageProfile = new StorageProfile();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("disks".equals(fieldName)) {
List disks = reader.readArray(reader1 -> Disk.fromJson(reader1));
deserializedStorageProfile.disks = disks;
} else {
reader.skipChildren();
}
}
return deserializedStorageProfile;
});
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy