mirror of https://github.com/apache/jclouds.git
Issue 112: added initial support for hosting.com
git-svn-id: http://jclouds.googlecode.com/svn/trunk@2288 3d8758e0-26b5-11de-8745-db77d3ebf521
This commit is contained in:
parent
3aa7e73351
commit
1d3fa374c8
|
@ -38,6 +38,7 @@ 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.Endpoint;
|
||||
import org.jclouds.rest.annotations.RequestFilters;
|
||||
|
@ -67,6 +68,7 @@ public interface VCloudClient {
|
|||
@GET
|
||||
@Endpoint(org.jclouds.vcloud.endpoints.Catalog.class)
|
||||
@Consumes(CATALOG_XML)
|
||||
@Produces(CATALOG_XML)// required for hosting.com to operate
|
||||
@XMLResponseParser(CatalogHandler.class)
|
||||
Future<? extends Catalog> getCatalog();
|
||||
|
||||
|
|
|
@ -47,6 +47,7 @@ import org.jclouds.vcloud.endpoints.Org;
|
|||
import org.jclouds.vcloud.endpoints.VCloud;
|
||||
|
||||
import com.google.common.base.Supplier;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.inject.AbstractModule;
|
||||
import com.google.inject.Provides;
|
||||
|
||||
|
@ -72,7 +73,7 @@ public class VCloudDiscoveryRestClientModule extends AbstractModule {
|
|||
@Org
|
||||
@Singleton
|
||||
protected URI provideOrg(Supplier<VCloudSession> cache, @Named(PROPERTY_VCLOUD_USER) String user) {
|
||||
return cache.get().getOrgs().get(user).getLocation();
|
||||
return Iterables.getLast(cache.get().getOrgs().values()).getLocation();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -0,0 +1,84 @@
|
|||
/**
|
||||
*
|
||||
* Copyright (C) 2009 Cloud Conscious, LLC. <info@cloudconscious.com>
|
||||
*
|
||||
* ====================================================================
|
||||
* 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;
|
||||
|
||||
|
||||
/**
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
public class Capacity {
|
||||
|
||||
private final String units;
|
||||
private final int allocated;
|
||||
private final int used;
|
||||
|
||||
public Capacity(String units, int allocated, int used) {
|
||||
this.units = units;
|
||||
this.allocated = allocated;
|
||||
this.used = used;
|
||||
}
|
||||
|
||||
public String getUnits() {
|
||||
return units;
|
||||
}
|
||||
|
||||
public int getAllocated() {
|
||||
return allocated;
|
||||
}
|
||||
|
||||
public int getUsed() {
|
||||
return used;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + allocated;
|
||||
result = prime * result + ((units == null) ? 0 : units.hashCode());
|
||||
result = prime * result + used;
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
Capacity other = (Capacity) obj;
|
||||
if (allocated != other.allocated)
|
||||
return false;
|
||||
if (units == null) {
|
||||
if (other.units != null)
|
||||
return false;
|
||||
} else if (!units.equals(other.units))
|
||||
return false;
|
||||
if (used != other.used)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -23,9 +23,9 @@
|
|||
*/
|
||||
package org.jclouds.vcloud.domain;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Map;
|
||||
|
||||
import org.jclouds.rest.domain.NamedLink;
|
||||
import org.jclouds.vcloud.domain.internal.CatalogImpl;
|
||||
|
||||
import com.google.inject.ImplementedBy;
|
||||
|
@ -35,6 +35,10 @@ import com.google.inject.ImplementedBy;
|
|||
*/
|
||||
@org.jclouds.vcloud.endpoints.Catalog
|
||||
@ImplementedBy(CatalogImpl.class)
|
||||
public interface Catalog extends NamedLink, Map<String, NamedResource> {
|
||||
public interface Catalog extends Map<String, NamedResource> {
|
||||
String getName();
|
||||
|
||||
String getDescription();
|
||||
|
||||
URI getLocation();
|
||||
}
|
|
@ -23,6 +23,7 @@
|
|||
*/
|
||||
package org.jclouds.vcloud.domain;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Map;
|
||||
|
||||
import org.jclouds.rest.domain.Link;
|
||||
|
@ -40,7 +41,12 @@ import com.google.inject.ImplementedBy;
|
|||
*/
|
||||
@Org
|
||||
@ImplementedBy(OrganizationImpl.class)
|
||||
public interface Organization extends NamedLink {
|
||||
public interface Organization {
|
||||
String getName();
|
||||
|
||||
int getId();
|
||||
|
||||
URI getLocation();
|
||||
|
||||
@Catalog
|
||||
Link getCatalog();
|
||||
|
|
|
@ -0,0 +1,71 @@
|
|||
/**
|
||||
*
|
||||
* Copyright (C) 2009 Cloud Conscious, LLC. <info@cloudconscious.com>
|
||||
*
|
||||
* ====================================================================
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
public class Quota {
|
||||
|
||||
private final int limit;
|
||||
private final int used;
|
||||
|
||||
public Quota(int limit, int used) {
|
||||
this.limit = limit;
|
||||
this.used = used;
|
||||
}
|
||||
|
||||
public int getLimit() {
|
||||
return limit;
|
||||
}
|
||||
|
||||
public int getUsed() {
|
||||
return used;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + limit;
|
||||
result = prime * result + used;
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
Quota other = (Quota) obj;
|
||||
if (limit != other.limit)
|
||||
return false;
|
||||
if (used != other.used)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -23,6 +23,7 @@
|
|||
*/
|
||||
package org.jclouds.vcloud.domain;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Map;
|
||||
|
||||
import org.jclouds.rest.domain.NamedLink;
|
||||
|
@ -35,7 +36,25 @@ import com.google.inject.ImplementedBy;
|
|||
*/
|
||||
@org.jclouds.vcloud.endpoints.VDC
|
||||
@ImplementedBy(VDCImpl.class)
|
||||
public interface VDC extends NamedLink {
|
||||
public interface VDC {
|
||||
|
||||
String getName();
|
||||
|
||||
int getId();
|
||||
|
||||
URI getLocation();
|
||||
|
||||
String getDescription();
|
||||
|
||||
Capacity getStorageCapacity();
|
||||
|
||||
Capacity getCpuCapacity();
|
||||
|
||||
Capacity getMemoryCapacity();
|
||||
|
||||
Quota getInstantiatedVmsQuota();
|
||||
|
||||
Quota getDeployedVmsQuota();
|
||||
|
||||
Map<String, NamedLink> getAvailableNetworks();
|
||||
|
||||
|
|
|
@ -29,11 +29,11 @@ import java.net.URI;
|
|||
import java.util.SortedMap;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import org.jclouds.rest.domain.NamedLink;
|
||||
import org.jclouds.rest.domain.internal.NamedLinkImpl;
|
||||
import org.jclouds.vcloud.domain.Catalog;
|
||||
import org.jclouds.vcloud.domain.NamedResource;
|
||||
|
||||
import com.google.inject.internal.Nullable;
|
||||
|
||||
/**
|
||||
* Locations of resources in vCloud
|
||||
*
|
||||
|
@ -44,33 +44,34 @@ public class CatalogImpl extends TreeMap<String, NamedResource> implements Catal
|
|||
|
||||
/** The serialVersionUID */
|
||||
private static final long serialVersionUID = 8464716396538298809L;
|
||||
private final NamedLink catalog;
|
||||
private final String name;
|
||||
private final String description;
|
||||
private final URI location;
|
||||
|
||||
public CatalogImpl(String name, String type, URI location,
|
||||
public CatalogImpl(String name, URI location, @Nullable String description,
|
||||
SortedMap<String, NamedResource> contents) {
|
||||
super();
|
||||
this.catalog = new NamedLinkImpl(checkNotNull(name, "name"), checkNotNull(type, "type"),
|
||||
checkNotNull(location, "location"));
|
||||
this.name = checkNotNull(name, "name");
|
||||
this.description = description;
|
||||
this.location = checkNotNull(location, "location");
|
||||
putAll(checkNotNull(contents, "contents"));
|
||||
}
|
||||
|
||||
public URI getLocation() {
|
||||
return catalog.getLocation();
|
||||
return location;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return catalog.getName();
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return catalog.getType();
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = super.hashCode();
|
||||
result = prime * result + ((catalog == null) ? 0 : catalog.hashCode());
|
||||
result = prime * result + ((description == null) ? 0 : description.hashCode());
|
||||
result = prime * result + ((location == null) ? 0 : location.hashCode());
|
||||
result = prime * result + ((name == null) ? 0 : name.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -83,12 +84,26 @@ public class CatalogImpl extends TreeMap<String, NamedResource> implements Catal
|
|||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
CatalogImpl other = (CatalogImpl) obj;
|
||||
if (catalog == null) {
|
||||
if (other.catalog != null)
|
||||
if (description == null) {
|
||||
if (other.description != null)
|
||||
return false;
|
||||
} else if (!catalog.equals(other.catalog))
|
||||
} else if (!description.equals(other.description))
|
||||
return false;
|
||||
if (location == null) {
|
||||
if (other.location != null)
|
||||
return false;
|
||||
} else if (!location.equals(other.location))
|
||||
return false;
|
||||
if (name == null) {
|
||||
if (other.name != null)
|
||||
return false;
|
||||
} else if (!name.equals(other.name))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
}
|
|
@ -27,7 +27,6 @@ import java.net.URI;
|
|||
import java.util.Map;
|
||||
|
||||
import org.jclouds.rest.domain.NamedLink;
|
||||
import org.jclouds.rest.domain.internal.NamedLinkImpl;
|
||||
import org.jclouds.vcloud.domain.Organization;
|
||||
import org.jclouds.vcloud.endpoints.Catalog;
|
||||
import org.jclouds.vcloud.endpoints.TasksList;
|
||||
|
@ -39,20 +38,36 @@ import org.jclouds.vcloud.endpoints.VDC;
|
|||
* @author Adrian Cole
|
||||
*
|
||||
*/
|
||||
public class OrganizationImpl extends NamedLinkImpl implements Organization {
|
||||
|
||||
public class OrganizationImpl implements Organization {
|
||||
private final int id;
|
||||
private final String name;
|
||||
private final URI location;
|
||||
private final NamedLink catalog;
|
||||
private final Map<String, NamedLink> vdcs;
|
||||
private final Map<String, NamedLink> tasksLists;
|
||||
|
||||
public OrganizationImpl(String name, String type, URI location, NamedLink catalog,
|
||||
public OrganizationImpl(int id, String name, URI location, NamedLink catalog,
|
||||
Map<String, NamedLink> vdcs, Map<String, NamedLink> tasksLists) {
|
||||
super(name, type, location);
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.location = location;
|
||||
this.catalog = catalog;
|
||||
this.vdcs = vdcs;
|
||||
this.tasksLists = tasksLists;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public URI getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
@Catalog
|
||||
public NamedLink getCatalog() {
|
||||
return catalog;
|
||||
|
@ -71,8 +86,11 @@ public class OrganizationImpl extends NamedLinkImpl implements Organization {
|
|||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = super.hashCode();
|
||||
int result = 1;
|
||||
result = prime * result + ((catalog == null) ? 0 : catalog.hashCode());
|
||||
result = prime * result + id;
|
||||
result = prime * result + ((location == null) ? 0 : location.hashCode());
|
||||
result = prime * result + ((name == null) ? 0 : name.hashCode());
|
||||
result = prime * result + ((tasksLists == null) ? 0 : tasksLists.hashCode());
|
||||
result = prime * result + ((vdcs == null) ? 0 : vdcs.hashCode());
|
||||
return result;
|
||||
|
@ -82,7 +100,7 @@ public class OrganizationImpl extends NamedLinkImpl implements Organization {
|
|||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (!super.equals(obj))
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
|
@ -92,6 +110,18 @@ public class OrganizationImpl extends NamedLinkImpl implements Organization {
|
|||
return false;
|
||||
} else if (!catalog.equals(other.catalog))
|
||||
return false;
|
||||
if (id != other.id)
|
||||
return false;
|
||||
if (location == null) {
|
||||
if (other.location != null)
|
||||
return false;
|
||||
} else if (!location.equals(other.location))
|
||||
return false;
|
||||
if (name == null) {
|
||||
if (other.name != null)
|
||||
return false;
|
||||
} else if (!name.equals(other.name))
|
||||
return false;
|
||||
if (tasksLists == null) {
|
||||
if (other.tasksLists != null)
|
||||
return false;
|
||||
|
@ -105,4 +135,5 @@ public class OrganizationImpl extends NamedLinkImpl implements Organization {
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -29,7 +29,8 @@ import java.net.URI;
|
|||
import java.util.Map;
|
||||
|
||||
import org.jclouds.rest.domain.NamedLink;
|
||||
import org.jclouds.rest.domain.internal.NamedLinkImpl;
|
||||
import org.jclouds.vcloud.domain.Capacity;
|
||||
import org.jclouds.vcloud.domain.Quota;
|
||||
import org.jclouds.vcloud.domain.VDC;
|
||||
|
||||
/**
|
||||
|
@ -38,17 +39,54 @@ import org.jclouds.vcloud.domain.VDC;
|
|||
* @author Adrian Cole
|
||||
*
|
||||
*/
|
||||
public class VDCImpl extends NamedLinkImpl implements VDC {
|
||||
public class VDCImpl implements VDC {
|
||||
|
||||
private final int id;
|
||||
private final String name;
|
||||
private final URI location;
|
||||
private final String description;
|
||||
private final Capacity storageCapacity;
|
||||
private final Capacity cpuCapacity;
|
||||
private final Capacity memoryCapacity;
|
||||
private final Quota instantiatedVmsQuota;
|
||||
private final Quota deployedVmsQuota;
|
||||
private final Map<String, NamedLink> availableNetworks;
|
||||
private final Map<String, NamedLink> resourceEntities;
|
||||
|
||||
public VDCImpl(int id, String name, URI location, String description, Capacity storageCapacity,
|
||||
Capacity cpuCapacity, Capacity memoryCapacity, Quota instantiatedVmsQuota,
|
||||
Quota deployedVmsQuota, Map<String, NamedLink> resourceEntities,
|
||||
Map<String, NamedLink> availableNetworks) {
|
||||
this.id = id;
|
||||
this.name = checkNotNull(name, "name");
|
||||
;
|
||||
this.location = checkNotNull(location, "location");
|
||||
;
|
||||
this.description = description;
|
||||
this.storageCapacity = storageCapacity;
|
||||
this.cpuCapacity = cpuCapacity;
|
||||
this.memoryCapacity = memoryCapacity;
|
||||
this.instantiatedVmsQuota = instantiatedVmsQuota;
|
||||
this.deployedVmsQuota = deployedVmsQuota;
|
||||
this.availableNetworks = checkNotNull(availableNetworks, "availableNetworks");
|
||||
;
|
||||
this.resourceEntities = checkNotNull(resourceEntities, "resourceEntities");
|
||||
;
|
||||
}
|
||||
|
||||
/** The serialVersionUID */
|
||||
private static final long serialVersionUID = 8464716396538298809L;
|
||||
|
||||
public VDCImpl(String name, String type, URI location, Map<String, NamedLink> resourceEntities,
|
||||
Map<String, NamedLink> availableNetworks) {
|
||||
super(name, type, location);
|
||||
this.availableNetworks = checkNotNull(availableNetworks, "availableNetworks");
|
||||
this.resourceEntities = checkNotNull(resourceEntities, "resourceEntities");
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public URI getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
public Map<String, NamedLink> getAvailableNetworks() {
|
||||
|
@ -62,9 +100,19 @@ public class VDCImpl extends NamedLinkImpl implements VDC {
|
|||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = super.hashCode();
|
||||
int result = 1;
|
||||
result = prime * result + ((availableNetworks == null) ? 0 : availableNetworks.hashCode());
|
||||
result = prime * result + ((cpuCapacity == null) ? 0 : cpuCapacity.hashCode());
|
||||
result = prime * result + ((deployedVmsQuota == null) ? 0 : deployedVmsQuota.hashCode());
|
||||
result = prime * result + ((description == null) ? 0 : description.hashCode());
|
||||
result = prime * result + id;
|
||||
result = prime * result
|
||||
+ ((instantiatedVmsQuota == null) ? 0 : instantiatedVmsQuota.hashCode());
|
||||
result = prime * result + ((location == null) ? 0 : location.hashCode());
|
||||
result = prime * result + ((memoryCapacity == null) ? 0 : memoryCapacity.hashCode());
|
||||
result = prime * result + ((name == null) ? 0 : name.hashCode());
|
||||
result = prime * result + ((resourceEntities == null) ? 0 : resourceEntities.hashCode());
|
||||
result = prime * result + ((storageCapacity == null) ? 0 : storageCapacity.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -72,7 +120,7 @@ public class VDCImpl extends NamedLinkImpl implements VDC {
|
|||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (!super.equals(obj))
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
|
@ -82,12 +130,77 @@ public class VDCImpl extends NamedLinkImpl implements VDC {
|
|||
return false;
|
||||
} else if (!availableNetworks.equals(other.availableNetworks))
|
||||
return false;
|
||||
if (cpuCapacity == null) {
|
||||
if (other.cpuCapacity != null)
|
||||
return false;
|
||||
} else if (!cpuCapacity.equals(other.cpuCapacity))
|
||||
return false;
|
||||
if (deployedVmsQuota == null) {
|
||||
if (other.deployedVmsQuota != null)
|
||||
return false;
|
||||
} else if (!deployedVmsQuota.equals(other.deployedVmsQuota))
|
||||
return false;
|
||||
if (description == null) {
|
||||
if (other.description != null)
|
||||
return false;
|
||||
} else if (!description.equals(other.description))
|
||||
return false;
|
||||
if (id != other.id)
|
||||
return false;
|
||||
if (instantiatedVmsQuota == null) {
|
||||
if (other.instantiatedVmsQuota != null)
|
||||
return false;
|
||||
} else if (!instantiatedVmsQuota.equals(other.instantiatedVmsQuota))
|
||||
return false;
|
||||
if (location == null) {
|
||||
if (other.location != null)
|
||||
return false;
|
||||
} else if (!location.equals(other.location))
|
||||
return false;
|
||||
if (memoryCapacity == null) {
|
||||
if (other.memoryCapacity != null)
|
||||
return false;
|
||||
} else if (!memoryCapacity.equals(other.memoryCapacity))
|
||||
return false;
|
||||
if (name == null) {
|
||||
if (other.name != null)
|
||||
return false;
|
||||
} else if (!name.equals(other.name))
|
||||
return false;
|
||||
if (resourceEntities == null) {
|
||||
if (other.resourceEntities != null)
|
||||
return false;
|
||||
} else if (!resourceEntities.equals(other.resourceEntities))
|
||||
return false;
|
||||
if (storageCapacity == null) {
|
||||
if (other.storageCapacity != null)
|
||||
return false;
|
||||
} else if (!storageCapacity.equals(other.storageCapacity))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public Capacity getStorageCapacity() {
|
||||
return storageCapacity;
|
||||
}
|
||||
|
||||
public Capacity getCpuCapacity() {
|
||||
return cpuCapacity;
|
||||
}
|
||||
|
||||
public Capacity getMemoryCapacity() {
|
||||
return memoryCapacity;
|
||||
}
|
||||
|
||||
public Quota getInstantiatedVmsQuota() {
|
||||
return instantiatedVmsQuota;
|
||||
}
|
||||
|
||||
public Quota getDeployedVmsQuota() {
|
||||
return deployedVmsQuota;
|
||||
}
|
||||
}
|
|
@ -29,6 +29,8 @@ import java.net.URI;
|
|||
import java.util.Map;
|
||||
|
||||
import org.jclouds.rest.domain.NamedLink;
|
||||
import org.jclouds.vcloud.domain.Capacity;
|
||||
import org.jclouds.vcloud.domain.Quota;
|
||||
import org.jclouds.vcloud.domain.internal.VDCImpl;
|
||||
import org.jclouds.vcloud.terremark.domain.TerremarkVDC;
|
||||
|
||||
|
@ -47,10 +49,13 @@ public class TerremarkVDCImpl extends VDCImpl implements TerremarkVDC {
|
|||
/** The serialVersionUID */
|
||||
private static final long serialVersionUID = 8464716396538298809L;
|
||||
|
||||
public TerremarkVDCImpl(String name, String type, URI location,
|
||||
Map<String, NamedLink> availableNetworks, Map<String, NamedLink> resourceEntities, NamedLink catalog,
|
||||
NamedLink publicIps, NamedLink internetServices) {
|
||||
super(name, type, location, availableNetworks, resourceEntities);
|
||||
public TerremarkVDCImpl(int id, String name, URI location, String description,
|
||||
Capacity storageCapacity, Capacity cpuCapacity, Capacity memoryCapacity,
|
||||
Quota instantiatedVmsQuota, Quota deployedVmsQuota,
|
||||
Map<String, NamedLink> availableNetworks, Map<String, NamedLink> resourceEntities,
|
||||
NamedLink catalog, NamedLink publicIps, NamedLink internetServices) {
|
||||
super(id, name, location, description, storageCapacity, cpuCapacity, memoryCapacity,
|
||||
instantiatedVmsQuota, deployedVmsQuota, availableNetworks, resourceEntities);
|
||||
this.catalog = checkNotNull(catalog, "catalog");
|
||||
this.publicIps = checkNotNull(publicIps, "publicIps");
|
||||
this.internetServices = checkNotNull(internetServices, "internetServices");
|
||||
|
|
|
@ -44,7 +44,9 @@ public class TerremarkVDCHandler extends VDCHandler {
|
|||
|
||||
public TerremarkVDC getResult() {
|
||||
VDC vDC = super.getResult();
|
||||
return new TerremarkVDCImpl(vDC.getName(), vDC.getType(), vDC.getLocation(), vDC
|
||||
return new TerremarkVDCImpl(vDC.getId(), vDC.getName(), vDC.getLocation(), vDC
|
||||
.getDescription(), vDC.getStorageCapacity(), vDC.getCpuCapacity(), vDC
|
||||
.getMemoryCapacity(), vDC.getInstantiatedVmsQuota(), vDC.getDeployedVmsQuota(), vDC
|
||||
.getResourceEntities(), vDC.getAvailableNetworks(), catalog, publicIps,
|
||||
internetServices);
|
||||
}
|
||||
|
|
|
@ -46,14 +46,18 @@ import com.google.common.collect.Maps;
|
|||
* @author Adrian Cole
|
||||
*/
|
||||
public class CatalogHandler extends ParseSax.HandlerWithResult<Catalog> {
|
||||
private StringBuilder currentText = new StringBuilder();
|
||||
|
||||
private NamedLink Catalog;
|
||||
private SortedMap<String, NamedResource> contents = Maps.newTreeMap();
|
||||
@Inject
|
||||
@CatalogItemRoot
|
||||
private String catalogItemRoot;
|
||||
|
||||
private String description;
|
||||
|
||||
public Catalog getResult() {
|
||||
return new CatalogImpl(Catalog.getName(), Catalog.getType(), Catalog.getLocation(), contents);
|
||||
return new CatalogImpl(Catalog.getName(), Catalog.getLocation(), description, contents);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -68,15 +72,31 @@ public class CatalogHandler extends ParseSax.HandlerWithResult<Catalog> {
|
|||
}
|
||||
}
|
||||
|
||||
public void endElement(String uri, String name, String qName) {
|
||||
if (qName.equals("Description")) {
|
||||
description = currentOrNull();
|
||||
}
|
||||
currentText = new StringBuilder();
|
||||
}
|
||||
|
||||
public void characters(char ch[], int start, int length) {
|
||||
currentText.append(ch, start, length);
|
||||
}
|
||||
|
||||
public NamedResource newNamedResource(Attributes attributes) {
|
||||
return new NamedResourceImpl(Integer.parseInt(attributes
|
||||
.getValue(attributes.getIndex("href")).replace(catalogItemRoot+"/", "")), attributes
|
||||
.getValue(attributes.getIndex("name")), attributes.getValue(attributes
|
||||
.getIndex("type")), URI.create(attributes.getValue(attributes.getIndex("href"))));
|
||||
.getValue(attributes.getIndex("href")).replace(catalogItemRoot + "/", "")),
|
||||
attributes.getValue(attributes.getIndex("name")), attributes.getValue(attributes
|
||||
.getIndex("type")), URI.create(attributes.getValue(attributes
|
||||
.getIndex("href"))));
|
||||
}
|
||||
|
||||
public void putNamedResource(Map<String, NamedResource> map, Attributes attributes) {
|
||||
map.put(attributes.getValue(attributes.getIndex("name")), newNamedResource(attributes));
|
||||
}
|
||||
|
||||
protected String currentOrNull() {
|
||||
String returnVal = currentText.toString().trim();
|
||||
return returnVal.equals("") ? null : returnVal;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,18 +26,21 @@ package org.jclouds.vcloud.xml;
|
|||
import static org.jclouds.rest.util.Utils.newNamedLink;
|
||||
import static org.jclouds.rest.util.Utils.putNamedLink;
|
||||
import static org.jclouds.vcloud.VCloudMediaType.CATALOG_XML;
|
||||
import static org.jclouds.vcloud.VCloudMediaType.ORG_XML;
|
||||
import static org.jclouds.vcloud.VCloudMediaType.TASKSLIST_XML;
|
||||
import static org.jclouds.vcloud.VCloudMediaType.VDC_XML;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.jclouds.http.functions.ParseSax;
|
||||
import org.jclouds.rest.domain.NamedLink;
|
||||
import org.jclouds.rest.domain.internal.NamedLinkImpl;
|
||||
import org.jclouds.vcloud.domain.NamedResource;
|
||||
import org.jclouds.vcloud.domain.Organization;
|
||||
import org.jclouds.vcloud.domain.internal.NamedResourceImpl;
|
||||
import org.jclouds.vcloud.domain.internal.OrganizationImpl;
|
||||
import org.jclouds.vcloud.endpoints.VCloud;
|
||||
import org.xml.sax.Attributes;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
|
@ -47,13 +50,16 @@ import com.google.common.collect.Maps;
|
|||
* @author Adrian Cole
|
||||
*/
|
||||
public class OrgHandler extends ParseSax.HandlerWithResult<Organization> {
|
||||
private NamedLink org;
|
||||
private NamedResource org;
|
||||
private Map<String, NamedLink> vdcs = Maps.newHashMap();
|
||||
private Map<String, NamedLink> tasksLists = Maps.newHashMap();
|
||||
private NamedLink catalog;
|
||||
@Inject
|
||||
@VCloud
|
||||
URI vcloudUri;
|
||||
|
||||
public Organization getResult() {
|
||||
return new OrganizationImpl(org.getName(), org.getType(), org.getLocation(), catalog, vdcs,
|
||||
return new OrganizationImpl(org.getId(), org.getName(), org.getLocation(), catalog, vdcs,
|
||||
tasksLists);
|
||||
}
|
||||
|
||||
|
@ -61,8 +67,7 @@ public class OrgHandler extends ParseSax.HandlerWithResult<Organization> {
|
|||
public void startElement(String uri, String localName, String qName, Attributes attributes)
|
||||
throws SAXException {
|
||||
if (qName.equals("Org")) {
|
||||
org = new NamedLinkImpl(attributes.getValue(attributes.getIndex("name")), ORG_XML, URI
|
||||
.create(attributes.getValue(attributes.getIndex("href"))));
|
||||
org = newNamedResource(attributes);
|
||||
} else if (qName.equals("Link")) {
|
||||
int typeIndex = attributes.getIndex("type");
|
||||
if (typeIndex != -1) {
|
||||
|
@ -77,4 +82,12 @@ public class OrgHandler extends ParseSax.HandlerWithResult<Organization> {
|
|||
}
|
||||
}
|
||||
|
||||
public NamedResource newNamedResource(Attributes attributes) {
|
||||
return new NamedResourceImpl(
|
||||
Integer.parseInt(attributes.getValue(attributes.getIndex("href")).replace(
|
||||
vcloudUri.toASCIIString() + "/org/", "")), attributes.getValue(attributes
|
||||
.getIndex("name")), attributes.getValue(attributes.getIndex("type")), URI
|
||||
.create(attributes.getValue(attributes.getIndex("href"))));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -61,6 +61,9 @@ public class TasksListHandler extends ParseSax.HandlerWithResult<TasksList> {
|
|||
throws SAXException {
|
||||
if (qName.equals("TasksList")) {
|
||||
location = Utils.newLink(attributes).getLocation();
|
||||
} else if (qName.equals("Link") && attributes.getIndex("rel") != -1
|
||||
&& attributes.getValue(attributes.getIndex("rel")).equals("self")) {
|
||||
location = Utils.newLink(attributes).getLocation();
|
||||
} else {
|
||||
taskHandler.startElement(uri, localName, qName, attributes);
|
||||
}
|
||||
|
|
|
@ -28,11 +28,17 @@ import static org.jclouds.rest.util.Utils.putNamedLink;
|
|||
import java.net.URI;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.jclouds.http.functions.ParseSax;
|
||||
import org.jclouds.rest.domain.NamedLink;
|
||||
import org.jclouds.rest.domain.internal.NamedLinkImpl;
|
||||
import org.jclouds.vcloud.domain.Capacity;
|
||||
import org.jclouds.vcloud.domain.NamedResource;
|
||||
import org.jclouds.vcloud.domain.Quota;
|
||||
import org.jclouds.vcloud.domain.VDC;
|
||||
import org.jclouds.vcloud.domain.internal.NamedResourceImpl;
|
||||
import org.jclouds.vcloud.domain.internal.VDCImpl;
|
||||
import org.jclouds.vcloud.endpoints.VCloud;
|
||||
import org.xml.sax.Attributes;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
|
@ -42,22 +48,46 @@ import com.google.common.collect.Maps;
|
|||
* @author Adrian Cole
|
||||
*/
|
||||
public class VDCHandler extends ParseSax.HandlerWithResult<VDC> {
|
||||
private NamedLink vDC;
|
||||
private StringBuilder currentText = new StringBuilder();
|
||||
|
||||
private NamedResource vDC;
|
||||
private Map<String, NamedLink> resourceEntities = Maps.newHashMap();
|
||||
private Map<String, NamedLink> availableNetworks = Maps.newHashMap();
|
||||
@Inject
|
||||
@VCloud
|
||||
URI vcloudUri;
|
||||
|
||||
private String description;
|
||||
|
||||
private Quota instantiatedVmsQuota;
|
||||
|
||||
private Capacity memoryCapacity;
|
||||
|
||||
private Capacity cpuCapacity;
|
||||
|
||||
private Capacity storageCapacity;
|
||||
|
||||
private Quota deployedVmsQuota;
|
||||
|
||||
private String units;
|
||||
|
||||
private int allocated;
|
||||
|
||||
private int used;
|
||||
|
||||
private int limit;
|
||||
|
||||
public VDC getResult() {
|
||||
return new VDCImpl(vDC.getName(), vDC.getType(), vDC.getLocation(), resourceEntities,
|
||||
availableNetworks);
|
||||
return new VDCImpl(vDC.getId(), vDC.getName(), vDC.getLocation(), description,
|
||||
storageCapacity, cpuCapacity, memoryCapacity, instantiatedVmsQuota,
|
||||
deployedVmsQuota, resourceEntities, availableNetworks);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startElement(String uri, String localName, String qName, Attributes attributes)
|
||||
throws SAXException {
|
||||
if (qName.equals("Vdc")) {
|
||||
vDC = new NamedLinkImpl(attributes.getValue(attributes.getIndex("name")), attributes
|
||||
.getValue(attributes.getIndex("type")), URI.create(attributes.getValue(attributes
|
||||
.getIndex("href"))));
|
||||
vDC = newNamedResource(attributes);
|
||||
} else if (qName.equals("Network")) {
|
||||
putNamedLink(availableNetworks, attributes);
|
||||
} else if (qName.equals("ResourceEntity")) {
|
||||
|
@ -65,4 +95,45 @@ public class VDCHandler extends ParseSax.HandlerWithResult<VDC> {
|
|||
}
|
||||
}
|
||||
|
||||
public void endElement(String uri, String name, String qName) {
|
||||
if (qName.equals("Description")) {
|
||||
description = currentOrNull();
|
||||
} else if (qName.equals("Units")) {
|
||||
units = currentOrNull();
|
||||
} else if (qName.equals("Allocated")) {
|
||||
allocated = Integer.parseInt(currentOrNull());
|
||||
} else if (qName.equals("Used")) {
|
||||
used = Integer.parseInt(currentOrNull());
|
||||
} else if (qName.equals("Limit")) {
|
||||
limit = Integer.parseInt(currentOrNull());
|
||||
} else if (qName.equals("StorageCapacity")) {
|
||||
storageCapacity = new Capacity(units, allocated, used);
|
||||
} else if (qName.equals("Cpu")) {
|
||||
cpuCapacity = new Capacity(units, allocated, used);
|
||||
} else if (qName.equals("Memory")) {
|
||||
memoryCapacity = new Capacity(units, allocated, used);
|
||||
} else if (qName.equals("InstantiatedVmsQuota")) {
|
||||
instantiatedVmsQuota = new Quota(limit, used);
|
||||
} else if (qName.equals("DeployedVmsQuota")) {
|
||||
deployedVmsQuota = new Quota(limit, used);
|
||||
}
|
||||
currentText = new StringBuilder();
|
||||
}
|
||||
|
||||
public void characters(char ch[], int start, int length) {
|
||||
currentText.append(ch, start, length);
|
||||
}
|
||||
|
||||
public NamedResource newNamedResource(Attributes attributes) {
|
||||
return new NamedResourceImpl(Integer.parseInt(attributes
|
||||
.getValue(attributes.getIndex("href")).replace(vcloudUri.toASCIIString() + "/vdc/",
|
||||
"")), attributes.getValue(attributes.getIndex("name")), attributes
|
||||
.getValue(attributes.getIndex("type")), URI.create(attributes.getValue(attributes
|
||||
.getIndex("href"))));
|
||||
}
|
||||
|
||||
protected String currentOrNull() {
|
||||
String returnVal = currentText.toString().trim();
|
||||
return returnVal.equals("") ? null : returnVal;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,7 +54,6 @@ public class VCloudClientLiveTest {
|
|||
assertNotNull(response);
|
||||
assertNotNull(response.getName());
|
||||
assertNotNull(response.getLocation());
|
||||
assertEquals(response.getType(), "application/vnd.vmware.vcloud.catalog+xml");
|
||||
assert response.size() > 0;
|
||||
}
|
||||
|
||||
|
@ -64,7 +63,6 @@ public class VCloudClientLiveTest {
|
|||
assertNotNull(response);
|
||||
assertNotNull(response.getName());
|
||||
assertNotNull(response.getLocation());
|
||||
assertEquals(response.getType(), "application/vnd.vmware.vcloud.vdc+xml");
|
||||
assertNotNull(response.getResourceEntities());
|
||||
assertNotNull(response.getAvailableNetworks());
|
||||
}
|
||||
|
|
|
@ -68,7 +68,9 @@ public class VCloudClientTest extends RestClientTest<VCloudClient> {
|
|||
GeneratedHttpRequest<VCloudClient> httpMethod = processor.createRequest(method);
|
||||
|
||||
assertRequestLineEquals(httpMethod, "GET http://catalog HTTP/1.1");
|
||||
assertHeadersEqual(httpMethod, "Accept: application/vnd.vmware.vcloud.catalog+xml\n");
|
||||
assertHeadersEqual(
|
||||
httpMethod,
|
||||
"Accept: application/vnd.vmware.vcloud.catalog+xml\nContent-Type: application/vnd.vmware.vcloud.catalog+xml\n");
|
||||
assertEntityEquals(httpMethod, null);
|
||||
|
||||
assertResponseParserClassEquals(method, httpMethod, ParseSax.class);
|
||||
|
|
|
@ -92,7 +92,6 @@ public class VCloudDiscoveryLiveTest {
|
|||
Organization response = context.getApi().getOrganization();
|
||||
assertNotNull(response);
|
||||
assertEquals(response.getName(), account);
|
||||
assertEquals(response.getType(), VCloudMediaType.ORG_XML);
|
||||
assertNotNull(response.getCatalog());
|
||||
assertEquals(response.getTasksLists().size(), 1);
|
||||
assertEquals(response.getVDCs().size(), 1);
|
||||
|
|
|
@ -38,12 +38,14 @@ import org.jclouds.rest.RestClientTest;
|
|||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.jclouds.rest.internal.RestAnnotationProcessor;
|
||||
import org.jclouds.vcloud.endpoints.Org;
|
||||
import org.jclouds.vcloud.endpoints.VCloud;
|
||||
import org.jclouds.vcloud.filters.SetVCloudTokenCookie;
|
||||
import org.jclouds.vcloud.xml.OrgHandler;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.inject.AbstractModule;
|
||||
import com.google.inject.Module;
|
||||
import com.google.inject.Provides;
|
||||
import com.google.inject.TypeLiteral;
|
||||
|
||||
/**
|
||||
|
@ -102,7 +104,12 @@ public class VCloudDiscoveryTest extends RestClientTest<VCloudDiscovery> {
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@Provides
|
||||
@VCloud
|
||||
URI provide() {
|
||||
return URI.create("https://services.vcloudexpress.terremark.com/api/v0.8");
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -29,14 +29,20 @@ import static org.testng.Assert.assertEquals;
|
|||
import java.io.InputStream;
|
||||
import java.net.URI;
|
||||
|
||||
import org.jclouds.http.functions.BaseHandlerTest;
|
||||
import org.jclouds.http.functions.ParseSax;
|
||||
import org.jclouds.http.functions.ParseSax.Factory;
|
||||
import org.jclouds.http.functions.config.ParserModule;
|
||||
import org.jclouds.rest.domain.NamedLink;
|
||||
import org.jclouds.rest.domain.internal.NamedLinkImpl;
|
||||
import org.jclouds.vcloud.endpoints.VCloud;
|
||||
import org.jclouds.vcloud.terremark.domain.TerremarkVDC;
|
||||
import org.testng.annotations.BeforeTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.inject.AbstractModule;
|
||||
import com.google.inject.Guice;
|
||||
import com.google.inject.Injector;
|
||||
import com.google.inject.Provides;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code TerremarkVDCHandler}
|
||||
|
@ -44,29 +50,44 @@ import com.google.common.collect.ImmutableMap;
|
|||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(groups = "unit", testName = "vcloud.TerremarkVDCHandlerTest")
|
||||
public class TerremarkVDCHandlerTest extends BaseHandlerTest {
|
||||
|
||||
@BeforeTest
|
||||
@Override
|
||||
protected void setUpInjector() {
|
||||
super.setUpInjector();
|
||||
}
|
||||
public class TerremarkVDCHandlerTest {
|
||||
|
||||
public void testApplyInputStream() {
|
||||
InputStream is = getClass().getResourceAsStream("/terremark/vdc.xml");
|
||||
Injector injector = Guice.createInjector(new ParserModule(), new AbstractModule() {
|
||||
|
||||
@Override
|
||||
protected void configure() {
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@Provides
|
||||
@VCloud
|
||||
URI provide() {
|
||||
return URI.create("https://services.vcloudexpress.terremark.com/api/v0.8");
|
||||
}
|
||||
|
||||
});
|
||||
Factory factory = injector.getInstance(ParseSax.Factory.class);
|
||||
|
||||
TerremarkVDC result = (TerremarkVDC) factory.create(
|
||||
injector.getInstance(TerremarkVDCHandler.class)).parse(is);
|
||||
assertEquals(result.getName(), "Miami Environment 1");
|
||||
assertEquals(result.getLocation(), URI
|
||||
.create("https://services.vcloudexpress.terremark.com/api/v0.8/vdc/32"));
|
||||
assertEquals(result.getType(), "application/vnd.vmware.vcloud.vdc+xml");
|
||||
assertEquals(result.getResourceEntities(), ImmutableMap.<String, NamedLink> of());
|
||||
assertEquals(result.getAvailableNetworks(), ImmutableMap.of("10.114.34.128/26", new NamedLinkImpl(
|
||||
"10.114.34.128/26", "application/vnd.vmware.vcloud.network+xml",
|
||||
URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/network/1708"))));
|
||||
assertEquals(result.getCatalog(), new NamedLinkImpl("Miami Environment 1", CATALOG_XML,
|
||||
URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/vdc/32/catalog")));
|
||||
assertEquals(
|
||||
result.getAvailableNetworks(),
|
||||
ImmutableMap
|
||||
.of(
|
||||
"10.114.34.128/26",
|
||||
new NamedLinkImpl(
|
||||
"10.114.34.128/26",
|
||||
"application/vnd.vmware.vcloud.network+xml",
|
||||
URI
|
||||
.create("https://services.vcloudexpress.terremark.com/api/v0.8/network/1708"))));
|
||||
assertEquals(result.getCatalog(), new NamedLinkImpl("Miami Environment 1", CATALOG_XML, URI
|
||||
.create("https://services.vcloudexpress.terremark.com/api/v0.8/vdc/32/catalog")));
|
||||
assertEquals(result.getPublicIps(), new NamedLinkImpl("Public IPs", "application/xml", URI
|
||||
.create("https://services.vcloudexpress.terremark.com/api/v0.8/vdc/32/publicIps")));
|
||||
assertEquals(
|
||||
|
|
|
@ -29,17 +29,17 @@ import static org.testng.Assert.assertEquals;
|
|||
import java.io.InputStream;
|
||||
import java.net.URI;
|
||||
|
||||
import org.jclouds.http.functions.BaseHandlerTest;
|
||||
import org.jclouds.http.functions.ParseSax;
|
||||
import org.jclouds.http.functions.ParseSax.Factory;
|
||||
import org.jclouds.http.functions.config.ParserModule;
|
||||
import org.jclouds.vcloud.domain.Catalog;
|
||||
import org.jclouds.vcloud.domain.internal.NamedResourceImpl;
|
||||
import org.jclouds.vcloud.endpoints.internal.CatalogItemRoot;
|
||||
import org.testng.annotations.BeforeTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.inject.AbstractModule;
|
||||
import com.google.inject.Guice;
|
||||
import com.google.inject.Injector;
|
||||
import com.google.inject.Provides;
|
||||
|
||||
/**
|
||||
|
@ -48,11 +48,14 @@ import com.google.inject.Provides;
|
|||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(groups = "unit", testName = "vcloud.CatalogHandlerTest")
|
||||
public class CatalogHandlerTest extends BaseHandlerTest {
|
||||
public class CatalogHandlerTest {
|
||||
|
||||
@BeforeTest
|
||||
@Override
|
||||
protected void setUpInjector() {
|
||||
private Injector injector;
|
||||
|
||||
private Factory factory;
|
||||
|
||||
public void testApplyInputStream() {
|
||||
InputStream is = getClass().getResourceAsStream("/catalog.xml");
|
||||
injector = Guice.createInjector(new ParserModule(), new AbstractModule() {
|
||||
|
||||
@Override
|
||||
|
@ -68,17 +71,13 @@ public class CatalogHandlerTest extends BaseHandlerTest {
|
|||
|
||||
});
|
||||
factory = injector.getInstance(ParseSax.Factory.class);
|
||||
}
|
||||
|
||||
public void testApplyInputStream() {
|
||||
InputStream is = getClass().getResourceAsStream("/catalog.xml");
|
||||
|
||||
Catalog result = (Catalog) factory.create(injector.getInstance(CatalogHandler.class)).parse(
|
||||
is);
|
||||
assertEquals(result.getName(), "Miami Environment 1");
|
||||
assert result.getDescription() == null;
|
||||
|
||||
assertEquals(result.getLocation(), URI
|
||||
.create("https://services.vcloudexpress.terremark.com/api/v0.8/vdc/32/catalog"));
|
||||
assertEquals(result.getType(), "application/vnd.vmware.vcloud.catalog+xml");
|
||||
|
||||
assertEquals(result.get("CentOS 5.3 (32-bit)"), new NamedResourceImpl(5,
|
||||
"CentOS 5.3 (32-bit)", CATALOGITEM_XML,
|
||||
|
@ -161,4 +160,45 @@ public class CatalogHandlerTest extends BaseHandlerTest {
|
|||
URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/22")));
|
||||
|
||||
}
|
||||
|
||||
public void testHosting() {
|
||||
InputStream is = getClass().getResourceAsStream("/catalog-hosting.xml");
|
||||
injector = Guice.createInjector(new ParserModule(), new AbstractModule() {
|
||||
|
||||
@Override
|
||||
protected void configure() {
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@Provides
|
||||
@CatalogItemRoot
|
||||
String provide() {
|
||||
return "https://vcloud.safesecureweb.com/api/v0.8/catalogItem";
|
||||
}
|
||||
|
||||
});
|
||||
factory = injector.getInstance(ParseSax.Factory.class);
|
||||
Catalog result = (Catalog) factory.create(injector.getInstance(CatalogHandler.class)).parse(
|
||||
is);
|
||||
assertEquals(result.getName(), "HMSCatalog");
|
||||
assertEquals(result.getDescription(), "HMS Shared Catalog");
|
||||
assertEquals(result.getLocation(), URI
|
||||
.create("https://vcloud.safesecureweb.com/api/v0.8/catalog/1"));
|
||||
|
||||
assertEquals(result.get("Plesk (Linux) 64-bit Template"), new NamedResourceImpl(1,
|
||||
"Plesk (Linux) 64-bit Template", CATALOGITEM_XML, URI
|
||||
.create("https://vcloud.safesecureweb.com/api/v0.8/catalogItem/1")));
|
||||
|
||||
assertEquals(result.get("Windows 2008 Datacenter 64 Bit Template"), new NamedResourceImpl(2,
|
||||
"Windows 2008 Datacenter 64 Bit Template", CATALOGITEM_XML, URI
|
||||
.create("https://vcloud.safesecureweb.com/api/v0.8/catalogItem/2")));
|
||||
|
||||
assertEquals(result.get("Cent OS 64 Bit Template"), new NamedResourceImpl(3,
|
||||
"Cent OS 64 Bit Template", CATALOGITEM_XML, URI
|
||||
.create("https://vcloud.safesecureweb.com/api/v0.8/catalogItem/3")));
|
||||
|
||||
assertEquals(result.get("cPanel (Linux) 64 Bit Template"), new NamedResourceImpl(4,
|
||||
"cPanel (Linux) 64 Bit Template", CATALOGITEM_XML, URI
|
||||
.create("https://vcloud.safesecureweb.com/api/v0.8/catalogItem/4")));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,21 +24,28 @@
|
|||
package org.jclouds.vcloud.xml;
|
||||
|
||||
import static org.jclouds.vcloud.VCloudMediaType.CATALOG_XML;
|
||||
import static org.jclouds.vcloud.VCloudMediaType.ORG_XML;
|
||||
import static org.jclouds.vcloud.VCloudMediaType.TASKSLIST_XML;
|
||||
import static org.testng.Assert.assertEquals;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.net.URI;
|
||||
|
||||
import org.jclouds.http.functions.BaseHandlerTest;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import org.jclouds.http.functions.ParseSax;
|
||||
import org.jclouds.http.functions.ParseSax.Factory;
|
||||
import org.jclouds.http.functions.config.ParserModule;
|
||||
import org.jclouds.rest.domain.internal.NamedLinkImpl;
|
||||
import org.jclouds.vcloud.VCloudMediaType;
|
||||
import org.jclouds.vcloud.domain.Organization;
|
||||
import org.testng.annotations.BeforeTest;
|
||||
import org.jclouds.vcloud.endpoints.VCloud;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.inject.AbstractModule;
|
||||
import com.google.inject.Guice;
|
||||
import com.google.inject.Injector;
|
||||
import com.google.inject.Provides;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code OrgHandler}
|
||||
|
@ -46,24 +53,37 @@ import com.google.common.collect.ImmutableMap;
|
|||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(groups = "unit", testName = "vcloud.OrgHandlerTest")
|
||||
public class OrgHandlerTest extends BaseHandlerTest {
|
||||
public class OrgHandlerTest {
|
||||
|
||||
@BeforeTest
|
||||
@Override
|
||||
protected void setUpInjector() {
|
||||
super.setUpInjector();
|
||||
}
|
||||
|
||||
public void testApplyInputStream() {
|
||||
InputStream is = getClass().getResourceAsStream("/org.xml");
|
||||
|
||||
Injector injector = Guice.createInjector(new ParserModule(), new AbstractModule(){
|
||||
|
||||
@Override
|
||||
protected void configure() {
|
||||
|
||||
}
|
||||
@SuppressWarnings("unused")
|
||||
@Provides
|
||||
@Singleton
|
||||
@VCloud
|
||||
URI provide(){
|
||||
return URI.create("https://services.vcloudexpress.terremark.com/api/v0.8");
|
||||
}
|
||||
|
||||
});
|
||||
Factory factory = injector.getInstance(ParseSax.Factory.class);
|
||||
|
||||
Organization result = (Organization) factory.create(injector.getInstance(OrgHandler.class))
|
||||
.parse(is);
|
||||
assertEquals(result.getName(), "adrian@jclouds.org");
|
||||
assertEquals(result.getId(), 48);
|
||||
assertEquals(result.getLocation(), URI
|
||||
.create("https://services.vcloudexpress.terremark.com/api/v0.8/org/48"));
|
||||
assertEquals(result.getType(), ORG_XML);
|
||||
assertEquals(result.getCatalog(), new NamedLinkImpl("Miami Environment 1 Catalog", CATALOG_XML,
|
||||
assertEquals(result.getCatalog(), new NamedLinkImpl("Miami Environment 1 Catalog",
|
||||
CATALOG_XML,
|
||||
URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/vdc/32/catalog")));
|
||||
assertEquals(result.getVDCs(), ImmutableMap.of("Miami Environment 1", new NamedLinkImpl(
|
||||
"Miami Environment 1", VCloudMediaType.VDC_XML, URI
|
||||
|
@ -79,4 +99,38 @@ public class OrgHandlerTest extends BaseHandlerTest {
|
|||
URI
|
||||
.create("https://services.vcloudexpress.terremark.com/api/v0.8/tasksList/32"))));
|
||||
}
|
||||
|
||||
public void testHosting() {
|
||||
InputStream is = getClass().getResourceAsStream("/org-hosting.xml");
|
||||
Injector injector = Guice.createInjector(new ParserModule(), new AbstractModule(){
|
||||
|
||||
@Override
|
||||
protected void configure() {
|
||||
|
||||
}
|
||||
@SuppressWarnings("unused")
|
||||
@Provides
|
||||
@Singleton
|
||||
@VCloud
|
||||
URI provide(){
|
||||
return URI.create("https://vcloud.safesecureweb.com/api/v0.8");
|
||||
}
|
||||
|
||||
});
|
||||
Factory factory = injector.getInstance(ParseSax.Factory.class);
|
||||
Organization result = (Organization) factory.create(injector.getInstance(OrgHandler.class))
|
||||
.parse(is);
|
||||
assertEquals(result.getName(), "Customer 188849");
|
||||
assertEquals(result.getId(), 188849);
|
||||
assertEquals(result.getLocation(), URI
|
||||
.create("https://vcloud.safesecureweb.com/api/v0.8/org/188849"));
|
||||
assertEquals(result.getCatalog(), new NamedLinkImpl("HMS Shared Catalog", CATALOG_XML, URI
|
||||
.create("https://vcloud.safesecureweb.com/api/v0.8/catalog/1")));
|
||||
assertEquals(result.getVDCs(), ImmutableMap.of("188849 Virtual DataCenter",
|
||||
new NamedLinkImpl("188849 Virtual DataCenter", VCloudMediaType.VDC_XML, URI
|
||||
.create("https://vcloud.safesecureweb.com/api/v0.8/vdc/188849"))));
|
||||
assertEquals(result.getTasksLists(), ImmutableMap.of("188849 Task List", new NamedLinkImpl(
|
||||
"188849 Task List", TASKSLIST_XML, URI
|
||||
.create("https://vcloud.safesecureweb.com/api/v0.8/tasksList/188849"))));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -100,4 +100,14 @@ public class TasksListHandlerTest extends BaseHandlerTest {
|
|||
.create("https://services.vcloudexpress.terremark.com/api/v0.8/vdc/1"), task2, URI
|
||||
.create("https://services.vcloudexpress.terremark.com/api/v0.8/vdc/1"), task1));
|
||||
}
|
||||
|
||||
public void testApplyInputStreamHosting() {
|
||||
InputStream is = getClass().getResourceAsStream("/taskslist-hosting.xml");
|
||||
|
||||
TasksList result = factory.create(injector.getInstance(TasksListHandler.class)).parse(is);
|
||||
assertEquals(result.getLocation(), URI
|
||||
.create("https://vcloud.safesecureweb.com/api/v0.8/tasksList/188849"));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -28,14 +28,22 @@ import static org.testng.Assert.assertEquals;
|
|||
import java.io.InputStream;
|
||||
import java.net.URI;
|
||||
|
||||
import org.jclouds.http.functions.BaseHandlerTest;
|
||||
import org.jclouds.http.functions.ParseSax;
|
||||
import org.jclouds.http.functions.ParseSax.Factory;
|
||||
import org.jclouds.http.functions.config.ParserModule;
|
||||
import org.jclouds.rest.domain.NamedLink;
|
||||
import org.jclouds.rest.domain.internal.NamedLinkImpl;
|
||||
import org.jclouds.vcloud.domain.Capacity;
|
||||
import org.jclouds.vcloud.domain.Quota;
|
||||
import org.jclouds.vcloud.domain.VDC;
|
||||
import org.testng.annotations.BeforeTest;
|
||||
import org.jclouds.vcloud.endpoints.VCloud;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.inject.AbstractModule;
|
||||
import com.google.inject.Guice;
|
||||
import com.google.inject.Injector;
|
||||
import com.google.inject.Provides;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code VDCHandler}
|
||||
|
@ -43,22 +51,35 @@ import com.google.common.collect.ImmutableMap;
|
|||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(groups = "unit", testName = "vcloud.VDCHandlerTest")
|
||||
public class VDCHandlerTest extends BaseHandlerTest {
|
||||
|
||||
@BeforeTest
|
||||
@Override
|
||||
protected void setUpInjector() {
|
||||
super.setUpInjector();
|
||||
}
|
||||
public class VDCHandlerTest {
|
||||
|
||||
public void testApplyInputStream() {
|
||||
InputStream is = getClass().getResourceAsStream("/vdc.xml");
|
||||
Injector injector = Guice.createInjector(new ParserModule(), new AbstractModule() {
|
||||
|
||||
@Override
|
||||
protected void configure() {
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@Provides
|
||||
@VCloud
|
||||
URI provide() {
|
||||
return URI.create("https://services.vcloudexpress.terremark.com/api/v0.8");
|
||||
}
|
||||
|
||||
});
|
||||
Factory factory = injector.getInstance(ParseSax.Factory.class);
|
||||
VDC result = factory.create(injector.getInstance(VDCHandler.class)).parse(is);
|
||||
assertEquals(result.getName(), "Miami Environment 1");
|
||||
assertEquals(result.getLocation(), URI
|
||||
.create("https://services.vcloudexpress.terremark.com/api/v0.8/vdc/32"));
|
||||
assertEquals(result.getType(), "application/vnd.vmware.vcloud.vdc+xml");
|
||||
assertEquals(result.getDescription(), null);
|
||||
assertEquals(result.getStorageCapacity(), null);
|
||||
assertEquals(result.getCpuCapacity(), null);
|
||||
assertEquals(result.getMemoryCapacity(), null);
|
||||
assertEquals(result.getInstantiatedVmsQuota(), null);
|
||||
assertEquals(result.getDeployedVmsQuota(), null);
|
||||
assertEquals(result.getResourceEntities(), ImmutableMap.<String, NamedLink> of());
|
||||
assertEquals(
|
||||
result.getAvailableNetworks(),
|
||||
|
@ -71,4 +92,82 @@ public class VDCHandlerTest extends BaseHandlerTest {
|
|||
URI
|
||||
.create("https://services.vcloudexpress.terremark.com/api/v0.8/network/1708"))));
|
||||
}
|
||||
|
||||
public void testApplyHosting() {
|
||||
InputStream is = getClass().getResourceAsStream("/vdc-hosting.xml");
|
||||
Injector injector = Guice.createInjector(new ParserModule(), new AbstractModule() {
|
||||
|
||||
@Override
|
||||
protected void configure() {
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@Provides
|
||||
@VCloud
|
||||
URI provide() {
|
||||
return URI.create("https://vcloud.safesecureweb.com/api/v0.8");
|
||||
}
|
||||
|
||||
});
|
||||
Factory factory = injector.getInstance(ParseSax.Factory.class);
|
||||
VDC result = factory.create(injector.getInstance(VDCHandler.class)).parse(is);
|
||||
assertEquals(result.getName(), "vDC Name");
|
||||
assertEquals(result.getLocation(), URI
|
||||
.create("https://vcloud.safesecureweb.com/api/v0.8/vdc/188849"));
|
||||
assertEquals(result.getDescription(), "vDC Name");
|
||||
assertEquals(result.getStorageCapacity(), new Capacity("bytes * 10^9", 0, 40960));
|
||||
assertEquals(result.getCpuCapacity(), new Capacity("hz * 10^6", 0, 2400));
|
||||
assertEquals(result.getMemoryCapacity(), new Capacity("bytes * 10^9", 0, 2));
|
||||
assertEquals(result.getInstantiatedVmsQuota(), new Quota(0, 2));
|
||||
assertEquals(result.getDeployedVmsQuota(), new Quota(0, 2));
|
||||
assertEquals(
|
||||
result.getResourceEntities(),
|
||||
new ImmutableMap.Builder<String, NamedLink>()
|
||||
.put(
|
||||
"Plesk (Linux) 64-bit Template",
|
||||
new NamedLinkImpl(
|
||||
"Plesk (Linux) 64-bit Template",
|
||||
"application/vnd.vmware.vcloud.vAppTemplate+xml",
|
||||
URI
|
||||
.create("https://vcloud.safesecureweb.com/api/v0.8/vAppTemplate/1")))
|
||||
.put(
|
||||
|
||||
"Windows 2008 Datacenter 64 Bit Template",
|
||||
new NamedLinkImpl(
|
||||
"Windows 2008 Datacenter 64 Bit Template",
|
||||
"application/vnd.vmware.vcloud.vAppTemplate+xml",
|
||||
URI
|
||||
.create("https://vcloud.safesecureweb.com/api/v0.8/vAppTemplate/2")))
|
||||
.put(
|
||||
"Cent OS 64 Bit Template",
|
||||
new NamedLinkImpl(
|
||||
"Cent OS 64 Bit Template",
|
||||
"application/vnd.vmware.vcloud.vAppTemplate+xml",
|
||||
URI
|
||||
.create("https://vcloud.safesecureweb.com/api/v0.8/vAppTemplate/3")))
|
||||
.put(
|
||||
"cPanel (Linux) 64 Bit Template",
|
||||
new NamedLinkImpl(
|
||||
"cPanel (Linux) 64 Bit Template",
|
||||
"application/vnd.vmware.vcloud.vAppTemplate+xml",
|
||||
URI
|
||||
.create("https://vcloud.safesecureweb.com/api/v0.8/vAppTemplate/4")))
|
||||
.put(
|
||||
"188849-1",
|
||||
new NamedLinkImpl(
|
||||
"188849-1",
|
||||
"application/vnd.vmware.vcloud.vApp+xml",
|
||||
URI
|
||||
.create("https://vcloud.safesecureweb.com/api/v0.8/vApp/188849-1")))
|
||||
.put(
|
||||
"188849-2",
|
||||
new NamedLinkImpl(
|
||||
"188849-2",
|
||||
"application/vnd.vmware.vcloud.vApp+xml",
|
||||
URI
|
||||
.create("https://vcloud.safesecureweb.com/api/v0.8/vApp/188849-2")))
|
||||
.build());
|
||||
|
||||
assertEquals(result.getAvailableNetworks(), ImmutableMap.<String, NamedLink> of());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Catalog href="https://vcloud.safesecureweb.com/api/v0.8/catalog/1"
|
||||
name="HMSCatalog" xsi:schemaLocation="http://www.vmware.com/vcloud/v0.8/catalog.xsd"
|
||||
xmlns="http://www.vmware.com/vcloud/v0.8" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<Description>HMS Shared Catalog</Description>
|
||||
|
||||
<Link rel="add"
|
||||
href="https://vcloud.safesecureweb.com/api/v0.8/catalog/1/catalogItems"
|
||||
type="application/vnd.vmware.vcloud.catalogItem+xml" />
|
||||
|
||||
<CatalogItems>
|
||||
<CatalogItem type="application/vnd.vmware.vcloud.catalogItem+xml"
|
||||
href="https://vcloud.safesecureweb.com/api/v0.8/catalogItem/1"
|
||||
name="Plesk (Linux) 64-bit Template" />
|
||||
<CatalogItem type="application/vnd.vmware.vcloud.catalogItem+xml"
|
||||
href="https://vcloud.safesecureweb.com/api/v0.8/catalogItem/2"
|
||||
name="Windows 2008 Datacenter 64 Bit Template" />
|
||||
<CatalogItem type="application/vnd.vmware.vcloud.catalogItem+xml"
|
||||
href="https://vcloud.safesecureweb.com/api/v0.8/catalogItem/3"
|
||||
name="Cent OS 64 Bit Template" />
|
||||
<CatalogItem type="application/vnd.vmware.vcloud.catalogItem+xml"
|
||||
href="https://vcloud.safesecureweb.com/api/v0.8/catalogItem/4"
|
||||
name="cPanel (Linux) 64 Bit Template" />
|
||||
</CatalogItems>
|
||||
</Catalog>
|
|
@ -0,0 +1,12 @@
|
|||
<Org href="https://vcloud.safesecureweb.com/api/v0.8/org/188849"
|
||||
name="Customer 188849" xsi:schemaLocation="http://www.vmware.com/vcloud/v0.8/organization.xsd"
|
||||
xmlns="http://www.vmware.com/vcloud/v0.8" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<Link rel="down" href="https://vcloud.safesecureweb.com/api/v0.8/catalog/1"
|
||||
type="application/vnd.vmware.vcloud.catalog+xml" name="HMS Shared Catalog" />
|
||||
<Link rel="down"
|
||||
href="https://vcloud.safesecureweb.com/api/v0.8/vdc/188849"
|
||||
type="application/vnd.vmware.vcloud.vdc+xml" name="188849 Virtual DataCenter" />
|
||||
<Link rel="down"
|
||||
href="https://vcloud.safesecureweb.com/api/v0.8/tasksList/188849"
|
||||
type="application/vnd.vmware.vcloud.tasksList+xml" name="188849 Task List" />
|
||||
</Org>
|
|
@ -1,28 +1,3 @@
|
|||
<!--
|
||||
|
||||
|
||||
Copyright (C) 2009 Cloud Conscious, LLC. <info@cloudconscious.com>
|
||||
|
||||
====================================================================
|
||||
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.
|
||||
====================================================================
|
||||
|
||||
-->
|
||||
<Org href="https://services.vcloudexpress.terremark.com/api/v0.8/org/48" name="adrian@jclouds.org" xmlns="http://www.vmware.com/vcloud/v1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||
<Link rel="down" href="https://services.vcloudexpress.terremark.com/api/v0.8/vdc/32" type="application/vnd.vmware.vcloud.vdc+xml" name="Miami Environment 1"/>
|
||||
<Link rel="down" href="https://services.vcloudexpress.terremark.com/api/v0.8/vdc/32/catalog" type="application/vnd.vmware.vcloud.catalog+xml" name="Miami Environment 1 Catalog"/>
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<tasks xmlns="http://www.vmware.com/vcloud/tasks" xmlns:common="http://www.vmware.com/vcloud/v0.8"
|
||||
xmlns:task="http://www.vmware.com/vcloud/task"
|
||||
xsi:schemaLocation="http://www.vmware.com/vcloud/tasks
|
||||
https://vcloud.safesecureweb.com/ns/vcloud/tasks-1.0.xsd
|
||||
http://www.vmware.com/vcloud/v0.8
|
||||
https://vcloud.safesecureweb.com/ns/vcloud/common-1.0.xsd
|
||||
http://www.vmware.com/vcloud/task
|
||||
https://vcloud.safesecureweb.com/ns/vcloud/task-1.0.xsd"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<Link rel="self"
|
||||
href="https://vcloud.safesecureweb.com/api/v0.8/tasksList/188849"
|
||||
type="application/vnd.vmware.vcloud.tasksList+xml" />
|
||||
</tasks>
|
|
@ -0,0 +1,60 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Vdc href="https://vcloud.safesecureweb.com/api/v0.8/vdc/188849"
|
||||
name="vDC Name" xsi:schemaLocation="http://www.vmware.com/vcloud/v0.8/vdc.xsd"
|
||||
xmlns="http://www.vmware.com/vcloud/v0.8" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<Link rel="add"
|
||||
href="https://vcloud.safesecureweb.com/api/v0.8/vdc/188849/vApps"
|
||||
type="application/vnd.vmware.vcloud.vApp+xml" />
|
||||
<Link rel="add"
|
||||
href="https://vcloud.safesecureweb.com/api/v0.8/vdc/188849/vAppTemplates"
|
||||
type="application/vnd.vmware.vcloud.catalogItem+xml" />
|
||||
<Link rel="add"
|
||||
href="https://vcloud.safesecureweb.com/api/v0.8/vdc/188849/media"
|
||||
type="application/vnd.vmware.vcloud.media+xml" />
|
||||
<Description>vDC Name</Description>
|
||||
<StorageCapacity>
|
||||
<Units>bytes * 10^9</Units>
|
||||
<Allocated>0</Allocated>
|
||||
<Used>40960</Used>
|
||||
</StorageCapacity>
|
||||
<ComputeCapacity>
|
||||
<Cpu>
|
||||
<Units>hz * 10^6</Units>
|
||||
<Allocated>0</Allocated>
|
||||
<Used>2400</Used>
|
||||
</Cpu>
|
||||
<Memory>
|
||||
<Units>bytes * 10^9</Units>
|
||||
<Allocated>0</Allocated>
|
||||
<Used>2</Used>
|
||||
</Memory>
|
||||
<InstantiatedVmsQuota>
|
||||
<Limit>0</Limit>
|
||||
<Used>2</Used>
|
||||
</InstantiatedVmsQuota>
|
||||
<DeployedVmsQuota>
|
||||
<Limit>0</Limit>
|
||||
<Used>2</Used>
|
||||
</DeployedVmsQuota>
|
||||
</ComputeCapacity>
|
||||
<ResourceEntities>
|
||||
<ResourceEntity
|
||||
href="https://vcloud.safesecureweb.com/api/v0.8/vAppTemplate/1"
|
||||
type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="Plesk (Linux) 64-bit Template" />
|
||||
<ResourceEntity
|
||||
href="https://vcloud.safesecureweb.com/api/v0.8/vAppTemplate/2"
|
||||
type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="Windows 2008 Datacenter 64 Bit Template" />
|
||||
<ResourceEntity
|
||||
href="https://vcloud.safesecureweb.com/api/v0.8/vAppTemplate/3"
|
||||
type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="Cent OS 64 Bit Template" />
|
||||
<ResourceEntity
|
||||
href="https://vcloud.safesecureweb.com/api/v0.8/vAppTemplate/4"
|
||||
type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="cPanel (Linux) 64 Bit Template" />
|
||||
<ResourceEntity
|
||||
href="https://vcloud.safesecureweb.com/api/v0.8/vApp/188849-1"
|
||||
type="application/vnd.vmware.vcloud.vApp+xml" name="188849-1" />
|
||||
<ResourceEntity
|
||||
href="https://vcloud.safesecureweb.com/api/v0.8/vApp/188849-2"
|
||||
type="application/vnd.vmware.vcloud.vApp+xml" name="188849-2" />
|
||||
</ResourceEntities>
|
||||
</Vdc>
|
Loading…
Reference in New Issue