
com.azure.resourcemanager.storagepool.models.DiskPoolCreate 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.storagepool.models;
import com.azure.core.annotation.Fluent;
import com.azure.core.management.Resource;
import com.azure.core.util.logging.ClientLogger;
import com.azure.json.JsonReader;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import com.azure.resourcemanager.storagepool.fluent.models.DiskPoolCreateProperties;
import com.azure.resourcemanager.storagepool.fluent.models.Sku;
import java.io.IOException;
import java.util.List;
import java.util.Map;
/**
* Request payload for create or update Disk Pool request.
*/
@Fluent
public final class DiskPoolCreate extends Resource {
/*
* Determines the SKU of the Disk Pool
*/
private Sku sku;
/*
* Properties for Disk Pool create request.
*/
private DiskPoolCreateProperties innerProperties = new DiskPoolCreateProperties();
/*
* Azure resource id. Indicates if this resource is managed by another Azure resource.
*/
private String managedBy;
/*
* List of Azure resource ids that manage this resource.
*/
private List managedByExtended;
/*
* 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 DiskPoolCreate class.
*/
public DiskPoolCreate() {
}
/**
* Get the sku property: Determines the SKU of the Disk Pool.
*
* @return the sku value.
*/
public Sku sku() {
return this.sku;
}
/**
* Set the sku property: Determines the SKU of the Disk Pool.
*
* @param sku the sku value to set.
* @return the DiskPoolCreate object itself.
*/
public DiskPoolCreate withSku(Sku sku) {
this.sku = sku;
return this;
}
/**
* Get the innerProperties property: Properties for Disk Pool create request.
*
* @return the innerProperties value.
*/
private DiskPoolCreateProperties innerProperties() {
return this.innerProperties;
}
/**
* Get the managedBy property: Azure resource id. Indicates if this resource is managed by another Azure resource.
*
* @return the managedBy value.
*/
public String managedBy() {
return this.managedBy;
}
/**
* Set the managedBy property: Azure resource id. Indicates if this resource is managed by another Azure resource.
*
* @param managedBy the managedBy value to set.
* @return the DiskPoolCreate object itself.
*/
public DiskPoolCreate withManagedBy(String managedBy) {
this.managedBy = managedBy;
return this;
}
/**
* Get the managedByExtended property: List of Azure resource ids that manage this resource.
*
* @return the managedByExtended value.
*/
public List managedByExtended() {
return this.managedByExtended;
}
/**
* Set the managedByExtended property: List of Azure resource ids that manage this resource.
*
* @param managedByExtended the managedByExtended value to set.
* @return the DiskPoolCreate object itself.
*/
public DiskPoolCreate withManagedByExtended(List managedByExtended) {
this.managedByExtended = managedByExtended;
return this;
}
/**
* 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 DiskPoolCreate withLocation(String location) {
super.withLocation(location);
return this;
}
/**
* {@inheritDoc}
*/
@Override
public DiskPoolCreate withTags(Map tags) {
super.withTags(tags);
return this;
}
/**
* Get the availabilityZones property: Logical zone for Disk Pool resource; example: ["1"].
*
* @return the availabilityZones value.
*/
public List availabilityZones() {
return this.innerProperties() == null ? null : this.innerProperties().availabilityZones();
}
/**
* Set the availabilityZones property: Logical zone for Disk Pool resource; example: ["1"].
*
* @param availabilityZones the availabilityZones value to set.
* @return the DiskPoolCreate object itself.
*/
public DiskPoolCreate withAvailabilityZones(List availabilityZones) {
if (this.innerProperties() == null) {
this.innerProperties = new DiskPoolCreateProperties();
}
this.innerProperties().withAvailabilityZones(availabilityZones);
return this;
}
/**
* Get the disks property: List of Azure Managed Disks to attach to a Disk Pool.
*
* @return the disks value.
*/
public List disks() {
return this.innerProperties() == null ? null : this.innerProperties().disks();
}
/**
* Set the disks property: List of Azure Managed Disks to attach to a Disk Pool.
*
* @param disks the disks value to set.
* @return the DiskPoolCreate object itself.
*/
public DiskPoolCreate withDisks(List disks) {
if (this.innerProperties() == null) {
this.innerProperties = new DiskPoolCreateProperties();
}
this.innerProperties().withDisks(disks);
return this;
}
/**
* Get the subnetId property: Azure Resource ID of a Subnet for the Disk Pool.
*
* @return the subnetId value.
*/
public String subnetId() {
return this.innerProperties() == null ? null : this.innerProperties().subnetId();
}
/**
* Set the subnetId property: Azure Resource ID of a Subnet for the Disk Pool.
*
* @param subnetId the subnetId value to set.
* @return the DiskPoolCreate object itself.
*/
public DiskPoolCreate withSubnetId(String subnetId) {
if (this.innerProperties() == null) {
this.innerProperties = new DiskPoolCreateProperties();
}
this.innerProperties().withSubnetId(subnetId);
return this;
}
/**
* Get the additionalCapabilities property: List of additional capabilities for a Disk Pool.
*
* @return the additionalCapabilities value.
*/
public List additionalCapabilities() {
return this.innerProperties() == null ? null : this.innerProperties().additionalCapabilities();
}
/**
* Set the additionalCapabilities property: List of additional capabilities for a Disk Pool.
*
* @param additionalCapabilities the additionalCapabilities value to set.
* @return the DiskPoolCreate object itself.
*/
public DiskPoolCreate withAdditionalCapabilities(List additionalCapabilities) {
if (this.innerProperties() == null) {
this.innerProperties = new DiskPoolCreateProperties();
}
this.innerProperties().withAdditionalCapabilities(additionalCapabilities);
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (sku() == null) {
throw LOGGER.atError()
.log(new IllegalArgumentException("Missing required property sku in model DiskPoolCreate"));
} else {
sku().validate();
}
if (innerProperties() == null) {
throw LOGGER.atError()
.log(new IllegalArgumentException("Missing required property innerProperties in model DiskPoolCreate"));
} else {
innerProperties().validate();
}
}
private static final ClientLogger LOGGER = new ClientLogger(DiskPoolCreate.class);
/**
* {@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("sku", this.sku);
jsonWriter.writeJsonField("properties", this.innerProperties);
jsonWriter.writeStringField("managedBy", this.managedBy);
jsonWriter.writeArrayField("managedByExtended", this.managedByExtended,
(writer, element) -> writer.writeString(element));
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of DiskPoolCreate from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of DiskPoolCreate 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 DiskPoolCreate.
*/
public static DiskPoolCreate fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
DiskPoolCreate deserializedDiskPoolCreate = new DiskPoolCreate();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("id".equals(fieldName)) {
deserializedDiskPoolCreate.id = reader.getString();
} else if ("name".equals(fieldName)) {
deserializedDiskPoolCreate.name = reader.getString();
} else if ("type".equals(fieldName)) {
deserializedDiskPoolCreate.type = reader.getString();
} else if ("location".equals(fieldName)) {
deserializedDiskPoolCreate.withLocation(reader.getString());
} else if ("tags".equals(fieldName)) {
Map tags = reader.readMap(reader1 -> reader1.getString());
deserializedDiskPoolCreate.withTags(tags);
} else if ("sku".equals(fieldName)) {
deserializedDiskPoolCreate.sku = Sku.fromJson(reader);
} else if ("properties".equals(fieldName)) {
deserializedDiskPoolCreate.innerProperties = DiskPoolCreateProperties.fromJson(reader);
} else if ("managedBy".equals(fieldName)) {
deserializedDiskPoolCreate.managedBy = reader.getString();
} else if ("managedByExtended".equals(fieldName)) {
List managedByExtended = reader.readArray(reader1 -> reader1.getString());
deserializedDiskPoolCreate.managedByExtended = managedByExtended;
} else {
reader.skipChildren();
}
}
return deserializedDiskPoolCreate;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy