http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/ovf/EditableResourceAllocationSettingData.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/ovf/EditableResourceAllocationSettingData.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/ovf/EditableResourceAllocationSettingData.java new file mode 100644 index 0000000..b12be86 --- /dev/null +++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/ovf/EditableResourceAllocationSettingData.java @@ -0,0 +1,298 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF 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.domain.ovf; + +import java.util.List; + +import org.jclouds.cim.ResourceAllocationSettingData; +import org.jclouds.vcloud.domain.ReferenceType; + +public class EditableResourceAllocationSettingData extends ResourceAllocationSettingData { + + public static Builder builder() { + return new Builder(); + } + + /** + * {@inheritDoc} + */ + @Override + public Builder toBuilder() { + return builder().fromEditableResourceAllocationSettingData(this); + } + + public static class Builder extends ResourceAllocationSettingData.Builder { + private ReferenceType edit; + + /** + * @see EditableResourceAllocationSettingData#getEdit + */ + public Builder edit(ReferenceType edit) { + this.edit = edit; + return this; + } + + public EditableResourceAllocationSettingData build() { + return new EditableResourceAllocationSettingData(elementName, instanceID, caption, description, address, + addressOnParent, allocationUnits, automaticAllocation, automaticDeallocation, consumerVisibility, limit, + mappingBehavior, otherResourceType, parent, poolID, reservation, resourceSubType, resourceType, + virtualQuantity, virtualQuantityUnits, weight, connections, hostResources, edit); + } + + public Builder fromEditableResourceAllocationSettingData(EditableResourceAllocationSettingData in) { + return edit(in.getEdit()).fromResourceAllocationSettingData(in); + } + + /** + * {@inheritDoc} + */ + @Override + public Builder caption(String caption) { + return Builder.class.cast(super.caption(caption)); + } + + /** + * {@inheritDoc} + */ + @Override + public Builder description(String description) { + return Builder.class.cast(super.description(description)); + } + + /** + * {@inheritDoc} + */ + @Override + public Builder elementName(String elementName) { + return Builder.class.cast(super.elementName(elementName)); + } + + /** + * {@inheritDoc} + */ + @Override + public Builder instanceID(String instanceID) { + return Builder.class.cast(super.instanceID(instanceID)); + } + + /** + * {@inheritDoc} + */ + @Override + public Builder address(String address) { + return Builder.class.cast(super.address(address)); + } + + /** + * {@inheritDoc} + */ + @Override + public Builder addressOnParent(String addressOnParent) { + return Builder.class.cast(super.addressOnParent(addressOnParent)); + } + + /** + * {@inheritDoc} + */ + @Override + public Builder allocationUnits(String allocationUnits) { + return Builder.class.cast(super.allocationUnits(allocationUnits)); + } + + /** + * {@inheritDoc} + */ + @Override + public Builder automaticAllocation(Boolean automaticAllocation) { + return Builder.class.cast(super.automaticAllocation(automaticAllocation)); + } + + /** + * {@inheritDoc} + */ + @Override + public Builder automaticDeallocation(Boolean automaticDeallocation) { + return Builder.class.cast(super.automaticDeallocation(automaticDeallocation)); + } + + /** + * {@inheritDoc} + */ + @Override + public Builder connection(String connection) { + return Builder.class.cast(super.connection(connection)); + } + + /** + * {@inheritDoc} + */ + @Override + public Builder connections(List<String> connections) { + return Builder.class.cast(super.connections(connections)); + } + + /** + * {@inheritDoc} + */ + @Override + public Builder consumerVisibility(ConsumerVisibility consumerVisibility) { + return Builder.class.cast(super.consumerVisibility(consumerVisibility)); + } + + /** + * {@inheritDoc} + */ + @Override + public Builder hostResource(String hostResource) { + return Builder.class.cast(super.hostResource(hostResource)); + } + + /** + * {@inheritDoc} + */ + @Override + public Builder hostResources(List<String> hostResources) { + return Builder.class.cast(super.hostResources(hostResources)); + } + + /** + * {@inheritDoc} + */ + @Override + public Builder limit(Long limit) { + return Builder.class.cast(super.limit(limit)); + } + + /** + * {@inheritDoc} + */ + @Override + public Builder mappingBehavior(MappingBehavior mappingBehavior) { + return Builder.class.cast(super.mappingBehavior(mappingBehavior)); + } + + /** + * {@inheritDoc} + */ + @Override + public Builder otherResourceType(String otherResourceType) { + return Builder.class.cast(super.otherResourceType(otherResourceType)); + } + + /** + * {@inheritDoc} + */ + @Override + public Builder parent(String parent) { + return Builder.class.cast(super.parent(parent)); + } + + /** + * {@inheritDoc} + */ + @Override + public Builder poolID(String poolID) { + return Builder.class.cast(super.poolID(poolID)); + } + + /** + * {@inheritDoc} + */ + @Override + public Builder reservation(Long reservation) { + return Builder.class.cast(super.reservation(reservation)); + } + + /** + * {@inheritDoc} + */ + @Override + public Builder resourceSubType(String resourceSubType) { + return Builder.class.cast(super.resourceSubType(resourceSubType)); + } + + /** + * {@inheritDoc} + */ + @Override + public Builder resourceType(org.jclouds.cim.ResourceAllocationSettingData.ResourceType resourceType) { + return Builder.class.cast(super.resourceType(resourceType)); + } + + /** + * {@inheritDoc} + */ + @Override + public Builder virtualQuantity(Long virtualQuantity) { + return Builder.class.cast(super.virtualQuantity(virtualQuantity)); + } + + /** + * {@inheritDoc} + */ + @Override + public Builder virtualQuantityUnits(String virtualQuantityUnits) { + return Builder.class.cast(super.virtualQuantityUnits(virtualQuantityUnits)); + } + + /** + * {@inheritDoc} + */ + @Override + public Builder weight(Integer weight) { + return Builder.class.cast(super.weight(weight)); + } + + @Override + public Builder fromResourceAllocationSettingData(ResourceAllocationSettingData in) { + return Builder.class.cast(super.fromResourceAllocationSettingData(in)); + } + + } + + private final ReferenceType edit; + + public EditableResourceAllocationSettingData(String elementName, String instanceID, String caption, + String description, String address, String addressOnParent, String allocationUnits, + Boolean automaticAllocation, Boolean automaticDeallocation, ConsumerVisibility consumerVisibility, Long limit, + MappingBehavior mappingBehavior, String otherResourceType, String parent, String poolID, Long reservation, + String resourceSubType, org.jclouds.cim.ResourceAllocationSettingData.ResourceType resourceType, + Long virtualQuantity, String virtualQuantityUnits, Integer weight, List<String> connections, + List<String> hostResources, ReferenceType edit) { + super(elementName, instanceID, caption, description, address, addressOnParent, allocationUnits, + automaticAllocation, automaticDeallocation, consumerVisibility, limit, mappingBehavior, otherResourceType, + parent, poolID, reservation, resourceSubType, resourceType, virtualQuantity, virtualQuantityUnits, weight, + connections, hostResources); + this.edit = edit; + } + + public ReferenceType getEdit() { + return edit; + } + + @Override + public String toString() { + return String + .format( + "[elementName=%s, instanceID=%s, caption=%s, description=%s, address=%s, addressOnParent=%s, allocationUnits=%s, automaticAllocation=%s, automaticDeallocation=%s, connections=%s, consumerVisibility=%s, hostResources=%s, limit=%s, mappingBehavior=%s, otherResourceType=%s, parent=%s, poolID=%s, reservation=%s, resourceSubType=%s, resourceType=%s, virtualQuantity=%s, virtualQuantityUnits=%s, weight=%s, edit=%s]", + elementName, instanceID, caption, description, address, addressOnParent, allocationUnits, + automaticAllocation, automaticDeallocation, connections, consumerVisibility, hostResources, limit, + mappingBehavior, otherResourceType, parent, poolID, reservation, resourceSubType, resourceType, + virtualQuantity, virtualQuantityUnits, weight, edit); + } + +}
http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/ovf/VCloudHardDisk.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/ovf/VCloudHardDisk.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/ovf/VCloudHardDisk.java new file mode 100644 index 0000000..b281785 --- /dev/null +++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/ovf/VCloudHardDisk.java @@ -0,0 +1,326 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF 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.domain.ovf; + +import java.util.List; + +import org.jclouds.cim.ResourceAllocationSettingData; + +public class VCloudHardDisk extends ResourceAllocationSettingData { + + public static Builder builder() { + return new Builder(); + } + + /** + * {@inheritDoc} + */ + @Override + public Builder toBuilder() { + return builder().fromVCloudHardDisk(this); + } + + public static class Builder extends ResourceAllocationSettingData.Builder { + private long capacity; + private int busType; + private String busSubType; + + /** + * @see VCloudHardDisk#getCapacity + */ + public Builder capacity(long capacity) { + this.capacity = capacity; + return this; + } + + /** + * @see VCloudHardDisk#getBusType + */ + public Builder busType(int busType) { + this.busType = busType; + return this; + } + + /** + * @see VCloudHardDisk#getBusSubType + */ + public Builder busSubType(String busSubType) { + this.busSubType = busSubType; + return this; + } + + public VCloudHardDisk build() { + return new VCloudHardDisk(elementName, instanceID, caption, description, address, addressOnParent, + allocationUnits, automaticAllocation, automaticDeallocation, consumerVisibility, limit, mappingBehavior, + otherResourceType, parent, poolID, reservation, resourceSubType, resourceType, virtualQuantity, + virtualQuantityUnits, weight, connections, hostResources, capacity, busType, busSubType); + } + + public Builder fromVCloudHardDisk(VCloudHardDisk in) { + return capacity(in.getCapacity()).busType(in.getBusType()).busSubType(in.getBusSubType()) + .fromResourceAllocationSettingData(in); + } + + /** + * {@inheritDoc} + */ + @Override + public Builder caption(String caption) { + return Builder.class.cast(super.caption(caption)); + } + + /** + * {@inheritDoc} + */ + @Override + public Builder description(String description) { + return Builder.class.cast(super.description(description)); + } + + /** + * {@inheritDoc} + */ + @Override + public Builder elementName(String elementName) { + return Builder.class.cast(super.elementName(elementName)); + } + + /** + * {@inheritDoc} + */ + @Override + public Builder instanceID(String instanceID) { + return Builder.class.cast(super.instanceID(instanceID)); + } + + /** + * {@inheritDoc} + */ + @Override + public Builder address(String address) { + return Builder.class.cast(super.address(address)); + } + + /** + * {@inheritDoc} + */ + @Override + public Builder addressOnParent(String addressOnParent) { + return Builder.class.cast(super.addressOnParent(addressOnParent)); + } + + /** + * {@inheritDoc} + */ + @Override + public Builder allocationUnits(String allocationUnits) { + return Builder.class.cast(super.allocationUnits(allocationUnits)); + } + + /** + * {@inheritDoc} + */ + @Override + public Builder automaticAllocation(Boolean automaticAllocation) { + return Builder.class.cast(super.automaticAllocation(automaticAllocation)); + } + + /** + * {@inheritDoc} + */ + @Override + public Builder automaticDeallocation(Boolean automaticDeallocation) { + return Builder.class.cast(super.automaticDeallocation(automaticDeallocation)); + } + + /** + * {@inheritDoc} + */ + @Override + public Builder connection(String connection) { + return Builder.class.cast(super.connection(connection)); + } + + /** + * {@inheritDoc} + */ + @Override + public Builder connections(List<String> connections) { + return Builder.class.cast(super.connections(connections)); + } + + /** + * {@inheritDoc} + */ + @Override + public Builder consumerVisibility(ConsumerVisibility consumerVisibility) { + return Builder.class.cast(super.consumerVisibility(consumerVisibility)); + } + + /** + * {@inheritDoc} + */ + @Override + public Builder hostResource(String hostResource) { + return Builder.class.cast(super.hostResource(hostResource)); + } + + /** + * {@inheritDoc} + */ + @Override + public Builder hostResources(List<String> hostResources) { + return Builder.class.cast(super.hostResources(hostResources)); + } + + /** + * {@inheritDoc} + */ + @Override + public Builder limit(Long limit) { + return Builder.class.cast(super.limit(limit)); + } + + /** + * {@inheritDoc} + */ + @Override + public Builder mappingBehavior(MappingBehavior mappingBehavior) { + return Builder.class.cast(super.mappingBehavior(mappingBehavior)); + } + + /** + * {@inheritDoc} + */ + @Override + public Builder otherResourceType(String otherResourceType) { + return Builder.class.cast(super.otherResourceType(otherResourceType)); + } + + /** + * {@inheritDoc} + */ + @Override + public Builder parent(String parent) { + return Builder.class.cast(super.parent(parent)); + } + + /** + * {@inheritDoc} + */ + @Override + public Builder poolID(String poolID) { + return Builder.class.cast(super.poolID(poolID)); + } + + /** + * {@inheritDoc} + */ + @Override + public Builder reservation(Long reservation) { + return Builder.class.cast(super.reservation(reservation)); + } + + /** + * {@inheritDoc} + */ + @Override + public Builder resourceSubType(String resourceSubType) { + return Builder.class.cast(super.resourceSubType(resourceSubType)); + } + + /** + * {@inheritDoc} + */ + @Override + public Builder resourceType(org.jclouds.cim.ResourceAllocationSettingData.ResourceType resourceType) { + return Builder.class.cast(super.resourceType(resourceType)); + } + + /** + * {@inheritDoc} + */ + @Override + public Builder virtualQuantity(Long virtualQuantity) { + return Builder.class.cast(super.virtualQuantity(virtualQuantity)); + } + + /** + * {@inheritDoc} + */ + @Override + public Builder virtualQuantityUnits(String virtualQuantityUnits) { + return Builder.class.cast(super.virtualQuantityUnits(virtualQuantityUnits)); + } + + /** + * {@inheritDoc} + */ + @Override + public Builder weight(Integer weight) { + return Builder.class.cast(super.weight(weight)); + } + + @Override + public Builder fromResourceAllocationSettingData(ResourceAllocationSettingData in) { + return Builder.class.cast(super.fromResourceAllocationSettingData(in)); + } + } + + private final long capacity; + private final int busType; + private final String busSubType; + + public VCloudHardDisk(String elementName, String instanceID, String caption, String description, String address, + String addressOnParent, String allocationUnits, Boolean automaticAllocation, Boolean automaticDeallocation, + ConsumerVisibility consumerVisibility, Long limit, MappingBehavior mappingBehavior, String otherResourceType, + String parent, String poolID, Long reservation, String resourceSubType, + org.jclouds.cim.ResourceAllocationSettingData.ResourceType resourceType, Long virtualQuantity, + String virtualQuantityUnits, Integer weight, List<String> connections, List<String> hostResources, + long capacity, int busType, String busSubType) { + super(elementName, instanceID, caption, description, address, addressOnParent, allocationUnits, + automaticAllocation, automaticDeallocation, consumerVisibility, limit, mappingBehavior, otherResourceType, + parent, poolID, reservation, resourceSubType, resourceType, virtualQuantity, virtualQuantityUnits, weight, + connections, hostResources); + this.capacity = capacity; + this.busType = busType; + this.busSubType = busSubType; + } + + public long getCapacity() { + return capacity; + } + + public int getBusType() { + return busType; + } + + public String getBusSubType() { + return busSubType; + } + + @Override + public String toString() { + return String + .format( + "[elementName=%s, instanceID=%s, caption=%s, description=%s, address=%s, addressOnParent=%s, allocationUnits=%s, automaticAllocation=%s, automaticDeallocation=%s, connections=%s, consumerVisibility=%s, hostResources=%s, limit=%s, mappingBehavior=%s, otherResourceType=%s, parent=%s, poolID=%s, reservation=%s, resourceSubType=%s, resourceType=%s, virtualQuantity=%s, virtualQuantityUnits=%s, weight=%s, busSubType=%s, busType=%s, capacity=%s]", + elementName, instanceID, caption, description, address, addressOnParent, allocationUnits, + automaticAllocation, automaticDeallocation, connections, consumerVisibility, hostResources, limit, + mappingBehavior, otherResourceType, parent, poolID, reservation, resourceSubType, resourceType, + virtualQuantity, virtualQuantityUnits, weight, busSubType, busType, capacity); + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/ovf/VCloudNetworkAdapter.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/ovf/VCloudNetworkAdapter.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/ovf/VCloudNetworkAdapter.java new file mode 100644 index 0000000..7a48916 --- /dev/null +++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/ovf/VCloudNetworkAdapter.java @@ -0,0 +1,328 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF 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.domain.ovf; + +import java.util.List; + +import org.jclouds.cim.ResourceAllocationSettingData; + +public class VCloudNetworkAdapter extends ResourceAllocationSettingData { + + public static Builder builder() { + return new Builder(); + } + + /** + * {@inheritDoc} + */ + @Override + public Builder toBuilder() { + return builder().fromVCloudNetworkAdapter(this); + } + + public static class Builder extends ResourceAllocationSettingData.Builder { + private String ipAddress; + private boolean primaryNetworkConnection; + private String ipAddressingMode; + + /** + * @see VCloudNetworkAdapter#getCapacity + */ + public Builder ipAddress(String ipAddress) { + this.ipAddress = ipAddress; + return this; + } + + /** + * @see VCloudNetworkAdapter#getBusType + */ + public Builder primaryNetworkConnection(boolean primaryNetworkConnection) { + this.primaryNetworkConnection = primaryNetworkConnection; + return this; + } + + /** + * @see VCloudNetworkAdapter#getBusSubType + */ + public Builder ipAddressingMode(String ipAddressingMode) { + this.ipAddressingMode = ipAddressingMode; + return this; + } + + public VCloudNetworkAdapter build() { + return new VCloudNetworkAdapter(elementName, instanceID, caption, description, address, addressOnParent, + allocationUnits, automaticAllocation, automaticDeallocation, consumerVisibility, limit, + mappingBehavior, otherResourceType, parent, poolID, reservation, resourceSubType, resourceType, + virtualQuantity, virtualQuantityUnits, weight, connections, hostResources, ipAddress, + primaryNetworkConnection, ipAddressingMode); + } + + public Builder fromVCloudNetworkAdapter(VCloudNetworkAdapter in) { + return ipAddress(in.getIpAddress()).primaryNetworkConnection(in.isPrimaryNetworkConnection()) + .ipAddressingMode(in.getIpAddressingMode()).fromResourceAllocationSettingData(in); + } + + /** + * {@inheritDoc} + */ + @Override + public Builder caption(String caption) { + return Builder.class.cast(super.caption(caption)); + } + + /** + * {@inheritDoc} + */ + @Override + public Builder description(String description) { + return Builder.class.cast(super.description(description)); + } + + /** + * {@inheritDoc} + */ + @Override + public Builder elementName(String elementName) { + return Builder.class.cast(super.elementName(elementName)); + } + + /** + * {@inheritDoc} + */ + @Override + public Builder instanceID(String instanceID) { + return Builder.class.cast(super.instanceID(instanceID)); + } + + /** + * {@inheritDoc} + */ + @Override + public Builder address(String address) { + return Builder.class.cast(super.address(address)); + } + + /** + * {@inheritDoc} + */ + @Override + public Builder addressOnParent(String addressOnParent) { + return Builder.class.cast(super.addressOnParent(addressOnParent)); + } + + /** + * {@inheritDoc} + */ + @Override + public Builder allocationUnits(String allocationUnits) { + return Builder.class.cast(super.allocationUnits(allocationUnits)); + } + + /** + * {@inheritDoc} + */ + @Override + public Builder automaticAllocation(Boolean automaticAllocation) { + return Builder.class.cast(super.automaticAllocation(automaticAllocation)); + } + + /** + * {@inheritDoc} + */ + @Override + public Builder automaticDeallocation(Boolean automaticDeallocation) { + return Builder.class.cast(super.automaticDeallocation(automaticDeallocation)); + } + + /** + * {@inheritDoc} + */ + @Override + public Builder connection(String connection) { + return Builder.class.cast(super.connection(connection)); + } + + /** + * {@inheritDoc} + */ + @Override + public Builder connections(List<String> connections) { + return Builder.class.cast(super.connections(connections)); + } + + /** + * {@inheritDoc} + */ + @Override + public Builder consumerVisibility(ConsumerVisibility consumerVisibility) { + return Builder.class.cast(super.consumerVisibility(consumerVisibility)); + } + + /** + * {@inheritDoc} + */ + @Override + public Builder hostResource(String hostResource) { + return Builder.class.cast(super.hostResource(hostResource)); + } + + /** + * {@inheritDoc} + */ + @Override + public Builder hostResources(List<String> hostResources) { + return Builder.class.cast(super.hostResources(hostResources)); + } + + /** + * {@inheritDoc} + */ + @Override + public Builder limit(Long limit) { + return Builder.class.cast(super.limit(limit)); + } + + /** + * {@inheritDoc} + */ + @Override + public Builder mappingBehavior(MappingBehavior mappingBehavior) { + return Builder.class.cast(super.mappingBehavior(mappingBehavior)); + } + + /** + * {@inheritDoc} + */ + @Override + public Builder otherResourceType(String otherResourceType) { + return Builder.class.cast(super.otherResourceType(otherResourceType)); + } + + /** + * {@inheritDoc} + */ + @Override + public Builder parent(String parent) { + return Builder.class.cast(super.parent(parent)); + } + + /** + * {@inheritDoc} + */ + @Override + public Builder poolID(String poolID) { + return Builder.class.cast(super.poolID(poolID)); + } + + /** + * {@inheritDoc} + */ + @Override + public Builder reservation(Long reservation) { + return Builder.class.cast(super.reservation(reservation)); + } + + /** + * {@inheritDoc} + */ + @Override + public Builder resourceSubType(String resourceSubType) { + return Builder.class.cast(super.resourceSubType(resourceSubType)); + } + + /** + * {@inheritDoc} + */ + @Override + public Builder resourceType(org.jclouds.cim.ResourceAllocationSettingData.ResourceType resourceType) { + return Builder.class.cast(super.resourceType(resourceType)); + } + + /** + * {@inheritDoc} + */ + @Override + public Builder virtualQuantity(Long virtualQuantity) { + return Builder.class.cast(super.virtualQuantity(virtualQuantity)); + } + + /** + * {@inheritDoc} + */ + @Override + public Builder virtualQuantityUnits(String virtualQuantityUnits) { + return Builder.class.cast(super.virtualQuantityUnits(virtualQuantityUnits)); + } + + /** + * {@inheritDoc} + */ + @Override + public Builder weight(Integer weight) { + return Builder.class.cast(super.weight(weight)); + } + + @Override + public Builder fromResourceAllocationSettingData(ResourceAllocationSettingData in) { + return Builder.class.cast(super.fromResourceAllocationSettingData(in)); + } + } + + private final String ipAddress; + private final boolean primaryNetworkConnection; + private final String ipAddressingMode; + + public VCloudNetworkAdapter(String elementName, String instanceID, String caption, String description, + String address, String addressOnParent, String allocationUnits, Boolean automaticAllocation, + Boolean automaticDeallocation, ConsumerVisibility consumerVisibility, Long limit, + MappingBehavior mappingBehavior, String otherResourceType, String parent, String poolID, Long reservation, + String resourceSubType, org.jclouds.cim.ResourceAllocationSettingData.ResourceType resourceType, + Long virtualQuantity, String virtualQuantityUnits, Integer weight, List<String> connections, + List<String> hostResources, String ipAddress, boolean primaryNetworkConnection, String ipAddressingMode) { + super(elementName, instanceID, caption, description, address, addressOnParent, allocationUnits, + automaticAllocation, automaticDeallocation, consumerVisibility, limit, mappingBehavior, + otherResourceType, parent, poolID, reservation, resourceSubType, resourceType, virtualQuantity, + virtualQuantityUnits, weight, connections, hostResources); + this.ipAddress = ipAddress; + this.primaryNetworkConnection = primaryNetworkConnection; + this.ipAddressingMode = ipAddressingMode; + } + + public String getIpAddress() { + return ipAddress; + } + + public boolean isPrimaryNetworkConnection() { + return primaryNetworkConnection; + } + + public String getIpAddressingMode() { + return ipAddressingMode; + } + + @Override + public String toString() { + return String + .format( + "[elementName=%s, instanceID=%s, caption=%s, description=%s, address=%s, addressOnParent=%s, allocationUnits=%s, automaticAllocation=%s, automaticDeallocation=%s, connections=%s, consumerVisibility=%s, hostResources=%s, limit=%s, mappingBehavior=%s, otherResourceType=%s, parent=%s, poolID=%s, reservation=%s, resourceSubType=%s, resourceType=%s, virtualQuantity=%s, virtualQuantityUnits=%s, weight=%s, ipAddressingMode=%s, primaryNetworkConnection=%s, ipAddress=%s]", + elementName, instanceID, caption, description, address, addressOnParent, allocationUnits, + automaticAllocation, automaticDeallocation, connections, consumerVisibility, hostResources, + limit, mappingBehavior, otherResourceType, parent, poolID, reservation, resourceSubType, + resourceType, virtualQuantity, virtualQuantityUnits, weight, ipAddressingMode, + primaryNetworkConnection, ipAddress); + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/ovf/VCloudNetworkSection.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/ovf/VCloudNetworkSection.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/ovf/VCloudNetworkSection.java new file mode 100644 index 0000000..64dddc5 --- /dev/null +++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/ovf/VCloudNetworkSection.java @@ -0,0 +1,80 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF 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.domain.ovf; + +import java.net.URI; + +import org.jclouds.ovf.Network; +import org.jclouds.ovf.NetworkSection; + +/** + * VCloud extension + */ +public class VCloudNetworkSection extends NetworkSection { + protected final String type; + protected final URI href; + + public VCloudNetworkSection(String type, URI href, String info, Iterable<Network> networks) { + super(info, networks); + this.type = type; + this.href = href; + } + + public String getType() { + return type; + } + + public URI getHref() { + return href; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = super.hashCode(); + result = prime * result + ((href == null) ? 0 : href.hashCode()); + result = prime * result + ((type == null) ? 0 : type.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (!super.equals(obj)) + return false; + if (getClass() != obj.getClass()) + return false; + VCloudNetworkSection other = (VCloudNetworkSection) obj; + if (href == null) { + if (other.href != null) + return false; + } else if (!href.equals(other.href)) + return false; + if (type == null) { + if (other.type != null) + return false; + } else if (!type.equals(other.type)) + return false; + return true; + } + + @Override + public String toString() { + return "[href=" + getHref() + ", type=" + getType() + ", info=" + getInfo() + ", networks=" + getNetworks() + "]"; + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/ovf/VCloudOperatingSystemSection.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/ovf/VCloudOperatingSystemSection.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/ovf/VCloudOperatingSystemSection.java new file mode 100644 index 0000000..052eadd --- /dev/null +++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/ovf/VCloudOperatingSystemSection.java @@ -0,0 +1,118 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF 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.domain.ovf; + +import static com.google.common.base.Preconditions.checkNotNull; + +import java.net.URI; + +import org.jclouds.javax.annotation.Nullable; +import org.jclouds.ovf.OperatingSystemSection; +import org.jclouds.vcloud.domain.ReferenceType; + +/** + * A description of the operating system supported by a virtual machine. + */ +public class VCloudOperatingSystemSection extends OperatingSystemSection { + protected final String type; + protected final URI href; + @Nullable + protected final String vmwOsType; + protected final ReferenceType edit; + + public VCloudOperatingSystemSection(@Nullable Integer id, @Nullable String info, @Nullable String description, String type, + URI href, @Nullable String vmwOsType, ReferenceType edit) { + super(id, info, description); + this.type = type; + this.href = href; + this.vmwOsType = vmwOsType; + this.edit = checkNotNull(edit, "edit"); + } + + public String getType() { + return type; + } + + public URI getHref() { + return href; + } + + /** + * + * @return VMware osType, if running on VMware + */ + public String getVmwOsType() { + return vmwOsType; + } + + /** + * + * @return edit link + */ + public ReferenceType getEdit() { + return edit; + } + + @Override + public String toString() { + return "[href=" + getHref() + ", type=" + getType() + ", id=" + getId() + ", vmwOsType=" + getVmwOsType() + + ", description=" + getDescription() + "]"; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = super.hashCode(); + result = prime * result + ((edit == null) ? 0 : edit.hashCode()); + result = prime * result + ((href == null) ? 0 : href.hashCode()); + result = prime * result + ((type == null) ? 0 : type.hashCode()); + result = prime * result + ((vmwOsType == null) ? 0 : vmwOsType.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (!super.equals(obj)) + return false; + if (getClass() != obj.getClass()) + return false; + VCloudOperatingSystemSection other = (VCloudOperatingSystemSection) obj; + if (edit == null) { + if (other.edit != null) + return false; + } else if (!edit.equals(other.edit)) + return false; + if (href == null) { + if (other.href != null) + return false; + } else if (!href.equals(other.href)) + return false; + if (type == null) { + if (other.type != null) + return false; + } else if (!type.equals(other.type)) + return false; + if (vmwOsType == null) { + if (other.vmwOsType != null) + return false; + } else if (!vmwOsType.equals(other.vmwOsType)) + return false; + return true; + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/ovf/VCloudVirtualHardwareSection.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/ovf/VCloudVirtualHardwareSection.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/ovf/VCloudVirtualHardwareSection.java new file mode 100644 index 0000000..6d89b95 --- /dev/null +++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/ovf/VCloudVirtualHardwareSection.java @@ -0,0 +1,179 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF 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.domain.ovf; + +import java.net.URI; + +import org.jclouds.cim.ResourceAllocationSettingData; +import org.jclouds.cim.VirtualSystemSettingData; +import org.jclouds.ovf.Section; +import org.jclouds.ovf.VirtualHardwareSection; + +/** + * A description of the virtual hardware supported by a virtual machine. + */ +public class VCloudVirtualHardwareSection extends VirtualHardwareSection { + public static Builder builder() { + return new Builder(); + } + + /** + * {@inheritDoc} + */ + @Override + public Builder toBuilder() { + return builder().fromVCloudVirtualHardwareSection(this); + } + + public static class Builder extends VirtualHardwareSection.Builder { + protected String type; + protected URI href; + + /** + * @see VCloudVirtualHardware#getType + */ + public Builder type(String type) { + this.type = type; + return this; + } + + /** + * @see VCloudVirtualHardware#getHref + */ + public Builder href(URI href) { + this.href = href; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public Builder system(VirtualSystemSettingData virtualSystem) { + return Builder.class.cast(super.system(virtualSystem)); + } + + /** + * {@inheritDoc} + */ + @Override + public Builder transport(String transport) { + return Builder.class.cast(super.transport(transport)); + } + + /** + * {@inheritDoc} + */ + @Override + public Builder transports(Iterable<String> transports) { + return Builder.class.cast(super.transports(transports)); + } + + /** + * {@inheritDoc} + */ + @Override + public Builder item(ResourceAllocationSettingData item) { + return Builder.class.cast(super.item(item)); + } + + /** + * {@inheritDoc} + */ + @Override + public Builder items(Iterable<? extends ResourceAllocationSettingData> items) { + return Builder.class.cast(super.items(items)); + } + + /** + * {@inheritDoc} + */ + @Override + public VCloudVirtualHardwareSection build() { + return new VCloudVirtualHardwareSection(type, href, info, transports, virtualSystem, items); + } + + public Builder fromVCloudVirtualHardwareSection(VCloudVirtualHardwareSection in) { + return fromVirtualHardwareSection(in).type(in.getType()).href(in.getHref()); + } + + /** + * {@inheritDoc} + */ + @Override + public Builder fromVirtualHardwareSection(VirtualHardwareSection in) { + return Builder.class.cast(super.fromVirtualHardwareSection(in)); + } + + /** + * {@inheritDoc} + */ + @Override + public Builder fromSection(Section<VirtualHardwareSection> in) { + return Builder.class.cast(super.fromSection(in)); + } + + /** + * {@inheritDoc} + */ + @Override + public Builder info(String info) { + return Builder.class.cast(super.info(info)); + } + } + + protected final String type; + protected final URI href; + + public VCloudVirtualHardwareSection(String type, URI href, String info, Iterable<String> transports, + VirtualSystemSettingData virtualSystem, Iterable<? extends ResourceAllocationSettingData> resourceAllocations) { + super(info, transports, virtualSystem, resourceAllocations); + this.type = type; + this.href = href; + } + + public String getType() { + return type; + } + + public URI getHref() { + return href; + } + + @Override + public int hashCode() { + return href.hashCode(); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (!super.equals(obj)) + return false; + if (getClass() != obj.getClass()) + return false; + VCloudVirtualHardwareSection other = (VCloudVirtualHardwareSection) obj; + return href.equals(other.href); + } + + @Override + public String toString() { + return "[href=" + getHref() + ", type=" + getType() + ", info=" + getInfo() + ", virtualSystem=" + getSystem() + + "]"; + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/endpoints/Catalog.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/endpoints/Catalog.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/endpoints/Catalog.java new file mode 100644 index 0000000..7b59d1e --- /dev/null +++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/endpoints/Catalog.java @@ -0,0 +1,34 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF 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.endpoints; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +import javax.inject.Qualifier; + +/** + * Related to a VCloud Catalog. + */ +@Retention(value = RetentionPolicy.RUNTIME) +@Target(value = { ElementType.TYPE, ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD }) +@Qualifier +public @interface Catalog { + +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/endpoints/Network.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/endpoints/Network.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/endpoints/Network.java new file mode 100644 index 0000000..f30162e --- /dev/null +++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/endpoints/Network.java @@ -0,0 +1,34 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF 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.endpoints; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +import javax.inject.Qualifier; + +/** + * Related to a VCloud Network. + */ +@Retention(value = RetentionPolicy.RUNTIME) +@Target(value = { ElementType.TYPE, ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD }) +@Qualifier +public @interface Network { + +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/endpoints/Org.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/endpoints/Org.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/endpoints/Org.java new file mode 100644 index 0000000..167b1ee --- /dev/null +++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/endpoints/Org.java @@ -0,0 +1,34 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF 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.endpoints; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +import javax.inject.Qualifier; + +/** + * Related to a VCloud express Org. + */ +@Retention(value = RetentionPolicy.RUNTIME) +@Target(value = { ElementType.TYPE, ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD }) +@Qualifier +public @interface Org { + +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/endpoints/OrgList.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/endpoints/OrgList.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/endpoints/OrgList.java new file mode 100644 index 0000000..5e0caab --- /dev/null +++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/endpoints/OrgList.java @@ -0,0 +1,34 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF 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.endpoints; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +import javax.inject.Qualifier; + +/** + * Related to a VCloud express Org List. + */ +@Retention(value = RetentionPolicy.RUNTIME) +@Target(value = { ElementType.TYPE, ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD }) +@Qualifier +public @interface OrgList { + +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/endpoints/TasksList.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/endpoints/TasksList.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/endpoints/TasksList.java new file mode 100644 index 0000000..333a39f --- /dev/null +++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/endpoints/TasksList.java @@ -0,0 +1,34 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF 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.endpoints; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +import javax.inject.Qualifier; + +/** + * Related to a VCloud express Task List. + */ +@Retention(value = RetentionPolicy.RUNTIME) +@Target(value = { ElementType.TYPE, ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD }) +@Qualifier +public @interface TasksList { + +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/endpoints/VCloudLogin.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/endpoints/VCloudLogin.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/endpoints/VCloudLogin.java new file mode 100644 index 0000000..7d3124b --- /dev/null +++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/endpoints/VCloudLogin.java @@ -0,0 +1,36 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF 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.endpoints; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +import javax.inject.Qualifier; + +/** + * Represents a component related to vCloud. + * + * @see <a href="https://community.vcloudexpress.terremark.com/en-us/discussion_forums/f/60.aspx" /> + */ +@Retention(value = RetentionPolicy.RUNTIME) +@Target(value = { ElementType.TYPE, ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD }) +@Qualifier +public @interface VCloudLogin { + +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/endpoints/VDC.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/endpoints/VDC.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/endpoints/VDC.java new file mode 100644 index 0000000..193eb74 --- /dev/null +++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/endpoints/VDC.java @@ -0,0 +1,34 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF 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.endpoints; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +import javax.inject.Qualifier; + +/** + * Related to a VCloud express Catalog. + */ +@Retention(value = RetentionPolicy.RUNTIME) +@Target(value = {ElementType.TYPE, ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD }) +@Qualifier +public @interface VDC { + +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/features/CatalogApi.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/features/CatalogApi.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/features/CatalogApi.java new file mode 100644 index 0000000..1aa660e --- /dev/null +++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/features/CatalogApi.java @@ -0,0 +1,143 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF 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.features; + +import static org.jclouds.vcloud.VCloudMediaType.CATALOGITEM_XML; +import static org.jclouds.vcloud.VCloudMediaType.CATALOG_XML; + +import java.net.URI; + +import javax.ws.rs.Consumes; +import javax.ws.rs.DELETE; +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; + +import org.jclouds.Fallbacks; +import org.jclouds.javax.annotation.Nullable; +import org.jclouds.rest.annotations.EndpointParam; +import org.jclouds.rest.annotations.Fallback; +import org.jclouds.rest.annotations.MapBinder; +import org.jclouds.rest.annotations.PayloadParam; +import org.jclouds.rest.annotations.RequestFilters; +import org.jclouds.rest.annotations.XMLResponseParser; +import org.jclouds.vcloud.binders.BindCatalogItemToXmlPayload; +import org.jclouds.vcloud.binders.OrgNameAndCatalogNameToEndpoint; +import org.jclouds.vcloud.binders.OrgNameCatalogNameItemNameToEndpoint; +import org.jclouds.vcloud.domain.Catalog; +import org.jclouds.vcloud.domain.CatalogItem; +import org.jclouds.vcloud.filters.AddVCloudAuthorizationAndCookieToRequest; +import org.jclouds.vcloud.options.CatalogItemOptions; +import org.jclouds.vcloud.xml.CatalogHandler; +import org.jclouds.vcloud.xml.CatalogItemHandler; + + +/** + * Provides access to Catalog functionality in vCloud + * <p/> + * + * @see <a href="http://communities.vmware.com/community/developer/forums/vcloudapi" /> + */ +@RequestFilters(AddVCloudAuthorizationAndCookieToRequest.class) +public interface CatalogApi { + + @GET + @XMLResponseParser(CatalogHandler.class) + @Fallback(Fallbacks.NullOnNotFoundOr404.class) + @Consumes(CATALOG_XML) + Catalog getCatalog(@EndpointParam URI catalogId); + + /** + * returns the catalog in the organization associated with the specified name. Note that both + * parameters can be null to choose default. + * + * @param orgName + * organization name, or null for the default + * @param catalogName + * catalog name, or null for the default + * @throws NoSuchElementException + * if you specified an org or catalog name that isn't present + */ + @GET + @XMLResponseParser(CatalogHandler.class) + @Fallback(Fallbacks.NullOnNotFoundOr404.class) + @Consumes(CATALOG_XML) + @MapBinder(OrgNameAndCatalogNameToEndpoint.class) + Catalog findCatalogInOrgNamed(@Nullable @PayloadParam("orgName") String orgName, + @Nullable @PayloadParam("catalogName") String catalogName); + + @GET + @Consumes(CATALOGITEM_XML) + @XMLResponseParser(CatalogItemHandler.class) + @Fallback(Fallbacks.NullOnNotFoundOr404.class) + CatalogItem getCatalogItem(@EndpointParam URI catalogItem); + + /** + * returns the catalog item in the catalog associated with the specified name. Note that the org + * and catalog parameters can be null to choose default. + * + * @param orgName + * organization name, or null for the default + * @param catalogName + * catalog name, or null for the default + * @param itemName + * item you wish to lookup + * + * @throws NoSuchElementException + * if you specified an org, catalog, or catalog item name that isn't present + */ + @GET + @Consumes(CATALOGITEM_XML) + @XMLResponseParser(CatalogItemHandler.class) + @Fallback(Fallbacks.NullOnNotFoundOr404.class) + @MapBinder(OrgNameCatalogNameItemNameToEndpoint.class) + CatalogItem findCatalogItemInOrgCatalogNamed(@Nullable @PayloadParam("orgName") String orgName, + @Nullable @PayloadParam("catalogName") String catalogName, + @PayloadParam("itemName") String itemName); + + /** + * A catalog can contain references to vApp templates and media images that have been uploaded to + * any vDC in an organization. A vApp template or media image can be listed in at most one + * catalog. + * + * @param entity + * the reference to the vApp templates and media image + * @param catalog + * URI of the catalog to add the resourceEntity from + * @param name + * name of the entry in the catalog + * + * @param options + * options such as description or properties + * @return the new catalog item + */ + @POST + @Path("/catalogItems") + @Consumes(CATALOGITEM_XML) + @Produces(CATALOGITEM_XML) + @MapBinder(BindCatalogItemToXmlPayload.class) + @XMLResponseParser(CatalogItemHandler.class) + CatalogItem addVAppTemplateOrMediaImageToCatalogAndNameItem(@PayloadParam("Entity") URI entity, + @EndpointParam URI catalog, + @PayloadParam("name") String name, + CatalogItemOptions... options); + + @DELETE + @Fallback(Fallbacks.VoidOnNotFoundOr404.class) + void deleteCatalogItem(@EndpointParam URI href); +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/features/NetworkApi.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/features/NetworkApi.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/features/NetworkApi.java new file mode 100644 index 0000000..d36e471 --- /dev/null +++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/features/NetworkApi.java @@ -0,0 +1,60 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF 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.features; + +import static org.jclouds.vcloud.VCloudMediaType.NETWORK_XML; + +import java.net.URI; + +import javax.ws.rs.Consumes; +import javax.ws.rs.GET; + +import org.jclouds.Fallbacks; +import org.jclouds.javax.annotation.Nullable; +import org.jclouds.rest.annotations.EndpointParam; +import org.jclouds.rest.annotations.Fallback; +import org.jclouds.rest.annotations.MapBinder; +import org.jclouds.rest.annotations.PayloadParam; +import org.jclouds.rest.annotations.RequestFilters; +import org.jclouds.rest.annotations.XMLResponseParser; +import org.jclouds.vcloud.binders.OrgNameVDCNameNetworkNameToEndpoint; +import org.jclouds.vcloud.domain.network.OrgNetwork; +import org.jclouds.vcloud.filters.AddVCloudAuthorizationAndCookieToRequest; +import org.jclouds.vcloud.xml.OrgNetworkHandler; + +/** + * Provides access to Network functionality in vCloud + * <p/> + */ +@RequestFilters(AddVCloudAuthorizationAndCookieToRequest.class) +public interface NetworkApi { + + @GET + @Consumes(NETWORK_XML) + @XMLResponseParser(OrgNetworkHandler.class) + @Fallback(Fallbacks.NullOnNotFoundOr404.class) + @MapBinder(OrgNameVDCNameNetworkNameToEndpoint.class) + OrgNetwork findNetworkInOrgVDCNamed(@Nullable @PayloadParam("orgName") String orgName, + @Nullable @PayloadParam("vdcName") String vdcName, + @PayloadParam("resourceName") String networkName); + + @GET + @Consumes(NETWORK_XML) + @XMLResponseParser(OrgNetworkHandler.class) + @Fallback(Fallbacks.NullOnNotFoundOr404.class) + OrgNetwork getNetwork(@EndpointParam URI network); +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/features/OrgApi.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/features/OrgApi.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/features/OrgApi.java new file mode 100644 index 0000000..3b7cf3a --- /dev/null +++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/features/OrgApi.java @@ -0,0 +1,84 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF 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.features; + +import static org.jclouds.vcloud.VCloudMediaType.ORG_XML; + +import java.net.URI; +import java.util.Map; + +import javax.ws.rs.Consumes; +import javax.ws.rs.GET; + +import org.jclouds.Fallbacks; +import org.jclouds.javax.annotation.Nullable; +import org.jclouds.rest.annotations.Endpoint; +import org.jclouds.rest.annotations.EndpointParam; +import org.jclouds.rest.annotations.Fallback; +import org.jclouds.rest.annotations.RequestFilters; +import org.jclouds.rest.annotations.XMLResponseParser; +import org.jclouds.vcloud.VCloudMediaType; +import org.jclouds.vcloud.domain.Org; +import org.jclouds.vcloud.domain.ReferenceType; +import org.jclouds.vcloud.endpoints.OrgList; +import org.jclouds.vcloud.filters.AddVCloudAuthorizationAndCookieToRequest; +import org.jclouds.vcloud.functions.OrgNameToEndpoint; +import org.jclouds.vcloud.xml.OrgHandler; +import org.jclouds.vcloud.xml.OrgListHandler; + + +/** + * Provides access to Org functionality in vCloud + * <p/> + */ +@RequestFilters(AddVCloudAuthorizationAndCookieToRequest.class) +public interface OrgApi { + + /** + * The response to a login request includes a list of the organizations to which the + * authenticated user has access. + * + * @return organizations indexed by name + */ + @GET + @Endpoint(OrgList.class) + @XMLResponseParser(OrgListHandler.class) + @Consumes(VCloudMediaType.ORGLIST_XML) + Map<String, ReferenceType> listOrgs(); + + @GET + @XMLResponseParser(OrgHandler.class) + @Fallback(Fallbacks.NullOnNotFoundOr404.class) + @Consumes(ORG_XML) + Org getOrg(@EndpointParam URI orgId); + + /** + * This call returns a list of all vCloud Data Centers (vdcs), catalogs, and task lists within + * the organization. + * + * @param name + * organization name, or null for the default + * @throws NoSuchElementException + * if you specified an org name that isn't present + */ + @GET + @XMLResponseParser(OrgHandler.class) + @Fallback(Fallbacks.NullOnNotFoundOr404.class) + @Consumes(ORG_XML) + Org findOrgNamed(@Nullable @EndpointParam(parser = OrgNameToEndpoint.class) String orgName); + +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/features/TaskApi.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/features/TaskApi.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/features/TaskApi.java new file mode 100644 index 0000000..b9a60a6 --- /dev/null +++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/features/TaskApi.java @@ -0,0 +1,80 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF 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.features; + +import static org.jclouds.vcloud.VCloudMediaType.TASKSLIST_XML; +import static org.jclouds.vcloud.VCloudMediaType.TASK_XML; + +import java.net.URI; + +import javax.ws.rs.Consumes; +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.Path; + +import org.jclouds.Fallbacks; +import org.jclouds.javax.annotation.Nullable; +import org.jclouds.rest.annotations.EndpointParam; +import org.jclouds.rest.annotations.Fallback; +import org.jclouds.rest.annotations.RequestFilters; +import org.jclouds.rest.annotations.XMLResponseParser; +import org.jclouds.vcloud.domain.Task; +import org.jclouds.vcloud.domain.TasksList; +import org.jclouds.vcloud.filters.AddVCloudAuthorizationAndCookieToRequest; +import org.jclouds.vcloud.functions.OrgNameToTasksListEndpoint; +import org.jclouds.vcloud.xml.TaskHandler; +import org.jclouds.vcloud.xml.TasksListHandler; + +/** + * Provides access to Task functionality in vCloud + * <p/> + */ +@RequestFilters(AddVCloudAuthorizationAndCookieToRequest.class) +public interface TaskApi { + + @GET + @Consumes(TASKSLIST_XML) + @XMLResponseParser(TasksListHandler.class) + @Fallback(Fallbacks.NullOnNotFoundOr404.class) + TasksList getTasksList(@EndpointParam URI tasksListId); + + @GET + @Consumes(TASKSLIST_XML) + @XMLResponseParser(TasksListHandler.class) + @Fallback(Fallbacks.NullOnNotFoundOr404.class) + TasksList findTasksListInOrgNamed(@Nullable @EndpointParam(parser = OrgNameToTasksListEndpoint.class) String orgName); + + /** + * Whenever the result of a request cannot be returned immediately, the server creates a Task + * object and includes it in the response, as a member of the Tasks container in the response + * body. Each Task has an href value, which is a URL that the client can use to retrieve the Task + * element alone, without the rest of the response in which it was contained. All information + * about the task is included in the Task element when it is returned in the responseâs Tasks + * container, so a client does not need to make an additional request to the Task URL unless it + * wants to follow the progress of a task that was incomplete. + */ + @GET + @Consumes(TASK_XML) + @XMLResponseParser(TaskHandler.class) + @Fallback(Fallbacks.NullOnNotFoundOr404.class) + Task getTask(@EndpointParam URI taskId); + + @POST + @Path("/action/cancel") + void cancelTask(@EndpointParam URI taskId); + +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/features/VAppApi.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/features/VAppApi.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/features/VAppApi.java new file mode 100644 index 0000000..af44c3e --- /dev/null +++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/features/VAppApi.java @@ -0,0 +1,260 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF 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.features; + +import static org.jclouds.vcloud.VCloudMediaType.DEPLOYVAPPPARAMS_XML; +import static org.jclouds.vcloud.VCloudMediaType.TASK_XML; +import static org.jclouds.vcloud.VCloudMediaType.UNDEPLOYVAPPPARAMS_XML; +import static org.jclouds.vcloud.VCloudMediaType.VAPP_XML; + +import java.net.URI; + +import javax.ws.rs.Consumes; +import javax.ws.rs.DELETE; +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; + +import org.jclouds.Fallbacks; +import org.jclouds.javax.annotation.Nullable; +import org.jclouds.predicates.validators.DnsNameValidator; +import org.jclouds.rest.annotations.EndpointParam; +import org.jclouds.rest.annotations.Fallback; +import org.jclouds.rest.annotations.MapBinder; +import org.jclouds.rest.annotations.ParamValidators; +import org.jclouds.rest.annotations.PayloadParam; +import org.jclouds.rest.annotations.PayloadParams; +import org.jclouds.rest.annotations.RequestFilters; +import org.jclouds.rest.annotations.XMLResponseParser; +import org.jclouds.vcloud.binders.BindCloneVAppParamsToXmlPayload; +import org.jclouds.vcloud.binders.BindDeployVAppParamsToXmlPayload; +import org.jclouds.vcloud.binders.BindUndeployVAppParamsToXmlPayload; +import org.jclouds.vcloud.binders.OrgNameVDCNameResourceEntityNameToEndpoint; +import org.jclouds.vcloud.domain.Task; +import org.jclouds.vcloud.domain.VApp; +import org.jclouds.vcloud.filters.AddVCloudAuthorizationAndCookieToRequest; +import org.jclouds.vcloud.options.CloneVAppOptions; +import org.jclouds.vcloud.xml.TaskHandler; +import org.jclouds.vcloud.xml.VAppHandler; + + +/** + * Provides access to VApp functionality in vCloud + * <p/> + * + * @see <a href="http://communities.vmware.com/community/developer/forums/vcloudapi" /> + */ +@RequestFilters(AddVCloudAuthorizationAndCookieToRequest.class) +public interface VAppApi { + @GET + @Consumes(VAPP_XML) + @XMLResponseParser(VAppHandler.class) + @Fallback(Fallbacks.NullOnNotFoundOr404.class) + @MapBinder(OrgNameVDCNameResourceEntityNameToEndpoint.class) + VApp findVAppInOrgVDCNamed(@Nullable @PayloadParam("orgName") String orgName, + @Nullable @PayloadParam("vdcName") String vdcName, @PayloadParam("resourceName") String vAppName); + + @POST + @Path("/action/cloneVApp") + @Produces("application/vnd.vmware.vcloud.cloneVAppParams+xml") + @Consumes(TASK_XML) + @XMLResponseParser(TaskHandler.class) + @MapBinder(BindCloneVAppParamsToXmlPayload.class) + Task copyVAppToVDCAndName(@PayloadParam("Source") URI sourceVApp, + @EndpointParam URI vdc, @PayloadParam("name") @ParamValidators(DnsNameValidator.class) String newName, + CloneVAppOptions... options); + + @POST + @Path("/action/cloneVApp") + @Produces("application/vnd.vmware.vcloud.cloneVAppParams+xml") + @Consumes(TASK_XML) + @XMLResponseParser(TaskHandler.class) + @PayloadParams(keys = "IsSourceDelete", values = "true") + @MapBinder(BindCloneVAppParamsToXmlPayload.class) + Task moveVAppToVDCAndRename(@PayloadParam("Source") URI sourceVApp, + @EndpointParam URI vdc, @PayloadParam("name") @ParamValidators(DnsNameValidator.class) String newName, + CloneVAppOptions... options); + + @GET + @Consumes(VAPP_XML) + @XMLResponseParser(VAppHandler.class) + @Fallback(Fallbacks.NullOnNotFoundOr404.class) + VApp getVApp(@EndpointParam URI href); + + /** + * To deploy a vApp, the client makes a request to its action/deploy URL. Deploying a vApp + * automatically deploys all of the virtual machines it contains. To deploy a virtual machine, + * the client makes a request to its action/deploy URL. + * <p/> + * Deploying a Vm implicitly deploys the parent vApp if that vApp is not already deployed. + */ + @POST + @Consumes(TASK_XML) + @Produces(DEPLOYVAPPPARAMS_XML) + @Path("/action/deploy") + @MapBinder(BindDeployVAppParamsToXmlPayload.class) + @XMLResponseParser(TaskHandler.class) + Task deployVApp(@EndpointParam URI href); + + /** + * like {@link #deployVApp(URI)}, except deploy transitions to power on state + * + */ + @POST + @Consumes(TASK_XML) + @Produces(DEPLOYVAPPPARAMS_XML) + @Path("/action/deploy") + @MapBinder(BindDeployVAppParamsToXmlPayload.class) + @PayloadParams(keys = "powerOn", values = "true") + @XMLResponseParser(TaskHandler.class) + Task deployAndPowerOnVApp(@EndpointParam URI href); + + /** + * Undeploying a vApp powers off or suspends any running virtual machines it contains, then frees + * the resources reserved for the vApp and sets the vAppâs deploy attribute to a value of false + * to indicate that it is not deployed. + * <p/> + * Undeploying a virtual machine powers off or suspends the virtual machine, then frees the + * resources reserved for it and sets the its deploy attribute to a value of false to indicate + * that it is not deployed. This operation has no effect on the containing vApp. + * <h4>NOTE</h4> + * Using this method will simply power off the vms. In order to save their state, use + * {@link #undeployAndSaveStateOf} + * + */ + @POST + @Consumes(TASK_XML) + @Produces(UNDEPLOYVAPPPARAMS_XML) + @Path("/action/undeploy") + @MapBinder(BindUndeployVAppParamsToXmlPayload.class) + @XMLResponseParser(TaskHandler.class) + Task undeployVApp(@EndpointParam URI href); + + /** + * like {@link #undeployVApp(URI)}, where the undeployed virtual machines are suspended and their + * suspend state saved + * + */ + @POST + @Consumes(TASK_XML) + @Produces(UNDEPLOYVAPPPARAMS_XML) + @Path("/action/undeploy") + @MapBinder(BindUndeployVAppParamsToXmlPayload.class) + @PayloadParams(keys = "saveState", values = "true") + @XMLResponseParser(TaskHandler.class) + Task undeployAndSaveStateOfVApp(@EndpointParam URI href); + + /** + * A powerOn request to a vApp URL powers on all of the virtual machines in the vApp, as + * specified in the vAppâs StartupSection field. + * <p/> + * A powerOn request to a virtual machine URL powers on the specified virtual machine and forces + * deployment of the parent vApp. + * <p/> + * <h4>NOTE</h4> A powerOn request to a vApp or virtual machine that is undeployed forces + * deployment. + */ + @POST + @Consumes(TASK_XML) + @Path("/power/action/powerOn") + @XMLResponseParser(TaskHandler.class) + Task powerOnVApp(@EndpointParam URI href); + + /** + * A powerOff request to a vApp URL powers off all of the virtual machines in the vApp, as + * specified in its StartupSection field. + * <p/> + * A powerOff request to a virtual machine URL powers off the specified virtual machine. + */ + @POST + @Consumes(TASK_XML) + @Path("/power/action/powerOff") + @XMLResponseParser(TaskHandler.class) + Task powerOffVApp(@EndpointParam URI href); + + /** + * A shutdown request to a vApp URL shuts down all of the virtual machines in the vApp, as + * specified in its StartupSection field. + * <p/> + * A shutdown request to a virtual machine URL shuts down the specified virtual machine. + * <p/> + * <h4>NOTE</h4Because this request sends a signal to the guest OS, the vCloud API cannot track + * the progress or verify the result of the requested operation. Hence, void is returned + */ + @POST + @Path("/power/action/shutdown") + void shutdownVApp(@EndpointParam URI href); + + /** + * A reset request to a vApp URL resets all of the virtual machines in the vApp, as specified in + * its StartupSection field. + * <p/> + * A reset request to a virtual machine URL resets the specified virtual machine. + */ + @POST + @Consumes(TASK_XML) + @Path("/power/action/reset") + @XMLResponseParser(TaskHandler.class) + Task resetVApp(@EndpointParam URI href); + + /** + * A reboot request to a vApp URL reboots all of the virtual machines in the vApp, as specified + * in its StartupSection field. + * <p/> + * A reboot request to a virtual machine URL reboots the specified virtual machine. + * <p/> + * <h4>NOTE</h4> Because this request sends a signal to the guest OS, the vCloud API cannot track + * the progress or verify the result of the requested operation. Hence, void is returned + */ + @POST + @Path("/power/action/reboot") + void rebootVApp(@EndpointParam URI href); + + /** + * A suspend request to a vApp URL suspends all of the virtual machines in the vApp, as specified + * in its StartupSection field. + * <p/> + * A suspend request to a virtual machine URL suspends the specified virtual machine. + */ + @POST + @Consumes(TASK_XML) + @Path("/power/action/suspend") + @XMLResponseParser(TaskHandler.class) + Task suspendVApp(@EndpointParam URI href); + + /** + * delete a vAppTemplate, vApp, or media image. You cannot delete an object if it is in use. Any + * object that is being copied or moved is in use. Other criteria that determine whether an + * object is in use depend on the object type. + * <ul> + * <li>A vApptemplate is in use if it is being instantiated. After instantiation is complete, the + * template is no longer in use.</li> + * <li>A vApp is in use if it is deployed.</li> + * <li>A media image is in use if it is inserted in a Vm.</li> + * </ul> + * + * @param href + * href of the vApp + * @return task of the operation in progress + */ + @DELETE + @Consumes(TASK_XML) + @Fallback(Fallbacks.VoidOnNotFoundOr404.class) + @XMLResponseParser(TaskHandler.class) + Task deleteVApp(@EndpointParam URI href); +}
