diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/VCloudDirectorAsyncClient.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/VCloudDirectorAsyncClient.java index cf1c90c09d..a66919ce12 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/VCloudDirectorAsyncClient.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/VCloudDirectorAsyncClient.java @@ -21,12 +21,18 @@ package org.jclouds.vcloud.director.v1_5; import org.jclouds.ovf.Network; import org.jclouds.rest.annotations.Delegate; import org.jclouds.vcloud.director.v1_5.domain.Org; +import org.jclouds.vcloud.director.v1_5.domain.Catalog; +import org.jclouds.vcloud.director.v1_5.domain.Media; +import org.jclouds.vcloud.director.v1_5.domain.Org; import org.jclouds.vcloud.director.v1_5.domain.Session; +import org.jclouds.vcloud.director.v1_5.domain.Task; +import org.jclouds.vcloud.director.v1_5.domain.Vdc; import org.jclouds.vcloud.director.v1_5.features.CatalogAsyncClient; import org.jclouds.vcloud.director.v1_5.features.NetworkAsyncClient; import org.jclouds.vcloud.director.v1_5.features.OrgAsyncClient; import org.jclouds.vcloud.director.v1_5.features.QueryAsyncClient; import org.jclouds.vcloud.director.v1_5.features.TaskAsyncClient; +import org.jclouds.vcloud.director.v1_5.features.VdcAsyncClient; import com.google.inject.Provides; @@ -80,4 +86,10 @@ public interface VCloudDirectorAsyncClient { */ @Delegate CatalogAsyncClient getMediaClient(); + + /** + * @return asynchronous access to {@link Vdc} features + */ + @Delegate + VdcAsyncClient getVdcClient(); } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/VCloudDirectorClient.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/VCloudDirectorClient.java index 89c53a663b..7649998ed6 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/VCloudDirectorClient.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/VCloudDirectorClient.java @@ -24,13 +24,19 @@ import org.jclouds.concurrent.Timeout; import org.jclouds.ovf.Network; import org.jclouds.rest.annotations.Delegate; import org.jclouds.vcloud.director.v1_5.domain.Org; +import org.jclouds.vcloud.director.v1_5.domain.Catalog; +import org.jclouds.vcloud.director.v1_5.domain.Media; +import org.jclouds.vcloud.director.v1_5.domain.Org; import org.jclouds.vcloud.director.v1_5.domain.Session; +import org.jclouds.vcloud.director.v1_5.domain.Task; +import org.jclouds.vcloud.director.v1_5.domain.Vdc; import org.jclouds.vcloud.director.v1_5.features.CatalogClient; import org.jclouds.vcloud.director.v1_5.features.MediaClient; import org.jclouds.vcloud.director.v1_5.features.NetworkClient; import org.jclouds.vcloud.director.v1_5.features.OrgClient; import org.jclouds.vcloud.director.v1_5.features.QueryClient; import org.jclouds.vcloud.director.v1_5.features.TaskClient; +import org.jclouds.vcloud.director.v1_5.features.VdcClient; import com.google.inject.Provides; @@ -83,4 +89,10 @@ public interface VCloudDirectorClient { */ @Delegate MediaClient getMediaClient(); + + /** + * @return synchronous access to {@link Vdc} features + */ + @Delegate + VdcClient getVdcClient(); } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/VCloudDirectorMediaType.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/VCloudDirectorMediaType.java index aca63b8e36..23cc523630 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/VCloudDirectorMediaType.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/VCloudDirectorMediaType.java @@ -44,7 +44,7 @@ public class VCloudDirectorMediaType { public static final String METADATA_ENTRY = "*/*"; // No media type (?) - public static final String METADATA_VALUE = "application/vnd.vmware.vcloud.metadata.value+xml";; + public static final String METADATA_VALUE = "application/vnd.vmware.vcloud.metadata.value+xml"; public static final String ORG = "application/vnd.vmware.vcloud.org+xml"; @@ -71,15 +71,40 @@ public class VCloudDirectorMediaType { public static final String OWNER = "application/vnd.vmware.vcloud.owner+xml"; public static final String VDC = "application/vnd.vmware.vcloud.vdc+xml"; - - public static final String ADMIN_USER = "application/vnd.vmware.admin.user+xml"; + public static final String ADMIN_USER = "application/vnd.vmware.admin.user+xml"; + + public static final String V_APP = "application/vnd.vmware.vcloud.vApp+xml"; + + public static final String V_APP_TEMPLATE = "application/vnd.vmware.vcloud.vAppTemplate+xml"; + + public static final String CAPTURE_VAPP_PARAMS = + "application/vnd.vmware.vcloud.captureVAppParams+xml"; + + public static final String CLONE_MEDIA_PARAMS = + "application/vnd.vmware.vcloud.cloneMediaParams+xml"; + + public static final String CLONE_V_APP_PARAMS = + "application/vnd.vmware.vcloud.cloneVAppParams+xml"; + + public static final String CLONE_V_APP_TEMPLATE_PARAMS = + "application/vnd.vmware.vcloud.cloneVAppTemplateParams+xml"; + + public static final String COMPOSE_VAPP_PARAMS = + "application/vnd.vmware.vcloud.composeVAppParams+xml"; + + public static final String INSTANTIATE_VAPP_TEMPLATE_PARAMS = + "application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml"; + + public static final String UPLOAD_VAPP_TEMPLATE_PARAMS = + "application/vnd.vmware.vcloud.uploadVAppTemplateParams+xml"; + public static final String QUERY_RESULT_RECORDS = "application/vnd.vmware.vcloud.query.records+xml"; public static final String QUERY_RESULT_REFERENCES = "application/vnd.vmware.vcloud.query.references+xml"; - public static final String QUERY_RESULT_ID_RECORDS = "application/vnd.vmware.vcloud.query.idrecords+xml"; - + public static final String QUERY_RESULT_ID_RECORDS = "application/vnd.vmware.vcloud.query.idrecords+xml"; + public static final String CONTROL_ACCESS = "application/vnd.vmware.vcloud.controlAccess+xml"; /** @@ -91,8 +116,11 @@ public class VCloudDirectorMediaType { SESSION, ERROR, ORG_LIST, METADATA, METADATA_ENTRY, METADATA_VALUE, ORG, TASKS_LIST, TASK, NETWORK, ORG_NETWORK, CATALOG, CATALOG_ITEM, CATALOG_ITEMS, CATALOGS_LIST, PROPERTY, - MEDIA, OWNER, VDC, ADMIN_USER, QUERY_RESULT_RECORDS, - QUERY_RESULT_REFERENCES, QUERY_RESULT_ID_RECORDS, + MEDIA, OWNER, VDC, ADMIN_USER, V_APP, V_APP_TEMPLATE, + CAPTURE_VAPP_PARAMS, CLONE_V_APP_PARAMS, CLONE_V_APP_TEMPLATE_PARAMS, + COMPOSE_VAPP_PARAMS, INSTANTIATE_VAPP_TEMPLATE_PARAMS, + UPLOAD_VAPP_TEMPLATE_PARAMS, + QUERY_RESULT_RECORDS, QUERY_RESULT_REFERENCES, QUERY_RESULT_ID_RECORDS, CONTROL_ACCESS ); } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/config/VCloudDirectorRestClientModule.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/config/VCloudDirectorRestClientModule.java index 6dd7be580f..ef9c121fd8 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/config/VCloudDirectorRestClientModule.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/config/VCloudDirectorRestClientModule.java @@ -54,6 +54,8 @@ import org.jclouds.vcloud.director.v1_5.features.QueryAsyncClient; import org.jclouds.vcloud.director.v1_5.features.QueryClient; import org.jclouds.vcloud.director.v1_5.features.TaskAsyncClient; import org.jclouds.vcloud.director.v1_5.features.TaskClient; +import org.jclouds.vcloud.director.v1_5.features.VdcAsyncClient; +import org.jclouds.vcloud.director.v1_5.features.VdcClient; import org.jclouds.vcloud.director.v1_5.functions.LoginUserInOrgWithPassword; import org.jclouds.vcloud.director.v1_5.handlers.InvalidateSessionAndRetryOn401AndLogoutOnClose; import org.jclouds.vcloud.director.v1_5.handlers.VCloudDirectorErrorHandler; @@ -87,6 +89,7 @@ public class VCloudDirectorRestClientModule extends RestClientModuleJava class for AvailableNetworks complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="AvailableNetworks">
+ *   <complexContent>
+ *     <extension base="{http://www.vmware.com/vcloud/v1.5}VCloudExtensibleType">
+ *       <sequence>
+ *         <element name="Network" type="{http://www.vmware.com/vcloud/v1.5}ReferenceType" maxOccurs="unbounded" minOccurs="0"/>
+ *       </sequence>
+ *       <anyAttribute processContents='lax' namespace='##other'/>
+ *     </extension>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "AvailableNetworks", propOrder = { + "networks" +}) +public class AvailableNetworks { + public static Builder builder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder().fromAvailableNetworks(this); + } + + public static class Builder { + + private List networks = Lists.newArrayList(); + + /** + * @see AvailableNetworks#getNetworks() + */ + public Builder networks(List networks) { + this.networks = Lists.newArrayList(checkNotNull(networks, "networks")); + return this; + } + + /** + * @see AvailableNetworks#getNetworks() + */ + public Builder network(Reference network) { + networks.add(checkNotNull(network, "network")); + return this; + } + + public AvailableNetworks build() { + AvailableNetworks availableNetworks = new AvailableNetworks(networks); + return availableNetworks; + } + + + public Builder fromAvailableNetworks(AvailableNetworks in) { + return networks(in.getNetworks()); + } + } + + private AvailableNetworks() { + // For JAXB and builder use + } + + private AvailableNetworks(List networks) { + this.networks = networks; + } + + + @XmlElement(name = "Network") + protected List networks; + + /** + * Gets the value of the network property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the network property. + * + *

+ * For example, to add a new item, do as follows: + *

+     *    getNetwork().add(newItem);
+     * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link ReferenceType } + * + * + */ + public List getNetworks() { + if (networks == null) { + networks = Lists.newArrayList(); + } + return this.networks; + } + + @Override + public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + AvailableNetworks that = AvailableNetworks.class.cast(o); + return equal(networks, that.networks); + } + + @Override + public int hashCode() { + return Objects.hashCode(networks); + } + + @Override + public String toString() { + return Objects.toStringHelper("") + .add("network", networks).toString(); + } + +} diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Capabilities.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Capabilities.java new file mode 100644 index 0000000000..7c8c8b6770 --- /dev/null +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Capabilities.java @@ -0,0 +1,148 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.jclouds.vcloud.director.v1_5.domain; + +import static com.google.common.base.Objects.equal; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + +import com.google.common.base.Objects; + + +/** + * + * Collection of supported hardware capabilities. + * + * + *

Java class for Capabilities complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="Capabilities">
+ *   <complexContent>
+ *     <extension base="{http://www.vmware.com/vcloud/v1.5}VCloudExtensibleType">
+ *       <sequence>
+ *         <element name="SupportedHardwareVersions" type="{http://www.vmware.com/vcloud/v1.5}SupportedHardwareVersionsType" minOccurs="0"/>
+ *       </sequence>
+ *       <anyAttribute processContents='lax' namespace='##other'/>
+ *     </extension>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "Capabilities", propOrder = { + "supportedHardwareVersions" +}) +public class Capabilities { + public static Builder builder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder().fromCapabilities(this); + } + + public static class Builder { + + private SupportedHardwareVersions supportedHardwareVersions; + + /** + * @see Capabilities#getSupportedHardwareVersions() + */ + public Builder supportedHardwareVersions(SupportedHardwareVersions supportedHardwareVersions) { + this.supportedHardwareVersions = supportedHardwareVersions; + return this; + } + + + public Capabilities build() { + Capabilities capabilities = new Capabilities(); + capabilities.setSupportedHardwareVersions(supportedHardwareVersions); + return capabilities; + } + + + public Builder fromCapabilities(Capabilities in) { + return supportedHardwareVersions(in.getSupportedHardwareVersions()); + } + } + + private Capabilities() { + // For JAXB and builder use + } + + + + @XmlElement(name = "SupportedHardwareVersions") + protected SupportedHardwareVersions supportedHardwareVersions; + + /** + * Gets the value of the supportedHardwareVersions property. + * + * @return + * possible object is + * {@link SupportedHardwareVersions } + * + */ + public SupportedHardwareVersions getSupportedHardwareVersions() { + return supportedHardwareVersions; + } + + /** + * Sets the value of the supportedHardwareVersions property. + * + * @param value + * allowed object is + * {@link SupportedHardwareVersions } + * + */ + public void setSupportedHardwareVersions(SupportedHardwareVersions value) { + this.supportedHardwareVersions = value; + } + + @Override + public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + Capabilities that = Capabilities.class.cast(o); + return equal(supportedHardwareVersions, that.supportedHardwareVersions); + } + + @Override + public int hashCode() { + return Objects.hashCode(supportedHardwareVersions); + } + + @Override + public String toString() { + return Objects.toStringHelper("") + .add("supportedHardwareVersions", supportedHardwareVersions).toString(); + } + +} diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CapacityType.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CapacityType.java new file mode 100644 index 0000000000..b6e968103f --- /dev/null +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CapacityType.java @@ -0,0 +1,233 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.jclouds.vcloud.director.v1_5.domain; + +import static com.google.common.base.Objects.equal; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlSeeAlso; +import javax.xml.bind.annotation.XmlType; + +import com.google.common.base.Objects; + + +/** + * + * Represents a capacity of a given resource. + * + * + *

Java class for Capacity complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="Capacity">
+ *   <complexContent>
+ *     <extension base="{http://www.vmware.com/vcloud/v1.5}VCloudExtensibleType">
+ *       <sequence>
+ *         <element name="Units" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         <element name="Allocated" type="{http://www.w3.org/2001/XMLSchema}Long" minOccurs="0"/>
+ *         <element name="Limit" type="{http://www.w3.org/2001/XMLSchema}Long"/>
+ *       </sequence>
+ *       <anyAttribute processContents='lax' namespace='##other'/>
+ *     </extension>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "Capacity", propOrder = { + "units", + "allocated", + "limit" +}) +@XmlSeeAlso({ +// CapacityWithUsageType.class +}) +public class CapacityType> { + + public static > Builder builder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder().fromCapacityType(this); + } + + public static class Builder> { + + protected String units; + protected Long allocated; + protected Long limit; + + /** + * @see CapacityType#getUnits() + */ + public Builder units(String units) { + this.units = units; + return this; + } + + /** + * @see CapacityType#getAllocated() + */ + public Builder allocated(Long allocated) { + this.allocated = allocated; + return this; + } + + /** + * @see CapacityType#getLimit() + */ + public Builder limit(Long limit) { + this.limit = limit; + return this; + } + + + public CapacityType build() { + CapacityType capacity = new CapacityType(); + capacity.setUnits(units); + capacity.setAllocated(allocated); + capacity.setLimit(limit); + return capacity; + } + + + public Builder fromCapacityType(CapacityType in) { + return units(in.getUnits()) + .allocated(in.getAllocated()) + .limit(in.getLimit()); + } + } + + protected CapacityType() { + // For JAXB and builder use + } + + protected CapacityType(String units) { + this.units = units; + } + + + + @XmlElement(name = "Units", required = true) + protected String units; + @XmlElement(name = "Allocated") + protected Long allocated; + @XmlElement(name = "Limit") + protected Long limit; + + /** + * Gets the value of the units property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getUnits() { + return units; + } + + /** + * Sets the value of the units property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setUnits(String value) { + this.units = value; + } + + /** + * Gets the value of the allocated property. + * + * @return + * possible object is + * {@link Long } + * + */ + public Long getAllocated() { + return allocated; + } + + /** + * Sets the value of the allocated property. + * + * @param value + * allowed object is + * {@link Long } + * + */ + public void setAllocated(Long value) { + this.allocated = value; + } + + /** + * Gets the value of the limit property. + * + */ + public Long getLimit() { + return limit; + } + + /** + * Sets the value of the limit property. + * + */ + public void setLimit(Long value) { + this.limit = value; + } + + @Override + public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + CapacityType that = CapacityType.class.cast(o); + return equal(units, that.units) && + equal(allocated, that.allocated) && + equal(limit, that.limit); + } + + @Override + public int hashCode() { + return Objects.hashCode(units, + allocated, + limit); + } + + @Override + public String toString() { + return Objects.toStringHelper("") + .add("units", units) + .add("allocated", allocated) + .add("limit", limit).toString(); + } + +} diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CapacityWithUsage.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CapacityWithUsage.java new file mode 100644 index 0000000000..f80e445147 --- /dev/null +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CapacityWithUsage.java @@ -0,0 +1,227 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.jclouds.vcloud.director.v1_5.domain; + +import static com.google.common.base.Objects.equal; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + +import com.google.common.base.Objects; + + +/** + * + * Represents a capacity and usage of a given resource. + * + * + *

Java class for CapacityWithUsage complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="CapacityWithUsage">
+ *   <complexContent>
+ *     <extension base="{http://www.vmware.com/vcloud/v1.5}CapacityType">
+ *       <sequence>
+ *         <element name="Used" type="{http://www.w3.org/2001/XMLSchema}Long" minOccurs="0"/>
+ *         <element name="Overhead" type="{http://www.w3.org/2001/XMLSchema}Long" minOccurs="0"/>
+ *       </sequence>
+ *       <anyAttribute processContents='lax' namespace='##other'/>
+ *     </extension>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "CapacityWithUsage", propOrder = { + "used", + "overhead" +}) +public class CapacityWithUsage extends CapacityType + +{ + @SuppressWarnings("unchecked") + public static Builder builder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder().fromCapacityWithUsage(this); + } + + public static class Builder extends CapacityType.Builder { + + private Long used; + private Long overhead; + + /** + * @see CapacityWithUsage#getUsed() + */ + public Builder used(Long used) { + this.used = used; + return this; + } + + /** + * @see CapacityWithUsage#getOverhead() + */ + public Builder overhead(Long overhead) { + this.overhead = overhead; + return this; + } + + + public CapacityWithUsage build() { + CapacityWithUsage capacityWithUsage = new CapacityWithUsage(units); + capacityWithUsage.setUsed(used); + capacityWithUsage.setOverhead(overhead); + capacityWithUsage.setAllocated(allocated); + capacityWithUsage.setLimit(limit); + return capacityWithUsage; + } + + /** + * @see CapacityType#getUnits() + */ + public Builder units(String units) { + this.units = units; + return this; + } + + /** + * @see CapacityType#getAllocated() + */ + public Builder allocated(Long allocated) { + this.allocated = allocated; + return this; + } + + /** + * @see CapacityType#getLimit() + */ + public Builder limit(Long limit) { + this.limit = limit; + return this; + } + + + @Override + public Builder fromCapacityType(CapacityType in) { + return Builder.class.cast(super.fromCapacityType(in)); + } + public Builder fromCapacityWithUsage(CapacityWithUsage in) { + return fromCapacityType(in) + .used(in.getUsed()) + .overhead(in.getOverhead()); + } + } + + protected CapacityWithUsage() { + // For JAXB and builder use + } + + public CapacityWithUsage(String units) { + super(units); + } + + + @XmlElement(name = "Used") + protected Long used; + @XmlElement(name = "Overhead") + protected Long overhead; + + /** + * Gets the value of the used property. + * + * @return + * possible object is + * {@link Long } + * + */ + public Long getUsed() { + return used; + } + + /** + * Sets the value of the used property. + * + * @param value + * allowed object is + * {@link Long } + * + */ + public void setUsed(Long value) { + this.used = value; + } + + /** + * Gets the value of the overhead property. + * + * @return + * possible object is + * {@link Long } + * + */ + public Long getOverhead() { + return overhead; + } + + /** + * Sets the value of the overhead property. + * + * @param value + * allowed object is + * {@link Long } + * + */ + public void setOverhead(Long value) { + this.overhead = value; + } + + @Override + public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + CapacityWithUsage that = CapacityWithUsage.class.cast(o); + return equal(used, that.used) && + equal(overhead, that.overhead); + } + + @Override + public int hashCode() { + return Objects.hashCode(used, + overhead); + } + + @Override + public String toString() { + return Objects.toStringHelper("") + .add("used", used) + .add("overhead", overhead).toString(); + } + +} diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CaptureVAppParams.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CaptureVAppParams.java new file mode 100644 index 0000000000..a762cdb3ca --- /dev/null +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CaptureVAppParams.java @@ -0,0 +1,232 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.jclouds.vcloud.director.v1_5.domain; + +import static com.google.common.base.Objects.equal; + +import java.util.ArrayList; +import java.util.List; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlElementRef; +import javax.xml.bind.annotation.XmlType; + +import org.jclouds.ovf.Section; + +import com.google.common.base.Objects; + + +/** + * + * Represents the parameters for capturing a vApp to a vApp template. + * + * + *

Java class for CaptureVAppParams complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="CaptureVAppParams">
+ *   <complexContent>
+ *     <extension base="{http://www.vmware.com/vcloud/v1.5}ParamsType">
+ *       <sequence>
+ *         <element name="Source" type="{http://www.vmware.com/vcloud/v1.5}ReferenceType"/>
+ *         <element ref="{http://schemas.dmtf.org/ovf/envelope/1}Section" maxOccurs="unbounded" minOccurs="0"/>
+ *       </sequence>
+ *       <anyAttribute processContents='lax' namespace='##other'/>
+ *     </extension>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "CaptureVAppParams", propOrder = { + "source", + "section" +}) +public class CaptureVAppParams + extends ParamsType + +{ + @SuppressWarnings("unchecked") + public static Builder builder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder().fromCaptureVAppParams(this); + } + + public static class Builder extends ParamsType.Builder { + + private Reference source; + private List>> sections; + + /** + * @see CaptureVAppParams#getSource() + */ + public Builder source(Reference source) { + this.source = source; + return this; + } + + /** + * @see CaptureVAppParams#getExtend() + */ + public Builder sections(List>> sections) { + this.sections = sections; + return this; + } + + + public CaptureVAppParams build() { + CaptureVAppParams captureVAppParams = new CaptureVAppParams(sections); + captureVAppParams.setSource(source); + return captureVAppParams; + } + + + @Override + public Builder fromParamsType(ParamsType in) { + return Builder.class.cast(super.fromParamsType(in)); + } + public Builder fromCaptureVAppParams(CaptureVAppParams in) { + return fromParamsType(in) + .source(in.getSource()) + .sections(in.getSections()); + } + } + + private CaptureVAppParams() { + // For JAXB and builder use + } + + private CaptureVAppParams(List>> sections) { + this.sections = sections; + } + + + @XmlElement(name = "Source", required = true) + protected Reference source; + @XmlElementRef(name = "Section", namespace = "http://schemas.dmtf.org/ovf/envelope/1", type = JAXBElement.class) + protected List>> sections; + + /** + * Gets the value of the source property. + * + * @return + * possible object is + * {@link Reference } + * + */ + public Reference getSource() { + return source; + } + + /** + * Sets the value of the source property. + * + * @param value + * allowed object is + * {@link Reference } + * + */ + public void setSource(Reference value) { + this.source = value; + } + + /** + * + * An ovf:Section to configure the captured vAppTemplate. + * Gets the value of the section property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the section property. + * + *

+ * For example, to add a new item, do as follows: + *

+     *    getSection().add(newItem);
+     * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link JAXBElement }{@code <}{@link Section> }{@code >} + * {@link JAXBElement }{@code <}{@link VirtualHardwareSection> }{@code >} + * {@link JAXBElement }{@code <}{@link LeaseSettingsSection> }{@code >} + * {@link JAXBElement }{@code <}{@link EulaSection> }{@code >} + * {@link JAXBElement }{@code <}{@link RuntimeInfoSection> }{@code >} + * {@link JAXBElement }{@code <}{@link AnnotationSection> }{@code >} + * {@link JAXBElement }{@code <}{@link DeploymentOptionSection> }{@code >} + * {@link JAXBElement }{@code <}{@link StartupSection> }{@code >} + * {@link JAXBElement }{@code <}{@link ResourceAllocationSection> }{@code >} + * {@link JAXBElement }{@code <}{@link NetworkConnectionSection> }{@code >} + * {@link JAXBElement }{@code <}{@link CustomizationSection> }{@code >} + * {@link JAXBElement }{@code <}{@link ProductSection> }{@code >} + * {@link JAXBElement }{@code <}{@link GuestCustomizationSection> }{@code >} + * {@link JAXBElement }{@code <}{@link OperatingSystemSection> }{@code >} + * {@link JAXBElement }{@code <}{@link NetworkConfigSection> }{@code >} + * {@link JAXBElement }{@code <}{@link NetworkSection> }{@code >} + * {@link JAXBElement }{@code <}{@link DiskSection> }{@code >} + * {@link JAXBElement }{@code <}{@link InstallSection> }{@code >} + * + * + */ + public List>> getSections() { + if (sections == null) { + sections = new ArrayList>>(); + } + return this.sections; + } + + @Override + public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + CaptureVAppParams that = CaptureVAppParams.class.cast(o); + return equal(source, that.source) && + equal(sections, that.sections); + } + + @Override + public int hashCode() { + return Objects.hashCode(source, + sections); + } + + @Override + public String toString() { + return Objects.toStringHelper("") + .add("source", source) + .add("sections", sections).toString(); + } + +} diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CloneMediaParams.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CloneMediaParams.java new file mode 100644 index 0000000000..f0434a1a42 --- /dev/null +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CloneMediaParams.java @@ -0,0 +1,200 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.jclouds.vcloud.director.v1_5.domain; + +import static com.google.common.base.Objects.equal; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + +import com.google.common.base.Objects; + + +/** + * + * Represents parameters for copying a media resource and optionally + * deleting the source. + * + * + *

Java class for CloneMediaParams complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="CloneMediaParams">
+ *   <complexContent>
+ *     <extension base="{http://www.vmware.com/vcloud/v1.5}ParamsType">
+ *       <sequence>
+ *         <element name="Source" type="{http://www.vmware.com/vcloud/v1.5}ReferenceType"/>
+ *         <element name="IsSourceDelete" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
+ *       </sequence>
+ *       <anyAttribute processContents='lax' namespace='##other'/>
+ *     </extension>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "CloneMediaParams", propOrder = { + "source", + "isSourceDelete" +}) +public class CloneMediaParams + extends ParamsType + +{ + @SuppressWarnings("unchecked") + public static Builder builder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder().fromCloneMediaParams(this); + } + + public static class Builder extends ParamsType.Builder { + + private Reference source; + private Boolean isSourceDelete; + + /** + * @see CloneMediaParams#getSource() + */ + public Builder source(Reference source) { + this.source = source; + return this; + } + + /** + * @see CloneMediaParams#getIsSourceDelete() + */ + public Builder isSourceDelete(Boolean isSourceDelete) { + this.isSourceDelete = isSourceDelete; + return this; + } + + + public CloneMediaParams build() { + CloneMediaParams cloneMediaParams = new CloneMediaParams(); + cloneMediaParams.setSource(source); + cloneMediaParams.setIsSourceDelete(isSourceDelete); + return cloneMediaParams; + } + + + @Override + public Builder fromParamsType(ParamsType in) { + return Builder.class.cast(super.fromParamsType(in)); + } + public Builder fromCloneMediaParams(CloneMediaParams in) { + return fromParamsType(in) + .source(in.getSource()) + .isSourceDelete(in.isSourceDelete()); + } + } + + private CloneMediaParams() { + // For JAXB and builder use + } + + + + @XmlElement(name = "Source", required = true) + protected Reference source; + @XmlElement(name = "IsSourceDelete") + protected Boolean isSourceDelete; + + /** + * Gets the value of the source property. + * + * @return + * possible object is + * {@link Reference } + * + */ + public Reference getSource() { + return source; + } + + /** + * Sets the value of the source property. + * + * @param value + * allowed object is + * {@link Reference } + * + */ + public void setSource(Reference value) { + this.source = value; + } + + /** + * Gets the value of the isSourceDelete property. + * + * @return + * possible object is + * {@link Boolean } + * + */ + public Boolean isSourceDelete() { + return isSourceDelete; + } + + /** + * Sets the value of the isSourceDelete property. + * + * @param value + * allowed object is + * {@link Boolean } + * + */ + public void setIsSourceDelete(Boolean value) { + this.isSourceDelete = value; + } + + @Override + public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + CloneMediaParams that = CloneMediaParams.class.cast(o); + return equal(source, that.source) && + equal(isSourceDelete, that.isSourceDelete); + } + + @Override + public int hashCode() { + return Objects.hashCode(source, + isSourceDelete); + } + + @Override + public String toString() { + return Objects.toStringHelper("") + .add("source", source) + .add("isSourceDelete", isSourceDelete).toString(); + } + +} diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CloneVAppParams.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CloneVAppParams.java new file mode 100644 index 0000000000..69559ff598 --- /dev/null +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CloneVAppParams.java @@ -0,0 +1,178 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.jclouds.vcloud.director.v1_5.domain; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + +import com.google.common.base.Objects; + + +/** + * + * Represents parameters for copying a vApp and optionally deleting the source. + * + * + *

Java class for CloneVAppParams complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="CloneVAppParams">
+ *   <complexContent>
+ *     <extension base="{http://www.vmware.com/vcloud/v1.5}InstantiateVAppParamsType">
+ *       <anyAttribute processContents='lax' namespace='##other'/>
+ *     </extension>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "CloneVAppParams") +public class CloneVAppParams + extends InstantiateVAppParamsType + +{ + @SuppressWarnings("unchecked") + public static Builder builder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder().fromCloneVAppParams(this); + } + + public static class Builder extends InstantiateVAppParamsType.Builder { + + + public CloneVAppParams build() { + CloneVAppParams cloneVAppParams = new CloneVAppParams(); + return cloneVAppParams; + } + + /** + * @see ParamsType#getDescription() + */ + public Builder description(String description) { + super.description(description); + return this; + } + + /** + * @see ParamsType#getName() + */ + public Builder name(String name) { + super.name(name); + return this; + } + + /** + * @see VAppCreationParamsType#getVAppParent() + */ + public Builder vAppParent(Reference vAppParent) { + super.vAppParent(vAppParent); + return this; + } + + /** + * @see VAppCreationParamsType#getInstantiationParams() + */ + public Builder instantiationParams(InstantiationParams instantiationParams) { + super.instantiationParams(instantiationParams); + return this; + } + + /** + * @see VAppCreationParamsType#getDeploy() + */ + public Builder deploy(Boolean deploy) { + super.deploy(deploy); + return this; + } + + /** + * @see VAppCreationParamsType#getPowerOn() + */ + public Builder powerOn(Boolean powerOn) { + super.powerOn(powerOn); + return this; + } + + /** + * @see InstantiateVAppParamsType#getSource() + */ + public Builder source(Reference source) { + super.source(source); + return this; + } + + /** + * @see InstantiateVAppParamsType#getIsSourceDelete() + */ + public Builder isSourceDelete(Boolean isSourceDelete) { + super.isSourceDelete(isSourceDelete); + return this; + } + + /** + * @see InstantiateVAppParamsType#getLinkedClone() + */ + public Builder linkedClone(Boolean linkedClone) { + super.linkedClone(linkedClone); + return this; + } + + @Override + public Builder fromInstantiateVAppParamsType(InstantiateVAppParamsType in) { + return Builder.class.cast(super.fromInstantiateVAppParamsType(in)); + } + public Builder fromCloneVAppParams(CloneVAppParams in) { + return fromInstantiateVAppParamsType(in); + } + } + + private CloneVAppParams() { + // For JAXB and builder use + } + + @Override + public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + CloneVAppParams that = CloneVAppParams.class.cast(o); + return super.equals(that); + } + + @Override + public int hashCode() { + return super.hashCode() + Objects.hashCode(""); + } + + @Override + public String toString() { + return Objects.toStringHelper("").toString(); + } + +} diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CloneVAppTemplateParams.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CloneVAppTemplateParams.java new file mode 100644 index 0000000000..36d4b1de62 --- /dev/null +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CloneVAppTemplateParams.java @@ -0,0 +1,200 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.jclouds.vcloud.director.v1_5.domain; + +import static com.google.common.base.Objects.equal; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + +import com.google.common.base.Objects; + + +/** + * + * Represents parameters for copying a vApp template and optionally + * deleting the source. + * + * + *

Java class for CloneVAppTemplateParams complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="CloneVAppTemplateParams">
+ *   <complexContent>
+ *     <extension base="{http://www.vmware.com/vcloud/v1.5}ParamsType">
+ *       <sequence>
+ *         <element name="Source" type="{http://www.vmware.com/vcloud/v1.5}ReferenceType"/>
+ *         <element name="IsSourceDelete" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
+ *       </sequence>
+ *       <anyAttribute processContents='lax' namespace='##other'/>
+ *     </extension>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "CloneVAppTemplateParams", propOrder = { + "source", + "isSourceDelete" +}) +public class CloneVAppTemplateParams + extends ParamsType + +{ + @SuppressWarnings("unchecked") + public static Builder builder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder().fromCloneVAppTemplateParams(this); + } + + public static class Builder extends ParamsType.Builder { + + private Reference source; + private Boolean isSourceDelete; + + /** + * @see CloneVAppTemplateParams#getSource() + */ + public Builder source(Reference source) { + this.source = source; + return this; + } + + /** + * @see CloneVAppTemplateParams#getIsSourceDelete() + */ + public Builder isSourceDelete(Boolean isSourceDelete) { + this.isSourceDelete = isSourceDelete; + return this; + } + + + public CloneVAppTemplateParams build() { + CloneVAppTemplateParams cloneVAppTemplateParams = new CloneVAppTemplateParams(); + cloneVAppTemplateParams.setSource(source); + cloneVAppTemplateParams.setIsSourceDelete(isSourceDelete); + return cloneVAppTemplateParams; + } + + + @Override + public Builder fromParamsType(ParamsType in) { + return Builder.class.cast(super.fromParamsType(in)); + } + public Builder fromCloneVAppTemplateParams(CloneVAppTemplateParams in) { + return fromParamsType(in) + .source(in.getSource()) + .isSourceDelete(in.isSourceDelete()); + } + } + + private CloneVAppTemplateParams() { + // For JAXB and builder use + } + + + + @XmlElement(name = "Source", required = true) + protected Reference source; + @XmlElement(name = "IsSourceDelete") + protected Boolean isSourceDelete; + + /** + * Gets the value of the source property. + * + * @return + * possible object is + * {@link Reference } + * + */ + public Reference getSource() { + return source; + } + + /** + * Sets the value of the source property. + * + * @param value + * allowed object is + * {@link Reference } + * + */ + public void setSource(Reference value) { + this.source = value; + } + + /** + * Gets the value of the isSourceDelete property. + * + * @return + * possible object is + * {@link Boolean } + * + */ + public Boolean isSourceDelete() { + return isSourceDelete; + } + + /** + * Sets the value of the isSourceDelete property. + * + * @param value + * allowed object is + * {@link Boolean } + * + */ + public void setIsSourceDelete(Boolean value) { + this.isSourceDelete = value; + } + + @Override + public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + CloneVAppTemplateParams that = CloneVAppTemplateParams.class.cast(o); + return equal(source, that.source) && + equal(isSourceDelete, that.isSourceDelete); + } + + @Override + public int hashCode() { + return Objects.hashCode(source, + isSourceDelete); + } + + @Override + public String toString() { + return Objects.toStringHelper("") + .add("source", source) + .add("isSourceDelete", isSourceDelete).toString(); + } + +} diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ComposeVAppParams.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ComposeVAppParams.java new file mode 100644 index 0000000000..de601f35c3 --- /dev/null +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ComposeVAppParams.java @@ -0,0 +1,261 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.jclouds.vcloud.director.v1_5.domain; + +import static com.google.common.base.Objects.equal; + +import java.util.ArrayList; +import java.util.List; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlSeeAlso; +import javax.xml.bind.annotation.XmlType; + +import com.google.common.base.Objects; + + +/** + * + * Represents vApp composition parameters. + * + * + *

Java class for ComposeVAppParams complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="ComposeVAppParams">
+ *   <complexContent>
+ *     <extension base="{http://www.vmware.com/vcloud/v1.5}VAppCreationParamsType">
+ *       <sequence>
+ *         <element name="SourcedItem" type="{http://www.vmware.com/vcloud/v1.5}SourcedCompositionItemParamType" maxOccurs="unbounded" minOccurs="0"/>
+ *         <element ref="{http://www.vmware.com/vcloud/v1.5}AllEULAsAccepted" minOccurs="0"/>
+ *       </sequence>
+ *       <attribute name="linkedClone" type="{http://www.w3.org/2001/XMLSchema}boolean" />
+ *       <anyAttribute processContents='lax' namespace='##other'/>
+ *     </extension>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "ComposeVAppParams", propOrder = { + "sourcedItem", + "allEULAsAccepted" +}) +@XmlSeeAlso({ +// RecomposeVAppParamsType.class +}) +public class ComposeVAppParams + extends VAppCreationParamsType + +{ + @SuppressWarnings("unchecked") + public static Builder builder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder().fromComposeVAppParams(this); + } + + public static class Builder extends VAppCreationParamsType.Builder { + + private List sourcedItem; + private Boolean allEULAsAccepted; + private Boolean linkedClone; + + /** + * @see ComposeVAppParams#getSourcedItem() + */ + public Builder sourcedItem(List sourcedItem) { + this.sourcedItem = sourcedItem; + return this; + } + + /** + * @see ComposeVAppParams#getAllEULAsAccepted() + */ + public Builder allEULAsAccepted(Boolean allEULAsAccepted) { + this.allEULAsAccepted = allEULAsAccepted; + return this; + } + + /** + * @see ComposeVAppParams#getLinkedClone() + */ + public Builder linkedClone(Boolean linkedClone) { + this.linkedClone = linkedClone; + return this; + } + + + public ComposeVAppParams build() { + ComposeVAppParams composeVAppParams = new ComposeVAppParams(sourcedItem); + composeVAppParams.setAllEULAsAccepted(allEULAsAccepted); + composeVAppParams.setLinkedClone(linkedClone); + return composeVAppParams; + } + + + @Override + public Builder fromVAppCreationParamsType(VAppCreationParamsType in) { + return Builder.class.cast(super.fromVAppCreationParamsType(in)); + } + public Builder fromComposeVAppParams(ComposeVAppParams in) { + return fromVAppCreationParamsType(in) + .sourcedItem(in.getSourcedItem()) + .allEULAsAccepted(in.isAllEULAsAccepted()) + .linkedClone(in.isLinkedClone()); + } + } + + private ComposeVAppParams() { + // For JAXB and builder use + } + + private ComposeVAppParams(List sourcedItem) { + this.sourcedItem = sourcedItem; + } + + + @XmlElement(name = "SourcedItem") + protected List sourcedItem; + @XmlElement(name = "AllEULAsAccepted") + protected Boolean allEULAsAccepted; + @XmlAttribute + protected Boolean linkedClone; + + /** + * Gets the value of the sourcedItem property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the sourcedItem property. + * + *

+ * For example, to add a new item, do as follows: + *

+     *    getSourcedItem().add(newItem);
+     * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link SourcedCompositionItemParamType } + * + * + */ + public List getSourcedItem() { + if (sourcedItem == null) { + sourcedItem = new ArrayList(); + } + return this.sourcedItem; + } + + /** + * + * Used to confirm acceptance of all EULAs in a + * vApp template. Instantiation fails if this + * element is missing, empty, or set to false + * and one or more EulaSection elements are + * present. + * + * + * @return + * possible object is + * {@link Boolean } + * + */ + public Boolean isAllEULAsAccepted() { + return allEULAsAccepted; + } + + /** + * Sets the value of the allEULAsAccepted property. + * + * @param value + * allowed object is + * {@link Boolean } + * + */ + public void setAllEULAsAccepted(Boolean value) { + this.allEULAsAccepted = value; + } + + /** + * Gets the value of the linkedClone property. + * + * @return + * possible object is + * {@link Boolean } + * + */ + public Boolean isLinkedClone() { + return linkedClone; + } + + /** + * Sets the value of the linkedClone property. + * + * @param value + * allowed object is + * {@link Boolean } + * + */ + public void setLinkedClone(Boolean value) { + this.linkedClone = value; + } + + @Override + public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + ComposeVAppParams that = ComposeVAppParams.class.cast(o); + return equal(sourcedItem, that.sourcedItem) && + equal(allEULAsAccepted, that.allEULAsAccepted) && + equal(linkedClone, that.linkedClone); + } + + @Override + public int hashCode() { + return Objects.hashCode(sourcedItem, + allEULAsAccepted, + linkedClone); + } + + @Override + public String toString() { + return Objects.toStringHelper("") + .add("sourcedItem", sourcedItem) + .add("allEULAsAccepted", allEULAsAccepted) + .add("linkedClone", linkedClone).toString(); + } + +} diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ComputeCapacity.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ComputeCapacity.java new file mode 100644 index 0000000000..0de0b3376c --- /dev/null +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ComputeCapacity.java @@ -0,0 +1,190 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.jclouds.vcloud.director.v1_5.domain; + +import static com.google.common.base.Objects.equal; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + +import com.google.common.base.Objects; + + +/** + * + * Represents a compute capacity with units. + * + * + *

Java class for ComputeCapacity complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="ComputeCapacity">
+ *   <complexContent>
+ *     <extension base="{http://www.vmware.com/vcloud/v1.5}VCloudExtensibleType">
+ *       <sequence>
+ *         <element name="Cpu" type="{http://www.vmware.com/vcloud/v1.5}CapacityWithUsageType"/>
+ *         <element name="Memory" type="{http://www.vmware.com/vcloud/v1.5}CapacityWithUsageType"/>
+ *       </sequence>
+ *       <anyAttribute processContents='lax' namespace='##other'/>
+ *     </extension>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "ComputeCapacity", propOrder = { + "cpu", + "memory" +}) +public class ComputeCapacity { + public static Builder builder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder().fromComputeCapacity(this); + } + + public static class Builder { + + private CapacityWithUsage cpu; + private CapacityWithUsage memory; + + /** + * @see ComputeCapacity#getCpu() + */ + public Builder cpu(CapacityWithUsage cpu) { + this.cpu = cpu; + return this; + } + + /** + * @see ComputeCapacity#getMemory() + */ + public Builder memory(CapacityWithUsage memory) { + this.memory = memory; + return this; + } + + + public ComputeCapacity build() { + ComputeCapacity computeCapacity = new ComputeCapacity(); + computeCapacity.setCpu(cpu); + computeCapacity.setMemory(memory); + return computeCapacity; + } + + + public Builder fromComputeCapacity(ComputeCapacity in) { + return cpu(in.getCpu()) + .memory(in.getMemory()); + } + } + + private ComputeCapacity() { + // For JAXB and builder use + } + + + + @XmlElement(name = "Cpu", required = true) + protected CapacityWithUsage cpu; + @XmlElement(name = "Memory", required = true) + protected CapacityWithUsage memory; + + /** + * Gets the value of the cpu property. + * + * @return + * possible object is + * {@link CapacityWithUsage } + * + */ + public CapacityWithUsage getCpu() { + return cpu; + } + + /** + * Sets the value of the cpu property. + * + * @param value + * allowed object is + * {@link CapacityWithUsage } + * + */ + public void setCpu(CapacityWithUsage value) { + this.cpu = value; + } + + /** + * Gets the value of the memory property. + * + * @return + * possible object is + * {@link CapacityWithUsage } + * + */ + public CapacityWithUsage getMemory() { + return memory; + } + + /** + * Sets the value of the memory property. + * + * @param value + * allowed object is + * {@link CapacityWithUsage } + * + */ + public void setMemory(CapacityWithUsage value) { + this.memory = value; + } + + @Override + public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + ComputeCapacity that = ComputeCapacity.class.cast(o); + return equal(cpu, that.cpu) && + equal(memory, that.memory); + } + + @Override + public int hashCode() { + return Objects.hashCode(cpu, + memory); + } + + @Override + public String toString() { + return Objects.toStringHelper("") + .add("cpu", cpu) + .add("memory", memory).toString(); + } + +} diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/InstantiateVAppParams.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/InstantiateVAppParams.java new file mode 100644 index 0000000000..55d7c2f709 --- /dev/null +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/InstantiateVAppParams.java @@ -0,0 +1,158 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.jclouds.vcloud.director.v1_5.domain; + + + +/** + * Parameters for Instantiating a vApp + * + * @author danikov + */ +public class InstantiateVAppParams + extends InstantiateVAppParamsType { + + @SuppressWarnings("unchecked") + public static Builder builder() { + return new Builder(); + } + + @Override + public Builder toBuilder() { + return new Builder(); + } + + public static class Builder + extends InstantiateVAppParamsType.Builder { + + public InstantiateVAppParams build() { + InstantiateVAppParams instantiateVAppParams = new InstantiateVAppParams(); + instantiateVAppParams.setSource(source); + instantiateVAppParams.setIsSourceDelete(isSourceDelete); + instantiateVAppParams.setLinkedClone(linkedClone); + instantiateVAppParams.setVAppParent(vAppParent); + instantiateVAppParams.setInstantiationParams(instantiationParams); + instantiateVAppParams.setDeploy(deploy); + instantiateVAppParams.setPowerOn(powerOn); + instantiateVAppParams.setDescription(description); + instantiateVAppParams.setName(name); + return instantiateVAppParams; + } + + /** + * @see InstantiateVAppParams#getSource() + */ + public Builder source(Reference source) { + super.source(source); + return this; + } + + /** + * @see InstantiateVAppParams#getIsSourceDelete() + */ + public Builder isSourceDelete(Boolean isSourceDelete) { + super.isSourceDelete(isSourceDelete); + return this; + } + + /** + * @see InstantiateVAppParams#getLinkedClone() + */ + public Builder linkedClone(Boolean linkedClone) { + super.linkedClone(linkedClone); + return this; + } + + /** + * @see ParamsType#getDescription() + */ + public Builder description(String description) { + super.description(description); + return this; + } + + /** + * @see ParamsType#getName() + */ + public Builder name(String name) { + super.name(name); + return this; + } + + /** + * @see VAppCreationParamsType#getVAppParent() + */ + public Builder vAppParent(Reference vAppParent) { + super.vAppParent(vAppParent); + return this; + } + + /** + * @see VAppCreationParamsType#getInstantiationParams() + */ + public Builder instantiationParams(InstantiationParams instantiationParams) { + super.instantiationParams(instantiationParams); + return this; + } + + /** + * @see VAppCreationParamsType#getDeploy() + */ + public Builder deploy(Boolean deploy) { + super.deploy(deploy); + return this; + } + + /** + * @see VAppCreationParamsType#getPowerOn() + */ + public Builder powerOn(Boolean powerOn) { + super.powerOn(powerOn); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public Builder fromInstantiateVAppParamsType( + InstantiateVAppParamsType in) { + return Builder.class.cast(super.fromVAppCreationParamsType(in)); + } + public Builder fromInstantiateVAppParams(InstantiateVAppParams in) { + return fromInstantiateVAppParamsType(in); + } + } + + protected InstantiateVAppParams() { + // For JAXB and builder use + } + + @Override + public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + InstantiateVAppParams that = InstantiateVAppParams.class.cast(o); + return super.equals(that); + } + +} diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/InstantiateVAppParamsType.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/InstantiateVAppParamsType.java new file mode 100644 index 0000000000..4f35618a76 --- /dev/null +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/InstantiateVAppParamsType.java @@ -0,0 +1,302 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.jclouds.vcloud.director.v1_5.domain; + +import static com.google.common.base.Objects.equal; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlSeeAlso; +import javax.xml.bind.annotation.XmlType; + +import com.google.common.base.Objects; + + +/** + * + * Represents vApp instantiation parameters. + * + * + *

Java class for InstantiateVAppParams complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="InstantiateVAppParams">
+ *   <complexContent>
+ *     <extension base="{http://www.vmware.com/vcloud/v1.5}VAppCreationParamsType">
+ *       <sequence>
+ *         <element name="Source" type="{http://www.vmware.com/vcloud/v1.5}ReferenceType"/>
+ *         <element name="IsSourceDelete" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
+ *       </sequence>
+ *       <attribute name="linkedClone" type="{http://www.w3.org/2001/XMLSchema}boolean" />
+ *       <anyAttribute processContents='lax' namespace='##other'/>
+ *     </extension>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "InstantiateVAppParams", propOrder = { + "source", + "isSourceDelete" +}) +@XmlSeeAlso({ +// InstantiateVAppTemplateParamsType.class, +// CloneVAppParamsType.class +}) +public class InstantiateVAppParamsType> + extends VAppCreationParamsType + +{ + public static > Builder builder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder().fromInstantiateVAppParamsType(this); + } + + public static class Builder> extends VAppCreationParamsType.Builder { + + protected Reference source; + protected Boolean isSourceDelete; + protected Boolean linkedClone; + + /** + * @see InstantiateVAppParamsType#getSource() + */ + public Builder source(Reference source) { + this.source = source; + return this; + } + + /** + * @see InstantiateVAppParamsType#getIsSourceDelete() + */ + public Builder isSourceDelete(Boolean isSourceDelete) { + this.isSourceDelete = isSourceDelete; + return this; + } + + /** + * @see InstantiateVAppParamsType#getLinkedClone() + */ + public Builder linkedClone(Boolean linkedClone) { + this.linkedClone = linkedClone; + return this; + } + + + public InstantiateVAppParamsType build() { + InstantiateVAppParamsType instantiateVAppParams = new InstantiateVAppParamsType(); + instantiateVAppParams.setSource(source); + instantiateVAppParams.setIsSourceDelete(isSourceDelete); + instantiateVAppParams.setLinkedClone(linkedClone); + instantiateVAppParams.setVAppParent(vAppParent); + instantiateVAppParams.setInstantiationParams(instantiationParams); + instantiateVAppParams.setDeploy(deploy); + instantiateVAppParams.setPowerOn(powerOn); + instantiateVAppParams.setDescription(description); + instantiateVAppParams.setName(name); + return instantiateVAppParams; + } + + /** + * @see ParamsType#getDescription() + */ + public Builder description(String description) { + super.description(description); + return this; + } + + /** + * @see ParamsType#getName() + */ + public Builder name(String name) { + super.name(name); + return this; + } + + /** + * @see VAppCreationParamsType#getVAppParent() + */ + public Builder vAppParent(Reference vAppParent) { + super.vAppParent(vAppParent); + return this; + } + + /** + * @see VAppCreationParamsType#getInstantiationParams() + */ + public Builder instantiationParams(InstantiationParams instantiationParams) { + super.instantiationParams(instantiationParams); + return this; + } + + /** + * @see VAppCreationParamsType#getDeploy() + */ + public Builder deploy(Boolean deploy) { + super.deploy(deploy); + return this; + } + + /** + * @see VAppCreationParamsType#getPowerOn() + */ + public Builder powerOn(Boolean powerOn) { + super.powerOn(powerOn); + return this; + } + + /** + * {@inheritDoc} + */ + @SuppressWarnings("unchecked") + @Override + public Builder fromVAppCreationParamsType(VAppCreationParamsType in) { + return Builder.class.cast(super.fromVAppCreationParamsType(in)); + } + public Builder fromInstantiateVAppParamsType(InstantiateVAppParamsType in) { + return fromVAppCreationParamsType(in) + .source(in.getSource()) + .isSourceDelete(in.isSourceDelete()) + .linkedClone(in.isLinkedClone()); + } + } + + protected InstantiateVAppParamsType() { + // For JAXB and builder use + } + + + + @XmlElement(name = "Source", required = true) + protected Reference source; + @XmlElement(name = "IsSourceDelete") + protected Boolean isSourceDelete; + @XmlAttribute + protected Boolean linkedClone; + + /** + * Gets the value of the source property. + * + * @return + * possible object is + * {@link Reference } + * + */ + public Reference getSource() { + return source; + } + + /** + * Sets the value of the source property. + * + * @param value + * allowed object is + * {@link Reference } + * + */ + public void setSource(Reference value) { + this.source = value; + } + + /** + * Gets the value of the isSourceDelete property. + * + * @return + * possible object is + * {@link Boolean } + * + */ + public Boolean isSourceDelete() { + return isSourceDelete; + } + + /** + * Sets the value of the isSourceDelete property. + * + * @param value + * allowed object is + * {@link Boolean } + * + */ + public void setIsSourceDelete(Boolean value) { + this.isSourceDelete = value; + } + + /** + * Gets the value of the linkedClone property. + * + * @return + * possible object is + * {@link Boolean } + * + */ + public Boolean isLinkedClone() { + return linkedClone; + } + + /** + * Sets the value of the linkedClone property. + * + * @param value + * allowed object is + * {@link Boolean } + * + */ + public void setLinkedClone(Boolean value) { + this.linkedClone = value; + } + + @Override + public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + InstantiateVAppParamsType that = InstantiateVAppParamsType.class.cast(o); + return equal(source, that.source) && + equal(isSourceDelete, that.isSourceDelete) && + equal(linkedClone, that.linkedClone); + } + + @Override + public int hashCode() { + return Objects.hashCode(source, + isSourceDelete, + linkedClone); + } + + @Override + public String toString() { + return Objects.toStringHelper("") + .add("source", source) + .add("isSourceDelete", isSourceDelete) + .add("linkedClone", linkedClone).toString(); + } + +} diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/InstantiateVAppTemplateParams.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/InstantiateVAppTemplateParams.java new file mode 100644 index 0000000000..ce7e905f34 --- /dev/null +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/InstantiateVAppTemplateParams.java @@ -0,0 +1,212 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.jclouds.vcloud.director.v1_5.domain; + +import static com.google.common.base.Objects.equal; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + +import com.google.common.base.Objects; + + +/** + * + * Represents vApp template instantiation parameters. + * + * + *

Java class for InstantiateVAppTemplateParams complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="InstantiateVAppTemplateParams">
+ *   <complexContent>
+ *     <extension base="{http://www.vmware.com/vcloud/v1.5}InstantiateVAppParamsType">
+ *       <sequence>
+ *         <element ref="{http://www.vmware.com/vcloud/v1.5}AllEULAsAccepted" minOccurs="0"/>
+ *       </sequence>
+ *       <anyAttribute processContents='lax' namespace='##other'/>
+ *     </extension>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "InstantiateVAppTemplateParams", propOrder = { + "allEULAsAccepted" +}) +public class InstantiateVAppTemplateParams + extends InstantiateVAppParamsType { + + @SuppressWarnings("unchecked") + public static Builder builder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder().fromInstantiateVAppTemplateParams(this); + } + + public static class Builder extends InstantiateVAppParamsType.Builder { + + private Boolean allEULAsAccepted; + + /** + * @see InstantiateVAppTemplateParamsType#getAllEULAsAccepted() + */ + public Builder allEULAsAccepted(Boolean allEULAsAccepted) { + this.allEULAsAccepted = allEULAsAccepted; + return this; + } + + public InstantiateVAppTemplateParams build() { + InstantiateVAppTemplateParams instantiateVAppTemplateParams = new InstantiateVAppTemplateParams(); + instantiateVAppTemplateParams.setAllEULAsAccepted(allEULAsAccepted); + return instantiateVAppTemplateParams; + } + + /** + * @see ParamsType#getDescription() + */ + public Builder description(String description) { + super.description(description); + return this; + } + + /** + * @see ParamsType#getName() + */ + public Builder name(String name) { + super.name(name); + return this; + } + + /** + * @see VAppCreationParamsType#getVAppParent() + */ + public Builder vAppParent(Reference vAppParent) { + super.vAppParent(vAppParent); + return this; + } + + /** + * @see VAppCreationParamsType#getInstantiationParams() + */ + public Builder instantiationParams(InstantiationParams instantiationParams) { + super.instantiationParams(instantiationParams); + return this; + } + + /** + * @see VAppCreationParamsType#getDeploy() + */ + public Builder deploy(Boolean deploy) { + super.deploy(deploy); + return this; + } + + /** + * @see VAppCreationParamsType#getPowerOn() + */ + public Builder powerOn(Boolean powerOn) { + super.powerOn(powerOn); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public Builder fromInstantiateVAppParamsType(InstantiateVAppParamsType in) { + return Builder.class.cast(super.fromInstantiateVAppParamsType(in)); + } + + public Builder fromInstantiateVAppTemplateParams(InstantiateVAppTemplateParams in) { + return fromInstantiateVAppParamsType(in) + .allEULAsAccepted(in.isAllEULAsAccepted()); + } + } + + private InstantiateVAppTemplateParams() { + // For JAXB and builder use + } + + + + @XmlElement(name = "AllEULAsAccepted") + protected Boolean allEULAsAccepted; + + /** + * + * Used to confirm acceptance of all EULAs in a + * vApp template. Instantiation fails if this + * element is missing, empty, or set to false + * and one or more EulaSection elements are + * present. + * + * + * @return + * possible object is + * {@link Boolean } + * + */ + public Boolean isAllEULAsAccepted() { + return allEULAsAccepted; + } + + /** + * Sets the value of the allEULAsAccepted property. + * + * @param value + * allowed object is + * {@link Boolean } + * + */ + public void setAllEULAsAccepted(Boolean value) { + this.allEULAsAccepted = value; + } + + @Override + public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + InstantiateVAppTemplateParams that = InstantiateVAppTemplateParams.class.cast(o); + return equal(allEULAsAccepted, that.allEULAsAccepted); + } + + @Override + public int hashCode() { + return Objects.hashCode(allEULAsAccepted); + } + + @Override + public String toString() { + return Objects.toStringHelper("") + .add("allEULAsAccepted", allEULAsAccepted).toString(); + } + +} diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/InstantiationParams.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/InstantiationParams.java new file mode 100644 index 0000000000..af0ab6754b --- /dev/null +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/InstantiationParams.java @@ -0,0 +1,180 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.jclouds.vcloud.director.v1_5.domain; + +import static com.google.common.base.Objects.equal; + +import java.util.ArrayList; +import java.util.List; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElementRef; +import javax.xml.bind.annotation.XmlType; + +import org.jclouds.ovf.Section; + +import com.google.common.base.Objects; + + +/** + * + * Represents a list of ovf:Section to configure for instantiating a VApp. + * + * + *

Java class for InstantiationParams complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="InstantiationParams">
+ *   <complexContent>
+ *     <extension base="{http://www.vmware.com/vcloud/v1.5}VCloudExtensibleType">
+ *       <sequence>
+ *         <element ref="{http://schemas.dmtf.org/ovf/envelope/1}Section" maxOccurs="unbounded" minOccurs="0"/>
+ *       </sequence>
+ *       <anyAttribute processContents='lax' namespace='##other'/>
+ *     </extension>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "InstantiationParams", propOrder = { + "section" +}) +public class InstantiationParams { + public static Builder builder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder().fromInstantiationParams(this); + } + + public static class Builder { + + private List>> sections; + + /** + * @see InstantiationParams#getExtend() + */ + public Builder sections(List>> sections) { + this.sections = sections; + return this; + } + + + public InstantiationParams build() { + InstantiationParams instantiationParams = new InstantiationParams(sections); + return instantiationParams; + } + + + public Builder fromInstantiationParams(InstantiationParams in) { + return sections(in.getSections()); + } + } + + private InstantiationParams() { + // For JAXB and builder use + } + + private InstantiationParams(List>> sections) { + this.sections = sections; + } + + + @XmlElementRef(name = "Section", namespace = "http://schemas.dmtf.org/ovf/envelope/1", type = JAXBElement.class) + protected List>> sections; + + /** + * + * An ovf:Section to configure for instantiation. + * Gets the value of the section property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the section property. + * + *

+ * For example, to add a new item, do as follows: + *

+     *    getSection().add(newItem);
+     * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link JAXBElement }{@code <}{@link SectionType }{@code >} + * {@link JAXBElement }{@code <}{@link VirtualHardwareSectionType }{@code >} + * {@link JAXBElement }{@code <}{@link LeaseSettingsSectionType }{@code >} + * {@link JAXBElement }{@code <}{@link EulaSectionType }{@code >} + * {@link JAXBElement }{@code <}{@link RuntimeInfoSectionType }{@code >} + * {@link JAXBElement }{@code <}{@link AnnotationSectionType }{@code >} + * {@link JAXBElement }{@code <}{@link DeploymentOptionSectionType }{@code >} + * {@link JAXBElement }{@code <}{@link StartupSectionType }{@code >} + * {@link JAXBElement }{@code <}{@link ResourceAllocationSectionType }{@code >} + * {@link JAXBElement }{@code <}{@link NetworkConnectionSectionType }{@code >} + * {@link JAXBElement }{@code <}{@link CustomizationSectionType }{@code >} + * {@link JAXBElement }{@code <}{@link ProductSectionType }{@code >} + * {@link JAXBElement }{@code <}{@link GuestCustomizationSectionType }{@code >} + * {@link JAXBElement }{@code <}{@link OperatingSystemSectionType }{@code >} + * {@link JAXBElement }{@code <}{@link NetworkConfigSectionType }{@code >} + * {@link JAXBElement }{@code <}{@link NetworkSectionType }{@code >} + * {@link JAXBElement }{@code <}{@link DiskSectionType }{@code >} + * {@link JAXBElement }{@code <}{@link InstallSectionType }{@code >} + * + * + */ + public List>> getSections() { + if (sections == null) { + sections = new ArrayList>>(); + } + return this.sections; + } + + @Override + public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + InstantiationParams that = InstantiationParams.class.cast(o); + return equal(sections, that.sections); + } + + @Override + public int hashCode() { + return Objects.hashCode(sections); + } + + @Override + public String toString() { + return Objects.toStringHelper("") + .add("sections", sections).toString(); + } + +} diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/NetworkAssignment.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/NetworkAssignment.java new file mode 100644 index 0000000000..77eec2e6e6 --- /dev/null +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/NetworkAssignment.java @@ -0,0 +1,188 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.jclouds.vcloud.director.v1_5.domain; + +import static com.google.common.base.Objects.equal; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlType; + +import com.google.common.base.Objects; + + +/** + * + * Represents mapping between a VM and vApp network. + * + * + *

Java class for NetworkAssignment complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="NetworkAssignment">
+ *   <complexContent>
+ *     <extension base="{http://www.vmware.com/vcloud/v1.5}VCloudExtensibleType">
+ *       <attribute name="innerNetwork" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
+ *       <attribute name="containerNetwork" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
+ *       <anyAttribute processContents='lax' namespace='##other'/>
+ *     </extension>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "NetworkAssignment") +public class NetworkAssignment + + +{ + public static Builder builder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder().fromNetworkAssignment(this); + } + + public static class Builder { + + private String innerNetwork; + private String containerNetwork; + + /** + * @see NetworkAssignment#getInnerNetwork() + */ + public Builder innerNetwork(String innerNetwork) { + this.innerNetwork = innerNetwork; + return this; + } + + /** + * @see NetworkAssignment#getContainerNetwork() + */ + public Builder containerNetwork(String containerNetwork) { + this.containerNetwork = containerNetwork; + return this; + } + + + public NetworkAssignment build() { + NetworkAssignment networkAssignment = new NetworkAssignment(); + networkAssignment.setInnerNetwork(innerNetwork); + networkAssignment.setContainerNetwork(containerNetwork); + return networkAssignment; + } + + + public Builder fromNetworkAssignment(NetworkAssignment in) { + return innerNetwork(in.getInnerNetwork()) + .containerNetwork(in.getContainerNetwork()); + } + } + + private NetworkAssignment() { + // For JAXB and builder use + } + + + + @XmlAttribute(required = true) + protected String innerNetwork; + @XmlAttribute(required = true) + protected String containerNetwork; + + /** + * Gets the value of the innerNetwork property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getInnerNetwork() { + return innerNetwork; + } + + /** + * Sets the value of the innerNetwork property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setInnerNetwork(String value) { + this.innerNetwork = value; + } + + /** + * Gets the value of the containerNetwork property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getContainerNetwork() { + return containerNetwork; + } + + /** + * Sets the value of the containerNetwork property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setContainerNetwork(String value) { + this.containerNetwork = value; + } + + @Override + public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + NetworkAssignment that = NetworkAssignment.class.cast(o); + return equal(innerNetwork, that.innerNetwork) && + equal(containerNetwork, that.containerNetwork); + } + + @Override + public int hashCode() { + return Objects.hashCode(innerNetwork, + containerNetwork); + } + + @Override + public String toString() { + return Objects.toStringHelper("") + .add("innerNetwork", innerNetwork) + .add("containerNetwork", containerNetwork).toString(); + } + +} diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ParamsType.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ParamsType.java new file mode 100644 index 0000000000..a2f8d4e7ce --- /dev/null +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ParamsType.java @@ -0,0 +1,201 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.jclouds.vcloud.director.v1_5.domain; + +import static com.google.common.base.Objects.equal; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlSeeAlso; +import javax.xml.bind.annotation.XmlType; + +import com.google.common.base.Objects; + + +/** + * + * A basic type used to specify parameters for operations. + * + * + *

Java class for Params complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="Params">
+ *   <complexContent>
+ *     <extension base="{http://www.vmware.com/vcloud/v1.5}VCloudExtensibleType">
+ *       <sequence>
+ *         <element name="Description" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *       <attribute name="name" type="{http://www.w3.org/2001/XMLSchema}string" />
+ *       <anyAttribute processContents='lax' namespace='##other'/>
+ *     </extension>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "Params", propOrder = { + "description" +}) +@XmlSeeAlso({ +// CaptureVAppParams.class, +// CloneVAppTemplateParams.class, +// CloneMediaParams.class, +// UploadVAppTemplateParams.class, +// ImportVmAsVAppTemplateParams.class, +// ImportMediaParams.class, +// UpdateResourcePoolSetParams.class, +// VAppCreationParams.class +}) +public class ParamsType> { + public static > Builder builder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder().fromParamsType(this); + } + + public static class Builder>{ + + protected String description; + protected String name; + + /** + * @see ParamsType#getDescription() + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * @see ParamsType#getName() + */ + public Builder name(String name) { + this.name = name; + return this; + } + + + public ParamsType build() { + ParamsType params = new ParamsType(); + params.setDescription(description); + params.setName(name); + return params; + } + + + public Builder fromParamsType(ParamsType in) { + return description(in.getDescription()) + .name(in.getName()); + } + } + + protected ParamsType() { + // For JAXB and builder use + } + + + + @XmlElement(name = "Description") + protected String description; + @XmlAttribute + protected String name; + + /** + * Gets the value of the description property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDescription() { + return description; + } + + /** + * Sets the value of the description property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDescription(String value) { + this.description = value; + } + + /** + * Gets the value of the name property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getName() { + return name; + } + + /** + * Sets the value of the name property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setName(String value) { + this.name = value; + } + + @Override + public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + ParamsType that = ParamsType.class.cast(o); + return equal(description, that.description) && + equal(name, that.name); + } + + @Override + public int hashCode() { + return Objects.hashCode(description, + name); + } + + @Override + public String toString() { + return Objects.toStringHelper("") + .add("description", description) + .add("name", name).toString(); + } + +} diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ResourceEntities.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ResourceEntities.java new file mode 100644 index 0000000000..ee6a758f70 --- /dev/null +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ResourceEntities.java @@ -0,0 +1,167 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.jclouds.vcloud.director.v1_5.domain; + +import static com.google.common.base.Objects.equal; +import static com.google.common.base.Preconditions.checkNotNull; + +import java.util.List; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + +import org.testng.collections.Lists; + +import com.google.common.base.Objects; + + +/** + * + * Represents a list of references to resource entities. + * + * + *

Java class for ResourceEntities complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="ResourceEntities">
+ *   <complexContent>
+ *     <extension base="{http://www.vmware.com/vcloud/v1.5}VCloudExtensibleType">
+ *       <sequence>
+ *         <element name="ResourceEntity" type="{http://www.vmware.com/vcloud/v1.5}ReferenceType" maxOccurs="unbounded" minOccurs="0"/>
+ *       </sequence>
+ *       <anyAttribute processContents='lax' namespace='##other'/>
+ *     </extension>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "ResourceEntities", propOrder = { + "resourceEntities" +}) +public class ResourceEntities { + public static Builder builder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder().fromResourceEntities(this); + } + + public static class Builder { + + private List resourceEntities = Lists.newArrayList(); + + /** + * @see ResourceEntities#getResourceEntities() + */ + public Builder resourceEntities(List resourceEntities) { + this.resourceEntities = Lists.newArrayList(checkNotNull(resourceEntities, "resourceEntities")); + return this; + } + + /** + * @see ResourceEntities#getResourceEntities() + */ + public Builder resourceEntity(Reference resourceEntity) { + resourceEntities.add(checkNotNull(resourceEntity, "resourceEntity")); + return this; + } + + public ResourceEntities build() { + ResourceEntities resourceEntities = new ResourceEntities(this.resourceEntities); + return resourceEntities; + } + + + public Builder fromResourceEntities(ResourceEntities in) { + return resourceEntities(in.getResourceEntities()); + } + } + + private ResourceEntities() { + // For JAXB and builder use + } + + private ResourceEntities(List resourceEntity) { + this.resourceEntities = resourceEntity; + } + + + @XmlElement(name = "ResourceEntity") + protected List resourceEntities; + + /** + * Gets the value of the resourceEntity property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the resourceEntity property. + * + *

+ * For example, to add a new item, do as follows: + *

+     *    getResourceEntity().add(newItem);
+     * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link ReferenceType } + * + * + */ + public List getResourceEntities() { + if (resourceEntities == null) { + resourceEntities = Lists.newArrayList(); + } + return this.resourceEntities; + } + + @Override + public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + ResourceEntities that = ResourceEntities.class.cast(o); + return equal(resourceEntities, that.resourceEntities); + } + + @Override + public int hashCode() { + return Objects.hashCode(resourceEntities); + } + + @Override + public String toString() { + return Objects.toStringHelper("") + .add("resourceEntity", resourceEntities).toString(); + } + +} diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/SourcedCompositionItemParam.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/SourcedCompositionItemParam.java new file mode 100644 index 0000000000..c52936f972 --- /dev/null +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/SourcedCompositionItemParam.java @@ -0,0 +1,326 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.jclouds.vcloud.director.v1_5.domain; + +import static com.google.common.base.Objects.equal; + +import java.util.ArrayList; +import java.util.List; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + +import com.google.common.base.Objects; + + +/** + * + * Represents a composition item. + * + * + *

Java class for SourcedCompositionItemParam complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="SourcedCompositionItemParam">
+ *   <complexContent>
+ *     <extension base="{http://www.vmware.com/vcloud/v1.5}VCloudExtensibleType">
+ *       <sequence>
+ *         <element name="Source" type="{http://www.vmware.com/vcloud/v1.5}ReferenceType"/>
+ *         <element name="VAppScopedLocalId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="InstantiationParams" type="{http://www.vmware.com/vcloud/v1.5}InstantiationParamsType" minOccurs="0"/>
+ *         <element name="NetworkAssignment" type="{http://www.vmware.com/vcloud/v1.5}NetworkAssignmentType" maxOccurs="unbounded" minOccurs="0"/>
+ *       </sequence>
+ *       <attribute name="sourceDelete" type="{http://www.w3.org/2001/XMLSchema}boolean" />
+ *       <anyAttribute processContents='lax' namespace='##other'/>
+ *     </extension>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "SourcedCompositionItemParam", propOrder = { + "source", + "vAppScopedLocalId", + "instantiationParams", + "networkAssignment" +}) +public class SourcedCompositionItemParam { + public static Builder builder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder().fromSourcedCompositionItemParam(this); + } + + public static class Builder { + + private Reference source; + private String vAppScopedLocalId; + private InstantiationParams instantiationParams; + private List networkAssignment; + private Boolean sourceDelete; + + /** + * @see SourcedCompositionItemParam#getSource() + */ + public Builder source(Reference source) { + this.source = source; + return this; + } + + /** + * @see SourcedCompositionItemParam#getVAppScopedLocalId() + */ + public Builder vAppScopedLocalId(String vAppScopedLocalId) { + this.vAppScopedLocalId = vAppScopedLocalId; + return this; + } + + /** + * @see SourcedCompositionItemParam#getInstantiationParams() + */ + public Builder instantiationParams(InstantiationParams instantiationParams) { + this.instantiationParams = instantiationParams; + return this; + } + + /** + * @see SourcedCompositionItemParam#getNetworkAssignment() + */ + public Builder networkAssignment(List networkAssignment) { + this.networkAssignment = networkAssignment; + return this; + } + + /** + * @see SourcedCompositionItemParam#getSourceDelete() + */ + public Builder sourceDelete(Boolean sourceDelete) { + this.sourceDelete = sourceDelete; + return this; + } + + + public SourcedCompositionItemParam build() { + SourcedCompositionItemParam sourcedCompositionItemParam = new SourcedCompositionItemParam(networkAssignment); + sourcedCompositionItemParam.setSource(source); + sourcedCompositionItemParam.setVAppScopedLocalId(vAppScopedLocalId); + sourcedCompositionItemParam.setInstantiationParams(instantiationParams); + sourcedCompositionItemParam.setSourceDelete(sourceDelete); + return sourcedCompositionItemParam; + } + + + public Builder fromSourcedCompositionItemParam(SourcedCompositionItemParam in) { + return source(in.getSource()) + .vAppScopedLocalId(in.getVAppScopedLocalId()) + .instantiationParams(in.getInstantiationParams()) + .networkAssignment(in.getNetworkAssignment()) + .sourceDelete(in.isSourceDelete()); + } + } + + private SourcedCompositionItemParam() { + // For JAXB and builder use + } + + private SourcedCompositionItemParam(List networkAssignment) { + this.networkAssignment = networkAssignment; + } + + + @XmlElement(name = "Source", required = true) + protected Reference source; + @XmlElement(name = "VAppScopedLocalId") + protected String vAppScopedLocalId; + @XmlElement(name = "InstantiationParams") + protected InstantiationParams instantiationParams; + @XmlElement(name = "NetworkAssignment") + protected List networkAssignment; + @XmlAttribute + protected Boolean sourceDelete; + + /** + * Gets the value of the source property. + * + * @return + * possible object is + * {@link Reference } + * + */ + public Reference getSource() { + return source; + } + + /** + * Sets the value of the source property. + * + * @param value + * allowed object is + * {@link Reference } + * + */ + public void setSource(Reference value) { + this.source = value; + } + + /** + * Gets the value of the vAppScopedLocalId property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getVAppScopedLocalId() { + return vAppScopedLocalId; + } + + /** + * Sets the value of the vAppScopedLocalId property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setVAppScopedLocalId(String value) { + this.vAppScopedLocalId = value; + } + + /** + * Gets the value of the instantiationParams property. + * + * @return + * possible object is + * {@link InstantiationParams } + * + */ + public InstantiationParams getInstantiationParams() { + return instantiationParams; + } + + /** + * Sets the value of the instantiationParams property. + * + * @param value + * allowed object is + * {@link InstantiationParams } + * + */ + public void setInstantiationParams(InstantiationParams value) { + this.instantiationParams = value; + } + + /** + * Gets the value of the networkAssignment property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the networkAssignment property. + * + *

+ * For example, to add a new item, do as follows: + *

+     *    getNetworkAssignment().add(newItem);
+     * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link NetworkAssignmentType } + * + * + */ + public List getNetworkAssignment() { + if (networkAssignment == null) { + networkAssignment = new ArrayList(); + } + return this.networkAssignment; + } + + /** + * Gets the value of the sourceDelete property. + * + * @return + * possible object is + * {@link Boolean } + * + */ + public Boolean isSourceDelete() { + return sourceDelete; + } + + /** + * Sets the value of the sourceDelete property. + * + * @param value + * allowed object is + * {@link Boolean } + * + */ + public void setSourceDelete(Boolean value) { + this.sourceDelete = value; + } + + @Override + public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + SourcedCompositionItemParam that = SourcedCompositionItemParam.class.cast(o); + return equal(source, that.source) && + equal(vAppScopedLocalId, that.vAppScopedLocalId) && + equal(instantiationParams, that.instantiationParams) && + equal(networkAssignment, that.networkAssignment) && + equal(sourceDelete, that.sourceDelete); + } + + @Override + public int hashCode() { + return Objects.hashCode(source, + vAppScopedLocalId, + instantiationParams, + networkAssignment, + sourceDelete); + } + + @Override + public String toString() { + return Objects.toStringHelper("") + .add("source", source) + .add("vAppScopedLocalId", vAppScopedLocalId) + .add("instantiationParams", instantiationParams) + .add("networkAssignment", networkAssignment) + .add("sourceDelete", sourceDelete).toString(); + } + +} diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/SupportedHardwareVersions.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/SupportedHardwareVersions.java new file mode 100644 index 0000000000..d8338d5809 --- /dev/null +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/SupportedHardwareVersions.java @@ -0,0 +1,167 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.jclouds.vcloud.director.v1_5.domain; + +import static com.google.common.base.Objects.equal; +import static com.google.common.base.Preconditions.checkNotNull; + +import java.util.List; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + +import org.testng.collections.Lists; + +import com.google.common.base.Objects; + + +/** + * + * Represents a list of supported VM hardware versions. + * + * + *

Java class for SupportedHardwareVersions complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="SupportedHardwareVersions">
+ *   <complexContent>
+ *     <extension base="{http://www.vmware.com/vcloud/v1.5}VCloudExtensibleType">
+ *       <sequence>
+ *         <element name="SupportedHardwareVersion" type="{http://www.vmware.com/vcloud/v1.5}SupportedHardwareVersionType" maxOccurs="unbounded" minOccurs="0"/>
+ *       </sequence>
+ *       <anyAttribute processContents='lax' namespace='##other'/>
+ *     </extension>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "SupportedHardwareVersions", propOrder = { + "supportedHardwareVersions" +}) +public class SupportedHardwareVersions { + public static Builder builder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder().fromSupportedHardwareVersions(this); + } + + public static class Builder { + + private List supportedHardwareVersions = Lists.newArrayList(); + + /** + * @see SupportedHardwareVersions#getSupportedHardwareVersions() + */ + public Builder supportedHardwareVersions(List supportedHardwareVersions) { + this.supportedHardwareVersions = Lists.newArrayList(checkNotNull(supportedHardwareVersions, "supportedHardwareVersions")); + return this; + } + + /** + * @see SupportedHardwareVersions#getSupportedHardwareVersions() + */ + public Builder supportedHardwareVersion(String supportedHardwareVersion) { + supportedHardwareVersions.add(checkNotNull(supportedHardwareVersion, "supportedHardwareVersion")); + return this; + } + + public SupportedHardwareVersions build() { + SupportedHardwareVersions supportedHardwareVersions = new SupportedHardwareVersions(this.supportedHardwareVersions); + return supportedHardwareVersions; + } + + + public Builder fromSupportedHardwareVersions(SupportedHardwareVersions in) { + return supportedHardwareVersions(in.getSupportedHardwareVersions()); + } + } + + private SupportedHardwareVersions() { + // For JAXB and builder use + } + + private SupportedHardwareVersions(List supportedHardwareVersions) { + this.supportedHardwareVersions = supportedHardwareVersions; + } + + + @XmlElement(name = "SupportedHardwareVersion") + protected List supportedHardwareVersions; + + /** + * Gets the value of the supportedHardwareVersion property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the supportedHardwareVersion property. + * + *

+ * For example, to add a new item, do as follows: + *

+     *    getSupportedHardwareVersion().add(newItem);
+     * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link String } + * + * + */ + public List getSupportedHardwareVersions() { + if (supportedHardwareVersions == null) { + supportedHardwareVersions = Lists.newArrayList(); + } + return this.supportedHardwareVersions; + } + + @Override + public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + SupportedHardwareVersions that = SupportedHardwareVersions.class.cast(o); + return equal(supportedHardwareVersions, that.supportedHardwareVersions); + } + + @Override + public int hashCode() { + return Objects.hashCode(supportedHardwareVersions); + } + + @Override + public String toString() { + return Objects.toStringHelper("") + .add("supportedHardwareVersion", supportedHardwareVersions).toString(); + } + +} diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/UploadVAppTemplateParams.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/UploadVAppTemplateParams.java new file mode 100644 index 0000000000..9ec25e2d77 --- /dev/null +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/UploadVAppTemplateParams.java @@ -0,0 +1,194 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.jclouds.vcloud.director.v1_5.domain; + +import static com.google.common.base.Objects.equal; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlType; + +import com.google.common.base.Objects; + + +/** + * + * Represents vApp Template upload parameters. + * + * + *

Java class for UploadVAppTemplateParams complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="UploadVAppTemplateParams">
+ *   <complexContent>
+ *     <extension base="{http://www.vmware.com/vcloud/v1.5}ParamsType">
+ *       <attribute name="transferFormat" type="{http://www.w3.org/2001/XMLSchema}string" />
+ *       <attribute name="manifestRequired" type="{http://www.w3.org/2001/XMLSchema}boolean" />
+ *       <anyAttribute processContents='lax' namespace='##other'/>
+ *     </extension>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "UploadVAppTemplateParams") +public class UploadVAppTemplateParams + extends ParamsType + +{ + @SuppressWarnings("unchecked") + public static Builder builder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder().fromUploadVAppTemplateParams(this); + } + + public static class Builder extends ParamsType.Builder { + + private String transferFormat; + private Boolean manifestRequired; + + /** + * @see UploadVAppTemplateParams#getTransferFormat() + */ + public Builder transferFormat(String transferFormat) { + this.transferFormat = transferFormat; + return this; + } + + /** + * @see UploadVAppTemplateParams#getManifestRequired() + */ + public Builder manifestRequired(Boolean manifestRequired) { + this.manifestRequired = manifestRequired; + return this; + } + + + public UploadVAppTemplateParams build() { + UploadVAppTemplateParams uploadVAppTemplateParams = new UploadVAppTemplateParams(); + uploadVAppTemplateParams.setTransferFormat(transferFormat); + uploadVAppTemplateParams.setManifestRequired(manifestRequired); + return uploadVAppTemplateParams; + } + + + @Override + public Builder fromParamsType(ParamsType in) { + return Builder.class.cast(super.fromParamsType(in)); + } + public Builder fromUploadVAppTemplateParams(UploadVAppTemplateParams in) { + return fromParamsType(in) + .transferFormat(in.getTransferFormat()) + .manifestRequired(in.isManifestRequired()); + } + } + + private UploadVAppTemplateParams() { + // For JAXB and builder use + } + + + + @XmlAttribute + protected String transferFormat; + @XmlAttribute + protected Boolean manifestRequired; + + /** + * Gets the value of the transferFormat property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getTransferFormat() { + return transferFormat; + } + + /** + * Sets the value of the transferFormat property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setTransferFormat(String value) { + this.transferFormat = value; + } + + /** + * Gets the value of the manifestRequired property. + * + * @return + * possible object is + * {@link Boolean } + * + */ + public Boolean isManifestRequired() { + return manifestRequired; + } + + /** + * Sets the value of the manifestRequired property. + * + * @param value + * allowed object is + * {@link Boolean } + * + */ + public void setManifestRequired(Boolean value) { + this.manifestRequired = value; + } + + @Override + public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + UploadVAppTemplateParams that = UploadVAppTemplateParams.class.cast(o); + return equal(transferFormat, that.transferFormat) && + equal(manifestRequired, that.manifestRequired); + } + + @Override + public int hashCode() { + return Objects.hashCode(transferFormat, + manifestRequired); + } + + @Override + public String toString() { + return Objects.toStringHelper("") + .add("transferFormat", transferFormat) + .add("manifestRequired", manifestRequired).toString(); + } + +} diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/VApp.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/VApp.java new file mode 100644 index 0000000000..ea90248696 --- /dev/null +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/VApp.java @@ -0,0 +1,5 @@ +package org.jclouds.vcloud.director.v1_5.domain; + +public class VApp { + // Placeholder for merge +} diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/VAppCreationParamsType.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/VAppCreationParamsType.java new file mode 100644 index 0000000000..2488b79dc7 --- /dev/null +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/VAppCreationParamsType.java @@ -0,0 +1,307 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.jclouds.vcloud.director.v1_5.domain; + +import static com.google.common.base.Objects.equal; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlSeeAlso; +import javax.xml.bind.annotation.XmlType; + +import com.google.common.base.Objects; + + +/** + * + * Represents vApp creation parameters. + * + * + *

Java class for VAppCreationParams complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="VAppCreationParams">
+ *   <complexContent>
+ *     <extension base="{http://www.vmware.com/vcloud/v1.5}ParamsType">
+ *       <sequence>
+ *         <element name="VAppParent" type="{http://www.vmware.com/vcloud/v1.5}ReferenceType" minOccurs="0"/>
+ *         <element name="InstantiationParams" type="{http://www.vmware.com/vcloud/v1.5}InstantiationParamsType" minOccurs="0"/>
+ *       </sequence>
+ *       <attribute name="deploy" type="{http://www.w3.org/2001/XMLSchema}boolean" />
+ *       <attribute name="powerOn" type="{http://www.w3.org/2001/XMLSchema}boolean" />
+ *       <anyAttribute processContents='lax' namespace='##other'/>
+ *     </extension>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "VAppCreationParams", propOrder = { + "vAppParent", + "instantiationParams" +}) +@XmlSeeAlso({ +// InstantiateOvfParamsType.class, +// ComposeVAppParamsType.class, +// InstantiateVAppParamsType.class, +// ImportVmAsVAppParamsType.class +}) +public class VAppCreationParamsType> + extends ParamsType + +{ + public static > Builder builder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder().fromVAppCreationParamsType(this); + } + + public static class Builder> extends ParamsType.Builder { + + protected Reference vAppParent; + protected InstantiationParams instantiationParams; + protected Boolean deploy; + protected Boolean powerOn; + + /** + * @see VAppCreationParamsType#getVAppParent() + */ + public Builder vAppParent(Reference vAppParent) { + this.vAppParent = vAppParent; + return this; + } + + /** + * @see VAppCreationParamsType#getInstantiationParams() + */ + public Builder instantiationParams(InstantiationParams instantiationParams) { + this.instantiationParams = instantiationParams; + return this; + } + + /** + * @see VAppCreationParamsType#getDeploy() + */ + public Builder deploy(Boolean deploy) { + this.deploy = deploy; + return this; + } + + /** + * @see VAppCreationParamsType#getPowerOn() + */ + public Builder powerOn(Boolean powerOn) { + this.powerOn = powerOn; + return this; + } + + + public VAppCreationParamsType build() { + VAppCreationParamsType vAppCreationParams = new VAppCreationParamsType(); + vAppCreationParams.setVAppParent(vAppParent); + vAppCreationParams.setInstantiationParams(instantiationParams); + vAppCreationParams.setDeploy(deploy); + vAppCreationParams.setPowerOn(powerOn); + vAppCreationParams.setDescription(description); + vAppCreationParams.setName(name); + return vAppCreationParams; + } + + /** + * @see ParamsType#getDescription() + */ + public Builder description(String description) { + super.description(description); + return this; + } + + /** + * @see ParamsType#getName() + */ + public Builder name(String name) { + super.name(name); + return this; + } + + /** + * {@inheritDoc} + */ + @SuppressWarnings("unchecked") + @Override + public Builder fromParamsType(ParamsType in) { + return Builder.class.cast(super.fromParamsType(in)); + } + public Builder fromVAppCreationParamsType(VAppCreationParamsType in) { + return fromParamsType(in) + .vAppParent(in.getVAppParent()) + .instantiationParams(in.getInstantiationParams()) + .deploy(in.isDeploy()) + .powerOn(in.isPowerOn()); + } + } + + protected VAppCreationParamsType() { + // For JAXB and builder use + } + + @XmlElement(name = "VAppParent") + protected Reference vAppParent; + @XmlElement(name = "InstantiationParams") + protected InstantiationParams instantiationParams; + @XmlAttribute + protected Boolean deploy; + @XmlAttribute + protected Boolean powerOn; + + /** + * Gets the value of the vAppParent property. + * + * @return + * possible object is + * {@link Reference } + * + */ + public Reference getVAppParent() { + return vAppParent; + } + + /** + * Sets the value of the vAppParent property. + * + * @param value + * allowed object is + * {@link Reference } + * + */ + public void setVAppParent(Reference value) { + this.vAppParent = value; + } + + /** + * Gets the value of the instantiationParams property. + * + * @return + * possible object is + * {@link InstantiationParams } + * + */ + public InstantiationParams getInstantiationParams() { + return instantiationParams; + } + + /** + * Sets the value of the instantiationParams property. + * + * @param value + * allowed object is + * {@link InstantiationParams } + * + */ + public void setInstantiationParams(InstantiationParams value) { + this.instantiationParams = value; + } + + /** + * Gets the value of the deploy property. + * + * @return + * possible object is + * {@link Boolean } + * + */ + public Boolean isDeploy() { + return deploy; + } + + /** + * Sets the value of the deploy property. + * + * @param value + * allowed object is + * {@link Boolean } + * + */ + public void setDeploy(Boolean value) { + this.deploy = value; + } + + /** + * Gets the value of the powerOn property. + * + * @return + * possible object is + * {@link Boolean } + * + */ + public Boolean isPowerOn() { + return powerOn; + } + + /** + * Sets the value of the powerOn property. + * + * @param value + * allowed object is + * {@link Boolean } + * + */ + public void setPowerOn(Boolean value) { + this.powerOn = value; + } + + @Override + public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + VAppCreationParamsType that = VAppCreationParamsType.class.cast(o); + return equal(vAppParent, that.vAppParent) && + equal(instantiationParams, that.instantiationParams) && + equal(deploy, that.deploy) && + equal(powerOn, that.powerOn); + } + + @Override + public int hashCode() { + return Objects.hashCode(vAppParent, + instantiationParams, + deploy, + powerOn); + } + + @Override + public String toString() { + return Objects.toStringHelper("") + .add("vAppParent", vAppParent) + .add("instantiationParams", instantiationParams) + .add("deploy", deploy) + .add("powerOn", powerOn).toString(); + } + +} diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/VAppTemplate.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/VAppTemplate.java new file mode 100644 index 0000000000..249e17c3d0 --- /dev/null +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/VAppTemplate.java @@ -0,0 +1,403 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.jclouds.vcloud.director.v1_5.domain; + +import static com.google.common.base.Objects.equal; + +import java.util.ArrayList; +import java.util.List; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlElementRef; +import javax.xml.bind.annotation.XmlType; + +import org.jclouds.ovf.Section; + +import com.google.common.base.Objects; + + +/** + * + * Represents a vApp template. + * + * + *

Java class for VAppTemplate complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="VAppTemplate">
+ *   <complexContent>
+ *     <extension base="{http://www.vmware.com/vcloud/v1.5}ResourceEntityType">
+ *       <sequence>
+ *         <element name="Owner" type="{http://www.vmware.com/vcloud/v1.5}OwnerType" minOccurs="0"/>
+ *         <element name="Children" type="{http://www.vmware.com/vcloud/v1.5}VAppTemplateChildrenType" minOccurs="0"/>
+ *         <element ref="{http://schemas.dmtf.org/ovf/envelope/1}Section" maxOccurs="unbounded" minOccurs="0"/>
+ *         <element name="VAppScopedLocalId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *       <attribute name="ovfDescriptorUploaded" type="{http://www.w3.org/2001/XMLSchema}boolean" />
+ *       <attribute name="goldMaster" type="{http://www.w3.org/2001/XMLSchema}boolean" default="false" />
+ *       <anyAttribute processContents='lax' namespace='##other'/>
+ *     </extension>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "VAppTemplate", propOrder = { + "owner", + "children", + "section", + "vAppScopedLocalId" +}) +public class VAppTemplate + extends ResourceEntityType + +{ + @SuppressWarnings("unchecked") + public static Builder builder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder().fromVAppTemplate(this); + } + + public static class Builder extends ResourceEntityType.Builder { + + private Owner owner; + private VAppTemplateChildren children; + private List>> sections; + private String vAppScopedLocalId; + private Boolean ovfDescriptorUploaded; + private Boolean goldMaster; + + /** + * @see VAppTemplate#getOwner() + */ + public Builder owner(Owner owner) { + this.owner = owner; + return this; + } + + /** + * @see VAppTemplate#getChildren() + */ + public Builder children(VAppTemplateChildren children) { + this.children = children; + return this; + } + + /** + * @see VAppTemplate#getExtend() + */ + public Builder extend(List>> sections) { + this.sections = sections; + return this; + } + + /** + * @see VAppTemplate#getVAppScopedLocalId() + */ + public Builder vAppScopedLocalId(String vAppScopedLocalId) { + this.vAppScopedLocalId = vAppScopedLocalId; + return this; + } + + /** + * @see VAppTemplate#getOvfDescriptorUploaded() + */ + public Builder ovfDescriptorUploaded(Boolean ovfDescriptorUploaded) { + this.ovfDescriptorUploaded = ovfDescriptorUploaded; + return this; + } + + /** + * @see VAppTemplate#getGoldMaster() + */ + public Builder goldMaster(Boolean goldMaster) { + this.goldMaster = goldMaster; + return this; + } + + + public VAppTemplate build() { + VAppTemplate vAppTemplate = new VAppTemplate(sections); + vAppTemplate.setOwner(owner); + vAppTemplate.setChildren(children); + vAppTemplate.setVAppScopedLocalId(vAppScopedLocalId); + vAppTemplate.setOvfDescriptorUploaded(ovfDescriptorUploaded); + vAppTemplate.setGoldMaster(goldMaster); + return vAppTemplate; + } + + + @Override + public Builder fromResourceEntityType(ResourceEntityType in) { + return Builder.class.cast(super.fromResourceEntityType(in)); + } + public Builder fromVAppTemplate(VAppTemplate in) { + return fromResourceEntityType(in) + .owner(in.getOwner()) + .children(in.getChildren()) + .extend(in.getSections()) + .vAppScopedLocalId(in.getVAppScopedLocalId()) + .ovfDescriptorUploaded(in.isOvfDescriptorUploaded()) + .goldMaster(in.isGoldMaster()); + } + } + + private VAppTemplate() { + // For JAXB and builder use + } + + private VAppTemplate(List>> sections) { + this.sections = sections; + } + + + @XmlElement(name = "Owner") + protected Owner owner; + @XmlElement(name = "Children") + protected VAppTemplateChildren children; + @XmlElementRef(name = "Section", namespace = "http://schemas.dmtf.org/ovf/envelope/1", type = JAXBElement.class) + protected List>> sections; + @XmlElement(name = "VAppScopedLocalId") + protected String vAppScopedLocalId; + @XmlAttribute + protected Boolean ovfDescriptorUploaded; + @XmlAttribute + protected Boolean goldMaster; + + /** + * Gets the value of the owner property. + * + * @return + * possible object is + * {@link Owner } + * + */ + public Owner getOwner() { + return owner; + } + + /** + * Sets the value of the owner property. + * + * @param value + * allowed object is + * {@link Owner } + * + */ + public void setOwner(Owner value) { + this.owner = value; + } + + /** + * Gets the value of the children property. + * + * @return + * possible object is + * {@link VAppTemplateChildren } + * + */ + public VAppTemplateChildren getChildren() { + return children; + } + + /** + * Sets the value of the children property. + * + * @param value + * allowed object is + * {@link VAppTemplateChildren } + * + */ + public void setChildren(VAppTemplateChildren value) { + this.children = value; + } + + /** + * + * Contains ovf sections for vApp template. + * Gets the value of the section property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the section property. + * + *

+ * For example, to add a new item, do as follows: + *

+     *    getSection().add(newItem);
+     * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link JAXBElement }{@code <}{@link SectionType }{@code >} + * {@link JAXBElement }{@code <}{@link VirtualHardwareSectionType }{@code >} + * {@link JAXBElement }{@code <}{@link LeaseSettingsSectionType }{@code >} + * {@link JAXBElement }{@code <}{@link EulaSectionType }{@code >} + * {@link JAXBElement }{@code <}{@link RuntimeInfoSectionType }{@code >} + * {@link JAXBElement }{@code <}{@link AnnotationSectionType }{@code >} + * {@link JAXBElement }{@code <}{@link DeploymentOptionSectionType }{@code >} + * {@link JAXBElement }{@code <}{@link StartupSectionType }{@code >} + * {@link JAXBElement }{@code <}{@link ResourceAllocationSectionType }{@code >} + * {@link JAXBElement }{@code <}{@link NetworkConnectionSectionType }{@code >} + * {@link JAXBElement }{@code <}{@link CustomizationSectionType }{@code >} + * {@link JAXBElement }{@code <}{@link ProductSectionType }{@code >} + * {@link JAXBElement }{@code <}{@link GuestCustomizationSectionType }{@code >} + * {@link JAXBElement }{@code <}{@link OperatingSystemSectionType }{@code >} + * {@link JAXBElement }{@code <}{@link NetworkConfigSectionType }{@code >} + * {@link JAXBElement }{@code <}{@link NetworkSectionType }{@code >} + * {@link JAXBElement }{@code <}{@link DiskSectionType }{@code >} + * {@link JAXBElement }{@code <}{@link InstallSectionType }{@code >} + * + * + */ + public List>> getSections() { + if (sections == null) { + sections = new ArrayList>>(); + } + return this.sections; + } + + /** + * Gets the value of the vAppScopedLocalId property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getVAppScopedLocalId() { + return vAppScopedLocalId; + } + + /** + * Sets the value of the vAppScopedLocalId property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setVAppScopedLocalId(String value) { + this.vAppScopedLocalId = value; + } + + /** + * Gets the value of the ovfDescriptorUploaded property. + * + * @return + * possible object is + * {@link Boolean } + * + */ + public Boolean isOvfDescriptorUploaded() { + return ovfDescriptorUploaded; + } + + /** + * Sets the value of the ovfDescriptorUploaded property. + * + * @param value + * allowed object is + * {@link Boolean } + * + */ + public void setOvfDescriptorUploaded(Boolean value) { + this.ovfDescriptorUploaded = value; + } + + /** + * Gets the value of the goldMaster property. + * + * @return + * possible object is + * {@link Boolean } + * + */ + public boolean isGoldMaster() { + if (goldMaster == null) { + return false; + } else { + return goldMaster; + } + } + + /** + * Sets the value of the goldMaster property. + * + * @param value + * allowed object is + * {@link Boolean } + * + */ + public void setGoldMaster(Boolean value) { + this.goldMaster = value; + } + + @Override + public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + VAppTemplate that = VAppTemplate.class.cast(o); + return equal(owner, that.owner) && + equal(children, that.children) && + equal(sections, that.sections) && + equal(vAppScopedLocalId, that.vAppScopedLocalId) && + equal(ovfDescriptorUploaded, that.ovfDescriptorUploaded) && + equal(goldMaster, that.goldMaster); + } + + @Override + public int hashCode() { + return Objects.hashCode(owner, + children, + sections, + vAppScopedLocalId, + ovfDescriptorUploaded, + goldMaster); + } + + @Override + public String toString() { + return Objects.toStringHelper("") + .add("owner", owner) + .add("children", children) + .add("sections", sections) + .add("vAppScopedLocalId", vAppScopedLocalId) + .add("ovfDescriptorUploaded", ovfDescriptorUploaded) + .add("goldMaster", goldMaster).toString(); + } + +} diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/VAppTemplateChildren.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/VAppTemplateChildren.java new file mode 100644 index 0000000000..3adf7a0054 --- /dev/null +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/VAppTemplateChildren.java @@ -0,0 +1,158 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.jclouds.vcloud.director.v1_5.domain; + +import static com.google.common.base.Objects.equal; + +import java.util.ArrayList; +import java.util.List; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + +import com.google.common.base.Objects; + + +/** + * + * Represents vApp template children. + * + * + *

Java class for VAppTemplateChildren complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="VAppTemplateChildren">
+ *   <complexContent>
+ *     <extension base="{http://www.vmware.com/vcloud/v1.5}VCloudExtensibleType">
+ *       <sequence>
+ *         <element name="Vm" type="{http://www.vmware.com/vcloud/v1.5}VAppTemplateType" maxOccurs="unbounded" minOccurs="0"/>
+ *       </sequence>
+ *       <anyAttribute processContents='lax' namespace='##other'/>
+ *     </extension>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "VAppTemplateChildren", propOrder = { + "vm" +}) +public class VAppTemplateChildren { + public static Builder builder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder().fromVAppTemplateChildren(this); + } + + public static class Builder { + + private List vm; + + /** + * @see VAppTemplateChildren#getVm() + */ + public Builder vm(List vm) { + this.vm = vm; + return this; + } + + + public VAppTemplateChildren build() { + VAppTemplateChildren vAppTemplateChildren = new VAppTemplateChildren(vm); + return vAppTemplateChildren; + } + + + public Builder fromVAppTemplateChildren(VAppTemplateChildren in) { + return vm(in.getVm()); + } + } + + private VAppTemplateChildren() { + // For JAXB and builder use + } + + private VAppTemplateChildren(List vm) { + this.vm = vm; + } + + + @XmlElement(name = "Vm") + protected List vm; + + /** + * Gets the value of the vm property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the vm property. + * + *

+ * For example, to add a new item, do as follows: + *

+     *    getVm().add(newItem);
+     * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link VAppTemplateType } + * + * + */ + public List getVm() { + if (vm == null) { + vm = new ArrayList(); + } + return this.vm; + } + + @Override + public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + VAppTemplateChildren that = VAppTemplateChildren.class.cast(o); + return equal(vm, that.vm); + } + + @Override + public int hashCode() { + return Objects.hashCode(vm); + } + + @Override + public String toString() { + return Objects.toStringHelper("") + .add("vm", vm).toString(); + } + +} diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Vdc.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Vdc.java new file mode 100644 index 0000000000..23cad56744 --- /dev/null +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Vdc.java @@ -0,0 +1,641 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.jclouds.vcloud.director.v1_5.domain; + +import static com.google.common.base.Objects.equal; +import static com.google.common.base.Preconditions.checkNotNull; + +import java.net.URI; +import java.util.Set; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlSeeAlso; +import javax.xml.bind.annotation.XmlType; + +import com.google.common.base.Objects; +import com.google.common.collect.Sets; + + +/** + * + * Represents a virtual data center (vDC). + * + * + *

Java class for Vdc complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="Vdc">
+ *   <complexContent>
+ *     <extension base="{http://www.vmware.com/vcloud/v1.5}EntityType">
+ *       <sequence>
+ *         <element name="AllocationModel" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         <element name="StorageCapacity" type="{http://www.vmware.com/vcloud/v1.5}CapacityWithUsageType"/>
+ *         <element name="ComputeCapacity" type="{http://www.vmware.com/vcloud/v1.5}ComputeCapacityType"/>
+ *         <element name="ResourceEntities" type="{http://www.vmware.com/vcloud/v1.5}ResourceEntitiesType" minOccurs="0"/>
+ *         <element name="AvailableNetworks" type="{http://www.vmware.com/vcloud/v1.5}AvailableNetworksType" minOccurs="0"/>
+ *         <element name="Capabilities" type="{http://www.vmware.com/vcloud/v1.5}CapabilitiesType" minOccurs="0"/>
+ *         <element name="NicQuota" type="{http://www.w3.org/2001/XMLSchema}int"/>
+ *         <element name="NetworkQuota" type="{http://www.w3.org/2001/XMLSchema}int"/>
+ *         <element name="VmQuota" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ *         <element name="IsEnabled" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
+ *       </sequence>
+ *       <attribute name="status" type="{http://www.w3.org/2001/XMLSchema}int" />
+ *       <anyAttribute processContents='lax' namespace='##other'/>
+ *     </extension>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlRootElement(name = "Vdc") +@XmlType(propOrder = { + "allocationModel", + "storageCapacity", + "computeCapacity", + "resourceEntities", + "availableNetworks", + "capabilities", + "nicQuota", + "networkQuota", + "vmQuota", + "isEnabled" +}) +@XmlSeeAlso({ +// AdminVdc.class +}) +public class Vdc + extends EntityType + +{ + @SuppressWarnings("unchecked") + public static Builder builder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder().fromVdc(this); + } + + public static class Builder extends EntityType.Builder { + + private String allocationModel; + private CapacityWithUsage storageCapacity; + private ComputeCapacity computeCapacity; + private ResourceEntities resourceEntities; + private AvailableNetworks availableNetworks; + private Capabilities capabilities; + private int nicQuota; + private int networkQuota; + private Integer vmQuota; + private Boolean isEnabled; + private Integer status; + + /** + * @see Vdc#getAllocationModel() + */ + public Builder allocationModel(String allocationModel) { + this.allocationModel = allocationModel; + return this; + } + + /** + * @see Vdc#getStorageCapacity() + */ + public Builder storageCapacity(CapacityWithUsage storageCapacity) { + this.storageCapacity = storageCapacity; + return this; + } + + /** + * @see Vdc#getComputeCapacity() + */ + public Builder computeCapacity(ComputeCapacity computeCapacity) { + this.computeCapacity = computeCapacity; + return this; + } + + /** + * @see Vdc#getResourceEntities() + */ + public Builder resourceEntities(ResourceEntities resourceEntities) { + this.resourceEntities = resourceEntities; + return this; + } + + /** + * @see Vdc#getAvailableNetworks() + */ + public Builder availableNetworks(AvailableNetworks availableNetworks) { + this.availableNetworks = availableNetworks; + return this; + } + + /** + * @see Vdc#getCapabilities() + */ + public Builder capabilities(Capabilities capabilities) { + this.capabilities = capabilities; + return this; + } + + /** + * @see Vdc#getNicQuota() + */ + public Builder nicQuota(int nicQuota) { + this.nicQuota = nicQuota; + return this; + } + + /** + * @see Vdc#getNetworkQuota() + */ + public Builder networkQuota(int networkQuota) { + this.networkQuota = networkQuota; + return this; + } + + /** + * @see Vdc#getVmQuota() + */ + public Builder vmQuota(Integer vmQuota) { + this.vmQuota = vmQuota; + return this; + } + + /** + * @see Vdc#isEnabled() + */ + public Builder isEnabled(Boolean isEnabled) { + this.isEnabled = isEnabled; + return this; + } + + /** + * @see Vdc#getStatus() + */ + public Builder status(Integer status) { + this.status = status; + return this; + } + + + public Vdc build() { + Vdc vdc = new Vdc(); + vdc.setAllocationModel(allocationModel); + vdc.setStorageCapacity(storageCapacity); + vdc.setComputeCapacity(computeCapacity); + vdc.setResourceEntities(resourceEntities); + vdc.setAvailableNetworks(availableNetworks); + vdc.setCapabilities(capabilities); + vdc.setNicQuota(nicQuota); + vdc.setNetworkQuota(networkQuota); + vdc.setVmQuota(vmQuota); + vdc.setIsEnabled(isEnabled); + vdc.setStatus(status); + return vdc; + } + + /** + * @see EntityType#getName() + */ + public Builder name(String name) { + super.name(name); + return this; + } + + /** + * @see EntityType#getDescription() + */ + public Builder description(String description) { + super.description(description); + return this; + } + + /** + * @see EntityType#getId() + */ + @Override + public Builder id(String id) { + this.id = id; + return this; + } + + /** + * @see EntityType#getTasksInProgress() + */ + @Override + public Builder tasksInProgress(TasksInProgress tasksInProgress) { + this.tasksInProgress = tasksInProgress; + return this; + } + + /** + * @see ReferenceType#getHref() + */ + @Override + public Builder href(URI href) { + this.href = href; + return this; + } + + /** + * @see ReferenceType#getType() + */ + @Override + public Builder type(String type) { + this.type = type; + return this; + } + + /** + * @see ReferenceType#getLinks() + */ + @Override + public Builder links(Set links) { + this.links = Sets.newLinkedHashSet(checkNotNull(links, "links")); + return this; + } + + /** + * @see ReferenceType#getLinks() + */ + @Override + public Builder link(Link link) { + this.links.add(checkNotNull(link, "link")); + return this; + } + + + @Override + public Builder fromEntityType(EntityType in) { + return Builder.class.cast(super.fromEntityType(in)); + } + public Builder fromVdc(Vdc in) { + return fromEntityType(in) + .allocationModel(in.getAllocationModel()) + .storageCapacity(in.getStorageCapacity()) + .computeCapacity(in.getComputeCapacity()) + .resourceEntities(in.getResourceEntities()) + .availableNetworks(in.getAvailableNetworks()) + .capabilities(in.getCapabilities()) + .nicQuota(in.getNicQuota()) + .networkQuota(in.getNetworkQuota()) + .vmQuota(in.getVmQuota()) + .isEnabled(in.isEnabled()) + .status(in.getStatus()); + } + } + + private Vdc() { + // For JAXB and builder use + } + + + @XmlElement(name = "AllocationModel", required = true) + protected String allocationModel; + @XmlElement(name = "StorageCapacity", required = true) + protected CapacityWithUsage storageCapacity; + @XmlElement(name = "ComputeCapacity", required = true) + protected ComputeCapacity computeCapacity; + @XmlElement(name = "ResourceEntities") + protected ResourceEntities resourceEntities; + @XmlElement(name = "AvailableNetworks") + protected AvailableNetworks availableNetworks; + @XmlElement(name = "Capabilities") + protected Capabilities capabilities; + @XmlElement(name = "NicQuota") + protected int nicQuota; + @XmlElement(name = "NetworkQuota") + protected int networkQuota; + @XmlElement(name = "VmQuota") + protected Integer vmQuota; + @XmlElement(name = "IsEnabled") + protected Boolean isEnabled; + @XmlAttribute + protected Integer status; + + /** + * Gets the value of the allocationModel property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getAllocationModel() { + return allocationModel; + } + + /** + * Sets the value of the allocationModel property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setAllocationModel(String value) { + this.allocationModel = value; + } + + /** + * Gets the value of the storageCapacity property. + * + * @return + * possible object is + * {@link CapacityWithUsage } + * + */ + public CapacityWithUsage getStorageCapacity() { + return storageCapacity; + } + + /** + * Sets the value of the storageCapacity property. + * + * @param value + * allowed object is + * {@link CapacityWithUsage } + * + */ + public void setStorageCapacity(CapacityWithUsage value) { + this.storageCapacity = value; + } + + /** + * Gets the value of the computeCapacity property. + * + * @return + * possible object is + * {@link ComputeCapacity } + * + */ + public ComputeCapacity getComputeCapacity() { + return computeCapacity; + } + + /** + * Sets the value of the computeCapacity property. + * + * @param value + * allowed object is + * {@link ComputeCapacity } + * + */ + public void setComputeCapacity(ComputeCapacity value) { + this.computeCapacity = value; + } + + /** + * Gets the value of the resourceEntities property. + * + * @return + * possible object is + * {@link ResourceEntities } + * + */ + public ResourceEntities getResourceEntities() { + return resourceEntities; + } + + /** + * Sets the value of the resourceEntities property. + * + * @param value + * allowed object is + * {@link ResourceEntities } + * + */ + public void setResourceEntities(ResourceEntities value) { + this.resourceEntities = value; + } + + /** + * Gets the value of the availableNetworks property. + * + * @return + * possible object is + * {@link AvailableNetworks } + * + */ + public AvailableNetworks getAvailableNetworks() { + return availableNetworks; + } + + /** + * Sets the value of the availableNetworks property. + * + * @param value + * allowed object is + * {@link AvailableNetworks } + * + */ + public void setAvailableNetworks(AvailableNetworks value) { + this.availableNetworks = value; + } + + /** + * Gets the value of the capabilities property. + * + * @return + * possible object is + * {@link Capabilities } + * + */ + public Capabilities getCapabilities() { + return capabilities; + } + + /** + * Sets the value of the capabilities property. + * + * @param value + * allowed object is + * {@link Capabilities } + * + */ + public void setCapabilities(Capabilities value) { + this.capabilities = value; + } + + /** + * Gets the value of the nicQuota property. + * + */ + public int getNicQuota() { + return nicQuota; + } + + /** + * Sets the value of the nicQuota property. + * + */ + public void setNicQuota(int value) { + this.nicQuota = value; + } + + /** + * Gets the value of the networkQuota property. + * + */ + public int getNetworkQuota() { + return networkQuota; + } + + /** + * Sets the value of the networkQuota property. + * + */ + public void setNetworkQuota(int value) { + this.networkQuota = value; + } + + /** + * Gets the value of the vmQuota property. + * + * @return + * possible object is + * {@link Integer } + * + */ + public Integer getVmQuota() { + return vmQuota; + } + + /** + * Sets the value of the vmQuota property. + * + * @param value + * allowed object is + * {@link Integer } + * + */ + public void setVmQuota(Integer value) { + this.vmQuota = value; + } + + /** + * Gets the value of the isEnabled property. + * + * @return + * possible object is + * {@link Boolean } + * + */ + public Boolean isEnabled() { + return isEnabled; + } + + /** + * Sets the value of the isEnabled property. + * + * @param value + * allowed object is + * {@link Boolean } + * + */ + public void setIsEnabled(Boolean value) { + this.isEnabled = value; + } + + /** + * Gets the value of the status property. + * + * @return + * possible object is + * {@link Integer } + * + */ + public Integer getStatus() { + return status; + } + + /** + * Sets the value of the status property. + * + * @param value + * allowed object is + * {@link Integer } + * + */ + public void setStatus(Integer value) { + this.status = value; + } + + @Override + public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + Vdc that = Vdc.class.cast(o); + return equal(allocationModel, that.allocationModel) && + equal(storageCapacity, that.storageCapacity) && + equal(computeCapacity, that.computeCapacity) && + equal(resourceEntities, that.resourceEntities) && + equal(availableNetworks, that.availableNetworks) && + equal(capabilities, that.capabilities) && + equal(nicQuota, that.nicQuota) && + equal(networkQuota, that.networkQuota) && + equal(vmQuota, that.vmQuota) && + equal(isEnabled, that.isEnabled) && + equal(status, that.status); + } + + @Override + public int hashCode() { + return Objects.hashCode(allocationModel, + storageCapacity, + computeCapacity, + resourceEntities, + availableNetworks, + capabilities, + nicQuota, + networkQuota, + vmQuota, + isEnabled, + status); + } + + @Override + public String toString() { + return Objects.toStringHelper("") + .add("allocationModel", allocationModel) + .add("storageCapacity", storageCapacity) + .add("computeCapacity", computeCapacity) + .add("resourceEntities", resourceEntities) + .add("availableNetworks", availableNetworks) + .add("capabilities", capabilities) + .add("nicQuota", nicQuota) + .add("networkQuota", networkQuota) + .add("vmQuota", vmQuota) + .add("isEnabled", isEnabled) + .add("status", status).toString(); + } + +} diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VdcAsyncClient.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VdcAsyncClient.java new file mode 100644 index 0000000000..4fe5cda2ae --- /dev/null +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VdcAsyncClient.java @@ -0,0 +1,189 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.jclouds.vcloud.director.v1_5.features; + +import javax.ws.rs.Consumes; +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; + +import org.jclouds.rest.annotations.BinderParam; +import org.jclouds.rest.annotations.EndpointParam; +import org.jclouds.rest.annotations.ExceptionParser; +import org.jclouds.rest.annotations.JAXBResponseParser; +import org.jclouds.rest.annotations.RequestFilters; +import org.jclouds.rest.binders.BindToXMLPayload; +import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType; +import org.jclouds.vcloud.director.v1_5.domain.CaptureVAppParams; +import org.jclouds.vcloud.director.v1_5.domain.CloneMediaParams; +import org.jclouds.vcloud.director.v1_5.domain.CloneVAppParams; +import org.jclouds.vcloud.director.v1_5.domain.CloneVAppTemplateParams; +import org.jclouds.vcloud.director.v1_5.domain.ComposeVAppParams; +import org.jclouds.vcloud.director.v1_5.domain.InstantiateVAppParamsType; +import org.jclouds.vcloud.director.v1_5.domain.Media; +import org.jclouds.vcloud.director.v1_5.domain.Metadata; +import org.jclouds.vcloud.director.v1_5.domain.MetadataValue; +import org.jclouds.vcloud.director.v1_5.domain.Reference; +import org.jclouds.vcloud.director.v1_5.domain.UploadVAppTemplateParams; +import org.jclouds.vcloud.director.v1_5.domain.VApp; +import org.jclouds.vcloud.director.v1_5.domain.VAppTemplate; +import org.jclouds.vcloud.director.v1_5.domain.Vdc; +import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationToRequest; +import org.jclouds.vcloud.director.v1_5.functions.ReferenceToEndpoint; +import org.jclouds.vcloud.director.v1_5.functions.ThrowVCloudErrorOn4xx; + +import com.google.common.util.concurrent.ListenableFuture; + +/** + + * @see VdcClient + * @author danikov + */ +@RequestFilters(AddVCloudAuthorizationToRequest.class) +public interface VdcAsyncClient { + + /** + * @see VdcClient#getVdc(Reference) + */ + @GET + @Consumes + @JAXBResponseParser + @ExceptionParser(ThrowVCloudErrorOn4xx.class) + ListenableFuture getVdc(@EndpointParam(parser = ReferenceToEndpoint.class) Reference vdcRef); + + /** + * @see VdcClient#captureVApp(Reference, CaptureVAppParams) + */ + @POST + @Path("/action/captureVApp") + @Consumes(VCloudDirectorMediaType.V_APP_TEMPLATE) + @Produces(VCloudDirectorMediaType.CAPTURE_VAPP_PARAMS) + @JAXBResponseParser + @ExceptionParser(ThrowVCloudErrorOn4xx.class) + ListenableFuture captureVApp(@EndpointParam(parser = ReferenceToEndpoint.class) Reference vdcRef, + @BinderParam(BindToXMLPayload.class) CaptureVAppParams params); + + /** + * @see VdcClient#cloneMedia(Reference, CloneMediaParams) + */ + @POST + @Path("/action/cloneMedia") + @Consumes(VCloudDirectorMediaType.MEDIA) + @Produces(VCloudDirectorMediaType.CAPTURE_VAPP_PARAMS) + @JAXBResponseParser + @ExceptionParser(ThrowVCloudErrorOn4xx.class) + ListenableFuture cloneMedia(@EndpointParam(parser = ReferenceToEndpoint.class) Reference vdcRef, + @BinderParam(BindToXMLPayload.class) CloneMediaParams params); + + /** + * @see VdcClient#cloneVApp(Reference, CloneVAppParams) + */ + @POST + @Path("/action/cloneVApp") + @Consumes(VCloudDirectorMediaType.V_APP) + @Produces(VCloudDirectorMediaType.CAPTURE_VAPP_PARAMS) + @JAXBResponseParser + @ExceptionParser(ThrowVCloudErrorOn4xx.class) + ListenableFuture cloneVApp(@EndpointParam(parser = ReferenceToEndpoint.class) Reference vdcRef, + @BinderParam(BindToXMLPayload.class) CloneVAppParams params); + + /** + * @see VdcClient#cloneVAppTemplate(Reference, CloneVAppTemplateParams) + */ + @POST + @Path("/action/cloneVAppTemplate") + @Consumes(VCloudDirectorMediaType.V_APP_TEMPLATE) + @Produces(VCloudDirectorMediaType.CAPTURE_VAPP_PARAMS) + @JAXBResponseParser + @ExceptionParser(ThrowVCloudErrorOn4xx.class) + ListenableFuture cloneVAppTemplate(@EndpointParam(parser = ReferenceToEndpoint.class) Reference vdcRef, + @BinderParam(BindToXMLPayload.class) CloneVAppTemplateParams params); + + /** + * @see VdcClient#composeVApp(Reference, ComposeVAppParams) + */ + @POST + @Path("/action/composeVApp") + @Consumes(VCloudDirectorMediaType.V_APP) + @Produces(VCloudDirectorMediaType.CAPTURE_VAPP_PARAMS) + @JAXBResponseParser + @ExceptionParser(ThrowVCloudErrorOn4xx.class) + ListenableFuture composeVApp(@EndpointParam(parser = ReferenceToEndpoint.class) Reference vdcRef, + @BinderParam(BindToXMLPayload.class) ComposeVAppParams params); + + /** + * @see VdcClient#instantiateVApp(Reference, InstantiateVAppParamsType) + */ + @POST + @Path("/action/instantiateVApp") + @Consumes(VCloudDirectorMediaType.V_APP) + @Produces(VCloudDirectorMediaType.CAPTURE_VAPP_PARAMS) + @JAXBResponseParser + @ExceptionParser(ThrowVCloudErrorOn4xx.class) + ListenableFuture instantiateVApp(@EndpointParam(parser = ReferenceToEndpoint.class) Reference vdcRef, + @BinderParam(BindToXMLPayload.class) InstantiateVAppParamsType params); + + /** + * @see VdcClient#uploadVAppTemplate(Reference, UploadVAppTemplateParams) + */ + @POST + @Path("/action/uploadVAppTemplate") + @Consumes(VCloudDirectorMediaType.V_APP_TEMPLATE) + @Produces(VCloudDirectorMediaType.CAPTURE_VAPP_PARAMS) + @JAXBResponseParser + @ExceptionParser(ThrowVCloudErrorOn4xx.class) + ListenableFuture uploadVAppTemplate(@EndpointParam(parser = ReferenceToEndpoint.class) Reference vdcRef, + @BinderParam(BindToXMLPayload.class) UploadVAppTemplateParams params); + + /** + * @see VdcClient#createMedia(Reference, Media) + */ + @POST + @Path("/media") + @Consumes(VCloudDirectorMediaType.MEDIA) + @Produces(VCloudDirectorMediaType.CAPTURE_VAPP_PARAMS) + @JAXBResponseParser + @ExceptionParser(ThrowVCloudErrorOn4xx.class) + ListenableFuture createMedia(@EndpointParam(parser = ReferenceToEndpoint.class) Reference vdcRef, + @BinderParam(BindToXMLPayload.class) Media media); + + /** + * @see VdcClient#getMetadata(Reference) + */ + @GET + @Path("/metadata") + @Consumes + @JAXBResponseParser + @ExceptionParser(ThrowVCloudErrorOn4xx.class) + ListenableFuture getMetadata(@EndpointParam(parser = ReferenceToEndpoint.class) Reference vdcRef); + + /** + * @see VdcClient#getMetadataEntry(Reference, String) + */ + @GET + @Path("/metadata/{key}") + @Consumes + @JAXBResponseParser + @ExceptionParser(ThrowVCloudErrorOn4xx.class) + ListenableFuture getMetadataValue(@EndpointParam(parser = ReferenceToEndpoint.class) Reference vdcRef , + @PathParam("key") String key); + +} \ No newline at end of file diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VdcClient.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VdcClient.java new file mode 100644 index 0000000000..0b72a139c4 --- /dev/null +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VdcClient.java @@ -0,0 +1,160 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.jclouds.vcloud.director.v1_5.features; + +import java.util.concurrent.TimeUnit; + +import org.jclouds.concurrent.Timeout; +import org.jclouds.vcloud.director.v1_5.domain.CaptureVAppParams; +import org.jclouds.vcloud.director.v1_5.domain.CloneMediaParams; +import org.jclouds.vcloud.director.v1_5.domain.CloneVAppParams; +import org.jclouds.vcloud.director.v1_5.domain.CloneVAppTemplateParams; +import org.jclouds.vcloud.director.v1_5.domain.ComposeVAppParams; +import org.jclouds.vcloud.director.v1_5.domain.InstantiateVAppParamsType; +import org.jclouds.vcloud.director.v1_5.domain.Media; +import org.jclouds.vcloud.director.v1_5.domain.Metadata; +import org.jclouds.vcloud.director.v1_5.domain.MetadataValue; +import org.jclouds.vcloud.director.v1_5.domain.Reference; +import org.jclouds.vcloud.director.v1_5.domain.UploadVAppTemplateParams; +import org.jclouds.vcloud.director.v1_5.domain.VApp; +import org.jclouds.vcloud.director.v1_5.domain.VAppTemplate; +import org.jclouds.vcloud.director.v1_5.domain.Vdc; + +/** + * Provides synchronous access to a vDC. + *

+ * + * @see VdcAsyncClient + * @see + * @author danikov + */ +@Timeout(duration = 180, timeUnit = TimeUnit.SECONDS) +public interface VdcClient { + + /** + * Retrieves a vdc. + * + * @return the vdc or null if not found + */ + Vdc getVdc(Reference vdcRef); + + /** + * Captures a vApp into vApp template. + * The status of vApp template will be in UNRESOLVED(0) until the capture task is finished. + * + * @return a VApp resource which will contain a task. + * The user should should wait for this task to finish to be able to use the vApp. + */ + VAppTemplate captureVApp(Reference vdcRef, CaptureVAppParams params); + + /** + * Clones a media into new one. + * The status of the returned media is UNRESOLVED(0) until the task for cloning finish. + * + * @return a Media resource which will contain a task. + * The user should monitor the contained task status in order to check when it is completed. + */ + Media cloneMedia(Reference vdcRef, CloneMediaParams params); + + /** + * Clones a vApp into new one. The status of vApp will be in UNRESOLVED(0) until the clone task is finished. + * + * @return a VApp resource which will contain a task. + * The user should should wait for this task to finish to be able to use the vApp. + */ + VApp cloneVApp(Reference vdcRef, CloneVAppParams params); + + /** + * Clones a vApp template into new one. + * The status of vApp template will be in UNRESOLVED(0) until the clone task is finished. + * + * @return a VAppTemplate resource which will contain a task. + * The user should should wait for this task to finish to be able to use the VAppTemplate. + */ + VAppTemplate cloneVAppTemplate(Reference vdcRef, CloneVAppTemplateParams params); + + /** + * Composes a new vApp using VMs from other vApps or vApp templates. The vCloud API supports + * composing a vApp from any combination of vApp templates, vApps, or virtual machines. + * When you compose a vApp, all children of each composition source become peers in the + * Children collection of the composed vApp. To compose a vApp, a client makes a compose + * vApp request whose body is a ComposeVAppParams element, includes the following information: + * - An InstantiationParams element that applies to the composed vApp itself and any vApp + * templates referenced in Item elements. - A SourcedItem element for each virtual machine, + * vApp, or vAppTemplate to include in the composition. Each SourcedItem can contain the + * following elements: - A required Source element whose href attribute value is a reference + * to a vApp template, vApp, or VM to include in the composition. If the Source element + * references a VM, the Item must also include an InstantiationParams element specific to + * that VM. - An optional NetworkAssignment element that specifies how the network connections + * of child VM elements are mapped to vApp networks in the parent. - If any of the composition + * items is subject to a EULA, the ComposeVAppParams element must include an AllEULAsAccepted + * element that has a value of true, indicating that you accept the EULA. Otherwise, composition + * fails. The composed vApp must be deployed and powered on before it can be used. The status + * of vApp will be UNRESOLVED(0) until the compose task is finished. + * + * @return a VApp resource which will contain a task. + * The user should should wait for this task to finish to be able to use the vApp. + */ + VApp composeVApp(Reference vdcRef, ComposeVAppParams params); + + /** + * Instantiate a vApp template into a new vApp. + * The status of vApp will be in UNRESOLVED(0) until the instantiate task is finished. + * + * @return a VApp resource which will contain a task. + * The user should should wait for this task to finish to be able to use the vApp. + */ + VApp instantiateVApp(Reference vdcRef, InstantiateVAppParamsType params); + + /** + * Uploading vApp template to a vDC. The operation is separate on several steps: + * 1. creating empty vApp template entity + * 2. uploading an OVF of vApp template + * 3. uploading disks described from the OVF + * 4. finishing task for uploading + * The status of vApp template will be NOT_READY(0) until the ovf and all disks are uploaded + * to the transfer site. After this a task will run on the vApp template uploading. + * + * @return a VAppTemplate resource which will contain a task. + * The user should should wait for this task to finish to be able to use the VAppTemplate. + */ + VAppTemplate uploadVAppTemplate(Reference vdcRef, UploadVAppTemplateParams params); + + /** + * Creates a media (and present upload link for the floppy/iso file). + * + * @return The response will return a link to transfer site to be able to continue with uploading the media. + */ + Media createMedia(Reference vdcRef, Media media); + + /** + * Retrieves an list of the vdc's metadata + * + * @return a list of metadata + */ + Metadata getMetadata(Reference vdcRef); + + /** + * Retrieves a metadata value + * + * @return the metadata value, or null if not found + */ + MetadataValue getMetadataValue(Reference vdcRef, String key); + +} diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/domain/Checks.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/domain/Checks.java index 6308e7addf..fcf5d55f3d 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/domain/Checks.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/domain/Checks.java @@ -20,6 +20,8 @@ package org.jclouds.vcloud.director.v1_5.domain; import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.CONDITION_FMT; import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.MUST_BE_WELL_FORMED_FMT; +import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.OBJ_FIELD_ATTRB_REQ; +import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.OBJ_FIELD_EQ; import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.MUST_CONTAIN_FMT; import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.NOT_NULL_OBJECT_FMT; import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.OBJ_FIELD_GTE_0; @@ -269,19 +271,15 @@ public class Checks { if (config.getIpScope() != null) { checkIpScope(config.getIpScope()); } - if (config.getParentNetwork() != null) { checkReferenceType(config.getParentNetwork()); } - if (config.getNetworkFeatures() != null) { checkNetworkFeatures(config.getNetworkFeatures()); } - if (config.getSyslogServerSettings() != null) { checkSyslogServerSettings(config.getSyslogServerSettings()); } - if (config.getRouterInfo() != null) { checkRouterInfo(config.getRouterInfo()); } @@ -327,7 +325,6 @@ public class Checks { if (settings.getSyslogServerIp1() != null) { checkIpAddress(settings.getSyslogServerIp1()); } - if (settings.getSyslogServerIp2() != null) { checkIpAddress(settings.getSyslogServerIp2()); } @@ -370,6 +367,95 @@ public class Checks { public static void checkIpAddress(String ip) { InetAddresses.isInetAddress(ip); } + + public static void checkComputeCapacity(ComputeCapacity computeCapacity) { + // Check required fields + assertNotNull(computeCapacity.getCpu(), "The cpu attribute of a ComputeCapacity must be set"); + checkCapacityWithUsage(computeCapacity.getCpu()); + + assertNotNull(computeCapacity.getMemory(), "The memory attribute of a ComputeCapacity must be set"); + checkCapacityWithUsage(computeCapacity.getMemory()); + } + + public static void checkCapacityWithUsage(CapacityWithUsage capacityWithUsage) { + // Check optional fields + if (capacityWithUsage.getUsed() != null) { + assertTrue(capacityWithUsage.getUsed() >= 0, "used must be greater than or equal to 0"); + } + if (capacityWithUsage.getOverhead() != null) { + assertTrue(capacityWithUsage.getOverhead() >= 0, "overhead must be greater than or equal to 0"); + } + + // Check parent type + checkCapacityType(capacityWithUsage); + } + + public static void checkCapacityType(CapacityType capacity) { + // Check required fields + assertNotNull(capacity.getUnits(), "The unit attribute of a CapacityWithUsage must be set"); + + assertNotNull(capacity.getLimit(), "The limit attribute of a CapacityWithUsage must be set"); + assertTrue(capacity.getLimit() >= 0, "Limit must be greater than or equal to 0"); + + + // Check optional fields + if (capacity.getAllocated() != null) { + assertTrue(capacity.getAllocated() >= 0, "allocated must be greater than or equal to 0"); + } + } + + public static void checkResourceEntities(ResourceEntities resourceEntities) { + for (Reference resourceEntity : resourceEntities.getResourceEntities()) { + checkReferenceType(resourceEntity); + } + } + + public static void checkAvailableNetworks(AvailableNetworks availableNetworks) { + for (Reference network : availableNetworks.getNetworks()) { + checkReferenceType(network); + } + } + + public static void checkCapabilities(Capabilities capabilities) { + // Check optional fields + if (capabilities.getSupportedHardwareVersions() != null) { + checkSupportedHardwareVersions(capabilities.getSupportedHardwareVersions()); + } + } + public static void checkSupportedHardwareVersions(SupportedHardwareVersions supportedHardwareVersions) { + for (String supportedHardwareVersion : supportedHardwareVersions.getSupportedHardwareVersions()) { + // NOTE supportedHardwareVersion cannot be checked? + } + } + + public static void checkMetadataFor(String client, Metadata metadata) { + for (MetadataEntry entry : metadata.getMetadataEntries()) { + // Check required fields + assertNotNull(entry.getKey(), + String.format(OBJ_FIELD_ATTRB_REQ, client, "MetadataEntry", entry.getKey(), "key")); + assertNotNull(entry.getValue(), + String.format(OBJ_FIELD_ATTRB_REQ, client, "MetadataEntry", entry.getValue(), "value")); + + // Check parent type + checkResourceType(entry); + } + + // Check parent type + checkResourceType(metadata); + } + + public static void checkMetadataValueFor(String client, MetadataValue metadataValue) { + // Check required fields + String value = metadataValue.getValue(); + assertNotNull(value, + String.format(OBJ_FIELD_ATTRB_REQ, client, "MetadataEntry", + metadataValue.toString(), "value")); + assertEquals(value, "value", + String.format(OBJ_FIELD_EQ, client, "metadataEntry.value", "value", value)); + + // Check parent type + checkResourceType(metadataValue); + } public static void checkVApp(VApp vApp) { // TODO Auto-generated method stub diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/NetworkClientLiveTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/NetworkClientLiveTest.java index 790198f5f7..d2ecac0bb3 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/NetworkClientLiveTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/NetworkClientLiveTest.java @@ -65,7 +65,6 @@ public class NetworkClientLiveTest extends BaseVCloudDirectorClientLiveTest { @BeforeClass(inheritGroups = true) @Override public void setupRequiredClients() { - String networkId = "a604f3c2-0343-453e-ae1f-cddac5b7bd94"; // TODO: inject networkRef = Reference.builder() .type("application/vnd.vmware.vcloud.orgNetwork+xml") .name("") diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VdcClientExpectTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VdcClientExpectTest.java new file mode 100644 index 0000000000..7641fe31de --- /dev/null +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VdcClientExpectTest.java @@ -0,0 +1,568 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + *(Link.builder().regarding copyright ownership. jclouds licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless(Link.builder().required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.jclouds.vcloud.director.v1_5.features; + +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.fail; + +import java.net.URI; + +import org.jclouds.vcloud.director.v1_5.VCloudDirectorClient; +import org.jclouds.vcloud.director.v1_5.VCloudDirectorException; +import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType; +import org.jclouds.vcloud.director.v1_5.domain.AvailableNetworks; +import org.jclouds.vcloud.director.v1_5.domain.Capabilities; +import org.jclouds.vcloud.director.v1_5.domain.CapacityWithUsage; +import org.jclouds.vcloud.director.v1_5.domain.CaptureVAppParams; +import org.jclouds.vcloud.director.v1_5.domain.CloneMediaParams; +import org.jclouds.vcloud.director.v1_5.domain.CloneVAppParams; +import org.jclouds.vcloud.director.v1_5.domain.CloneVAppTemplateParams; +import org.jclouds.vcloud.director.v1_5.domain.ComposeVAppParams; +import org.jclouds.vcloud.director.v1_5.domain.ComputeCapacity; +import org.jclouds.vcloud.director.v1_5.domain.Error; +import org.jclouds.vcloud.director.v1_5.domain.InstantiateVAppTemplateParams; +import org.jclouds.vcloud.director.v1_5.domain.Link; +import org.jclouds.vcloud.director.v1_5.domain.Media; +import org.jclouds.vcloud.director.v1_5.domain.Metadata; +import org.jclouds.vcloud.director.v1_5.domain.MetadataValue; +import org.jclouds.vcloud.director.v1_5.domain.Reference; +import org.jclouds.vcloud.director.v1_5.domain.ResourceEntities; +import org.jclouds.vcloud.director.v1_5.domain.SupportedHardwareVersions; +import org.jclouds.vcloud.director.v1_5.domain.UploadVAppTemplateParams; +import org.jclouds.vcloud.director.v1_5.domain.VApp; +import org.jclouds.vcloud.director.v1_5.domain.VAppTemplate; +import org.jclouds.vcloud.director.v1_5.domain.Vdc; +import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorRestClientExpectTest; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; + +/** + * Allows us to test a client via its side effects. + * + * @author danikov + */ +@Test(groups = { "unit", "apitests", "user" }, singleThreaded = true, testName = "VdcClientExpectTest") +public class VdcClientExpectTest extends BaseVCloudDirectorRestClientExpectTest { + + private Reference vdcRef; + + @BeforeClass + public void before() { + String vdcId = "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f"; + vdcRef = Reference.builder() + .type("application/vnd.vmware.vcloud.vdc+xml") + .name("") + .href(URI.create(endpoint+"/vdc/"+vdcId)) + .id(vdcId) + .build(); + } + + @Test + public void testGetVdc() { + VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + new VcloudHttpRequestPrimer() + .apiCommand("GET", "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f") + .acceptAnyMedia() + .httpRequestBuilder().build(), + new VcloudHttpResponsePrimer() + .xmlFilePayload("/vdc/vdc.xml", VCloudDirectorMediaType.VDC) + .httpResponseBuilder().build()); + + Vdc expected = getVdc(); + + assertEquals(client.getVdcClient().getVdc(vdcRef), expected); + } + + @Test + public void testResponse400ForInvalidVdcId() { + VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + new VcloudHttpRequestPrimer() + .apiCommand("GET", "/vdc/NOTAUUID") + .acceptAnyMedia() + .httpRequestBuilder().build(), + new VcloudHttpResponsePrimer() + .xmlFilePayload("/vdc/error400.xml", VCloudDirectorMediaType.ERROR) + .httpResponseBuilder().statusCode(400).build()); + + Error expected = Error.builder() + .message("validation error : EntityRef has incorrect type, expected type is com.vmware.vcloud.entity.vdc.") + .majorErrorCode(400) + .minorErrorCode("BAD_REQUEST") + .build(); + + try { + client.getVdcClient().getVdc(vdcRef); + fail("Should give HTTP 400 error"); + } catch (VCloudDirectorException vde) { + assertEquals(vde.getError(), expected); + } catch (Exception e) { + fail("Should have thrown a VCloudDirectorException"); + } + } + + @Test + public void testResponse403ForFakeVdcId() { + VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + new VcloudHttpRequestPrimer() + .apiCommand("GET", "/vdc/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee") + .acceptAnyMedia() + .httpRequestBuilder().build(), + new VcloudHttpResponsePrimer() + .xmlFilePayload("/vdc/error403-fake.xml", VCloudDirectorMediaType.ERROR) + .httpResponseBuilder().statusCode(403).build()); + + Error expected = Error.builder() + .message("No access to entity \"com.vmware.vcloud.entity.vdc:aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee\".") + .majorErrorCode(403) + .minorErrorCode("ACCESS_TO_RESOURCE_IS_FORBIDDEN") + .build(); + + try { + client.getVdcClient().getVdc(vdcRef); + fail("Should give HTTP 403 error"); + } catch (VCloudDirectorException vde) { + assertEquals(vde.getError(), expected); + } catch (Exception e) { + fail("Should have thrown a VCloudDirectorException"); + } + } + + @Test(enabled = false) + public void testCaptureVApp() { + VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + new VcloudHttpRequestPrimer() + .apiCommand("POST", "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/action/captureVApp") + .xmlFilePayload("/vdc/params/captureVApp.xml", VCloudDirectorMediaType.CAPTURE_VAPP_PARAMS) + .acceptAnyMedia() + .httpRequestBuilder().build(), + new VcloudHttpResponsePrimer() + .xmlFilePayload("/vdc/vdc.xml", VCloudDirectorMediaType.VDC) + .httpResponseBuilder().build()); + + VAppTemplate expected = captureVApp(); + + // TODO: configure params + CaptureVAppParams params = CaptureVAppParams.builder() + + .build(); + + assertEquals(client.getVdcClient().captureVApp(vdcRef, params), expected); + } + + @Test(enabled = false) + public void testResponse4xxForCaptureVAppNoParams() { + VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + new VcloudHttpRequestPrimer() + .apiCommand("POST", "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/action/captureVApp") + .xmlFilePayload("/vdc/params/captureVApp.xml", VCloudDirectorMediaType.CAPTURE_VAPP_PARAMS) + .acceptAnyMedia() + .httpRequestBuilder().build(), + new VcloudHttpResponsePrimer() + .xmlFilePayload("/vdc/param/error400.xml", VCloudDirectorMediaType.ERROR) + .httpResponseBuilder().statusCode(400).build()); + + Error expected = Error.builder() + .message("?") + .majorErrorCode(400) + .minorErrorCode("BAD_REQUEST") + .build(); + + try { + client.getVdcClient().captureVApp(vdcRef, null); + fail("Should give HTTP 400 error"); + } catch (VCloudDirectorException vde) { + assertEquals(vde.getError(), expected); + } catch (Exception e) { + fail("Should have thrown a VCloudDirectorException"); + } + } + + @Test + public void testCloneMedia() { + VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + new VcloudHttpRequestPrimer() + .apiCommand("POST", "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/action/cloneMedia") + .xmlFilePayload("/vdc/params/cloneMedia.xml", VCloudDirectorMediaType.CLONE_MEDIA_PARAMS) + .acceptAnyMedia() + .httpRequestBuilder().build(), + new VcloudHttpResponsePrimer() + .xmlFilePayload("/vdc/cloneMedia.xml", VCloudDirectorMediaType.MEDIA) + .httpResponseBuilder().build()); + + Media expected = cloneMedia(); + + // TODO: configure params + CloneMediaParams params = CloneMediaParams.builder() + + .build(); + + assertEquals(client.getVdcClient().cloneMedia(vdcRef, params), expected); + } + + @Test(enabled = false) + public void testCloneVApp() { + VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + new VcloudHttpRequestPrimer() + .apiCommand("POST", "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/action/cloneVApp") + .xmlFilePayload("/vdc/params/cloneVApp.xml", VCloudDirectorMediaType.CLONE_V_APP_PARAMS) + .acceptAnyMedia() + .httpRequestBuilder().build(), + new VcloudHttpResponsePrimer() + .xmlFilePayload("/vdc/cloneVApp.xml", VCloudDirectorMediaType.V_APP) + .httpResponseBuilder().build()); + + VApp expected = cloneVApp(); + + // TODO: configure params + CloneVAppParams params = CloneVAppParams.builder() + + .build(); + + assertEquals(client.getVdcClient().cloneVApp(vdcRef, params), expected); + } + + @Test(enabled = false) + public void testCloneVAppTemplate() { + VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + new VcloudHttpRequestPrimer() + .apiCommand("POST", "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/action/cloneVAppTemplate") + .xmlFilePayload("/vdc/params/cloneVAppTemplate.xml", VCloudDirectorMediaType.CLONE_V_APP_TEMPLATE_PARAMS) + .acceptAnyMedia() + .httpRequestBuilder().build(), + new VcloudHttpResponsePrimer() + .xmlFilePayload("/vdc/cloneVAppTemplate.xml", VCloudDirectorMediaType.V_APP_TEMPLATE) + .httpResponseBuilder().build()); + + VAppTemplate expected = cloneVAppTemplate(); + + // TODO: configure params + CloneVAppTemplateParams params = CloneVAppTemplateParams.builder() + + .build(); + + assertEquals(client.getVdcClient().cloneVAppTemplate(vdcRef, params), expected); + } + + @Test(enabled = false) + public void testComposeVApp() { + VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + new VcloudHttpRequestPrimer() + .apiCommand("POST", "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/action/composeVApp") + .xmlFilePayload("/vdc/params/composeVApp.xml", VCloudDirectorMediaType.COMPOSE_VAPP_PARAMS) + .acceptAnyMedia() + .httpRequestBuilder().build(), + new VcloudHttpResponsePrimer() + .xmlFilePayload("/vdc/composeVApp.xml", VCloudDirectorMediaType.V_APP) + .httpResponseBuilder().build()); + + VApp expected = composeVApp(); + + // TODO: configure params + ComposeVAppParams params = ComposeVAppParams.builder() + + .build(); + + assertEquals(client.getVdcClient().composeVApp(vdcRef, params), expected); + } + + @Test(enabled = false) + public void testInstantiateVAppTemplate() { + VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + new VcloudHttpRequestPrimer() + .apiCommand("POST", "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/action/instantiateVAppTemplate") + .xmlFilePayload("/vdc/params/instantiateVAppTemplate.xml", VCloudDirectorMediaType.CAPTURE_VAPP_PARAMS) + .acceptAnyMedia() + .httpRequestBuilder().build(), + new VcloudHttpResponsePrimer() + .xmlFilePayload("/vdc/instantiateVAppTemplate.xml", VCloudDirectorMediaType.V_APP) + .httpResponseBuilder().build()); + + VApp expected = instantiateVAppTemplate(); + + // TODO: configure params + InstantiateVAppTemplateParams params = InstantiateVAppTemplateParams.builder() + + .build(); + + assertEquals(client.getVdcClient().instantiateVApp(vdcRef, params), expected); + } + + @Test(enabled = false) + public void testUploadVAppTemplate() { + VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + new VcloudHttpRequestPrimer() + .apiCommand("POST", "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/action/uploadVAppTemplate") + .xmlFilePayload("/vdc/params/uploadVAppTemplate.xml", VCloudDirectorMediaType.UPLOAD_VAPP_TEMPLATE_PARAMS) + .acceptAnyMedia() + .httpRequestBuilder().build(), + new VcloudHttpResponsePrimer() + .xmlFilePayload("/vdc/uploadVAppTemplate.xml", VCloudDirectorMediaType.V_APP_TEMPLATE) + .httpResponseBuilder().build()); + + VAppTemplate expected = uploadVAppTemplate(); + + // TODO: configure params + UploadVAppTemplateParams params = UploadVAppTemplateParams.builder() + + .build(); + + assertEquals(client.getVdcClient().uploadVAppTemplate(vdcRef, params), expected); + } + + @Test + public void testCreateMedia() { + VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + new VcloudHttpRequestPrimer() + .apiCommand("POST", "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/action/media") + .xmlFilePayload("/vdc/params/createMedia.xml", VCloudDirectorMediaType.MEDIA) + .acceptAnyMedia() + .httpRequestBuilder().build(), + new VcloudHttpResponsePrimer() + .xmlFilePayload("/vdc/createMedia.xml", VCloudDirectorMediaType.MEDIA) + .httpResponseBuilder().build()); + + Media expected = createMedia(); + + // TODO: configure params + Media createMedia = Media.builder() + + .build(); + + assertEquals(client.getVdcClient().createMedia(vdcRef, createMedia), expected); + } + + @Test + public void testGetMetadata() { + URI vdcUri = URI.create(endpoint + "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f"); + + VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + new VcloudHttpRequestPrimer() + .apiCommand("GET", "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/metadata") + .acceptAnyMedia() + .httpRequestBuilder().build(), + new VcloudHttpResponsePrimer() + .xmlFilePayload("/vdc/metadata.xml", VCloudDirectorMediaType.METADATA) + .httpResponseBuilder().build()); + + Reference mediaRef = Reference.builder().href(vdcUri).build(); + + Metadata expected = metadata(); + + assertEquals(client.getMediaClient().getMetadata(mediaRef), expected); + } + + public void testGetMetadataValue() { + URI vdcUri = URI.create("https://vcloudbeta.bluelock.com/api/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f"); + + VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + new VcloudHttpRequestPrimer() + .apiCommand("GET", "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/metadata/key") + .acceptAnyMedia() + .httpRequestBuilder().build(), + new VcloudHttpResponsePrimer() + .xmlFilePayload("/vdc/metadataValue.xml", VCloudDirectorMediaType.METADATA_VALUE) + .httpResponseBuilder().build()); + + MetadataValue expected = metadataValue(); + + Reference mediaRef = Reference.builder().href(vdcUri).build(); + + assertEquals(client.getVdcClient().getMetadataValue(mediaRef, "key"), expected); + } + + public static Vdc getVdc() { + return Vdc.builder() + .status(1) + .name("orgVDC-cloudsoft-Tier1-PAYG") + .id("urn:vcloud:vdc:e9cd3387-ac57-4d27-a481-9bee75e0690f") + .type("application/vnd.vmware.vcloud.vdc+xml") + .href(URI.create("https://mycloud.greenhousedata.com/api/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f")) + .link(Link.builder() + .rel("up") + .type("application/vnd.vmware.vcloud.org+xml") + .href(URI.create("https://mycloud.greenhousedata.com/api/org/c076f90a-397a-49fa-89b8-b294c1599cd0")) + .build()) + .link(Link.builder() + .rel("down") + .type("application/vnd.vmware.vcloud.metadata+xml") + .href(URI.create("https://mycloud.greenhousedata.com/api/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/metadata")) + .build()) + .link(Link.builder() + .rel("add") + .type("application/vnd.vmware.vcloud.uploadVAppTemplateParams+xml") + .href(URI.create("https://mycloud.greenhousedata.com/api/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/action/uploadVAppTemplate")) + .build()) + .link(Link.builder() + .rel("add") + .type("application/vnd.vmware.vcloud.media+xml") + .href(URI.create("https://mycloud.greenhousedata.com/api/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/media")) + .build()) + .link(Link.builder() + .rel("add") + .type("application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml") + .href(URI.create("https://mycloud.greenhousedata.com/api/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/action/instantiateVAppTemplate")) + .build()) + .link(Link.builder() + .rel("add") + .type("application/vnd.vmware.vcloud.cloneVAppParams+xml") + .href(URI.create("https://mycloud.greenhousedata.com/api/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/action/cloneVApp")) + .build()) + .link(Link.builder() + .rel("add") + .type("application/vnd.vmware.vcloud.cloneVAppTemplateParams+xml") + .href(URI.create("https://mycloud.greenhousedata.com/api/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/action/cloneVAppTemplate")) + .build()) + .link(Link.builder() + .rel("add") + .type("application/vnd.vmware.vcloud.cloneMediaParams+xml") + .href(URI.create("https://mycloud.greenhousedata.com/api/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/action/cloneMedia")) + .build()) + .link(Link.builder() + .rel("add") + .type("application/vnd.vmware.vcloud.captureVAppParams+xml") + .href(URI.create("https://mycloud.greenhousedata.com/api/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/action/captureVApp")) + .build()) + .link(Link.builder() + .rel("add") + .type("application/vnd.vmware.vcloud.composeVAppParams+xml") + .href(URI.create("https://mycloud.greenhousedata.com/api/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/action/composeVApp")) + .build()) + .description("Pay As You go resources for organization cloudsoft ") + .allocationModel("AllocationVApp") + .storageCapacity(CapacityWithUsage.builder() + .units("MB") + .allocated(0l) + .limit(0l) + .used(4519l) + .overhead(0l) + .build()) + .computeCapacity(ComputeCapacity.builder() + .cpu(CapacityWithUsage.builder() + .units("MHz") + .allocated(0l) + .limit(0l) + .used(0l) + .overhead(0l) + .build()) + .memory(CapacityWithUsage.builder() + .units("MB") + .allocated(0l) + .limit(0l) + .used(0l) + .overhead(0l) + .build()) + .build()) + .resourceEntities(ResourceEntities.builder() + .resourceEntity(Reference.builder() + .type("application/vnd.vmware.vcloud.vApp+xml") + .name("vcdcap-db9") + .href(URI.create("https://mycloud.greenhousedata.com/api/vApp/vapp-e2a4ab74-ea62-4afa-8bb7-0c11259044fb")) + .build()) + .resourceEntity(Reference.builder() + .type("application/vnd.vmware.vcloud.vAppTemplate+xml") + .name("adriancolecap") + .href(URI.create("https://mycloud.greenhousedata.com/api/vAppTemplate/vappTemplate-5571eb21-f532-4506-9737-01a4635a04cb")) + .build()) + .resourceEntity(Reference.builder() + .type("application/vnd.vmware.vcloud.media+xml") + .name("DansTestMedia") + .href(URI.create("https://mycloud.greenhousedata.com/api/media/794eb334-754e-4917-b5a0-5df85cbd61d1")) + .build()) + .build()) + .availableNetworks(AvailableNetworks.builder() + .network(Reference.builder() + .type("application/vnd.vmware.vcloud.network+xml") + .name("orgNet-cloudsoft-Isolated") + .href(URI.create("https://mycloud.greenhousedata.com/api/network/a604f3c2-0343-453e-ae1f-cddac5b7bd94")) + .build()) + .network(Reference.builder() + .type("application/vnd.vmware.vcloud.network+xml") + .name("orgNet-cloudsoft-External") + .href(URI.create("https://mycloud.greenhousedata.com/api/network/b466c0c5-8a5c-4335-b703-a2e2e6b5f3e1")) + .build()) + .network(Reference.builder() + .type("application/vnd.vmware.vcloud.network+xml") + .name("orgNet-cloudsoft-Internal-Routed") + .href(URI.create("https://mycloud.greenhousedata.com/api/network/6d7392e2-c816-43fb-99be-f9ebcd70abf6")) + .build()) + .build()) + .capabilities(Capabilities.builder() + .supportedHardwareVersions(SupportedHardwareVersions.builder() + .supportedHardwareVersion("vmx-04") + .supportedHardwareVersion("vmx-07") + .supportedHardwareVersion("vmx-08") + .build()) + .build()) + .nicQuota(0) + .networkQuota(10) + .vmQuota(10) + .isEnabled(true) + .build(); + } + + private VAppTemplate captureVApp() { + // TODO Auto-generated method stub + return null; + } + + private Media cloneMedia() { + // TODO Auto-generated method stub + return null; + } + + private VApp cloneVApp() { + // TODO Auto-generated method stub + return null; + } + + private VAppTemplate cloneVAppTemplate() { + // TODO Auto-generated method stub + return null; + } + + private VApp composeVApp() { + // TODO Auto-generated method stub + return null; + } + + private VApp instantiateVAppTemplate() { + // TODO Auto-generated method stub + return null; + } + + private VAppTemplate uploadVAppTemplate() { + // TODO Auto-generated method stub + return null; + } + + private Media createMedia() { + // TODO Auto-generated method stub + return null; + } + + private Metadata metadata() { + // TODO Auto-generated method stub + return null; + } + + private MetadataValue metadataValue() { + // TODO Auto-generated method stub + return null; + } +} diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VdcClientLiveTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VdcClientLiveTest.java new file mode 100644 index 0000000000..4b049d4dd6 --- /dev/null +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VdcClientLiveTest.java @@ -0,0 +1,297 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + *(Link.builder().regarding copyright ownership. jclouds licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless(Link.builder().required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.jclouds.vcloud.director.v1_5.features; + +import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.OBJ_FIELD_GTE_0; +import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.OBJ_FIELD_REQ; +import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.OBJ_FIELD_REQ_LIVE; +import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.OBJ_REQ_LIVE; +import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.REF_REQ_LIVE; +import static org.testng.Assert.assertFalse; +import static org.testng.Assert.assertNotNull; +import static org.testng.Assert.assertTrue; + +import java.net.URI; + +import org.jclouds.vcloud.director.v1_5.domain.CaptureVAppParams; +import org.jclouds.vcloud.director.v1_5.domain.Checks; +import org.jclouds.vcloud.director.v1_5.domain.CloneMediaParams; +import org.jclouds.vcloud.director.v1_5.domain.CloneVAppParams; +import org.jclouds.vcloud.director.v1_5.domain.CloneVAppTemplateParams; +import org.jclouds.vcloud.director.v1_5.domain.ComposeVAppParams; +import org.jclouds.vcloud.director.v1_5.domain.InstantiateVAppParams; +import org.jclouds.vcloud.director.v1_5.domain.Media; +import org.jclouds.vcloud.director.v1_5.domain.Metadata; +import org.jclouds.vcloud.director.v1_5.domain.MetadataValue; +import org.jclouds.vcloud.director.v1_5.domain.Reference; +import org.jclouds.vcloud.director.v1_5.domain.UploadVAppTemplateParams; +import org.jclouds.vcloud.director.v1_5.domain.VApp; +import org.jclouds.vcloud.director.v1_5.domain.VAppTemplate; +import org.jclouds.vcloud.director.v1_5.domain.Vdc; +import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorClientLiveTest; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; + +import com.google.common.collect.Iterables; + +/** + * Tests behavior of {@code VdcClient} + * + * @author danikov + */ +@Test(groups = { "live", "apitests", "user" }, testName = "VdcClientLiveTest") +public class VdcClientLiveTest extends BaseVCloudDirectorClientLiveTest { + + public static final String VDC = "vdc"; + + /* + * Convenience reference to API client. + */ + protected VdcClient vdcClient; + + private Reference vdcRef; + + @BeforeClass(inheritGroups = true) + @Override + public void setupRequiredClients() { + vdcRef = Reference.builder() + .type("application/vnd.vmware.vcloud.vdc+xml") + .name("") + .href(URI.create(endpoint+"/vdc/"+vDCId)) + .id(vDCId) + .build(); + vdcClient = context.getApi().getVdcClient(); + } + + @Test(testName = "GET /vdc/{id}") + public void testGetVdc() { + // required for testing + assertNotNull(vdcRef, String.format(REF_REQ_LIVE, VDC)); + + Vdc vdc = vdcClient.getVdc(vdcRef); + assertNotNull(vdc, String.format(OBJ_REQ_LIVE, VDC)); + assertTrue(!vdc.getDescription().equals("DO NOT USE"), "vDC isn't to be used for testing"); + + // parent type + Checks.checkEntityType(vdc); + + // required + assertNotNull(vdc.getAllocationModel(), String.format(OBJ_FIELD_REQ, VDC, "allocationModel")); + + assertNotNull(vdc.getStorageCapacity(), String.format(OBJ_FIELD_REQ, VDC, "storageCapacity")); + Checks.checkCapacityWithUsage(vdc.getStorageCapacity()); + + assertNotNull(vdc.getComputeCapacity(), String.format(OBJ_FIELD_REQ, VDC, "computeCapacity")); + Checks.checkComputeCapacity(vdc.getComputeCapacity()); + + assertNotNull(vdc.getNicQuota(), String.format(OBJ_FIELD_REQ, VDC, "nicQuota")); + assertTrue(vdc.getNicQuota() >= 0, String.format(OBJ_FIELD_GTE_0, VDC, "nicQuota", vdc.getNicQuota())); + + assertNotNull(vdc.getNetworkQuota(), String.format(OBJ_FIELD_REQ, VDC, "networkQuota")); + assertTrue(vdc.getNetworkQuota() >= 0, String.format(OBJ_FIELD_GTE_0, VDC, "networkQuota", vdc.getNetworkQuota())); + + + // optional + // NOTE isEnabled cannot be checked + if (vdc.getResourceEntities() != null) { + Checks.checkResourceEntities(vdc.getResourceEntities()); + } + if (vdc.getAvailableNetworks() != null) { + Checks.checkAvailableNetworks(vdc.getAvailableNetworks()); + } + if (vdc.getCapabilities() != null) { + Checks.checkCapabilities(vdc.getCapabilities()); + } + if(vdc.getVmQuota() != null) { + assertTrue(vdc.getVmQuota() >= 0, String.format(OBJ_FIELD_GTE_0, VDC, "vmQuota", vdc.getVmQuota())); + } + if(vdc.getVmQuota() != null) { + assertTrue(vdc.getVmQuota() >= 0, String.format(OBJ_FIELD_GTE_0, VDC, "vmQuota", vdc.getVmQuota())); + } + } + + @Test(testName = "POST /vdc/{id}/action/captureVApp", enabled = false) + public void testCaptureVApp() { + Reference templateSource = null; // TODO: vApp reference + VAppTemplate template = vdcClient.captureVApp(vdcRef, CaptureVAppParams.builder() + .source(templateSource) + // TODO: test optional params + //.name("") + //.description("") + //.sections(sections) // TODO: ovf sections + .build()); + + Checks.checkVAppTemplate(template); + + // TODO: await task to complete + // TODO: make assertions that the task was successful + } + + @Test(testName = "POST /vdc/{id}/action/cloneMedia") + public void testCloneMedia() { + Reference mediaSource = null; // TODO: media reference + Media media = vdcClient.cloneMedia(vdcRef, CloneMediaParams.builder() + .source(mediaSource) + // TODO: test optional params + //.name("") + //.description("") + //.isSourceDelete(true) + .build()); + + Checks.checkMediaFor(VDC, media); + + // TODO: await task to complete + // TODO: make assertions that the task was successful + } + + @Test(testName = "POST /vdc/{id}/action/cloneVApp", enabled = false) + public void testCloneVApp() { + Reference vAppSource = null; // TODO: vApp reference + VApp vApp = vdcClient.cloneVApp(vdcRef, CloneVAppParams.builder() + .source(vAppSource) + // TODO: test optional params + //.name("") + //.description("") + //.deploy(true) + //.isSourceDelete(true) + //.powerOn(true) + //.instantiationParams(InstantiationParams.builder() + // .sections(sections) // TODO: ovf sections? various tests? + // .build()) + + // Reserved. Unimplemented params; may test eventually when implemented + //.vAppParent(vAppParentRef) + //.linkedClone(true) + .build()); + + Checks.checkVApp(vApp); + + // TODO: await task to complete + // TODO: make assertions that the task was successful + } + + @Test(testName = "POST /vdc/{id}/action/cloneVAppTemplate", enabled = false) + public void testCloneVAppTemplate() { + Reference templateSource = null; // TODO: vAppTemplate reference + VAppTemplate template = vdcClient.cloneVAppTemplate(vdcRef, CloneVAppTemplateParams.builder() + .source(templateSource) + // TODO: test optional params + //.name("") + //.description("") + //.isSourceDelete(true) + //.sections(sections) // TODO: ovf sections + .build()); + + Checks.checkVAppTemplate(template); + + // TODO: await task to complete + // TODO: make assertions that the task was successful + } + + @Test(testName = "POST /vdc/{id}/action/composeVApp", enabled = false) + public void testComposeVApp() { + VApp vApp = vdcClient.composeVApp(vdcRef, ComposeVAppParams.builder() + // TODO: test optional params + //.name("") + //.description("") + //.deploy(true) + //.isSourceDelete(true) + //.powerOn(true) + //.instantiationParams(InstantiationParams.builder() + // .sections(sections) // TODO: ovf sections? various tests? + // .build()) + + // Reserved. Unimplemented params; may test eventually when implemented + //.linkedClone() + .build()); + + Checks.checkVApp(vApp); + + // TODO: await task to complete + // TODO: make assertions that the task was successful + } + + @Test(testName = "POST /vdc/{id}/action/instantiateVAppTemplate", enabled = false) + public void testInstantiateVAppTemplate() { + Reference templateSource = null; // TODO: vApp or vAppTemplate reference + VApp vApp = vdcClient.instantiateVApp(vdcRef, InstantiateVAppParams.builder() + .source(templateSource) + // TODO: test optional params + //.name("") + //.description("") + //.isSourceDelete(true) + .build()); + + Checks.checkVApp(vApp); + + // TODO: await task to complete + // TODO: make assertions that the task was successful + } + + @Test(testName = "POST /vdc/{id}/action/uploadVAppTemplate", enabled = false) + public void testUploadVAppTemplate() { + VAppTemplate template = vdcClient.uploadVAppTemplate(vdcRef, UploadVAppTemplateParams.builder() + // TODO: test optional params + //.name("") + //.description("") + //.transferFormat("") + //.manifestRequired(true) + .build()); + + Checks.checkVAppTemplate(template); + + // TODO: await task to complete + // TODO: make assertions that the task was successful + } + + @Test(testName = "POST /vdc/{id}/media") + public void testCreateMedia() { + Media media = vdcClient.createMedia(vdcRef, Media.builder() + .name("") + .imageType(Media.ImageType.ISO) + .size(0) + // TODO: test optional params + //.name("") + //.description("") + //.isSourceDelete(true) + .build()); + + Checks.checkMediaFor(VDC, media); + + // TODO: await task to complete + // TODO: make assertions that the task was successful + } + + @Test(testName = "GET /network/{id}/metadata") + public void testGetMetadata() { + Metadata metadata = vdcClient.getMetadata(vdcRef); + // required for testing + assertFalse(Iterables.isEmpty(metadata.getMetadataEntries()), + String.format(OBJ_FIELD_REQ_LIVE, VDC, "metadata.entries")); + + Checks.checkMetadataFor(VDC, metadata); + } + + @Test(testName = "GET /network/{id}/metadata/{key}") + public void testGetMetadataValue() { + MetadataValue metadataValue = vdcClient.getMetadataValue(vdcRef, "key"); + + Checks.checkMetadataValueFor(VDC, metadataValue); + } +} diff --git a/labs/vcloud-director/src/test/resources/vdc/error400.xml b/labs/vcloud-director/src/test/resources/vdc/error400.xml new file mode 100644 index 0000000000..7d7c18b7f1 --- /dev/null +++ b/labs/vcloud-director/src/test/resources/vdc/error400.xml @@ -0,0 +1,2 @@ + + diff --git a/labs/vcloud-director/src/test/resources/vdc/error403-fake.xml b/labs/vcloud-director/src/test/resources/vdc/error403-fake.xml new file mode 100644 index 0000000000..a3f2be18c6 --- /dev/null +++ b/labs/vcloud-director/src/test/resources/vdc/error403-fake.xml @@ -0,0 +1,2 @@ + + diff --git a/labs/vcloud-director/src/test/resources/vdc/metadata.xml b/labs/vcloud-director/src/test/resources/vdc/metadata.xml new file mode 100644 index 0000000000..58682fae3d --- /dev/null +++ b/labs/vcloud-director/src/test/resources/vdc/metadata.xml @@ -0,0 +1,8 @@ + + + + + key + value + + diff --git a/labs/vcloud-director/src/test/resources/vdc/vdc.xml b/labs/vcloud-director/src/test/resources/vdc/vdc.xml new file mode 100644 index 0000000000..ac1e2f92ae --- /dev/null +++ b/labs/vcloud-director/src/test/resources/vdc/vdc.xml @@ -0,0 +1,59 @@ + + + + + + + + + + + + + Pay As You go resources for organization cloudsoft + AllocationVApp + + MB + 0 + 0 + 4519 + 0 + + + + MHz + 0 + 0 + 0 + 0 + + + MB + 0 + 0 + 0 + 0 + + + + + + + + + + + + + + + vmx-04 + vmx-07 + vmx-08 + + + 0 + 10 + 10 + true +