
com.azure.resourcemanager.devcenter.fluent.models.DevCenterSkuInner 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.devcenter.fluent.models;
import com.azure.core.annotation.Fluent;
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.devcenter.models.Capability;
import com.azure.resourcemanager.devcenter.models.Sku;
import com.azure.resourcemanager.devcenter.models.SkuTier;
import java.io.IOException;
import java.util.List;
/**
* The resource model definition representing SKU for DevCenter resources.
*/
@Fluent
public final class DevCenterSkuInner extends Sku {
/*
* The name of the resource type
*/
private String resourceType;
/*
* SKU supported locations.
*/
private List locations;
/*
* Collection of name/value pairs to describe the SKU capabilities.
*/
private List capabilities;
/**
* Creates an instance of DevCenterSkuInner class.
*/
public DevCenterSkuInner() {
}
/**
* Get the resourceType property: The name of the resource type.
*
* @return the resourceType value.
*/
public String resourceType() {
return this.resourceType;
}
/**
* Get the locations property: SKU supported locations.
*
* @return the locations value.
*/
public List locations() {
return this.locations;
}
/**
* Get the capabilities property: Collection of name/value pairs to describe the SKU capabilities.
*
* @return the capabilities value.
*/
public List capabilities() {
return this.capabilities;
}
/**
* {@inheritDoc}
*/
@Override
public DevCenterSkuInner withName(String name) {
super.withName(name);
return this;
}
/**
* {@inheritDoc}
*/
@Override
public DevCenterSkuInner withTier(SkuTier tier) {
super.withTier(tier);
return this;
}
/**
* {@inheritDoc}
*/
@Override
public DevCenterSkuInner withSize(String size) {
super.withSize(size);
return this;
}
/**
* {@inheritDoc}
*/
@Override
public DevCenterSkuInner withFamily(String family) {
super.withFamily(family);
return this;
}
/**
* {@inheritDoc}
*/
@Override
public DevCenterSkuInner withCapacity(Integer capacity) {
super.withCapacity(capacity);
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
@Override
public void validate() {
if (capabilities() != null) {
capabilities().forEach(e -> e.validate());
}
if (name() == null) {
throw LOGGER.atError()
.log(new IllegalArgumentException("Missing required property name in model DevCenterSkuInner"));
}
}
private static final ClientLogger LOGGER = new ClientLogger(DevCenterSkuInner.class);
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeStringField("name", name());
jsonWriter.writeStringField("tier", tier() == null ? null : tier().toString());
jsonWriter.writeStringField("size", size());
jsonWriter.writeStringField("family", family());
jsonWriter.writeNumberField("capacity", capacity());
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of DevCenterSkuInner from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of DevCenterSkuInner 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 DevCenterSkuInner.
*/
public static DevCenterSkuInner fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
DevCenterSkuInner deserializedDevCenterSkuInner = new DevCenterSkuInner();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("name".equals(fieldName)) {
deserializedDevCenterSkuInner.withName(reader.getString());
} else if ("tier".equals(fieldName)) {
deserializedDevCenterSkuInner.withTier(SkuTier.fromString(reader.getString()));
} else if ("size".equals(fieldName)) {
deserializedDevCenterSkuInner.withSize(reader.getString());
} else if ("family".equals(fieldName)) {
deserializedDevCenterSkuInner.withFamily(reader.getString());
} else if ("capacity".equals(fieldName)) {
deserializedDevCenterSkuInner.withCapacity(reader.getNullable(JsonReader::getInt));
} else if ("resourceType".equals(fieldName)) {
deserializedDevCenterSkuInner.resourceType = reader.getString();
} else if ("locations".equals(fieldName)) {
List locations = reader.readArray(reader1 -> reader1.getString());
deserializedDevCenterSkuInner.locations = locations;
} else if ("capabilities".equals(fieldName)) {
List capabilities = reader.readArray(reader1 -> Capability.fromJson(reader1));
deserializedDevCenterSkuInner.capabilities = capabilities;
} else {
reader.skipChildren();
}
}
return deserializedDevCenterSkuInner;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy