mirror of https://github.com/apache/jclouds.git
Merge branch 'master' of git://github.com/jclouds/jclouds into jclouds-vbox
This commit is contained in:
commit
2fc8e372ea
|
@ -29,7 +29,6 @@ import com.google.common.base.Splitter;
|
|||
import com.google.common.collect.Iterables;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Jason King
|
||||
*/
|
||||
public abstract class BaseVersionedServiceLiveTest extends BaseRestClientLiveTest {
|
||||
|
@ -48,16 +47,18 @@ public abstract class BaseVersionedServiceLiveTest extends BaseRestClientLiveTes
|
|||
overrides.setProperty(provider + ".image.login-user", loginUser);
|
||||
if (authenticateSudo != null)
|
||||
overrides.setProperty(provider + ".image.authenticate-sudo", authenticateSudo);
|
||||
|
||||
return overrides;
|
||||
}
|
||||
|
||||
@Override
|
||||
@BeforeClass
|
||||
protected void setupCredentials() {
|
||||
super.setupCredentials();
|
||||
|
||||
imageId = System.getProperty("test." + provider + ".image-id");
|
||||
loginUser = System.getProperty("test." + provider + ".image.login-user");
|
||||
authenticateSudo = System.getProperty("test." + provider + ".image.authenticate-sudo");
|
||||
|
||||
if (loginUser != null){
|
||||
Iterable<String> userPass = Splitter.on(':').split(loginUser);
|
||||
Builder loginCredentialsBuilder = LoginCredentials.builder();
|
||||
|
|
|
@ -40,7 +40,6 @@ public abstract class BaseRestClientLiveTest {
|
|||
protected String apiVersion;
|
||||
protected String buildVersion;
|
||||
|
||||
|
||||
protected Properties setupRestProperties() {
|
||||
return RestContextFactory.getPropertiesFromResource("/rest.properties");
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
<test.vcloud-director.image-id></test.vcloud-director.image-id>
|
||||
<test.vcloud-director.image.login-user></test.vcloud-director.image.login-user>
|
||||
<test.vcloud-director.image.authenticate-sudo></test.vcloud-director.image.authenticate-sudo>
|
||||
<test.vcloud-director.catalog-name></test.vcloud-director.catalog-name>
|
||||
<test.vcloud-director.catalog-name>Public</test.vcloud-director.catalog-name>
|
||||
<test.vcloud-director.media-id></test.vcloud-director.media-id>
|
||||
<test.vcloud-director.vapptemplate-id></test.vcloud-director.vapptemplate-id>
|
||||
<test.vcloud-director.network-id></test.vcloud-director.network-id>
|
||||
|
|
|
@ -18,11 +18,14 @@
|
|||
*/
|
||||
package org.jclouds.vcloud.director.v1_5;
|
||||
|
||||
import org.jclouds.ovf.Network;
|
||||
import org.jclouds.rest.annotations.Delegate;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Org;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Session;
|
||||
import org.jclouds.vcloud.director.v1_5.features.CatalogAsyncClient;
|
||||
import org.jclouds.vcloud.director.v1_5.features.NetworkAsyncClient;
|
||||
import org.jclouds.vcloud.director.v1_5.features.OrgAsyncClient;
|
||||
import org.jclouds.vcloud.director.v1_5.features.QueryAsyncClient;
|
||||
import org.jclouds.vcloud.director.v1_5.features.TaskAsyncClient;
|
||||
|
||||
import com.google.inject.Provides;
|
||||
|
@ -42,6 +45,12 @@ public interface VCloudDirectorAsyncClient {
|
|||
@Provides
|
||||
Session getCurrentSession();
|
||||
|
||||
/**
|
||||
* @return asynchronous access to query features
|
||||
*/
|
||||
@Delegate
|
||||
QueryAsyncClient getQueryClient();
|
||||
|
||||
/**
|
||||
* @return asynchronous access to {@link Org} features
|
||||
*/
|
||||
|
|
|
@ -21,19 +21,21 @@ package org.jclouds.vcloud.director.v1_5;
|
|||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.jclouds.concurrent.Timeout;
|
||||
import org.jclouds.ovf.Network;
|
||||
import org.jclouds.rest.annotations.Delegate;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Org;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Session;
|
||||
import org.jclouds.vcloud.director.v1_5.features.CatalogClient;
|
||||
import org.jclouds.vcloud.director.v1_5.features.MediaClient;
|
||||
import org.jclouds.vcloud.director.v1_5.features.NetworkClient;
|
||||
import org.jclouds.vcloud.director.v1_5.features.OrgClient;
|
||||
import org.jclouds.vcloud.director.v1_5.features.QueryClient;
|
||||
import org.jclouds.vcloud.director.v1_5.features.TaskClient;
|
||||
|
||||
import com.google.inject.Provides;
|
||||
|
||||
/**
|
||||
* Provides synchronous access to VCloudDirector.
|
||||
* <p/>
|
||||
*
|
||||
* @see VCloudDirectorAsyncClient
|
||||
* @author Adrian Cole
|
||||
|
@ -41,12 +43,17 @@ import com.google.inject.Provides;
|
|||
@Timeout(duration = 60, timeUnit = TimeUnit.SECONDS)
|
||||
public interface VCloudDirectorClient {
|
||||
/**
|
||||
*
|
||||
* @return the current login session
|
||||
*/
|
||||
@Provides
|
||||
Session getCurrentSession();
|
||||
|
||||
|
||||
/**
|
||||
* @return asynchronous access to query features
|
||||
*/
|
||||
@Delegate
|
||||
QueryClient getQueryClient();
|
||||
|
||||
/**
|
||||
* @return synchronous access to {@link Org} features
|
||||
*/
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/**
|
||||
/*
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
|
@ -18,9 +18,10 @@
|
|||
*/
|
||||
package org.jclouds.vcloud.director.v1_5;
|
||||
|
||||
|
||||
/**
|
||||
* Constants used by VCloudDirector clients
|
||||
*
|
||||
*
|
||||
* @author grkvlt@apache.org
|
||||
*/
|
||||
public class VCloudDirectorConstants {
|
||||
|
@ -28,4 +29,37 @@ public class VCloudDirectorConstants {
|
|||
/** The XML namespace used by the clients. */
|
||||
public static final String VCLOUD_1_5_NS = "http://www.vmware.com/vcloud/v1.5";
|
||||
|
||||
/** The property used to configure the timeout for task completion. */
|
||||
public static final String PROPERTY_VCLOUD_DIRECTOR_TIMEOUT_TASK_COMPLETED = "jclouds.vcloud-director.timeout.task-complete";
|
||||
|
||||
public static final String PROPERTY_VCLOUD_DIRECTOR_VERSION_SCHEMA = "jclouds.vcloud-director.version.schema";
|
||||
|
||||
/** Name of the default org that your vApp will join, if an org isn't explicitly specified. */
|
||||
public static final String PROPERTY_VCLOUD_DIRECTOR_DEFAULT_ORG = "jclouds.vcloud-director.defaults.org";
|
||||
|
||||
/** Name of the default catalog to query, if it isn't explicitly specified. */
|
||||
public static final String PROPERTY_VCLOUD_DIRECTOR_DEFAULT_CATALOG = "jclouds.vcloud-director.defaults.catalog";
|
||||
|
||||
/** Name of the VDC that your vApp will join, if a vDC isn't explicitly specified. */
|
||||
public static final String PROPERTY_VCLOUD_DIRECTOR_DEFAULT_VDC = "jclouds.vcloud-director.defaults.vdc";
|
||||
|
||||
/** Name of the default network, in the default VDC that your vApp will join. */
|
||||
public static final String PROPERTY_VCLOUD_DIRECTOR_DEFAULT_NETWORK = "jclouds.vcloud-director.defaults.network";
|
||||
|
||||
/** TODO javadoc */
|
||||
// public static final String PROPERTY_VCLOUD_DEFAULT_FENCEMODE = "jclouds.vcloud-director.defaults.fencemode";
|
||||
|
||||
/** TODO javadoc */
|
||||
public static final String PROPERTY_VCLOUD_DIRECTOR_XML_NAMESPACE = "jclouds.vcloud-director.xml.ns";
|
||||
|
||||
/** TODO javadoc */
|
||||
public static final String PROPERTY_VCLOUD_DIRECTOR_XML_SCHEMA = "jclouds.vcloud-director.xml.schema";
|
||||
|
||||
// TODO put these somewhere else, maybe core?
|
||||
|
||||
/** TODO javadoc */
|
||||
public static final String PROPERTY_DNS_NAME_LEN_MIN = "jclouds.dns_name_length_min";
|
||||
|
||||
/** TODO javadoc */
|
||||
public static final String PROPERTY_NS_NAME_LEN_MAX = "jclouds.dns_name_length_max";
|
||||
}
|
||||
|
|
|
@ -21,8 +21,8 @@ package org.jclouds.vcloud.director.v1_5;
|
|||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.jclouds.vcloud.director.v1_5.config.VCloudDirectorRestClientModule;
|
||||
import org.jclouds.rest.RestContextBuilder;
|
||||
import org.jclouds.vcloud.director.v1_5.config.VCloudDirectorRestClientModule;
|
||||
|
||||
import com.google.inject.Module;
|
||||
|
||||
|
|
|
@ -27,22 +27,33 @@ import org.jclouds.vcloud.director.v1_5.domain.Task;
|
|||
public class VCloudDirectorException extends RuntimeException {
|
||||
|
||||
/** The serialVersionUID. */
|
||||
private static final long serialVersionUID = -3200853408568729058L;
|
||||
private static final long serialVersionUID = -5292516858598372960L;
|
||||
|
||||
private final Error error;
|
||||
private final Task task;
|
||||
|
||||
public VCloudDirectorException(Error error) {
|
||||
super("Error: " + error.getMessage());
|
||||
super("ERR-801: Error: " + error.getMessage());
|
||||
this.error = error;
|
||||
this.task = null;
|
||||
}
|
||||
|
||||
public VCloudDirectorException(Task task) {
|
||||
super("Task error: " + task.getError().getMessage());
|
||||
super("ERR-802: Task error: " + task.getError().getMessage());
|
||||
this.error = task.getError();
|
||||
this.task = task;
|
||||
}
|
||||
|
||||
public Error getError() {
|
||||
return error;
|
||||
}
|
||||
|
||||
public boolean hasTask() {
|
||||
return task != null;
|
||||
}
|
||||
|
||||
public Task getTask() {
|
||||
return task;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -18,9 +18,10 @@
|
|||
*/
|
||||
package org.jclouds.vcloud.director.v1_5;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
/**
|
||||
* Resource Types used in VCloud.
|
||||
*
|
||||
|
@ -73,10 +74,25 @@ public class VCloudDirectorMediaType {
|
|||
|
||||
public static final String ADMIN_USER = "application/vnd.vmware.admin.user+xml";
|
||||
|
||||
public static final List<String> ALL = Arrays.asList(
|
||||
SESSION, ERROR, ORG_LIST, METADATA, METADATA_ENTRY,
|
||||
METADATA_VALUE, ORG, TASKS_LIST, TASK, NETWORK, ORG_NETWORK,
|
||||
CATALOG, CATALOG_ITEM, CATALOG_ITEMS, CATALOGS_LIST, PROPERTY,
|
||||
MEDIA, OWNER, VDC, ADMIN_USER
|
||||
);
|
||||
public static final String QUERY_RESULT_RECORDS = "application/vnd.vmware.vcloud.query.records+xml";
|
||||
|
||||
public static final String QUERY_RESULT_REFERENCES = "application/vnd.vmware.vcloud.query.references+xml";
|
||||
|
||||
public static final String QUERY_RESULT_ID_RECORDS = "application/vnd.vmware.vcloud.query.idrecords+xml";
|
||||
|
||||
public static final String CONTROL_ACCESS = "application/vnd.vmware.vcloud.controlAccess+xml";
|
||||
|
||||
/**
|
||||
* All acceptable media types.
|
||||
*
|
||||
* This list must be updated whenever a new media type constant is added.
|
||||
*/
|
||||
public static final List<String> ALL = ImmutableList.of(
|
||||
SESSION, ERROR, ORG_LIST, METADATA, METADATA_ENTRY,
|
||||
METADATA_VALUE, ORG, TASKS_LIST, TASK, NETWORK, ORG_NETWORK,
|
||||
CATALOG, CATALOG_ITEM, CATALOG_ITEMS, CATALOGS_LIST, PROPERTY,
|
||||
MEDIA, OWNER, VDC, ADMIN_USER, QUERY_RESULT_RECORDS,
|
||||
QUERY_RESULT_REFERENCES, QUERY_RESULT_ID_RECORDS,
|
||||
CONTROL_ACCESS
|
||||
);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/**
|
||||
/*
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
|
@ -21,6 +21,10 @@ package org.jclouds.vcloud.director.v1_5;
|
|||
import static org.jclouds.Constants.PROPERTY_API_VERSION;
|
||||
import static org.jclouds.Constants.PROPERTY_ENDPOINT;
|
||||
import static org.jclouds.Constants.PROPERTY_SESSION_INTERVAL;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.PROPERTY_VCLOUD_DIRECTOR_TIMEOUT_TASK_COMPLETED;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.PROPERTY_VCLOUD_DIRECTOR_VERSION_SCHEMA;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.PROPERTY_VCLOUD_DIRECTOR_XML_NAMESPACE;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.PROPERTY_VCLOUD_DIRECTOR_XML_SCHEMA;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
|
@ -34,14 +38,29 @@ import org.jclouds.PropertiesBuilder;
|
|||
public class VCloudDirectorPropertiesBuilder extends PropertiesBuilder {
|
||||
|
||||
@Override
|
||||
protected Properties defaultProperties() {
|
||||
public Properties defaultProperties() {
|
||||
Properties properties = super.defaultProperties();
|
||||
|
||||
properties.setProperty(PROPERTY_ENDPOINT, "https://vcloudbeta.bluelock.com/api");
|
||||
properties.setProperty(PROPERTY_SESSION_INTERVAL, 30*60 + "");
|
||||
properties.setProperty(PROPERTY_SESSION_INTERVAL, Integer.toString(30 * 60));
|
||||
properties.setProperty(PROPERTY_API_VERSION, "1.5");
|
||||
|
||||
properties.setProperty(PROPERTY_VCLOUD_DIRECTOR_XML_NAMESPACE,
|
||||
String.format("http://www.vmware.com/vcloud/v${%s}", PROPERTY_VCLOUD_DIRECTOR_VERSION_SCHEMA));
|
||||
properties.setProperty(PROPERTY_SESSION_INTERVAL, Integer.toString(8 * 60));
|
||||
properties.setProperty(PROPERTY_VCLOUD_DIRECTOR_XML_SCHEMA, PROPERTY_ENDPOINT + "/v1.5/schema/master.xsd");
|
||||
|
||||
// TODO integrate these with the {@link ComputeTimeouts} instead of having a single timeout for everything.
|
||||
properties.setProperty(PROPERTY_SESSION_INTERVAL, Integer.toString(300));
|
||||
properties.setProperty(PROPERTY_VCLOUD_DIRECTOR_TIMEOUT_TASK_COMPLETED, Long.toString(1200l * 1000l));
|
||||
|
||||
return properties;
|
||||
}
|
||||
|
||||
public VCloudDirectorPropertiesBuilder() {
|
||||
super();
|
||||
}
|
||||
|
||||
public VCloudDirectorPropertiesBuilder(Properties properties) {
|
||||
super(properties);
|
||||
}
|
||||
|
|
|
@ -50,6 +50,8 @@ import org.jclouds.vcloud.director.v1_5.features.NetworkAsyncClient;
|
|||
import org.jclouds.vcloud.director.v1_5.features.NetworkClient;
|
||||
import org.jclouds.vcloud.director.v1_5.features.OrgAsyncClient;
|
||||
import org.jclouds.vcloud.director.v1_5.features.OrgClient;
|
||||
import org.jclouds.vcloud.director.v1_5.features.QueryAsyncClient;
|
||||
import org.jclouds.vcloud.director.v1_5.features.QueryClient;
|
||||
import org.jclouds.vcloud.director.v1_5.features.TaskAsyncClient;
|
||||
import org.jclouds.vcloud.director.v1_5.features.TaskClient;
|
||||
import org.jclouds.vcloud.director.v1_5.functions.LoginUserInOrgWithPassword;
|
||||
|
@ -82,6 +84,7 @@ public class VCloudDirectorRestClientModule extends RestClientModule<VCloudDirec
|
|||
.put(CatalogClient.class, CatalogAsyncClient.class)
|
||||
.put(NetworkClient.class, NetworkAsyncClient.class)
|
||||
.put(OrgClient.class, OrgAsyncClient.class)
|
||||
.put(QueryClient.class, QueryAsyncClient.class)
|
||||
.put(MediaClient.class, MediaAsyncClient.class)
|
||||
.put(TaskClient.class, TaskAsyncClient.class)
|
||||
.build();
|
||||
|
@ -92,10 +95,13 @@ public class VCloudDirectorRestClientModule extends RestClientModule<VCloudDirec
|
|||
|
||||
@Override
|
||||
protected void configure() {
|
||||
// session client is used directly for filters and retry handlers, so let's bind it explicitly
|
||||
// Bind clients that are used directly in Functions, Predicates and other circumstances
|
||||
bindClientAndAsyncClient(binder(), SessionClient.class, SessionAsyncClient.class);
|
||||
bindClientAndAsyncClient(binder(), OrgClient.class, OrgAsyncClient.class);
|
||||
bindClientAndAsyncClient(binder(), TaskClient.class, TaskAsyncClient.class);
|
||||
|
||||
bind(HttpRetryHandler.class).annotatedWith(ClientError.class).to(InvalidateSessionAndRetryOn401AndLogoutOnClose.class);
|
||||
|
||||
super.configure();
|
||||
}
|
||||
|
||||
|
|
|
@ -18,8 +18,8 @@
|
|||
*/
|
||||
package org.jclouds.vcloud.director.v1_5.domain;
|
||||
|
||||
import static com.google.common.base.Preconditions.*;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.*;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Set;
|
||||
|
|
|
@ -18,8 +18,8 @@
|
|||
*/
|
||||
package org.jclouds.vcloud.director.v1_5.domain;
|
||||
|
||||
import static com.google.common.base.Preconditions.*;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.*;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.List;
|
||||
|
|
|
@ -18,8 +18,8 @@
|
|||
*/
|
||||
package org.jclouds.vcloud.director.v1_5.domain;
|
||||
|
||||
import static com.google.common.base.Preconditions.*;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.*;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
|
|
@ -0,0 +1,96 @@
|
|||
package org.jclouds.vcloud.director.v1_5.domain;
|
||||
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
@XmlRootElement(namespace = VCLOUD_1_5_NS, name = "CatalogReference")
|
||||
public class CatalogReference extends ReferenceType<CatalogReference> {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Builder toBuilder() {
|
||||
return new Builder().fromCatalogReference(this);
|
||||
}
|
||||
|
||||
public static class Builder extends ReferenceType.Builder<CatalogReference> {
|
||||
|
||||
@Override
|
||||
public CatalogReference build() {
|
||||
CatalogReference reference = new CatalogReference(href);
|
||||
reference.setId(id);
|
||||
reference.setName(name);
|
||||
reference.setType(type);
|
||||
return reference;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ReferenceType#getHref()
|
||||
*/
|
||||
@Override
|
||||
public Builder href(URI href) {
|
||||
this.href = href;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ReferenceType#getId()
|
||||
*/
|
||||
@Override
|
||||
public Builder id(String id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ReferenceType#getType()
|
||||
*/
|
||||
@Override
|
||||
public Builder type(String type) {
|
||||
this.type = type;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ReferenceType#getName()
|
||||
*/
|
||||
@Override
|
||||
public Builder name(String name) {
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Builder fromReferenceType(ReferenceType<CatalogReference> in) {
|
||||
return Builder.class.cast(super.fromReferenceType(in));
|
||||
}
|
||||
|
||||
protected Builder fromCatalogReference(CatalogReference in) {
|
||||
return fromReferenceType(in);
|
||||
}
|
||||
}
|
||||
|
||||
protected CatalogReference(URI href) {
|
||||
super(href);
|
||||
}
|
||||
|
||||
protected CatalogReference() {
|
||||
// For JAXB
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o)
|
||||
return true;
|
||||
if (o == null || getClass() != o.getClass())
|
||||
return false;
|
||||
CatalogReference that = CatalogReference.class.cast(o);
|
||||
return super.equals(that);
|
||||
}
|
||||
}
|
|
@ -18,8 +18,8 @@
|
|||
*/
|
||||
package org.jclouds.vcloud.director.v1_5.domain;
|
||||
|
||||
import static com.google.common.base.Preconditions.*;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.*;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
|
|
@ -105,7 +105,7 @@ public class EntityType<T extends EntityType<T>> extends ResourceType<T> {
|
|||
}
|
||||
|
||||
/**
|
||||
* @see ReferenceType#getHref()
|
||||
* @see ResourceType#getHref()
|
||||
*/
|
||||
@Override
|
||||
public Builder<T> href(URI href) {
|
||||
|
@ -114,7 +114,7 @@ public class EntityType<T extends EntityType<T>> extends ResourceType<T> {
|
|||
}
|
||||
|
||||
/**
|
||||
* @see ReferenceType#getType()
|
||||
* @see ResourceType#getType()
|
||||
*/
|
||||
@Override
|
||||
public Builder<T> type(String type) {
|
||||
|
@ -123,7 +123,7 @@ public class EntityType<T extends EntityType<T>> extends ResourceType<T> {
|
|||
}
|
||||
|
||||
/**
|
||||
* @see ReferenceType#getLinks()
|
||||
* @see ResourceType#getLinks()
|
||||
*/
|
||||
@Override
|
||||
public Builder<T> links(Set<Link> links) {
|
||||
|
@ -132,7 +132,7 @@ public class EntityType<T extends EntityType<T>> extends ResourceType<T> {
|
|||
}
|
||||
|
||||
/**
|
||||
* @see ReferenceType#getLinks()
|
||||
* @see ResourceType#getLinks()
|
||||
*/
|
||||
@Override
|
||||
public Builder<T> link(Link link) {
|
||||
|
|
|
@ -18,9 +18,9 @@
|
|||
*/
|
||||
package org.jclouds.vcloud.director.v1_5.domain;
|
||||
|
||||
import static com.google.common.base.Objects.*;
|
||||
import static com.google.common.base.Preconditions.*;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.*;
|
||||
import static com.google.common.base.Objects.equal;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
|
|
|
@ -20,7 +20,7 @@ package org.jclouds.vcloud.director.v1_5.domain;
|
|||
|
||||
import static com.google.common.base.Objects.equal;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.*;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
package org.jclouds.vcloud.director.v1_5.domain;
|
||||
|
||||
import static com.google.common.base.Objects.equal;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.*;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
|
|
@ -20,7 +20,7 @@ package org.jclouds.vcloud.director.v1_5.domain;
|
|||
|
||||
import static com.google.common.base.Objects.equal;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.*;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
package org.jclouds.vcloud.director.v1_5.domain;
|
||||
|
||||
import static com.google.common.base.Objects.equal;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.*;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
|
|
|
@ -18,8 +18,8 @@
|
|||
*/
|
||||
package org.jclouds.vcloud.director.v1_5.domain;
|
||||
|
||||
import static com.google.common.base.Objects.*;
|
||||
import static com.google.common.base.Preconditions.*;
|
||||
import static com.google.common.base.Objects.equal;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Arrays;
|
||||
|
@ -46,14 +46,27 @@ public class Link extends ReferenceType<Link> {
|
|||
public static final String UP = "up";
|
||||
public static final String DOWN = "down";
|
||||
public static final String EDIT = "edit";
|
||||
public static final String DELETE = "delete";
|
||||
public static final String ADD = "add";
|
||||
public static final String DELETE = "delete";
|
||||
public static final String REMOVE = "remove";
|
||||
public static final String CATALOG_ITEM = "catalogItem";
|
||||
public static final String TASK_CANCEL = "task:cancel";
|
||||
public static final String ALTERNATE = "alternate";
|
||||
public static final String NEXT_PAGE = "nextPage";
|
||||
public static final String PREVIOUS_PAGE = "previousPage";
|
||||
public static final String LAST_PAGE = "lastPage";
|
||||
public static final String FIRST_PAGE = "firstPage";
|
||||
public static final String CONTROL_ACCESS = "controlAccess";
|
||||
|
||||
public static final List<String> ALL = Arrays.asList(
|
||||
UP, DOWN, EDIT, DELETE, ADD, REMOVE, CATALOG_ITEM, TASK_CANCEL
|
||||
/**
|
||||
* All acceptable {@link Link#getRel()} values.
|
||||
*
|
||||
* This list must be updated whenever a new relationship is added.
|
||||
*/
|
||||
public static final List<String> ALL = Arrays.asList(
|
||||
UP, DOWN, EDIT, ADD, DELETE, REMOVE, CATALOG_ITEM, TASK_CANCEL,
|
||||
ALTERNATE, NEXT_PAGE, PREVIOUS_PAGE, LAST_PAGE, FIRST_PAGE,
|
||||
CONTROL_ACCESS
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -193,4 +206,4 @@ public class Link extends ReferenceType<Link> {
|
|||
public ToStringHelper string() {
|
||||
return super.string().add("rel", rel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.jclouds.vcloud.director.v1_5.domain;
|
||||
|
||||
import static com.google.common.base.Objects.equal;
|
||||
|
@ -27,69 +26,42 @@ import java.util.Arrays;
|
|||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
|
||||
import com.google.common.base.Objects.ToStringHelper;
|
||||
|
||||
/**
|
||||
*
|
||||
* Represents a media.
|
||||
*
|
||||
*
|
||||
* <p>Java class for Media complex type.
|
||||
*
|
||||
* <p>The following schema fragment specifies the expected content contained within this class.
|
||||
* Represents a media.
|
||||
*
|
||||
* <pre>
|
||||
* <complexType name="Media">
|
||||
* <complexContent>
|
||||
* <extension base="{http://www.vmware.com/vcloud/v1.5}ResourceEntityType">
|
||||
* <sequence>
|
||||
* <element name="Owner" type="{http://www.vmware.com/vcloud/v1.5}OwnerType" minOccurs="0"/>
|
||||
* </sequence>
|
||||
* <attribute name="imageType" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
|
||||
* <attribute name="size" use="required" type="{http://www.w3.org/2001/XMLSchema}long" />
|
||||
* <anyAttribute processContents='lax' namespace='##other'/>
|
||||
* </extension>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* <complexType name="Media" />
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlRootElement(namespace = VCLOUD_1_5_NS, name = "Media")
|
||||
@XmlType(propOrder = {"owner"})
|
||||
public class Media
|
||||
extends ResourceEntityType<Media>
|
||||
public class Media extends ResourceEntityType<Media> {
|
||||
|
||||
{
|
||||
public static final class ImageType {
|
||||
public static final String ISO = "iso";
|
||||
public static final String FLOPPY = "floppy";
|
||||
|
||||
public static final List<String> ALL = Arrays.asList(
|
||||
ISO, FLOPPY
|
||||
);
|
||||
public static final List<String> ALL = Arrays.asList(ISO, FLOPPY);
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Builder toBuilder() {
|
||||
return new Builder().fromMedia(this);
|
||||
}
|
||||
|
||||
public static class Builder extends ResourceEntityType.Builder<Media> {
|
||||
|
||||
|
||||
private Owner owner;
|
||||
private String imageType;
|
||||
private long size;
|
||||
|
@ -118,7 +90,7 @@ public class Media
|
|||
return this;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Media build() {
|
||||
Media media = new Media();
|
||||
media.setOwner(owner);
|
||||
|
@ -126,10 +98,11 @@ public class Media
|
|||
media.setSize(size);
|
||||
return media;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see ResourceEntityType#getFiles()
|
||||
*/
|
||||
@Override
|
||||
public Builder files(FilesList files) {
|
||||
super.files(files);
|
||||
return this;
|
||||
|
@ -138,11 +111,12 @@ public class Media
|
|||
/**
|
||||
* @see ResourceEntityType#getStatus()
|
||||
*/
|
||||
@Override
|
||||
public Builder status(Integer status) {
|
||||
super.status(status);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see EntityType#getName()
|
||||
*/
|
||||
|
@ -215,16 +189,13 @@ public class Media
|
|||
return this;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Builder fromResourceEntityType(ResourceEntityType<Media> in) {
|
||||
return Builder.class.cast(super.fromResourceEntityType(in));
|
||||
return Builder.class.cast(super.fromResourceEntityType(in));
|
||||
}
|
||||
|
||||
public Builder fromMedia(Media in) {
|
||||
return fromResourceEntityType(in)
|
||||
.owner(in.getOwner())
|
||||
.imageType(in.getImageType())
|
||||
.size(in.getSize());
|
||||
return fromResourceEntityType(in).owner(in.getOwner()).imageType(in.getImageType()).size(in.getSize());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -232,102 +203,65 @@ public class Media
|
|||
super();
|
||||
}
|
||||
|
||||
@XmlElement(namespace = VCLOUD_1_5_NS, name = "Owner")
|
||||
protected Owner owner;
|
||||
@XmlAttribute(required = true)
|
||||
protected String imageType;
|
||||
@XmlAttribute(required = true)
|
||||
protected long size;
|
||||
@XmlElement(namespace = VCLOUD_1_5_NS, name = "Owner")
|
||||
protected Owner owner;
|
||||
@XmlAttribute(required = true)
|
||||
protected String imageType;
|
||||
@XmlAttribute(required = true)
|
||||
protected long size;
|
||||
|
||||
/**
|
||||
* Gets the value of the owner property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link Owner }
|
||||
*
|
||||
*/
|
||||
public Owner getOwner() {
|
||||
return owner;
|
||||
}
|
||||
/**
|
||||
* Gets the value of the owner property.
|
||||
*/
|
||||
public Owner getOwner() {
|
||||
return owner;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the owner property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link Owner }
|
||||
*
|
||||
*/
|
||||
public void setOwner(Owner value) {
|
||||
this.owner = value;
|
||||
}
|
||||
public void setOwner(Owner value) {
|
||||
this.owner = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the imageType property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public String getImageType() {
|
||||
return imageType;
|
||||
}
|
||||
/**
|
||||
* Gets the value of the imageType property.
|
||||
*/
|
||||
public String getImageType() {
|
||||
return imageType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the imageType property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public void setImageType(String value) {
|
||||
this.imageType = value;
|
||||
}
|
||||
public void setImageType(String value) {
|
||||
this.imageType = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the size property.
|
||||
*
|
||||
*/
|
||||
public long getSize() {
|
||||
return size;
|
||||
}
|
||||
/**
|
||||
* Gets the value of the size property.
|
||||
*/
|
||||
public long getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the size property.
|
||||
*
|
||||
*/
|
||||
public void setSize(long value) {
|
||||
this.size = value;
|
||||
}
|
||||
public void setSize(long value) {
|
||||
this.size = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o)
|
||||
return true;
|
||||
return true;
|
||||
if (o == null || getClass() != o.getClass())
|
||||
return false;
|
||||
Media that = Media.class.cast(o);
|
||||
return equal(owner, that.owner) &&
|
||||
equal(imageType, that.imageType) &&
|
||||
equal(size, that.size);
|
||||
return super.equals(that) &&
|
||||
equal(this.owner, that.owner) && equal(this.imageType, that.imageType) && equal(this.size, that.size);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(owner,
|
||||
imageType,
|
||||
size);
|
||||
return super.hashCode() + Objects.hashCode(owner, imageType, size);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Objects.toStringHelper("")
|
||||
.add("owner", owner)
|
||||
.add("imageType", imageType)
|
||||
.add("size", size).toString();
|
||||
public ToStringHelper string() {
|
||||
return super.string().add("owner", owner).add("imageType", imageType).add("size", size);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -18,9 +18,9 @@
|
|||
*/
|
||||
package org.jclouds.vcloud.director.v1_5.domain;
|
||||
|
||||
import static com.google.common.base.Objects.*;
|
||||
import static com.google.common.base.Preconditions.*;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.*;
|
||||
import static com.google.common.base.Objects.equal;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Set;
|
||||
|
|
|
@ -18,9 +18,9 @@
|
|||
*/
|
||||
package org.jclouds.vcloud.director.v1_5.domain;
|
||||
|
||||
import static com.google.common.base.Objects.*;
|
||||
import static com.google.common.base.Preconditions.*;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.*;
|
||||
import static com.google.common.base.Objects.equal;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Set;
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
package org.jclouds.vcloud.director.v1_5.domain;
|
||||
|
||||
import static com.google.common.base.Objects.equal;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.*;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
|
|
|
@ -20,7 +20,7 @@ package org.jclouds.vcloud.director.v1_5.domain;
|
|||
|
||||
import static com.google.common.base.Objects.equal;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.*;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
package org.jclouds.vcloud.director.v1_5.domain;
|
||||
|
||||
import static com.google.common.base.Objects.equal;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.*;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
|
|
@ -18,9 +18,9 @@
|
|||
*/
|
||||
package org.jclouds.vcloud.director.v1_5.domain;
|
||||
|
||||
import static com.google.common.base.Objects.*;
|
||||
import static com.google.common.base.Preconditions.*;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.*;
|
||||
import static com.google.common.base.Objects.equal;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Set;
|
||||
|
|
|
@ -18,9 +18,9 @@
|
|||
*/
|
||||
package org.jclouds.vcloud.director.v1_5.domain;
|
||||
|
||||
import static com.google.common.base.Objects.*;
|
||||
import static com.google.common.base.Preconditions.*;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.*;
|
||||
import static com.google.common.base.Objects.equal;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
package org.jclouds.vcloud.director.v1_5.domain;
|
||||
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.*;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
|
|
|
@ -85,11 +85,11 @@ public class Reference extends ReferenceType<Reference> {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected Builder fromReferenceType(ReferenceType<Reference> in) {
|
||||
public Builder fromReferenceType(ReferenceType<Reference> in) {
|
||||
return Builder.class.cast(super.fromReferenceType(in));
|
||||
}
|
||||
|
||||
protected Builder fromReference(Reference in) {
|
||||
public Builder fromReference(Reference in) {
|
||||
return fromReferenceType(in);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
package org.jclouds.vcloud.director.v1_5.domain;
|
||||
|
||||
import static com.google.common.base.Objects.*;
|
||||
import static com.google.common.base.Objects.equal;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Map;
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
package org.jclouds.vcloud.director.v1_5.domain;
|
||||
|
||||
import static com.google.common.base.Preconditions.*;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Set;
|
||||
|
|
|
@ -25,52 +25,22 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
|||
import java.net.URI;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.base.Objects.ToStringHelper;
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* Base type that represents a resource entity such as a vApp
|
||||
* template or virtual media.
|
||||
*
|
||||
*
|
||||
* <p>Java class for ResourceEntity complex type.
|
||||
*
|
||||
* <p>The following schema fragment specifies the expected content contained within this class.
|
||||
* Base type that represents a resource entity such as a vApp template or virtual media.
|
||||
*
|
||||
* <pre>
|
||||
* <complexType name="ResourceEntity">
|
||||
* <complexContent>
|
||||
* <extension base="{http://www.vmware.com/vcloud/v1.5}EntityType">
|
||||
* <sequence>
|
||||
* <element name="Files" type="{http://www.vmware.com/vcloud/v1.5}FilesListType" minOccurs="0"/>
|
||||
* </sequence>
|
||||
* <attribute name="status" type="{http://www.w3.org/2001/XMLSchema}int" />
|
||||
* <anyAttribute processContents='lax' namespace='##other'/>
|
||||
* </extension>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* <complexType name="ResourceEntity" >
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
* @author danikov
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlType(name = "ResourceEntity", propOrder = {
|
||||
"files"
|
||||
})
|
||||
//@XmlSeeAlso({
|
||||
// MediaType.class,
|
||||
// VAppTemplateType.class,
|
||||
// AbstractVAppType.class,
|
||||
// NetworkPoolType.class
|
||||
//})
|
||||
public class ResourceEntityType<T extends ResourceEntityType<T>> extends EntityType<T> {
|
||||
|
||||
public static <T extends ResourceEntityType<T>> Builder<T> builder() {
|
||||
|
@ -83,7 +53,7 @@ public class ResourceEntityType<T extends ResourceEntityType<T>> extends EntityT
|
|||
}
|
||||
|
||||
public static class Builder<T extends ResourceEntityType<T>> extends EntityType.Builder<T> {
|
||||
|
||||
|
||||
private FilesList files;
|
||||
private Integer status;
|
||||
|
||||
|
@ -103,7 +73,7 @@ public class ResourceEntityType<T extends ResourceEntityType<T>> extends EntityT
|
|||
return this;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ResourceEntityType<T> build() {
|
||||
ResourceEntityType<T> resourceEntity = new ResourceEntityType<T>();
|
||||
resourceEntity.setFiles(files);
|
||||
|
@ -111,7 +81,6 @@ public class ResourceEntityType<T extends ResourceEntityType<T>> extends EntityT
|
|||
return resourceEntity;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see EntityType#getId()
|
||||
*/
|
||||
|
@ -165,101 +134,66 @@ public class ResourceEntityType<T extends ResourceEntityType<T>> extends EntityT
|
|||
this.links.add(checkNotNull(link, "link"));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
|
||||
@Override
|
||||
public Builder<T> fromResourceType(ResourceType<T> in) {
|
||||
return Builder.class.cast(super.fromResourceType(in));
|
||||
}
|
||||
|
||||
public Builder<T> fromResourceEntityType(ResourceEntityType<T> in) {
|
||||
return fromResourceType(in)
|
||||
.files(in.getFiles())
|
||||
.status(in.getStatus());
|
||||
return fromResourceType(in).files(in.getFiles()).status(in.getStatus());
|
||||
}
|
||||
}
|
||||
|
||||
public ResourceEntityType() {
|
||||
// for JAXB
|
||||
}
|
||||
|
||||
@XmlElement(name = "Files")
|
||||
protected FilesList files;
|
||||
@XmlAttribute
|
||||
protected Integer status;
|
||||
@XmlElement(name = "Files")
|
||||
protected FilesList files;
|
||||
@XmlAttribute
|
||||
protected Integer status;
|
||||
|
||||
/**
|
||||
* Gets the value of the files property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link FilesList }
|
||||
*
|
||||
*/
|
||||
public FilesList getFiles() {
|
||||
return files;
|
||||
}
|
||||
/**
|
||||
* Gets the value of the files property.
|
||||
*/
|
||||
public FilesList getFiles() {
|
||||
return files;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the files property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link FilesList }
|
||||
*
|
||||
*/
|
||||
public void setFiles(FilesList value) {
|
||||
this.files = value;
|
||||
}
|
||||
public void setFiles(FilesList value) {
|
||||
this.files = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the status property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link Integer }
|
||||
*
|
||||
*/
|
||||
public Integer getStatus() {
|
||||
return status;
|
||||
}
|
||||
/**
|
||||
* Gets the value of the status property.
|
||||
*/
|
||||
public Integer getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the status property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link Integer }
|
||||
*
|
||||
*/
|
||||
public void setStatus(Integer value) {
|
||||
this.status = value;
|
||||
}
|
||||
public void setStatus(Integer value) {
|
||||
this.status = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o)
|
||||
return true;
|
||||
return true;
|
||||
if (o == null || getClass() != o.getClass())
|
||||
return false;
|
||||
ResourceEntityType<?> that = ResourceEntityType.class.cast(o);
|
||||
return equal(files, that.files) &&
|
||||
equal(status, that.status);
|
||||
return super.equals(that) && equal(this.files, that.files) && equal(this.status, that.status);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(files,
|
||||
status);
|
||||
return super.hashCode() + Objects.hashCode(files, status);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Objects.toStringHelper("")
|
||||
.add("files", files)
|
||||
.add("status", status).toString();
|
||||
public ToStringHelper string() {
|
||||
return super.string().add("files", files).add("status", status);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -18,9 +18,9 @@
|
|||
*/
|
||||
package org.jclouds.vcloud.director.v1_5.domain;
|
||||
|
||||
import static com.google.common.base.Objects.*;
|
||||
import static com.google.common.base.Preconditions.*;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.*;
|
||||
import static com.google.common.base.Objects.equal;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Set;
|
||||
|
@ -32,7 +32,6 @@ import javax.xml.bind.annotation.XmlElement;
|
|||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.base.Objects.ToStringHelper;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
/**
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
package org.jclouds.vcloud.director.v1_5.domain;
|
||||
|
||||
import static com.google.common.base.Objects.equal;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.*;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
|
|
@ -18,9 +18,9 @@
|
|||
*/
|
||||
package org.jclouds.vcloud.director.v1_5.domain;
|
||||
|
||||
import static com.google.common.base.Objects.*;
|
||||
import static com.google.common.base.Preconditions.*;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.*;
|
||||
import static com.google.common.base.Objects.equal;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Set;
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
package org.jclouds.vcloud.director.v1_5.domain;
|
||||
|
||||
import static com.google.common.base.Objects.*;
|
||||
import static com.google.common.base.Objects.equal;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
package org.jclouds.vcloud.director.v1_5.domain;
|
||||
|
||||
import static com.google.common.base.Objects.equal;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.*;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
|
|
|
@ -18,9 +18,9 @@
|
|||
*/
|
||||
package org.jclouds.vcloud.director.v1_5.domain;
|
||||
|
||||
import static com.google.common.base.Objects.*;
|
||||
import static com.google.common.base.Preconditions.*;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.*;
|
||||
import static com.google.common.base.Objects.equal;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Arrays;
|
||||
|
@ -147,13 +147,6 @@ public class Task extends EntityType<Task> {
|
|||
this.status = status;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Task#getStatus()
|
||||
*/
|
||||
public Builder status(TaskStatus status) {
|
||||
return this.status(status.toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Task#getOperation()
|
||||
|
@ -418,14 +411,10 @@ public class Task extends EntityType<Task> {
|
|||
* <li>aborted - The task was aborted by an administrative action.
|
||||
* </ul>
|
||||
*/
|
||||
public TaskStatus getStatus() {
|
||||
return TaskStatus.fromValue(status);
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(TaskStatus status) {
|
||||
this.setStatus(status.toString());
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
|
|
@ -1,41 +0,0 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.vcloud.director.v1_5.domain;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*
|
||||
*/
|
||||
public class TaskInErrorStateException extends RuntimeException {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private final Task task;
|
||||
|
||||
public TaskInErrorStateException(Task task) {
|
||||
super("error on task: " + task + " error: " + task.getError());
|
||||
this.task = task;
|
||||
}
|
||||
|
||||
public Task getTask() {
|
||||
return task;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,73 +0,0 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.vcloud.director.v1_5.domain;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
/**
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
public enum TaskStatus {
|
||||
/**
|
||||
* The task has completed and returned a value indicating success.
|
||||
*/
|
||||
SUCCESS,
|
||||
/**
|
||||
* The task is running.
|
||||
*/
|
||||
RUNNING,
|
||||
|
||||
/**
|
||||
* The task has been queued for execution.
|
||||
*/
|
||||
QUEUED,
|
||||
/**
|
||||
* The task has completed and returned a value indicating an error.
|
||||
*/
|
||||
ERROR,
|
||||
/**
|
||||
* not an official status, temporarily in.
|
||||
*/
|
||||
CANCELLED, UNRECOGNIZED;
|
||||
public String value() {
|
||||
return name().toLowerCase();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return value();
|
||||
}
|
||||
|
||||
public static TaskStatus fromValue(String status) {
|
||||
if ("CANCELED".equals(status.toUpperCase())) {
|
||||
// TODO: ecloud hack
|
||||
status = "CANCELLED";
|
||||
} else if ("FAILED".equals(status.toUpperCase())) {
|
||||
status = "ERROR";
|
||||
} else if ("COMPLETED".equals(status.toUpperCase())) {
|
||||
status = "SUCCESS";
|
||||
}
|
||||
try {
|
||||
return valueOf(checkNotNull(status, "status").toUpperCase());
|
||||
} catch (IllegalArgumentException e) {
|
||||
return UNRECOGNIZED;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -18,9 +18,9 @@
|
|||
*/
|
||||
package org.jclouds.vcloud.director.v1_5.domain;
|
||||
|
||||
import static com.google.common.base.Objects.*;
|
||||
import static com.google.common.base.Preconditions.*;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.*;
|
||||
import static com.google.common.base.Objects.equal;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Set;
|
||||
|
|
|
@ -18,9 +18,9 @@
|
|||
*/
|
||||
package org.jclouds.vcloud.director.v1_5.domain;
|
||||
|
||||
import static com.google.common.base.Objects.*;
|
||||
import static com.google.common.base.Preconditions.*;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.*;
|
||||
import static com.google.common.base.Objects.equal;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Set;
|
||||
|
|
|
@ -0,0 +1,931 @@
|
|||
/*
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.vcloud.director.v1_5.domain;
|
||||
|
||||
import static com.google.common.base.Objects.equal;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
/**
|
||||
*
|
||||
* Represents users in the vCloud system.
|
||||
*
|
||||
*
|
||||
* <p>Java class for User complex type.
|
||||
*
|
||||
* <p>The following schema fragment specifies the expected content contained within this class.
|
||||
*
|
||||
* <pre>
|
||||
* <complexType name="User">
|
||||
* <complexContent>
|
||||
* <extension base="{http://www.vmware.com/vcloud/v1.5}EntityType">
|
||||
* <sequence>
|
||||
* <element name="FullName" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
|
||||
* <element name="EmailAddress" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
|
||||
* <element name="Telephone" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
|
||||
* <element name="IsEnabled" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
|
||||
* <element name="IsLocked" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
|
||||
* <element name="IM" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
|
||||
* <element name="NameInSource" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
|
||||
* <element name="IsAlertEnabled" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
|
||||
* <element name="AlertEmailPrefix" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
|
||||
* <element name="AlertEmail" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
|
||||
* <element name="IsExternal" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
|
||||
* <element name="IsDefaultCached" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
|
||||
* <element name="IsGroupRole" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
|
||||
* <element name="StoredVmQuota" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
|
||||
* <element name="DeployedVmQuota" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
|
||||
* <element name="Role" type="{http://www.vmware.com/vcloud/v1.5}ReferenceType" minOccurs="0"/>
|
||||
* <element name="Password" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
|
||||
* <element name="GroupReferences" type="{http://www.vmware.com/vcloud/v1.5}GroupsListType" minOccurs="0"/>
|
||||
* </sequence>
|
||||
* <anyAttribute processContents='lax' namespace='##other'/>
|
||||
* </extension>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlType(name = "User", propOrder = {
|
||||
"fullName",
|
||||
"emailAddress",
|
||||
"telephone",
|
||||
"isEnabled",
|
||||
"isLocked",
|
||||
"im",
|
||||
"nameInSource",
|
||||
"isAlertEnabled",
|
||||
"alertEmailPrefix",
|
||||
"alertEmail",
|
||||
"isExternal",
|
||||
"isDefaultCached",
|
||||
"isGroupRole",
|
||||
"storedVmQuota",
|
||||
"deployedVmQuota",
|
||||
"role",
|
||||
"password",
|
||||
"groupReferences"
|
||||
})
|
||||
public class User
|
||||
extends EntityType<User>
|
||||
|
||||
{
|
||||
@SuppressWarnings("unchecked")
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
public Builder toBuilder() {
|
||||
return new Builder().fromUser(this);
|
||||
}
|
||||
|
||||
public static class Builder extends EntityType.Builder<User> {
|
||||
|
||||
private String fullName;
|
||||
private String emailAddress;
|
||||
private String telephone;
|
||||
private Boolean isEnabled;
|
||||
private Boolean isLocked;
|
||||
private String im;
|
||||
private String nameInSource;
|
||||
private Boolean isAlertEnabled;
|
||||
private String alertEmailPrefix;
|
||||
private String alertEmail;
|
||||
private Boolean isExternal;
|
||||
private Boolean isDefaultCached;
|
||||
private Boolean isGroupRole;
|
||||
private Integer storedVmQuota;
|
||||
private Integer deployedVmQuota;
|
||||
private Reference role;
|
||||
private String password;
|
||||
private Object /* GroupsList */ groupReferences;
|
||||
|
||||
/**
|
||||
* @see User#getFullName()
|
||||
*/
|
||||
public Builder fullName(String fullName) {
|
||||
this.fullName = fullName;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see User#getEmailAddress()
|
||||
*/
|
||||
public Builder emailAddress(String emailAddress) {
|
||||
this.emailAddress = emailAddress;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see User#getTelephone()
|
||||
*/
|
||||
public Builder telephone(String telephone) {
|
||||
this.telephone = telephone;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see User#getIsEnabled()
|
||||
*/
|
||||
public Builder isEnabled(Boolean isEnabled) {
|
||||
this.isEnabled = isEnabled;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see User#getIsLocked()
|
||||
*/
|
||||
public Builder isLocked(Boolean isLocked) {
|
||||
this.isLocked = isLocked;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see User#getIm()
|
||||
*/
|
||||
public Builder im(String im) {
|
||||
this.im = im;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see User#getNameInSource()
|
||||
*/
|
||||
public Builder nameInSource(String nameInSource) {
|
||||
this.nameInSource = nameInSource;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see User#getIsAlertEnabled()
|
||||
*/
|
||||
public Builder isAlertEnabled(Boolean isAlertEnabled) {
|
||||
this.isAlertEnabled = isAlertEnabled;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see User#getAlertEmailPrefix()
|
||||
*/
|
||||
public Builder alertEmailPrefix(String alertEmailPrefix) {
|
||||
this.alertEmailPrefix = alertEmailPrefix;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see User#getAlertEmail()
|
||||
*/
|
||||
public Builder alertEmail(String alertEmail) {
|
||||
this.alertEmail = alertEmail;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see User#getIsExternal()
|
||||
*/
|
||||
public Builder isExternal(Boolean isExternal) {
|
||||
this.isExternal = isExternal;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see User#getIsDefaultCached()
|
||||
*/
|
||||
public Builder isDefaultCached(Boolean isDefaultCached) {
|
||||
this.isDefaultCached = isDefaultCached;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see User#getIsGroupRole()
|
||||
*/
|
||||
public Builder isGroupRole(Boolean isGroupRole) {
|
||||
this.isGroupRole = isGroupRole;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see User#getStoredVmQuota()
|
||||
*/
|
||||
public Builder storedVmQuota(Integer storedVmQuota) {
|
||||
this.storedVmQuota = storedVmQuota;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see User#getDeployedVmQuota()
|
||||
*/
|
||||
public Builder deployedVmQuota(Integer deployedVmQuota) {
|
||||
this.deployedVmQuota = deployedVmQuota;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see User#getRole()
|
||||
*/
|
||||
public Builder role(Reference role) {
|
||||
this.role = role;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see User#getPassword()
|
||||
*/
|
||||
public Builder password(String password) {
|
||||
this.password = password;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see User#getGroupReferences()
|
||||
*/
|
||||
public Builder groupReferences(Object /* GroupsList */ groupReferences) {
|
||||
this.groupReferences = groupReferences;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public User build() {
|
||||
User user = new User(im);
|
||||
user.setFullName(fullName);
|
||||
user.setEmailAddress(emailAddress);
|
||||
user.setTelephone(telephone);
|
||||
user.setIsEnabled(isEnabled);
|
||||
user.setIsLocked(isLocked);
|
||||
user.setNameInSource(nameInSource);
|
||||
user.setIsAlertEnabled(isAlertEnabled);
|
||||
user.setAlertEmailPrefix(alertEmailPrefix);
|
||||
user.setAlertEmail(alertEmail);
|
||||
user.setIsExternal(isExternal);
|
||||
user.setIsDefaultCached(isDefaultCached);
|
||||
user.setIsGroupRole(isGroupRole);
|
||||
user.setStoredVmQuota(storedVmQuota);
|
||||
user.setDeployedVmQuota(deployedVmQuota);
|
||||
user.setRole(role);
|
||||
user.setPassword(password);
|
||||
user.setGroupReferences(groupReferences);
|
||||
return user;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see EntityType#getId()
|
||||
*/
|
||||
@Override
|
||||
public Builder id(String id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see EntityType#getTasksInProgress()
|
||||
*/
|
||||
@Override
|
||||
public Builder tasksInProgress(TasksInProgress tasksInProgress) {
|
||||
this.tasksInProgress = tasksInProgress;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ReferenceType#getHref()
|
||||
*/
|
||||
@Override
|
||||
public Builder href(URI href) {
|
||||
this.href = href;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ReferenceType#getType()
|
||||
*/
|
||||
@Override
|
||||
public Builder type(String type) {
|
||||
this.type = type;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ReferenceType#getLinks()
|
||||
*/
|
||||
@Override
|
||||
public Builder links(Set<Link> links) {
|
||||
this.links = Sets.newLinkedHashSet(checkNotNull(links, "links"));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ReferenceType#getLinks()
|
||||
*/
|
||||
@Override
|
||||
public Builder link(Link link) {
|
||||
this.links.add(checkNotNull(link, "link"));
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Builder fromEntityType(EntityType<User> in) {
|
||||
return Builder.class.cast(super.fromEntityType(in));
|
||||
}
|
||||
public Builder fromUser(User in) {
|
||||
return fromEntityType(in)
|
||||
.fullName(in.getFullName())
|
||||
.emailAddress(in.getEmailAddress())
|
||||
.telephone(in.getTelephone())
|
||||
.isEnabled(in.isEnabled())
|
||||
.isLocked(in.isLocked())
|
||||
.im(in.getIM())
|
||||
.nameInSource(in.getNameInSource())
|
||||
.isAlertEnabled(in.isAlertEnabled())
|
||||
.alertEmailPrefix(in.getAlertEmailPrefix())
|
||||
.alertEmail(in.getAlertEmail())
|
||||
.isExternal(in.isExternal())
|
||||
.isDefaultCached(in.isDefaultCached())
|
||||
.isGroupRole(in.isGroupRole())
|
||||
.storedVmQuota(in.getStoredVmQuota())
|
||||
.deployedVmQuota(in.getDeployedVmQuota())
|
||||
.role(in.getRole())
|
||||
.password(in.getPassword())
|
||||
.groupReferences(in.getGroupReferences());
|
||||
}
|
||||
}
|
||||
|
||||
private User() {
|
||||
// For JAXB and builder use
|
||||
}
|
||||
|
||||
private User(String im) {
|
||||
this.im = im;
|
||||
}
|
||||
|
||||
|
||||
@XmlElement(name = "FullName")
|
||||
protected String fullName;
|
||||
@XmlElement(name = "EmailAddress")
|
||||
protected String emailAddress;
|
||||
@XmlElement(name = "Telephone")
|
||||
protected String telephone;
|
||||
@XmlElement(name = "IsEnabled")
|
||||
protected Boolean isEnabled;
|
||||
@XmlElement(name = "IsLocked")
|
||||
protected Boolean isLocked;
|
||||
@XmlElement(name = "IM")
|
||||
protected String im;
|
||||
@XmlElement(name = "NameInSource")
|
||||
protected String nameInSource;
|
||||
@XmlElement(name = "IsAlertEnabled")
|
||||
protected Boolean isAlertEnabled;
|
||||
@XmlElement(name = "AlertEmailPrefix")
|
||||
protected String alertEmailPrefix;
|
||||
@XmlElement(name = "AlertEmail")
|
||||
protected String alertEmail;
|
||||
@XmlElement(name = "IsExternal")
|
||||
protected Boolean isExternal;
|
||||
@XmlElement(name = "IsDefaultCached")
|
||||
protected Boolean isDefaultCached;
|
||||
@XmlElement(name = "IsGroupRole")
|
||||
protected Boolean isGroupRole;
|
||||
@XmlElement(name = "StoredVmQuota")
|
||||
protected Integer storedVmQuota;
|
||||
@XmlElement(name = "DeployedVmQuota")
|
||||
protected Integer deployedVmQuota;
|
||||
@XmlElement(name = "Role")
|
||||
protected Reference role;
|
||||
@XmlElement(name = "Password")
|
||||
protected String password;
|
||||
@XmlElement(name = "GroupReferences")
|
||||
protected Object /* GroupsList */ groupReferences;
|
||||
|
||||
/**
|
||||
* Gets the value of the fullName property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public String getFullName() {
|
||||
return fullName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the fullName property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public void setFullName(String value) {
|
||||
this.fullName = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the emailAddress property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public String getEmailAddress() {
|
||||
return emailAddress;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the emailAddress property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public void setEmailAddress(String value) {
|
||||
this.emailAddress = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the telephone property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public String getTelephone() {
|
||||
return telephone;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the telephone property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public void setTelephone(String value) {
|
||||
this.telephone = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the isEnabled property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link Boolean }
|
||||
*
|
||||
*/
|
||||
public Boolean isEnabled() {
|
||||
return isEnabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the isEnabled property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link Boolean }
|
||||
*
|
||||
*/
|
||||
public void setIsEnabled(Boolean value) {
|
||||
this.isEnabled = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the isLocked property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link Boolean }
|
||||
*
|
||||
*/
|
||||
public Boolean isLocked() {
|
||||
return isLocked;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the isLocked property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link Boolean }
|
||||
*
|
||||
*/
|
||||
public void setIsLocked(Boolean value) {
|
||||
this.isLocked = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the im property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public String getIM() {
|
||||
return im;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the im property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public void setIM(String value) {
|
||||
this.im = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the nameInSource property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public String getNameInSource() {
|
||||
return nameInSource;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the nameInSource property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public void setNameInSource(String value) {
|
||||
this.nameInSource = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the isAlertEnabled property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link Boolean }
|
||||
*
|
||||
*/
|
||||
public Boolean isAlertEnabled() {
|
||||
return isAlertEnabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the isAlertEnabled property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link Boolean }
|
||||
*
|
||||
*/
|
||||
public void setIsAlertEnabled(Boolean value) {
|
||||
this.isAlertEnabled = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the alertEmailPrefix property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public String getAlertEmailPrefix() {
|
||||
return alertEmailPrefix;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the alertEmailPrefix property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public void setAlertEmailPrefix(String value) {
|
||||
this.alertEmailPrefix = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the alertEmail property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public String getAlertEmail() {
|
||||
return alertEmail;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the alertEmail property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public void setAlertEmail(String value) {
|
||||
this.alertEmail = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the isExternal property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link Boolean }
|
||||
*
|
||||
*/
|
||||
public Boolean isExternal() {
|
||||
return isExternal;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the isExternal property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link Boolean }
|
||||
*
|
||||
*/
|
||||
public void setIsExternal(Boolean value) {
|
||||
this.isExternal = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the isDefaultCached property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link Boolean }
|
||||
*
|
||||
*/
|
||||
public Boolean isDefaultCached() {
|
||||
return isDefaultCached;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the isDefaultCached property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link Boolean }
|
||||
*
|
||||
*/
|
||||
public void setIsDefaultCached(Boolean value) {
|
||||
this.isDefaultCached = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the isGroupRole property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link Boolean }
|
||||
*
|
||||
*/
|
||||
public Boolean isGroupRole() {
|
||||
return isGroupRole;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the isGroupRole property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link Boolean }
|
||||
*
|
||||
*/
|
||||
public void setIsGroupRole(Boolean value) {
|
||||
this.isGroupRole = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the storedVmQuota property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link Integer }
|
||||
*
|
||||
*/
|
||||
public Integer getStoredVmQuota() {
|
||||
return storedVmQuota;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the storedVmQuota property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link Integer }
|
||||
*
|
||||
*/
|
||||
public void setStoredVmQuota(Integer value) {
|
||||
this.storedVmQuota = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the deployedVmQuota property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link Integer }
|
||||
*
|
||||
*/
|
||||
public Integer getDeployedVmQuota() {
|
||||
return deployedVmQuota;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the deployedVmQuota property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link Integer }
|
||||
*
|
||||
*/
|
||||
public void setDeployedVmQuota(Integer value) {
|
||||
this.deployedVmQuota = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the role property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link Reference }
|
||||
*
|
||||
*/
|
||||
public Reference getRole() {
|
||||
return role;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the role property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link Reference }
|
||||
*
|
||||
*/
|
||||
public void setRole(Reference value) {
|
||||
this.role = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the password property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the password property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public void setPassword(String value) {
|
||||
this.password = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the groupReferences property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link GroupsList }
|
||||
*
|
||||
*/
|
||||
public Object /* GroupsList */ getGroupReferences() {
|
||||
return groupReferences;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the groupReferences property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link GroupsList }
|
||||
*
|
||||
*/
|
||||
public void setGroupReferences(Object /* GroupsList */ value) {
|
||||
this.groupReferences = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o)
|
||||
return true;
|
||||
if (o == null || getClass() != o.getClass())
|
||||
return false;
|
||||
User that = User.class.cast(o);
|
||||
return equal(fullName, that.fullName) &&
|
||||
equal(emailAddress, that.emailAddress) &&
|
||||
equal(telephone, that.telephone) &&
|
||||
equal(isEnabled, that.isEnabled) &&
|
||||
equal(isLocked, that.isLocked) &&
|
||||
equal(im, that.im) &&
|
||||
equal(nameInSource, that.nameInSource) &&
|
||||
equal(isAlertEnabled, that.isAlertEnabled) &&
|
||||
equal(alertEmailPrefix, that.alertEmailPrefix) &&
|
||||
equal(alertEmail, that.alertEmail) &&
|
||||
equal(isExternal, that.isExternal) &&
|
||||
equal(isDefaultCached, that.isDefaultCached) &&
|
||||
equal(isGroupRole, that.isGroupRole) &&
|
||||
equal(storedVmQuota, that.storedVmQuota) &&
|
||||
equal(deployedVmQuota, that.deployedVmQuota) &&
|
||||
equal(role, that.role) &&
|
||||
equal(password, that.password) &&
|
||||
equal(groupReferences, that.groupReferences);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(fullName,
|
||||
emailAddress,
|
||||
telephone,
|
||||
isEnabled,
|
||||
isLocked,
|
||||
im,
|
||||
nameInSource,
|
||||
isAlertEnabled,
|
||||
alertEmailPrefix,
|
||||
alertEmail,
|
||||
isExternal,
|
||||
isDefaultCached,
|
||||
isGroupRole,
|
||||
storedVmQuota,
|
||||
deployedVmQuota,
|
||||
role,
|
||||
password,
|
||||
groupReferences);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Objects.toStringHelper("")
|
||||
.add("fullName", fullName)
|
||||
.add("emailAddress", emailAddress)
|
||||
.add("telephone", telephone)
|
||||
.add("isEnabled", isEnabled)
|
||||
.add("isLocked", isLocked)
|
||||
.add("im", im)
|
||||
.add("nameInSource", nameInSource)
|
||||
.add("isAlertEnabled", isAlertEnabled)
|
||||
.add("alertEmailPrefix", alertEmailPrefix)
|
||||
.add("alertEmail", alertEmail)
|
||||
.add("isExternal", isExternal)
|
||||
.add("isDefaultCached", isDefaultCached)
|
||||
.add("isGroupRole", isGroupRole)
|
||||
.add("storedVmQuota", storedVmQuota)
|
||||
.add("deployedVmQuota", deployedVmQuota)
|
||||
.add("role", role)
|
||||
.add("password", password)
|
||||
.add("groupReferences", groupReferences).toString();
|
||||
}
|
||||
|
||||
}
|
|
@ -19,6 +19,8 @@
|
|||
@XmlSchema(namespace = VCLOUD_1_5_NS, elementFormDefault = XmlNsForm.QUALIFIED)
|
||||
package org.jclouds.vcloud.director.v1_5.domain;
|
||||
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
|
||||
|
||||
import javax.xml.bind.annotation.XmlNsForm;
|
||||
import javax.xml.bind.annotation.XmlSchema;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.*;
|
||||
|
||||
|
|
|
@ -0,0 +1,180 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.jclouds.vcloud.director.v1_5.domain.query;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import org.jclouds.vcloud.director.v1_5.domain.CatalogReference;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Link;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
/**
|
||||
* Represents the results from a vCloud query as references.
|
||||
*
|
||||
* <pre>
|
||||
* <complexType name="QueryResultReferences" />
|
||||
* </pre>
|
||||
*
|
||||
* @author grkvlt@apache.org
|
||||
*/
|
||||
@XmlRootElement(namespace = VCLOUD_1_5_NS, name = "CatalogReferences")
|
||||
public class CatalogReferences extends QueryResultReferences<CatalogReference> {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Builder toBuilder() {
|
||||
return new Builder().fromQueryResultReferences(this);
|
||||
}
|
||||
|
||||
public static class Builder extends QueryResultReferences.Builder<CatalogReference> {
|
||||
|
||||
@Override
|
||||
public CatalogReferences build() {
|
||||
CatalogReferences queryResultReferences = new CatalogReferences(href);
|
||||
queryResultReferences.setReferences(references);
|
||||
queryResultReferences.setName(name);
|
||||
queryResultReferences.setPage(page);
|
||||
queryResultReferences.setPageSize(pageSize);
|
||||
queryResultReferences.setTotal(total);
|
||||
queryResultReferences.setType(type);
|
||||
queryResultReferences.setLinks(links);
|
||||
return queryResultReferences;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see QueryResultReferences#getReferences()
|
||||
*/
|
||||
@Override
|
||||
public Builder references(List<CatalogReference> references) {
|
||||
this.references = references;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see QueryResultReferences#getReferences()
|
||||
*/
|
||||
@Override
|
||||
public Builder reference(CatalogReference reference) {
|
||||
this.references.add(reference);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Container#getName()
|
||||
*/
|
||||
@Override
|
||||
public Builder name(String name) {
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Container#getPage()
|
||||
*/
|
||||
@Override
|
||||
public Builder page(Integer page) {
|
||||
this.page = page;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Container#getPageSize()
|
||||
*/
|
||||
@Override
|
||||
public Builder pageSize(Integer pageSize) {
|
||||
this.pageSize = pageSize;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Container#getTotal()
|
||||
*/
|
||||
@Override
|
||||
public Builder total(Long total) {
|
||||
this.total = total;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ResourceType#getHref()
|
||||
*/
|
||||
@Override
|
||||
public Builder href(URI href) {
|
||||
super.href(href);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ResourceType#getType()
|
||||
*/
|
||||
@Override
|
||||
public Builder type(String type) {
|
||||
super.type(type);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ResourceType#getLinks()
|
||||
*/
|
||||
@Override
|
||||
public Builder links(Set<Link> links) {
|
||||
super.links(Sets.newLinkedHashSet(checkNotNull(links, "links")));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ResourceType#getLinks()
|
||||
*/
|
||||
@Override
|
||||
public Builder link(Link link) {
|
||||
super.link(link);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Builder fromQueryResultReferences(QueryResultReferences<CatalogReference> in) {
|
||||
return Builder.class.cast(super.fromQueryResultReferences(in));
|
||||
}
|
||||
|
||||
public Builder fromCatalogReferences(CatalogReferences in) {
|
||||
return fromQueryResultReferences(in);
|
||||
}
|
||||
}
|
||||
|
||||
protected CatalogReferences() {
|
||||
// For JAXB and builder use
|
||||
}
|
||||
|
||||
protected CatalogReferences(URI href) {
|
||||
super(href);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,238 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.jclouds.vcloud.director.v1_5.domain.query;
|
||||
|
||||
import static com.google.common.base.Objects.equal;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Link;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.ResourceType;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.base.Objects.ToStringHelper;
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
/**
|
||||
* Container for query result sets.
|
||||
*
|
||||
* <pre>
|
||||
* <complexType name="Container" />
|
||||
* </pre>
|
||||
*
|
||||
* @author grkvlt@apache.org
|
||||
*/
|
||||
public class ContainerType<T extends ContainerType<T>> extends ResourceType<T> {
|
||||
|
||||
public static <T extends ContainerType<T>> Builder<T> builder() {
|
||||
return new Builder<T>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Builder<T> toBuilder() {
|
||||
return new Builder<T>().fromContainerType(this);
|
||||
}
|
||||
|
||||
public static class Builder<T extends ContainerType<T>> extends ResourceType.Builder<T> {
|
||||
|
||||
protected String name;
|
||||
protected Integer page;
|
||||
protected Integer pageSize;
|
||||
protected Long total;
|
||||
|
||||
/**
|
||||
* @see Container#getName()
|
||||
*/
|
||||
public Builder<T> name(String name) {
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Container#getPage()
|
||||
*/
|
||||
public Builder<T> page(Integer page) {
|
||||
this.page = page;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Container#getPageSize()
|
||||
*/
|
||||
public Builder<T> pageSize(Integer pageSize) {
|
||||
this.pageSize = pageSize;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Container#getTotal()
|
||||
*/
|
||||
public Builder<T> total(Long total) {
|
||||
this.total = total;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ContainerType<T> build() {
|
||||
ContainerType<T> container = new ContainerType<T>(href);
|
||||
container.setName(name);
|
||||
container.setPage(page);
|
||||
container.setPageSize(pageSize);
|
||||
container.setTotal(total);
|
||||
container.setType(type);
|
||||
container.setLinks(links);
|
||||
return container;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ResourceType#getHref()
|
||||
*/
|
||||
@Override
|
||||
public Builder<T> href(URI href) {
|
||||
super.href(href);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ResourceType#getType()
|
||||
*/
|
||||
@Override
|
||||
public Builder<T> type(String type) {
|
||||
super.type(type);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ResourceType#getLinks()
|
||||
*/
|
||||
@Override
|
||||
public Builder<T> links(Set<Link> links) {
|
||||
super.links(Sets.newLinkedHashSet(checkNotNull(links, "links")));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ResourceType#getLinks()
|
||||
*/
|
||||
@Override
|
||||
public Builder<T> link(Link link) {
|
||||
super.link(link);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Builder<T> fromResourceType(ResourceType<T> in) {
|
||||
return Builder.class.cast(super.fromResourceType(in));
|
||||
}
|
||||
|
||||
public Builder<T> fromContainerType(ContainerType<T> in) {
|
||||
return fromResourceType(in).name(in.getName()).page(in.getPage()).pageSize(in.getPageSize()).total(in.getTotal());
|
||||
}
|
||||
}
|
||||
|
||||
protected ContainerType() {
|
||||
// For JAXB and builder use
|
||||
}
|
||||
|
||||
protected ContainerType(URI href) {
|
||||
super(href);
|
||||
}
|
||||
|
||||
|
||||
@XmlAttribute
|
||||
protected String name;
|
||||
@XmlAttribute
|
||||
protected Integer page;
|
||||
@XmlAttribute
|
||||
protected Integer pageSize;
|
||||
@XmlAttribute
|
||||
protected Long total;
|
||||
|
||||
/**
|
||||
* Query name that generated this result set.
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String value) {
|
||||
this.name = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Page of the result set that this container holds. The first page is page number 1.
|
||||
*/
|
||||
public Integer getPage() {
|
||||
return page;
|
||||
}
|
||||
|
||||
public void setPage(Integer value) {
|
||||
this.page = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Page size, as a number of records or references.
|
||||
*/
|
||||
public Integer getPageSize() {
|
||||
return pageSize;
|
||||
}
|
||||
|
||||
public void setPageSize(Integer value) {
|
||||
this.pageSize = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Total number of records or references in the container.
|
||||
*/
|
||||
public Long getTotal() {
|
||||
return total;
|
||||
}
|
||||
|
||||
public void setTotal(Long value) {
|
||||
this.total = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o)
|
||||
return true;
|
||||
if (o == null || getClass() != o.getClass())
|
||||
return false;
|
||||
ContainerType<T> that = ContainerType.class.cast(o);
|
||||
return super.equals(that) &&
|
||||
equal(this.name, that.name) && equal(this.page, that.page) &&
|
||||
equal(this.pageSize, that.pageSize) && equal(this.total, that.total);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return super.hashCode() + Objects.hashCode(name, page, pageSize, total);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ToStringHelper string() {
|
||||
return super.string().add("name", name).add("page", page).add("pageSize", pageSize).add("total", total);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,98 @@
|
|||
/*
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.vcloud.director.v1_5.domain.query;
|
||||
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
|
||||
import com.google.common.base.Objects.ToStringHelper;
|
||||
|
||||
/**
|
||||
*
|
||||
* Container for the list of typed queries available to the
|
||||
* requesting user.
|
||||
*
|
||||
*
|
||||
* <p>Java class for QueryList complex type.
|
||||
*
|
||||
* <p>The following schema fragment specifies the expected content contained within this class.
|
||||
*
|
||||
* <pre>
|
||||
* <complexType name="QueryList">
|
||||
* <complexContent>
|
||||
* <extension base="{http://www.vmware.com/vcloud/v1.5}ContainerType">
|
||||
* <anyAttribute processContents='lax' namespace='##other'/>
|
||||
* </extension>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
*/
|
||||
@XmlType(name = "QueryList")
|
||||
public class QueryList extends ContainerType<QueryList> {
|
||||
@SuppressWarnings("unchecked")
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
public Builder toBuilder() {
|
||||
return new Builder().fromQueryList(this);
|
||||
}
|
||||
|
||||
public static class Builder extends ContainerType.Builder<QueryList> {
|
||||
|
||||
public QueryList build() {
|
||||
QueryList queryList = new QueryList();
|
||||
return queryList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Builder fromContainerType(ContainerType<QueryList> in) {
|
||||
return Builder.class.cast(super.fromContainerType(in));
|
||||
}
|
||||
public Builder fromQueryList(QueryList in) {
|
||||
return fromContainerType(in);
|
||||
}
|
||||
}
|
||||
|
||||
private QueryList() {
|
||||
// For JAXB and builder use
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o)
|
||||
return true;
|
||||
if (o == null || getClass() != o.getClass())
|
||||
return false;
|
||||
QueryList that = QueryList.class.cast(o);
|
||||
return super.equals(that) ;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return super.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ToStringHelper string() {
|
||||
return super.string();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,409 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.jclouds.vcloud.director.v1_5.domain.query;
|
||||
|
||||
import static com.google.common.base.Objects.equal;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Date;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlSchemaType;
|
||||
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Link;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.base.Objects.ToStringHelper;
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
/**
|
||||
* Represents the results from a Catalog vCloud query as a record.
|
||||
*
|
||||
* <pre>
|
||||
* <complexType name="QueryResultCatalogRecord" />
|
||||
* </pre>
|
||||
*
|
||||
* @author grkvlt@apache.org
|
||||
*/
|
||||
@XmlRootElement(name = "CatalogRecord", namespace = VCLOUD_1_5_NS)
|
||||
public class QueryResultCatalogRecord extends QueryResultRecordType<QueryResultCatalogRecord> {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Builder toBuilder() {
|
||||
return new Builder().fromQueryResultCatalogRecord(this);
|
||||
}
|
||||
|
||||
public static class Builder extends QueryResultRecordType.Builder<QueryResultCatalogRecord> {
|
||||
|
||||
private String name;
|
||||
private Boolean isPublished;
|
||||
private Boolean isShared;
|
||||
private Date creationDate;
|
||||
private String orgName;
|
||||
private String ownerName;
|
||||
private Integer numberOfVAppTemplates;
|
||||
private Integer numberOfMedia;
|
||||
private URI owner;
|
||||
|
||||
/**
|
||||
* @see QueryResultCatalogRecord#getName()
|
||||
*/
|
||||
public Builder name(String name) {
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see QueryResultCatalogRecord#getIsPublished()
|
||||
*/
|
||||
public Builder isPublished(Boolean isPublished) {
|
||||
this.isPublished = isPublished;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see QueryResultCatalogRecord#getIsPublished()
|
||||
*/
|
||||
public Builder published() {
|
||||
this.isPublished = Boolean.TRUE;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see QueryResultCatalogRecord#getIsPublished()
|
||||
*/
|
||||
public Builder notPublished() {
|
||||
this.isPublished = Boolean.FALSE;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see QueryResultCatalogRecord#getIsShared()
|
||||
*/
|
||||
public Builder isShared(Boolean isShared) {
|
||||
this.isShared = isShared;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see QueryResultCatalogRecord#getIsShared()
|
||||
*/
|
||||
public Builder shared() {
|
||||
this.isShared = Boolean.TRUE;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see QueryResultCatalogRecord#getIsShared()
|
||||
*/
|
||||
public Builder notShared() {
|
||||
this.isShared = Boolean.FALSE;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see QueryResultCatalogRecord#getCreationDate()
|
||||
*/
|
||||
public Builder creationDate(Date creationDate) {
|
||||
this.creationDate = creationDate;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see QueryResultCatalogRecord#getOrgName()
|
||||
*/
|
||||
public Builder orgName(String orgName) {
|
||||
this.orgName = orgName;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see QueryResultCatalogRecord#getOwnerName()
|
||||
*/
|
||||
public Builder ownerName(String ownerName) {
|
||||
this.ownerName = ownerName;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see QueryResultCatalogRecord#getNumberOfVAppTemplates()
|
||||
*/
|
||||
public Builder numberOfVAppTemplates(Integer numberOfVAppTemplates) {
|
||||
this.numberOfVAppTemplates = numberOfVAppTemplates;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see QueryResultCatalogRecord#getNumberOfMedia()
|
||||
*/
|
||||
public Builder numberOfMedia(Integer numberOfMedia) {
|
||||
this.numberOfMedia = numberOfMedia;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see QueryResultCatalogRecord#getOwner()
|
||||
*/
|
||||
public Builder owner(URI owner) {
|
||||
this.owner = owner;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public QueryResultCatalogRecord build() {
|
||||
QueryResultCatalogRecord queryResultCatalogRecord = new QueryResultCatalogRecord(href);
|
||||
queryResultCatalogRecord.setName(name);
|
||||
queryResultCatalogRecord.setIsPublished(isPublished);
|
||||
queryResultCatalogRecord.setIsShared(isShared);
|
||||
queryResultCatalogRecord.setCreationDate(creationDate);
|
||||
queryResultCatalogRecord.setOrgName(orgName);
|
||||
queryResultCatalogRecord.setOwnerName(ownerName);
|
||||
queryResultCatalogRecord.setNumberOfVAppTemplates(numberOfVAppTemplates);
|
||||
queryResultCatalogRecord.setNumberOfMedia(numberOfMedia);
|
||||
queryResultCatalogRecord.setOwner(owner);
|
||||
queryResultCatalogRecord.setId(id);
|
||||
queryResultCatalogRecord.setType(type);
|
||||
queryResultCatalogRecord.setLinks(links);
|
||||
return queryResultCatalogRecord;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see QueryResultRecordType#getHref()
|
||||
*/
|
||||
@Override
|
||||
public Builder href(URI href) {
|
||||
this.href = href;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see QueryResultRecordType#getId()
|
||||
*/
|
||||
@Override
|
||||
public Builder id(String id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see QueryResultRecordType#getType()
|
||||
*/
|
||||
@Override
|
||||
public Builder type(String type) {
|
||||
this.type = type;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see QueryResultRecordType#getLinks()
|
||||
*/
|
||||
@Override
|
||||
public Builder links(Set<Link> links) {
|
||||
this.links = Sets.newLinkedHashSet(checkNotNull(links, "links"));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see QueryResultRecordType#getLinks()
|
||||
*/
|
||||
@Override
|
||||
public Builder link(Link link) {
|
||||
this.links.add(checkNotNull(link, "link"));
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Builder fromQueryResultRecordType(QueryResultRecordType<QueryResultCatalogRecord> in) {
|
||||
return Builder.class.cast(super.fromQueryResultRecordType(in));
|
||||
}
|
||||
|
||||
public Builder fromQueryResultCatalogRecord(QueryResultCatalogRecord in) {
|
||||
return fromQueryResultRecordType(in).name(in.getName()).isPublished(in.isPublished()).isShared(in.isShared()).creationDate(in.getCreationDate()).orgName(in.getOrgName()).ownerName(
|
||||
in.getOwnerName()).numberOfVAppTemplates(in.getNumberOfVAppTemplates()).numberOfMedia(in.getNumberOfMedia()).owner(in.getOwner());
|
||||
}
|
||||
}
|
||||
|
||||
private QueryResultCatalogRecord() {
|
||||
// For JAXB and builder use
|
||||
}
|
||||
|
||||
private QueryResultCatalogRecord(URI href) {
|
||||
super(href);
|
||||
}
|
||||
|
||||
@XmlAttribute
|
||||
protected String name;
|
||||
@XmlAttribute
|
||||
protected Boolean isPublished;
|
||||
@XmlAttribute
|
||||
protected Boolean isShared;
|
||||
@XmlAttribute
|
||||
@XmlSchemaType(name = "dateTime")
|
||||
protected Date creationDate;
|
||||
@XmlAttribute
|
||||
protected String orgName;
|
||||
@XmlAttribute
|
||||
protected String ownerName;
|
||||
@XmlAttribute
|
||||
protected Integer numberOfVAppTemplates;
|
||||
@XmlAttribute
|
||||
protected Integer numberOfMedia;
|
||||
@XmlAttribute
|
||||
protected URI owner;
|
||||
|
||||
/**
|
||||
* Gets the value of the name property.
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String value) {
|
||||
this.name = value;
|
||||
}
|
||||
|
||||
public Boolean isPublished() {
|
||||
return isPublished;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the isPublished property.
|
||||
*/
|
||||
public void setIsPublished(Boolean value) {
|
||||
this.isPublished = value;
|
||||
}
|
||||
|
||||
public Boolean isShared() {
|
||||
return isShared;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the isShared property.
|
||||
*/
|
||||
public void setIsShared(Boolean value) {
|
||||
this.isShared = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the creationDate property.
|
||||
*/
|
||||
public Date getCreationDate() {
|
||||
return creationDate;
|
||||
}
|
||||
|
||||
public void setCreationDate(Date value) {
|
||||
this.creationDate = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the orgName property.
|
||||
*/
|
||||
public String getOrgName() {
|
||||
return orgName;
|
||||
}
|
||||
|
||||
public void setOrgName(String value) {
|
||||
this.orgName = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the ownerName property.
|
||||
*/
|
||||
public String getOwnerName() {
|
||||
return ownerName;
|
||||
}
|
||||
|
||||
public void setOwnerName(String value) {
|
||||
this.ownerName = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the numberOfVAppTemplates property.
|
||||
*/
|
||||
public Integer getNumberOfVAppTemplates() {
|
||||
return numberOfVAppTemplates;
|
||||
}
|
||||
|
||||
public void setNumberOfVAppTemplates(Integer value) {
|
||||
this.numberOfVAppTemplates = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the numberOfMedia property.
|
||||
*/
|
||||
public Integer getNumberOfMedia() {
|
||||
return numberOfMedia;
|
||||
}
|
||||
|
||||
public void setNumberOfMedia(Integer value) {
|
||||
this.numberOfMedia = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the owner property.
|
||||
*/
|
||||
public URI getOwner() {
|
||||
return owner;
|
||||
}
|
||||
|
||||
public void setOwner(URI value) {
|
||||
this.owner = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o)
|
||||
return true;
|
||||
if (o == null || getClass() != o.getClass())
|
||||
return false;
|
||||
QueryResultCatalogRecord that = QueryResultCatalogRecord.class.cast(o);
|
||||
return super.equals(that) &&
|
||||
equal(this.name, that.name) && equal(this.isPublished, that.isPublished) &&
|
||||
equal(this.isShared, that.isShared) && equal(this.creationDate, that.creationDate) &&
|
||||
equal(this.orgName, that.orgName) && equal(this.ownerName, that.ownerName) &&
|
||||
equal(this.numberOfVAppTemplates, that.numberOfVAppTemplates) &&
|
||||
equal(this.numberOfMedia, that.numberOfMedia) && equal(this.owner, that.owner);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return super.hashCode() + Objects.hashCode(name, isPublished, isShared, creationDate,
|
||||
orgName, ownerName, numberOfVAppTemplates, numberOfMedia, owner);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ToStringHelper string() {
|
||||
return super.string()
|
||||
.add("name", name).add("isPublished", isPublished).add("isShared", isShared)
|
||||
.add("creationDate", creationDate).add("orgName", orgName).add("ownerName", ownerName)
|
||||
.add("numberOfVAppTemplates", numberOfVAppTemplates).add("numberOfMedia", numberOfMedia)
|
||||
.add("owner", owner);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,357 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.jclouds.vcloud.director.v1_5.domain.query;
|
||||
|
||||
import static com.google.common.base.Objects.equal;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Link;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.base.Objects.ToStringHelper;
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
/**
|
||||
* Represents the results from a Network vCloud query as a record.
|
||||
*
|
||||
* <pre>
|
||||
* <complexType name="QueryResultNetworkRecord" />
|
||||
* </pre>
|
||||
*
|
||||
* @author grkvlt@apache.org
|
||||
*/
|
||||
public class QueryResultNetworkRecord extends QueryResultRecordType<QueryResultNetworkRecord> {
|
||||
@SuppressWarnings("unchecked")
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Builder toBuilder() {
|
||||
return new Builder().fromQueryResultNetworkRecord(this);
|
||||
}
|
||||
|
||||
public static class Builder extends QueryResultRecordType.Builder<QueryResultNetworkRecord> {
|
||||
|
||||
private String name;
|
||||
private String ipScopeId;
|
||||
private String gateway;
|
||||
private String netmask;
|
||||
private String dns1;
|
||||
private String dns2;
|
||||
private String dnsSuffix;
|
||||
private Boolean isBusy;
|
||||
|
||||
/**
|
||||
* @see QueryResultNetworkRecord#getName()
|
||||
*/
|
||||
public Builder name(String name) {
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see QueryResultNetworkRecord#getIpScopeId()
|
||||
*/
|
||||
public Builder ipScopeId(String ipScopeId) {
|
||||
this.ipScopeId = ipScopeId;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see QueryResultNetworkRecord#getGateway()
|
||||
*/
|
||||
public Builder gateway(String gateway) {
|
||||
this.gateway = gateway;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see QueryResultNetworkRecord#getNetmask()
|
||||
*/
|
||||
public Builder netmask(String netmask) {
|
||||
this.netmask = netmask;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see QueryResultNetworkRecord#getDns1()
|
||||
*/
|
||||
public Builder dns1(String dns1) {
|
||||
this.dns1 = dns1;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see QueryResultNetworkRecord#getDns2()
|
||||
*/
|
||||
public Builder dns2(String dns2) {
|
||||
this.dns2 = dns2;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see QueryResultNetworkRecord#getDnsSuffix()
|
||||
*/
|
||||
public Builder dnsSuffix(String dnsSuffix) {
|
||||
this.dnsSuffix = dnsSuffix;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see QueryResultNetworkRecord#isBusy()
|
||||
*/
|
||||
public Builder isBusy(Boolean isBusy) {
|
||||
this.isBusy = isBusy;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see QueryResultNetworkRecord#isBusy()
|
||||
*/
|
||||
public Builder busy() {
|
||||
this.isBusy = Boolean.TRUE;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see QueryResultNetworkRecord#isBusy()
|
||||
*/
|
||||
public Builder notBusy() {
|
||||
this.isBusy = Boolean.FALSE;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public QueryResultNetworkRecord build() {
|
||||
QueryResultNetworkRecord queryResultNetworkRecord = new QueryResultNetworkRecord(href);
|
||||
queryResultNetworkRecord.setName(name);
|
||||
queryResultNetworkRecord.setIpScopeId(ipScopeId);
|
||||
queryResultNetworkRecord.setGateway(gateway);
|
||||
queryResultNetworkRecord.setNetmask(netmask);
|
||||
queryResultNetworkRecord.setDns1(dns1);
|
||||
queryResultNetworkRecord.setDns2(dns2);
|
||||
queryResultNetworkRecord.setDnsSuffix(dnsSuffix);
|
||||
queryResultNetworkRecord.setIsBusy(isBusy);
|
||||
queryResultNetworkRecord.setId(id);
|
||||
queryResultNetworkRecord.setType(type);
|
||||
queryResultNetworkRecord.setLinks(links);
|
||||
return queryResultNetworkRecord;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see QueryResultRecordType#getHref()
|
||||
*/
|
||||
@Override
|
||||
public Builder href(URI href) {
|
||||
this.href = href;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see QueryResultRecordType#getId()
|
||||
*/
|
||||
@Override
|
||||
public Builder id(String id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see QueryResultRecordType#getType()
|
||||
*/
|
||||
@Override
|
||||
public Builder type(String type) {
|
||||
this.type = type;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see QueryResultRecordType#getLinks()
|
||||
*/
|
||||
@Override
|
||||
public Builder links(Set<Link> links) {
|
||||
this.links = Sets.newLinkedHashSet(checkNotNull(links, "links"));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see QueryResultRecordType#getLinks()
|
||||
*/
|
||||
@Override
|
||||
public Builder link(Link link) {
|
||||
this.links.add(checkNotNull(link, "link"));
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Builder fromQueryResultRecordType(QueryResultRecordType<QueryResultNetworkRecord> in) {
|
||||
return Builder.class.cast(super.fromQueryResultRecordType(in));
|
||||
}
|
||||
|
||||
public Builder fromQueryResultNetworkRecord(QueryResultNetworkRecord in) {
|
||||
return fromQueryResultRecordType(in)
|
||||
.name(in.getName()).ipScopeId(in.getIpScopeId()).gateway(in.getGateway())
|
||||
.netmask(in.getNetmask()).dns1(in.getDns1()).dns2(in.getDns2())
|
||||
.dnsSuffix(in.getDnsSuffix()).isBusy(in.isBusy());
|
||||
}
|
||||
}
|
||||
|
||||
private QueryResultNetworkRecord() {
|
||||
// For JAXB and builder use
|
||||
}
|
||||
|
||||
private QueryResultNetworkRecord(URI href) {
|
||||
super(href);
|
||||
}
|
||||
|
||||
@XmlAttribute
|
||||
protected String name;
|
||||
@XmlAttribute
|
||||
protected String ipScopeId;
|
||||
@XmlAttribute
|
||||
protected String gateway;
|
||||
@XmlAttribute
|
||||
protected String netmask;
|
||||
@XmlAttribute
|
||||
protected String dns1;
|
||||
@XmlAttribute
|
||||
protected String dns2;
|
||||
@XmlAttribute
|
||||
protected String dnsSuffix;
|
||||
@XmlAttribute
|
||||
protected Boolean isBusy;
|
||||
|
||||
/**
|
||||
* name.
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String value) {
|
||||
this.name = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* IP scope object of this network.
|
||||
*/
|
||||
public String getIpScopeId() {
|
||||
return ipScopeId;
|
||||
}
|
||||
|
||||
public void setIpScopeId(String value) {
|
||||
this.ipScopeId = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gateway for the network.
|
||||
*/
|
||||
public String getGateway() {
|
||||
return gateway;
|
||||
}
|
||||
|
||||
public void setGateway(String value) {
|
||||
this.gateway = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Netmask for the network.
|
||||
*/
|
||||
public String getNetmask() {
|
||||
return netmask;
|
||||
}
|
||||
|
||||
public void setNetmask(String value) {
|
||||
this.netmask = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Primary DNS for the network.
|
||||
*/
|
||||
public String getDns1() {
|
||||
return dns1;
|
||||
}
|
||||
|
||||
public void setDns1(String value) {
|
||||
this.dns1 = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Secondary DNS for the network.
|
||||
*/
|
||||
public String getDns2() {
|
||||
return dns2;
|
||||
}
|
||||
|
||||
public void setDns2(String value) {
|
||||
this.dns2 = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* DNS suffix for the network.
|
||||
*/
|
||||
public String getDnsSuffix() {
|
||||
return dnsSuffix;
|
||||
}
|
||||
|
||||
public void setDnsSuffix(String value) {
|
||||
this.dnsSuffix = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows whether it is busy.
|
||||
*/
|
||||
public Boolean isBusy() {
|
||||
return isBusy;
|
||||
}
|
||||
|
||||
public void setIsBusy(Boolean value) {
|
||||
this.isBusy = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o)
|
||||
return true;
|
||||
if (o == null || getClass() != o.getClass())
|
||||
return false;
|
||||
QueryResultNetworkRecord that = QueryResultNetworkRecord.class.cast(o);
|
||||
return super.equals(that) && equal(name, that.name) && equal(ipScopeId, that.ipScopeId) && equal(gateway, that.gateway) && equal(netmask, that.netmask) && equal(dns1, that.dns1)
|
||||
&& equal(dns2, that.dns2) && equal(dnsSuffix, that.dnsSuffix) && equal(isBusy, that.isBusy);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(name, ipScopeId, gateway, netmask, dns1, dns2, dnsSuffix, isBusy);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ToStringHelper string() {
|
||||
return string().add("name", name).add("ipScopeId", ipScopeId).add("gateway", gateway).add("netmask", netmask).add("dns1", dns1).add("dns2", dns2).add("dnsSuffix", dnsSuffix).add("isBusy",
|
||||
isBusy);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,240 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.vcloud.director.v1_5.domain.query;
|
||||
|
||||
import static com.google.common.base.Objects.equal;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlAnyAttribute;
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlSchemaType;
|
||||
import javax.xml.bind.annotation.XmlSeeAlso;
|
||||
import javax.xml.namespace.QName;
|
||||
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Link;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.base.Objects.ToStringHelper;
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
/**
|
||||
* Base type for query result Records. Subtypes define more specific elements.
|
||||
*
|
||||
* <pre>
|
||||
* <complexType name="QueryResultRecordType" />
|
||||
* </pre>
|
||||
*
|
||||
* @author grkvlt@apache.org
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlSeeAlso({ QueryResultCatalogRecord.class, QueryResultNetworkRecord.class })
|
||||
public class QueryResultRecordType<T extends QueryResultRecordType<T>> {
|
||||
|
||||
public static <T extends QueryResultRecordType<T>> Builder<T> builder() {
|
||||
return new Builder<T>();
|
||||
}
|
||||
|
||||
public Builder<T> toBuilder() {
|
||||
return new Builder<T>().fromQueryResultRecordType(this);
|
||||
}
|
||||
|
||||
public static class Builder<T extends QueryResultRecordType<T>> {
|
||||
|
||||
protected URI href;
|
||||
protected String id;
|
||||
protected String type;
|
||||
protected Set<Link> links = Sets.newLinkedHashSet();
|
||||
|
||||
/**
|
||||
* @see QueryResultRecordType#getHref()
|
||||
*/
|
||||
public Builder<T> href(URI href) {
|
||||
this.href = href;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see QueryResultRecordType#getId()
|
||||
*/
|
||||
public Builder<T> id(String id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see QueryResultRecordType#getType()
|
||||
*/
|
||||
public Builder<T> type(String type) {
|
||||
this.type = type;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see QueryResultRecordType#getLinks()
|
||||
*/
|
||||
public Builder<T> links(Set<Link> links) {
|
||||
this.links = Sets.newLinkedHashSet(checkNotNull(links, "links"));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see QueryResultRecordType#getLinks()
|
||||
*/
|
||||
public Builder<T> link(Link link) {
|
||||
this.links.add(checkNotNull(link, "link"));
|
||||
return this;
|
||||
}
|
||||
|
||||
public QueryResultRecordType<T> build() {
|
||||
QueryResultRecordType<T> record = new QueryResultRecordType<T>(href);
|
||||
record.setId(id);
|
||||
record.setType(type);
|
||||
record.setLinks(links);
|
||||
return record;
|
||||
}
|
||||
|
||||
public Builder<T> fromQueryResultRecordType(QueryResultRecordType<T> in) {
|
||||
return href(in.getHref()).id(in.getId()).type(in.getType());
|
||||
}
|
||||
}
|
||||
|
||||
@XmlElement(namespace = VCLOUD_1_5_NS, name = "Link")
|
||||
private Set<Link> links = Sets.newLinkedHashSet();
|
||||
@XmlAttribute
|
||||
@XmlSchemaType(name = "anyURI")
|
||||
private URI href;
|
||||
@XmlAttribute
|
||||
private String id;
|
||||
@XmlAttribute
|
||||
private String type;
|
||||
@XmlAnyAttribute
|
||||
// XXX not sure about this
|
||||
private Map<QName, String> otherAttributes = new HashMap<QName, String>();
|
||||
|
||||
public QueryResultRecordType(URI href) {
|
||||
this.href = href;
|
||||
}
|
||||
|
||||
public QueryResultRecordType() {
|
||||
// For JAXB
|
||||
}
|
||||
|
||||
/**
|
||||
* Set of optional links to an entity or operation associated with this object.
|
||||
*/
|
||||
public Set<Link> getLinks() {
|
||||
return links;
|
||||
}
|
||||
|
||||
public void setLinks(Set<Link> links) {
|
||||
this.links = Sets.newLinkedHashSet(checkNotNull(links, "links"));
|
||||
}
|
||||
|
||||
public void addLink(Link link) {
|
||||
this.links.add(checkNotNull(link, "link"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Contains the URI to the entity. An object reference, expressed in URL format. Because this URL includes the object identifier
|
||||
* portion of the id attribute value, it uniquely identifies the object, persists for the life of the object, and is never
|
||||
* reused. The value of the href attribute is a reference to a view of the object, and can be used to access a representation of
|
||||
* the object that is valid in a particular context. Although URLs have a well-known syntax and a well-understood interpretation,
|
||||
* a client should treat each href as an opaque string. The rules that govern how the server constructs href strings might change
|
||||
* in future releases.
|
||||
*
|
||||
* @return an opaque reference and should never be parsed
|
||||
*/
|
||||
public URI getHref() {
|
||||
return href;
|
||||
}
|
||||
|
||||
public void setHref(URI href) {
|
||||
this.href = href;
|
||||
}
|
||||
|
||||
/**
|
||||
* The resource identifier, expressed in URN format. The value of this attribute uniquely identifies the resource, persists for
|
||||
* the life of the resource, and is never reused.
|
||||
*/
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Contains the type of the the entity. The object type, specified as a MIME content type, of the object that the link
|
||||
* references. This attribute is present only for links to objects. It is not present for links to actions.
|
||||
*
|
||||
* @return type definition, type, expressed as an HTTP Content-Type
|
||||
*/
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
// XXX not sure about this
|
||||
|
||||
/**
|
||||
* Gets a map that contains attributes that aren't bound to any typed property on this class.
|
||||
*/
|
||||
public Map<QName, String> getOtherAttributes() {
|
||||
return otherAttributes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o)
|
||||
return true;
|
||||
if (o == null || getClass() != o.getClass())
|
||||
return false;
|
||||
QueryResultRecordType<?> that = QueryResultRecordType.class.cast(o);
|
||||
return equal(this.href, that.href) && equal(this.id, that.id) &&
|
||||
equal(this.type, that.type) && equal(this.links, that.links);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(href, id, type, links);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return string().toString();
|
||||
}
|
||||
|
||||
protected ToStringHelper string() {
|
||||
return Objects.toStringHelper("").add("href", href).add("id", id)
|
||||
.add("type", type).add("links", links);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,225 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.jclouds.vcloud.director.v1_5.domain.query;
|
||||
|
||||
import static com.google.common.base.Objects.equal;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElementRef;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Link;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.base.Objects.ToStringHelper;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
/**
|
||||
* Represents the results from a vCloud query as records.
|
||||
*
|
||||
* <pre>
|
||||
* <complexType name="QueryResultRecords" />
|
||||
* </pre>
|
||||
*
|
||||
* @author grkvlt@apache.org
|
||||
*/
|
||||
@XmlRootElement(namespace = VCLOUD_1_5_NS, name = "QueryResultRecords")
|
||||
public class QueryResultRecords<T extends QueryResultRecordType<T>> extends ContainerType<QueryResultRecords<T>> {
|
||||
|
||||
public static final String MEDIA_TYPE = VCloudDirectorMediaType.QUERY_RESULT_RECORDS;
|
||||
|
||||
public static <T extends QueryResultRecordType<T>> Builder<T> builder() {
|
||||
return new Builder<T>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Builder<T> toBuilder() {
|
||||
return new Builder<T>().fromQueryResultRecords(this);
|
||||
}
|
||||
|
||||
public static class Builder<T extends QueryResultRecordType<T>> extends ContainerType.Builder<QueryResultRecords<T>> {
|
||||
|
||||
private List<T> records = Lists.newArrayList();
|
||||
|
||||
/**
|
||||
* @see QueryResultRecords#getRecords()
|
||||
*/
|
||||
public Builder<T> records(List<T> records) {
|
||||
this.records = records;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see QueryResultRecords#getRecords()
|
||||
*/
|
||||
public Builder<T> record(T record) {
|
||||
this.records.add(record);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public QueryResultRecords<T> build() {
|
||||
QueryResultRecords<T> queryResultRecords = new QueryResultRecords<T>(href);
|
||||
queryResultRecords.setRecords(records);
|
||||
queryResultRecords.setName(name);
|
||||
queryResultRecords.setPage(page);
|
||||
queryResultRecords.setPageSize(pageSize);
|
||||
queryResultRecords.setTotal(total);
|
||||
queryResultRecords.setType(type);
|
||||
queryResultRecords.setLinks(links);
|
||||
return queryResultRecords;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ContainerType#getName()
|
||||
*/
|
||||
@Override
|
||||
public Builder<T> name(String name) {
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ContainerType#getPage()
|
||||
*/
|
||||
@Override
|
||||
public Builder<T> page(Integer page) {
|
||||
this.page = page;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ContainerType#getPageSize()
|
||||
*/
|
||||
@Override
|
||||
public Builder<T> pageSize(Integer pageSize) {
|
||||
this.pageSize = pageSize;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ContainerType#getTotal()
|
||||
*/
|
||||
@Override
|
||||
public Builder<T> total(Long total) {
|
||||
this.total = total;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ResourceType#getHref()
|
||||
*/
|
||||
@Override
|
||||
public Builder<T> href(URI href) {
|
||||
super.href(href);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ResourceType#getType()
|
||||
*/
|
||||
@Override
|
||||
public Builder<T> type(String type) {
|
||||
super.type(type);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ResourceType#getLinks()
|
||||
*/
|
||||
@Override
|
||||
public Builder<T> links(Set<Link> links) {
|
||||
super.links(Sets.newLinkedHashSet(checkNotNull(links, "links")));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ResourceType#getLinks()
|
||||
*/
|
||||
@Override
|
||||
public Builder<T> link(Link link) {
|
||||
super.link(link);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Builder<T> fromContainerType(ContainerType<QueryResultRecords<T>> in) {
|
||||
return Builder.class.cast(super.fromContainerType(in));
|
||||
}
|
||||
|
||||
public Builder<T> fromQueryResultRecords(QueryResultRecords<T> in) {
|
||||
return fromContainerType(in).records(in.getRecords());
|
||||
}
|
||||
}
|
||||
|
||||
protected QueryResultRecords() {
|
||||
// For JAXB and builder use
|
||||
}
|
||||
|
||||
protected QueryResultRecords(URI href) {
|
||||
super(href);
|
||||
}
|
||||
|
||||
@XmlElementRef
|
||||
protected List<T> records;
|
||||
|
||||
/**
|
||||
* Set of records representing query results.
|
||||
*/
|
||||
public List<T> getRecords() {
|
||||
return records;
|
||||
}
|
||||
|
||||
public void setRecords(List<T> records) {
|
||||
this.records = Lists.newArrayList(checkNotNull(records, "records"));
|
||||
}
|
||||
|
||||
public void addRecords(T record) {
|
||||
this.records.add(checkNotNull(record, "record"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o)
|
||||
return true;
|
||||
if (o == null || getClass() != o.getClass())
|
||||
return false;
|
||||
QueryResultRecords<T> that = QueryResultRecords.class.cast(o);
|
||||
return super.equals(that) && equal(this.records, that.records);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return super.hashCode() + Objects.hashCode(records);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ToStringHelper string() {
|
||||
return super.string().add("records", records);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,228 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.jclouds.vcloud.director.v1_5.domain.query;
|
||||
|
||||
import static com.google.common.base.Objects.equal;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElementRef;
|
||||
import javax.xml.bind.annotation.XmlElementRefs;
|
||||
|
||||
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.CatalogReference;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Link;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.ReferenceType;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.base.Objects.ToStringHelper;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
/**
|
||||
* Represents the results from a vCloud query as references.
|
||||
*
|
||||
* <pre>
|
||||
* <complexType name="QueryResultReferences" />
|
||||
* </pre>
|
||||
*
|
||||
* @author grkvlt@apache.org
|
||||
*/
|
||||
public class QueryResultReferences<T extends ReferenceType<T>> extends ContainerType<QueryResultReferences<T>> {
|
||||
|
||||
public static final String MEDIA_TYPE = VCloudDirectorMediaType.QUERY_RESULT_REFERENCES;
|
||||
|
||||
public static <T extends ReferenceType<T>> Builder<T> builder() {
|
||||
return new Builder<T>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Builder<T> toBuilder() {
|
||||
return new Builder<T>().fromQueryResultReferences(this);
|
||||
}
|
||||
|
||||
public static class Builder<T extends ReferenceType<T>> extends ContainerType.Builder<QueryResultReferences<T>> {
|
||||
|
||||
protected List<T> references = Lists.newArrayList();
|
||||
|
||||
/**
|
||||
* @see QueryResultReferences#getReferences()
|
||||
*/
|
||||
public Builder<T> references(List<T> references) {
|
||||
this.references = references;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see QueryResultReferences#getReferences()
|
||||
*/
|
||||
public Builder<T> reference(T reference) {
|
||||
this.references.add(reference);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public QueryResultReferences<T> build() {
|
||||
QueryResultReferences<T> queryResultReferences = new QueryResultReferences<T>(href);
|
||||
queryResultReferences.setReferences(references);
|
||||
queryResultReferences.setName(name);
|
||||
queryResultReferences.setPage(page);
|
||||
queryResultReferences.setPageSize(pageSize);
|
||||
queryResultReferences.setTotal(total);
|
||||
queryResultReferences.setType(type);
|
||||
queryResultReferences.setLinks(links);
|
||||
return queryResultReferences;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Container#getName()
|
||||
*/
|
||||
@Override
|
||||
public Builder<T> name(String name) {
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Container#getPage()
|
||||
*/
|
||||
@Override
|
||||
public Builder<T> page(Integer page) {
|
||||
this.page = page;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Container#getPageSize()
|
||||
*/
|
||||
@Override
|
||||
public Builder<T> pageSize(Integer pageSize) {
|
||||
this.pageSize = pageSize;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Container#getTotal()
|
||||
*/
|
||||
@Override
|
||||
public Builder<T> total(Long total) {
|
||||
this.total = total;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ResourceType#getHref()
|
||||
*/
|
||||
@Override
|
||||
public Builder<T> href(URI href) {
|
||||
super.href(href);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ResourceType#getType()
|
||||
*/
|
||||
@Override
|
||||
public Builder<T> type(String type) {
|
||||
super.type(type);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ResourceType#getLinks()
|
||||
*/
|
||||
@Override
|
||||
public Builder<T> links(Set<Link> links) {
|
||||
super.links(Sets.newLinkedHashSet(checkNotNull(links, "links")));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ResourceType#getLinks()
|
||||
*/
|
||||
@Override
|
||||
public Builder<T> link(Link link) {
|
||||
super.link(link);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Builder<T> fromContainerType(ContainerType<QueryResultReferences<T>> in) {
|
||||
return Builder.class.cast(super.fromContainerType(in));
|
||||
}
|
||||
|
||||
public Builder<T> fromQueryResultReferences(QueryResultReferences<T> in) {
|
||||
return fromContainerType(in).references(in.getReferences());
|
||||
}
|
||||
}
|
||||
|
||||
protected QueryResultReferences() {
|
||||
// For JAXB and builder use
|
||||
}
|
||||
|
||||
protected QueryResultReferences(URI href) {
|
||||
super(href);
|
||||
}
|
||||
|
||||
// NOTE add other types as they are used. probably not the best way to do this.
|
||||
@XmlElementRefs({
|
||||
@XmlElementRef(type = CatalogReference.class)
|
||||
})
|
||||
protected List<T> references = Lists.newArrayList();
|
||||
|
||||
/**
|
||||
* Set of references representing query results.
|
||||
*/
|
||||
public List<T> getReferences() {
|
||||
return references;
|
||||
}
|
||||
|
||||
public void setReferences(List<T> references) {
|
||||
this.references = Lists.newArrayList(checkNotNull(references, "references"));
|
||||
}
|
||||
|
||||
public void addReference(T reference) {
|
||||
this.references.add(checkNotNull(reference, "reference"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o)
|
||||
return true;
|
||||
if (o == null || getClass() != o.getClass())
|
||||
return false;
|
||||
QueryResultReferences<T> that = QueryResultReferences.class.cast(o);
|
||||
return super.equals(that) && equal(this.references, that.references);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return super.hashCode() + Objects.hashCode(references);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ToStringHelper string() {
|
||||
return super.string().add("references", references);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,138 @@
|
|||
/*
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.vcloud.director.v1_5.domain.vapp;
|
||||
|
||||
import org.jclouds.vcloud.director.v1_5.domain.ResourceEntityType;
|
||||
|
||||
|
||||
/**
|
||||
* Represents a base type for VAppType and VmType.
|
||||
*
|
||||
* <pre>
|
||||
* <complexType name="AbstractVAppType" >
|
||||
* </pre>
|
||||
*
|
||||
* @author grkvlt@apache.org
|
||||
*/
|
||||
public abstract class AbstractVAppType extends ResourceEntityType<AbstractVAppType> {
|
||||
|
||||
// @XmlElement(name = "VAppParent")
|
||||
// protected ReferenceType vAppParent;
|
||||
// @XmlElementRef(name = "Section", namespace = "http://schemas.dmtf.org/ovf/envelope/1", type = JAXBElement.class)
|
||||
// protected List<JAXBElement<? extends SectionType>> section;
|
||||
// @XmlAttribute
|
||||
// protected Boolean deployed;
|
||||
//
|
||||
// /**
|
||||
// * Gets the value of the vAppParent property.
|
||||
// *
|
||||
// * @return
|
||||
// * possible object is
|
||||
// * {@link ReferenceType }
|
||||
// *
|
||||
// */
|
||||
// public ReferenceType getVAppParent() {
|
||||
// return vAppParent;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Sets the value of the vAppParent property.
|
||||
// *
|
||||
// * @param value
|
||||
// * allowed object is
|
||||
// * {@link ReferenceType }
|
||||
// *
|
||||
// */
|
||||
// public void setVAppParent(ReferenceType value) {
|
||||
// this.vAppParent = value;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// *
|
||||
// * Specific ovf:Section with additional information for the vApp.
|
||||
// * Gets the value of the section property.
|
||||
// *
|
||||
// * <p>
|
||||
// * This accessor method returns a reference to the live list,
|
||||
// * not a snapshot. Therefore any modification you make to the
|
||||
// * returned list will be present inside the JAXB object.
|
||||
// * This is why there is not a <CODE>set</CODE> method for the section property.
|
||||
// *
|
||||
// * <p>
|
||||
// * For example, to add a new item, do as follows:
|
||||
// * <pre>
|
||||
// * getSection().add(newItem);
|
||||
// * </pre>
|
||||
// *
|
||||
// *
|
||||
// * <p>
|
||||
// * Objects of the following type(s) are allowed in the list
|
||||
// * {@link JAXBElement }{@code <}{@link SectionType }{@code >}
|
||||
// * {@link JAXBElement }{@code <}{@link VirtualHardwareSectionType }{@code >}
|
||||
// * {@link JAXBElement }{@code <}{@link LeaseSettingsSectionType }{@code >}
|
||||
// * {@link JAXBElement }{@code <}{@link EulaSectionType }{@code >}
|
||||
// * {@link JAXBElement }{@code <}{@link RuntimeInfoSectionType }{@code >}
|
||||
// * {@link JAXBElement }{@code <}{@link AnnotationSectionType }{@code >}
|
||||
// * {@link JAXBElement }{@code <}{@link DeploymentOptionSectionType }{@code >}
|
||||
// * {@link JAXBElement }{@code <}{@link StartupSectionType }{@code >}
|
||||
// * {@link JAXBElement }{@code <}{@link ResourceAllocationSectionType }{@code >}
|
||||
// * {@link JAXBElement }{@code <}{@link NetworkConnectionSectionType }{@code >}
|
||||
// * {@link JAXBElement }{@code <}{@link CustomizationSectionType }{@code >}
|
||||
// * {@link JAXBElement }{@code <}{@link ProductSectionType }{@code >}
|
||||
// * {@link JAXBElement }{@code <}{@link GuestCustomizationSectionType }{@code >}
|
||||
// * {@link JAXBElement }{@code <}{@link OperatingSystemSectionType }{@code >}
|
||||
// * {@link JAXBElement }{@code <}{@link NetworkConfigSectionType }{@code >}
|
||||
// * {@link JAXBElement }{@code <}{@link NetworkSectionType }{@code >}
|
||||
// * {@link JAXBElement }{@code <}{@link DiskSectionType }{@code >}
|
||||
// * {@link JAXBElement }{@code <}{@link InstallSectionType }{@code >}
|
||||
// *
|
||||
// *
|
||||
// */
|
||||
// public List<JAXBElement<? extends SectionType>> getSection() {
|
||||
// if (section == null) {
|
||||
// section = new ArrayList<JAXBElement<? extends SectionType>>();
|
||||
// }
|
||||
// return this.section;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Gets the value of the deployed property.
|
||||
// *
|
||||
// * @return
|
||||
// * possible object is
|
||||
// * {@link Boolean }
|
||||
// *
|
||||
// */
|
||||
// public Boolean isDeployed() {
|
||||
// return deployed;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Sets the value of the deployed property.
|
||||
// *
|
||||
// * @param value
|
||||
// * allowed object is
|
||||
// * {@link Boolean }
|
||||
// *
|
||||
// */
|
||||
// public void setDeployed(Boolean value) {
|
||||
// this.deployed = value;
|
||||
// }
|
||||
|
||||
}
|
|
@ -0,0 +1,245 @@
|
|||
/*
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.vcloud.director.v1_5.domain.vapp;
|
||||
|
||||
/**
|
||||
* Represents a vApp.
|
||||
*
|
||||
* <pre>
|
||||
* <complexType name="VApp" />
|
||||
* </pre>
|
||||
*
|
||||
* @author grkvlt@apache.org
|
||||
*/
|
||||
public class VApp extends AbstractVAppType {
|
||||
//
|
||||
// @SuppressWarnings("unchecked")
|
||||
// public static Builder builder() {
|
||||
// return new Builder();
|
||||
// }
|
||||
//
|
||||
// public Builder toBuilder() {
|
||||
// return new Builder().fromVApp(this);
|
||||
// }
|
||||
//
|
||||
// public static class Builder extends AbstractVAppType.Builder<VApp> {
|
||||
//
|
||||
// private Owner owner;
|
||||
// private Boolean inMaintenanceMode;
|
||||
// private VAppChildren children;
|
||||
// private Boolean ovfDescriptorUploaded;
|
||||
//
|
||||
// /**
|
||||
// * @see VApp#getOwner()
|
||||
// */
|
||||
// public Builder owner(Owner owner) {
|
||||
// this.owner = owner;
|
||||
// return this;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * @see VApp#getInMaintenanceMode()
|
||||
// */
|
||||
// public Builder inMaintenanceMode(Boolean inMaintenanceMode) {
|
||||
// this.inMaintenanceMode = inMaintenanceMode;
|
||||
// return this;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * @see VApp#getChildren()
|
||||
// */
|
||||
// public Builder children(VAppChildren children) {
|
||||
// this.children = children;
|
||||
// return this;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * @see VApp#getOvfDescriptorUploaded()
|
||||
// */
|
||||
// public Builder ovfDescriptorUploaded(Boolean ovfDescriptorUploaded) {
|
||||
// this.ovfDescriptorUploaded = ovfDescriptorUploaded;
|
||||
// return this;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// public VApp build() {
|
||||
// VApp vApp = new VApp();
|
||||
// vApp.setOwner(owner);
|
||||
// vApp.setInMaintenanceMode(inMaintenanceMode);
|
||||
// vApp.setChildren(children);
|
||||
// vApp.setOvfDescriptorUploaded(ovfDescriptorUploaded);
|
||||
// return vApp;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// @Override
|
||||
// public Builder fromAbstractVAppType(AbstractVAppType<VApp> in) {
|
||||
// return Builder.class.cast(super.fromAbstractVAppType(in));
|
||||
// }
|
||||
// public Builder fromVApp(VApp in) {
|
||||
// return fromAbstractVAppType(in)
|
||||
// .owner(in.getOwner())
|
||||
// .inMaintenanceMode(in.getInMaintenanceMode())
|
||||
// .children(in.getChildren())
|
||||
// .ovfDescriptorUploaded(in.getOvfDescriptorUploaded());
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// private VApp() {
|
||||
// // For JAXB and builder use
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
// @XmlElement(name = "Owner")
|
||||
// protected Owner owner;
|
||||
// @XmlElement(name = "InMaintenanceMode")
|
||||
// protected Boolean inMaintenanceMode;
|
||||
// @XmlElement(name = "Children")
|
||||
// protected VAppChildren children;
|
||||
// @XmlAttribute
|
||||
// protected Boolean ovfDescriptorUploaded;
|
||||
//
|
||||
// /**
|
||||
// * Gets the value of the owner property.
|
||||
// *
|
||||
// * @return
|
||||
// * possible object is
|
||||
// * {@link Owner }
|
||||
// *
|
||||
// */
|
||||
// public Owner getOwner() {
|
||||
// return owner;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Sets the value of the owner property.
|
||||
// *
|
||||
// * @param value
|
||||
// * allowed object is
|
||||
// * {@link Owner }
|
||||
// *
|
||||
// */
|
||||
// public void setOwner(Owner value) {
|
||||
// this.owner = value;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Gets the value of the inMaintenanceMode property.
|
||||
// *
|
||||
// * @return
|
||||
// * possible object is
|
||||
// * {@link Boolean }
|
||||
// *
|
||||
// */
|
||||
// public Boolean isInMaintenanceMode() {
|
||||
// return inMaintenanceMode;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Sets the value of the inMaintenanceMode property.
|
||||
// *
|
||||
// * @param value
|
||||
// * allowed object is
|
||||
// * {@link Boolean }
|
||||
// *
|
||||
// */
|
||||
// public void setInMaintenanceMode(Boolean value) {
|
||||
// this.inMaintenanceMode = value;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Gets the value of the children property.
|
||||
// *
|
||||
// * @return
|
||||
// * possible object is
|
||||
// * {@link VAppChildren }
|
||||
// *
|
||||
// */
|
||||
// public VAppChildren getChildren() {
|
||||
// return children;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Sets the value of the children property.
|
||||
// *
|
||||
// * @param value
|
||||
// * allowed object is
|
||||
// * {@link VAppChildren }
|
||||
// *
|
||||
// */
|
||||
// public void setChildren(VAppChildren value) {
|
||||
// this.children = value;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Gets the value of the ovfDescriptorUploaded property.
|
||||
// *
|
||||
// * @return
|
||||
// * possible object is
|
||||
// * {@link Boolean }
|
||||
// *
|
||||
// */
|
||||
// public Boolean isOvfDescriptorUploaded() {
|
||||
// return ovfDescriptorUploaded;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Sets the value of the ovfDescriptorUploaded property.
|
||||
// *
|
||||
// * @param value
|
||||
// * allowed object is
|
||||
// * {@link Boolean }
|
||||
// *
|
||||
// */
|
||||
// public void setOvfDescriptorUploaded(Boolean value) {
|
||||
// this.ovfDescriptorUploaded = value;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean equals(Object o) {
|
||||
// if (this == o)
|
||||
// return true;
|
||||
// if (o == null || getClass() != o.getClass())
|
||||
// return false;
|
||||
// VApp that = VApp.class.cast(o);
|
||||
// return equal(owner, that.owner) &&
|
||||
// equal(inMaintenanceMode, that.inMaintenanceMode) &&
|
||||
// equal(children, that.children) &&
|
||||
// equal(ovfDescriptorUploaded, that.ovfDescriptorUploaded);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public int hashCode() {
|
||||
// return Objects.hashCode(owner,
|
||||
// inMaintenanceMode,
|
||||
// children,
|
||||
// ovfDescriptorUploaded);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public String toString() {
|
||||
// return Objects.toStringHelper("")
|
||||
// .add("owner", owner)
|
||||
// .add("inMaintenanceMode", inMaintenanceMode)
|
||||
// .add("children", children)
|
||||
// .add("ovfDescriptorUploaded", ovfDescriptorUploaded).toString();
|
||||
// }
|
||||
|
||||
}
|
|
@ -37,7 +37,6 @@ import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
|
|||
import org.jclouds.vcloud.director.v1_5.domain.Catalog;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.CatalogItem;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Metadata;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.MetadataEntry;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.MetadataValue;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.ReferenceType;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Task;
|
||||
|
@ -93,7 +92,7 @@ public interface CatalogAsyncClient {
|
|||
@Consumes
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
||||
ListenableFuture<MetadataEntry> getCatalogMetadataEntry(@EndpointParam(parser = ReferenceToEndpoint.class) ReferenceType<?> catalogRef,
|
||||
ListenableFuture<MetadataValue> getCatalogMetadataValue(@EndpointParam(parser = ReferenceToEndpoint.class) ReferenceType<?> catalogRef,
|
||||
@PathParam("key") String key);
|
||||
|
||||
/**
|
||||
|
@ -155,7 +154,7 @@ public interface CatalogAsyncClient {
|
|||
@Consumes
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
||||
ListenableFuture<MetadataEntry> getCatalogItemMetadataEntry(@EndpointParam(parser = ReferenceToEndpoint.class) ReferenceType<?> catalogItemRef,
|
||||
ListenableFuture<MetadataValue> getCatalogItemMetadataValue(@EndpointParam(parser = ReferenceToEndpoint.class) ReferenceType<?> catalogItemRef,
|
||||
@PathParam("key") String key);
|
||||
|
||||
/**
|
||||
|
@ -167,7 +166,7 @@ public interface CatalogAsyncClient {
|
|||
@Produces(VCloudDirectorMediaType.METADATA_VALUE)
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
||||
ListenableFuture<Task> setCatalogItemMetadataEntry(@EndpointParam(parser = ReferenceToEndpoint.class) ReferenceType<?> catalogItemRef,
|
||||
ListenableFuture<Task> setCatalogItemMetadataValue(@EndpointParam(parser = ReferenceToEndpoint.class) ReferenceType<?> catalogItemRef,
|
||||
@PathParam("key") String key, @BinderParam(BindToXMLPayload.class) MetadataValue metadataValue);
|
||||
|
||||
/**
|
||||
|
@ -178,6 +177,6 @@ public interface CatalogAsyncClient {
|
|||
@Consumes
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
||||
ListenableFuture<Task> deleteCatalogItemMetadataEntry(@EndpointParam(parser = ReferenceToEndpoint.class) ReferenceType<?> catalogItemRef,
|
||||
ListenableFuture<Task> deleteCatalogItemMetadataValue(@EndpointParam(parser = ReferenceToEndpoint.class) ReferenceType<?> catalogItemRef,
|
||||
@PathParam("key") String key);
|
||||
}
|
||||
|
|
|
@ -24,7 +24,6 @@ import org.jclouds.concurrent.Timeout;
|
|||
import org.jclouds.vcloud.director.v1_5.domain.Catalog;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.CatalogItem;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Metadata;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.MetadataEntry;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.MetadataValue;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.ReferenceType;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Task;
|
||||
|
@ -84,9 +83,9 @@ public interface CatalogClient {
|
|||
*
|
||||
* @param catalogRef the reference for the catalog
|
||||
* @param key the metadata entry key
|
||||
* @return the catalog metadata entry
|
||||
* @return the catalog metadata value
|
||||
*/
|
||||
MetadataEntry getCatalogMetadataEntry(ReferenceType<?> catalogRef, String key);
|
||||
MetadataValue getCatalogMetadataValue(ReferenceType<?> catalogRef, String key);
|
||||
|
||||
/**
|
||||
* Retrieves a catalog item.
|
||||
|
@ -158,9 +157,9 @@ public interface CatalogClient {
|
|||
*
|
||||
* @param catalogItemRef the reference for the catalog item
|
||||
* @param key the metadata entry key
|
||||
* @return the catalog item metadata entry
|
||||
* @return the catalog item metadata value
|
||||
*/
|
||||
MetadataEntry getCatalogItemMetadataEntry(ReferenceType<?> catalogItemRef, String key);
|
||||
MetadataValue getCatalogItemMetadataValue(ReferenceType<?> catalogItemRef, String key);
|
||||
|
||||
/**
|
||||
* Sets the metadata for the particular key for the catalog item to the value provided.
|
||||
|
@ -174,7 +173,7 @@ public interface CatalogClient {
|
|||
* @param value the metadata value
|
||||
* @return a task for the set operation
|
||||
*/
|
||||
Task setCatalogItemMetadataEntry(ReferenceType<?> catalogItemRef, String key, MetadataValue value);
|
||||
Task setCatalogItemMetadataValue(ReferenceType<?> catalogItemRef, String key, MetadataValue value);
|
||||
|
||||
/**
|
||||
* Deletes the metadata for the particular key for the catalog item.
|
||||
|
@ -187,5 +186,5 @@ public interface CatalogClient {
|
|||
* @param key the metadata entry key
|
||||
* @return a task for the delete operation
|
||||
*/
|
||||
Task deleteCatalogItemMetadataEntry(ReferenceType<?> catalogItemRef, String key);
|
||||
Task deleteCatalogItemMetadataValue(ReferenceType<?> catalogItemRef, String key);
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ import org.jclouds.rest.annotations.ExceptionParser;
|
|||
import org.jclouds.rest.annotations.JAXBResponseParser;
|
||||
import org.jclouds.rest.annotations.RequestFilters;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Metadata;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.MetadataEntry;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.MetadataValue;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Org;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.OrgList;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.ReferenceType;
|
||||
|
@ -81,6 +81,6 @@ public interface OrgAsyncClient {
|
|||
@Consumes
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
||||
ListenableFuture<MetadataEntry> getOrgMetadataEntry(@EndpointParam(parser = ReferenceToEndpoint.class) ReferenceType<?> orgRef,
|
||||
ListenableFuture<MetadataValue> getOrgMetadataValue(@EndpointParam(parser = ReferenceToEndpoint.class) ReferenceType<?> orgRef,
|
||||
@PathParam("key") String key);
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ import java.util.concurrent.TimeUnit;
|
|||
|
||||
import org.jclouds.concurrent.Timeout;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Metadata;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.MetadataEntry;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.MetadataValue;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Org;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.OrgList;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.ReferenceType;
|
||||
|
@ -58,7 +58,6 @@ public interface OrgClient {
|
|||
* @return the org or null if not found
|
||||
*/
|
||||
Org getOrg(ReferenceType<?> orgRef);
|
||||
// FIXME throws exception on not found currently
|
||||
|
||||
/**
|
||||
* Retrieves an list of the organization's metadata
|
||||
|
@ -80,6 +79,5 @@ public interface OrgClient {
|
|||
*
|
||||
* @return the metadata entry or null if not found
|
||||
*/
|
||||
MetadataEntry getOrgMetadataEntry(ReferenceType<?> orgRef, String key);
|
||||
// FIXME throws exception on not found currently
|
||||
MetadataValue getOrgMetadataValue(ReferenceType<?> orgRef, String key);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,129 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.vcloud.director.v1_5.features;
|
||||
|
||||
import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.QueryParam;
|
||||
|
||||
import org.jclouds.rest.annotations.ExceptionParser;
|
||||
import org.jclouds.rest.annotations.JAXBResponseParser;
|
||||
import org.jclouds.rest.annotations.QueryParams;
|
||||
import org.jclouds.rest.annotations.RequestFilters;
|
||||
import org.jclouds.rest.annotations.SkipEncoding;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.query.CatalogReferences;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.query.QueryList;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.query.QueryResultRecords;
|
||||
import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationToRequest;
|
||||
import org.jclouds.vcloud.director.v1_5.functions.ThrowVCloudErrorOn4xx;
|
||||
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
/**
|
||||
* @see QueryClient
|
||||
* @author grkvlt@apache.org
|
||||
*/
|
||||
@RequestFilters(AddVCloudAuthorizationToRequest.class)
|
||||
@SkipEncoding({ '=' })
|
||||
@SuppressWarnings("rawtypes")
|
||||
public interface QueryAsyncClient {
|
||||
|
||||
/**
|
||||
* REST API General queries handler.
|
||||
*/
|
||||
@GET
|
||||
@Path("/query")
|
||||
@Consumes
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
||||
ListenableFuture<QueryList> queryList();
|
||||
|
||||
@GET
|
||||
@Path("/query")
|
||||
@Consumes
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
||||
ListenableFuture<QueryResultRecords> queryAll(@QueryParam("type") String type);
|
||||
|
||||
@GET
|
||||
@Path("/query")
|
||||
@Consumes
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
||||
ListenableFuture<QueryResultRecords> query(@QueryParam("type") String type, @QueryParam("filter") String filter);
|
||||
|
||||
@GET
|
||||
@Path("/query")
|
||||
@Consumes
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
||||
ListenableFuture<QueryResultRecords> query(@QueryParam("page") Integer page, @QueryParam("pageSize") Integer pageSize,
|
||||
@QueryParam("format") String format, @QueryParam("type") String type, @QueryParam("filter") String filter);
|
||||
|
||||
/**
|
||||
* Retrieves a list of Catalogs by using REST API general QueryHandler.
|
||||
*/
|
||||
@GET
|
||||
@Path("/catalogs/query")
|
||||
@Consumes
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
||||
ListenableFuture<QueryResultRecords> catalogsQueryAll();
|
||||
|
||||
@GET
|
||||
@Path("/catalogs/query")
|
||||
@Consumes
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
||||
ListenableFuture<QueryResultRecords> catalogsQuery(@QueryParam("filter") String filter);
|
||||
|
||||
@GET
|
||||
@Path("/catalogs/query")
|
||||
@Consumes
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
||||
ListenableFuture<QueryResultRecords> catalogsQuery(@QueryParam("page") Integer page, @QueryParam("pageSize") Integer pageSize,
|
||||
@QueryParam("filter") String filter);
|
||||
|
||||
@GET
|
||||
@Path("/catalogs/query")
|
||||
@Consumes
|
||||
@QueryParams(keys = { "format" }, values = { "references" })
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
||||
ListenableFuture<CatalogReferences> catalogReferencesQueryAll();
|
||||
|
||||
@GET
|
||||
@Path("/catalogs/query")
|
||||
@Consumes
|
||||
@QueryParams(keys = { "format" }, values = { "references" })
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
||||
ListenableFuture<CatalogReferences> catalogReferencesQuery(@QueryParam("filter") String filter);
|
||||
|
||||
@GET
|
||||
@Path("/catalogs/query")
|
||||
@Consumes
|
||||
@QueryParams(keys = { "format" }, values = { "references" })
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
||||
ListenableFuture<CatalogReferences> catalogReferencesQuery(@QueryParam("page") Integer page, @QueryParam("pageSize") Integer pageSize,
|
||||
@QueryParam("filter") String filter);
|
||||
}
|
|
@ -0,0 +1,75 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.vcloud.director.v1_5.features;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.jclouds.concurrent.Timeout;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.query.CatalogReferences;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.query.QueryList;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.query.QueryResultRecords;
|
||||
|
||||
/**
|
||||
* Provides synchronous access to The REST API query interface.
|
||||
*
|
||||
* @see TaskAsyncClient
|
||||
* @author grkvlt@apache.org
|
||||
*/
|
||||
@Timeout(duration = 180, timeUnit = TimeUnit.SECONDS)
|
||||
public interface QueryClient {
|
||||
|
||||
/**
|
||||
* REST API General queries handler.
|
||||
*
|
||||
* <pre>
|
||||
* GET /query
|
||||
* </pre>
|
||||
*/
|
||||
QueryList queryList();
|
||||
|
||||
QueryResultRecords queryAll(String type);
|
||||
|
||||
QueryResultRecords query(String type, String filter);
|
||||
|
||||
QueryResultRecords query(Integer page, Integer pageSize, String format, String type, String filter);
|
||||
|
||||
/**
|
||||
* Retrieves a list of Catalogs by using REST API general QueryHandler.
|
||||
*
|
||||
* If filter is provided it will be applied to the corresponding result set.
|
||||
* Format determines the elements representation - references or records.
|
||||
* Default format is references.
|
||||
*
|
||||
* <pre>
|
||||
* GET /catalogs/query
|
||||
* </pre>
|
||||
*/
|
||||
QueryResultRecords catalogsQueryAll();
|
||||
|
||||
QueryResultRecords catalogsQuery(String filter);
|
||||
|
||||
QueryResultRecords catalogsQuery(Integer page, Integer pageSize, String filter);
|
||||
|
||||
CatalogReferences catalogReferencesQueryAll();
|
||||
|
||||
CatalogReferences catalogReferencesQuery(String filter);
|
||||
|
||||
CatalogReferences catalogReferencesQuery(Integer page, Integer pageSize, String filter);
|
||||
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
/**
|
||||
/*
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
|
@ -21,25 +21,20 @@ package org.jclouds.vcloud.director.v1_5.predicates;
|
|||
import java.net.URI;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import org.jclouds.logging.Logger;
|
||||
import org.jclouds.rest.RestContext;
|
||||
import org.jclouds.vcloud.director.v1_5.VCloudDirectorAsyncClient;
|
||||
import org.jclouds.vcloud.director.v1_5.VCloudDirectorClient;
|
||||
import org.jclouds.vcloud.director.v1_5.VCloudDirectorException;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Task;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.TaskInErrorStateException;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.TaskStatus;
|
||||
import org.jclouds.vcloud.director.v1_5.features.TaskClient;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.inject.Inject;
|
||||
|
||||
/**
|
||||
* Test a {@link Task} to see if it has succeeded.
|
||||
*
|
||||
* Tests to see if a task succeeds.
|
||||
*
|
||||
* @author Adrian Cole
|
||||
* @author grkvlt@apache.org
|
||||
*/
|
||||
@Singleton
|
||||
public class TaskSuccess implements Predicate<URI> {
|
||||
|
@ -50,21 +45,26 @@ public class TaskSuccess implements Predicate<URI> {
|
|||
protected Logger logger = Logger.NULL;
|
||||
|
||||
@Inject
|
||||
public TaskSuccess(RestContext<VCloudDirectorClient, VCloudDirectorAsyncClient> context) {
|
||||
this.taskClient = context.getApi().getTaskClient();
|
||||
public TaskSuccess(TaskClient taskClient) {
|
||||
this.taskClient = taskClient;
|
||||
}
|
||||
|
||||
/** @see Predicate#apply(Object) */
|
||||
@Override
|
||||
public boolean apply(URI taskUri) {
|
||||
logger.trace("looking for status on task %s", taskUri);
|
||||
|
||||
Task task = taskClient.getTask(taskUri);
|
||||
// perhaps task isn't available, yet
|
||||
if (task == null)
|
||||
return false;
|
||||
logger.trace("%s: looking for status %s: currently: %s", task, TaskStatus.SUCCESS, task.getStatus());
|
||||
if (task.getStatus() == TaskStatus.ERROR)
|
||||
throw new TaskInErrorStateException(task);
|
||||
return task.getStatus() == TaskStatus.SUCCESS;
|
||||
if (task == null) return false;
|
||||
logger.trace("%s: looking for status %s: currently: %s", task, Task.Status.SUCCESS, task.getStatus());
|
||||
if (task.getStatus().equals(Task.Status.ERROR))
|
||||
throw new VCloudDirectorException(task);
|
||||
return task.getStatus().equals(Task.Status.SUCCESS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "checkTaskSuccess()";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,7 +35,5 @@ public class VCloudDirectorClientExpectTest extends BaseVCloudDirectorRestClient
|
|||
VCloudDirectorClient clientWhenSessionsExist = requestSendsResponse(loginRequest, sessionResponse);
|
||||
|
||||
assertEquals(clientWhenSessionsExist.getCurrentSession(), SessionClientExpectTest.SESSION);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -36,4 +36,12 @@ public class VCloudDirectorClientExperimentLiveTest extends BaseVCloudDirectorCl
|
|||
assertEquals(session.getHref().toASCIIString(), context.getEndpoint().toASCIIString() + "/session/");
|
||||
}
|
||||
|
||||
/**
|
||||
* No operation.
|
||||
*
|
||||
* @see BaseVCloudDirectorClientLiveTest#setupRequiredClients()
|
||||
*/
|
||||
@Override
|
||||
public void setupRequiredClients() { }
|
||||
|
||||
}
|
||||
|
|
|
@ -23,21 +23,52 @@ package org.jclouds.vcloud.director.v1_5;
|
|||
*/
|
||||
public class VCloudDirectorLiveTestConstants {
|
||||
|
||||
public static final String REF_REQ_LIVE = "%s reference required to perform live tests";
|
||||
public static final String OBJ_REQ_LIVE = "%s instance required to perform live tests";
|
||||
public static final String OBJ_FIELD_REQ_LIVE = "%s must have a non-null \"%s\" to perform live tests";
|
||||
public static final String OBJ_FIELD_REQ = "%s must always have a non-null field \"%s\"";
|
||||
public static final String OBJ_FIELD_ATTRB_REQ = "%s %s (%s) must always have a non-null field \"%s\"";
|
||||
public static final String OBJ_FIELD_EQ = "%s %s must have the value \"%s\" (%s)";
|
||||
public static final String OBJ_FIELD_CONTAINS = "%s %s must contain the values \"%s\" (%s)";
|
||||
public static final String OBJ_FIELD_GTE_0 = "%s field %s must be greater than to equal to 0 (%d)";
|
||||
public static final String GETTER_RETURNS_SAME_OBJ = "%s should return the same %s as %s (%s, %s)";
|
||||
public static final String OBJ_FIELD_UPDATABLE = "%s field %s should be updatable";
|
||||
public static final String OBJ_FIELD_ATTRB_DEL = "%s %s (%s) should have deleted field \"%s\" (%s)";
|
||||
public static final String OBJ_DEL = "%s (%s) should have been deleted";
|
||||
public static final String TASK_COMPLETE_TIMELY = "Task %s should complete in a timely fashion";
|
||||
/* Error codes from 100 to 199 reflect parsing and other errors in domain objects. */
|
||||
|
||||
public static final String OK = "ERR-100: ok";
|
||||
|
||||
public static final String REF_REQ_LIVE = "ERR-101: %s reference required to perform live tests";
|
||||
|
||||
public static final String OBJ_REQ_LIVE = "ERR-102: %s instance required to perform live tests";
|
||||
|
||||
public static final String OBJ_FIELD_REQ_LIVE = "ERR-103: %s must have a non-null \"%s\" to perform live tests";
|
||||
|
||||
public static final String OBJ_FIELD_REQ = "ERR-103: %s must always have a non-null field \"%s\"";
|
||||
|
||||
public static final String OBJ_FIELD_ATTRB_REQ = "ERR-105: %s %s (%s) must always have a non-null field \"%s\"";
|
||||
|
||||
public static final String OBJ_FIELD_EQ = "ERR-106: %s %s must have the value \"%s\" (%s)";
|
||||
|
||||
public static final String OBJ_FIELD_CONTAINS = "ERR-107: %s %s must contain the values \"%s\" (%s)";
|
||||
|
||||
public static final String OBJ_FIELD_GTE_0 = "ERR-108: %s field %s must be greater than to equal to 0 (%d)";
|
||||
|
||||
public static final String GETTER_RETURNS_SAME_OBJ = "ERR-109: %s should return the same %s as %s (%s, %s)";
|
||||
|
||||
public static final String OBJ_FIELD_UPDATABLE = "ERR-110: %s field %s should be updatable";
|
||||
|
||||
public static final String OBJ_FIELD_ATTRB_DEL = "ERR-111: %s %s (%s) should have deleted field \"%s\" (%s)";
|
||||
|
||||
public static final String OBJ_DEL = "ERR-112: %s (%s) should have been deleted";
|
||||
|
||||
public static final String TASK_COMPLETE_TIMELY = "ERR-113: Task %s should complete in a timely fashion";
|
||||
|
||||
public static final String NOT_NULL_OBJECT_FMT = "ERR-114: The %s field of the %s must not be null";
|
||||
|
||||
@Deprecated
|
||||
public static final String FIELD_NOT_NULL_FMT = "The %s field of the %s must not be null";
|
||||
public static final String NOT_EMPTY_OBJECT_FMT = "ERR-115: One or more %s fields of the %s must be present";
|
||||
|
||||
public static final String REQUIRED_VALUE_OBJECT_FMT = "ERR-116: The %s field of the %s must not be '%s'; allowed values: %s";
|
||||
|
||||
public static final String REQUIRED_VALUE_FMT = "ERR-117: The %s field must not be '%s'; allowed values: %s";
|
||||
|
||||
public static final String MUST_BE_WELL_FORMED_FMT = "ERR-118: The %s field must be well formed: '%s'";
|
||||
|
||||
public static final String MUST_EXIST_FMT = "ERR-119: The '%s' %s must exist";
|
||||
|
||||
public static final String MUST_CONTAIN_FMT = "ERR-120: The %s field must contain '%s': '%s'";
|
||||
|
||||
public static final String CONDITION_FMT = "ERR-121: The %s field must be %s: '%s'";
|
||||
|
||||
public static final String CORRECT_VALUE_OBJECT_FMT = "ERR-122: The %s field of the %s must be '%s': '%s'";
|
||||
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/**
|
||||
/*
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
|
@ -18,6 +18,12 @@
|
|||
*/
|
||||
package org.jclouds.vcloud.director.v1_5.domain;
|
||||
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.CONDITION_FMT;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.MUST_BE_WELL_FORMED_FMT;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.MUST_CONTAIN_FMT;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.NOT_NULL_OBJECT_FMT;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.REQUIRED_VALUE_FMT;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.REQUIRED_VALUE_OBJECT_FMT;
|
||||
import static org.testng.Assert.assertEquals;
|
||||
import static org.testng.Assert.assertNotNull;
|
||||
import static org.testng.Assert.assertTrue;
|
||||
|
@ -52,7 +58,7 @@ public class Checks {
|
|||
|
||||
public static void checkEntityType(EntityType<?> entity) {
|
||||
// Check required fields
|
||||
assertNotNull(entity.getName(), "The Name attribute of an EntityType must be set");
|
||||
assertNotNull(entity.getName(), String.format(NOT_NULL_OBJECT_FMT, "Name", "EntityType"));
|
||||
|
||||
// Check optional fields
|
||||
// NOTE description cannot be checked
|
||||
|
@ -67,7 +73,7 @@ public class Checks {
|
|||
|
||||
public static void checkReferenceType(ReferenceType<?> reference) {
|
||||
// Check required fields
|
||||
assertNotNull(reference.getHref(), "The Href attribute of a ReferenceType must be set");
|
||||
assertNotNull(reference.getHref(), String.format(NOT_NULL_OBJECT_FMT, "Href", "ReferenceType"));
|
||||
|
||||
// Check optional fields
|
||||
String id = reference.getId();
|
||||
|
@ -91,21 +97,18 @@ public class Checks {
|
|||
|
||||
public static void checkId(String id) {
|
||||
Iterable<String> parts = Splitter.on(':').split(id);
|
||||
assertEquals(Iterables.size(parts), 4, "The Id must be well formed");
|
||||
assertEquals(Iterables.get(parts, 0), "urn", "The Id must start with 'urn'");
|
||||
assertEquals(Iterables.get(parts, 1), "vcloud", "The Id must include 'vcloud'");
|
||||
assertEquals(Iterables.size(parts), 4, String.format(MUST_BE_WELL_FORMED_FMT, "Id", id));
|
||||
assertEquals(Iterables.get(parts, 0), "urn", String.format(MUST_CONTAIN_FMT, "Id", "urn", id));
|
||||
assertEquals(Iterables.get(parts, 1), "vcloud", String.format(MUST_CONTAIN_FMT, "Id", "vcloud", id));
|
||||
try {
|
||||
UUID uuid = UUID.fromString(Iterables.get(parts, 3));
|
||||
assertNotNull(uuid, "The UUID part of an Id must be well formed");
|
||||
UUID.fromString(Iterables.get(parts, 3));
|
||||
} catch (IllegalArgumentException iae) {
|
||||
fail("The UUID part of an Id must be well formed");
|
||||
fail(String.format(MUST_BE_WELL_FORMED_FMT, "Id", id));
|
||||
}
|
||||
}
|
||||
|
||||
public static void checkType(String type) {
|
||||
assertTrue(VCloudDirectorMediaType.ALL.contains(type),
|
||||
String.format("The Type (%s) must be a valid media type - %s", type,
|
||||
Iterables.toString(VCloudDirectorMediaType.ALL)));
|
||||
assertTrue(VCloudDirectorMediaType.ALL.contains(type), String.format(REQUIRED_VALUE_FMT, "Type", type, Iterables.toString(VCloudDirectorMediaType.ALL)));
|
||||
}
|
||||
|
||||
// NOTE this does not currently check anything
|
||||
|
@ -121,10 +124,8 @@ public class Checks {
|
|||
|
||||
public static void checkLink(Link link) {
|
||||
// Check required fields
|
||||
assertNotNull(link.getRel(), "The Rel attribute of a Link must be set");
|
||||
assertTrue(Link.Rel.ALL.contains(link.getRel()),
|
||||
String.format("The Rel attribute (%s) of a Link must be one of the allowed list - %s",
|
||||
link.getRel(), Iterables.toString(Link.Rel.ALL)));
|
||||
assertNotNull(link.getRel(), String.format(NOT_NULL_OBJECT_FMT, "Rel", "Link"));
|
||||
assertTrue(Link.Rel.ALL.contains(link.getRel()), String.format(REQUIRED_VALUE_OBJECT_FMT, "Rel", "Link", link.getRel(), Iterables.toString(Link.Rel.ALL)));
|
||||
|
||||
// Check parent type
|
||||
checkReferenceType(link);
|
||||
|
@ -132,10 +133,8 @@ public class Checks {
|
|||
|
||||
public static void checkTask(Task task) {
|
||||
// Check required fields
|
||||
assertNotNull(task.getStatus(), "The Status attribute of a Task must be set");
|
||||
assertTrue(Task.Status.ALL.contains(task.getStatus().toString()),
|
||||
String.format("The Status of a Task (%s) must be one of the allowed list - %s",
|
||||
task.getStatus().toString(), Iterables.toString(Task.Status.ALL)));
|
||||
assertNotNull(task.getStatus(), String.format(NOT_NULL_OBJECT_FMT, "Status", "Task"));
|
||||
assertTrue(Task.Status.ALL.contains(task.getStatus()), String.format(REQUIRED_VALUE_OBJECT_FMT, "Status", "Task", task.getStatus(), Iterables.toString(Task.Status.ALL)));
|
||||
|
||||
// Check optional fields
|
||||
// NOTE operation cannot be checked
|
||||
|
@ -175,20 +174,78 @@ public class Checks {
|
|||
checkEntityType(file);
|
||||
}
|
||||
|
||||
public static void checkMetadata(Metadata metadata) {
|
||||
Set<MetadataEntry> metadataEntries = metadata.getMetadataEntries();
|
||||
if (metadataEntries != null && !metadataEntries.isEmpty()) {
|
||||
for (MetadataEntry metadataEntry : metadataEntries) {
|
||||
checkMetadataEntry(metadataEntry);
|
||||
}
|
||||
}
|
||||
|
||||
// Check parent type
|
||||
checkResourceType(metadata);
|
||||
}
|
||||
|
||||
public static void checkMetadataEntry(MetadataEntry metadataEntry) {
|
||||
// Check required fields
|
||||
assertNotNull(metadataEntry.getKey(), String.format(NOT_NULL_OBJECT_FMT, "Key", "MetadataEntry"));
|
||||
assertNotNull(metadataEntry.getValue(), String.format(NOT_NULL_OBJECT_FMT, "Value", "MetadataEntry"));
|
||||
|
||||
// Check parent type
|
||||
checkResourceType(metadataEntry);
|
||||
}
|
||||
|
||||
public static void checkMetadataValue(MetadataValue metadataValue) {
|
||||
// Check required elements and attributes
|
||||
assertNotNull(metadataValue.getValue(), String.format(NOT_NULL_OBJECT_FMT, "Value", "MetadataValue"));
|
||||
|
||||
// Check parent type
|
||||
checkResourceType(metadataValue);
|
||||
}
|
||||
|
||||
public static void checkProgress(Integer progress) {
|
||||
assertTrue(progress >= 0 && progress <= 100, "The Progress attribute must be between 0 and 100");
|
||||
assertTrue(progress >= 0 && progress <= 100, String.format(CONDITION_FMT, "Progress", "between 0 and 100", Integer.toString(progress)));
|
||||
}
|
||||
|
||||
public static void checkError(Error error) {
|
||||
// Check required fields
|
||||
assertNotNull(error.getMessage(), "The Message attribute of an Error must be set");
|
||||
assertNotNull(error.getMajorErrorCode(), "The MajorErrorCode attribute of an Error must be set");
|
||||
assertNotNull(error.getMinorErrorCode(), "The MinorErrorCode attribute of an Error must be set");
|
||||
assertNotNull(error.getMessage(), String.format(NOT_NULL_OBJECT_FMT, "Message", "Error"));
|
||||
assertNotNull(error.getMajorErrorCode(), String.format(NOT_NULL_OBJECT_FMT, "MajorErrorCode", "Error"));
|
||||
assertNotNull(error.getMinorErrorCode(), String.format(NOT_NULL_OBJECT_FMT, "MinorErrorCode", "Error"));
|
||||
|
||||
// NOTE vendorSpecificErrorCode cannot be checked
|
||||
// NOTE stackTrace cannot be checked
|
||||
}
|
||||
|
||||
public static void checkOrg(Org org) {
|
||||
// Check required elements and attributes
|
||||
assertNotNull(org.getFullName(), String.format(NOT_NULL_OBJECT_FMT, "FullName", "Org"));
|
||||
|
||||
// Check parent type
|
||||
checkEntityType(org);
|
||||
}
|
||||
|
||||
public static void checkCatalog(Catalog catalog) {
|
||||
// Check optional elements/attributes
|
||||
Entity owner = catalog.getOwner();
|
||||
if (owner != null) checkEntityType(owner);
|
||||
CatalogItems catalogItems = catalog.getCatalogItems();
|
||||
if (catalogItems != null) {
|
||||
for (Reference catalogItemReference : catalogItems.getCatalogItems()) {
|
||||
checkReferenceType(catalogItemReference);
|
||||
}
|
||||
}
|
||||
// NOTE isPublished cannot be checked
|
||||
|
||||
// Check parent type
|
||||
checkEntityType(catalog);
|
||||
}
|
||||
|
||||
public static void checkCatalogItem(CatalogItem catalogItem) {
|
||||
// Check parent type
|
||||
checkEntityType(catalogItem);
|
||||
}
|
||||
|
||||
public static void checkImageType(String imageType) {
|
||||
assertTrue(Media.ImageType.ALL.contains(imageType),
|
||||
"The Image type of a Media must be one of the allowed list");
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
package org.jclouds.vcloud.director.v1_5.features;
|
||||
|
||||
import static org.testng.Assert.*;
|
||||
import static org.testng.Assert.assertEquals;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
|
@ -46,7 +46,7 @@ import com.google.common.collect.ImmutableSet;
|
|||
*
|
||||
* @author grkvlt@apache.org
|
||||
*/
|
||||
@Test(groups = "unit", singleThreaded = true, testName = "CatalogClientExpectTest")
|
||||
@Test(groups = { "unit", "user" }, singleThreaded = true, testName = "CatalogClientExpectTest")
|
||||
public class CatalogClientExpectTest extends BaseVCloudDirectorRestClientExpectTest {
|
||||
|
||||
@Test
|
||||
|
@ -165,7 +165,7 @@ public class CatalogClientExpectTest extends BaseVCloudDirectorRestClientExpectT
|
|||
|
||||
HttpResponse catalogResponse = HttpResponse.builder()
|
||||
.statusCode(200)
|
||||
.payload(payloadFromResourceWithContentType("/catalog/catalogMetadataEntry.xml", VCloudDirectorMediaType.METADATA_ENTRY))
|
||||
.payload(payloadFromResourceWithContentType("/catalog/catalogMetadataValue.xml", VCloudDirectorMediaType.METADATA_VALUE))
|
||||
.build();
|
||||
|
||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, catalogRequest, catalogResponse);
|
||||
|
@ -176,9 +176,9 @@ public class CatalogClientExpectTest extends BaseVCloudDirectorRestClientExpectT
|
|||
.href(URI.create(endpoint + "/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4"))
|
||||
.build();
|
||||
|
||||
MetadataEntry expected = metadataEntry();
|
||||
MetadataValue expected = metadataValue();
|
||||
|
||||
assertEquals(client.getCatalogClient().getCatalogMetadataEntry(catalogRef, "KEY"), expected);
|
||||
assertEquals(client.getCatalogClient().getCatalogMetadataValue(catalogRef, "KEY"), expected);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -349,7 +349,7 @@ public class CatalogClientExpectTest extends BaseVCloudDirectorRestClientExpectT
|
|||
|
||||
HttpResponse catalogItemResponse = HttpResponse.builder()
|
||||
.statusCode(200)
|
||||
.payload(payloadFromResourceWithContentType("/catalog/catalogItemMetadataEntry.xml", VCloudDirectorMediaType.METADATA_ENTRY + ";version=1.5"))
|
||||
.payload(payloadFromResourceWithContentType("/catalog/catalogItemMetadataValue.xml", VCloudDirectorMediaType.METADATA_VALUE + ";version=1.5"))
|
||||
.build();
|
||||
|
||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, catalogItemRequest, catalogItemResponse);
|
||||
|
@ -360,9 +360,9 @@ public class CatalogClientExpectTest extends BaseVCloudDirectorRestClientExpectT
|
|||
.href(URI.create("https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df"))
|
||||
.build();
|
||||
|
||||
MetadataEntry expected = itemMetadataEntry();
|
||||
MetadataValue expected = itemMetadataValue();
|
||||
|
||||
assertEquals(client.getCatalogClient().getCatalogItemMetadataEntry(catalogItemReference, "KEY"), expected);
|
||||
assertEquals(client.getCatalogClient().getCatalogItemMetadataValue(catalogItemReference, "KEY"), expected);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -394,7 +394,7 @@ public class CatalogClientExpectTest extends BaseVCloudDirectorRestClientExpectT
|
|||
|
||||
Task expected = setMetadataValueTask();
|
||||
|
||||
assertEquals(client.getCatalogClient().setCatalogItemMetadataEntry(catalogItemReference, "KEY", value), expected);
|
||||
assertEquals(client.getCatalogClient().setCatalogItemMetadataValue(catalogItemReference, "KEY", value), expected);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -423,7 +423,7 @@ public class CatalogClientExpectTest extends BaseVCloudDirectorRestClientExpectT
|
|||
|
||||
Task expected = deleteMetadataEntryTask();
|
||||
|
||||
assertEquals(client.getCatalogClient().deleteCatalogItemMetadataEntry(catalogItemReference, "KEY"), expected);
|
||||
assertEquals(client.getCatalogClient().deleteCatalogItemMetadataValue(catalogItemReference, "KEY"), expected);
|
||||
}
|
||||
|
||||
public static final Catalog catalog() {
|
||||
|
@ -524,6 +524,30 @@ public class CatalogClientExpectTest extends BaseVCloudDirectorRestClientExpectT
|
|||
.entry("KEY", "VALUE")
|
||||
.build();
|
||||
}
|
||||
|
||||
public static MetadataValue metadataValue() {
|
||||
return MetadataValue.builder()
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4/metadata/KEY"))
|
||||
.link(Link.builder()
|
||||
.rel("up")
|
||||
.type("application/vnd.vmware.vcloud.metadata+xml")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4/metadata"))
|
||||
.build())
|
||||
.value("VALUE")
|
||||
.build();
|
||||
}
|
||||
|
||||
public static MetadataValue itemMetadataValue() {
|
||||
return MetadataValue.builder()
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df/metadata/KEY"))
|
||||
.link(Link.builder()
|
||||
.rel("up")
|
||||
.type("application/vnd.vmware.vcloud.metadata+xml")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df/metadata"))
|
||||
.build())
|
||||
.value("VALUE")
|
||||
.build();
|
||||
}
|
||||
|
||||
public static CatalogItem catalogItem() {
|
||||
return CatalogItem.builder()
|
||||
|
|
|
@ -18,70 +18,259 @@
|
|||
*/
|
||||
package org.jclouds.vcloud.director.v1_5.features;
|
||||
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.CORRECT_VALUE_OBJECT_FMT;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.MUST_EXIST_FMT;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.TASK_COMPLETE_TIMELY;
|
||||
import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkCatalogItem;
|
||||
import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkError;
|
||||
import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkMetadata;
|
||||
import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkMetadataValue;
|
||||
import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkTask;
|
||||
import static org.testng.Assert.assertEquals;
|
||||
import static org.testng.Assert.assertFalse;
|
||||
import static org.testng.Assert.assertTrue;
|
||||
import static org.testng.Assert.fail;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
import org.jclouds.vcloud.director.v1_5.domain.OrgList;
|
||||
import org.jclouds.vcloud.director.v1_5.VCloudDirectorException;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Catalog;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.CatalogItem;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Error;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Metadata;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.MetadataEntry;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.MetadataValue;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Reference;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.ReferenceType;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Task;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.TasksList;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.query.CatalogReferences;
|
||||
import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorClientLiveTest;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.collect.Iterables;
|
||||
|
||||
/**
|
||||
* Tests live behavior of {@link taskClient}.
|
||||
*
|
||||
* @author grkvlt@apache.task
|
||||
*/
|
||||
@Test(groups = { "live", "apitests" }, testName = "TaskClientLiveTest")
|
||||
* Tests live behavior of {@link CatalogClient}.
|
||||
*
|
||||
* @author grkvlt@apache.org
|
||||
*/
|
||||
@Test(groups = { "live", "api", "user" }, singleThreaded = true, testName = "CatalogClientLiveTest")
|
||||
public class CatalogClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
||||
|
||||
/*
|
||||
* Convenience references to API clients.
|
||||
*/
|
||||
|
||||
private CatalogClient catalogClient;
|
||||
private QueryClient queryClient;
|
||||
private MediaClient mediaClient;
|
||||
|
||||
/*
|
||||
* Shared state between dependant tests.
|
||||
*/
|
||||
|
||||
private OrgList orgList;
|
||||
private Reference orgRef;
|
||||
private TasksList taskList;
|
||||
private Task task;
|
||||
private URI taskUri;
|
||||
private ReferenceType<?> catalogRef;
|
||||
private ReferenceType<?> catalogItemRef;
|
||||
private ReferenceType<?> newCatalogItemRef;
|
||||
private Catalog catalog;
|
||||
private CatalogItem catalogItem;
|
||||
private CatalogItem newCatalogItem;
|
||||
private Metadata catalogMetadata;
|
||||
|
||||
@Test(testName = "GET /tasksList/{id}")
|
||||
public void testGetTaskList() {
|
||||
orgList = context.getApi().getOrgClient().getOrgList();
|
||||
orgRef = Iterables.getFirst(orgList.getOrgs(), null);
|
||||
|
||||
// Call the method being tested
|
||||
taskList = context.getApi().getTaskClient().getTaskList(orgRef);
|
||||
|
||||
// NOTE The environment MUST have ...
|
||||
|
||||
// Check required elements and attributes
|
||||
assertFalse(Iterables.isEmpty(taskList.getTasks()), "There must always be Task elements in the TaskList");
|
||||
|
||||
for (Task task : taskList.getTasks()) {
|
||||
checkTask(task);
|
||||
@BeforeClass(inheritGroups = true)
|
||||
public void setupRequiredClients() {
|
||||
catalogClient = context.getApi().getCatalogClient();
|
||||
queryClient = context.getApi().getQueryClient();
|
||||
mediaClient = context.getApi().getMediaClient();
|
||||
}
|
||||
|
||||
private Metadata catalogItemMetadata;
|
||||
|
||||
@Test(testName = "GET /catalog/{id}")
|
||||
public void testGetCatalog() {
|
||||
// TODO use property from default property set
|
||||
CatalogReferences catalogReferences = queryClient.catalogReferencesQuery(String.format("name==%s", catalogName));
|
||||
assertEquals(Iterables.size(catalogReferences.getReferences()), 1, String.format(MUST_EXIST_FMT, catalogName, "Catalog"));
|
||||
catalogRef = Iterables.getOnlyElement(catalogReferences.getReferences());
|
||||
catalog = catalogClient.getCatalog(catalogRef);
|
||||
}
|
||||
|
||||
@Test(testName = "GET /catalogItem/{id}", dependsOnMethods = { "testGetCatalog" })
|
||||
public void testGetCatalogItem() {
|
||||
assertFalse(Iterables.isEmpty(catalog.getCatalogItems().getCatalogItems()));
|
||||
catalogItemRef = Iterables.get(catalog.getCatalogItems().getCatalogItems(), 0);
|
||||
catalogItem = catalogClient.getCatalogItem(catalogItemRef);
|
||||
checkCatalogItem(catalogItem);
|
||||
}
|
||||
|
||||
// NOTE for this test to work, we need to be able to upload a new vAppTemplate to a vDC first
|
||||
// NOTE we could do this with a test environment property -Dtest.vcloud-director.vappTemplateId=vapptemplate-abcd
|
||||
@Test(testName = "POST /catalog/{id}/catalogItems", dependsOnMethods = { "testGetCatalog" }, enabled = false)
|
||||
public void testAddCatalogItem() {
|
||||
CatalogItem editedCatalogItem = CatalogItem.builder()
|
||||
.name("newitem")
|
||||
.description("New Item")
|
||||
// XXX org.jclouds.vcloud.director.v1_5.VCloudDirectorException: Error: The VCD entity image already exists.
|
||||
// .entity(Reference.builder().href(catalogItem.getEntity().getHref()).build())
|
||||
// XXX org.jclouds.vcloud.director.v1_5.VCloudDirectorException: Error: The VCD entity ubuntu10 already exists.
|
||||
// .entity(Reference.builder().href(URI.create(endpoint + "/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9")).build())
|
||||
.build();
|
||||
newCatalogItem = catalogClient.addCatalogItem(catalogRef, editedCatalogItem);
|
||||
checkCatalogItem(newCatalogItem);
|
||||
assertEquals(newCatalogItem.getName(), "newitem");
|
||||
}
|
||||
|
||||
@Test(testName = "PUT /catalogItem/{id}", dependsOnMethods = { "testAddCatalogItem" }, enabled = false)
|
||||
public void testUpdateCatalogItem() {
|
||||
Catalog catalog = catalogClient.getCatalog(catalogRef);
|
||||
newCatalogItemRef = Iterables.find(catalog.getCatalogItems().getCatalogItems(), new Predicate<Reference>() {
|
||||
@Override
|
||||
public boolean apply(Reference input) {
|
||||
return input.getHref().equals(newCatalogItem.getHref());
|
||||
}
|
||||
});
|
||||
CatalogItem updatedCatalogItem = CatalogItem.builder().fromCatalogItem(catalogItem).name("UPDATEDNAME").build();
|
||||
newCatalogItem = catalogClient.updateCatalogItem(catalogRef, updatedCatalogItem);
|
||||
checkCatalogItem(newCatalogItem);
|
||||
assertEquals(newCatalogItem.getName(), "UPDATEDNAME");
|
||||
}
|
||||
|
||||
@Test(testName = "DELETE /catalogItem/{id}", dependsOnMethods = { "testAddCatalogItem" }, enabled = false)
|
||||
public void testDeleteCatalogItem() {
|
||||
catalogClient.deleteCatalogItem(newCatalogItemRef);
|
||||
try {
|
||||
catalogClient.getCatalogItem(newCatalogItemRef);
|
||||
fail("The CatalogItem should have been deleted");
|
||||
} catch (VCloudDirectorException vcde) {
|
||||
checkError(vcde.getError());
|
||||
// XXX
|
||||
assertEquals(vcde.getError().getMajorErrorCode(), Integer.valueOf(403), "The majorErrorCode should be 403 since the item has been deleted");
|
||||
}
|
||||
}
|
||||
|
||||
@Test(testName = "GET /task/{id}", dependsOnMethods = { "testGetTaskList" })
|
||||
public void testGetTask() {
|
||||
taskUri = Iterables.getFirst(taskList.getTasks(), null).getHref();
|
||||
|
||||
// Call the method being tested
|
||||
task = context.getApi().getTaskClient().getTask(taskUri);
|
||||
|
||||
// Check required elements and attributes
|
||||
checkTask(task);
|
||||
// NOTE for this test to work, we need to be able to create metadata on a Catalog, specifically { "KEY", "VALUE" }
|
||||
@Test(testName = "GET /catalog/{id}/metadata", dependsOnMethods = { "testGetCatalog" }, enabled = false)
|
||||
public void testGetCatalogMetadata() {
|
||||
catalogMetadata = catalogClient.getCatalogMetadata(catalogRef);
|
||||
checkMetadata(catalogMetadata);
|
||||
}
|
||||
|
||||
@Test(testName = "GET /task/{id}/metadata/", dependsOnMethods = { "testGetTask" })
|
||||
public void testCancelTask() {
|
||||
// Call the method being tested
|
||||
context.getApi().getTaskClient().cancelTask(taskUri);
|
||||
|
||||
// NOTE for this test to work, we need to be able to create metadata on a Catalog, specifically { "KEY", "VALUE" }
|
||||
@Test(testName = "GET /catalog/{id}/metadata/{key}", dependsOnMethods = { "testGetCatalogMetadata" }, enabled = false)
|
||||
public void testGetCatalogMetadataValue() {
|
||||
MetadataEntry existingMetadataEntry = Iterables.find(catalogMetadata.getMetadataEntries(), new Predicate<MetadataEntry>() {
|
||||
@Override
|
||||
public boolean apply(MetadataEntry input) {
|
||||
return input.getKey().equals("KEY");
|
||||
}
|
||||
});
|
||||
MetadataValue metadataValue = catalogClient.getCatalogMetadataValue(catalogRef, "KEY");
|
||||
assertEquals(metadataValue.getValue(), existingMetadataEntry.getValue(),
|
||||
String.format(CORRECT_VALUE_OBJECT_FMT, "Value", "MetadataValue", existingMetadataEntry.getValue(), metadataValue.getValue()));
|
||||
checkMetadataValue(metadataValue);
|
||||
}
|
||||
}
|
||||
|
||||
@Test(testName = "GET /catalogItem/{id}/metadata", dependsOnMethods = { "testGetCatalogItem" })
|
||||
public void testGetCatalogItemMetadata() {
|
||||
resetCatalogItemMetadata(catalogItemRef);
|
||||
catalogItemMetadata = catalogClient.getCatalogItemMetadata(catalogItemRef);
|
||||
assertEquals(catalogItemMetadata.getMetadataEntries().size(), 1, String.format(MUST_EXIST_FMT, "MetadataEntry", "CatalogItem"));
|
||||
checkMetadata(catalogItemMetadata);
|
||||
}
|
||||
|
||||
@Test(testName = "POST /catalogItem/{id}/metadata", dependsOnMethods = { "testGetCatalogItemMetadata" })
|
||||
public void testMergeCatalogItemMetadata() {
|
||||
Metadata newMetadata = Metadata.builder()
|
||||
.entry(MetadataEntry.builder().entry("KEY", "MARMALADE").build())
|
||||
.entry(MetadataEntry.builder().entry("VEGIMITE", "VALUE").build())
|
||||
.build();
|
||||
|
||||
Task mergeCatalogItemMetadata = catalogClient.mergeCatalogItemMetadata(catalogItemRef, newMetadata);
|
||||
checkTask(mergeCatalogItemMetadata);
|
||||
assertTrue(retryTaskSuccess.apply(mergeCatalogItemMetadata.getHref()),
|
||||
String.format(TASK_COMPLETE_TIMELY, "mergeCatalogItemMetadata"));
|
||||
|
||||
Metadata mergedCatalogItemMetadata = catalogClient.getCatalogItemMetadata(catalogItemRef);
|
||||
// XXX
|
||||
assertEquals(mergedCatalogItemMetadata.getMetadataEntries().size(), catalogItemMetadata.getMetadataEntries().size() + 1,
|
||||
"Should have added another MetadataEntry to the CatalogItem");
|
||||
|
||||
MetadataValue keyMetadataValue = catalogClient.getCatalogItemMetadataValue(catalogItemRef, "KEY");
|
||||
// XXX
|
||||
assertEquals(keyMetadataValue.getValue(), "MARMALADE", "The Value of the MetadataValue for KEY should have changed");
|
||||
checkMetadataValue(keyMetadataValue);
|
||||
|
||||
MetadataValue newKeyMetadataValue = catalogClient.getCatalogItemMetadataValue(catalogItemRef, "VEGIMITE");
|
||||
// XXX
|
||||
assertEquals(newKeyMetadataValue.getValue(), "VALUE", "The Value of the MetadataValue for NEW_KEY should have been set");
|
||||
checkMetadataValue(newKeyMetadataValue);
|
||||
}
|
||||
|
||||
// TODO escalate
|
||||
// XXX org.jclouds.vcloud.director.v1_5.VCloudDirectorException: Error: The access to the resource metadata_item with id KEY is forbidden
|
||||
@Test(testName = "GET /catalog/{id}/metadata/{key}", dependsOnMethods = { "testGetCatalogItemMetadata" })
|
||||
public void testGetCatalogItemMetadataValue() {
|
||||
MetadataEntry existingMetadataEntry = Iterables.find(catalogItemMetadata.getMetadataEntries(), new Predicate<MetadataEntry>() {
|
||||
@Override
|
||||
public boolean apply(MetadataEntry input) {
|
||||
return input.getKey().equals("KEY");
|
||||
}
|
||||
});
|
||||
MetadataValue metadataValue = catalogClient.getCatalogItemMetadataValue(catalogItemRef, "KEY");
|
||||
assertEquals(existingMetadataEntry.getValue(), metadataValue.getValue());
|
||||
checkMetadataValue(metadataValue);
|
||||
}
|
||||
|
||||
@Test(testName = "PUT /catalog/{id}/metadata/{key}", dependsOnMethods = { "testGetCatalogItemMetadataValue" })
|
||||
public void testSetCatalogItemMetadataValue() {
|
||||
MetadataValue newMetadataValue = MetadataValue.builder().value("NEW").build();
|
||||
|
||||
Task setCatalogItemMetadataValue = catalogClient.setCatalogItemMetadataValue(catalogItemRef, "KEY", newMetadataValue);
|
||||
checkTask(setCatalogItemMetadataValue);
|
||||
// TODO requires code from dan to be merged
|
||||
// assertTrue(taskTester.apply(setCatalogItemMetadataValue.getHref()),
|
||||
// String.format(TASK_COMPLETE_TIMELY, "setCatalogItemMetadataValue"));
|
||||
|
||||
MetadataValue updatedMetadataValue = catalogClient.getCatalogItemMetadataValue(catalogItemRef, "KEY");
|
||||
assertEquals(updatedMetadataValue.getValue(), newMetadataValue.getValue(),
|
||||
String.format(CORRECT_VALUE_OBJECT_FMT, "Value", "MetadataValue", newMetadataValue.getValue(), updatedMetadataValue.getValue()));
|
||||
checkMetadataValue(updatedMetadataValue);
|
||||
}
|
||||
|
||||
@Test(testName = "DELETE /catalog/{id}/metadata/{key}", dependsOnMethods = { "testSetCatalogItemMetadataValue" })
|
||||
public void testDeleteCatalogItemMetadataValue() {
|
||||
Task deleteCatalogItemMetadataValue = catalogClient.deleteCatalogItemMetadataValue(catalogItemRef, "KEY");
|
||||
checkTask(deleteCatalogItemMetadataValue);
|
||||
// TODO requires code from dan to be merged
|
||||
// assertTrue(taskTester.apply(deleteCatalogItemMetadataValue.getHref()),
|
||||
// String.format(TASK_COMPLETE_TIMELY, "deleteCatalogItemMetadataValue"));
|
||||
try {
|
||||
catalogClient.getCatalogItemMetadataValue(catalogItemRef, "KEY");
|
||||
fail("The CatalogItem MetadataValue for KEY should have been deleted");
|
||||
} catch (VCloudDirectorException vcde) {
|
||||
Error error = vcde.getError();
|
||||
checkError(error);
|
||||
Integer majorErrorCode = error.getMajorErrorCode();
|
||||
assertEquals(majorErrorCode, Integer.valueOf(403),
|
||||
String.format(CORRECT_VALUE_OBJECT_FMT, "MajorErrorCode", "Error", "403",Integer.toString(majorErrorCode)));
|
||||
}
|
||||
}
|
||||
|
||||
private void deleteAllCatalogItemMetadata(ReferenceType<?> catalogItemRef) {
|
||||
Metadata currentMetadata = catalogClient.getCatalogItemMetadata(catalogItemRef);
|
||||
for (MetadataEntry currentMetadataEntry : currentMetadata.getMetadataEntries()) {
|
||||
catalogClient.deleteCatalogItemMetadataValue(catalogItemRef, currentMetadataEntry.getKey());
|
||||
}
|
||||
Metadata emptyMetadata = catalogClient.getCatalogItemMetadata(catalogItemRef);
|
||||
assertTrue(emptyMetadata.getMetadataEntries().isEmpty(), "The catalogItem Metadata should be empty");
|
||||
}
|
||||
|
||||
private void resetCatalogItemMetadata(ReferenceType<?> catalogItemRef) {
|
||||
deleteAllCatalogItemMetadata(catalogItemRef);
|
||||
Metadata newMetadata = Metadata.builder().entry(MetadataEntry.builder().entry("KEY", "VALUE").build()).build();
|
||||
Task mergeCatalogItemMetadata = catalogClient.mergeCatalogItemMetadata(catalogItemRef, newMetadata);
|
||||
// TODO requires code from dan to be merged
|
||||
// assertTrue(taskTester.apply(mergeCatalogItemMetadata.getHref()),
|
||||
// String.format(TASK_COMPLETE_TIMELY, "mergeCatalogItemMetadata"));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,10 +43,10 @@ import org.testng.annotations.Test;
|
|||
*
|
||||
* @author danikov
|
||||
*/
|
||||
@Test(groups = "unit", singleThreaded = true, testName = "NetworkClientExpectTest")
|
||||
@Test(groups = { "unit", "user" }, singleThreaded = true, testName = "NetworkClientExpectTest")
|
||||
public class MediaClientExpectTest extends BaseVCloudDirectorRestClientExpectTest {
|
||||
|
||||
@Test
|
||||
@Test(enabled = false)
|
||||
public void testGetMedia() {
|
||||
URI mediaUri = URI.create(endpoint + "/media/794eb334-754e-4917-b5a0-5df85cbd61d1");
|
||||
|
||||
|
|
|
@ -42,9 +42,7 @@ import static org.testng.Assert.fail;
|
|||
|
||||
import java.net.URI;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.jclouds.predicates.RetryablePredicate;
|
||||
import org.jclouds.vcloud.director.v1_5.VCloudDirectorException;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Checks;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Error;
|
||||
|
@ -56,11 +54,10 @@ import org.jclouds.vcloud.director.v1_5.domain.Owner;
|
|||
import org.jclouds.vcloud.director.v1_5.domain.Reference;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Task;
|
||||
import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorClientLiveTest;
|
||||
import org.jclouds.vcloud.director.v1_5.predicates.TaskSuccess;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.BeforeGroups;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Iterables;
|
||||
|
||||
|
@ -69,16 +66,23 @@ import com.google.common.collect.Iterables;
|
|||
*
|
||||
* @author danikov
|
||||
*/
|
||||
@Test(groups = { "live", "apitests", "User" }, testName = "MediaClientLiveTest")
|
||||
@Test(groups = { "live", "api", "user" }, singleThreaded = true, testName = "MediaClientLiveTest")
|
||||
public class MediaClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
||||
|
||||
public static final String MEDIA = "media";
|
||||
public static Predicate<URI> taskTester;
|
||||
|
||||
/*
|
||||
* Convenience references to API clients.
|
||||
*/
|
||||
|
||||
protected MediaClient mediaClient;
|
||||
|
||||
@BeforeClass(inheritGroups = true)
|
||||
@Override
|
||||
public void setupRequiredClients() {
|
||||
mediaClient = context.getApi().getMediaClient();
|
||||
}
|
||||
|
||||
/*
|
||||
* Shared state between dependent tests.
|
||||
*/
|
||||
|
@ -89,17 +93,14 @@ public class MediaClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
|||
private MetadataValue metadataValue;
|
||||
private String metadataEntryValue = "value";
|
||||
|
||||
@BeforeGroups(groups = { "live" }, dependsOnMethods = { "setupClient" })
|
||||
public void before() {
|
||||
String mediaId = "68dc01a4-6c76-4177-9f19-ec12bf94287c"; // TODO: inject
|
||||
@BeforeGroups(groups = { "live" })
|
||||
public void createReferenceData() {
|
||||
mediaRef = Reference.builder()
|
||||
.type("application/vnd.vmware.vcloud.media+xml")
|
||||
.name("")
|
||||
.href(URI.create(endpoint+"/media/"+mediaId))
|
||||
.href(URI.create(endpoint+"/media/" + mediaId))
|
||||
.id(mediaId)
|
||||
.build();
|
||||
mediaClient = context.getApi().getMediaClient();
|
||||
taskTester = new RetryablePredicate<URI>(new TaskSuccess(context), 10, 1, TimeUnit.SECONDS);
|
||||
mediaClient.setMetadata(mediaRef, "key", MetadataValue.builder().value("value").build());
|
||||
}
|
||||
|
||||
|
@ -127,11 +128,11 @@ public class MediaClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
|||
assertTrue(size >= 0, String.format(OBJ_FIELD_GTE_0, MEDIA, "size", size));
|
||||
}
|
||||
|
||||
@Test(testName = "GET /media/{id}/owner",
|
||||
@Test(testName = "GET /media/{id}/owner",
|
||||
dependsOnMethods = { "testWhenResponseIs2xxLoginReturnsValidMedia" })
|
||||
public void testWhenResponseIs2xxLoginReturnsValidMediaOwner() {
|
||||
Owner directOwner = mediaClient.getOwner(mediaRef);
|
||||
assertEquals(owner, directOwner, String.format(GETTER_RETURNS_SAME_OBJ,
|
||||
assertEquals(owner, directOwner, String.format(GETTER_RETURNS_SAME_OBJ,
|
||||
"getOwner()", "owner", "media.getOwner()", owner.toString(), directOwner.toString()));
|
||||
|
||||
// parent type
|
||||
|
@ -142,7 +143,7 @@ public class MediaClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
|||
Checks.checkReferenceType(directOwner.getUser());
|
||||
}
|
||||
|
||||
@Test(testName = "PUT /media/{id}",
|
||||
@Test(testName = "PUT /media/{id}",
|
||||
dependsOnMethods = { "testWhenResponseIs2xxLoginReturnsValidMedia" })
|
||||
public void testWhenResponseIs2xxLoginReturnsValidNetwork() {
|
||||
String oldName = media.getName();
|
||||
|
@ -154,11 +155,11 @@ public class MediaClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
|||
|
||||
Task updateMedia = mediaClient.updateMedia(mediaRef, media);
|
||||
Checks.checkTask(updateMedia);
|
||||
assertTrue(taskTester.apply(updateMedia.getHref()), String.format(TASK_COMPLETE_TIMELY, "updateMedia"));
|
||||
assertTrue(retryTaskSuccess.apply(updateMedia.getHref()), String.format(TASK_COMPLETE_TIMELY, "updateMedia"));
|
||||
media = mediaClient.getMedia(mediaRef);
|
||||
|
||||
assertTrue(equal(media.getName(), newName), String.format(OBJ_FIELD_UPDATABLE, MEDIA, "name"));
|
||||
assertTrue(equal(media.getDescription(), newDescription),
|
||||
assertTrue(equal(media.getDescription(), newDescription),
|
||||
String.format(OBJ_FIELD_UPDATABLE, MEDIA, "description"));
|
||||
|
||||
//TODO negative tests?
|
||||
|
@ -171,16 +172,16 @@ public class MediaClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
|||
|
||||
updateMedia = mediaClient.updateMedia(mediaRef, media);
|
||||
Checks.checkTask(updateMedia);
|
||||
assertTrue(taskTester.apply(updateMedia.getHref()), String.format(TASK_COMPLETE_TIMELY, "updateMedia"));
|
||||
assertTrue(retryTaskSuccess.apply(updateMedia.getHref()), String.format(TASK_COMPLETE_TIMELY, "updateMedia"));
|
||||
media = mediaClient.getMedia(mediaRef);
|
||||
}
|
||||
|
||||
@Test(testName = "GET /media/{id}/metadata",
|
||||
@Test(testName = "GET /media/{id}/metadata",
|
||||
dependsOnMethods = { "testWhenResponseIs2xxLoginReturnsValidMedia" })
|
||||
public void testWhenResponseIs2xxLoginReturnsValidMetadata() {
|
||||
metadata = mediaClient.getMetadata(mediaRef);
|
||||
// required for testing
|
||||
assertFalse(Iterables.isEmpty(metadata.getMetadataEntries()),
|
||||
assertFalse(Iterables.isEmpty(metadata.getMetadataEntries()),
|
||||
String.format(OBJ_FIELD_REQ_LIVE, MEDIA, "metadata.entries"));
|
||||
|
||||
// parent type
|
||||
|
@ -188,9 +189,9 @@ public class MediaClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
|||
|
||||
for (MetadataEntry entry : metadata.getMetadataEntries()) {
|
||||
// required elements and attributes
|
||||
assertNotNull(entry.getKey(),
|
||||
assertNotNull(entry.getKey(),
|
||||
String.format(OBJ_FIELD_ATTRB_REQ, MEDIA, "MetadataEntry", metadataValue, "key"));
|
||||
assertNotNull(entry.getValue(),
|
||||
assertNotNull(entry.getValue(),
|
||||
String.format(OBJ_FIELD_ATTRB_REQ, MEDIA, "MetadataEntry", metadataValue, "value"));
|
||||
|
||||
// parent type
|
||||
|
@ -198,7 +199,7 @@ public class MediaClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Test(testName = "POST /media/{id}/metadata",
|
||||
@Test(testName = "POST /media/{id}/metadata",
|
||||
dependsOnMethods = { "testWhenResponseIs2xxLoginReturnsValidMetadata" })
|
||||
public void testWhenResponseIs2xxLoginMergedMetadata() {
|
||||
// test new
|
||||
|
@ -209,7 +210,7 @@ public class MediaClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
|||
|
||||
Task mergeMetadata = mediaClient.mergeMetadata(mediaRef, inputMetadata);
|
||||
Checks.checkTask(mergeMetadata);
|
||||
assertTrue(taskTester.apply(mergeMetadata.getHref()), String.format(TASK_COMPLETE_TIMELY, "mergeMetadata(new)"));
|
||||
assertTrue(retryTaskSuccess.apply(mergeMetadata.getHref()), String.format(TASK_COMPLETE_TIMELY, "mergeMetadata(new)"));
|
||||
metadata = mediaClient.getMetadata(mediaRef);
|
||||
checkMetadataContainsEntries(metadata, inputEntries);
|
||||
|
||||
|
@ -223,7 +224,7 @@ public class MediaClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
|||
|
||||
mergeMetadata = mediaClient.mergeMetadata(mediaRef, inputMetadata);
|
||||
Checks.checkTask(mergeMetadata);
|
||||
assertTrue(taskTester.apply(mergeMetadata.getHref()), String.format(TASK_COMPLETE_TIMELY, "mergeMetadata(modify)"));
|
||||
assertTrue(retryTaskSuccess.apply(mergeMetadata.getHref()), String.format(TASK_COMPLETE_TIMELY, "mergeMetadata(modify)"));
|
||||
metadata = mediaClient.getMetadata(mediaRef);
|
||||
checkMetadataContainsEntries(metadata, inputEntries);
|
||||
|
||||
|
@ -240,14 +241,14 @@ public class MediaClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
|||
}
|
||||
|
||||
if (!found) {
|
||||
String.format(OBJ_FIELD_CONTAINS, MEDIA, "metadata",
|
||||
Iterables.toString(metadata.getMetadataEntries()),
|
||||
String.format(OBJ_FIELD_CONTAINS, MEDIA, "metadata",
|
||||
Iterables.toString(metadata.getMetadataEntries()),
|
||||
Iterables.toString(entries));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test(testName = "GET /media/{id}/metadata/{key}",
|
||||
@Test(testName = "GET /media/{id}/metadata/{key}",
|
||||
dependsOnMethods = { "testWhenResponseIs2xxLoginMergedMetadata" })
|
||||
public void testWhenResponseIs2xxLoginReturnsValidMetadataValue() {
|
||||
metadataValue = mediaClient.getMetadataValue(mediaRef, "key");
|
||||
|
@ -257,14 +258,14 @@ public class MediaClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
|||
|
||||
// Check required elements and attributes
|
||||
String value = metadataValue.getValue();
|
||||
assertNotNull(value,
|
||||
String.format(OBJ_FIELD_ATTRB_REQ, MEDIA, "MetadataEntry",
|
||||
assertNotNull(value,
|
||||
String.format(OBJ_FIELD_ATTRB_REQ, MEDIA, "MetadataEntry",
|
||||
metadataValue.toString(), metadataEntryValue.toString()));
|
||||
assertEquals(value, metadataEntryValue,
|
||||
assertEquals(value, metadataEntryValue,
|
||||
String.format(OBJ_FIELD_EQ, MEDIA, "metadataEntry.value", metadataEntryValue, value));
|
||||
}
|
||||
|
||||
@Test(testName = "PUT /media/{id}/metadata/{key}",
|
||||
@Test(testName = "PUT /media/{id}/metadata/{key}",
|
||||
dependsOnMethods = { "testWhenResponseIs2xxLoginReturnsValidMetadataValue" })
|
||||
public void testWhenResponseIs2xxLoginUpdatesMetadataEntry() {
|
||||
metadataEntryValue = "newValue";
|
||||
|
@ -272,7 +273,7 @@ public class MediaClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
|||
|
||||
Task setMetadataEntry = mediaClient.setMetadata(mediaRef, "key", newValue);
|
||||
Checks.checkTask(setMetadataEntry);
|
||||
assertTrue(taskTester.apply(setMetadataEntry.getHref()),
|
||||
assertTrue(retryTaskSuccess.apply(setMetadataEntry.getHref()),
|
||||
String.format(TASK_COMPLETE_TIMELY, "setMetadataEntry"));
|
||||
metadataValue = mediaClient.getMetadataValue(mediaRef, "key");
|
||||
|
||||
|
@ -280,12 +281,12 @@ public class MediaClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
|||
testWhenResponseIs2xxLoginReturnsValidMetadataValue();
|
||||
}
|
||||
|
||||
@Test(testName = "DELETE /media/{id}/metadata/{key}",
|
||||
@Test(testName = "DELETE /media/{id}/metadata/{key}",
|
||||
dependsOnMethods = { "testWhenResponseIs2xxLoginUpdatesMetadataEntry" } )
|
||||
public void testWhenResponseIs2xxLoginDeletesMetadataEntry() {
|
||||
Task deleteMetadataEntry = mediaClient.deleteMetadataEntry(mediaRef, "testKey");
|
||||
Checks.checkTask(deleteMetadataEntry);
|
||||
assertTrue(taskTester.apply(deleteMetadataEntry.getHref()),
|
||||
assertTrue(retryTaskSuccess.apply(deleteMetadataEntry.getHref()),
|
||||
String.format(TASK_COMPLETE_TIMELY, "deleteMetadataEntry"));
|
||||
|
||||
Error expected = Error.builder()
|
||||
|
@ -305,8 +306,8 @@ public class MediaClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
|||
}
|
||||
|
||||
if (metadataValue != null) { // guard against NPE on the .toStrings
|
||||
assertNull(metadataValue, String.format(OBJ_FIELD_ATTRB_DEL, MEDIA,
|
||||
"Metadata", metadataValue.toString(),
|
||||
assertNull(metadataValue, String.format(OBJ_FIELD_ATTRB_DEL, MEDIA,
|
||||
"Metadata", metadataValue.toString(),
|
||||
"metadataEntry", metadataValue.toString()));
|
||||
}
|
||||
|
||||
|
@ -314,18 +315,18 @@ public class MediaClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
|||
testWhenResponseIs2xxLoginReturnsValidMetadata();
|
||||
testWhenResponseIs2xxLoginReturnsValidMedia();
|
||||
}
|
||||
@Test(testName = "DELETE /media/{id}",
|
||||
@Test(testName = "DELETE /media/{id}",
|
||||
dependsOnMethods = { "testWhenResponseIs2xxLoginDeletesMetadataEntry" } )
|
||||
public void testWhenResponseIs2xxLoginDeletesMedia() {
|
||||
|
||||
Task deleteMedia = mediaClient.deleteMedia(mediaRef);
|
||||
Checks.checkTask(deleteMedia);
|
||||
assertTrue(taskTester.apply(deleteMedia.getHref()),
|
||||
assertTrue(retryTaskSuccess.apply(deleteMedia.getHref()),
|
||||
String.format(TASK_COMPLETE_TIMELY, "deleteMedia"));
|
||||
|
||||
Error expected = Error.builder()
|
||||
.message(String.format(
|
||||
"No access to entity \"(com.vmware.vcloud.entity.media:%s)\".",
|
||||
"No access to entity \"(com.vmware.vcloud.entity.media:%s)\".",
|
||||
mediaRef.getId()))
|
||||
.majorErrorCode(403)
|
||||
.minorErrorCode("ACCESS_TO_RESOURCE_IS_FORBIDDEN")
|
||||
|
|
|
@ -48,7 +48,7 @@ import com.google.common.collect.ImmutableSet;
|
|||
*
|
||||
* @author danikov
|
||||
*/
|
||||
@Test(groups = "unit", singleThreaded = true, testName = "NetworkClientExpectTest")
|
||||
@Test(groups = { "unit", "user" }, singleThreaded = true, testName = "NetworkClientExpectTest")
|
||||
public class NetworkClientExpectTest extends BaseVCloudDirectorRestClientExpectTest {
|
||||
|
||||
@Test
|
||||
|
|
|
@ -40,17 +40,17 @@ import org.jclouds.vcloud.director.v1_5.domain.OrgNetwork;
|
|||
import org.jclouds.vcloud.director.v1_5.domain.Reference;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.ReferenceType;
|
||||
import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorClientLiveTest;
|
||||
import org.testng.annotations.BeforeGroups;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.Iterables;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code NetworkClient}
|
||||
* Tests behavior of {@link NetworkClient}
|
||||
*
|
||||
* @author danikov
|
||||
*/
|
||||
@Test(groups = { "live", "apitests" }, testName = "NetworkClientLiveTest")
|
||||
@Test(groups = { "live", "api", "user" }, singleThreaded = true, testName = "NetworkClientLiveTest")
|
||||
public class NetworkClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
||||
|
||||
public static final String NETWORK = "network";
|
||||
|
@ -62,8 +62,9 @@ public class NetworkClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
|||
|
||||
private Reference networkRef;
|
||||
|
||||
@BeforeGroups(groups = { "live" }, dependsOnMethods = { "setupClient" })
|
||||
public void before() {
|
||||
@BeforeClass(inheritGroups = true)
|
||||
@Override
|
||||
public void setupRequiredClients() {
|
||||
String networkId = "a604f3c2-0343-453e-ae1f-cddac5b7bd94"; // TODO: inject
|
||||
networkRef = Reference.builder()
|
||||
.type("application/vnd.vmware.vcloud.orgNetwork+xml")
|
||||
|
@ -135,5 +136,4 @@ public class NetworkClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
|||
assertEquals(value, "value",
|
||||
String.format(OBJ_FIELD_EQ, NETWORK, "metadataEntry.value", "value", value));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -18,7 +18,8 @@
|
|||
*/
|
||||
package org.jclouds.vcloud.director.v1_5.features;
|
||||
|
||||
import static org.testng.Assert.*;
|
||||
import static org.testng.Assert.assertEquals;
|
||||
import static org.testng.Assert.fail;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
|
@ -29,6 +30,7 @@ import org.jclouds.vcloud.director.v1_5.domain.Error;
|
|||
import org.jclouds.vcloud.director.v1_5.domain.Link;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Metadata;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.MetadataEntry;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.MetadataValue;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Org;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.OrgList;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Reference;
|
||||
|
@ -43,7 +45,7 @@ import com.google.common.collect.Iterables;
|
|||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(groups = "unit", singleThreaded = true, testName = "OrgClientExpectTest")
|
||||
@Test(groups = { "unit", "user" }, singleThreaded = true, testName = "OrgClientExpectTest")
|
||||
public class OrgClientExpectTest extends BaseVCloudDirectorRestClientExpectTest {
|
||||
|
||||
@Test
|
||||
|
@ -197,18 +199,18 @@ public class OrgClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testGetOrgMetadataEntry() {
|
||||
public void testGetOrgMetadataValue() {
|
||||
URI orgUri = URI.create("https://vcloudbeta.bluelock.com/api/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0");
|
||||
|
||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
||||
getStandardRequest("GET", "/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/metadata/KEY"),
|
||||
getStandardPayloadResponse("/org/orgMetadataEntry.xml", VCloudDirectorMediaType.METADATA_ENTRY));
|
||||
getStandardPayloadResponse("/org/orgMetadataValue.xml", VCloudDirectorMediaType.METADATA_VALUE));
|
||||
|
||||
MetadataEntry expected = metadataEntry();
|
||||
MetadataValue expected = metadataValue();
|
||||
|
||||
Reference orgRef = Reference.builder().href(orgUri).build();
|
||||
|
||||
assertEquals(client.getOrgClient().getOrgMetadataEntry(orgRef, "KEY"), expected);
|
||||
assertEquals(client.getOrgClient().getOrgMetadataValue(orgRef, "KEY"), expected);
|
||||
}
|
||||
|
||||
public static Org org() {
|
||||
|
@ -263,13 +265,25 @@ public class OrgClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
|
|||
|
||||
public static MetadataEntry metadataEntry() {
|
||||
return MetadataEntry.builder()
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/metadata/KEY"))
|
||||
.link(Link.builder()
|
||||
.rel("up")
|
||||
.type("application/vnd.vmware.vcloud.metadata+xml")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/metadata"))
|
||||
.build())
|
||||
.entry("KEY", "VALUE")
|
||||
.build();
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/metadata/KEY"))
|
||||
.link(Link.builder()
|
||||
.rel("up")
|
||||
.type("application/vnd.vmware.vcloud.metadata+xml")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/metadata"))
|
||||
.build())
|
||||
.entry("KEY", "VALUE")
|
||||
.build();
|
||||
}
|
||||
|
||||
public static MetadataValue metadataValue() {
|
||||
return MetadataValue.builder()
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/metadata/KEY"))
|
||||
.link(Link.builder()
|
||||
.rel("up")
|
||||
.type("application/vnd.vmware.vcloud.metadata+xml")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/metadata"))
|
||||
.build())
|
||||
.value("VALUE")
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,17 +18,24 @@
|
|||
*/
|
||||
package org.jclouds.vcloud.director.v1_5.features;
|
||||
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.*;
|
||||
import static org.jclouds.vcloud.director.v1_5.domain.Checks.*;
|
||||
import static org.testng.Assert.*;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.CONDITION_FMT;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.CORRECT_VALUE_OBJECT_FMT;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.NOT_EMPTY_OBJECT_FMT;
|
||||
import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkMetadata;
|
||||
import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkMetadataValue;
|
||||
import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkOrg;
|
||||
import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkReferenceType;
|
||||
import static org.testng.Assert.assertEquals;
|
||||
import static org.testng.Assert.assertFalse;
|
||||
|
||||
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Metadata;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.MetadataEntry;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.MetadataValue;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Org;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.OrgList;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Reference;
|
||||
import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorClientLiveTest;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.Iterables;
|
||||
|
@ -38,14 +45,20 @@ import com.google.common.collect.Iterables;
|
|||
*
|
||||
* @author grkvlt@apache.org
|
||||
*/
|
||||
@Test(groups = { "live", "apitests" }, testName = "OrgClientLiveTest")
|
||||
@Test(groups = { "live", "api", "user" }, singleThreaded = true, testName = "OrgClientLiveTest")
|
||||
public class OrgClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
||||
|
||||
/*
|
||||
* Convenience references to API clients.
|
||||
*/
|
||||
|
||||
private final OrgClient orgClient = context.getApi().getOrgClient();
|
||||
private OrgClient orgClient;
|
||||
|
||||
@BeforeClass(inheritGroups = true)
|
||||
@Override
|
||||
public void setupRequiredClients() {
|
||||
orgClient = context.getApi().getOrgClient();
|
||||
}
|
||||
|
||||
/*
|
||||
* Shared state between dependant tests.
|
||||
|
@ -62,11 +75,11 @@ public class OrgClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
|||
|
||||
// NOTE The environment MUST have at least one organisation configured
|
||||
|
||||
// Check required elements and attributes
|
||||
assertFalse(Iterables.isEmpty(orgList.getOrgs()), "There must always be Org elements in the OrgList");
|
||||
// Check test requirements
|
||||
assertFalse(Iterables.isEmpty(orgList.getOrgs()), String.format(NOT_EMPTY_OBJECT_FMT, "Org", "OrgList"));
|
||||
|
||||
for (Reference orgRef : orgList.getOrgs()) {
|
||||
assertEquals(orgRef.getType(), VCloudDirectorMediaType.ORG, "The Refernce must be to an Org type");
|
||||
assertEquals(orgRef.getType(), VCloudDirectorMediaType.ORG, String.format(CONDITION_FMT, "Reference.Type", VCloudDirectorMediaType.ORG, orgRef.getType()));
|
||||
checkReferenceType(orgRef);
|
||||
}
|
||||
}
|
||||
|
@ -78,11 +91,7 @@ public class OrgClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
|||
// Call the method being tested
|
||||
org = orgClient.getOrg(orgRef);
|
||||
|
||||
// Check required elements and attributes
|
||||
assertNotNull(org.getFullName(), String.format(FIELD_NOT_NULL_FMT, "FullName", "Org"));
|
||||
|
||||
// Check parent type
|
||||
checkEntityType(org);
|
||||
checkOrg(org);
|
||||
}
|
||||
|
||||
@Test(testName = "GET /org/{id}/metadata/", dependsOnMethods = { "testGetOrg" })
|
||||
|
@ -92,36 +101,22 @@ public class OrgClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
|||
|
||||
// NOTE The environment MUST have at one metadata entry for the first organisation configured
|
||||
|
||||
// Check required elements and attributes
|
||||
assertFalse(Iterables.isEmpty(metadata.getMetadataEntries()), "There must always be MetadataEntry elements in the Org");
|
||||
checkMetadata(metadata);
|
||||
|
||||
// Check parent type
|
||||
checkResourceType(metadata);
|
||||
|
||||
for (MetadataEntry entry : metadata.getMetadataEntries()) {
|
||||
// Check required elements and attributes
|
||||
assertNotNull(entry.getKey(), String.format(FIELD_NOT_NULL_FMT, "Key", "MetadataEntry"));
|
||||
assertNotNull(entry.getValue(), String.format(FIELD_NOT_NULL_FMT, "Value", "MetadataEntry"));
|
||||
|
||||
// Check parent type
|
||||
checkResourceType(entry);
|
||||
}
|
||||
// Check requirements for this test
|
||||
assertFalse(Iterables.isEmpty(metadata.getMetadataEntries()), String.format(NOT_EMPTY_OBJECT_FMT, "MetadataEntry", "Org"));
|
||||
}
|
||||
|
||||
@Test(testName = "GET /org/{id}/metadata/{key}", dependsOnMethods = { "testGetOrgMetadata" })
|
||||
public void testGetOrgMetadataEntry() {
|
||||
public void testGetOrgMetadataValue() {
|
||||
// Call the method being tested
|
||||
MetadataEntry entry = orgClient.getOrgMetadataEntry(orgRef, "KEY");
|
||||
MetadataValue value = orgClient.getOrgMetadataValue(orgRef, "KEY");
|
||||
|
||||
// NOTE The environment MUST have configured the metadata entry as '{ key="KEY", value="VALUE" )'
|
||||
|
||||
// Check required elements and attributes
|
||||
assertNotNull(entry.getKey(), String.format(FIELD_NOT_NULL_FMT, "Key", "MetadataEntry"));
|
||||
assertEquals(entry.getKey(), "KEY", "The Key field must have the value \"KEY\"");
|
||||
assertNotNull(entry.getValue(), String.format(FIELD_NOT_NULL_FMT, "Value", "MetadataEntry"));
|
||||
assertEquals(entry.getValue(), "VALUE", "The Value field must have the value \"VALUE\"");
|
||||
|
||||
// Check parent type
|
||||
checkResourceType(entry);
|
||||
String expected = "VALUE";
|
||||
|
||||
checkMetadataValue(value);
|
||||
assertEquals(value.getValue(), expected, String.format(CORRECT_VALUE_OBJECT_FMT, "Value", "MetadataValue", expected, value.getValue()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,187 @@
|
|||
/*
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.vcloud.director.v1_5.features;
|
||||
|
||||
import static org.testng.Assert.assertEquals;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.HttpResponse;
|
||||
import org.jclouds.vcloud.director.v1_5.VCloudDirectorClient;
|
||||
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.CatalogReference;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Link;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.query.CatalogReferences;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.query.QueryResultCatalogRecord;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.query.QueryResultRecords;
|
||||
import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorRestClientExpectTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.ImmutableMultimap;
|
||||
|
||||
/**
|
||||
* Test the {@link TaskClient} by observing its side effects.
|
||||
*
|
||||
* @author grkvlt@apache.org
|
||||
*/
|
||||
@Test(groups = { "unit", "user" }, singleThreaded = true, testName = "QueryClientExpectTest")
|
||||
public class QueryClientExpectTest extends BaseVCloudDirectorRestClientExpectTest {
|
||||
|
||||
@Test
|
||||
public void testQueryAllCatalogs() {
|
||||
HttpRequest queryRequest = HttpRequest.builder()
|
||||
.method("GET")
|
||||
.endpoint(URI.create(endpoint + "/catalogs/query"))
|
||||
.headers(ImmutableMultimap.<String, String> builder()
|
||||
.put("Accept", "*/*")
|
||||
.put("x-vcloud-authorization", token)
|
||||
.build())
|
||||
.build();
|
||||
|
||||
HttpResponse queryResponse= HttpResponse.builder()
|
||||
.statusCode(200)
|
||||
.payload(payloadFromResourceWithContentType("/query/allCatalogs.xml", VCloudDirectorMediaType.QUERY_RESULT_RECORDS + ";version=1.5"))
|
||||
.build();
|
||||
|
||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, queryRequest, queryResponse);
|
||||
|
||||
QueryResultRecords<QueryResultCatalogRecord> expected = QueryResultRecords.<QueryResultCatalogRecord>builder()
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/catalogs/query?page=1&pageSize=25&format=records"))
|
||||
.type("application/vnd.vmware.vcloud.query.records+xml")
|
||||
.name("catalog")
|
||||
.page(1)
|
||||
.pageSize(25)
|
||||
.total(3L)
|
||||
.link(Link.builder()
|
||||
.rel("alternate")
|
||||
.type("application/vnd.vmware.vcloud.query.references+xml")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/catalogs/query?page=1&pageSize=25&format=references"))
|
||||
.build())
|
||||
.link(Link.builder()
|
||||
.rel("alternate")
|
||||
.type("application/vnd.vmware.vcloud.query.idrecords+xml")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/catalogs/query?page=1&pageSize=25&format=idrecords"))
|
||||
.build())
|
||||
.record(QueryResultCatalogRecord.builder()
|
||||
.ownerName("qunying.huang@enstratus.com")
|
||||
.owner(URI.create("https://vcloudbeta.bluelock.com/api/admin/user/967d317c-4273-4a95-b8a4-bf63b78e9c69"))
|
||||
.orgName("JClouds")
|
||||
.numberOfVAppTemplates(0)
|
||||
.numberOfMedia(0)
|
||||
.name("QunyingTestCatalog")
|
||||
.shared()
|
||||
.notPublished()
|
||||
.creationDate(dateService.iso8601DateParse("2012-02-07T00:16:28.323-05:00"))
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4"))
|
||||
.build())
|
||||
.record(QueryResultCatalogRecord.builder()
|
||||
.ownerName("system")
|
||||
.owner(URI.create("https://vcloudbeta.bluelock.com/api/admin/user/0ebf2453-5e95-48ab-b223-02671965ee91"))
|
||||
.orgName("Bluelock")
|
||||
.numberOfVAppTemplates(0)
|
||||
.numberOfMedia(0)
|
||||
.name("Public")
|
||||
.notShared()
|
||||
.published()
|
||||
.creationDate(dateService.iso8601DateParse("2011-09-28T13:45:44.207-04:00"))
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/catalog/9e08c2f6-077a-42ce-bece-d5332e2ebb5c"))
|
||||
.build())
|
||||
.record(QueryResultCatalogRecord.builder()
|
||||
.ownerName("adk@cloudsoftcorp.com")
|
||||
.owner(URI.create("https://vcloudbeta.bluelock.com/api/admin/user/e9eb1b29-0404-4c5e-8ef7-e584acc51da9"))
|
||||
.orgName("JClouds")
|
||||
.numberOfVAppTemplates(0)
|
||||
.numberOfMedia(0)
|
||||
.name("test")
|
||||
.shared()
|
||||
.notPublished()
|
||||
.creationDate(dateService.iso8601DateParse("2012-02-09T12:32:17.723-05:00"))
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/catalog/b7289d54-4ca4-497f-9a93-2d4afc97e3da"))
|
||||
.build())
|
||||
.build();
|
||||
|
||||
assertEquals(client.getQueryClient().catalogsQueryAll(), expected);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testQueryAllCatalogReferences() {
|
||||
HttpRequest queryRequest = HttpRequest.builder()
|
||||
.method("GET")
|
||||
.endpoint(URI.create(endpoint + "/catalogs/query?format=references"))
|
||||
.headers(ImmutableMultimap.<String, String> builder()
|
||||
.put("Accept", "*/*")
|
||||
.put("x-vcloud-authorization", token)
|
||||
.build())
|
||||
.build();
|
||||
|
||||
HttpResponse queryResponse= HttpResponse.builder()
|
||||
.statusCode(200)
|
||||
.payload(payloadFromResourceWithContentType("/query/allCatalogReferences.xml", VCloudDirectorMediaType.QUERY_RESULT_RECORDS + ";version=1.5"))
|
||||
.build();
|
||||
|
||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, queryRequest, queryResponse);
|
||||
|
||||
CatalogReferences expected = CatalogReferences.builder()
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/catalogs/query?page=1&pageSize=25&format=references"))
|
||||
.type("application/vnd.vmware.vcloud.query.references+xml")
|
||||
.name("catalog")
|
||||
.page(1)
|
||||
.pageSize(25)
|
||||
.total(4L)
|
||||
.link(Link.builder()
|
||||
.rel("alternate")
|
||||
.type("application/vnd.vmware.vcloud.query.records+xml")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/catalogs/query?page=1&pageSize=25&format=records"))
|
||||
.build())
|
||||
.link(Link.builder()
|
||||
.rel("alternate")
|
||||
.type("application/vnd.vmware.vcloud.query.idrecords+xml")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/catalogs/query?page=1&pageSize=25&format=idrecords"))
|
||||
.build())
|
||||
.reference(CatalogReference.builder()
|
||||
.type("application/vnd.vmware.vcloud.catalog+xml")
|
||||
.name("QunyingTestCatalog")
|
||||
.id("urn:vcloud:catalog:7212e451-76e1-4631-b2de-ba1dfd8080e4")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4"))
|
||||
.build())
|
||||
.reference(CatalogReference.builder()
|
||||
.type("application/vnd.vmware.vcloud.catalog+xml")
|
||||
.name("Public")
|
||||
.id("urn:vcloud:catalog:9e08c2f6-077a-42ce-bece-d5332e2ebb5c")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/catalog/9e08c2f6-077a-42ce-bece-d5332e2ebb5c"))
|
||||
.build())
|
||||
.reference(CatalogReference.builder()
|
||||
.type("application/vnd.vmware.vcloud.catalog+xml")
|
||||
.name("dantest")
|
||||
.id("urn:vcloud:catalog:b542aff4-9f97-4f51-a126-4330fbf62f02")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/catalog/b542aff4-9f97-4f51-a126-4330fbf62f02"))
|
||||
.build())
|
||||
.reference(CatalogReference.builder()
|
||||
.type("application/vnd.vmware.vcloud.catalog+xml")
|
||||
.name("test")
|
||||
.id("urn:vcloud:catalog:b7289d54-4ca4-497f-9a93-2d4afc97e3da")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/catalog/b7289d54-4ca4-497f-9a93-2d4afc97e3da"))
|
||||
.build())
|
||||
.build();
|
||||
|
||||
assertEquals(client.getQueryClient().catalogReferencesQueryAll(), expected);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,70 @@
|
|||
/*
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.vcloud.director.v1_5.features;
|
||||
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.NOT_EMPTY_OBJECT_FMT;
|
||||
import static org.testng.Assert.assertFalse;
|
||||
|
||||
import org.jclouds.vcloud.director.v1_5.domain.query.CatalogReferences;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.query.QueryResultRecords;
|
||||
import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorClientLiveTest;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
* Tests live behavior of {@link QueryClient}.
|
||||
*
|
||||
* @author grkvlt@apache.org
|
||||
*/
|
||||
@Test(groups = { "live", "api", "user" }, singleThreaded = true, testName = "QueryClientLiveTest")
|
||||
public class QueryClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
||||
|
||||
/*
|
||||
* Convenience references to API clients.
|
||||
*/
|
||||
|
||||
private CatalogClient catalogClient;
|
||||
private QueryClient queryClient;
|
||||
|
||||
@BeforeClass(inheritGroups = true)
|
||||
@Override
|
||||
public void setupRequiredClients() {
|
||||
catalogClient = context.getApi().getCatalogClient();
|
||||
queryClient = context.getApi().getQueryClient();
|
||||
}
|
||||
|
||||
/*
|
||||
* Shared state between dependant tests.
|
||||
*/
|
||||
|
||||
private QueryResultRecords<?> catalogRecords;
|
||||
private CatalogReferences catalogReferences;
|
||||
|
||||
@Test(testName = "GET /catalogs/query")
|
||||
public void testQueryAllCatalogs() {
|
||||
catalogRecords = queryClient.catalogsQueryAll();
|
||||
assertFalse(catalogRecords.getRecords().isEmpty(), String.format(NOT_EMPTY_OBJECT_FMT, "CatalogRecord", "QueryResultRecords"));
|
||||
}
|
||||
|
||||
@Test(testName = "GET /catalogs/query?format=references", dependsOnMethods = { "testQueryAllCatalogs" })
|
||||
public void testQueryAllCatalogReferences() {
|
||||
catalogReferences = queryClient.catalogReferencesQueryAll();
|
||||
assertFalse(catalogReferences.getReferences().isEmpty(), String.format(NOT_EMPTY_OBJECT_FMT, "CatalogReference", "CatalogReferences"));
|
||||
}
|
||||
}
|
|
@ -18,7 +18,8 @@
|
|||
*/
|
||||
package org.jclouds.vcloud.director.v1_5.features;
|
||||
|
||||
import static org.testng.Assert.*;
|
||||
import static org.testng.Assert.assertEquals;
|
||||
import static org.testng.Assert.fail;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
|
@ -41,7 +42,7 @@ import com.google.common.collect.ImmutableMultimap;
|
|||
*
|
||||
* @author grkvlt@apache.org
|
||||
*/
|
||||
@Test(groups = "unit", singleThreaded = true, testName = "TaskClientExpectTest")
|
||||
@Test(groups = { "unit", "user" }, singleThreaded = true, testName = "TaskClientExpectTest")
|
||||
public class TaskClientExpectTest extends BaseVCloudDirectorRestClientExpectTest {
|
||||
|
||||
@Test
|
||||
|
|
|
@ -18,9 +18,9 @@
|
|||
*/
|
||||
package org.jclouds.vcloud.director.v1_5.features;
|
||||
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.*;
|
||||
import static org.jclouds.vcloud.director.v1_5.domain.Checks.*;
|
||||
import static org.testng.Assert.*;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.NOT_EMPTY_OBJECT_FMT;
|
||||
import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkTask;
|
||||
import static org.testng.Assert.assertFalse;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
|
@ -29,6 +29,7 @@ import org.jclouds.vcloud.director.v1_5.domain.Reference;
|
|||
import org.jclouds.vcloud.director.v1_5.domain.Task;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.TasksList;
|
||||
import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorClientLiveTest;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.Iterables;
|
||||
|
@ -38,15 +39,22 @@ import com.google.common.collect.Iterables;
|
|||
*
|
||||
* @author grkvlt@apache.org
|
||||
*/
|
||||
@Test(groups = { "live", "apitests" }, testName = "TaskClientLiveTest")
|
||||
@Test(groups = { "live", "api", "user" }, singleThreaded = true, testName = "TaskClientLiveTest")
|
||||
public class TaskClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
||||
|
||||
/*
|
||||
* Convenience references to API clients.
|
||||
*/
|
||||
|
||||
private final OrgClient orgClient = context.getApi().getOrgClient();
|
||||
private final TaskClient taskClient = context.getApi().getTaskClient();
|
||||
private OrgClient orgClient;
|
||||
private TaskClient taskClient;
|
||||
|
||||
@BeforeClass(inheritGroups = true)
|
||||
@Override
|
||||
public void setupRequiredClients() {
|
||||
orgClient = context.getApi().getOrgClient();
|
||||
taskClient = context.getApi().getTaskClient();
|
||||
}
|
||||
|
||||
/*
|
||||
* Shared state between dependant tests.
|
||||
|
@ -69,7 +77,7 @@ public class TaskClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
|||
// NOTE The environment MUST have ...
|
||||
|
||||
// Check required elements and attributes
|
||||
assertFalse(Iterables.isEmpty(taskList.getTasks()), "There must always be Task elements in the TaskList");
|
||||
assertFalse(Iterables.isEmpty(taskList.getTasks()), String.format(NOT_EMPTY_OBJECT_FMT, "Task", "TaskList"));
|
||||
|
||||
for (Task task : taskList.getTasks()) {
|
||||
checkTask(task);
|
||||
|
|
|
@ -31,7 +31,6 @@ import org.jclouds.http.HttpCommand;
|
|||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.HttpResponse;
|
||||
import org.jclouds.io.Payloads;
|
||||
import org.jclouds.vcloud.director.v1_5.handlers.VCloudDirectorErrorHandler;
|
||||
import org.jclouds.rest.AuthorizationException;
|
||||
import org.jclouds.rest.ResourceNotFoundException;
|
||||
import org.jclouds.util.Strings2;
|
||||
|
|
|
@ -18,19 +18,22 @@
|
|||
*/
|
||||
package org.jclouds.vcloud.director.v1_5.internal;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.jclouds.compute.BaseVersionedServiceLiveTest;
|
||||
import org.jclouds.logging.log4j.config.Log4JLoggingModule;
|
||||
import org.jclouds.predicates.RetryablePredicate;
|
||||
import org.jclouds.rest.RestContext;
|
||||
import org.jclouds.rest.RestContextFactory;
|
||||
import org.jclouds.sshj.config.SshjSshClientModule;
|
||||
import org.jclouds.vcloud.director.v1_5.VCloudDirectorAsyncClient;
|
||||
import org.jclouds.vcloud.director.v1_5.VCloudDirectorClient;
|
||||
import org.testng.annotations.AfterGroups;
|
||||
import org.testng.annotations.BeforeGroups;
|
||||
import org.jclouds.vcloud.director.v1_5.predicates.TaskSuccess;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.inject.Module;
|
||||
|
||||
|
@ -38,14 +41,14 @@ import com.google.inject.Module;
|
|||
* Tests behavior of {@link VCloudDirectorClient} and acts as parent for other client live tests.
|
||||
*
|
||||
* @author Adrian Cole
|
||||
* @author grkvlt@apache.org
|
||||
*/
|
||||
@Test(groups = "live")
|
||||
public class BaseVCloudDirectorClientLiveTest extends BaseVersionedServiceLiveTest {
|
||||
public BaseVCloudDirectorClientLiveTest() {
|
||||
public abstract class BaseVCloudDirectorClientLiveTest extends BaseVersionedServiceLiveTest {
|
||||
|
||||
protected BaseVCloudDirectorClientLiveTest() {
|
||||
provider = "vcloud-director";
|
||||
}
|
||||
|
||||
protected RestContext<VCloudDirectorClient, VCloudDirectorAsyncClient> context;
|
||||
|
||||
protected String catalogName;
|
||||
protected String mediaId;
|
||||
|
@ -54,27 +57,57 @@ public class BaseVCloudDirectorClientLiveTest extends BaseVersionedServiceLiveTe
|
|||
protected String vDCId;
|
||||
|
||||
@Override
|
||||
protected Properties setupProperties() {
|
||||
Properties overrides= super.setupProperties();
|
||||
if (catalogName != null)
|
||||
overrides.setProperty(provider + ".catalog-name", catalogName);
|
||||
if (mediaId != null)
|
||||
overrides.setProperty(provider + ".media-id", mediaId);
|
||||
if (vAppTemplateId != null)
|
||||
overrides.setProperty(provider + ".vapptemplate-id", vAppTemplateId);
|
||||
if (networkId != null)
|
||||
overrides.setProperty(provider + ".network-id", networkId);
|
||||
if (vDCId != null)
|
||||
overrides.setProperty(provider + ".vcd-id", vDCId);
|
||||
return overrides;
|
||||
}
|
||||
|
||||
@BeforeClass(inheritGroups = true)
|
||||
// NOTE Implement as required to populate xxxClient fields, or NOP
|
||||
public abstract void setupRequiredClients();
|
||||
|
||||
/** Injected by {@link #setupContext} */
|
||||
public Predicate<URI> retryTaskSuccess;
|
||||
|
||||
@Override
|
||||
@BeforeClass(groups = { "live" })
|
||||
protected void setupCredentials() {
|
||||
super.setupCredentials();
|
||||
catalogName = System.getProperty("test." + provider + ".catalog-name", "Public");
|
||||
|
||||
catalogName = System.getProperty("test." + provider + ".catalog-name");
|
||||
mediaId = System.getProperty("test." + provider + ".media-id");
|
||||
vAppTemplateId = System.getProperty("test." + provider + ".vapptemplate-id");
|
||||
networkId = System.getProperty("test." + provider + ".network-id");
|
||||
vDCId = System.getProperty("test." + provider + ".vdc-id");
|
||||
}
|
||||
|
||||
protected RestContext<VCloudDirectorClient, VCloudDirectorAsyncClient> context;
|
||||
|
||||
@BeforeGroups(groups = { "live" })
|
||||
public void setupClient() {
|
||||
|
||||
@BeforeClass(groups = { "live" })
|
||||
public void setupContext() {
|
||||
setupCredentials();
|
||||
Properties overrides = setupProperties();
|
||||
|
||||
context = new RestContextFactory().createContext(provider, identity, credential,
|
||||
ImmutableSet.<Module> of(new Log4JLoggingModule(), new SshjSshClientModule()), overrides);
|
||||
|
||||
TaskSuccess taskSuccess = context.utils().injector().getInstance(TaskSuccess.class);
|
||||
retryTaskSuccess = new RetryablePredicate<URI>(taskSuccess, 1000L);
|
||||
}
|
||||
|
||||
@AfterGroups(groups = "live")
|
||||
protected void tearDown() {
|
||||
if (context != null)
|
||||
context.close();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ import com.google.common.collect.ImmutableMultimap;
|
|||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(groups = "unit", testName = "SessionClientExpectTest")
|
||||
// only needed as SessionClient is not(Link.builder().registered in(Link.builder().rest.properties
|
||||
// only needed as SessionClient is not registered in rest.properties
|
||||
@RegisterContext(sync = SessionClient.class, async = SessionAsyncClient.class)
|
||||
public class SessionClientExpectTest extends BaseRestClientExpectTest<SessionClient> {
|
||||
public static final String user = "adrian@jclouds.org";
|
||||
|
|
|
@ -28,7 +28,7 @@ import java.net.URI;
|
|||
import java.util.Properties;
|
||||
|
||||
import org.jclouds.compute.BaseVersionedServiceLiveTest;
|
||||
import org.jclouds.logging.slf4j.config.SLF4JLoggingModule;
|
||||
import org.jclouds.logging.log4j.config.Log4JLoggingModule;
|
||||
import org.jclouds.rest.RestContext;
|
||||
import org.jclouds.rest.RestContextSpec;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.SessionWithToken;
|
||||
|
@ -61,7 +61,7 @@ public class SessionClientLiveTest extends BaseVersionedServiceLiveTest {
|
|||
apiVersion, buildVersion, "", identity, credential, SessionClient.class, SessionAsyncClient.class);
|
||||
|
||||
context = createContextBuilder(contextSpec, overrides).withModules(
|
||||
ImmutableSet.<Module> of(new SLF4JLoggingModule())).buildContext();
|
||||
ImmutableSet.<Module> of(new Log4JLoggingModule())).buildContext();
|
||||
|
||||
// session client isn't typically exposed to the user, as it is implicit
|
||||
client = context.utils().injector().getInstance(SessionClient.class);
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<MetadataEntry xmlns="http://www.vmware.com/vcloud/v1.5" href="https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df/metadata/KEY" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v1.5 http://vcloudbeta.bluelock.com/api/v1.5/schema/master.xsd">
|
||||
<MetadataValue xmlns="http://www.vmware.com/vcloud/v1.5" href="https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df/metadata/KEY" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v1.5 http://vcloudbeta.bluelock.com/api/v1.5/schema/master.xsd">
|
||||
<Link rel="up" type="application/vnd.vmware.vcloud.metadata+xml" href="https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df/metadata"/>
|
||||
<Key>KEY</Key>
|
||||
<Value>VALUE</Value>
|
||||
</MetadataEntry>
|
||||
</MetadataValue>
|
|
@ -1,6 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<MetadataEntry xmlns="http://www.vmware.com/vcloud/v1.5" href="https://vcloudbeta.bluelock.com/api/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4/metadata/KEY" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v1.5 http://vcloudbeta.bluelock.com/api/v1.5/schema/master.xsd">
|
||||
<MetadataValue xmlns="http://www.vmware.com/vcloud/v1.5" href="https://vcloudbeta.bluelock.com/api/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4/metadata/KEY" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v1.5 http://vcloudbeta.bluelock.com/api/v1.5/schema/master.xsd">
|
||||
<Link rel="up" type="application/vnd.vmware.vcloud.metadata+xml" href="https://vcloudbeta.bluelock.com/api/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4/metadata"/>
|
||||
<Key>KEY</Key>
|
||||
<Value>VALUE</Value>
|
||||
</MetadataEntry>
|
||||
</MetadataValue>
|
|
@ -1,6 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<MetadataEntry xmlns="http://www.vmware.com/vcloud/v1.5" href="https://vcloudbeta.bluelock.com/api/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/metadata/KEY" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v1.5 http://vcloudbeta.bluelock.com/api/v1.5/schema/master.xsd">
|
||||
<MetadataValue xmlns="http://www.vmware.com/vcloud/v1.5" href="https://vcloudbeta.bluelock.com/api/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/metadata/KEY" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v1.5 http://vcloudbeta.bluelock.com/api/v1.5/schema/master.xsd">
|
||||
<Link rel="up" type="application/vnd.vmware.vcloud.metadata+xml" href="https://vcloudbeta.bluelock.com/api/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/metadata"/>
|
||||
<Key>KEY</Key>
|
||||
<Value>VALUE</Value>
|
||||
</MetadataEntry>
|
||||
</MetadataValue>
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CatalogReferences xmlns="http://www.vmware.com/vcloud/v1.5" total="4" pageSize="25" page="1" name="catalog" type="application/vnd.vmware.vcloud.query.references+xml" href="https://vcloudbeta.bluelock.com/api/catalogs/query?page=1&pageSize=25&format=references" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v1.5 http://vcloudbeta.bluelock.com/api/v1.5/schema/master.xsd">
|
||||
<Link rel="alternate" type="application/vnd.vmware.vcloud.query.records+xml" href="https://vcloudbeta.bluelock.com/api/catalogs/query?page=1&pageSize=25&format=records"/>
|
||||
<Link rel="alternate" type="application/vnd.vmware.vcloud.query.idrecords+xml" href="https://vcloudbeta.bluelock.com/api/catalogs/query?page=1&pageSize=25&format=idrecords"/>
|
||||
<CatalogReference type="application/vnd.vmware.vcloud.catalog+xml" name="QunyingTestCatalog" id="urn:vcloud:catalog:7212e451-76e1-4631-b2de-ba1dfd8080e4" href="https://vcloudbeta.bluelock.com/api/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4"/>
|
||||
<CatalogReference type="application/vnd.vmware.vcloud.catalog+xml" name="Public" id="urn:vcloud:catalog:9e08c2f6-077a-42ce-bece-d5332e2ebb5c" href="https://vcloudbeta.bluelock.com/api/catalog/9e08c2f6-077a-42ce-bece-d5332e2ebb5c"/>
|
||||
<CatalogReference type="application/vnd.vmware.vcloud.catalog+xml" name="dantest" id="urn:vcloud:catalog:b542aff4-9f97-4f51-a126-4330fbf62f02" href="https://vcloudbeta.bluelock.com/api/catalog/b542aff4-9f97-4f51-a126-4330fbf62f02"/>
|
||||
<CatalogReference type="application/vnd.vmware.vcloud.catalog+xml" name="test" id="urn:vcloud:catalog:b7289d54-4ca4-497f-9a93-2d4afc97e3da" href="https://vcloudbeta.bluelock.com/api/catalog/b7289d54-4ca4-497f-9a93-2d4afc97e3da"/>
|
||||
</CatalogReferences>
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<QueryResultRecords xmlns="http://www.vmware.com/vcloud/v1.5" total="3" pageSize="25" page="1" name="catalog" type="application/vnd.vmware.vcloud.query.records+xml" href="https://vcloudbeta.bluelock.com/api/catalogs/query?page=1&pageSize=25&format=records" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v1.5 http://vcloudbeta.bluelock.com/api/v1.5/schema/master.xsd">
|
||||
<Link rel="alternate" type="application/vnd.vmware.vcloud.query.references+xml" href="https://vcloudbeta.bluelock.com/api/catalogs/query?page=1&pageSize=25&format=references"/>
|
||||
<Link rel="alternate" type="application/vnd.vmware.vcloud.query.idrecords+xml" href="https://vcloudbeta.bluelock.com/api/catalogs/query?page=1&pageSize=25&format=idrecords"/>
|
||||
<CatalogRecord ownerName="qunying.huang@enstratus.com" owner="https://vcloudbeta.bluelock.com/api/admin/user/967d317c-4273-4a95-b8a4-bf63b78e9c69" orgName="JClouds" numberOfVAppTemplates="0" numberOfMedia="0" name="QunyingTestCatalog" isShared="true" isPublished="false" creationDate="2012-02-07T00:16:28.323-05:00" href="https://vcloudbeta.bluelock.com/api/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4"/>
|
||||
<CatalogRecord ownerName="system" owner="https://vcloudbeta.bluelock.com/api/admin/user/0ebf2453-5e95-48ab-b223-02671965ee91" orgName="Bluelock" numberOfVAppTemplates="0" numberOfMedia="0" name="Public" isShared="false" isPublished="true" creationDate="2011-09-28T13:45:44.207-04:00" href="https://vcloudbeta.bluelock.com/api/catalog/9e08c2f6-077a-42ce-bece-d5332e2ebb5c"/>
|
||||
<CatalogRecord ownerName="adk@cloudsoftcorp.com" owner="https://vcloudbeta.bluelock.com/api/admin/user/e9eb1b29-0404-4c5e-8ef7-e584acc51da9" orgName="JClouds" numberOfVAppTemplates="0" numberOfMedia="0" name="test" isShared="true" isPublished="false" creationDate="2012-02-09T12:32:17.723-05:00" href="https://vcloudbeta.bluelock.com/api/catalog/b7289d54-4ca4-497f-9a93-2d4afc97e3da"/>
|
||||
</QueryResultRecords>
|
|
@ -0,0 +1,58 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<QueryList xmlns="http://www.vmware.com/vcloud/v1.5" type="application/vnd.vmware.vcloud.query.queryList+xml" href="https://vcloudbeta.bluelock.com/api/query" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v1.5 http://vcloudbeta.bluelock.com/api/v1.5/schema/master.xsd">
|
||||
<Link rel="down" type="application/vnd.vmware.vcloud.query.references+xml" name="organization" href="https://vcloudbeta.bluelock.com/api/query?type=organization&format=references"/>
|
||||
<Link rel="down" type="application/vnd.vmware.vcloud.query.records+xml" name="organization" href="https://vcloudbeta.bluelock.com/api/query?type=organization&format=records"/>
|
||||
<Link rel="down" type="application/vnd.vmware.vcloud.query.idrecords+xml" name="organization" href="https://vcloudbeta.bluelock.com/api/query?type=organization&format=idrecords"/>
|
||||
<Link rel="down" type="application/vnd.vmware.vcloud.query.references+xml" name="orgVdc" href="https://vcloudbeta.bluelock.com/api/query?type=orgVdc&format=references"/>
|
||||
<Link rel="down" type="application/vnd.vmware.vcloud.query.records+xml" name="orgVdc" href="https://vcloudbeta.bluelock.com/api/query?type=orgVdc&format=records"/>
|
||||
<Link rel="down" type="application/vnd.vmware.vcloud.query.idrecords+xml" name="orgVdc" href="https://vcloudbeta.bluelock.com/api/query?type=orgVdc&format=idrecords"/>
|
||||
<Link rel="down" type="application/vnd.vmware.vcloud.query.references+xml" name="media" href="https://vcloudbeta.bluelock.com/api/query?type=media&format=references"/>
|
||||
<Link rel="down" type="application/vnd.vmware.vcloud.query.records+xml" name="media" href="https://vcloudbeta.bluelock.com/api/query?type=media&format=records"/>
|
||||
<Link rel="down" type="application/vnd.vmware.vcloud.query.idrecords+xml" name="media" href="https://vcloudbeta.bluelock.com/api/query?type=media&format=idrecords"/>
|
||||
<Link rel="down" type="application/vnd.vmware.vcloud.query.references+xml" name="vAppTemplate" href="https://vcloudbeta.bluelock.com/api/query?type=vAppTemplate&format=references"/>
|
||||
<Link rel="down" type="application/vnd.vmware.vcloud.query.records+xml" name="vAppTemplate" href="https://vcloudbeta.bluelock.com/api/query?type=vAppTemplate&format=records"/>
|
||||
<Link rel="down" type="application/vnd.vmware.vcloud.query.idrecords+xml" name="vAppTemplate" href="https://vcloudbeta.bluelock.com/api/query?type=vAppTemplate&format=idrecords"/>
|
||||
<Link rel="down" type="application/vnd.vmware.vcloud.query.references+xml" name="vApp" href="https://vcloudbeta.bluelock.com/api/query?type=vApp&format=references"/>
|
||||
<Link rel="down" type="application/vnd.vmware.vcloud.query.records+xml" name="vApp" href="https://vcloudbeta.bluelock.com/api/query?type=vApp&format=records"/>
|
||||
<Link rel="down" type="application/vnd.vmware.vcloud.query.idrecords+xml" name="vApp" href="https://vcloudbeta.bluelock.com/api/query?type=vApp&format=idrecords"/>
|
||||
<Link rel="down" type="application/vnd.vmware.vcloud.query.references+xml" name="vm" href="https://vcloudbeta.bluelock.com/api/query?type=vm&format=references"/>
|
||||
<Link rel="down" type="application/vnd.vmware.vcloud.query.records+xml" name="vm" href="https://vcloudbeta.bluelock.com/api/query?type=vm&format=records"/>
|
||||
<Link rel="down" type="application/vnd.vmware.vcloud.query.idrecords+xml" name="vm" href="https://vcloudbeta.bluelock.com/api/query?type=vm&format=idrecords"/>
|
||||
<Link rel="down" type="application/vnd.vmware.vcloud.query.references+xml" name="orgNetwork" href="https://vcloudbeta.bluelock.com/api/query?type=orgNetwork&format=references"/>
|
||||
<Link rel="down" type="application/vnd.vmware.vcloud.query.records+xml" name="orgNetwork" href="https://vcloudbeta.bluelock.com/api/query?type=orgNetwork&format=records"/>
|
||||
<Link rel="down" type="application/vnd.vmware.vcloud.query.idrecords+xml" name="orgNetwork" href="https://vcloudbeta.bluelock.com/api/query?type=orgNetwork&format=idrecords"/>
|
||||
<Link rel="down" type="application/vnd.vmware.vcloud.query.references+xml" name="vAppNetwork" href="https://vcloudbeta.bluelock.com/api/query?type=vAppNetwork&format=references"/>
|
||||
<Link rel="down" type="application/vnd.vmware.vcloud.query.records+xml" name="vAppNetwork" href="https://vcloudbeta.bluelock.com/api/query?type=vAppNetwork&format=records"/>
|
||||
<Link rel="down" type="application/vnd.vmware.vcloud.query.idrecords+xml" name="vAppNetwork" href="https://vcloudbeta.bluelock.com/api/query?type=vAppNetwork&format=idrecords"/>
|
||||
<Link rel="down" type="application/vnd.vmware.vcloud.query.references+xml" name="catalog" href="https://vcloudbeta.bluelock.com/api/query?type=catalog&format=references"/>
|
||||
<Link rel="down" type="application/vnd.vmware.vcloud.query.records+xml" name="catalog" href="https://vcloudbeta.bluelock.com/api/query?type=catalog&format=records"/>
|
||||
<Link rel="down" type="application/vnd.vmware.vcloud.query.idrecords+xml" name="catalog" href="https://vcloudbeta.bluelock.com/api/query?type=catalog&format=idrecords"/>
|
||||
<Link rel="down" type="application/vnd.vmware.vcloud.query.references+xml" name="group" href="https://vcloudbeta.bluelock.com/api/query?type=group&format=references"/>
|
||||
<Link rel="down" type="application/vnd.vmware.vcloud.query.records+xml" name="group" href="https://vcloudbeta.bluelock.com/api/query?type=group&format=records"/>
|
||||
<Link rel="down" type="application/vnd.vmware.vcloud.query.idrecords+xml" name="group" href="https://vcloudbeta.bluelock.com/api/query?type=group&format=idrecords"/>
|
||||
<Link rel="down" type="application/vnd.vmware.vcloud.query.references+xml" name="user" href="https://vcloudbeta.bluelock.com/api/query?type=user&format=references"/>
|
||||
<Link rel="down" type="application/vnd.vmware.vcloud.query.records+xml" name="user" href="https://vcloudbeta.bluelock.com/api/query?type=user&format=records"/>
|
||||
<Link rel="down" type="application/vnd.vmware.vcloud.query.idrecords+xml" name="user" href="https://vcloudbeta.bluelock.com/api/query?type=user&format=idrecords"/>
|
||||
<Link rel="down" type="application/vnd.vmware.vcloud.query.references+xml" name="strandedUser" href="https://vcloudbeta.bluelock.com/api/query?type=strandedUser&format=references"/>
|
||||
<Link rel="down" type="application/vnd.vmware.vcloud.query.records+xml" name="strandedUser" href="https://vcloudbeta.bluelock.com/api/query?type=strandedUser&format=records"/>
|
||||
<Link rel="down" type="application/vnd.vmware.vcloud.query.idrecords+xml" name="strandedUser" href="https://vcloudbeta.bluelock.com/api/query?type=strandedUser&format=idrecords"/>
|
||||
<Link rel="down" type="application/vnd.vmware.vcloud.query.references+xml" name="role" href="https://vcloudbeta.bluelock.com/api/query?type=role&format=references"/>
|
||||
<Link rel="down" type="application/vnd.vmware.vcloud.query.records+xml" name="role" href="https://vcloudbeta.bluelock.com/api/query?type=role&format=records"/>
|
||||
<Link rel="down" type="application/vnd.vmware.vcloud.query.idrecords+xml" name="role" href="https://vcloudbeta.bluelock.com/api/query?type=role&format=idrecords"/>
|
||||
<Link rel="down" type="application/vnd.vmware.vcloud.query.records+xml" name="allocatedExternalAddress" href="https://vcloudbeta.bluelock.com/api/query?type=allocatedExternalAddress&format=records"/>
|
||||
<Link rel="down" type="application/vnd.vmware.vcloud.query.idrecords+xml" name="allocatedExternalAddress" href="https://vcloudbeta.bluelock.com/api/query?type=allocatedExternalAddress&format=idrecords"/>
|
||||
<Link rel="down" type="application/vnd.vmware.vcloud.query.records+xml" name="event" href="https://vcloudbeta.bluelock.com/api/query?type=event&format=records"/>
|
||||
<Link rel="down" type="application/vnd.vmware.vcloud.query.idrecords+xml" name="event" href="https://vcloudbeta.bluelock.com/api/query?type=event&format=idrecords"/>
|
||||
<Link rel="down" type="application/vnd.vmware.vcloud.query.references+xml" name="right" href="https://vcloudbeta.bluelock.com/api/query?type=right&format=references"/>
|
||||
<Link rel="down" type="application/vnd.vmware.vcloud.query.records+xml" name="right" href="https://vcloudbeta.bluelock.com/api/query?type=right&format=records"/>
|
||||
<Link rel="down" type="application/vnd.vmware.vcloud.query.idrecords+xml" name="right" href="https://vcloudbeta.bluelock.com/api/query?type=right&format=idrecords"/>
|
||||
<Link rel="down" type="application/vnd.vmware.vcloud.query.references+xml" name="vAppOrgNetworkRelation" href="https://vcloudbeta.bluelock.com/api/query?type=vAppOrgNetworkRelation&format=references"/>
|
||||
<Link rel="down" type="application/vnd.vmware.vcloud.query.records+xml" name="vAppOrgNetworkRelation" href="https://vcloudbeta.bluelock.com/api/query?type=vAppOrgNetworkRelation&format=records"/>
|
||||
<Link rel="down" type="application/vnd.vmware.vcloud.query.idrecords+xml" name="vAppOrgNetworkRelation" href="https://vcloudbeta.bluelock.com/api/query?type=vAppOrgNetworkRelation&format=idrecords"/>
|
||||
<Link rel="down" type="application/vnd.vmware.vcloud.query.references+xml" name="catalogItem" href="https://vcloudbeta.bluelock.com/api/query?type=catalogItem&format=references"/>
|
||||
<Link rel="down" type="application/vnd.vmware.vcloud.query.records+xml" name="catalogItem" href="https://vcloudbeta.bluelock.com/api/query?type=catalogItem&format=records"/>
|
||||
<Link rel="down" type="application/vnd.vmware.vcloud.query.idrecords+xml" name="catalogItem" href="https://vcloudbeta.bluelock.com/api/query?type=catalogItem&format=idrecords"/>
|
||||
<Link rel="down" type="application/vnd.vmware.vcloud.query.references+xml" name="task" href="https://vcloudbeta.bluelock.com/api/query?type=task&format=references"/>
|
||||
<Link rel="down" type="application/vnd.vmware.vcloud.query.records+xml" name="task" href="https://vcloudbeta.bluelock.com/api/query?type=task&format=records"/>
|
||||
<Link rel="down" type="application/vnd.vmware.vcloud.query.idrecords+xml" name="task" href="https://vcloudbeta.bluelock.com/api/query?type=task&format=idrecords"/>
|
||||
</QueryList>
|
Loading…
Reference in New Issue