com.azure.resourcemanager.elasticsan.fluent.models.ElasticSanProperties 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.elasticsan.fluent.models;
import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.azure.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import com.azure.resourcemanager.elasticsan.models.ProvisioningStates;
import com.azure.resourcemanager.elasticsan.models.PublicNetworkAccess;
import com.azure.resourcemanager.elasticsan.models.Sku;
import java.io.IOException;
import java.util.List;
/**
* Elastic San response properties.
*/
@Fluent
public final class ElasticSanProperties implements JsonSerializable {
/*
* resource sku
*/
private Sku sku;
/*
* Logical zone for Elastic San resource; example: ["1"].
*/
private List availabilityZones;
/*
* State of the operation on the resource.
*/
private ProvisioningStates provisioningState;
/*
* Base size of the Elastic San appliance in TiB.
*/
private long baseSizeTiB;
/*
* Extended size of the Elastic San appliance in TiB.
*/
private long extendedCapacitySizeTiB;
/*
* Total size of the provisioned Volumes in GiB.
*/
private Long totalVolumeSizeGiB;
/*
* Total number of volume groups in this Elastic San appliance.
*/
private Long volumeGroupCount;
/*
* Total Provisioned IOPS of the Elastic San appliance.
*/
private Long totalIops;
/*
* Total Provisioned MBps Elastic San appliance.
*/
private Long totalMBps;
/*
* Total size of the Elastic San appliance in TB.
*/
private Long totalSizeTiB;
/*
* The list of Private Endpoint Connections.
*/
private List privateEndpointConnections;
/*
* Allow or disallow public network access to ElasticSan. Value is optional but if passed in, must be 'Enabled' or
* 'Disabled'.
*/
private PublicNetworkAccess publicNetworkAccess;
/**
* Creates an instance of ElasticSanProperties class.
*/
public ElasticSanProperties() {
}
/**
* Get the sku property: resource sku.
*
* @return the sku value.
*/
public Sku sku() {
return this.sku;
}
/**
* Set the sku property: resource sku.
*
* @param sku the sku value to set.
* @return the ElasticSanProperties object itself.
*/
public ElasticSanProperties withSku(Sku sku) {
this.sku = sku;
return this;
}
/**
* Get the availabilityZones property: Logical zone for Elastic San resource; example: ["1"].
*
* @return the availabilityZones value.
*/
public List availabilityZones() {
return this.availabilityZones;
}
/**
* Set the availabilityZones property: Logical zone for Elastic San resource; example: ["1"].
*
* @param availabilityZones the availabilityZones value to set.
* @return the ElasticSanProperties object itself.
*/
public ElasticSanProperties withAvailabilityZones(List availabilityZones) {
this.availabilityZones = availabilityZones;
return this;
}
/**
* Get the provisioningState property: State of the operation on the resource.
*
* @return the provisioningState value.
*/
public ProvisioningStates provisioningState() {
return this.provisioningState;
}
/**
* Get the baseSizeTiB property: Base size of the Elastic San appliance in TiB.
*
* @return the baseSizeTiB value.
*/
public long baseSizeTiB() {
return this.baseSizeTiB;
}
/**
* Set the baseSizeTiB property: Base size of the Elastic San appliance in TiB.
*
* @param baseSizeTiB the baseSizeTiB value to set.
* @return the ElasticSanProperties object itself.
*/
public ElasticSanProperties withBaseSizeTiB(long baseSizeTiB) {
this.baseSizeTiB = baseSizeTiB;
return this;
}
/**
* Get the extendedCapacitySizeTiB property: Extended size of the Elastic San appliance in TiB.
*
* @return the extendedCapacitySizeTiB value.
*/
public long extendedCapacitySizeTiB() {
return this.extendedCapacitySizeTiB;
}
/**
* Set the extendedCapacitySizeTiB property: Extended size of the Elastic San appliance in TiB.
*
* @param extendedCapacitySizeTiB the extendedCapacitySizeTiB value to set.
* @return the ElasticSanProperties object itself.
*/
public ElasticSanProperties withExtendedCapacitySizeTiB(long extendedCapacitySizeTiB) {
this.extendedCapacitySizeTiB = extendedCapacitySizeTiB;
return this;
}
/**
* Get the totalVolumeSizeGiB property: Total size of the provisioned Volumes in GiB.
*
* @return the totalVolumeSizeGiB value.
*/
public Long totalVolumeSizeGiB() {
return this.totalVolumeSizeGiB;
}
/**
* Get the volumeGroupCount property: Total number of volume groups in this Elastic San appliance.
*
* @return the volumeGroupCount value.
*/
public Long volumeGroupCount() {
return this.volumeGroupCount;
}
/**
* Get the totalIops property: Total Provisioned IOPS of the Elastic San appliance.
*
* @return the totalIops value.
*/
public Long totalIops() {
return this.totalIops;
}
/**
* Get the totalMBps property: Total Provisioned MBps Elastic San appliance.
*
* @return the totalMBps value.
*/
public Long totalMBps() {
return this.totalMBps;
}
/**
* Get the totalSizeTiB property: Total size of the Elastic San appliance in TB.
*
* @return the totalSizeTiB value.
*/
public Long totalSizeTiB() {
return this.totalSizeTiB;
}
/**
* Get the privateEndpointConnections property: The list of Private Endpoint Connections.
*
* @return the privateEndpointConnections value.
*/
public List privateEndpointConnections() {
return this.privateEndpointConnections;
}
/**
* Get the publicNetworkAccess property: Allow or disallow public network access to ElasticSan. Value is optional
* but if passed in, must be 'Enabled' or 'Disabled'.
*
* @return the publicNetworkAccess value.
*/
public PublicNetworkAccess publicNetworkAccess() {
return this.publicNetworkAccess;
}
/**
* Set the publicNetworkAccess property: Allow or disallow public network access to ElasticSan. Value is optional
* but if passed in, must be 'Enabled' or 'Disabled'.
*
* @param publicNetworkAccess the publicNetworkAccess value to set.
* @return the ElasticSanProperties object itself.
*/
public ElasticSanProperties withPublicNetworkAccess(PublicNetworkAccess publicNetworkAccess) {
this.publicNetworkAccess = publicNetworkAccess;
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 ElasticSanProperties"));
} else {
sku().validate();
}
if (privateEndpointConnections() != null) {
privateEndpointConnections().forEach(e -> e.validate());
}
}
private static final ClientLogger LOGGER = new ClientLogger(ElasticSanProperties.class);
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeJsonField("sku", this.sku);
jsonWriter.writeLongField("baseSizeTiB", this.baseSizeTiB);
jsonWriter.writeLongField("extendedCapacitySizeTiB", this.extendedCapacitySizeTiB);
jsonWriter.writeArrayField("availabilityZones", this.availabilityZones,
(writer, element) -> writer.writeString(element));
jsonWriter.writeStringField("publicNetworkAccess",
this.publicNetworkAccess == null ? null : this.publicNetworkAccess.toString());
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of ElasticSanProperties from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of ElasticSanProperties 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 ElasticSanProperties.
*/
public static ElasticSanProperties fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
ElasticSanProperties deserializedElasticSanProperties = new ElasticSanProperties();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("sku".equals(fieldName)) {
deserializedElasticSanProperties.sku = Sku.fromJson(reader);
} else if ("baseSizeTiB".equals(fieldName)) {
deserializedElasticSanProperties.baseSizeTiB = reader.getLong();
} else if ("extendedCapacitySizeTiB".equals(fieldName)) {
deserializedElasticSanProperties.extendedCapacitySizeTiB = reader.getLong();
} else if ("availabilityZones".equals(fieldName)) {
List availabilityZones = reader.readArray(reader1 -> reader1.getString());
deserializedElasticSanProperties.availabilityZones = availabilityZones;
} else if ("provisioningState".equals(fieldName)) {
deserializedElasticSanProperties.provisioningState
= ProvisioningStates.fromString(reader.getString());
} else if ("totalVolumeSizeGiB".equals(fieldName)) {
deserializedElasticSanProperties.totalVolumeSizeGiB = reader.getNullable(JsonReader::getLong);
} else if ("volumeGroupCount".equals(fieldName)) {
deserializedElasticSanProperties.volumeGroupCount = reader.getNullable(JsonReader::getLong);
} else if ("totalIops".equals(fieldName)) {
deserializedElasticSanProperties.totalIops = reader.getNullable(JsonReader::getLong);
} else if ("totalMBps".equals(fieldName)) {
deserializedElasticSanProperties.totalMBps = reader.getNullable(JsonReader::getLong);
} else if ("totalSizeTiB".equals(fieldName)) {
deserializedElasticSanProperties.totalSizeTiB = reader.getNullable(JsonReader::getLong);
} else if ("privateEndpointConnections".equals(fieldName)) {
List privateEndpointConnections
= reader.readArray(reader1 -> PrivateEndpointConnectionInner.fromJson(reader1));
deserializedElasticSanProperties.privateEndpointConnections = privateEndpointConnections;
} else if ("publicNetworkAccess".equals(fieldName)) {
deserializedElasticSanProperties.publicNetworkAccess
= PublicNetworkAccess.fromString(reader.getString());
} else {
reader.skipChildren();
}
}
return deserializedElasticSanProperties;
});
}
}