diff --git a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/Flavor.java b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/Flavor.java index 12d37cc2a3..6462539625 100644 --- a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/Flavor.java +++ b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/Flavor.java @@ -21,11 +21,13 @@ package org.jclouds.openstack.nova.v1_1.domain; import org.jclouds.openstack.domain.Resource; import com.google.common.base.Objects; +import com.google.common.base.Optional; +import com.google.gson.annotations.SerializedName; /** * A flavor is an available hardware configuration for a server. Each flavor has * a unique combination of disk space and memory capacity. - * + * * @author Jeremy Daggett * @see swap; + @SerializedName("rxtx_factor") + private final Optional rxtxFactor; + @SerializedName("OS-FLV-EXT-DATA:ephemeral") + private final Optional ephemeral; protected Flavor(Builder builder) { super(builder); this.ram = builder.ram; this.disk = builder.disk; this.vcpus = builder.vcpus; + this.swap = Optional.fromNullable(builder.swap); + this.rxtxFactor = Optional.fromNullable(builder.rxtxFactor); + this.ephemeral = Optional.fromNullable(builder.ephemeral); + } + + protected Flavor() { + this.swap = Optional.absent(); + this.rxtxFactor = Optional.absent(); + this.ephemeral = Optional.absent(); } public int getRam() { @@ -113,11 +160,34 @@ public class Flavor extends Resource { return this.vcpus; } + public Optional getSwap() { + return swap; + } + + public Optional getRxtxFactor() { + return rxtxFactor; + } + + /** + * Retrieves ephemeral disk space in GB + *

+ * NOTE: This field is only present if the Flavor Extra Data extension is installed (alias "OS-FLV-EXT-DATA"). + * + * @see org.jclouds.openstack.nova.v1_1.features.ExtensionClient#getExtensionByAlias + * @see org.jclouds.openstack.nova.v1_1.extensions.ExtensionNamespaces#FLAVOR_EXTRA_DATA + */ + public Optional getEphemeral() { + return ephemeral; + } + @Override protected Objects.ToStringHelper string() { return super.string() .add("ram", ram) .add("disk", disk) - .add("vcpus", vcpus); + .add("vcpus", vcpus) + .add("swap", swap) + .add("rxtxFactor", rxtxFactor) + .add("ephemeral", ephemeral); } -} +} \ No newline at end of file