mirror of https://github.com/apache/jclouds.git
JCLOUDS-166, JCLOUDS-167 - Removing async from vcloud and Terremark APIs/providers
This commit is contained in:
parent
5261f760b7
commit
a61ad06cbf
|
@ -19,14 +19,16 @@ package org.jclouds.vcloud;
|
|||
import java.io.Closeable;
|
||||
|
||||
import org.jclouds.rest.annotations.Delegate;
|
||||
import org.jclouds.vcloud.features.CatalogClient;
|
||||
import org.jclouds.vcloud.features.NetworkClient;
|
||||
import org.jclouds.vcloud.features.OrgClient;
|
||||
import org.jclouds.vcloud.features.TaskClient;
|
||||
import org.jclouds.vcloud.features.VAppClient;
|
||||
import org.jclouds.vcloud.features.VAppTemplateClient;
|
||||
import org.jclouds.vcloud.features.VDCClient;
|
||||
import org.jclouds.vcloud.features.VmClient;
|
||||
import org.jclouds.rest.annotations.RequestFilters;
|
||||
import org.jclouds.vcloud.features.CatalogApi;
|
||||
import org.jclouds.vcloud.features.NetworkApi;
|
||||
import org.jclouds.vcloud.features.OrgApi;
|
||||
import org.jclouds.vcloud.features.TaskApi;
|
||||
import org.jclouds.vcloud.features.VAppApi;
|
||||
import org.jclouds.vcloud.features.VAppTemplateApi;
|
||||
import org.jclouds.vcloud.features.VDCApi;
|
||||
import org.jclouds.vcloud.features.VmApi;
|
||||
import org.jclouds.vcloud.filters.AddVCloudAuthorizationAndCookieToRequest;
|
||||
|
||||
/**
|
||||
* Provides access to VCloud resources via their REST API.
|
||||
|
@ -35,54 +37,55 @@ import org.jclouds.vcloud.features.VmClient;
|
|||
* @see <a href="http://communities.vmware.com/community/developer/forums/vcloudapi" />
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
public interface VCloudClient extends Closeable {
|
||||
@RequestFilters(AddVCloudAuthorizationAndCookieToRequest.class)
|
||||
public interface VCloudApi extends Closeable {
|
||||
/**
|
||||
* Provides asynchronous access to VApp Template features.
|
||||
*
|
||||
*/
|
||||
@Delegate
|
||||
VAppTemplateClient getVAppTemplateClient();
|
||||
VAppTemplateApi getVAppTemplateClient();
|
||||
|
||||
/**
|
||||
* Provides synchronous access to VApp features.
|
||||
*/
|
||||
@Delegate
|
||||
VAppClient getVAppClient();
|
||||
VAppApi getVAppClient();
|
||||
|
||||
/**
|
||||
* Provides synchronous access to Vm features.
|
||||
*/
|
||||
@Delegate
|
||||
VmClient getVmClient();
|
||||
VmApi getVmClient();
|
||||
|
||||
/**
|
||||
* Provides synchronous access to Catalog features.
|
||||
*/
|
||||
@Delegate
|
||||
CatalogClient getCatalogClient();
|
||||
CatalogApi getCatalogClient();
|
||||
|
||||
/**
|
||||
* Provides synchronous access to Task features.
|
||||
*/
|
||||
@Delegate
|
||||
TaskClient getTaskClient();
|
||||
TaskApi getTaskClient();
|
||||
|
||||
/**
|
||||
* Provides synchronous access to VDC features.
|
||||
*/
|
||||
@Delegate
|
||||
VDCClient getVDCClient();
|
||||
VDCApi getVDCClient();
|
||||
|
||||
/**
|
||||
* Provides synchronous access to Network features.
|
||||
*/
|
||||
@Delegate
|
||||
NetworkClient getNetworkClient();
|
||||
NetworkApi getNetworkClient();
|
||||
|
||||
/**
|
||||
* Provides synchronous access to Org features.
|
||||
*/
|
||||
@Delegate
|
||||
OrgClient getOrgClient();
|
||||
OrgApi getOrgClient();
|
||||
|
||||
}
|
|
@ -29,13 +29,12 @@ import java.util.Properties;
|
|||
|
||||
import org.jclouds.apis.ApiMetadata;
|
||||
import org.jclouds.compute.ComputeServiceContext;
|
||||
import org.jclouds.rest.internal.BaseRestApiMetadata;
|
||||
import org.jclouds.rest.internal.BaseHttpApiMetadata;
|
||||
import org.jclouds.vcloud.compute.config.VCloudComputeServiceContextModule;
|
||||
import org.jclouds.vcloud.config.VCloudRestClientModule;
|
||||
import org.jclouds.vcloud.config.VCloudHttpApiModule;
|
||||
import org.jclouds.vcloud.domain.network.FenceMode;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.reflect.TypeToken;
|
||||
import com.google.inject.Module;
|
||||
|
||||
/**
|
||||
|
@ -43,17 +42,9 @@ import com.google.inject.Module;
|
|||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
public class VCloudApiMetadata extends BaseRestApiMetadata {
|
||||
public class VCloudApiMetadata extends BaseHttpApiMetadata<VCloudApi> {
|
||||
|
||||
|
||||
/**
|
||||
* @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(VCloudClient.class)} as
|
||||
* {@link VCloudAsyncClient} interface will be removed in jclouds 1.7.
|
||||
*/
|
||||
@Deprecated
|
||||
public static final TypeToken<org.jclouds.rest.RestContext<VCloudClient, VCloudAsyncClient>> CONTEXT_TOKEN = new TypeToken<org.jclouds.rest.RestContext<VCloudClient, VCloudAsyncClient>>() {
|
||||
private static final long serialVersionUID = 1L;
|
||||
};
|
||||
|
||||
@Override
|
||||
public Builder toBuilder() {
|
||||
return new Builder().fromApiMetadata(this);
|
||||
|
@ -68,7 +59,7 @@ public class VCloudApiMetadata extends BaseRestApiMetadata {
|
|||
}
|
||||
|
||||
public static Properties defaultProperties() {
|
||||
Properties properties = BaseRestApiMetadata.defaultProperties();
|
||||
Properties properties = BaseHttpApiMetadata.defaultProperties();
|
||||
properties.setProperty(PROPERTY_VCLOUD_VERSION_SCHEMA, "1");
|
||||
properties.setProperty(PROPERTY_VCLOUD_XML_NAMESPACE,
|
||||
String.format("http://www.vmware.com/vcloud/v${%s}", PROPERTY_VCLOUD_VERSION_SCHEMA));
|
||||
|
@ -87,11 +78,8 @@ public class VCloudApiMetadata extends BaseRestApiMetadata {
|
|||
return properties;
|
||||
}
|
||||
|
||||
public static class Builder extends BaseRestApiMetadata.Builder<Builder> {
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public static class Builder extends BaseHttpApiMetadata.Builder<VCloudApi, Builder> {
|
||||
protected Builder() {
|
||||
super(VCloudClient.class, VCloudAsyncClient.class);
|
||||
id("vcloud")
|
||||
.name("VCloud 1.0 API")
|
||||
.identityName("User at Organization (user@org)")
|
||||
|
@ -100,7 +88,7 @@ public class VCloudApiMetadata extends BaseRestApiMetadata {
|
|||
.version("1.0")
|
||||
.defaultProperties(VCloudApiMetadata.defaultProperties())
|
||||
.view(typeToken(ComputeServiceContext.class))
|
||||
.defaultModules(ImmutableSet.<Class<? extends Module>>of(VCloudRestClientModule.class, VCloudComputeServiceContextModule.class));
|
||||
.defaultModules(ImmutableSet.<Class<? extends Module>>of(VCloudHttpApiModule.class, VCloudComputeServiceContextModule.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,119 +0,0 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.jclouds.vcloud;
|
||||
|
||||
import java.io.Closeable;
|
||||
|
||||
import org.jclouds.rest.annotations.Delegate;
|
||||
import org.jclouds.rest.annotations.RequestFilters;
|
||||
import org.jclouds.vcloud.features.CatalogAsyncClient;
|
||||
import org.jclouds.vcloud.features.NetworkAsyncClient;
|
||||
import org.jclouds.vcloud.features.OrgAsyncClient;
|
||||
import org.jclouds.vcloud.features.TaskAsyncClient;
|
||||
import org.jclouds.vcloud.features.VAppAsyncClient;
|
||||
import org.jclouds.vcloud.features.VAppTemplateAsyncClient;
|
||||
import org.jclouds.vcloud.features.VDCAsyncClient;
|
||||
import org.jclouds.vcloud.features.VmAsyncClient;
|
||||
import org.jclouds.vcloud.filters.AddVCloudAuthorizationAndCookieToRequest;
|
||||
|
||||
/**
|
||||
* Provides access to VCloud resources via their REST API.
|
||||
* <p/>
|
||||
*
|
||||
* @see <a href= "https://community.vcloudexpress.terremark.com/en-us/discussion_forums/f/60.aspx"
|
||||
* />
|
||||
* @author Adrian Cole
|
||||
* @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(VCloudClient.class)} as
|
||||
* {@link VCloudAsyncClient} interface will be removed in jclouds 1.7.
|
||||
*/
|
||||
@Deprecated
|
||||
@RequestFilters(AddVCloudAuthorizationAndCookieToRequest.class)
|
||||
public interface VCloudAsyncClient extends Closeable {
|
||||
|
||||
/**
|
||||
* Provides asynchronous access to VApp Template features.
|
||||
*
|
||||
* @see VCloudClient#getVAppTemplateClient
|
||||
*
|
||||
*/
|
||||
@Delegate
|
||||
VAppTemplateAsyncClient getVAppTemplateClient();
|
||||
|
||||
/**
|
||||
* Provides asynchronous access to VApp features.
|
||||
*
|
||||
* @see VCloudClient#getVAppClient
|
||||
*
|
||||
*/
|
||||
@Delegate
|
||||
VAppAsyncClient getVAppClient();
|
||||
|
||||
/**
|
||||
* Provides asynchronous access to Vm features.
|
||||
*
|
||||
* @see VCloudClient#getVmClient
|
||||
*
|
||||
*/
|
||||
@Delegate
|
||||
VmAsyncClient getVmClient();
|
||||
|
||||
/**
|
||||
* Provides asynchronous access to Catalog features.
|
||||
*
|
||||
* @see VCloudClient#getCatalogClient
|
||||
*
|
||||
*/
|
||||
@Delegate
|
||||
CatalogAsyncClient getCatalogClient();
|
||||
|
||||
/**
|
||||
* Provides asynchronous access to Task features.
|
||||
*
|
||||
* @see VCloudClient#getTaskClient
|
||||
*
|
||||
*/
|
||||
@Delegate
|
||||
TaskAsyncClient getTaskClient();
|
||||
|
||||
/**
|
||||
* Provides asynchronous access to VDC features.
|
||||
*
|
||||
* @see VCloudClient#getVDCClient
|
||||
*
|
||||
*/
|
||||
@Delegate
|
||||
VDCAsyncClient getVDCClient();
|
||||
|
||||
/**
|
||||
* Provides asynchronous access to Network features.
|
||||
*
|
||||
* @see VCloudClient#getNetworkClient
|
||||
*
|
||||
*/
|
||||
@Delegate
|
||||
NetworkAsyncClient getNetworkClient();
|
||||
|
||||
/**
|
||||
* Provides asynchronous access to Org features.
|
||||
*
|
||||
* @see VCloudClient#getOrgClient
|
||||
*
|
||||
*/
|
||||
@Delegate
|
||||
OrgAsyncClient getOrgClient();
|
||||
|
||||
}
|
|
@ -19,7 +19,17 @@ package org.jclouds.vcloud;
|
|||
import java.io.Closeable;
|
||||
import java.net.URI;
|
||||
import java.util.SortedMap;
|
||||
public interface VCloudVersionsClient extends Closeable {
|
||||
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.Path;
|
||||
|
||||
import org.jclouds.rest.annotations.XMLResponseParser;
|
||||
import org.jclouds.vcloud.xml.SupportedVersionsHandler;
|
||||
|
||||
public interface VCloudVersionsApi extends Closeable {
|
||||
|
||||
@GET
|
||||
@XMLResponseParser(SupportedVersionsHandler.class)
|
||||
@Path("/versions")
|
||||
SortedMap<String, URI> getSupportedVersions();
|
||||
}
|
|
@ -1,47 +0,0 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.jclouds.vcloud;
|
||||
|
||||
import java.io.Closeable;
|
||||
import java.net.URI;
|
||||
import java.util.SortedMap;
|
||||
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.Path;
|
||||
|
||||
import org.jclouds.rest.annotations.XMLResponseParser;
|
||||
import org.jclouds.vcloud.xml.SupportedVersionsHandler;
|
||||
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
/**
|
||||
* Establishes a context with a VCloud endpoint.
|
||||
* <p/>
|
||||
*
|
||||
* @see <a href="https://community.vcloudexpress.terremark.com/en-us/discussion_forums/f/60.aspx" />
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
public interface VCloudVersionsAsyncClient extends Closeable {
|
||||
|
||||
/**
|
||||
* Retrieve information for supported versions
|
||||
*/
|
||||
@GET
|
||||
@XMLResponseParser(SupportedVersionsHandler.class)
|
||||
@Path("/versions")
|
||||
ListenableFuture<SortedMap<String, URI>> getSupportedVersions();
|
||||
}
|
|
@ -42,7 +42,7 @@ import org.jclouds.ovf.Network;
|
|||
import org.jclouds.predicates.validators.DnsNameValidator;
|
||||
import org.jclouds.rest.annotations.BuildVersion;
|
||||
import org.jclouds.vcloud.TaskStillRunningException;
|
||||
import org.jclouds.vcloud.VCloudClient;
|
||||
import org.jclouds.vcloud.VCloudApi;
|
||||
import org.jclouds.vcloud.compute.options.VCloudTemplateOptions;
|
||||
import org.jclouds.vcloud.domain.GuestCustomizationSection;
|
||||
import org.jclouds.vcloud.domain.NetworkConnection;
|
||||
|
@ -71,7 +71,7 @@ public class InstantiateVAppTemplateWithGroupEncodedIntoNameThenCustomizeDeployA
|
|||
@Named(ComputeServiceConstants.COMPUTE_LOGGER)
|
||||
protected Logger logger = Logger.NULL;
|
||||
|
||||
protected final VCloudClient client;
|
||||
protected final VCloudApi client;
|
||||
protected final Predicate<URI> successTester;
|
||||
protected final LoadingCache<URI, VAppTemplate> vAppTemplates;
|
||||
protected final NetworkConfigurationForNetworkAndOptions networkConfigurationForNetworkAndOptions;
|
||||
|
@ -79,7 +79,7 @@ public class InstantiateVAppTemplateWithGroupEncodedIntoNameThenCustomizeDeployA
|
|||
|
||||
|
||||
@Inject
|
||||
protected InstantiateVAppTemplateWithGroupEncodedIntoNameThenCustomizeDeployAndPowerOn(VCloudClient client,
|
||||
protected InstantiateVAppTemplateWithGroupEncodedIntoNameThenCustomizeDeployAndPowerOn(VCloudApi client,
|
||||
Predicate<URI> successTester, LoadingCache<URI, VAppTemplate> vAppTemplates, NetworkConfigurationForNetworkAndOptions networkConfigurationForNetworkAndOptions,
|
||||
@BuildVersion String buildVersion) {
|
||||
this.client = client;
|
||||
|
|
|
@ -38,7 +38,7 @@ import org.jclouds.ovf.Envelope;
|
|||
import org.jclouds.util.Throwables2;
|
||||
import org.jclouds.vcloud.TaskInErrorStateException;
|
||||
import org.jclouds.vcloud.TaskStillRunningException;
|
||||
import org.jclouds.vcloud.VCloudClient;
|
||||
import org.jclouds.vcloud.VCloudApi;
|
||||
import org.jclouds.vcloud.VCloudMediaType;
|
||||
import org.jclouds.vcloud.domain.Org;
|
||||
import org.jclouds.vcloud.domain.ReferenceType;
|
||||
|
@ -54,10 +54,9 @@ import com.google.common.base.Predicate;
|
|||
import com.google.common.base.Supplier;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.ImmutableSet.Builder;
|
||||
import com.google.common.collect.Iterables;
|
||||
|
||||
/**
|
||||
* defines the connection between the {@link VCloudClient} implementation and the jclouds
|
||||
* defines the connection between the {@link org.jclouds.vcloud.VCloudApi} implementation and the jclouds
|
||||
* {@link ComputeService}
|
||||
*
|
||||
*/
|
||||
|
@ -68,7 +67,7 @@ public class VCloudComputeServiceAdapter implements ComputeServiceAdapter<VApp,
|
|||
@Named(ComputeServiceConstants.COMPUTE_LOGGER)
|
||||
protected Logger logger = Logger.NULL;
|
||||
|
||||
protected final VCloudClient client;
|
||||
protected final VCloudApi client;
|
||||
protected final Predicate<URI> successTester;
|
||||
protected final InstantiateVAppTemplateWithGroupEncodedIntoNameThenCustomizeDeployAndPowerOn booter;
|
||||
protected final Supplier<Map<String, Org>> nameToOrg;
|
||||
|
@ -76,7 +75,7 @@ public class VCloudComputeServiceAdapter implements ComputeServiceAdapter<VApp,
|
|||
protected final Function<VAppTemplate, Envelope> templateToEnvelope;
|
||||
|
||||
@Inject
|
||||
protected VCloudComputeServiceAdapter(VCloudClient client, Predicate<URI> successTester,
|
||||
protected VCloudComputeServiceAdapter(VCloudApi client, Predicate<URI> successTester,
|
||||
InstantiateVAppTemplateWithGroupEncodedIntoNameThenCustomizeDeployAndPowerOn booter,
|
||||
Supplier<Map<String, Org>> nameToOrg, VAppTemplatesSupplier templates,
|
||||
Function<VAppTemplate, Envelope> templateToEnvelope) {
|
||||
|
|
|
@ -26,7 +26,7 @@ import static com.google.common.collect.Iterables.transform;
|
|||
import static com.google.common.collect.Maps.transformValues;
|
||||
import static com.google.common.collect.Maps.uniqueIndex;
|
||||
import static org.jclouds.Constants.PROPERTY_SESSION_INTERVAL;
|
||||
import static org.jclouds.rest.config.BinderUtils.bindSyncToAsyncHttpApi;
|
||||
import static org.jclouds.rest.config.BinderUtils.bindHttpApi;
|
||||
import static org.jclouds.util.Predicates2.retry;
|
||||
import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_DEFAULT_FENCEMODE;
|
||||
import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_TIMEOUT_TASK_COMPLETED;
|
||||
|
@ -52,15 +52,13 @@ import org.jclouds.location.suppliers.ImplicitLocationSupplier;
|
|||
import org.jclouds.location.suppliers.LocationsSupplier;
|
||||
import org.jclouds.ovf.Envelope;
|
||||
import org.jclouds.rest.AuthorizationException;
|
||||
import org.jclouds.rest.ConfiguresRestClient;
|
||||
import org.jclouds.rest.ConfiguresHttpApi;
|
||||
import org.jclouds.rest.annotations.ApiVersion;
|
||||
import org.jclouds.rest.config.RestClientModule;
|
||||
import org.jclouds.rest.config.HttpApiModule;
|
||||
import org.jclouds.rest.suppliers.MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier;
|
||||
import org.jclouds.vcloud.VCloudAsyncClient;
|
||||
import org.jclouds.vcloud.VCloudClient;
|
||||
import org.jclouds.vcloud.VCloudApi;
|
||||
import org.jclouds.vcloud.VCloudToken;
|
||||
import org.jclouds.vcloud.VCloudVersionsAsyncClient;
|
||||
import org.jclouds.vcloud.VCloudVersionsClient;
|
||||
import org.jclouds.vcloud.VCloudVersionsApi;
|
||||
import org.jclouds.vcloud.compute.functions.FindLocationForResource;
|
||||
import org.jclouds.vcloud.compute.functions.ValidateVAppTemplateAndReturnEnvelopeOrThrowIllegalArgumentException;
|
||||
import org.jclouds.vcloud.domain.Catalog;
|
||||
|
@ -73,22 +71,6 @@ import org.jclouds.vcloud.domain.VDC;
|
|||
import org.jclouds.vcloud.domain.network.FenceMode;
|
||||
import org.jclouds.vcloud.endpoints.Network;
|
||||
import org.jclouds.vcloud.endpoints.OrgList;
|
||||
import org.jclouds.vcloud.features.CatalogAsyncClient;
|
||||
import org.jclouds.vcloud.features.CatalogClient;
|
||||
import org.jclouds.vcloud.features.NetworkAsyncClient;
|
||||
import org.jclouds.vcloud.features.NetworkClient;
|
||||
import org.jclouds.vcloud.features.OrgAsyncClient;
|
||||
import org.jclouds.vcloud.features.OrgClient;
|
||||
import org.jclouds.vcloud.features.TaskAsyncClient;
|
||||
import org.jclouds.vcloud.features.TaskClient;
|
||||
import org.jclouds.vcloud.features.VAppAsyncClient;
|
||||
import org.jclouds.vcloud.features.VAppClient;
|
||||
import org.jclouds.vcloud.features.VAppTemplateAsyncClient;
|
||||
import org.jclouds.vcloud.features.VAppTemplateClient;
|
||||
import org.jclouds.vcloud.features.VDCAsyncClient;
|
||||
import org.jclouds.vcloud.features.VDCClient;
|
||||
import org.jclouds.vcloud.features.VmAsyncClient;
|
||||
import org.jclouds.vcloud.features.VmClient;
|
||||
import org.jclouds.vcloud.functions.CatalogItemsInCatalog;
|
||||
import org.jclouds.vcloud.functions.CatalogItemsInOrg;
|
||||
import org.jclouds.vcloud.functions.CatalogsInOrg;
|
||||
|
@ -98,8 +80,7 @@ import org.jclouds.vcloud.functions.OrgsForNames;
|
|||
import org.jclouds.vcloud.functions.VAppTemplatesForCatalogItems;
|
||||
import org.jclouds.vcloud.functions.VDCsInOrg;
|
||||
import org.jclouds.vcloud.handlers.ParseVCloudErrorFromHttpResponse;
|
||||
import org.jclouds.vcloud.internal.VCloudLoginAsyncClient;
|
||||
import org.jclouds.vcloud.internal.VCloudLoginClient;
|
||||
import org.jclouds.vcloud.internal.VCloudLoginApi;
|
||||
import org.jclouds.vcloud.loaders.OVFLoader;
|
||||
import org.jclouds.vcloud.loaders.VAppTemplateLoader;
|
||||
import org.jclouds.vcloud.location.DefaultVDC;
|
||||
|
@ -128,28 +109,14 @@ import com.google.inject.TypeLiteral;
|
|||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@ConfiguresRestClient
|
||||
public class VCloudRestClientModule extends RestClientModule<VCloudClient, VCloudAsyncClient> {
|
||||
@ConfiguresHttpApi
|
||||
public class VCloudHttpApiModule extends HttpApiModule<VCloudApi> {
|
||||
|
||||
public static final Map<Class<?>, Class<?>> DELEGATE_MAP = ImmutableMap.<Class<?>, Class<?>> builder()//
|
||||
.put(VAppTemplateClient.class, VAppTemplateAsyncClient.class)//
|
||||
.put(VAppClient.class, VAppAsyncClient.class)//
|
||||
.put(VmClient.class, VmAsyncClient.class)//
|
||||
.put(CatalogClient.class, CatalogAsyncClient.class)//
|
||||
.put(TaskClient.class, TaskAsyncClient.class)//
|
||||
.put(VDCClient.class, VDCAsyncClient.class)//
|
||||
.put(NetworkClient.class, NetworkAsyncClient.class)//
|
||||
.put(OrgClient.class, OrgAsyncClient.class)//
|
||||
.build();
|
||||
|
||||
public VCloudRestClientModule() {
|
||||
super(DELEGATE_MAP);
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
protected Supplier<VCloudSession> provideVCloudTokenCache(@Named(PROPERTY_SESSION_INTERVAL) long seconds,
|
||||
AtomicReference<AuthorizationException> authException, final VCloudLoginClient login) {
|
||||
AtomicReference<AuthorizationException> authException, final VCloudLoginApi login) {
|
||||
return MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier.create(authException,
|
||||
new Supplier<VCloudSession>() {
|
||||
|
||||
|
@ -204,8 +171,9 @@ public class VCloudRestClientModule extends RestClientModule<VCloudClient, VClou
|
|||
bind(new TypeLiteral<Function<VAppTemplate, Envelope>>() {
|
||||
}).to(new TypeLiteral<ValidateVAppTemplateAndReturnEnvelopeOrThrowIllegalArgumentException>() {
|
||||
});
|
||||
bindSyncToAsyncHttpApi(binder(), VCloudVersionsClient.class, VCloudVersionsAsyncClient.class);
|
||||
bindSyncToAsyncHttpApi(binder(), VCloudLoginClient.class, VCloudLoginAsyncClient.class);
|
||||
bindHttpApi(binder(), VCloudApi.class);
|
||||
bindHttpApi(binder(), VCloudVersionsApi.class);
|
||||
bindHttpApi(binder(), VCloudLoginApi.class);
|
||||
}
|
||||
|
||||
protected void bindCacheLoaders() {
|
||||
|
@ -389,7 +357,7 @@ public class VCloudRestClientModule extends RestClientModule<VCloudClient, VClou
|
|||
@Provides
|
||||
@Singleton
|
||||
@org.jclouds.vcloud.endpoints.VCloudLogin
|
||||
protected Supplier<URI> provideAuthenticationURI(final VCloudVersionsClient versionService,
|
||||
protected Supplier<URI> provideAuthenticationURI(final VCloudVersionsApi versionService,
|
||||
@ApiVersion final String version) {
|
||||
return new Supplier<URI>() {
|
||||
|
|
@ -0,0 +1,145 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.jclouds.vcloud.features;
|
||||
|
||||
import static org.jclouds.vcloud.VCloudMediaType.CATALOGITEM_XML;
|
||||
import static org.jclouds.vcloud.VCloudMediaType.CATALOG_XML;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.DELETE;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.POST;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.Produces;
|
||||
|
||||
import org.jclouds.Fallbacks;
|
||||
import org.jclouds.javax.annotation.Nullable;
|
||||
import org.jclouds.rest.annotations.EndpointParam;
|
||||
import org.jclouds.rest.annotations.Fallback;
|
||||
import org.jclouds.rest.annotations.MapBinder;
|
||||
import org.jclouds.rest.annotations.PayloadParam;
|
||||
import org.jclouds.rest.annotations.RequestFilters;
|
||||
import org.jclouds.rest.annotations.XMLResponseParser;
|
||||
import org.jclouds.vcloud.binders.BindCatalogItemToXmlPayload;
|
||||
import org.jclouds.vcloud.binders.OrgNameAndCatalogNameToEndpoint;
|
||||
import org.jclouds.vcloud.binders.OrgNameCatalogNameItemNameToEndpoint;
|
||||
import org.jclouds.vcloud.domain.Catalog;
|
||||
import org.jclouds.vcloud.domain.CatalogItem;
|
||||
import org.jclouds.vcloud.filters.AddVCloudAuthorizationAndCookieToRequest;
|
||||
import org.jclouds.vcloud.options.CatalogItemOptions;
|
||||
import org.jclouds.vcloud.xml.CatalogHandler;
|
||||
import org.jclouds.vcloud.xml.CatalogItemHandler;
|
||||
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
/**
|
||||
* Provides access to Catalog functionality in vCloud
|
||||
* <p/>
|
||||
*
|
||||
* @see <a href="http://communities.vmware.com/community/developer/forums/vcloudapi" />
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@RequestFilters(AddVCloudAuthorizationAndCookieToRequest.class)
|
||||
public interface CatalogApi {
|
||||
|
||||
@GET
|
||||
@XMLResponseParser(CatalogHandler.class)
|
||||
@Fallback(Fallbacks.NullOnNotFoundOr404.class)
|
||||
@Consumes(CATALOG_XML)
|
||||
Catalog getCatalog(@EndpointParam URI catalogId);
|
||||
|
||||
/**
|
||||
* returns the catalog in the organization associated with the specified name. Note that both
|
||||
* parameters can be null to choose default.
|
||||
*
|
||||
* @param orgName
|
||||
* organization name, or null for the default
|
||||
* @param catalogName
|
||||
* catalog name, or null for the default
|
||||
* @throws NoSuchElementException
|
||||
* if you specified an org or catalog name that isn't present
|
||||
*/
|
||||
@GET
|
||||
@XMLResponseParser(CatalogHandler.class)
|
||||
@Fallback(Fallbacks.NullOnNotFoundOr404.class)
|
||||
@Consumes(CATALOG_XML)
|
||||
@MapBinder(OrgNameAndCatalogNameToEndpoint.class)
|
||||
Catalog findCatalogInOrgNamed(@Nullable @PayloadParam("orgName") String orgName,
|
||||
@Nullable @PayloadParam("catalogName") String catalogName);
|
||||
|
||||
@GET
|
||||
@Consumes(CATALOGITEM_XML)
|
||||
@XMLResponseParser(CatalogItemHandler.class)
|
||||
@Fallback(Fallbacks.NullOnNotFoundOr404.class)
|
||||
CatalogItem getCatalogItem(@EndpointParam URI catalogItem);
|
||||
|
||||
/**
|
||||
* returns the catalog item in the catalog associated with the specified name. Note that the org
|
||||
* and catalog parameters can be null to choose default.
|
||||
*
|
||||
* @param orgName
|
||||
* organization name, or null for the default
|
||||
* @param catalogName
|
||||
* catalog name, or null for the default
|
||||
* @param itemName
|
||||
* item you wish to lookup
|
||||
*
|
||||
* @throws NoSuchElementException
|
||||
* if you specified an org, catalog, or catalog item name that isn't present
|
||||
*/
|
||||
@GET
|
||||
@Consumes(CATALOGITEM_XML)
|
||||
@XMLResponseParser(CatalogItemHandler.class)
|
||||
@Fallback(Fallbacks.NullOnNotFoundOr404.class)
|
||||
@MapBinder(OrgNameCatalogNameItemNameToEndpoint.class)
|
||||
CatalogItem findCatalogItemInOrgCatalogNamed(@Nullable @PayloadParam("orgName") String orgName,
|
||||
@Nullable @PayloadParam("catalogName") String catalogName,
|
||||
@PayloadParam("itemName") String itemName);
|
||||
|
||||
/**
|
||||
* A catalog can contain references to vApp templates and media images that have been uploaded to
|
||||
* any vDC in an organization. A vApp template or media image can be listed in at most one
|
||||
* catalog.
|
||||
*
|
||||
* @param entity
|
||||
* the reference to the vApp templates and media image
|
||||
* @param catalog
|
||||
* URI of the catalog to add the resourceEntity from
|
||||
* @param name
|
||||
* name of the entry in the catalog
|
||||
*
|
||||
* @param options
|
||||
* options such as description or properties
|
||||
* @return the new catalog item
|
||||
*/
|
||||
@POST
|
||||
@Path("/catalogItems")
|
||||
@Consumes(CATALOGITEM_XML)
|
||||
@Produces(CATALOGITEM_XML)
|
||||
@MapBinder(BindCatalogItemToXmlPayload.class)
|
||||
@XMLResponseParser(CatalogItemHandler.class)
|
||||
CatalogItem addVAppTemplateOrMediaImageToCatalogAndNameItem(@PayloadParam("Entity") URI entity,
|
||||
@EndpointParam URI catalog,
|
||||
@PayloadParam("name") String name,
|
||||
CatalogItemOptions... options);
|
||||
|
||||
@DELETE
|
||||
@Fallback(Fallbacks.VoidOnNotFoundOr404.class)
|
||||
void deleteCatalogItem(@EndpointParam URI href);
|
||||
}
|
|
@ -1,121 +0,0 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.jclouds.vcloud.features;
|
||||
|
||||
import static org.jclouds.vcloud.VCloudMediaType.CATALOGITEM_XML;
|
||||
import static org.jclouds.vcloud.VCloudMediaType.CATALOG_XML;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.DELETE;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.POST;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.Produces;
|
||||
|
||||
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
|
||||
import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
|
||||
import org.jclouds.javax.annotation.Nullable;
|
||||
import org.jclouds.rest.annotations.EndpointParam;
|
||||
import org.jclouds.rest.annotations.Fallback;
|
||||
import org.jclouds.rest.annotations.MapBinder;
|
||||
import org.jclouds.rest.annotations.PayloadParam;
|
||||
import org.jclouds.rest.annotations.RequestFilters;
|
||||
import org.jclouds.rest.annotations.XMLResponseParser;
|
||||
import org.jclouds.vcloud.binders.BindCatalogItemToXmlPayload;
|
||||
import org.jclouds.vcloud.binders.OrgNameAndCatalogNameToEndpoint;
|
||||
import org.jclouds.vcloud.binders.OrgNameCatalogNameItemNameToEndpoint;
|
||||
import org.jclouds.vcloud.domain.Catalog;
|
||||
import org.jclouds.vcloud.domain.CatalogItem;
|
||||
import org.jclouds.vcloud.filters.AddVCloudAuthorizationAndCookieToRequest;
|
||||
import org.jclouds.vcloud.options.CatalogItemOptions;
|
||||
import org.jclouds.vcloud.xml.CatalogHandler;
|
||||
import org.jclouds.vcloud.xml.CatalogItemHandler;
|
||||
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
/**
|
||||
* Provides access to Catalog functionality in vCloud
|
||||
* <p/>
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@RequestFilters(AddVCloudAuthorizationAndCookieToRequest.class)
|
||||
public interface CatalogAsyncClient {
|
||||
|
||||
/**
|
||||
* @see CatalogClient#getCatalog
|
||||
*/
|
||||
@GET
|
||||
@XMLResponseParser(CatalogHandler.class)
|
||||
@Fallback(NullOnNotFoundOr404.class)
|
||||
@Consumes(CATALOG_XML)
|
||||
ListenableFuture<Catalog> getCatalog(@EndpointParam URI catalogId);
|
||||
|
||||
/**
|
||||
* @see CatalogClient#findCatalogInOrgNamed
|
||||
*/
|
||||
@GET
|
||||
@XMLResponseParser(CatalogHandler.class)
|
||||
@Fallback(NullOnNotFoundOr404.class)
|
||||
@Consumes(CATALOG_XML)
|
||||
@MapBinder(OrgNameAndCatalogNameToEndpoint.class)
|
||||
ListenableFuture<Catalog> findCatalogInOrgNamed(@Nullable @PayloadParam("orgName") String orgName,
|
||||
@Nullable @PayloadParam("catalogName") String catalogName);
|
||||
|
||||
/**
|
||||
* @see CatalogClient#getCatalogItem
|
||||
*/
|
||||
@GET
|
||||
@Consumes(CATALOGITEM_XML)
|
||||
@XMLResponseParser(CatalogItemHandler.class)
|
||||
@Fallback(NullOnNotFoundOr404.class)
|
||||
ListenableFuture<CatalogItem> getCatalogItem(@EndpointParam URI catalogItem);
|
||||
|
||||
/**
|
||||
* @see CatalogClient#getCatalogItemInOrg
|
||||
*/
|
||||
@GET
|
||||
@Consumes(CATALOGITEM_XML)
|
||||
@XMLResponseParser(CatalogItemHandler.class)
|
||||
@Fallback(NullOnNotFoundOr404.class)
|
||||
@MapBinder(OrgNameCatalogNameItemNameToEndpoint.class)
|
||||
ListenableFuture<CatalogItem> findCatalogItemInOrgCatalogNamed(@Nullable @PayloadParam("orgName") String orgName,
|
||||
@Nullable @PayloadParam("catalogName") String catalogName, @PayloadParam("itemName") String itemName);
|
||||
|
||||
/**
|
||||
* @see CatalogClient#addVAppTemplateOrMediaImageToCatalog
|
||||
*/
|
||||
@POST
|
||||
@Path("/catalogItems")
|
||||
@Consumes(CATALOGITEM_XML)
|
||||
@Produces(CATALOGITEM_XML)
|
||||
@MapBinder(BindCatalogItemToXmlPayload.class)
|
||||
@XMLResponseParser(CatalogItemHandler.class)
|
||||
ListenableFuture<CatalogItem> addVAppTemplateOrMediaImageToCatalogAndNameItem(@PayloadParam("Entity") URI entity,
|
||||
@EndpointParam URI catalog, @PayloadParam("name") String name, CatalogItemOptions... options);
|
||||
|
||||
|
||||
/**
|
||||
* @see CatalogClient#deleteCatalogItem
|
||||
*/
|
||||
@DELETE
|
||||
@Fallback(VoidOnNotFoundOr404.class)
|
||||
ListenableFuture<Void> deleteCatalogItem(@EndpointParam URI href);
|
||||
|
||||
}
|
|
@ -1,86 +0,0 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.jclouds.vcloud.features;
|
||||
|
||||
import java.net.URI;
|
||||
import org.jclouds.javax.annotation.Nullable;
|
||||
import org.jclouds.vcloud.domain.Catalog;
|
||||
import org.jclouds.vcloud.domain.CatalogItem;
|
||||
import org.jclouds.vcloud.options.CatalogItemOptions;
|
||||
|
||||
/**
|
||||
* Provides access to Catalog functionality in vCloud
|
||||
* <p/>
|
||||
*
|
||||
* @see <a href="http://communities.vmware.com/community/developer/forums/vcloudapi" />
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
public interface CatalogClient {
|
||||
|
||||
Catalog getCatalog(URI catalogId);
|
||||
|
||||
/**
|
||||
* returns the catalog in the organization associated with the specified name. Note that both
|
||||
* parameters can be null to choose default.
|
||||
*
|
||||
* @param orgName
|
||||
* organization name, or null for the default
|
||||
* @param catalogName
|
||||
* catalog name, or null for the default
|
||||
* @throws NoSuchElementException
|
||||
* if you specified an org or catalog name that isn't present
|
||||
*/
|
||||
Catalog findCatalogInOrgNamed(@Nullable String orgName, @Nullable String catalogName);
|
||||
|
||||
CatalogItem getCatalogItem(URI catalogItem);
|
||||
|
||||
/**
|
||||
* returns the catalog item in the catalog associated with the specified name. Note that the org
|
||||
* and catalog parameters can be null to choose default.
|
||||
*
|
||||
* @param orgName
|
||||
* organization name, or null for the default
|
||||
* @param catalogName
|
||||
* catalog name, or null for the default
|
||||
* @param itemName
|
||||
* item you wish to lookup
|
||||
*
|
||||
* @throws NoSuchElementException
|
||||
* if you specified an org, catalog, or catalog item name that isn't present
|
||||
*/
|
||||
CatalogItem findCatalogItemInOrgCatalogNamed(@Nullable String orgName, @Nullable String catalogName, String itemName);
|
||||
|
||||
/**
|
||||
* A catalog can contain references to vApp templates and media images that have been uploaded to
|
||||
* any vDC in an organization. A vApp template or media image can be listed in at most one
|
||||
* catalog.
|
||||
*
|
||||
* @param entity
|
||||
* the reference to the vApp templates and media image
|
||||
* @param catalog
|
||||
* URI of the catalog to add the resourceEntity from
|
||||
* @param name
|
||||
* name of the entry in the catalog
|
||||
*
|
||||
* @param options
|
||||
* options such as description or properties
|
||||
* @return the new catalog item
|
||||
*/
|
||||
CatalogItem addVAppTemplateOrMediaImageToCatalogAndNameItem(URI entity, URI catalog, String name, CatalogItemOptions... options);
|
||||
|
||||
void deleteCatalogItem(URI href);
|
||||
}
|
|
@ -23,7 +23,7 @@ import java.net.URI;
|
|||
import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.GET;
|
||||
|
||||
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
|
||||
import org.jclouds.Fallbacks;
|
||||
import org.jclouds.javax.annotation.Nullable;
|
||||
import org.jclouds.rest.annotations.EndpointParam;
|
||||
import org.jclouds.rest.annotations.Fallback;
|
||||
|
@ -36,35 +36,26 @@ import org.jclouds.vcloud.domain.network.OrgNetwork;
|
|||
import org.jclouds.vcloud.filters.AddVCloudAuthorizationAndCookieToRequest;
|
||||
import org.jclouds.vcloud.xml.OrgNetworkHandler;
|
||||
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
/**
|
||||
* Provides access to Network functionality in vCloud
|
||||
* <p/>
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@RequestFilters(AddVCloudAuthorizationAndCookieToRequest.class)
|
||||
public interface NetworkAsyncClient {
|
||||
public interface NetworkApi {
|
||||
|
||||
/**
|
||||
* @see NetworkClient#findNetworkInOrgVDCNamed
|
||||
*/
|
||||
@GET
|
||||
@Consumes(NETWORK_XML)
|
||||
@XMLResponseParser(OrgNetworkHandler.class)
|
||||
@Fallback(NullOnNotFoundOr404.class)
|
||||
@Fallback(Fallbacks.NullOnNotFoundOr404.class)
|
||||
@MapBinder(OrgNameVDCNameNetworkNameToEndpoint.class)
|
||||
ListenableFuture<OrgNetwork> findNetworkInOrgVDCNamed(@Nullable @PayloadParam("orgName") String orgName,
|
||||
@Nullable @PayloadParam("vdcName") String vdcName, @PayloadParam("resourceName") String networkName);
|
||||
OrgNetwork findNetworkInOrgVDCNamed(@Nullable @PayloadParam("orgName") String orgName,
|
||||
@Nullable @PayloadParam("vdcName") String vdcName,
|
||||
@PayloadParam("resourceName") String networkName);
|
||||
|
||||
/**
|
||||
* @see NetworkClient#getNetwork
|
||||
*/
|
||||
@GET
|
||||
@Consumes(NETWORK_XML)
|
||||
@XMLResponseParser(OrgNetworkHandler.class)
|
||||
@Fallback(NullOnNotFoundOr404.class)
|
||||
ListenableFuture<OrgNetwork> getNetwork(@EndpointParam URI network);
|
||||
|
||||
@Fallback(Fallbacks.NullOnNotFoundOr404.class)
|
||||
OrgNetwork getNetwork(@EndpointParam URI network);
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.jclouds.vcloud.features;
|
||||
|
||||
import java.net.URI;
|
||||
import org.jclouds.javax.annotation.Nullable;
|
||||
import org.jclouds.vcloud.domain.network.OrgNetwork;
|
||||
|
||||
/**
|
||||
* Provides access to Network functionality in vCloud
|
||||
* <p/>
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
public interface NetworkClient {
|
||||
|
||||
OrgNetwork findNetworkInOrgVDCNamed(@Nullable String orgName, @Nullable String catalogName, String networkName);
|
||||
|
||||
OrgNetwork getNetwork(URI network);
|
||||
}
|
|
@ -24,7 +24,7 @@ import java.util.Map;
|
|||
import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.GET;
|
||||
|
||||
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
|
||||
import org.jclouds.Fallbacks;
|
||||
import org.jclouds.javax.annotation.Nullable;
|
||||
import org.jclouds.rest.annotations.Endpoint;
|
||||
import org.jclouds.rest.annotations.EndpointParam;
|
||||
|
@ -49,34 +49,39 @@ import com.google.common.util.concurrent.ListenableFuture;
|
|||
* @author Adrian Cole
|
||||
*/
|
||||
@RequestFilters(AddVCloudAuthorizationAndCookieToRequest.class)
|
||||
public interface OrgAsyncClient {
|
||||
public interface OrgApi {
|
||||
|
||||
/**
|
||||
* The response to a login request includes a list of the organizations to which the
|
||||
* authenticated user has access.
|
||||
*
|
||||
* @see OrgClient#listOrgs
|
||||
* @return organizations indexed by name
|
||||
*/
|
||||
@GET
|
||||
@Endpoint(OrgList.class)
|
||||
@XMLResponseParser(OrgListHandler.class)
|
||||
@Consumes(VCloudMediaType.ORGLIST_XML)
|
||||
ListenableFuture<Map<String, ReferenceType>> listOrgs();
|
||||
Map<String, ReferenceType> listOrgs();
|
||||
|
||||
@GET
|
||||
@XMLResponseParser(OrgHandler.class)
|
||||
@Fallback(Fallbacks.NullOnNotFoundOr404.class)
|
||||
@Consumes(ORG_XML)
|
||||
Org getOrg(@EndpointParam URI orgId);
|
||||
|
||||
/**
|
||||
* @see OrgClient#getOrg
|
||||
* This call returns a list of all vCloud Data Centers (vdcs), catalogs, and task lists within
|
||||
* the organization.
|
||||
*
|
||||
* @param name
|
||||
* organization name, or null for the default
|
||||
* @throws NoSuchElementException
|
||||
* if you specified an org name that isn't present
|
||||
*/
|
||||
@GET
|
||||
@XMLResponseParser(OrgHandler.class)
|
||||
@Fallback(NullOnNotFoundOr404.class)
|
||||
@Fallback(Fallbacks.NullOnNotFoundOr404.class)
|
||||
@Consumes(ORG_XML)
|
||||
ListenableFuture<Org> getOrg(@EndpointParam URI orgId);
|
||||
Org findOrgNamed(@Nullable @EndpointParam(parser = OrgNameToEndpoint.class) String orgName);
|
||||
|
||||
/**
|
||||
* @see OrgClient#getOrgNamed
|
||||
*/
|
||||
@GET
|
||||
@XMLResponseParser(OrgHandler.class)
|
||||
@Fallback(NullOnNotFoundOr404.class)
|
||||
@Consumes(ORG_XML)
|
||||
ListenableFuture<Org> findOrgNamed(
|
||||
@Nullable @EndpointParam(parser = OrgNameToEndpoint.class) String orgName);
|
||||
}
|
|
@ -1,54 +0,0 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.jclouds.vcloud.features;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Map;
|
||||
import org.jclouds.javax.annotation.Nullable;
|
||||
import org.jclouds.vcloud.domain.Org;
|
||||
import org.jclouds.vcloud.domain.ReferenceType;
|
||||
|
||||
/**
|
||||
* Provides access to Org functionality in vCloud
|
||||
* <p/>
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
public interface OrgClient {
|
||||
|
||||
/**
|
||||
* The response to a login request includes a list of the organizations to which the
|
||||
* authenticated user has access.
|
||||
*
|
||||
* @return organizations indexed by name
|
||||
*/
|
||||
Map<String, ReferenceType> listOrgs();
|
||||
|
||||
Org getOrg(URI orgId);
|
||||
|
||||
/**
|
||||
* This call returns a list of all vCloud Data Centers (vdcs), catalogs, and task lists within
|
||||
* the organization.
|
||||
*
|
||||
* @param name
|
||||
* organization name, or null for the default
|
||||
* @throws NoSuchElementException
|
||||
* if you specified an org name that isn't present
|
||||
*/
|
||||
Org findOrgNamed(@Nullable String name);
|
||||
|
||||
}
|
|
@ -26,7 +26,7 @@ import javax.ws.rs.GET;
|
|||
import javax.ws.rs.POST;
|
||||
import javax.ws.rs.Path;
|
||||
|
||||
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
|
||||
import org.jclouds.Fallbacks;
|
||||
import org.jclouds.javax.annotation.Nullable;
|
||||
import org.jclouds.rest.annotations.EndpointParam;
|
||||
import org.jclouds.rest.annotations.Fallback;
|
||||
|
@ -39,8 +39,6 @@ import org.jclouds.vcloud.functions.OrgNameToTasksListEndpoint;
|
|||
import org.jclouds.vcloud.xml.TaskHandler;
|
||||
import org.jclouds.vcloud.xml.TasksListHandler;
|
||||
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
/**
|
||||
* Provides access to Task functionality in vCloud
|
||||
* <p/>
|
||||
|
@ -48,41 +46,37 @@ import com.google.common.util.concurrent.ListenableFuture;
|
|||
* @author Adrian Cole
|
||||
*/
|
||||
@RequestFilters(AddVCloudAuthorizationAndCookieToRequest.class)
|
||||
public interface TaskAsyncClient {
|
||||
public interface TaskApi {
|
||||
|
||||
/**
|
||||
* @see TaskClient#getTasksList
|
||||
*/
|
||||
@GET
|
||||
@Consumes(TASKSLIST_XML)
|
||||
@XMLResponseParser(TasksListHandler.class)
|
||||
@Fallback(NullOnNotFoundOr404.class)
|
||||
ListenableFuture<TasksList> getTasksList(@EndpointParam URI tasksListId);
|
||||
@Fallback(Fallbacks.NullOnNotFoundOr404.class)
|
||||
TasksList getTasksList(@EndpointParam URI tasksListId);
|
||||
|
||||
/**
|
||||
* @see TaskClient#findTasksListInOrgNamed
|
||||
*/
|
||||
@GET
|
||||
@Consumes(TASKSLIST_XML)
|
||||
@XMLResponseParser(TasksListHandler.class)
|
||||
@Fallback(NullOnNotFoundOr404.class)
|
||||
ListenableFuture<TasksList> findTasksListInOrgNamed(
|
||||
@Nullable @EndpointParam(parser = OrgNameToTasksListEndpoint.class) String orgName);
|
||||
@Fallback(Fallbacks.NullOnNotFoundOr404.class)
|
||||
TasksList findTasksListInOrgNamed(@Nullable @EndpointParam(parser = OrgNameToTasksListEndpoint.class) String orgName);
|
||||
|
||||
/**
|
||||
* @see TaskClient#getTask
|
||||
* Whenever the result of a request cannot be returned immediately, the server creates a Task
|
||||
* object and includes it in the response, as a member of the Tasks container in the response
|
||||
* body. Each Task has an href value, which is a URL that the client can use to retrieve the Task
|
||||
* element alone, without the rest of the response in which it was contained. All information
|
||||
* about the task is included in the Task element when it is returned in the response’s Tasks
|
||||
* container, so a client does not need to make an additional request to the Task URL unless it
|
||||
* wants to follow the progress of a task that was incomplete.
|
||||
*/
|
||||
@GET
|
||||
@Consumes(TASK_XML)
|
||||
@XMLResponseParser(TaskHandler.class)
|
||||
@Fallback(NullOnNotFoundOr404.class)
|
||||
ListenableFuture<Task> getTask(@EndpointParam URI taskId);
|
||||
@Fallback(Fallbacks.NullOnNotFoundOr404.class)
|
||||
Task getTask(@EndpointParam URI taskId);
|
||||
|
||||
/**
|
||||
* @see TaskClient#cancelTask
|
||||
*/
|
||||
@POST
|
||||
@Path("/action/cancel")
|
||||
ListenableFuture<Void> cancelTask(@EndpointParam URI taskId);
|
||||
void cancelTask(@EndpointParam URI taskId);
|
||||
|
||||
}
|
|
@ -1,48 +0,0 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.jclouds.vcloud.features;
|
||||
|
||||
import java.net.URI;
|
||||
import org.jclouds.vcloud.domain.Task;
|
||||
import org.jclouds.vcloud.domain.TasksList;
|
||||
|
||||
/**
|
||||
* Provides access to Task functionality in vCloud
|
||||
* <p/>
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
public interface TaskClient {
|
||||
|
||||
TasksList getTasksList(URI tasksListId);
|
||||
|
||||
TasksList findTasksListInOrgNamed(String orgName);
|
||||
|
||||
/**
|
||||
* Whenever the result of a request cannot be returned immediately, the server creates a Task
|
||||
* object and includes it in the response, as a member of the Tasks container in the response
|
||||
* body. Each Task has an href value, which is a URL that the client can use to retrieve the Task
|
||||
* element alone, without the rest of the response in which it was contained. All information
|
||||
* about the task is included in the Task element when it is returned in the response’s Tasks
|
||||
* container, so a client does not need to make an additional request to the Task URL unless it
|
||||
* wants to follow the progress of a task that was incomplete.
|
||||
*/
|
||||
Task getTask(URI taskId);
|
||||
|
||||
void cancelTask(URI taskId);
|
||||
|
||||
}
|
|
@ -16,11 +16,43 @@
|
|||
*/
|
||||
package org.jclouds.vcloud.features;
|
||||
|
||||
import static org.jclouds.vcloud.VCloudMediaType.DEPLOYVAPPPARAMS_XML;
|
||||
import static org.jclouds.vcloud.VCloudMediaType.TASK_XML;
|
||||
import static org.jclouds.vcloud.VCloudMediaType.UNDEPLOYVAPPPARAMS_XML;
|
||||
import static org.jclouds.vcloud.VCloudMediaType.VAPP_XML;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.DELETE;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.POST;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.Produces;
|
||||
|
||||
import org.jclouds.Fallbacks;
|
||||
import org.jclouds.javax.annotation.Nullable;
|
||||
import org.jclouds.predicates.validators.DnsNameValidator;
|
||||
import org.jclouds.rest.annotations.EndpointParam;
|
||||
import org.jclouds.rest.annotations.Fallback;
|
||||
import org.jclouds.rest.annotations.MapBinder;
|
||||
import org.jclouds.rest.annotations.ParamValidators;
|
||||
import org.jclouds.rest.annotations.PayloadParam;
|
||||
import org.jclouds.rest.annotations.PayloadParams;
|
||||
import org.jclouds.rest.annotations.RequestFilters;
|
||||
import org.jclouds.rest.annotations.XMLResponseParser;
|
||||
import org.jclouds.vcloud.binders.BindCloneVAppParamsToXmlPayload;
|
||||
import org.jclouds.vcloud.binders.BindDeployVAppParamsToXmlPayload;
|
||||
import org.jclouds.vcloud.binders.BindUndeployVAppParamsToXmlPayload;
|
||||
import org.jclouds.vcloud.binders.OrgNameVDCNameResourceEntityNameToEndpoint;
|
||||
import org.jclouds.vcloud.domain.Task;
|
||||
import org.jclouds.vcloud.domain.VApp;
|
||||
import org.jclouds.vcloud.filters.AddVCloudAuthorizationAndCookieToRequest;
|
||||
import org.jclouds.vcloud.options.CloneVAppOptions;
|
||||
import org.jclouds.vcloud.xml.TaskHandler;
|
||||
import org.jclouds.vcloud.xml.VAppHandler;
|
||||
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
/**
|
||||
* Provides access to VApp functionality in vCloud
|
||||
|
@ -29,14 +61,42 @@ import org.jclouds.vcloud.options.CloneVAppOptions;
|
|||
* @see <a href="http://communities.vmware.com/community/developer/forums/vcloudapi" />
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
public interface VAppClient {
|
||||
VApp findVAppInOrgVDCNamed(@Nullable String orgName, @Nullable String catalogName, String vAppName);
|
||||
@RequestFilters(AddVCloudAuthorizationAndCookieToRequest.class)
|
||||
public interface VAppApi {
|
||||
@GET
|
||||
@Consumes(VAPP_XML)
|
||||
@XMLResponseParser(VAppHandler.class)
|
||||
@Fallback(Fallbacks.NullOnNotFoundOr404.class)
|
||||
@MapBinder(OrgNameVDCNameResourceEntityNameToEndpoint.class)
|
||||
VApp findVAppInOrgVDCNamed(@Nullable @PayloadParam("orgName") String orgName,
|
||||
@Nullable @PayloadParam("vdcName") String vdcName, @PayloadParam("resourceName") String vAppName);
|
||||
|
||||
Task copyVAppToVDCAndName(URI sourceVApp, URI vDC, String newName, CloneVAppOptions... options);
|
||||
@POST
|
||||
@Path("/action/cloneVApp")
|
||||
@Produces("application/vnd.vmware.vcloud.cloneVAppParams+xml")
|
||||
@Consumes(TASK_XML)
|
||||
@XMLResponseParser(TaskHandler.class)
|
||||
@MapBinder(BindCloneVAppParamsToXmlPayload.class)
|
||||
Task copyVAppToVDCAndName(@PayloadParam("Source") URI sourceVApp,
|
||||
@EndpointParam URI vdc, @PayloadParam("name") @ParamValidators(DnsNameValidator.class) String newName,
|
||||
CloneVAppOptions... options);
|
||||
|
||||
Task moveVAppToVDCAndRename(URI sourceVApp, URI vDC, String newName, CloneVAppOptions... options);
|
||||
@POST
|
||||
@Path("/action/cloneVApp")
|
||||
@Produces("application/vnd.vmware.vcloud.cloneVAppParams+xml")
|
||||
@Consumes(TASK_XML)
|
||||
@XMLResponseParser(TaskHandler.class)
|
||||
@PayloadParams(keys = "IsSourceDelete", values = "true")
|
||||
@MapBinder(BindCloneVAppParamsToXmlPayload.class)
|
||||
Task moveVAppToVDCAndRename(@PayloadParam("Source") URI sourceVApp,
|
||||
@EndpointParam URI vdc, @PayloadParam("name") @ParamValidators(DnsNameValidator.class) String newName,
|
||||
CloneVAppOptions... options);
|
||||
|
||||
VApp getVApp(URI vApp);
|
||||
@GET
|
||||
@Consumes(VAPP_XML)
|
||||
@XMLResponseParser(VAppHandler.class)
|
||||
@Fallback(Fallbacks.NullOnNotFoundOr404.class)
|
||||
VApp getVApp(@EndpointParam URI href);
|
||||
|
||||
/**
|
||||
* To deploy a vApp, the client makes a request to its action/deploy URL. Deploying a vApp
|
||||
|
@ -45,13 +105,26 @@ public interface VAppClient {
|
|||
* <p/>
|
||||
* Deploying a Vm implicitly deploys the parent vApp if that vApp is not already deployed.
|
||||
*/
|
||||
Task deployVApp(URI href);
|
||||
@POST
|
||||
@Consumes(TASK_XML)
|
||||
@Produces(DEPLOYVAPPPARAMS_XML)
|
||||
@Path("/action/deploy")
|
||||
@MapBinder(BindDeployVAppParamsToXmlPayload.class)
|
||||
@XMLResponseParser(TaskHandler.class)
|
||||
Task deployVApp(@EndpointParam URI href);
|
||||
|
||||
/**
|
||||
* like {@link #deployVApp(URI)}, except deploy transitions to power on state
|
||||
*
|
||||
*/
|
||||
Task deployAndPowerOnVApp(URI href);
|
||||
@POST
|
||||
@Consumes(TASK_XML)
|
||||
@Produces(DEPLOYVAPPPARAMS_XML)
|
||||
@Path("/action/deploy")
|
||||
@MapBinder(BindDeployVAppParamsToXmlPayload.class)
|
||||
@PayloadParams(keys = "powerOn", values = "true")
|
||||
@XMLResponseParser(TaskHandler.class)
|
||||
Task deployAndPowerOnVApp(@EndpointParam URI href);
|
||||
|
||||
/**
|
||||
* Undeploying a vApp powers off or suspends any running virtual machines it contains, then frees
|
||||
|
@ -66,14 +139,27 @@ public interface VAppClient {
|
|||
* {@link #undeployAndSaveStateOf}
|
||||
*
|
||||
*/
|
||||
Task undeployVApp(URI href);
|
||||
@POST
|
||||
@Consumes(TASK_XML)
|
||||
@Produces(UNDEPLOYVAPPPARAMS_XML)
|
||||
@Path("/action/undeploy")
|
||||
@MapBinder(BindUndeployVAppParamsToXmlPayload.class)
|
||||
@XMLResponseParser(TaskHandler.class)
|
||||
Task undeployVApp(@EndpointParam URI href);
|
||||
|
||||
/**
|
||||
* like {@link #undeployVApp(URI)}, where the undeployed virtual machines are suspended and their
|
||||
* suspend state saved
|
||||
*
|
||||
*/
|
||||
Task undeployAndSaveStateOfVApp(URI href);
|
||||
@POST
|
||||
@Consumes(TASK_XML)
|
||||
@Produces(UNDEPLOYVAPPPARAMS_XML)
|
||||
@Path("/action/undeploy")
|
||||
@MapBinder(BindUndeployVAppParamsToXmlPayload.class)
|
||||
@PayloadParams(keys = "saveState", values = "true")
|
||||
@XMLResponseParser(TaskHandler.class)
|
||||
Task undeployAndSaveStateOfVApp(@EndpointParam URI href);
|
||||
|
||||
/**
|
||||
* A powerOn request to a vApp URL powers on all of the virtual machines in the vApp, as
|
||||
|
@ -85,7 +171,11 @@ public interface VAppClient {
|
|||
* <h4>NOTE</h4> A powerOn request to a vApp or virtual machine that is undeployed forces
|
||||
* deployment.
|
||||
*/
|
||||
Task powerOnVApp(URI href);
|
||||
@POST
|
||||
@Consumes(TASK_XML)
|
||||
@Path("/power/action/powerOn")
|
||||
@XMLResponseParser(TaskHandler.class)
|
||||
Task powerOnVApp(@EndpointParam URI href);
|
||||
|
||||
/**
|
||||
* A powerOff request to a vApp URL powers off all of the virtual machines in the vApp, as
|
||||
|
@ -93,7 +183,11 @@ public interface VAppClient {
|
|||
* <p/>
|
||||
* A powerOff request to a virtual machine URL powers off the specified virtual machine.
|
||||
*/
|
||||
Task powerOffVApp(URI href);
|
||||
@POST
|
||||
@Consumes(TASK_XML)
|
||||
@Path("/power/action/powerOff")
|
||||
@XMLResponseParser(TaskHandler.class)
|
||||
Task powerOffVApp(@EndpointParam URI href);
|
||||
|
||||
/**
|
||||
* A shutdown request to a vApp URL shuts down all of the virtual machines in the vApp, as
|
||||
|
@ -104,7 +198,9 @@ public interface VAppClient {
|
|||
* <h4>NOTE</h4Because this request sends a signal to the guest OS, the vCloud API cannot track
|
||||
* the progress or verify the result of the requested operation. Hence, void is returned
|
||||
*/
|
||||
void shutdownVApp(URI href);
|
||||
@POST
|
||||
@Path("/power/action/shutdown")
|
||||
void shutdownVApp(@EndpointParam URI href);
|
||||
|
||||
/**
|
||||
* A reset request to a vApp URL resets all of the virtual machines in the vApp, as specified in
|
||||
|
@ -112,7 +208,11 @@ public interface VAppClient {
|
|||
* <p/>
|
||||
* A reset request to a virtual machine URL resets the specified virtual machine.
|
||||
*/
|
||||
Task resetVApp(URI href);
|
||||
@POST
|
||||
@Consumes(TASK_XML)
|
||||
@Path("/power/action/reset")
|
||||
@XMLResponseParser(TaskHandler.class)
|
||||
Task resetVApp(@EndpointParam URI href);
|
||||
|
||||
/**
|
||||
* A reboot request to a vApp URL reboots all of the virtual machines in the vApp, as specified
|
||||
|
@ -123,7 +223,9 @@ public interface VAppClient {
|
|||
* <h4>NOTE</h4> Because this request sends a signal to the guest OS, the vCloud API cannot track
|
||||
* the progress or verify the result of the requested operation. Hence, void is returned
|
||||
*/
|
||||
void rebootVApp(URI href);
|
||||
@POST
|
||||
@Path("/power/action/reboot")
|
||||
void rebootVApp(@EndpointParam URI href);
|
||||
|
||||
/**
|
||||
* A suspend request to a vApp URL suspends all of the virtual machines in the vApp, as specified
|
||||
|
@ -131,7 +233,11 @@ public interface VAppClient {
|
|||
* <p/>
|
||||
* A suspend request to a virtual machine URL suspends the specified virtual machine.
|
||||
*/
|
||||
Task suspendVApp(URI href);
|
||||
@POST
|
||||
@Consumes(TASK_XML)
|
||||
@Path("/power/action/suspend")
|
||||
@XMLResponseParser(TaskHandler.class)
|
||||
Task suspendVApp(@EndpointParam URI href);
|
||||
|
||||
/**
|
||||
* delete a vAppTemplate, vApp, or media image. You cannot delete an object if it is in use. Any
|
||||
|
@ -148,5 +254,9 @@ public interface VAppClient {
|
|||
* href of the vApp
|
||||
* @return task of the operation in progress
|
||||
*/
|
||||
Task deleteVApp(URI href);
|
||||
@DELETE
|
||||
@Consumes(TASK_XML)
|
||||
@Fallback(Fallbacks.VoidOnNotFoundOr404.class)
|
||||
@XMLResponseParser(TaskHandler.class)
|
||||
Task deleteVApp(@EndpointParam URI href);
|
||||
}
|
|
@ -1,219 +0,0 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.jclouds.vcloud.features;
|
||||
|
||||
import static org.jclouds.vcloud.VCloudMediaType.DEPLOYVAPPPARAMS_XML;
|
||||
import static org.jclouds.vcloud.VCloudMediaType.TASK_XML;
|
||||
import static org.jclouds.vcloud.VCloudMediaType.UNDEPLOYVAPPPARAMS_XML;
|
||||
import static org.jclouds.vcloud.VCloudMediaType.VAPP_XML;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.DELETE;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.POST;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.Produces;
|
||||
|
||||
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
|
||||
import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
|
||||
import org.jclouds.javax.annotation.Nullable;
|
||||
import org.jclouds.predicates.validators.DnsNameValidator;
|
||||
import org.jclouds.rest.annotations.EndpointParam;
|
||||
import org.jclouds.rest.annotations.Fallback;
|
||||
import org.jclouds.rest.annotations.MapBinder;
|
||||
import org.jclouds.rest.annotations.ParamValidators;
|
||||
import org.jclouds.rest.annotations.PayloadParam;
|
||||
import org.jclouds.rest.annotations.PayloadParams;
|
||||
import org.jclouds.rest.annotations.RequestFilters;
|
||||
import org.jclouds.rest.annotations.XMLResponseParser;
|
||||
import org.jclouds.vcloud.binders.BindCloneVAppParamsToXmlPayload;
|
||||
import org.jclouds.vcloud.binders.BindDeployVAppParamsToXmlPayload;
|
||||
import org.jclouds.vcloud.binders.BindUndeployVAppParamsToXmlPayload;
|
||||
import org.jclouds.vcloud.binders.OrgNameVDCNameResourceEntityNameToEndpoint;
|
||||
import org.jclouds.vcloud.domain.Task;
|
||||
import org.jclouds.vcloud.domain.VApp;
|
||||
import org.jclouds.vcloud.filters.AddVCloudAuthorizationAndCookieToRequest;
|
||||
import org.jclouds.vcloud.options.CloneVAppOptions;
|
||||
import org.jclouds.vcloud.xml.TaskHandler;
|
||||
import org.jclouds.vcloud.xml.VAppHandler;
|
||||
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
/**
|
||||
* Provides access to VApp functionality in vCloud
|
||||
* <p/>
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@RequestFilters(AddVCloudAuthorizationAndCookieToRequest.class)
|
||||
public interface VAppAsyncClient {
|
||||
|
||||
/**
|
||||
* @see VAppClient#copyVAppToVDCAndName
|
||||
*/
|
||||
@POST
|
||||
@Path("/action/cloneVApp")
|
||||
@Produces("application/vnd.vmware.vcloud.cloneVAppParams+xml")
|
||||
@Consumes(TASK_XML)
|
||||
@XMLResponseParser(TaskHandler.class)
|
||||
@MapBinder(BindCloneVAppParamsToXmlPayload.class)
|
||||
ListenableFuture<Task> copyVAppToVDCAndName(@PayloadParam("Source") URI sourceVApp,
|
||||
@EndpointParam URI vdc, @PayloadParam("name") @ParamValidators(DnsNameValidator.class) String newName,
|
||||
CloneVAppOptions... options);
|
||||
|
||||
/**
|
||||
* @see VAppClient#moveVAppToVDCAndRename
|
||||
*/
|
||||
@POST
|
||||
@Path("/action/cloneVApp")
|
||||
@Produces("application/vnd.vmware.vcloud.cloneVAppParams+xml")
|
||||
@Consumes(TASK_XML)
|
||||
@XMLResponseParser(TaskHandler.class)
|
||||
@PayloadParams(keys = "IsSourceDelete", values = "true")
|
||||
@MapBinder(BindCloneVAppParamsToXmlPayload.class)
|
||||
ListenableFuture<Task> moveVAppToVDCAndRename(@PayloadParam("Source") URI sourceVApp,
|
||||
@EndpointParam URI vdc, @PayloadParam("name") @ParamValidators(DnsNameValidator.class) String newName,
|
||||
CloneVAppOptions... options);
|
||||
|
||||
/**
|
||||
* @see VAppClient#findVAppInOrgVDCNamed
|
||||
*/
|
||||
@GET
|
||||
@Consumes(VAPP_XML)
|
||||
@XMLResponseParser(VAppHandler.class)
|
||||
@Fallback(NullOnNotFoundOr404.class)
|
||||
@MapBinder(OrgNameVDCNameResourceEntityNameToEndpoint.class)
|
||||
ListenableFuture<VApp> findVAppInOrgVDCNamed(@Nullable @PayloadParam("orgName") String orgName,
|
||||
@Nullable @PayloadParam("vdcName") String vdcName, @PayloadParam("resourceName") String vAppName);
|
||||
|
||||
/**
|
||||
* @see VAppClient#getVApp
|
||||
*/
|
||||
@GET
|
||||
@Consumes(VAPP_XML)
|
||||
@XMLResponseParser(VAppHandler.class)
|
||||
@Fallback(NullOnNotFoundOr404.class)
|
||||
ListenableFuture<VApp> getVApp(@EndpointParam URI href);
|
||||
|
||||
/**
|
||||
* @see VAppClient#deployVApp
|
||||
*/
|
||||
@POST
|
||||
@Consumes(TASK_XML)
|
||||
@Produces(DEPLOYVAPPPARAMS_XML)
|
||||
@Path("/action/deploy")
|
||||
@MapBinder(BindDeployVAppParamsToXmlPayload.class)
|
||||
@XMLResponseParser(TaskHandler.class)
|
||||
ListenableFuture<Task> deployVApp(@EndpointParam URI href);
|
||||
|
||||
/**
|
||||
* @see VAppClient#deployAndPowerOnVApp
|
||||
*/
|
||||
@POST
|
||||
@Consumes(TASK_XML)
|
||||
@Produces(DEPLOYVAPPPARAMS_XML)
|
||||
@Path("/action/deploy")
|
||||
@MapBinder(BindDeployVAppParamsToXmlPayload.class)
|
||||
@PayloadParams(keys = "powerOn", values = "true")
|
||||
@XMLResponseParser(TaskHandler.class)
|
||||
ListenableFuture<Task> deployAndPowerOnVApp(@EndpointParam URI href);
|
||||
|
||||
/**
|
||||
* @see VAppClient#undeployVApp
|
||||
*/
|
||||
@POST
|
||||
@Consumes(TASK_XML)
|
||||
@Produces(UNDEPLOYVAPPPARAMS_XML)
|
||||
@Path("/action/undeploy")
|
||||
@MapBinder(BindUndeployVAppParamsToXmlPayload.class)
|
||||
@XMLResponseParser(TaskHandler.class)
|
||||
ListenableFuture<Task> undeployVApp(@EndpointParam URI href);
|
||||
|
||||
/**
|
||||
* @see VAppClient#undeployAndSaveStateOfVApp
|
||||
*/
|
||||
@POST
|
||||
@Consumes(TASK_XML)
|
||||
@Produces(UNDEPLOYVAPPPARAMS_XML)
|
||||
@Path("/action/undeploy")
|
||||
@MapBinder(BindUndeployVAppParamsToXmlPayload.class)
|
||||
@PayloadParams(keys = "saveState", values = "true")
|
||||
@XMLResponseParser(TaskHandler.class)
|
||||
ListenableFuture<Task> undeployAndSaveStateOfVApp(@EndpointParam URI href);
|
||||
|
||||
/**
|
||||
* @see VAppClient#powerOnVApp
|
||||
*/
|
||||
@POST
|
||||
@Consumes(TASK_XML)
|
||||
@Path("/power/action/powerOn")
|
||||
@XMLResponseParser(TaskHandler.class)
|
||||
ListenableFuture<Task> powerOnVApp(@EndpointParam URI href);
|
||||
|
||||
/**
|
||||
* @see VAppClient#powerOffVApp
|
||||
*/
|
||||
@POST
|
||||
@Consumes(TASK_XML)
|
||||
@Path("/power/action/powerOff")
|
||||
@XMLResponseParser(TaskHandler.class)
|
||||
ListenableFuture<Task> powerOffVApp(@EndpointParam URI href);
|
||||
|
||||
/**
|
||||
* @see VAppClient#shutdownVApp
|
||||
*/
|
||||
@POST
|
||||
@Path("/power/action/shutdown")
|
||||
ListenableFuture<Void> shutdownVApp(@EndpointParam URI href);
|
||||
|
||||
/**
|
||||
* @see VAppClient#resetVApp
|
||||
*/
|
||||
@POST
|
||||
@Consumes(TASK_XML)
|
||||
@Path("/power/action/reset")
|
||||
@XMLResponseParser(TaskHandler.class)
|
||||
ListenableFuture<Task> resetVApp(@EndpointParam URI href);
|
||||
|
||||
/**
|
||||
* @see VAppClient#rebootVApp
|
||||
*/
|
||||
@POST
|
||||
@Path("/power/action/reboot")
|
||||
ListenableFuture<Void> rebootVApp(@EndpointParam URI href);
|
||||
|
||||
/**
|
||||
* @see VAppClient#suspendVApp
|
||||
*/
|
||||
@POST
|
||||
@Consumes(TASK_XML)
|
||||
@Path("/power/action/suspend")
|
||||
@XMLResponseParser(TaskHandler.class)
|
||||
ListenableFuture<Task> suspendVApp(@EndpointParam URI href);
|
||||
|
||||
/**
|
||||
* @see VAppClient#deleteVApp
|
||||
*/
|
||||
@DELETE
|
||||
@Consumes(TASK_XML)
|
||||
@Fallback(VoidOnNotFoundOr404.class)
|
||||
@XMLResponseParser(TaskHandler.class)
|
||||
ListenableFuture<Task> deleteVApp(@EndpointParam URI href);
|
||||
|
||||
}
|
|
@ -30,8 +30,7 @@ import javax.ws.rs.Path;
|
|||
import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
|
||||
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
|
||||
import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
|
||||
import org.jclouds.Fallbacks;
|
||||
import org.jclouds.javax.annotation.Nullable;
|
||||
import org.jclouds.ovf.Envelope;
|
||||
import org.jclouds.ovf.xml.EnvelopeHandler;
|
||||
|
@ -62,16 +61,38 @@ import org.jclouds.vcloud.xml.VAppTemplateHandler;
|
|||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
/**
|
||||
* Provides access to VAppTemplate functionality in vCloud
|
||||
* Provides access to VApp Template functionality in vCloud
|
||||
* <p/>
|
||||
*
|
||||
* @see <a href="http://communities.vmware.com/community/developer/forums/vcloudapi" />
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@RequestFilters(AddVCloudAuthorizationAndCookieToRequest.class)
|
||||
public interface VAppTemplateAsyncClient {
|
||||
public interface VAppTemplateApi {
|
||||
/**
|
||||
* returns the vapp template corresponding to a catalog item in the catalog associated with the
|
||||
* specified name. Note that the org and catalog parameters can be null to choose default.
|
||||
*
|
||||
* @param orgName
|
||||
* organization name, or null for the default
|
||||
* @param catalogName
|
||||
* catalog name, or null for the default
|
||||
* @param itemName
|
||||
* item you wish to lookup
|
||||
*
|
||||
* @throws NoSuchElementException
|
||||
* if you specified an org, catalog, or catalog item name that isn't present
|
||||
*/
|
||||
@GET
|
||||
@Consumes(VAPPTEMPLATE_XML)
|
||||
@XMLResponseParser(VAppTemplateHandler.class)
|
||||
@Fallback(Fallbacks.NullOnNotFoundOr404.class)
|
||||
@MapBinder(OrgNameCatalogNameVAppTemplateNameToEndpoint.class)
|
||||
VAppTemplate findVAppTemplateInOrgCatalogNamed(@Nullable @PayloadParam("orgName") String orgName,
|
||||
@Nullable @PayloadParam("catalogName") String catalogName,
|
||||
@PayloadParam("itemName") String itemName);
|
||||
|
||||
/**
|
||||
* @see VAppTemplateClient#createVAppInVDCByInstantiatingTemplate
|
||||
*/
|
||||
@POST
|
||||
@Path("/action/instantiateVAppTemplate")
|
||||
|
@ -79,49 +100,20 @@ public interface VAppTemplateAsyncClient {
|
|||
@Consumes(VAPP_XML)
|
||||
@XMLResponseParser(VAppHandler.class)
|
||||
@MapBinder(BindInstantiateVAppTemplateParamsToXmlPayload.class)
|
||||
ListenableFuture<VApp> createVAppInVDCByInstantiatingTemplate(
|
||||
@PayloadParam("name") @ParamValidators(DnsNameValidator.class) String appName, @EndpointParam URI vdc,
|
||||
@PayloadParam("template") URI template, InstantiateVAppTemplateOptions... options);
|
||||
VApp createVAppInVDCByInstantiatingTemplate(
|
||||
@PayloadParam("name") @ParamValidators(DnsNameValidator.class) String appName, @EndpointParam URI vdc,
|
||||
@PayloadParam("template") URI template, InstantiateVAppTemplateOptions... options);
|
||||
|
||||
/**
|
||||
* @see VAppTemplateClient#getOvfEnvelopeForVAppTemplate
|
||||
*/
|
||||
@GET
|
||||
@Consumes(MediaType.TEXT_XML)
|
||||
@Path("/ovf")
|
||||
@XMLResponseParser(EnvelopeHandler.class)
|
||||
@Fallback(NullOnNotFoundOr404.class)
|
||||
ListenableFuture<Envelope> getOvfEnvelopeForVAppTemplate(@EndpointParam URI href);
|
||||
|
||||
/**
|
||||
* @see VAppTemplateClient#captureVAppAsTemplateInVDC
|
||||
*/
|
||||
@POST
|
||||
@Path("/action/captureVApp")
|
||||
@Produces("application/vnd.vmware.vcloud.captureVAppParams+xml")
|
||||
@Consumes(VAPPTEMPLATE_XML)
|
||||
@XMLResponseParser(VAppTemplateHandler.class)
|
||||
@MapBinder(BindCaptureVAppParamsToXmlPayload.class)
|
||||
ListenableFuture<VAppTemplate> captureVAppAsTemplateInVDC(@PayloadParam("vApp") URI toCapture,
|
||||
@PayloadParam("templateName") @ParamValidators(DnsNameValidator.class) String templateName,
|
||||
@EndpointParam URI vdc, CaptureVAppOptions... options);
|
||||
|
||||
/**
|
||||
* @see VAppTemplateClient#copyVAppTemplateToVDCAndName
|
||||
*/
|
||||
@POST
|
||||
@Path("/action/cloneVAppTemplate")
|
||||
@Produces("application/vnd.vmware.vcloud.cloneVAppTemplateParams+xml")
|
||||
@Consumes(TASK_XML)
|
||||
@XMLResponseParser(TaskHandler.class)
|
||||
@MapBinder(BindCloneVAppTemplateParamsToXmlPayload.class)
|
||||
ListenableFuture<Task> copyVAppTemplateToVDCAndName(@PayloadParam("Source") URI sourceVAppTemplate,
|
||||
@EndpointParam URI vdc, @PayloadParam("name") @ParamValidators(DnsNameValidator.class) String newName,
|
||||
CloneVAppTemplateOptions... options);
|
||||
Task copyVAppTemplateToVDCAndName(@PayloadParam("Source") URI sourceVAppTemplate,
|
||||
@EndpointParam URI vdc, @PayloadParam("name") @ParamValidators(DnsNameValidator.class) String newName,
|
||||
CloneVAppTemplateOptions... options);
|
||||
|
||||
/**
|
||||
* @see VAppTemplateClient#moveVAppTemplateToVDCAndRename
|
||||
*/
|
||||
@POST
|
||||
@Path("/action/cloneVAppTemplate")
|
||||
@Produces("application/vnd.vmware.vcloud.cloneVAppTemplateParams+xml")
|
||||
|
@ -129,37 +121,61 @@ public interface VAppTemplateAsyncClient {
|
|||
@XMLResponseParser(TaskHandler.class)
|
||||
@PayloadParams(keys = "IsSourceDelete", values = "true")
|
||||
@MapBinder(BindCloneVAppTemplateParamsToXmlPayload.class)
|
||||
ListenableFuture<Task> moveVAppTemplateToVDCAndRename(@PayloadParam("Source") URI toClone,
|
||||
@EndpointParam URI vdc, @PayloadParam("name") @ParamValidators(DnsNameValidator.class) String newName,
|
||||
CloneVAppTemplateOptions... options);
|
||||
Task moveVAppTemplateToVDCAndRename(@PayloadParam("Source") URI toClone,
|
||||
@EndpointParam URI vdc, @PayloadParam("name") @ParamValidators(DnsNameValidator.class) String newName,
|
||||
CloneVAppTemplateOptions... options);
|
||||
|
||||
/**
|
||||
* @see VAppTemplateClient#findVAppTemplateInOrgCatalogNamed
|
||||
* The captureVApp request creates a vApp template from an instantiated vApp. <h4>Note</h4>
|
||||
* Before it can be captured, a vApp must be undeployed
|
||||
*
|
||||
* @param targetVdcHref
|
||||
* @param sourceVAppHref
|
||||
* @param newTemplateName
|
||||
* @param options
|
||||
* @return template in progress
|
||||
*/
|
||||
@POST
|
||||
@Path("/action/captureVApp")
|
||||
@Produces("application/vnd.vmware.vcloud.captureVAppParams+xml")
|
||||
@Consumes(VAPPTEMPLATE_XML)
|
||||
@XMLResponseParser(VAppTemplateHandler.class)
|
||||
@MapBinder(BindCaptureVAppParamsToXmlPayload.class)
|
||||
VAppTemplate captureVAppAsTemplateInVDC(@PayloadParam("vApp") URI toCapture,
|
||||
@PayloadParam("templateName") @ParamValidators(DnsNameValidator.class) String templateName,
|
||||
@EndpointParam URI vdc, CaptureVAppOptions... options);
|
||||
|
||||
@GET
|
||||
@Consumes(VAPPTEMPLATE_XML)
|
||||
@XMLResponseParser(VAppTemplateHandler.class)
|
||||
@Fallback(NullOnNotFoundOr404.class)
|
||||
@MapBinder(OrgNameCatalogNameVAppTemplateNameToEndpoint.class)
|
||||
ListenableFuture<VAppTemplate> findVAppTemplateInOrgCatalogNamed(@Nullable @PayloadParam("orgName") String orgName,
|
||||
@Nullable @PayloadParam("catalogName") String catalogName, @PayloadParam("itemName") String itemName);
|
||||
@Fallback(Fallbacks.NullOnNotFoundOr404.class)
|
||||
VAppTemplate getVAppTemplate(@EndpointParam URI vAppTemplate);
|
||||
|
||||
/**
|
||||
* @see VAppTemplateClient#getVAppTemplate
|
||||
*/
|
||||
@GET
|
||||
@Consumes(VAPPTEMPLATE_XML)
|
||||
@XMLResponseParser(VAppTemplateHandler.class)
|
||||
@Fallback(NullOnNotFoundOr404.class)
|
||||
ListenableFuture<VAppTemplate> getVAppTemplate(@EndpointParam URI vAppTemplate);
|
||||
@Consumes(MediaType.TEXT_XML)
|
||||
@Path("/ovf")
|
||||
@XMLResponseParser(EnvelopeHandler.class)
|
||||
@Fallback(Fallbacks.NullOnNotFoundOr404.class)
|
||||
Envelope getOvfEnvelopeForVAppTemplate(@EndpointParam URI href);
|
||||
|
||||
/**
|
||||
* @see VAppTemplateClient#deleteVAppTemplate
|
||||
* delete a vAppTemplate, vApp, or media image. You cannot delete an object if it is in use. Any
|
||||
* object that is being copied or moved is in use. Other criteria that determine whether an
|
||||
* object is in use depend on the object type.
|
||||
* <ul>
|
||||
* <li>A vApptemplate is in use if it is being instantiated. After instantiation is complete, the
|
||||
* template is no longer in use.</li>
|
||||
* <li>A vApp is in use if it is deployed.</li>
|
||||
* <li>A media image is in use if it is inserted in a Vm.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param id
|
||||
* href of the vApp
|
||||
* @return task of the operation in progress
|
||||
*/
|
||||
@DELETE
|
||||
@Consumes(TASK_XML)
|
||||
@Fallback(VoidOnNotFoundOr404.class)
|
||||
@Fallback(Fallbacks.VoidOnNotFoundOr404.class)
|
||||
@XMLResponseParser(TaskHandler.class)
|
||||
ListenableFuture<Task> deleteVAppTemplate(@EndpointParam URI href);
|
||||
|
||||
Task deleteVAppTemplate(@EndpointParam URI href);
|
||||
}
|
|
@ -1,97 +0,0 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.jclouds.vcloud.features;
|
||||
|
||||
import java.net.URI;
|
||||
import org.jclouds.javax.annotation.Nullable;
|
||||
import org.jclouds.ovf.Envelope;
|
||||
import org.jclouds.vcloud.domain.Task;
|
||||
import org.jclouds.vcloud.domain.VApp;
|
||||
import org.jclouds.vcloud.domain.VAppTemplate;
|
||||
import org.jclouds.vcloud.options.CaptureVAppOptions;
|
||||
import org.jclouds.vcloud.options.CloneVAppTemplateOptions;
|
||||
import org.jclouds.vcloud.options.InstantiateVAppTemplateOptions;
|
||||
|
||||
/**
|
||||
* Provides access to VApp Template functionality in vCloud
|
||||
* <p/>
|
||||
*
|
||||
* @see <a href="http://communities.vmware.com/community/developer/forums/vcloudapi" />
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
public interface VAppTemplateClient {
|
||||
/**
|
||||
* returns the vapp template corresponding to a catalog item in the catalog associated with the
|
||||
* specified name. Note that the org and catalog parameters can be null to choose default.
|
||||
*
|
||||
* @param orgName
|
||||
* organization name, or null for the default
|
||||
* @param catalogName
|
||||
* catalog name, or null for the default
|
||||
* @param itemName
|
||||
* item you wish to lookup
|
||||
*
|
||||
* @throws NoSuchElementException
|
||||
* if you specified an org, catalog, or catalog item name that isn't present
|
||||
*/
|
||||
VAppTemplate findVAppTemplateInOrgCatalogNamed(@Nullable String orgName, @Nullable String catalogName, String itemName);
|
||||
|
||||
/**
|
||||
*/
|
||||
VApp createVAppInVDCByInstantiatingTemplate(String appName, URI vDC, URI template,
|
||||
InstantiateVAppTemplateOptions... options);
|
||||
|
||||
Task copyVAppTemplateToVDCAndName(URI sourceVAppTemplate, URI vDC, String newName,
|
||||
CloneVAppTemplateOptions... options);
|
||||
|
||||
Task moveVAppTemplateToVDCAndRename(URI sourceVAppTemplate, URI vDC, String newName,
|
||||
CloneVAppTemplateOptions... options);
|
||||
|
||||
/**
|
||||
* The captureVApp request creates a vApp template from an instantiated vApp. <h4>Note</h4>
|
||||
* Before it can be captured, a vApp must be undeployed
|
||||
*
|
||||
* @param targetVdcHref
|
||||
* @param sourceVAppHref
|
||||
* @param newTemplateName
|
||||
* @param options
|
||||
* @return template in progress
|
||||
*/
|
||||
VAppTemplate captureVAppAsTemplateInVDC(URI sourceVAppHref, String newTemplateName, URI targetVdcHref,
|
||||
CaptureVAppOptions... options);
|
||||
|
||||
VAppTemplate getVAppTemplate(URI vApp);
|
||||
|
||||
Envelope getOvfEnvelopeForVAppTemplate(URI vAppTemplate);
|
||||
|
||||
/**
|
||||
* delete a vAppTemplate, vApp, or media image. You cannot delete an object if it is in use. Any
|
||||
* object that is being copied or moved is in use. Other criteria that determine whether an
|
||||
* object is in use depend on the object type.
|
||||
* <ul>
|
||||
* <li>A vApptemplate is in use if it is being instantiated. After instantiation is complete, the
|
||||
* template is no longer in use.</li>
|
||||
* <li>A vApp is in use if it is deployed.</li>
|
||||
* <li>A media image is in use if it is inserted in a Vm.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param id
|
||||
* href of the vApp
|
||||
* @return task of the operation in progress
|
||||
*/
|
||||
Task deleteVAppTemplate(URI id);
|
||||
}
|
|
@ -23,7 +23,7 @@ import java.net.URI;
|
|||
import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.GET;
|
||||
|
||||
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
|
||||
import org.jclouds.Fallbacks;
|
||||
import org.jclouds.javax.annotation.Nullable;
|
||||
import org.jclouds.rest.annotations.EndpointParam;
|
||||
import org.jclouds.rest.annotations.Fallback;
|
||||
|
@ -45,25 +45,30 @@ import com.google.common.util.concurrent.ListenableFuture;
|
|||
* @author Adrian Cole
|
||||
*/
|
||||
@RequestFilters(AddVCloudAuthorizationAndCookieToRequest.class)
|
||||
public interface VDCAsyncClient {
|
||||
public interface VDCApi {
|
||||
@GET
|
||||
@XMLResponseParser(VDCHandler.class)
|
||||
@Consumes(VDC_XML)
|
||||
@Fallback(Fallbacks.NullOnNotFoundOr404.class)
|
||||
VDC getVDC(@EndpointParam URI vdc);
|
||||
|
||||
/**
|
||||
* @see VDCClient#getVDC(URI)
|
||||
* returns the VDC in the organization associated with the specified name. Note that both
|
||||
* parameters can be null to choose default.
|
||||
*
|
||||
* @param orgName
|
||||
* organization name, or null for the default
|
||||
* @param vdcName
|
||||
* catalog name, or null for the default
|
||||
* @throws NoSuchElementException
|
||||
* if you specified an org or vdc name that isn't present
|
||||
*/
|
||||
@GET
|
||||
@XMLResponseParser(VDCHandler.class)
|
||||
@Consumes(VDC_XML)
|
||||
@Fallback(NullOnNotFoundOr404.class)
|
||||
ListenableFuture<VDC> getVDC(@EndpointParam URI vdc);
|
||||
|
||||
/**
|
||||
* @see VDCClient#findVDCInOrgNamed(String, String)
|
||||
*/
|
||||
@GET
|
||||
@XMLResponseParser(VDCHandler.class)
|
||||
@Consumes(VDC_XML)
|
||||
@Fallback(NullOnNotFoundOr404.class)
|
||||
@Fallback(Fallbacks.NullOnNotFoundOr404.class)
|
||||
@MapBinder(OrgNameAndVDCNameToEndpoint.class)
|
||||
ListenableFuture<VDC> findVDCInOrgNamed(@Nullable @PayloadParam("orgName") String orgName,
|
||||
@Nullable @PayloadParam("vdcName") String vdcName);
|
||||
VDC findVDCInOrgNamed(@Nullable @PayloadParam("orgName") String orgName,
|
||||
@Nullable @PayloadParam("vdcName") String vdcName);
|
||||
|
||||
}
|
|
@ -1,44 +0,0 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.jclouds.vcloud.features;
|
||||
|
||||
import java.net.URI;
|
||||
import org.jclouds.vcloud.domain.VDC;
|
||||
|
||||
/**
|
||||
* Provides access to VDC functionality in vCloud
|
||||
* <p/>
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
public interface VDCClient {
|
||||
VDC getVDC(URI vdc);
|
||||
|
||||
/**
|
||||
* returns the VDC in the organization associated with the specified name. Note that both
|
||||
* parameters can be null to choose default.
|
||||
*
|
||||
* @param orgName
|
||||
* organization name, or null for the default
|
||||
* @param vdcName
|
||||
* catalog name, or null for the default
|
||||
* @throws NoSuchElementException
|
||||
* if you specified an org or vdc name that isn't present
|
||||
*/
|
||||
VDC findVDCInOrgNamed(String orgName, String vdcName);
|
||||
|
||||
}
|
|
@ -16,12 +16,47 @@
|
|||
*/
|
||||
package org.jclouds.vcloud.features;
|
||||
|
||||
import static org.jclouds.vcloud.VCloudMediaType.DEPLOYVAPPPARAMS_XML;
|
||||
import static org.jclouds.vcloud.VCloudMediaType.GUESTCUSTOMIZATIONSECTION_XML;
|
||||
import static org.jclouds.vcloud.VCloudMediaType.NETWORKCONNECTIONSECTION_XML;
|
||||
import static org.jclouds.vcloud.VCloudMediaType.RASDITEM_XML;
|
||||
import static org.jclouds.vcloud.VCloudMediaType.TASK_XML;
|
||||
import static org.jclouds.vcloud.VCloudMediaType.UNDEPLOYVAPPPARAMS_XML;
|
||||
import static org.jclouds.vcloud.VCloudMediaType.VM_XML;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.net.URI;
|
||||
|
||||
import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.POST;
|
||||
import javax.ws.rs.PUT;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.Produces;
|
||||
|
||||
import org.jclouds.Fallbacks;
|
||||
import org.jclouds.rest.annotations.BinderParam;
|
||||
import org.jclouds.rest.annotations.EndpointParam;
|
||||
import org.jclouds.rest.annotations.Fallback;
|
||||
import org.jclouds.rest.annotations.MapBinder;
|
||||
import org.jclouds.rest.annotations.PayloadParams;
|
||||
import org.jclouds.rest.annotations.RequestFilters;
|
||||
import org.jclouds.rest.annotations.XMLResponseParser;
|
||||
import org.jclouds.vcloud.binders.BindCPUCountToXmlPayload;
|
||||
import org.jclouds.vcloud.binders.BindDeployVAppParamsToXmlPayload;
|
||||
import org.jclouds.vcloud.binders.BindGuestCustomizationSectionToXmlPayload;
|
||||
import org.jclouds.vcloud.binders.BindMemoryToXmlPayload;
|
||||
import org.jclouds.vcloud.binders.BindNetworkConnectionSectionToXmlPayload;
|
||||
import org.jclouds.vcloud.binders.BindUndeployVAppParamsToXmlPayload;
|
||||
import org.jclouds.vcloud.domain.GuestCustomizationSection;
|
||||
import org.jclouds.vcloud.domain.NetworkConnectionSection;
|
||||
import org.jclouds.vcloud.domain.Task;
|
||||
import org.jclouds.vcloud.domain.Vm;
|
||||
import org.jclouds.vcloud.filters.AddVCloudAuthorizationAndCookieToRequest;
|
||||
import org.jclouds.vcloud.xml.TaskHandler;
|
||||
import org.jclouds.vcloud.xml.VmHandler;
|
||||
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
/**
|
||||
* Provides access to VM functionality in vCloud
|
||||
|
@ -29,9 +64,14 @@ import org.jclouds.vcloud.domain.Vm;
|
|||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
public interface VmClient {
|
||||
@RequestFilters(AddVCloudAuthorizationAndCookieToRequest.class)
|
||||
public interface VmApi {
|
||||
|
||||
Vm getVm(URI vApp);
|
||||
@GET
|
||||
@Consumes(VM_XML)
|
||||
@XMLResponseParser(VmHandler.class)
|
||||
@Fallback(Fallbacks.NullOnNotFoundOr404.class)
|
||||
Vm getVm(@EndpointParam URI href);
|
||||
|
||||
/**
|
||||
* To deploy a vApp, the client makes a request to its action/deploy URL. Deploying a vApp
|
||||
|
@ -40,13 +80,26 @@ public interface VmClient {
|
|||
* <p/>
|
||||
* Deploying a Vm implicitly deploys the parent vApp if that vApp is not already deployed.
|
||||
*/
|
||||
Task deployVm(URI href);
|
||||
@POST
|
||||
@Consumes(TASK_XML)
|
||||
@Produces(DEPLOYVAPPPARAMS_XML)
|
||||
@Path("/action/deploy")
|
||||
@MapBinder(BindDeployVAppParamsToXmlPayload.class)
|
||||
@XMLResponseParser(TaskHandler.class)
|
||||
Task deployVm(@EndpointParam URI href);
|
||||
|
||||
/**
|
||||
* like {@link #deploy(URI)}, except deploy transitions to power on state
|
||||
*
|
||||
*/
|
||||
Task deployAndPowerOnVm(URI href);
|
||||
@POST
|
||||
@Consumes(TASK_XML)
|
||||
@Produces(DEPLOYVAPPPARAMS_XML)
|
||||
@Path("/action/deploy")
|
||||
@MapBinder(BindDeployVAppParamsToXmlPayload.class)
|
||||
@PayloadParams(keys = "powerOn", values = "true")
|
||||
@XMLResponseParser(TaskHandler.class)
|
||||
Task deployAndPowerOnVm(@EndpointParam URI href);
|
||||
|
||||
/**
|
||||
* Undeploying a vApp powers off or suspends any running virtual machines it contains, then frees
|
||||
|
@ -61,14 +114,27 @@ public interface VmClient {
|
|||
* {@link #undeployAndSaveStateOf}
|
||||
*
|
||||
*/
|
||||
Task undeployVm(URI href);
|
||||
@POST
|
||||
@Consumes(TASK_XML)
|
||||
@Produces(UNDEPLOYVAPPPARAMS_XML)
|
||||
@Path("/action/undeploy")
|
||||
@MapBinder(BindUndeployVAppParamsToXmlPayload.class)
|
||||
@XMLResponseParser(TaskHandler.class)
|
||||
Task undeployVm(@EndpointParam URI href);
|
||||
|
||||
/**
|
||||
* like {@link #undeploy(URI)}, where the undeployed virtual machines are suspended and their
|
||||
* suspend state saved
|
||||
*
|
||||
*/
|
||||
Task undeployAndSaveStateOfVm(URI href);
|
||||
@POST
|
||||
@Consumes(TASK_XML)
|
||||
@Produces(UNDEPLOYVAPPPARAMS_XML)
|
||||
@Path("/action/undeploy")
|
||||
@MapBinder(BindUndeployVAppParamsToXmlPayload.class)
|
||||
@PayloadParams(keys = "saveState", values = "true")
|
||||
@XMLResponseParser(TaskHandler.class)
|
||||
Task undeployAndSaveStateOfVm(@EndpointParam URI href);
|
||||
|
||||
/**
|
||||
* A powerOn request to a vApp URL powers on all of the virtual machines in the vApp, as
|
||||
|
@ -80,7 +146,11 @@ public interface VmClient {
|
|||
* <h4>NOTE</h4> A powerOn request to a vApp or virtual machine that is undeployed forces
|
||||
* deployment.
|
||||
*/
|
||||
Task powerOnVm(URI href);
|
||||
@POST
|
||||
@Consumes(TASK_XML)
|
||||
@Path("/power/action/powerOn")
|
||||
@XMLResponseParser(TaskHandler.class)
|
||||
Task powerOnVm(@EndpointParam URI href);
|
||||
|
||||
/**
|
||||
* A powerOff request to a vApp URL powers off all of the virtual machines in the vApp, as
|
||||
|
@ -88,7 +158,11 @@ public interface VmClient {
|
|||
* <p/>
|
||||
* A powerOff request to a virtual machine URL powers off the specified virtual machine.
|
||||
*/
|
||||
Task powerOffVm(URI href);
|
||||
@POST
|
||||
@Consumes(TASK_XML)
|
||||
@Path("/power/action/powerOff")
|
||||
@XMLResponseParser(TaskHandler.class)
|
||||
Task powerOffVm(@EndpointParam URI href);
|
||||
|
||||
/**
|
||||
* A shutdown request to a vApp URL shuts down all of the virtual machines in the vApp, as
|
||||
|
@ -99,7 +173,9 @@ public interface VmClient {
|
|||
* <h4>NOTE</h4Because this request sends a signal to the guest OS, the vCloud API cannot track
|
||||
* the progress or verify the result of the requested operation. Hence, void is returned
|
||||
*/
|
||||
void shutdownVm(URI href);
|
||||
@POST
|
||||
@Path("/power/action/shutdown")
|
||||
void shutdownVm(@EndpointParam URI href);
|
||||
|
||||
/**
|
||||
* A reset request to a vApp URL resets all of the virtual machines in the vApp, as specified in
|
||||
|
@ -107,7 +183,11 @@ public interface VmClient {
|
|||
* <p/>
|
||||
* A reset request to a virtual machine URL resets the specified virtual machine.
|
||||
*/
|
||||
Task resetVm(URI href);
|
||||
@POST
|
||||
@Consumes(TASK_XML)
|
||||
@Path("/power/action/reset")
|
||||
@XMLResponseParser(TaskHandler.class)
|
||||
Task resetVm(@EndpointParam URI href);
|
||||
|
||||
/**
|
||||
* A reboot request to a vApp URL reboots all of the virtual machines in the vApp, as specified
|
||||
|
@ -118,7 +198,9 @@ public interface VmClient {
|
|||
* <h4>NOTE</h4> Because this request sends a signal to the guest OS, the vCloud API cannot track
|
||||
* the progress or verify the result of the requested operation. Hence, void is returned
|
||||
*/
|
||||
void rebootVm(URI href);
|
||||
@POST
|
||||
@Path("/power/action/reboot")
|
||||
void rebootVm(@EndpointParam URI href);
|
||||
|
||||
/**
|
||||
* A suspend request to a vApp URL suspends all of the virtual machines in the vApp, as specified
|
||||
|
@ -126,7 +208,11 @@ public interface VmClient {
|
|||
* <p/>
|
||||
* A suspend request to a virtual machine URL suspends the specified virtual machine.
|
||||
*/
|
||||
Task suspendVm(URI href);
|
||||
@POST
|
||||
@Consumes(TASK_XML)
|
||||
@Path("/power/action/suspend")
|
||||
@XMLResponseParser(TaskHandler.class)
|
||||
Task suspendVm(@EndpointParam URI href);
|
||||
|
||||
/**
|
||||
* Get a Screen Thumbnail for a Virtual Machine
|
||||
|
@ -134,7 +220,11 @@ public interface VmClient {
|
|||
* @param href
|
||||
* to snapshot
|
||||
*/
|
||||
InputStream getScreenThumbnailForVm(URI href);
|
||||
@GET
|
||||
@Path("/screen")
|
||||
@Consumes("image/png")
|
||||
@Fallback(Fallbacks.NullOnNotFoundOr404.class)
|
||||
InputStream getScreenThumbnailForVm(@EndpointParam URI vm);
|
||||
|
||||
/**
|
||||
* Modify the Guest Customization Section of a Virtual Machine
|
||||
|
@ -145,7 +235,14 @@ public interface VmClient {
|
|||
* guestCustomizationSection
|
||||
* @return task in progress
|
||||
*/
|
||||
Task updateGuestCustomizationOfVm(GuestCustomizationSection guestCustomizationSection, URI href);
|
||||
@PUT
|
||||
@Consumes(TASK_XML)
|
||||
@Produces(GUESTCUSTOMIZATIONSECTION_XML)
|
||||
@Path("/guestCustomizationSection")
|
||||
@XMLResponseParser(TaskHandler.class)
|
||||
Task updateGuestCustomizationOfVm(
|
||||
@BinderParam(BindGuestCustomizationSectionToXmlPayload.class) GuestCustomizationSection guestCustomizationSection,
|
||||
@EndpointParam URI href);
|
||||
|
||||
/**
|
||||
* Modify the Network Connection Section of a Virtual Machine
|
||||
|
@ -156,7 +253,14 @@ public interface VmClient {
|
|||
* networkConnectionSection
|
||||
* @return task in progress
|
||||
*/
|
||||
Task updateNetworkConnectionOfVm(NetworkConnectionSection guestCustomizationSection, URI href);
|
||||
@PUT
|
||||
@Consumes(TASK_XML)
|
||||
@Produces(NETWORKCONNECTIONSECTION_XML)
|
||||
@Path("/networkConnectionSection")
|
||||
@XMLResponseParser(TaskHandler.class)
|
||||
Task updateNetworkConnectionOfVm(
|
||||
@BinderParam(BindNetworkConnectionSectionToXmlPayload.class) NetworkConnectionSection networkConnectionSection,
|
||||
@EndpointParam URI href);
|
||||
|
||||
/**
|
||||
* update the cpuCount of an existing VM
|
||||
|
@ -166,7 +270,13 @@ public interface VmClient {
|
|||
* @param cpuCount
|
||||
* count to change the primary cpu to
|
||||
*/
|
||||
Task updateCPUCountOfVm(int cpuCount, URI href);
|
||||
@PUT
|
||||
@Consumes(TASK_XML)
|
||||
@Produces(RASDITEM_XML)
|
||||
@Path("/virtualHardwareSection/cpu")
|
||||
@XMLResponseParser(TaskHandler.class)
|
||||
Task updateCPUCountOfVm(@BinderParam(BindCPUCountToXmlPayload.class) int cpuCount,
|
||||
@EndpointParam URI href);
|
||||
|
||||
/**
|
||||
* update the memoryInMB of an existing VM
|
||||
|
@ -176,5 +286,11 @@ public interface VmClient {
|
|||
* @param memoryInMB
|
||||
* memory in MB to assign to the VM
|
||||
*/
|
||||
Task updateMemoryMBOfVm(int memoryInMB, URI href);
|
||||
@PUT
|
||||
@Consumes(TASK_XML)
|
||||
@Produces(RASDITEM_XML)
|
||||
@Path("/virtualHardwareSection/memory")
|
||||
@XMLResponseParser(TaskHandler.class)
|
||||
Task updateMemoryMBOfVm(@BinderParam(BindMemoryToXmlPayload.class) int memoryInMB,
|
||||
@EndpointParam URI href);
|
||||
}
|
|
@ -1,230 +0,0 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.jclouds.vcloud.features;
|
||||
|
||||
import static org.jclouds.vcloud.VCloudMediaType.DEPLOYVAPPPARAMS_XML;
|
||||
import static org.jclouds.vcloud.VCloudMediaType.GUESTCUSTOMIZATIONSECTION_XML;
|
||||
import static org.jclouds.vcloud.VCloudMediaType.NETWORKCONNECTIONSECTION_XML;
|
||||
import static org.jclouds.vcloud.VCloudMediaType.RASDITEM_XML;
|
||||
import static org.jclouds.vcloud.VCloudMediaType.TASK_XML;
|
||||
import static org.jclouds.vcloud.VCloudMediaType.UNDEPLOYVAPPPARAMS_XML;
|
||||
import static org.jclouds.vcloud.VCloudMediaType.VM_XML;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.net.URI;
|
||||
|
||||
import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.POST;
|
||||
import javax.ws.rs.PUT;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.Produces;
|
||||
|
||||
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
|
||||
import org.jclouds.rest.annotations.BinderParam;
|
||||
import org.jclouds.rest.annotations.EndpointParam;
|
||||
import org.jclouds.rest.annotations.Fallback;
|
||||
import org.jclouds.rest.annotations.MapBinder;
|
||||
import org.jclouds.rest.annotations.PayloadParams;
|
||||
import org.jclouds.rest.annotations.RequestFilters;
|
||||
import org.jclouds.rest.annotations.XMLResponseParser;
|
||||
import org.jclouds.vcloud.binders.BindCPUCountToXmlPayload;
|
||||
import org.jclouds.vcloud.binders.BindDeployVAppParamsToXmlPayload;
|
||||
import org.jclouds.vcloud.binders.BindGuestCustomizationSectionToXmlPayload;
|
||||
import org.jclouds.vcloud.binders.BindMemoryToXmlPayload;
|
||||
import org.jclouds.vcloud.binders.BindNetworkConnectionSectionToXmlPayload;
|
||||
import org.jclouds.vcloud.binders.BindUndeployVAppParamsToXmlPayload;
|
||||
import org.jclouds.vcloud.domain.GuestCustomizationSection;
|
||||
import org.jclouds.vcloud.domain.NetworkConnectionSection;
|
||||
import org.jclouds.vcloud.domain.Task;
|
||||
import org.jclouds.vcloud.domain.Vm;
|
||||
import org.jclouds.vcloud.filters.AddVCloudAuthorizationAndCookieToRequest;
|
||||
import org.jclouds.vcloud.xml.TaskHandler;
|
||||
import org.jclouds.vcloud.xml.VmHandler;
|
||||
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
/**
|
||||
* Provides access to Vm functionality in vCloud
|
||||
* <p/>
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@RequestFilters(AddVCloudAuthorizationAndCookieToRequest.class)
|
||||
public interface VmAsyncClient {
|
||||
|
||||
/**
|
||||
* @see VmClient#getVm
|
||||
*/
|
||||
@GET
|
||||
@Consumes(VM_XML)
|
||||
@XMLResponseParser(VmHandler.class)
|
||||
@Fallback(NullOnNotFoundOr404.class)
|
||||
ListenableFuture<Vm> getVm(@EndpointParam URI href);
|
||||
|
||||
/**
|
||||
* @see VmClient#deployVm
|
||||
*/
|
||||
@POST
|
||||
@Consumes(TASK_XML)
|
||||
@Produces(DEPLOYVAPPPARAMS_XML)
|
||||
@Path("/action/deploy")
|
||||
@MapBinder(BindDeployVAppParamsToXmlPayload.class)
|
||||
@XMLResponseParser(TaskHandler.class)
|
||||
ListenableFuture<Task> deployVm(@EndpointParam URI href);
|
||||
|
||||
/**
|
||||
* @see VmClient#deployAndPowerOnVm
|
||||
*/
|
||||
@POST
|
||||
@Consumes(TASK_XML)
|
||||
@Produces(DEPLOYVAPPPARAMS_XML)
|
||||
@Path("/action/deploy")
|
||||
@MapBinder(BindDeployVAppParamsToXmlPayload.class)
|
||||
@PayloadParams(keys = "powerOn", values = "true")
|
||||
@XMLResponseParser(TaskHandler.class)
|
||||
ListenableFuture<Task> deployAndPowerOnVm(@EndpointParam URI href);
|
||||
|
||||
/**
|
||||
* @see VmClient#undeployVm
|
||||
*/
|
||||
@POST
|
||||
@Consumes(TASK_XML)
|
||||
@Produces(UNDEPLOYVAPPPARAMS_XML)
|
||||
@Path("/action/undeploy")
|
||||
@MapBinder(BindUndeployVAppParamsToXmlPayload.class)
|
||||
@XMLResponseParser(TaskHandler.class)
|
||||
ListenableFuture<Task> undeployVm(@EndpointParam URI href);
|
||||
|
||||
/**
|
||||
* @see VmClient#undeployAndSaveStateOfVm
|
||||
*/
|
||||
@POST
|
||||
@Consumes(TASK_XML)
|
||||
@Produces(UNDEPLOYVAPPPARAMS_XML)
|
||||
@Path("/action/undeploy")
|
||||
@MapBinder(BindUndeployVAppParamsToXmlPayload.class)
|
||||
@PayloadParams(keys = "saveState", values = "true")
|
||||
@XMLResponseParser(TaskHandler.class)
|
||||
ListenableFuture<Task> undeployAndSaveStateOfVm(@EndpointParam URI href);
|
||||
|
||||
/**
|
||||
* @see VmClient#powerOnVm
|
||||
*/
|
||||
@POST
|
||||
@Consumes(TASK_XML)
|
||||
@Path("/power/action/powerOn")
|
||||
@XMLResponseParser(TaskHandler.class)
|
||||
ListenableFuture<Task> powerOnVm(@EndpointParam URI href);
|
||||
|
||||
/**
|
||||
* @see VmClient#powerOffVm
|
||||
*/
|
||||
@POST
|
||||
@Consumes(TASK_XML)
|
||||
@Path("/power/action/powerOff")
|
||||
@XMLResponseParser(TaskHandler.class)
|
||||
ListenableFuture<Task> powerOffVm(@EndpointParam URI href);
|
||||
|
||||
/**
|
||||
* @see VmClient#shutdownVm
|
||||
*/
|
||||
@POST
|
||||
@Path("/power/action/shutdown")
|
||||
ListenableFuture<Void> shutdownVm(@EndpointParam URI href);
|
||||
|
||||
/**
|
||||
* @see VmClient#resetVm
|
||||
*/
|
||||
@POST
|
||||
@Consumes(TASK_XML)
|
||||
@Path("/power/action/reset")
|
||||
@XMLResponseParser(TaskHandler.class)
|
||||
ListenableFuture<Task> resetVm(@EndpointParam URI href);
|
||||
|
||||
/**
|
||||
* @see VmClient#rebootVm
|
||||
*/
|
||||
@POST
|
||||
@Path("/power/action/reboot")
|
||||
ListenableFuture<Void> rebootVm(@EndpointParam URI href);
|
||||
|
||||
/**
|
||||
* @see VmClient#suspendVm
|
||||
*/
|
||||
@POST
|
||||
@Consumes(TASK_XML)
|
||||
@Path("/power/action/suspend")
|
||||
@XMLResponseParser(TaskHandler.class)
|
||||
ListenableFuture<Task> suspendVm(@EndpointParam URI href);
|
||||
|
||||
/**
|
||||
* @see VmClient#updateCPUCountOfVm
|
||||
*/
|
||||
@PUT
|
||||
@Consumes(TASK_XML)
|
||||
@Produces(RASDITEM_XML)
|
||||
@Path("/virtualHardwareSection/cpu")
|
||||
@XMLResponseParser(TaskHandler.class)
|
||||
ListenableFuture<Task> updateCPUCountOfVm(@BinderParam(BindCPUCountToXmlPayload.class) int cpuCount,
|
||||
@EndpointParam URI href);
|
||||
|
||||
/**
|
||||
* @see VmClient#updateMemoryMBOfVm
|
||||
*/
|
||||
@PUT
|
||||
@Consumes(TASK_XML)
|
||||
@Produces(RASDITEM_XML)
|
||||
@Path("/virtualHardwareSection/memory")
|
||||
@XMLResponseParser(TaskHandler.class)
|
||||
ListenableFuture<Task> updateMemoryMBOfVm(@BinderParam(BindMemoryToXmlPayload.class) int memoryInMB,
|
||||
@EndpointParam URI href);
|
||||
|
||||
/**
|
||||
* @see VmClient#updateGuestCustomizationOfVm
|
||||
*/
|
||||
@PUT
|
||||
@Consumes(TASK_XML)
|
||||
@Produces(GUESTCUSTOMIZATIONSECTION_XML)
|
||||
@Path("/guestCustomizationSection")
|
||||
@XMLResponseParser(TaskHandler.class)
|
||||
ListenableFuture<Task> updateGuestCustomizationOfVm(
|
||||
@BinderParam(BindGuestCustomizationSectionToXmlPayload.class) GuestCustomizationSection guestCustomizationSection,
|
||||
@EndpointParam URI href);
|
||||
|
||||
/**
|
||||
* @see VmClient#updateNetworkConnectionOfVm
|
||||
*/
|
||||
@PUT
|
||||
@Consumes(TASK_XML)
|
||||
@Produces(NETWORKCONNECTIONSECTION_XML)
|
||||
@Path("/networkConnectionSection")
|
||||
@XMLResponseParser(TaskHandler.class)
|
||||
ListenableFuture<Task> updateNetworkConnectionOfVm(
|
||||
@BinderParam(BindNetworkConnectionSectionToXmlPayload.class) NetworkConnectionSection networkConnectionSection,
|
||||
@EndpointParam URI href);
|
||||
|
||||
/**
|
||||
*
|
||||
* @see VmClient#getScreenThumbnailForVm
|
||||
*/
|
||||
@GET
|
||||
@Path("/screen")
|
||||
@Consumes("image/png")
|
||||
@Fallback(NullOnNotFoundOr404.class)
|
||||
ListenableFuture<InputStream> getScreenThumbnailForVm(@EndpointParam URI vm);
|
||||
}
|
|
@ -17,16 +17,14 @@
|
|||
package org.jclouds.vcloud.functions;
|
||||
|
||||
import static com.google.common.collect.Iterables.filter;
|
||||
import static org.jclouds.concurrent.FutureIterables.transformParallel;
|
||||
import static com.google.common.collect.Iterables.transform;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import org.jclouds.Constants;
|
||||
import org.jclouds.logging.Logger;
|
||||
import org.jclouds.vcloud.VCloudAsyncClient;
|
||||
import org.jclouds.vcloud.VCloudApi;
|
||||
import org.jclouds.vcloud.VCloudMediaType;
|
||||
import org.jclouds.vcloud.domain.Catalog;
|
||||
import org.jclouds.vcloud.domain.CatalogItem;
|
||||
|
@ -34,8 +32,6 @@ import org.jclouds.vcloud.domain.ReferenceType;
|
|||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
import com.google.common.util.concurrent.ListeningExecutorService;
|
||||
|
||||
/**
|
||||
* @author Adrian Cole
|
||||
|
@ -45,26 +41,24 @@ public class CatalogItemsInCatalog implements Function<Catalog, Iterable<Catalog
|
|||
@Resource
|
||||
public Logger logger = Logger.NULL;
|
||||
|
||||
private final VCloudAsyncClient aclient;
|
||||
private final ListeningExecutorService userExecutor;
|
||||
private final VCloudApi aclient;
|
||||
|
||||
@Inject
|
||||
CatalogItemsInCatalog(VCloudAsyncClient aclient, @Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor) {
|
||||
CatalogItemsInCatalog(VCloudApi aclient) {
|
||||
this.aclient = aclient;
|
||||
this.userExecutor = userExecutor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<CatalogItem> apply(Catalog from) {
|
||||
return transformParallel(filter(from.values(), new Predicate<ReferenceType>() {
|
||||
return transform(filter(from.values(), new Predicate<ReferenceType>() {
|
||||
public boolean apply(ReferenceType input) {
|
||||
return input.getType().equals(VCloudMediaType.CATALOGITEM_XML);
|
||||
}
|
||||
}), new Function<ReferenceType, ListenableFuture<? extends CatalogItem>>() {
|
||||
public ListenableFuture<CatalogItem> apply(ReferenceType from) {
|
||||
}), new Function<ReferenceType, CatalogItem>() {
|
||||
public CatalogItem apply(ReferenceType from) {
|
||||
return aclient.getCatalogClient().getCatalogItem(from.getHref());
|
||||
}
|
||||
}, userExecutor, null, logger, "catalogItems in " + from.getHref());
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -16,23 +16,19 @@
|
|||
*/
|
||||
package org.jclouds.vcloud.functions;
|
||||
|
||||
import static org.jclouds.concurrent.FutureIterables.transformParallel;
|
||||
import static com.google.common.collect.Iterables.transform;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import org.jclouds.Constants;
|
||||
import org.jclouds.logging.Logger;
|
||||
import org.jclouds.vcloud.VCloudAsyncClient;
|
||||
import org.jclouds.vcloud.VCloudApi;
|
||||
import org.jclouds.vcloud.domain.Catalog;
|
||||
import org.jclouds.vcloud.domain.Org;
|
||||
import org.jclouds.vcloud.domain.ReferenceType;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
import com.google.common.util.concurrent.ListeningExecutorService;
|
||||
|
||||
/**
|
||||
* @author Adrian Cole
|
||||
|
@ -42,21 +38,19 @@ public class CatalogsInOrg implements Function<Org, Iterable<Catalog>> {
|
|||
@Resource
|
||||
public Logger logger = Logger.NULL;
|
||||
|
||||
private final VCloudAsyncClient aclient;
|
||||
private final ListeningExecutorService userExecutor;
|
||||
private final VCloudApi aclient;
|
||||
|
||||
@Inject
|
||||
CatalogsInOrg(VCloudAsyncClient aclient, @Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor) {
|
||||
CatalogsInOrg(VCloudApi aclient) {
|
||||
this.aclient = aclient;
|
||||
this.userExecutor = userExecutor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<Catalog> apply(final Org org) {
|
||||
return transformParallel(org.getCatalogs().values(), new Function<ReferenceType, ListenableFuture<? extends Catalog>>() {
|
||||
public ListenableFuture<Catalog> apply(ReferenceType from) {
|
||||
return transform(org.getCatalogs().values(), new Function<ReferenceType, Catalog>() {
|
||||
public Catalog apply(ReferenceType from) {
|
||||
return aclient.getCatalogClient().getCatalog(from.getHref());
|
||||
}
|
||||
}, userExecutor, null, logger, "catalogs in " + org.getName());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,23 +16,19 @@
|
|||
*/
|
||||
package org.jclouds.vcloud.functions;
|
||||
|
||||
import static org.jclouds.concurrent.FutureIterables.transformParallel;
|
||||
import static com.google.common.collect.Iterables.transform;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import org.jclouds.Constants;
|
||||
import org.jclouds.logging.Logger;
|
||||
import org.jclouds.vcloud.VCloudAsyncClient;
|
||||
import org.jclouds.vcloud.VCloudApi;
|
||||
import org.jclouds.vcloud.domain.Org;
|
||||
import org.jclouds.vcloud.domain.ReferenceType;
|
||||
import org.jclouds.vcloud.domain.network.OrgNetwork;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
import com.google.common.util.concurrent.ListeningExecutorService;
|
||||
|
||||
/**
|
||||
* @author Adrian Cole
|
||||
|
@ -42,22 +38,20 @@ public class NetworksInOrg implements Function<Org, Iterable<OrgNetwork>> {
|
|||
@Resource
|
||||
public Logger logger = Logger.NULL;
|
||||
|
||||
private final VCloudAsyncClient aclient;
|
||||
private final ListeningExecutorService userExecutor;
|
||||
private final VCloudApi aclient;
|
||||
|
||||
@Inject
|
||||
NetworksInOrg(VCloudAsyncClient aclient, @Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor) {
|
||||
NetworksInOrg(VCloudApi aclient) {
|
||||
this.aclient = aclient;
|
||||
this.userExecutor = userExecutor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<OrgNetwork> apply(final Org org) {
|
||||
return transformParallel(org.getNetworks().values(), new Function<ReferenceType, ListenableFuture<? extends OrgNetwork>>() {
|
||||
public ListenableFuture<? extends OrgNetwork> apply(ReferenceType from) {
|
||||
return transform(org.getNetworks().values(), new Function<ReferenceType, OrgNetwork>() {
|
||||
public OrgNetwork apply(ReferenceType from) {
|
||||
return aclient.getNetworkClient().getNetwork(from.getHref());
|
||||
}
|
||||
}, userExecutor, null, logger, "OrgNetworks in org " + org.getName());
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -16,27 +16,23 @@
|
|||
*/
|
||||
package org.jclouds.vcloud.functions;
|
||||
|
||||
import static org.jclouds.concurrent.FutureIterables.transformParallel;
|
||||
import static com.google.common.collect.Iterables.transform;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import org.jclouds.Constants;
|
||||
import org.jclouds.domain.Location;
|
||||
import org.jclouds.domain.LocationScope;
|
||||
import org.jclouds.logging.Logger;
|
||||
import org.jclouds.vcloud.VCloudAsyncClient;
|
||||
import org.jclouds.vcloud.VCloudApi;
|
||||
import org.jclouds.vcloud.domain.Org;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.collect.FluentIterable;
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
import com.google.common.util.concurrent.ListeningExecutorService;
|
||||
|
||||
/**
|
||||
* @author Adrian Cole
|
||||
|
@ -45,13 +41,11 @@ import com.google.common.util.concurrent.ListeningExecutorService;
|
|||
public class OrgsForLocations implements Function<Iterable<Location>, Iterable<Org>> {
|
||||
@Resource
|
||||
public Logger logger = Logger.NULL;
|
||||
private final VCloudAsyncClient aclient;
|
||||
private final ListeningExecutorService userExecutor;
|
||||
private final VCloudApi aclient;
|
||||
|
||||
@Inject
|
||||
OrgsForLocations(VCloudAsyncClient aclient, @Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor) {
|
||||
OrgsForLocations(VCloudApi aclient) {
|
||||
this.aclient = aclient;
|
||||
this.userExecutor = userExecutor;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -69,11 +63,11 @@ public class OrgsForLocations implements Function<Iterable<Location>, Iterable<O
|
|||
return URI.create(from.getParent().getId());
|
||||
}
|
||||
});
|
||||
return transformParallel(uris, new Function<URI, ListenableFuture<? extends Org>>() {
|
||||
public ListenableFuture<Org> apply(URI from) {
|
||||
return transform(uris, new Function<URI, Org>() {
|
||||
public Org apply(URI from) {
|
||||
return aclient.getOrgClient().getOrg(from);
|
||||
}
|
||||
}, userExecutor, null, logger, "organizations for uris");
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -16,23 +16,19 @@
|
|||
*/
|
||||
package org.jclouds.vcloud.functions;
|
||||
|
||||
import static org.jclouds.concurrent.FutureIterables.transformParallel;
|
||||
import static com.google.common.collect.Iterables.transform;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import org.jclouds.Constants;
|
||||
import org.jclouds.logging.Logger;
|
||||
import org.jclouds.vcloud.VCloudAsyncClient;
|
||||
import org.jclouds.vcloud.VCloudApi;
|
||||
import org.jclouds.vcloud.domain.Org;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.base.Predicates;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
import com.google.common.util.concurrent.ListeningExecutorService;
|
||||
|
||||
/**
|
||||
* @author Adrian Cole
|
||||
|
@ -41,22 +37,20 @@ import com.google.common.util.concurrent.ListeningExecutorService;
|
|||
public class OrgsForNames implements Function<Iterable<String>, Iterable<Org>> {
|
||||
@Resource
|
||||
public Logger logger = Logger.NULL;
|
||||
private final VCloudAsyncClient aclient;
|
||||
private final ListeningExecutorService userExecutor;
|
||||
private final VCloudApi aclient;
|
||||
|
||||
@Inject
|
||||
OrgsForNames(VCloudAsyncClient aclient, @Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor) {
|
||||
OrgsForNames(VCloudApi aclient) {
|
||||
this.aclient = aclient;
|
||||
this.userExecutor = userExecutor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<Org> apply(Iterable<String> from) {
|
||||
return Iterables.filter(transformParallel(from, new Function<String, ListenableFuture<? extends Org>>() {
|
||||
public ListenableFuture<Org> apply(String from) {
|
||||
return Iterables.filter(transform(from, new Function<String, Org>() {
|
||||
public Org apply(String from) {
|
||||
return aclient.getOrgClient().findOrgNamed(from);
|
||||
}
|
||||
}, userExecutor, null, logger, "organizations for names"), Predicates.notNull());
|
||||
}), Predicates.notNull());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -17,8 +17,7 @@
|
|||
package org.jclouds.vcloud.functions;
|
||||
|
||||
import static com.google.common.collect.Iterables.filter;
|
||||
import static org.jclouds.Constants.PROPERTY_USER_THREADS;
|
||||
import static org.jclouds.concurrent.FutureIterables.transformParallel;
|
||||
import static com.google.common.collect.Iterables.transform;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.inject.Inject;
|
||||
|
@ -27,7 +26,7 @@ import javax.inject.Singleton;
|
|||
|
||||
import org.jclouds.compute.reference.ComputeServiceConstants;
|
||||
import org.jclouds.logging.Logger;
|
||||
import org.jclouds.vcloud.VCloudAsyncClient;
|
||||
import org.jclouds.vcloud.VCloudApi;
|
||||
import org.jclouds.vcloud.VCloudMediaType;
|
||||
import org.jclouds.vcloud.domain.CatalogItem;
|
||||
import org.jclouds.vcloud.domain.VAppTemplate;
|
||||
|
@ -35,8 +34,6 @@ import org.jclouds.vcloud.domain.VAppTemplate;
|
|||
import com.google.common.base.Function;
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.base.Predicates;
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
import com.google.common.util.concurrent.ListeningExecutorService;
|
||||
|
||||
/**
|
||||
* @author Adrian Cole
|
||||
|
@ -46,27 +43,24 @@ public class VAppTemplatesForCatalogItems implements Function<Iterable<CatalogIt
|
|||
@Resource
|
||||
@Named(ComputeServiceConstants.COMPUTE_LOGGER)
|
||||
private Logger logger = Logger.NULL;
|
||||
private final VCloudAsyncClient aclient;
|
||||
private final ListeningExecutorService userExecutor;
|
||||
|
||||
private final VCloudApi aclient;
|
||||
|
||||
@Inject
|
||||
VAppTemplatesForCatalogItems(VCloudAsyncClient aclient, @Named(PROPERTY_USER_THREADS) ListeningExecutorService userExecutor) {
|
||||
VAppTemplatesForCatalogItems(VCloudApi aclient) {
|
||||
this.aclient = aclient;
|
||||
this.userExecutor = userExecutor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<VAppTemplate> apply(Iterable<CatalogItem> from) {
|
||||
return filter(transformParallel(filter(from, new Predicate<CatalogItem>() {
|
||||
return filter(transform(filter(from, new Predicate<CatalogItem>() {
|
||||
public boolean apply(CatalogItem input) {
|
||||
return input.getEntity().getType().equals(VCloudMediaType.VAPPTEMPLATE_XML);
|
||||
}
|
||||
}), new Function<CatalogItem, ListenableFuture<? extends VAppTemplate>>() {
|
||||
public ListenableFuture<VAppTemplate> apply(CatalogItem from) {
|
||||
}), new Function<CatalogItem, VAppTemplate>() {
|
||||
public VAppTemplate apply(CatalogItem from) {
|
||||
return aclient.getVAppTemplateClient().getVAppTemplate(from.getEntity().getHref());
|
||||
}
|
||||
}, userExecutor, null, logger, "vappTemplates in"), Predicates.notNull());
|
||||
}), Predicates.notNull());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -16,23 +16,19 @@
|
|||
*/
|
||||
package org.jclouds.vcloud.functions;
|
||||
|
||||
import static org.jclouds.concurrent.FutureIterables.transformParallel;
|
||||
import static com.google.common.collect.Iterables.transform;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import org.jclouds.Constants;
|
||||
import org.jclouds.logging.Logger;
|
||||
import org.jclouds.vcloud.VCloudAsyncClient;
|
||||
import org.jclouds.vcloud.VCloudApi;
|
||||
import org.jclouds.vcloud.domain.Org;
|
||||
import org.jclouds.vcloud.domain.ReferenceType;
|
||||
import org.jclouds.vcloud.domain.VDC;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
import com.google.common.util.concurrent.ListeningExecutorService;
|
||||
|
||||
/**
|
||||
* @author Adrian Cole
|
||||
|
@ -42,22 +38,20 @@ public class VDCsInOrg implements Function<Org, Iterable<VDC>> {
|
|||
@Resource
|
||||
public Logger logger = Logger.NULL;
|
||||
|
||||
private final VCloudAsyncClient aclient;
|
||||
private final ListeningExecutorService userExecutor;
|
||||
private final VCloudApi aclient;
|
||||
|
||||
@Inject
|
||||
VDCsInOrg(VCloudAsyncClient aclient, @Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor) {
|
||||
VDCsInOrg(VCloudApi aclient) {
|
||||
this.aclient = aclient;
|
||||
this.userExecutor = userExecutor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<VDC> apply(final Org org) {
|
||||
return transformParallel(org.getVDCs().values(), new Function<ReferenceType, ListenableFuture<? extends VDC>>() {
|
||||
public ListenableFuture<? extends VDC> apply(ReferenceType from) {
|
||||
return transform(org.getVDCs().values(), new Function<ReferenceType, VDC>() {
|
||||
public VDC apply(ReferenceType from) {
|
||||
return aclient.getVDCClient().getVDC(from.getHref());
|
||||
}
|
||||
}, userExecutor, null, logger, "vdcs in org " + org.getName());
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -29,18 +29,9 @@ import org.jclouds.vcloud.VCloudMediaType;
|
|||
import org.jclouds.vcloud.domain.VCloudSession;
|
||||
import org.jclouds.vcloud.functions.ParseLoginResponseFromHeaders;
|
||||
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
/**
|
||||
* Establishes a context with a VCloud endpoint.
|
||||
* <p/>
|
||||
*
|
||||
* @see <a href="https://community.vcloudexpress.terremark.com/en-us/discussion_forums/f/60.aspx" />
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Endpoint(org.jclouds.vcloud.endpoints.VCloudLogin.class)
|
||||
@RequestFilters(BasicAuthentication.class)
|
||||
public interface VCloudLoginAsyncClient extends Closeable {
|
||||
public interface VCloudLoginApi extends Closeable {
|
||||
|
||||
/**
|
||||
* This request returns a token to use in subsequent requests. After 30 minutes of inactivity,
|
||||
|
@ -49,5 +40,5 @@ public interface VCloudLoginAsyncClient extends Closeable {
|
|||
@POST
|
||||
@ResponseParser(ParseLoginResponseFromHeaders.class)
|
||||
@Consumes(VCloudMediaType.ORGLIST_XML)
|
||||
ListenableFuture<VCloudSession> login();
|
||||
VCloudSession login();
|
||||
}
|
|
@ -1,26 +0,0 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.jclouds.vcloud.internal;
|
||||
|
||||
import java.io.Closeable;
|
||||
|
||||
import org.jclouds.vcloud.domain.VCloudSession;
|
||||
|
||||
public interface VCloudLoginClient extends Closeable {
|
||||
|
||||
VCloudSession login();
|
||||
}
|
|
@ -24,7 +24,7 @@ import javax.inject.Singleton;
|
|||
|
||||
import org.jclouds.logging.Logger;
|
||||
import org.jclouds.ovf.Envelope;
|
||||
import org.jclouds.vcloud.VCloudClient;
|
||||
import org.jclouds.vcloud.VCloudApi;
|
||||
|
||||
import com.google.common.cache.CacheLoader;
|
||||
|
||||
|
@ -33,10 +33,10 @@ public class OVFLoader extends CacheLoader<URI, Envelope> {
|
|||
@Resource
|
||||
protected Logger logger = Logger.NULL;
|
||||
|
||||
private final VCloudClient client;
|
||||
private final VCloudApi client;
|
||||
|
||||
@Inject
|
||||
OVFLoader(VCloudClient client) {
|
||||
OVFLoader(VCloudApi client) {
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ import javax.inject.Inject;
|
|||
import javax.inject.Singleton;
|
||||
|
||||
import org.jclouds.logging.Logger;
|
||||
import org.jclouds.vcloud.VCloudClient;
|
||||
import org.jclouds.vcloud.VCloudApi;
|
||||
import org.jclouds.vcloud.domain.VAppTemplate;
|
||||
|
||||
import com.google.common.cache.CacheLoader;
|
||||
|
@ -33,10 +33,10 @@ public class VAppTemplateLoader extends CacheLoader<URI, VAppTemplate> {
|
|||
@Resource
|
||||
protected Logger logger = Logger.NULL;
|
||||
|
||||
private final VCloudClient client;
|
||||
private final VCloudApi client;
|
||||
|
||||
@Inject
|
||||
VAppTemplateLoader(VCloudClient client) {
|
||||
VAppTemplateLoader(VCloudApi client) {
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ import javax.inject.Singleton;
|
|||
|
||||
import org.jclouds.logging.Logger;
|
||||
import org.jclouds.vcloud.TaskInErrorStateException;
|
||||
import org.jclouds.vcloud.VCloudClient;
|
||||
import org.jclouds.vcloud.VCloudApi;
|
||||
import org.jclouds.vcloud.domain.Task;
|
||||
import org.jclouds.vcloud.domain.TaskStatus;
|
||||
|
||||
|
@ -39,13 +39,13 @@ import com.google.inject.Inject;
|
|||
@Singleton
|
||||
public class TaskSuccess implements Predicate<URI> {
|
||||
|
||||
private final VCloudClient client;
|
||||
private final VCloudApi client;
|
||||
|
||||
@Resource
|
||||
protected Logger logger = Logger.NULL;
|
||||
|
||||
@Inject
|
||||
public TaskSuccess(VCloudClient client) {
|
||||
public TaskSuccess(VCloudApi client) {
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
|
|
|
@ -19,24 +19,23 @@ package org.jclouds.vcloud;
|
|||
import java.io.IOException;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
import org.jclouds.vcloud.internal.BaseVCloudAsyncClientTest;
|
||||
import org.jclouds.vcloud.internal.BaseVCloudApiTest;
|
||||
import org.jclouds.vcloud.utils.TestUtils;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.DataProvider;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code VCloudAsyncClient}
|
||||
* Tests behavior of {@code VCloudApi}
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
// NOTE:without testName, this will not call @Before* and fail w/NPE during
|
||||
// surefire
|
||||
@Test(groups = "unit", testName = "VCloudAsyncClientTest")
|
||||
public class VCloudAsyncClientTest extends BaseVCloudAsyncClientTest<VCloudAsyncClient> {
|
||||
@Test(groups = "unit", testName = "VCloudApiTest")
|
||||
public class VCloudApiTest extends BaseVCloudApiTest<VCloudApi> {
|
||||
|
||||
private VCloudAsyncClient asyncClient;
|
||||
private VCloudClient syncClient;
|
||||
private VCloudApi syncClient;
|
||||
|
||||
public void testSync() throws SecurityException, NoSuchMethodException, InterruptedException, ExecutionException {
|
||||
assert syncClient.getVAppClient() != null;
|
||||
|
@ -49,23 +48,11 @@ public class VCloudAsyncClientTest extends BaseVCloudAsyncClientTest<VCloudAsync
|
|||
assert syncClient.getOrgClient() != null;
|
||||
}
|
||||
|
||||
public void testAsync() throws SecurityException, NoSuchMethodException, InterruptedException, ExecutionException {
|
||||
assert asyncClient.getVAppClient() != null;
|
||||
assert asyncClient.getCatalogClient() != null;
|
||||
assert asyncClient.getVmClient() != null;
|
||||
assert asyncClient.getVAppTemplateClient() != null;
|
||||
assert asyncClient.getTaskClient() != null;
|
||||
assert asyncClient.getVDCClient() != null;
|
||||
assert asyncClient.getNetworkClient() != null;
|
||||
assert asyncClient.getOrgClient() != null;
|
||||
}
|
||||
|
||||
@BeforeClass
|
||||
@Override
|
||||
protected void setupFactory() throws IOException {
|
||||
super.setupFactory();
|
||||
asyncClient = injector.getInstance(VCloudAsyncClient.class);
|
||||
syncClient = injector.getInstance(VCloudClient.class);
|
||||
syncClient = injector.getInstance(VCloudApi.class);
|
||||
}
|
||||
|
||||
@DataProvider
|
|
@ -16,7 +16,7 @@
|
|||
*/
|
||||
package org.jclouds.vcloud;
|
||||
|
||||
import org.jclouds.vcloud.internal.BaseVCloudClientLiveTest;
|
||||
import org.jclouds.vcloud.internal.BaseVCloudApiLiveTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
|
@ -25,14 +25,13 @@ import org.testng.annotations.Test;
|
|||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(groups = "live", singleThreaded = true)
|
||||
public class VCloudSessionRefreshLiveTest extends BaseVCloudClientLiveTest {
|
||||
public class VCloudSessionRefreshLiveTest extends BaseVCloudApiLiveTest {
|
||||
|
||||
private static final int timeOut = 40;
|
||||
|
||||
@Test
|
||||
public void testSessionRefresh() throws Exception {
|
||||
VCloudClient connection = VCloudClient.class.cast(client.getContext().unwrap(VCloudApiMetadata.CONTEXT_TOKEN)
|
||||
.getApi());
|
||||
VCloudApi connection = view.unwrapApi(VCloudApi.class);
|
||||
|
||||
connection.getOrgClient().findOrgNamed(null);
|
||||
Thread.sleep(timeOut * 1000);
|
||||
|
|
|
@ -33,16 +33,16 @@ import com.google.common.collect.ImmutableList;
|
|||
import com.google.common.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code VCloudVersionsAsyncClient}
|
||||
* Tests behavior of {@code VCloudVersionsApi}
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire
|
||||
@Test(groups = "unit", testName = "VCloudVersionsAsyncClientTest")
|
||||
public class VCloudVersionsAsyncClientTest extends BaseAsyncClientTest<VCloudVersionsAsyncClient> {
|
||||
@Test(groups = "unit", testName = "VCloudVersionsApiTest")
|
||||
public class VCloudVersionsApiTest extends BaseAsyncClientTest<VCloudVersionsApi> {
|
||||
|
||||
public void testVersions() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = method(VCloudVersionsAsyncClient.class, "getSupportedVersions");
|
||||
Invokable<?, ?> method = method(VCloudVersionsApi.class, "getSupportedVersions");
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertEquals(request.getRequestLine(), "GET http://localhost:8080/versions HTTP/1.1");
|
||||
|
@ -63,7 +63,7 @@ public class VCloudVersionsAsyncClientTest extends BaseAsyncClientTest<VCloudVer
|
|||
|
||||
@Override
|
||||
protected ProviderMetadata createProviderMetadata() {
|
||||
return AnonymousProviderMetadata.forClientMappedToAsyncClientOnEndpoint(VCloudVersionsClient.class,
|
||||
VCloudVersionsAsyncClient.class, "http://localhost:8080");
|
||||
return AnonymousProviderMetadata.forApiOnEndpoint(VCloudVersionsApi.class,
|
||||
"http://localhost:8080");
|
||||
}
|
||||
}
|
|
@ -24,7 +24,7 @@ import org.jclouds.rest.annotations.ApiVersion;
|
|||
import org.jclouds.vcloud.VCloudMediaType;
|
||||
import org.jclouds.vcloud.domain.Org;
|
||||
import org.jclouds.vcloud.domain.ReferenceType;
|
||||
import org.jclouds.vcloud.internal.BaseVCloudClientLiveTest;
|
||||
import org.jclouds.vcloud.internal.BaseVCloudApiLiveTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.inject.Key;
|
||||
|
@ -32,8 +32,8 @@ import com.google.inject.Key;
|
|||
/**
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(groups = "live", enabled = true, singleThreaded = true, testName = "CatalogClientLiveTest")
|
||||
public class CatalogClientLiveTest extends BaseVCloudClientLiveTest {
|
||||
@Test(groups = "live", enabled = true, singleThreaded = true, testName = "CatalogApiLiveTest")
|
||||
public class CatalogApiLiveTest extends BaseVCloudApiLiveTest {
|
||||
@Test
|
||||
public void testGetCatalog() throws Exception {
|
||||
Org org = getVCloudApi().getOrgClient().findOrgNamed(null);
|
|
@ -24,7 +24,7 @@ import java.net.URI;
|
|||
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
|
||||
import org.jclouds.http.functions.ParseSax;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.jclouds.vcloud.internal.BaseVCloudAsyncClientTest;
|
||||
import org.jclouds.vcloud.internal.BaseVCloudApiTest;
|
||||
import org.jclouds.vcloud.options.CatalogItemOptions;
|
||||
import org.jclouds.vcloud.xml.CatalogHandler;
|
||||
import org.jclouds.vcloud.xml.CatalogItemHandler;
|
||||
|
@ -33,17 +33,17 @@ import org.testng.annotations.Test;
|
|||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.reflect.Invokable;
|
||||
/**
|
||||
* Tests behavior of {@code CatalogAsyncClient}
|
||||
* Tests behavior of {@code CatalogApi}
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
// NOTE:without testName, this will not call @Before* and fail w/NPE during
|
||||
// surefire
|
||||
@Test(groups = "unit", testName = "CatalogAsyncClientTest")
|
||||
public class CatalogAsyncClientTest extends BaseVCloudAsyncClientTest<CatalogAsyncClient> {
|
||||
@Test(groups = "unit", testName = "CatalogApiTest")
|
||||
public class CatalogApiTest extends BaseVCloudApiTest<CatalogApi> {
|
||||
|
||||
public void testCatalog() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = method(CatalogAsyncClient.class, "getCatalog", URI.class);
|
||||
Invokable<?, ?> method = method(CatalogApi.class, "getCatalog", URI.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/catalog/1")));
|
||||
|
||||
|
@ -59,7 +59,7 @@ public class CatalogAsyncClientTest extends BaseVCloudAsyncClientTest<CatalogAsy
|
|||
}
|
||||
|
||||
public void testCatalogInOrg() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = method(CatalogAsyncClient.class, "findCatalogInOrgNamed", String.class, String.class);
|
||||
Invokable<?, ?> method = method(CatalogApi.class, "findCatalogInOrgNamed", String.class, String.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("org", "catalog"));
|
||||
|
||||
assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/catalog/1 HTTP/1.1");
|
||||
|
@ -74,7 +74,7 @@ public class CatalogAsyncClientTest extends BaseVCloudAsyncClientTest<CatalogAsy
|
|||
}
|
||||
|
||||
public void testCatalogItemURI() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = method(CatalogAsyncClient.class, "getCatalogItem", URI.class);
|
||||
Invokable<?, ?> method = method(CatalogApi.class, "getCatalogItem", URI.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/catalogItem/2")));
|
||||
|
||||
|
@ -90,7 +90,7 @@ public class CatalogAsyncClientTest extends BaseVCloudAsyncClientTest<CatalogAsy
|
|||
}
|
||||
|
||||
public void testFindCatalogItemInOrgCatalogNamed() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = method(CatalogAsyncClient.class, "findCatalogItemInOrgCatalogNamed", String.class,
|
||||
Invokable<?, ?> method = method(CatalogApi.class, "findCatalogItemInOrgCatalogNamed", String.class,
|
||||
String.class, String.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("org", "catalog", "item"));
|
||||
|
||||
|
@ -107,7 +107,7 @@ public class CatalogAsyncClientTest extends BaseVCloudAsyncClientTest<CatalogAsy
|
|||
|
||||
public void testAddVAppTemplateOrMediaImageToCatalogAndNameItem() throws SecurityException, NoSuchMethodException,
|
||||
IOException {
|
||||
Invokable<?, ?> method = method(CatalogAsyncClient.class, "addVAppTemplateOrMediaImageToCatalogAndNameItem", URI.class,
|
||||
Invokable<?, ?> method = method(CatalogApi.class, "addVAppTemplateOrMediaImageToCatalogAndNameItem", URI.class,
|
||||
URI.class, String.class, CatalogItemOptions[].class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI.create("http://fooentity"), URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/catalog/1"), "myname", CatalogItemOptions.Builder
|
|
@ -16,14 +16,14 @@
|
|||
*/
|
||||
package org.jclouds.vcloud.features;
|
||||
|
||||
import org.jclouds.vcloud.internal.BaseVCloudClientLiveTest;
|
||||
import org.jclouds.vcloud.internal.BaseVCloudApiLiveTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(groups = "live", enabled = true, singleThreaded = true, testName = "VDCClientLiveTest")
|
||||
public class VDCClientLiveTest extends BaseVCloudClientLiveTest {
|
||||
@Test(groups = "live", enabled = true, singleThreaded = true, testName = "NetworkApiLiveTest")
|
||||
public class NetworkApiLiveTest extends BaseVCloudApiLiveTest {
|
||||
|
||||
|
||||
}
|
|
@ -24,24 +24,24 @@ import java.net.URI;
|
|||
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
|
||||
import org.jclouds.http.functions.ParseSax;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.jclouds.vcloud.internal.BaseVCloudAsyncClientTest;
|
||||
import org.jclouds.vcloud.internal.BaseVCloudApiTest;
|
||||
import org.jclouds.vcloud.xml.OrgNetworkHandler;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.reflect.Invokable;
|
||||
/**
|
||||
* Tests behavior of {@code NetworkAsyncClient}
|
||||
* Tests behavior of {@code NetworkApi}
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
// NOTE:without testName, this will not call @Before* and fail w/NPE during
|
||||
// surefire
|
||||
@Test(groups = "unit", testName = "NetworkAsyncClientTest")
|
||||
public class NetworkAsyncClientTest extends BaseVCloudAsyncClientTest<NetworkAsyncClient> {
|
||||
@Test(groups = "unit", testName = "NetworkApiTest")
|
||||
public class NetworkApiTest extends BaseVCloudApiTest<NetworkApi> {
|
||||
|
||||
public void testNetwork() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = method(NetworkAsyncClient.class, "getNetwork", URI.class);
|
||||
Invokable<?, ?> method = method(NetworkApi.class, "getNetwork", URI.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/network/2")));
|
||||
|
||||
|
@ -57,7 +57,7 @@ public class NetworkAsyncClientTest extends BaseVCloudAsyncClientTest<NetworkAsy
|
|||
}
|
||||
|
||||
public void testFindNetworkInOrgVDCNamed() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = method(NetworkAsyncClient.class, "findNetworkInOrgVDCNamed", String.class, String.class,
|
||||
Invokable<?, ?> method = method(NetworkApi.class, "findNetworkInOrgVDCNamed", String.class, String.class,
|
||||
String.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("org", "vdc", "network"));
|
||||
|
|
@ -20,14 +20,14 @@ import static org.testng.Assert.assertEquals;
|
|||
import static org.testng.Assert.assertNotNull;
|
||||
|
||||
import org.jclouds.vcloud.domain.ReferenceType;
|
||||
import org.jclouds.vcloud.internal.BaseVCloudClientLiveTest;
|
||||
import org.jclouds.vcloud.internal.BaseVCloudApiLiveTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(groups = "live", enabled = true, singleThreaded = true, testName = "OrgClientLiveTest")
|
||||
public class OrgClientLiveTest extends BaseVCloudClientLiveTest {
|
||||
@Test(groups = "live", enabled = true, singleThreaded = true, testName = "OrgApiLiveTest")
|
||||
public class OrgApiLiveTest extends BaseVCloudApiLiveTest {
|
||||
|
||||
@Test
|
||||
public void testListOrgs() throws Exception {
|
|
@ -25,7 +25,7 @@ import org.jclouds.Fallbacks.NullOnNotFoundOr404;
|
|||
import org.jclouds.fallbacks.MapHttp4xxCodesToExceptions;
|
||||
import org.jclouds.http.functions.ParseSax;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.jclouds.vcloud.internal.BaseVCloudAsyncClientTest;
|
||||
import org.jclouds.vcloud.internal.BaseVCloudApiTest;
|
||||
import org.jclouds.vcloud.xml.OrgHandler;
|
||||
import org.jclouds.vcloud.xml.OrgListHandler;
|
||||
import org.testng.annotations.Test;
|
||||
|
@ -33,17 +33,17 @@ import org.testng.annotations.Test;
|
|||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.reflect.Invokable;
|
||||
/**
|
||||
* Tests behavior of {@code OrgAsyncClient}
|
||||
* Tests behavior of {@code OrgApi}
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
// NOTE:without testName, this will not call @Before* and fail w/NPE during
|
||||
// surefire
|
||||
@Test(groups = "unit", testName = "OrgAsyncClientTest")
|
||||
public class OrgAsyncClientTest extends BaseVCloudAsyncClientTest<OrgAsyncClient> {
|
||||
@Test(groups = "unit", testName = "OrgApiTest")
|
||||
public class OrgApiTest extends BaseVCloudApiTest<OrgApi> {
|
||||
|
||||
public void testlistOrgs() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = method(OrgAsyncClient.class, "listOrgs");
|
||||
Invokable<?, ?> method = method(OrgApi.class, "listOrgs");
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/org HTTP/1.1");
|
||||
|
@ -58,7 +58,7 @@ public class OrgAsyncClientTest extends BaseVCloudAsyncClientTest<OrgAsyncClient
|
|||
}
|
||||
|
||||
public void testOrg() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = method(OrgAsyncClient.class, "getOrg", URI.class);
|
||||
Invokable<?, ?> method = method(OrgApi.class, "getOrg", URI.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/org/1")));
|
||||
|
||||
|
@ -74,7 +74,7 @@ public class OrgAsyncClientTest extends BaseVCloudAsyncClientTest<OrgAsyncClient
|
|||
}
|
||||
|
||||
public void testFindOrgNamed() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = method(OrgAsyncClient.class, "findOrgNamed", String.class);
|
||||
Invokable<?, ?> method = method(OrgApi.class, "findOrgNamed", String.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("org"));
|
||||
|
||||
assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/org/1 HTTP/1.1");
|
|
@ -16,14 +16,14 @@
|
|||
*/
|
||||
package org.jclouds.vcloud.features;
|
||||
|
||||
import org.jclouds.vcloud.internal.BaseVCloudClientLiveTest;
|
||||
import org.jclouds.vcloud.internal.BaseVCloudApiLiveTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(groups = "live", enabled = true, singleThreaded = true, testName = "TaskClientLiveTest")
|
||||
public class TaskClientLiveTest extends BaseVCloudClientLiveTest {
|
||||
@Test(groups = "live", enabled = true, singleThreaded = true, testName = "TaskApiLiveTest")
|
||||
public class TaskApiLiveTest extends BaseVCloudApiLiveTest {
|
||||
|
||||
|
||||
}
|
|
@ -25,7 +25,7 @@ import org.jclouds.Fallbacks.NullOnNotFoundOr404;
|
|||
import org.jclouds.http.functions.ParseSax;
|
||||
import org.jclouds.http.functions.ReleasePayloadAndReturn;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.jclouds.vcloud.internal.BaseVCloudAsyncClientTest;
|
||||
import org.jclouds.vcloud.internal.BaseVCloudApiTest;
|
||||
import org.jclouds.vcloud.xml.TaskHandler;
|
||||
import org.jclouds.vcloud.xml.TasksListHandler;
|
||||
import org.testng.annotations.Test;
|
||||
|
@ -33,17 +33,17 @@ import org.testng.annotations.Test;
|
|||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.reflect.Invokable;
|
||||
/**
|
||||
* Tests behavior of {@code TaskAsyncClient}
|
||||
* Tests behavior of {@code TaskApi}
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
// NOTE:without testName, this will not call @Before* and fail w/NPE during
|
||||
// surefire
|
||||
@Test(groups = "unit", testName = "TaskAsyncClientTest")
|
||||
public class TaskAsyncClientTest extends BaseVCloudAsyncClientTest<TaskAsyncClient> {
|
||||
@Test(groups = "unit", testName = "TaskApiTest")
|
||||
public class TaskApiTest extends BaseVCloudApiTest<TaskApi> {
|
||||
|
||||
public void testGetTasksList() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = method(TaskAsyncClient.class, "getTasksList", URI.class);
|
||||
Invokable<?, ?> method = method(TaskApi.class, "getTasksList", URI.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/tasksList/1")));
|
||||
|
||||
|
@ -59,7 +59,7 @@ public class TaskAsyncClientTest extends BaseVCloudAsyncClientTest<TaskAsyncClie
|
|||
}
|
||||
|
||||
public void testFindTasksListInOrgNamed() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = method(TaskAsyncClient.class, "findTasksListInOrgNamed", String.class);
|
||||
Invokable<?, ?> method = method(TaskApi.class, "findTasksListInOrgNamed", String.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("org"));
|
||||
|
||||
assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/tasksList/1 HTTP/1.1");
|
||||
|
@ -74,7 +74,7 @@ public class TaskAsyncClientTest extends BaseVCloudAsyncClientTest<TaskAsyncClie
|
|||
}
|
||||
|
||||
public void testGetTask() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = method(TaskAsyncClient.class, "getTask", URI.class);
|
||||
Invokable<?, ?> method = method(TaskApi.class, "getTask", URI.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/task/1")));
|
||||
|
||||
|
@ -90,7 +90,7 @@ public class TaskAsyncClientTest extends BaseVCloudAsyncClientTest<TaskAsyncClie
|
|||
}
|
||||
|
||||
public void testCancelTask() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = method(TaskAsyncClient.class, "cancelTask", URI.class);
|
||||
Invokable<?, ?> method = method(TaskApi.class, "cancelTask", URI.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/task/1")));
|
||||
|
|
@ -23,15 +23,15 @@ import org.jclouds.vcloud.domain.Org;
|
|||
import org.jclouds.vcloud.domain.ReferenceType;
|
||||
import org.jclouds.vcloud.domain.VApp;
|
||||
import org.jclouds.vcloud.domain.VDC;
|
||||
import org.jclouds.vcloud.internal.BaseVCloudClientLiveTest;
|
||||
import org.jclouds.vcloud.internal.BaseVCloudApiLiveTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(groups = "live", enabled = true, singleThreaded = true, testName = "VAppClientLiveTest")
|
||||
public class VAppClientLiveTest extends BaseVCloudClientLiveTest {
|
||||
@Test(groups = "live", enabled = true, singleThreaded = true, testName = "VAppApiLiveTest")
|
||||
public class VAppApiLiveTest extends BaseVCloudApiLiveTest {
|
||||
|
||||
@Test
|
||||
public void testGetVApp() throws Exception {
|
|
@ -27,7 +27,7 @@ import org.jclouds.http.functions.ParseSax;
|
|||
import org.jclouds.http.functions.ReleasePayloadAndReturn;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.jclouds.util.Strings2;
|
||||
import org.jclouds.vcloud.internal.BaseVCloudAsyncClientTest;
|
||||
import org.jclouds.vcloud.internal.BaseVCloudApiTest;
|
||||
import org.jclouds.vcloud.options.CloneVAppOptions;
|
||||
import org.jclouds.vcloud.xml.TaskHandler;
|
||||
import org.jclouds.vcloud.xml.VAppHandler;
|
||||
|
@ -36,17 +36,17 @@ import org.testng.annotations.Test;
|
|||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.reflect.Invokable;
|
||||
/**
|
||||
* Tests behavior of {@code VAppAsyncClient}
|
||||
* Tests behavior of {@code VAppApi}
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
// NOTE:without testName, this will not call @Before* and fail w/NPE during
|
||||
// surefire
|
||||
@Test(groups = "unit", testName = "VAppAsyncClientTest")
|
||||
public class VAppAsyncClientTest extends BaseVCloudAsyncClientTest<VAppAsyncClient> {
|
||||
@Test(groups = "unit", testName = "VAppApiTest")
|
||||
public class VAppApiTest extends BaseVCloudApiTest<VAppApi> {
|
||||
|
||||
public void testopyVAppToVDCAndName() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = method(VAppAsyncClient.class, "copyVAppToVDCAndName", URI.class, URI.class, String.class,
|
||||
Invokable<?, ?> method = method(VAppApi.class, "copyVAppToVDCAndName", URI.class, URI.class, String.class,
|
||||
CloneVAppOptions[].class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vapp/4181"), URI
|
||||
|
@ -66,7 +66,7 @@ public class VAppAsyncClientTest extends BaseVCloudAsyncClientTest<VAppAsyncClie
|
|||
}
|
||||
|
||||
public void testCopyVAppToVDCAndNameOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = method(VAppAsyncClient.class, "copyVAppToVDCAndName", URI.class, URI.class, String.class,
|
||||
Invokable<?, ?> method = method(VAppApi.class, "copyVAppToVDCAndName", URI.class, URI.class, String.class,
|
||||
CloneVAppOptions[].class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vapp/201"), URI
|
||||
|
@ -87,7 +87,7 @@ public class VAppAsyncClientTest extends BaseVCloudAsyncClientTest<VAppAsyncClie
|
|||
}
|
||||
|
||||
public void testMoveVAppToVDCAndRenameOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = method(VAppAsyncClient.class, "moveVAppToVDCAndRename", URI.class, URI.class, String.class,
|
||||
Invokable<?, ?> method = method(VAppApi.class, "moveVAppToVDCAndRename", URI.class, URI.class, String.class,
|
||||
CloneVAppOptions[].class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vapp/201"), URI
|
||||
|
@ -108,7 +108,7 @@ public class VAppAsyncClientTest extends BaseVCloudAsyncClientTest<VAppAsyncClie
|
|||
}
|
||||
|
||||
public void testDeployVApp() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = method(VAppAsyncClient.class, "deployVApp", URI.class);
|
||||
Invokable<?, ?> method = method(VAppApi.class, "deployVApp", URI.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
|
||||
|
||||
|
@ -125,7 +125,7 @@ public class VAppAsyncClientTest extends BaseVCloudAsyncClientTest<VAppAsyncClie
|
|||
}
|
||||
|
||||
public void testDeployAndPowerOnVApp() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = method(VAppAsyncClient.class, "deployAndPowerOnVApp", URI.class);
|
||||
Invokable<?, ?> method = method(VAppApi.class, "deployAndPowerOnVApp", URI.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
|
||||
|
||||
|
@ -142,7 +142,7 @@ public class VAppAsyncClientTest extends BaseVCloudAsyncClientTest<VAppAsyncClie
|
|||
}
|
||||
|
||||
public void testGetVApp() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = method(VAppAsyncClient.class, "getVApp", URI.class);
|
||||
Invokable<?, ?> method = method(VAppApi.class, "getVApp", URI.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
|
||||
|
||||
|
@ -158,7 +158,7 @@ public class VAppAsyncClientTest extends BaseVCloudAsyncClientTest<VAppAsyncClie
|
|||
}
|
||||
|
||||
public void testRebootVApp() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = method(VAppAsyncClient.class, "rebootVApp", URI.class);
|
||||
Invokable<?, ?> method = method(VAppApi.class, "rebootVApp", URI.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
|
||||
|
||||
|
@ -175,7 +175,7 @@ public class VAppAsyncClientTest extends BaseVCloudAsyncClientTest<VAppAsyncClie
|
|||
}
|
||||
|
||||
public void testUndeployVApp() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = method(VAppAsyncClient.class, "undeployVApp", URI.class);
|
||||
Invokable<?, ?> method = method(VAppApi.class, "undeployVApp", URI.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
|
||||
|
||||
|
@ -193,7 +193,7 @@ public class VAppAsyncClientTest extends BaseVCloudAsyncClientTest<VAppAsyncClie
|
|||
}
|
||||
|
||||
public void testUndeployAndSaveStateOfVAppSaveState() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = method(VAppAsyncClient.class, "undeployAndSaveStateOfVApp", URI.class);
|
||||
Invokable<?, ?> method = method(VAppApi.class, "undeployAndSaveStateOfVApp", URI.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
|
||||
|
||||
|
@ -212,7 +212,7 @@ public class VAppAsyncClientTest extends BaseVCloudAsyncClientTest<VAppAsyncClie
|
|||
}
|
||||
|
||||
public void testDeleteVApp() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = method(VAppAsyncClient.class, "deleteVApp", URI.class);
|
||||
Invokable<?, ?> method = method(VAppApi.class, "deleteVApp", URI.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
|
||||
|
||||
|
@ -228,7 +228,7 @@ public class VAppAsyncClientTest extends BaseVCloudAsyncClientTest<VAppAsyncClie
|
|||
}
|
||||
|
||||
public void testPowerOnVApp() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = method(VAppAsyncClient.class, "powerOnVApp", URI.class);
|
||||
Invokable<?, ?> method = method(VAppApi.class, "powerOnVApp", URI.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
|
||||
|
||||
|
@ -245,7 +245,7 @@ public class VAppAsyncClientTest extends BaseVCloudAsyncClientTest<VAppAsyncClie
|
|||
}
|
||||
|
||||
public void testPowerOffVApp() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = method(VAppAsyncClient.class, "powerOffVApp", URI.class);
|
||||
Invokable<?, ?> method = method(VAppApi.class, "powerOffVApp", URI.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
|
||||
|
||||
|
@ -262,7 +262,7 @@ public class VAppAsyncClientTest extends BaseVCloudAsyncClientTest<VAppAsyncClie
|
|||
}
|
||||
|
||||
public void testResetVApp() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = method(VAppAsyncClient.class, "resetVApp", URI.class);
|
||||
Invokable<?, ?> method = method(VAppApi.class, "resetVApp", URI.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
|
||||
|
||||
|
@ -279,7 +279,7 @@ public class VAppAsyncClientTest extends BaseVCloudAsyncClientTest<VAppAsyncClie
|
|||
}
|
||||
|
||||
public void testSuspendVApp() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = method(VAppAsyncClient.class, "suspendVApp", URI.class);
|
||||
Invokable<?, ?> method = method(VAppApi.class, "suspendVApp", URI.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
|
||||
|
||||
|
@ -296,7 +296,7 @@ public class VAppAsyncClientTest extends BaseVCloudAsyncClientTest<VAppAsyncClie
|
|||
}
|
||||
|
||||
public void testShutdownVApp() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = method(VAppAsyncClient.class, "shutdownVApp", URI.class);
|
||||
Invokable<?, ?> method = method(VAppApi.class, "shutdownVApp", URI.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
|
||||
|
|
@ -33,7 +33,7 @@ import org.jclouds.vcloud.domain.Status;
|
|||
import org.jclouds.vcloud.domain.Task;
|
||||
import org.jclouds.vcloud.domain.VApp;
|
||||
import org.jclouds.vcloud.domain.VAppTemplate;
|
||||
import org.jclouds.vcloud.internal.BaseVCloudClientLiveTest;
|
||||
import org.jclouds.vcloud.internal.BaseVCloudApiLiveTest;
|
||||
import org.jclouds.vcloud.options.CatalogItemOptions;
|
||||
import org.jclouds.vcloud.predicates.TaskSuccess;
|
||||
import org.testng.annotations.Test;
|
||||
|
@ -45,8 +45,8 @@ import com.google.common.collect.ImmutableMap;
|
|||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(groups = "live", enabled = true, singleThreaded = true, testName = "VAppTemplateClientLiveTest")
|
||||
public class VAppTemplateClientLiveTest extends BaseVCloudClientLiveTest {
|
||||
@Test(groups = "live", enabled = true, singleThreaded = true, testName = "VAppTemplateApiLiveTest")
|
||||
public class VAppTemplateApiLiveTest extends BaseVCloudApiLiveTest {
|
||||
@Test
|
||||
public void testGetVAppTemplate() throws Exception {
|
||||
Org org = getVCloudApi().getOrgClient().findOrgNamed(null);
|
|
@ -29,7 +29,7 @@ import org.jclouds.rest.internal.GeneratedHttpRequest;
|
|||
import org.jclouds.util.Strings2;
|
||||
import org.jclouds.vcloud.domain.network.FenceMode;
|
||||
import org.jclouds.vcloud.domain.network.NetworkConfig;
|
||||
import org.jclouds.vcloud.internal.BaseVCloudAsyncClientTest;
|
||||
import org.jclouds.vcloud.internal.BaseVCloudApiTest;
|
||||
import org.jclouds.vcloud.options.CaptureVAppOptions;
|
||||
import org.jclouds.vcloud.options.CloneVAppTemplateOptions;
|
||||
import org.jclouds.vcloud.options.InstantiateVAppTemplateOptions;
|
||||
|
@ -41,18 +41,18 @@ import org.testng.annotations.Test;
|
|||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.reflect.Invokable;
|
||||
/**
|
||||
* Tests behavior of {@code VAppTemplateAsyncClient}
|
||||
* Tests behavior of {@code VAppTemplateApi}
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
// NOTE:without testName, this will not call @Before* and fail w/NPE during
|
||||
// surefire
|
||||
@Test(groups = "unit", testName = "VAppTemplateAsyncClientTest")
|
||||
public class VAppTemplateAsyncClientTest extends BaseVCloudAsyncClientTest<VAppTemplateAsyncClient> {
|
||||
@Test(groups = "unit", testName = "VAppTemplateApiTest")
|
||||
public class VAppTemplateApiTest extends BaseVCloudApiTest<VAppTemplateApi> {
|
||||
|
||||
public void testCreateVAppInVDCByInstantiatingTemplate() throws SecurityException, NoSuchMethodException,
|
||||
IOException {
|
||||
Invokable<?, ?> method = method(VAppTemplateAsyncClient.class, "createVAppInVDCByInstantiatingTemplate", String.class,
|
||||
Invokable<?, ?> method = method(VAppTemplateApi.class, "createVAppInVDCByInstantiatingTemplate", String.class,
|
||||
URI.class, URI.class, InstantiateVAppTemplateOptions[].class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("my-vapp", URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"), URI
|
||||
|
@ -77,7 +77,7 @@ public class VAppTemplateAsyncClientTest extends BaseVCloudAsyncClientTest<VAppT
|
|||
@Test(expectedExceptions = IllegalArgumentException.class)
|
||||
public void testCreateVAppInVDCByInstantiatingTemplateOptionsIllegalName() throws SecurityException,
|
||||
NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = method(VAppTemplateAsyncClient.class, "createVAppInVDCByInstantiatingTemplate", String.class,
|
||||
Invokable<?, ?> method = method(VAppTemplateApi.class, "createVAppInVDCByInstantiatingTemplate", String.class,
|
||||
URI.class, URI.class, InstantiateVAppTemplateOptions[].class);
|
||||
processor.createRequest(method, ImmutableList.<Object> of("CentOS 01", URI.create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"), URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"), addNetworkConfig(new NetworkConfig(null,
|
||||
|
@ -85,7 +85,7 @@ public class VAppTemplateAsyncClientTest extends BaseVCloudAsyncClientTest<VAppT
|
|||
}
|
||||
|
||||
public void testcopyVAppTemplateToVDCAndName() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = method(VAppTemplateAsyncClient.class, "copyVAppTemplateToVDCAndName", URI.class, URI.class,
|
||||
Invokable<?, ?> method = method(VAppTemplateApi.class, "copyVAppTemplateToVDCAndName", URI.class, URI.class,
|
||||
String.class, CloneVAppTemplateOptions[].class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/4181"), URI
|
||||
|
@ -105,7 +105,7 @@ public class VAppTemplateAsyncClientTest extends BaseVCloudAsyncClientTest<VAppT
|
|||
}
|
||||
|
||||
public void testcopyVAppTemplateToVDCAndNameOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = method(VAppTemplateAsyncClient.class, "copyVAppTemplateToVDCAndName", URI.class, URI.class,
|
||||
Invokable<?, ?> method = method(VAppTemplateApi.class, "copyVAppTemplateToVDCAndName", URI.class, URI.class,
|
||||
String.class, CloneVAppTemplateOptions[].class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/201"), URI
|
||||
|
@ -126,7 +126,7 @@ public class VAppTemplateAsyncClientTest extends BaseVCloudAsyncClientTest<VAppT
|
|||
}
|
||||
|
||||
public void testmoveVAppTemplateToVDCAndRenameOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = method(VAppTemplateAsyncClient.class, "moveVAppTemplateToVDCAndRename", URI.class, URI.class,
|
||||
Invokable<?, ?> method = method(VAppTemplateApi.class, "moveVAppTemplateToVDCAndRename", URI.class, URI.class,
|
||||
String.class, CloneVAppTemplateOptions[].class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/201"), URI
|
||||
|
@ -147,7 +147,7 @@ public class VAppTemplateAsyncClientTest extends BaseVCloudAsyncClientTest<VAppT
|
|||
}
|
||||
|
||||
public void testcaptureVAppAsTemplateInVDC() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = method(VAppTemplateAsyncClient.class, "captureVAppAsTemplateInVDC", URI.class, String.class,
|
||||
Invokable<?, ?> method = method(VAppTemplateApi.class, "captureVAppAsTemplateInVDC", URI.class, String.class,
|
||||
URI.class, CaptureVAppOptions[].class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vapp/4181"), "my-template", URI
|
||||
|
@ -168,7 +168,7 @@ public class VAppTemplateAsyncClientTest extends BaseVCloudAsyncClientTest<VAppT
|
|||
}
|
||||
|
||||
public void testcaptureVAppAsTemplateInVDCOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = method(VAppTemplateAsyncClient.class, "captureVAppAsTemplateInVDC", URI.class, String.class,
|
||||
Invokable<?, ?> method = method(VAppTemplateApi.class, "captureVAppAsTemplateInVDC", URI.class, String.class,
|
||||
URI.class, CaptureVAppOptions[].class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vapp/201"), "my-template", URI
|
||||
|
@ -189,7 +189,7 @@ public class VAppTemplateAsyncClientTest extends BaseVCloudAsyncClientTest<VAppT
|
|||
}
|
||||
|
||||
public void testFindVAppTemplate() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = method(VAppTemplateAsyncClient.class, "findVAppTemplateInOrgCatalogNamed", String.class,
|
||||
Invokable<?, ?> method = method(VAppTemplateApi.class, "findVAppTemplateInOrgCatalogNamed", String.class,
|
||||
String.class, String.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("org", "catalog", "template"));
|
||||
|
||||
|
@ -205,7 +205,7 @@ public class VAppTemplateAsyncClientTest extends BaseVCloudAsyncClientTest<VAppT
|
|||
}
|
||||
|
||||
public void testVAppTemplateURI() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = method(VAppTemplateAsyncClient.class, "getVAppTemplate", URI.class);
|
||||
Invokable<?, ?> method = method(VAppTemplateApi.class, "getVAppTemplate", URI.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/2")));
|
||||
|
||||
|
@ -221,7 +221,7 @@ public class VAppTemplateAsyncClientTest extends BaseVCloudAsyncClientTest<VAppT
|
|||
}
|
||||
|
||||
public void testGetOvfEnvelopeForVAppTemplate() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = method(VAppTemplateAsyncClient.class, "getOvfEnvelopeForVAppTemplate", URI.class);
|
||||
Invokable<?, ?> method = method(VAppTemplateApi.class, "getOvfEnvelopeForVAppTemplate", URI.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/2")));
|
||||
|
|
@ -16,14 +16,14 @@
|
|||
*/
|
||||
package org.jclouds.vcloud.features;
|
||||
|
||||
import org.jclouds.vcloud.internal.BaseVCloudClientLiveTest;
|
||||
import org.jclouds.vcloud.internal.BaseVCloudApiLiveTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(groups = "live", enabled = true, singleThreaded = true, testName = "NetworkClientLiveTest")
|
||||
public class NetworkClientLiveTest extends BaseVCloudClientLiveTest {
|
||||
@Test(groups = "live", enabled = true, singleThreaded = true, testName = "VDCApiLiveTest")
|
||||
public class VDCApiLiveTest extends BaseVCloudApiLiveTest {
|
||||
|
||||
|
||||
}
|
|
@ -25,7 +25,7 @@ import java.util.NoSuchElementException;
|
|||
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
|
||||
import org.jclouds.http.functions.ParseSax;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.jclouds.vcloud.internal.BaseVCloudAsyncClientTest;
|
||||
import org.jclouds.vcloud.internal.BaseVCloudApiTest;
|
||||
import org.jclouds.vcloud.xml.VDCHandler;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
|
@ -33,29 +33,29 @@ import com.google.common.collect.ImmutableList;
|
|||
import com.google.common.collect.Lists;
|
||||
import com.google.common.reflect.Invokable;
|
||||
/**
|
||||
* Tests behavior of {@code VDCAsyncClient}
|
||||
* Tests behavior of {@code VDCApi}
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
// NOTE:without testName, this will not call @Before* and fail w/NPE during
|
||||
// surefire
|
||||
@Test(groups = "unit", testName = "VDCAsyncClientTest")
|
||||
public class VDCAsyncClientTest extends BaseVCloudAsyncClientTest<VDCAsyncClient> {
|
||||
@Test(groups = "unit", testName = "VDCApiTest")
|
||||
public class VDCApiTest extends BaseVCloudApiTest<VDCApi> {
|
||||
|
||||
@Test(expectedExceptions = NoSuchElementException.class)
|
||||
public void testFindVDCInOrgNamedBadVDC() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = method(VDCAsyncClient.class, "findVDCInOrgNamed", String.class, String.class);
|
||||
Invokable<?, ?> method = method(VDCApi.class, "findVDCInOrgNamed", String.class, String.class);
|
||||
processor.createRequest(method, ImmutableList.<Object> of("org", "vdc1"));
|
||||
}
|
||||
|
||||
@Test(expectedExceptions = NoSuchElementException.class)
|
||||
public void testFindVDCInOrgNamedBadOrg() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = method(VDCAsyncClient.class, "findVDCInOrgNamed", String.class, String.class);
|
||||
Invokable<?, ?> method = method(VDCApi.class, "findVDCInOrgNamed", String.class, String.class);
|
||||
processor.createRequest(method, ImmutableList.<Object> of("org1", "vdc"));
|
||||
}
|
||||
|
||||
public void testFindVDCInOrgNamedNullOrg() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = method(VDCAsyncClient.class, "findVDCInOrgNamed", String.class, String.class);
|
||||
Invokable<?, ?> method = method(VDCApi.class, "findVDCInOrgNamed", String.class, String.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "vdc"));
|
||||
|
||||
assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/vdc/1 HTTP/1.1");
|
||||
|
@ -70,7 +70,7 @@ public class VDCAsyncClientTest extends BaseVCloudAsyncClientTest<VDCAsyncClient
|
|||
}
|
||||
|
||||
public void testFindVDCInOrgNamedNullOrgAndVDC() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = method(VDCAsyncClient.class, "findVDCInOrgNamed", String.class, String.class);
|
||||
Invokable<?, ?> method = method(VDCApi.class, "findVDCInOrgNamed", String.class, String.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, null));
|
||||
|
||||
assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/vdc/1 HTTP/1.1");
|
||||
|
@ -85,7 +85,7 @@ public class VDCAsyncClientTest extends BaseVCloudAsyncClientTest<VDCAsyncClient
|
|||
}
|
||||
|
||||
public void testGetVDC() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = method(VDCAsyncClient.class, "getVDC", URI.class);
|
||||
Invokable<?, ?> method = method(VDCApi.class, "getVDC", URI.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1")));
|
||||
|
|
@ -27,7 +27,7 @@ import static org.testng.Assert.assertNotNull;
|
|||
import org.jclouds.compute.domain.ExecResponse;
|
||||
import org.jclouds.compute.domain.NodeMetadata;
|
||||
import org.jclouds.compute.options.TemplateOptions;
|
||||
import org.jclouds.vcloud.VCloudApiMetadata;
|
||||
import org.jclouds.vcloud.VCloudApi;
|
||||
import org.jclouds.vcloud.VCloudMediaType;
|
||||
import org.jclouds.vcloud.compute.options.VCloudTemplateOptions;
|
||||
import org.jclouds.vcloud.domain.Org;
|
||||
|
@ -35,7 +35,7 @@ import org.jclouds.vcloud.domain.ReferenceType;
|
|||
import org.jclouds.vcloud.domain.VApp;
|
||||
import org.jclouds.vcloud.domain.VDC;
|
||||
import org.jclouds.vcloud.domain.Vm;
|
||||
import org.jclouds.vcloud.internal.BaseVCloudClientLiveTest;
|
||||
import org.jclouds.vcloud.internal.BaseVCloudApiLiveTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.Iterables;
|
||||
|
@ -48,8 +48,8 @@ import com.google.common.net.HostAndPort;
|
|||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(groups = "live", enabled = true, singleThreaded = true, testName = "VmClientLiveTest")
|
||||
public class VmClientLiveTest extends BaseVCloudClientLiveTest {
|
||||
@Test(groups = "live", enabled = true, singleThreaded = true, testName = "VmApiLiveTest")
|
||||
public class VmApiLiveTest extends BaseVCloudApiLiveTest {
|
||||
|
||||
@Test
|
||||
public void testGetThumbnailOfVm() throws Exception {
|
||||
|
@ -108,8 +108,8 @@ public class VmClientLiveTest extends BaseVCloudClientLiveTest {
|
|||
options.as(VCloudTemplateOptions.class).description(group);
|
||||
node = getOnlyElement(client.createNodesInGroup(group, 1, options));
|
||||
|
||||
VApp vapp = client.getContext().unwrap(VCloudApiMetadata.CONTEXT_TOKEN).getApi().getVAppClient().getVApp(
|
||||
node.getUri());
|
||||
VApp vapp = client.getContext().unwrapApi(VCloudApi.class).getVAppClient().getVApp(
|
||||
node.getUri());
|
||||
assertEquals(vapp.getDescription(), group);
|
||||
|
||||
Vm vm = Iterables.get(vapp.getChildren(), 0);
|
|
@ -28,7 +28,7 @@ import org.jclouds.http.functions.ReturnInputStream;
|
|||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.jclouds.util.Strings2;
|
||||
import org.jclouds.vcloud.domain.GuestCustomizationSection;
|
||||
import org.jclouds.vcloud.internal.BaseVCloudAsyncClientTest;
|
||||
import org.jclouds.vcloud.internal.BaseVCloudApiTest;
|
||||
import org.jclouds.vcloud.utils.TestUtils;
|
||||
import org.jclouds.vcloud.xml.TaskHandler;
|
||||
import org.jclouds.vcloud.xml.VmHandler;
|
||||
|
@ -38,17 +38,17 @@ import org.testng.annotations.Test;
|
|||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.reflect.Invokable;
|
||||
/**
|
||||
* Tests behavior of {@code VmAsyncClient}
|
||||
* Tests behavior of {@code VmApi}
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
// NOTE:without testName, this will not call @Before* and fail w/NPE during
|
||||
// surefire
|
||||
@Test(groups = "unit", testName = "VmAsyncClientTest")
|
||||
public class VmAsyncClientTest extends BaseVCloudAsyncClientTest<VmAsyncClient> {
|
||||
@Test(groups = "unit", testName = "VmApiTest")
|
||||
public class VmApiTest extends BaseVCloudApiTest<VmApi> {
|
||||
|
||||
public void testGetThumbnailOfVm() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = method(VmAsyncClient.class, "getScreenThumbnailForVm", URI.class);
|
||||
Invokable<?, ?> method = method(VmApi.class, "getScreenThumbnailForVm", URI.class);
|
||||
GeneratedHttpRequest request = processor
|
||||
.createRequest(method, ImmutableList.<Object> of(URI.create("http://vcloud.example.com/api/v1.0/vApp/vm-12")));
|
||||
|
||||
|
@ -65,7 +65,7 @@ public class VmAsyncClientTest extends BaseVCloudAsyncClientTest<VmAsyncClient>
|
|||
|
||||
@Test(dataProvider = "ignoreOnWindows", description = "see http://code.google.com/p/jclouds/issues/detail?id=402")
|
||||
public void testUpdateGuestConfiguration() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = method(VmAsyncClient.class, "updateGuestCustomizationOfVm", GuestCustomizationSection.class,
|
||||
Invokable<?, ?> method = method(VmApi.class, "updateGuestCustomizationOfVm", GuestCustomizationSection.class,
|
||||
URI.class);
|
||||
GuestCustomizationSection guest = new GuestCustomizationSection(URI
|
||||
.create("http://vcloud.example.com/api/v1.0/vApp/vm-12/guestCustomizationSection"));
|
||||
|
@ -87,7 +87,7 @@ public class VmAsyncClientTest extends BaseVCloudAsyncClientTest<VmAsyncClient>
|
|||
}
|
||||
|
||||
public void testUpdateCPUCountOfVm() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = method(VmAsyncClient.class, "updateCPUCountOfVm", int.class, URI.class);
|
||||
Invokable<?, ?> method = method(VmApi.class, "updateCPUCountOfVm", int.class, URI.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(2, URI
|
||||
.create("http://vcloud.example.com/api/v1.0/vApp/vm-12")));
|
||||
|
||||
|
@ -105,7 +105,7 @@ public class VmAsyncClientTest extends BaseVCloudAsyncClientTest<VmAsyncClient>
|
|||
}
|
||||
|
||||
public void testUpdateMemoryMBOfVm() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = method(VmAsyncClient.class, "updateMemoryMBOfVm", int.class, URI.class);
|
||||
Invokable<?, ?> method = method(VmApi.class, "updateMemoryMBOfVm", int.class, URI.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(512, URI
|
||||
.create("http://vcloud.example.com/api/v1.0/vApp/vm-12")));
|
||||
|
||||
|
@ -123,7 +123,7 @@ public class VmAsyncClientTest extends BaseVCloudAsyncClientTest<VmAsyncClient>
|
|||
}
|
||||
|
||||
public void testDeployVm() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = method(VmAsyncClient.class, "deployVm", URI.class);
|
||||
Invokable<?, ?> method = method(VmApi.class, "deployVm", URI.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
|
||||
|
||||
|
@ -140,7 +140,7 @@ public class VmAsyncClientTest extends BaseVCloudAsyncClientTest<VmAsyncClient>
|
|||
}
|
||||
|
||||
public void testDeployAndPowerOnVm() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = method(VmAsyncClient.class, "deployAndPowerOnVm", URI.class);
|
||||
Invokable<?, ?> method = method(VmApi.class, "deployAndPowerOnVm", URI.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
|
||||
|
||||
|
@ -157,7 +157,7 @@ public class VmAsyncClientTest extends BaseVCloudAsyncClientTest<VmAsyncClient>
|
|||
}
|
||||
|
||||
public void testGetVm() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = method(VmAsyncClient.class, "getVm", URI.class);
|
||||
Invokable<?, ?> method = method(VmApi.class, "getVm", URI.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vm/1")));
|
||||
|
||||
|
@ -173,7 +173,7 @@ public class VmAsyncClientTest extends BaseVCloudAsyncClientTest<VmAsyncClient>
|
|||
}
|
||||
|
||||
public void testRebootVm() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = method(VmAsyncClient.class, "rebootVm", URI.class);
|
||||
Invokable<?, ?> method = method(VmApi.class, "rebootVm", URI.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
|
||||
|
||||
|
@ -190,7 +190,7 @@ public class VmAsyncClientTest extends BaseVCloudAsyncClientTest<VmAsyncClient>
|
|||
}
|
||||
|
||||
public void testUndeployVm() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = method(VmAsyncClient.class, "undeployVm", URI.class);
|
||||
Invokable<?, ?> method = method(VmApi.class, "undeployVm", URI.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
|
||||
|
||||
|
@ -208,7 +208,7 @@ public class VmAsyncClientTest extends BaseVCloudAsyncClientTest<VmAsyncClient>
|
|||
}
|
||||
|
||||
public void testUndeployAndSaveStateOfVmSaveState() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = method(VmAsyncClient.class, "undeployAndSaveStateOfVm", URI.class);
|
||||
Invokable<?, ?> method = method(VmApi.class, "undeployAndSaveStateOfVm", URI.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
|
||||
|
||||
|
@ -227,7 +227,7 @@ public class VmAsyncClientTest extends BaseVCloudAsyncClientTest<VmAsyncClient>
|
|||
}
|
||||
|
||||
public void testPowerOnVm() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = method(VmAsyncClient.class, "powerOnVm", URI.class);
|
||||
Invokable<?, ?> method = method(VmApi.class, "powerOnVm", URI.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
|
||||
|
||||
|
@ -244,7 +244,7 @@ public class VmAsyncClientTest extends BaseVCloudAsyncClientTest<VmAsyncClient>
|
|||
}
|
||||
|
||||
public void testPowerOffVm() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = method(VmAsyncClient.class, "powerOffVm", URI.class);
|
||||
Invokable<?, ?> method = method(VmApi.class, "powerOffVm", URI.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
|
||||
|
||||
|
@ -261,7 +261,7 @@ public class VmAsyncClientTest extends BaseVCloudAsyncClientTest<VmAsyncClient>
|
|||
}
|
||||
|
||||
public void testResetVm() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = method(VmAsyncClient.class, "resetVm", URI.class);
|
||||
Invokable<?, ?> method = method(VmApi.class, "resetVm", URI.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
|
||||
|
||||
|
@ -278,7 +278,7 @@ public class VmAsyncClientTest extends BaseVCloudAsyncClientTest<VmAsyncClient>
|
|||
}
|
||||
|
||||
public void testSuspendVm() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = method(VmAsyncClient.class, "suspendVm", URI.class);
|
||||
Invokable<?, ?> method = method(VmApi.class, "suspendVm", URI.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
|
||||
|
||||
|
@ -295,7 +295,7 @@ public class VmAsyncClientTest extends BaseVCloudAsyncClientTest<VmAsyncClient>
|
|||
}
|
||||
|
||||
public void testShutdownVm() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = method(VmAsyncClient.class, "shutdownVm", URI.class);
|
||||
Invokable<?, ?> method = method(VmApi.class, "shutdownVm", URI.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
|
||||
|
|
@ -19,8 +19,7 @@ package org.jclouds.vcloud.internal;
|
|||
import org.jclouds.compute.ComputeService;
|
||||
import org.jclouds.compute.internal.BaseComputeServiceContextLiveTest;
|
||||
import org.jclouds.sshj.config.SshjSshClientModule;
|
||||
import org.jclouds.vcloud.VCloudApiMetadata;
|
||||
import org.jclouds.vcloud.VCloudClient;
|
||||
import org.jclouds.vcloud.VCloudApi;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
|
@ -31,19 +30,19 @@ import com.google.inject.Module;
|
|||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(groups = "live", enabled = true, singleThreaded = true)
|
||||
public abstract class BaseVCloudClientLiveTest extends BaseComputeServiceContextLiveTest {
|
||||
public abstract class BaseVCloudApiLiveTest extends BaseComputeServiceContextLiveTest {
|
||||
|
||||
// username is too long for name constraints
|
||||
protected String prefix = "vcd";
|
||||
|
||||
protected ComputeService client;
|
||||
|
||||
public BaseVCloudClientLiveTest() {
|
||||
public BaseVCloudApiLiveTest() {
|
||||
provider = "vcloud";
|
||||
}
|
||||
|
||||
protected VCloudClient getVCloudApi() {
|
||||
return VCloudClient.class.cast(view.unwrap(VCloudApiMetadata.CONTEXT_TOKEN).getApi());
|
||||
protected VCloudApi getVCloudApi() {
|
||||
return view.unwrapApi(VCloudApi.class);
|
||||
}
|
||||
|
||||
@Override
|
|
@ -33,12 +33,12 @@ import org.jclouds.ovf.xml.EnvelopeHandlerTest;
|
|||
import org.jclouds.providers.AnonymousProviderMetadata;
|
||||
import org.jclouds.providers.ProviderMetadata;
|
||||
import org.jclouds.rest.AuthorizationException;
|
||||
import org.jclouds.rest.ConfiguresRestClient;
|
||||
import org.jclouds.rest.ConfiguresHttpApi;
|
||||
import org.jclouds.rest.internal.BaseAsyncClientTest;
|
||||
import org.jclouds.vcloud.VCloudApiMetadata;
|
||||
import org.jclouds.vcloud.VCloudMediaType;
|
||||
import org.jclouds.vcloud.VCloudVersionsClient;
|
||||
import org.jclouds.vcloud.config.VCloudRestClientModule;
|
||||
import org.jclouds.vcloud.VCloudVersionsApi;
|
||||
import org.jclouds.vcloud.config.VCloudHttpApiModule;
|
||||
import org.jclouds.vcloud.domain.AllocationModel;
|
||||
import org.jclouds.vcloud.domain.CatalogItem;
|
||||
import org.jclouds.vcloud.domain.Org;
|
||||
|
@ -69,13 +69,13 @@ import com.google.inject.Module;
|
|||
import com.google.inject.TypeLiteral;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code VCloudAsyncClient}
|
||||
* Tests behavior of {@code VCloudApi}
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire
|
||||
@Test(groups = "unit", testName = "BaseVCloudAsyncClientTest")
|
||||
public abstract class BaseVCloudAsyncClientTest<T> extends BaseAsyncClientTest<T> {
|
||||
@Test(groups = "unit", testName = "BaseVCloudApiTest")
|
||||
public abstract class BaseVCloudApiTest<T> extends BaseAsyncClientTest<T> {
|
||||
|
||||
@Override
|
||||
protected void checkFilters(HttpRequest request) {
|
||||
|
@ -85,7 +85,7 @@ public abstract class BaseVCloudAsyncClientTest<T> extends BaseAsyncClientTest<T
|
|||
|
||||
@Override
|
||||
protected Module createModule() {
|
||||
return new VCloudRestClientModuleExtension();
|
||||
return new VCloudHttpApiModuleExtension();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -124,11 +124,11 @@ public abstract class BaseVCloudAsyncClientTest<T> extends BaseAsyncClientTest<T
|
|||
.create("https://vcenterprise.bluelock.com/api/v1.0/vdcItem/2"))),
|
||||
ImmutableMap.<String, ReferenceType> of(NETWORK_REF.getName(), NETWORK_REF), 0, 0, 0, false);
|
||||
|
||||
@ConfiguresRestClient
|
||||
public static class VCloudRestClientModuleExtension extends VCloudRestClientModule {
|
||||
@ConfiguresHttpApi
|
||||
public static class VCloudHttpApiModuleExtension extends VCloudHttpApiModule {
|
||||
|
||||
@Override
|
||||
protected Supplier<URI> provideAuthenticationURI(VCloudVersionsClient versionService, String version) {
|
||||
protected Supplier<URI> provideAuthenticationURI(VCloudVersionsApi versionService, String version) {
|
||||
return Suppliers.ofInstance(URI.create("https://vcenterprise.bluelock.com/api/v1.0/login"));
|
||||
}
|
||||
|
||||
|
@ -163,7 +163,7 @@ public abstract class BaseVCloudAsyncClientTest<T> extends BaseAsyncClientTest<T
|
|||
|
||||
@Override
|
||||
protected Supplier<VCloudSession> provideVCloudTokenCache(@Named(PROPERTY_SESSION_INTERVAL) long seconds,
|
||||
AtomicReference<AuthorizationException> authException, final VCloudLoginClient login) {
|
||||
AtomicReference<AuthorizationException> authException, final VCloudLoginApi login) {
|
||||
return Suppliers.<VCloudSession> ofInstance(new VCloudSession() {
|
||||
|
||||
@Override
|
|
@ -42,16 +42,16 @@ import com.google.inject.Binder;
|
|||
import com.google.inject.Module;
|
||||
import com.google.inject.Provides;
|
||||
/**
|
||||
* Tests behavior of {@code VCloudLoginAsyncClient}
|
||||
* Tests behavior of {@code VCloudLoginApi}
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire
|
||||
@Test(groups = "unit", testName = "VCloudLoginAsyncClientTest")
|
||||
public class VCloudLoginAsyncClientTest extends BaseAsyncClientTest<VCloudLoginAsyncClient> {
|
||||
@Test(groups = "unit", testName = "VCloudLoginApiTest")
|
||||
public class VCloudLoginApiTest extends BaseAsyncClientTest<VCloudLoginApi> {
|
||||
|
||||
public void testLogin() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = method(VCloudLoginAsyncClient.class, "login");
|
||||
Invokable<?, ?> method = method(VCloudLoginApi.class, "login");
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertEquals(request.getRequestLine(), "POST http://localhost:8080/login HTTP/1.1");
|
||||
|
@ -90,8 +90,8 @@ public class VCloudLoginAsyncClientTest extends BaseAsyncClientTest<VCloudLoginA
|
|||
|
||||
@Override
|
||||
protected ProviderMetadata createProviderMetadata() {
|
||||
return AnonymousProviderMetadata.forClientMappedToAsyncClientOnEndpoint(VCloudLoginClient.class,
|
||||
VCloudLoginAsyncClient.class, "http://localhost:8080/login");
|
||||
return AnonymousProviderMetadata.forApiOnEndpoint(VCloudLoginApi.class,
|
||||
"http://localhost:8080/login");
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,576 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.jclouds.trmk.vcloud_0_8;
|
||||
|
||||
import static org.jclouds.trmk.vcloud_0_8.TerremarkVCloudMediaType.CATALOGITEMCUSTOMIZATIONPARAMETERS_XML;
|
||||
import static org.jclouds.trmk.vcloud_0_8.TerremarkVCloudMediaType.CATALOGITEM_XML;
|
||||
import static org.jclouds.trmk.vcloud_0_8.TerremarkVCloudMediaType.CATALOG_XML;
|
||||
import static org.jclouds.trmk.vcloud_0_8.TerremarkVCloudMediaType.INTERNETSERVICESLIST_XML;
|
||||
import static org.jclouds.trmk.vcloud_0_8.TerremarkVCloudMediaType.INTERNETSERVICE_XML;
|
||||
import static org.jclouds.trmk.vcloud_0_8.TerremarkVCloudMediaType.NETWORK_XML;
|
||||
import static org.jclouds.trmk.vcloud_0_8.TerremarkVCloudMediaType.NODESERVICE_XML;
|
||||
import static org.jclouds.trmk.vcloud_0_8.TerremarkVCloudMediaType.ORG_XML;
|
||||
import static org.jclouds.trmk.vcloud_0_8.TerremarkVCloudMediaType.PUBLICIPSLIST_XML;
|
||||
import static org.jclouds.trmk.vcloud_0_8.TerremarkVCloudMediaType.PUBLICIP_XML;
|
||||
import static org.jclouds.trmk.vcloud_0_8.TerremarkVCloudMediaType.TASKSLIST_XML;
|
||||
import static org.jclouds.trmk.vcloud_0_8.TerremarkVCloudMediaType.TASK_XML;
|
||||
import static org.jclouds.trmk.vcloud_0_8.TerremarkVCloudMediaType.VAPPTEMPLATE_XML;
|
||||
import static org.jclouds.trmk.vcloud_0_8.TerremarkVCloudMediaType.VAPP_XML;
|
||||
import static org.jclouds.trmk.vcloud_0_8.TerremarkVCloudMediaType.VDC_XML;
|
||||
|
||||
import java.io.Closeable;
|
||||
import java.net.URI;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.DELETE;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.POST;
|
||||
import javax.ws.rs.PUT;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.Produces;
|
||||
|
||||
import org.jclouds.Fallbacks;
|
||||
import org.jclouds.javax.annotation.Nullable;
|
||||
import org.jclouds.predicates.validators.DnsNameValidator;
|
||||
import org.jclouds.rest.annotations.EndpointParam;
|
||||
import org.jclouds.rest.annotations.Fallback;
|
||||
import org.jclouds.rest.annotations.MapBinder;
|
||||
import org.jclouds.rest.annotations.ParamValidators;
|
||||
import org.jclouds.rest.annotations.PayloadParam;
|
||||
import org.jclouds.rest.annotations.RequestFilters;
|
||||
import org.jclouds.rest.annotations.ResponseParser;
|
||||
import org.jclouds.rest.annotations.XMLResponseParser;
|
||||
import org.jclouds.trmk.vcloud_0_8.binders.BindCloneVAppParamsToXmlPayload;
|
||||
import org.jclouds.trmk.vcloud_0_8.binders.BindInstantiateVAppTemplateParamsToXmlPayload;
|
||||
import org.jclouds.trmk.vcloud_0_8.binders.BindNodeConfigurationToXmlPayload;
|
||||
import org.jclouds.trmk.vcloud_0_8.binders.BindVAppConfigurationToXmlPayload;
|
||||
import org.jclouds.trmk.vcloud_0_8.binders.OrgNameAndCatalogNameToEndpoint;
|
||||
import org.jclouds.trmk.vcloud_0_8.binders.OrgNameAndTasksListNameToEndpoint;
|
||||
import org.jclouds.trmk.vcloud_0_8.binders.OrgNameAndVDCNameToEndpoint;
|
||||
import org.jclouds.trmk.vcloud_0_8.binders.OrgNameCatalogNameItemNameToEndpoint;
|
||||
import org.jclouds.trmk.vcloud_0_8.binders.OrgNameCatalogNameVAppTemplateNameToEndpoint;
|
||||
import org.jclouds.trmk.vcloud_0_8.binders.OrgNameVDCNameResourceEntityNameToEndpoint;
|
||||
import org.jclouds.trmk.vcloud_0_8.domain.Catalog;
|
||||
import org.jclouds.trmk.vcloud_0_8.domain.CatalogItem;
|
||||
import org.jclouds.trmk.vcloud_0_8.domain.CustomizationParameters;
|
||||
import org.jclouds.trmk.vcloud_0_8.domain.InternetService;
|
||||
import org.jclouds.trmk.vcloud_0_8.domain.KeyPair;
|
||||
import org.jclouds.trmk.vcloud_0_8.domain.Network;
|
||||
import org.jclouds.trmk.vcloud_0_8.domain.Node;
|
||||
import org.jclouds.trmk.vcloud_0_8.domain.Protocol;
|
||||
import org.jclouds.trmk.vcloud_0_8.domain.PublicIpAddress;
|
||||
import org.jclouds.trmk.vcloud_0_8.domain.ReferenceType;
|
||||
import org.jclouds.trmk.vcloud_0_8.domain.Task;
|
||||
import org.jclouds.trmk.vcloud_0_8.domain.TasksList;
|
||||
import org.jclouds.trmk.vcloud_0_8.domain.VApp;
|
||||
import org.jclouds.trmk.vcloud_0_8.domain.VAppConfiguration;
|
||||
import org.jclouds.trmk.vcloud_0_8.domain.VAppTemplate;
|
||||
import org.jclouds.trmk.vcloud_0_8.domain.VDC;
|
||||
import org.jclouds.trmk.vcloud_0_8.filters.SetVCloudTokenCookie;
|
||||
import org.jclouds.trmk.vcloud_0_8.functions.OrgNameToEndpoint;
|
||||
import org.jclouds.trmk.vcloud_0_8.functions.ParseTaskFromLocationHeader;
|
||||
import org.jclouds.trmk.vcloud_0_8.functions.VDCURIToInternetServicesEndpoint;
|
||||
import org.jclouds.trmk.vcloud_0_8.functions.VDCURIToPublicIPsEndpoint;
|
||||
import org.jclouds.trmk.vcloud_0_8.options.AddInternetServiceOptions;
|
||||
import org.jclouds.trmk.vcloud_0_8.options.AddNodeOptions;
|
||||
import org.jclouds.trmk.vcloud_0_8.options.CloneVAppOptions;
|
||||
import org.jclouds.trmk.vcloud_0_8.options.InstantiateVAppTemplateOptions;
|
||||
import org.jclouds.trmk.vcloud_0_8.xml.CatalogHandler;
|
||||
import org.jclouds.trmk.vcloud_0_8.xml.CatalogItemHandler;
|
||||
import org.jclouds.trmk.vcloud_0_8.xml.CustomizationParametersHandler;
|
||||
import org.jclouds.trmk.vcloud_0_8.xml.InternetServiceHandler;
|
||||
import org.jclouds.trmk.vcloud_0_8.xml.InternetServicesHandler;
|
||||
import org.jclouds.trmk.vcloud_0_8.xml.NetworkHandler;
|
||||
import org.jclouds.trmk.vcloud_0_8.xml.NodeHandler;
|
||||
import org.jclouds.trmk.vcloud_0_8.xml.NodesHandler;
|
||||
import org.jclouds.trmk.vcloud_0_8.xml.OrgHandler;
|
||||
import org.jclouds.trmk.vcloud_0_8.xml.PublicIpAddressesHandler;
|
||||
import org.jclouds.trmk.vcloud_0_8.xml.TaskHandler;
|
||||
import org.jclouds.trmk.vcloud_0_8.xml.TasksListHandler;
|
||||
import org.jclouds.trmk.vcloud_0_8.xml.VAppHandler;
|
||||
import org.jclouds.trmk.vcloud_0_8.xml.VAppTemplateHandler;
|
||||
import org.jclouds.trmk.vcloud_0_8.xml.VDCHandler;
|
||||
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
import com.google.inject.Provides;
|
||||
|
||||
/**
|
||||
* Provides access to VCloud resources via their REST API.
|
||||
* <p/>
|
||||
*
|
||||
* @see <a href=
|
||||
* "https://community.vcloudexpress.terremark.com/en-us/discussion_forums/f/60.aspx"
|
||||
* />
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@RequestFilters(SetVCloudTokenCookie.class)
|
||||
public interface TerremarkVCloudApi extends Closeable {
|
||||
@GET
|
||||
@XMLResponseParser(CatalogHandler.class)
|
||||
@Consumes(CATALOG_XML)
|
||||
@Fallback(Fallbacks.NullOnNotFoundOr404.class)
|
||||
Catalog getCatalog(@EndpointParam URI catalogId);
|
||||
|
||||
/**
|
||||
* returns the catalog in the organization associated with the specified
|
||||
* name. Note that both parameters can be null to choose default.
|
||||
*
|
||||
* @param orgName
|
||||
* organization name, or null for the default
|
||||
* @param catalogName
|
||||
* catalog name, or null for the default
|
||||
* @throws NoSuchElementException
|
||||
* if you specified an org or catalog name that isn't present
|
||||
*/
|
||||
@GET
|
||||
@XMLResponseParser(CatalogHandler.class)
|
||||
@Fallback(Fallbacks.NullOnNotFoundOr404.class)
|
||||
@Consumes(CATALOG_XML)
|
||||
@MapBinder(OrgNameAndCatalogNameToEndpoint.class)
|
||||
Catalog findCatalogInOrgNamed(@Nullable @PayloadParam("orgName") String orgName,
|
||||
@Nullable @PayloadParam("catalogName") String catalogName);
|
||||
|
||||
@GET
|
||||
@Consumes(CATALOGITEM_XML)
|
||||
@XMLResponseParser(CatalogItemHandler.class)
|
||||
@Fallback(Fallbacks.NullOnNotFoundOr404.class)
|
||||
CatalogItem getCatalogItem(@EndpointParam URI catalogItem);
|
||||
|
||||
/**
|
||||
* returns the catalog item in the catalog associated with the specified
|
||||
* name. Note that the org and catalog parameters can be null to choose
|
||||
* default.
|
||||
*
|
||||
* @param orgName
|
||||
* organization name, or null for the default
|
||||
* @param catalogName
|
||||
* catalog name, or null for the default
|
||||
* @param itemName
|
||||
* item you wish to lookup
|
||||
*
|
||||
* @throws NoSuchElementException
|
||||
* if you specified an org, catalog, or catalog item name that
|
||||
* isn't present
|
||||
*/
|
||||
@GET
|
||||
@Consumes(CATALOGITEM_XML)
|
||||
@XMLResponseParser(CatalogItemHandler.class)
|
||||
@Fallback(Fallbacks.NullOnNotFoundOr404.class)
|
||||
@MapBinder(OrgNameCatalogNameItemNameToEndpoint.class)
|
||||
CatalogItem findCatalogItemInOrgCatalogNamed(@Nullable @PayloadParam("orgName") String orgName,
|
||||
@Nullable @PayloadParam("catalogName") String catalogName, @PayloadParam("itemName") String itemName);
|
||||
|
||||
@GET
|
||||
@Consumes(NETWORK_XML)
|
||||
@XMLResponseParser(NetworkHandler.class)
|
||||
@Fallback(Fallbacks.NullOnNotFoundOr404.class)
|
||||
@MapBinder(OrgNameVDCNameResourceEntityNameToEndpoint.class)
|
||||
Network findNetworkInOrgVDCNamed(@Nullable @PayloadParam("orgName") String orgName,
|
||||
@Nullable @PayloadParam("vdcName") String vdcName, @PayloadParam("resourceName") String networkName);
|
||||
|
||||
@GET
|
||||
@Consumes(NETWORK_XML)
|
||||
@XMLResponseParser(NetworkHandler.class)
|
||||
@Fallback(Fallbacks.NullOnNotFoundOr404.class)
|
||||
Network getNetwork(@EndpointParam URI network);
|
||||
|
||||
/**
|
||||
* returns the VDC in the organization associated with the specified name.
|
||||
* Note that both parameters can be null to choose default.
|
||||
*
|
||||
* @param orgName
|
||||
* organization name, or null for the default
|
||||
* @param vdcName
|
||||
* catalog name, or null for the default
|
||||
* @throws NoSuchElementException
|
||||
* if you specified an org or vdc name that isn't present
|
||||
*/
|
||||
@GET
|
||||
@XMLResponseParser(VDCHandler.class)
|
||||
@Consumes(VDC_XML)
|
||||
@Fallback(Fallbacks.NullOnNotFoundOr404.class)
|
||||
@MapBinder(OrgNameAndVDCNameToEndpoint.class)
|
||||
VDC findVDCInOrgNamed(@Nullable @PayloadParam("orgName") String orgName,
|
||||
@Nullable @PayloadParam("vdcName") String vdcName);
|
||||
|
||||
@GET
|
||||
@Consumes(TASKSLIST_XML)
|
||||
@XMLResponseParser(TasksListHandler.class)
|
||||
@Fallback(Fallbacks.NullOnNotFoundOr404.class)
|
||||
TasksList getTasksList(@EndpointParam URI tasksListId);
|
||||
|
||||
@GET
|
||||
@XMLResponseParser(TasksListHandler.class)
|
||||
@Fallback(Fallbacks.NullOnNotFoundOr404.class)
|
||||
@Consumes(TASKSLIST_XML)
|
||||
@MapBinder(OrgNameAndTasksListNameToEndpoint.class)
|
||||
TasksList findTasksListInOrgNamed(@Nullable @PayloadParam("orgName") String orgName,
|
||||
@Nullable @PayloadParam("tasksListName") String tasksListName);
|
||||
|
||||
/**
|
||||
* Whenever the result of a request cannot be returned immediately, the
|
||||
* server creates a Task object and includes it in the response, as a member
|
||||
* of the Tasks container in the response body. Each Task has an href value,
|
||||
* which is a URL that the client can use to retrieve the Task element alone,
|
||||
* without the rest of the response in which it was contained. All
|
||||
* information about the task is included in the Task element when it is
|
||||
* returned in the response's Tasks container, so a client does not need to
|
||||
* make an additional request to the Task URL unless it wants to follow the
|
||||
* progress of a task that was incomplete.
|
||||
*/
|
||||
@GET
|
||||
@Consumes(TASK_XML)
|
||||
@XMLResponseParser(TaskHandler.class)
|
||||
@Fallback(Fallbacks.NullOnNotFoundOr404.class)
|
||||
Task getTask(@EndpointParam URI taskId);
|
||||
|
||||
@POST
|
||||
@Path("/action/cancel")
|
||||
void cancelTask(@EndpointParam URI taskId);
|
||||
|
||||
/**
|
||||
*
|
||||
* @return a listing of all orgs that the current user has access to.
|
||||
*/
|
||||
@Provides
|
||||
@org.jclouds.trmk.vcloud_0_8.endpoints.Org
|
||||
Map<String, ReferenceType> listOrgs();
|
||||
|
||||
@POST
|
||||
@Path("/action/instantiateVAppTemplate")
|
||||
@Produces("application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml")
|
||||
@Consumes(VAPP_XML)
|
||||
@XMLResponseParser(VAppHandler.class)
|
||||
@MapBinder(BindInstantiateVAppTemplateParamsToXmlPayload.class)
|
||||
VApp instantiateVAppTemplateInVDC(@EndpointParam URI vdc,
|
||||
@PayloadParam("template") URI template,
|
||||
@PayloadParam("name") @ParamValidators(DnsNameValidator.class) String appName,
|
||||
InstantiateVAppTemplateOptions... options);
|
||||
|
||||
@POST
|
||||
@Path("/action/cloneVApp")
|
||||
@Produces("application/vnd.vmware.vcloud.cloneVAppParams+xml")
|
||||
@Consumes(TASK_XML)
|
||||
@XMLResponseParser(TaskHandler.class)
|
||||
@MapBinder(BindCloneVAppParamsToXmlPayload.class)
|
||||
Task cloneVAppInVDC(@EndpointParam URI vdc, @PayloadParam("vApp") URI toClone,
|
||||
@PayloadParam("newName") @ParamValidators(DnsNameValidator.class) String newName, CloneVAppOptions... options);
|
||||
|
||||
@GET
|
||||
@Consumes(VAPPTEMPLATE_XML)
|
||||
@XMLResponseParser(VAppTemplateHandler.class)
|
||||
@Fallback(Fallbacks.NullOnNotFoundOr404.class)
|
||||
VAppTemplate getVAppTemplate(@EndpointParam URI vAppTemplate);
|
||||
|
||||
/**
|
||||
* returns the vapp template corresponding to a catalog item in the catalog
|
||||
* associated with the specified name. Note that the org and catalog
|
||||
* parameters can be null to choose default.
|
||||
*
|
||||
* @param orgName
|
||||
* organization name, or null for the default
|
||||
* @param catalogName
|
||||
* catalog name, or null for the default
|
||||
* @param itemName
|
||||
* item you wish to lookup
|
||||
*
|
||||
* @throws NoSuchElementException
|
||||
* if you specified an org, catalog, or catalog item name that
|
||||
* isn't present
|
||||
*/
|
||||
@GET
|
||||
@Consumes(VAPPTEMPLATE_XML)
|
||||
@XMLResponseParser(VAppTemplateHandler.class)
|
||||
@Fallback(Fallbacks.NullOnNotFoundOr404.class)
|
||||
@MapBinder(OrgNameCatalogNameVAppTemplateNameToEndpoint.class)
|
||||
VAppTemplate findVAppTemplateInOrgCatalogNamed(@Nullable @PayloadParam("orgName") String orgName,
|
||||
@Nullable @PayloadParam("catalogName") String catalogName, @PayloadParam("itemName") String itemName);
|
||||
|
||||
@GET
|
||||
@Consumes(VAPP_XML)
|
||||
@XMLResponseParser(VAppHandler.class)
|
||||
@Fallback(Fallbacks.NullOnNotFoundOr404.class)
|
||||
@MapBinder(OrgNameVDCNameResourceEntityNameToEndpoint.class)
|
||||
VApp findVAppInOrgVDCNamed(@Nullable @PayloadParam("orgName") String orgName,
|
||||
@Nullable @PayloadParam("vdcName") String vdcName, @PayloadParam("resourceName") String vAppName);
|
||||
|
||||
@GET
|
||||
@Consumes(VAPP_XML)
|
||||
@XMLResponseParser(VAppHandler.class)
|
||||
@Fallback(Fallbacks.NullOnNotFoundOr404.class)
|
||||
VApp getVApp(@EndpointParam URI vApp);
|
||||
|
||||
@POST
|
||||
@Consumes(TASK_XML)
|
||||
@Path("/action/deploy")
|
||||
@XMLResponseParser(TaskHandler.class)
|
||||
Task deployVApp(@EndpointParam URI vAppId);
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@POST
|
||||
@Consumes(TASK_XML)
|
||||
@Path("/action/undeploy")
|
||||
@XMLResponseParser(TaskHandler.class)
|
||||
Task undeployVApp(@EndpointParam URI vAppId);
|
||||
|
||||
/**
|
||||
* This call powers on the vApp, as specified in the vApp's ovf:Startup
|
||||
* element.
|
||||
*/
|
||||
@POST
|
||||
@Consumes(TASK_XML)
|
||||
@Path("/power/action/powerOn")
|
||||
@XMLResponseParser(TaskHandler.class)
|
||||
Task powerOnVApp(@EndpointParam URI vAppId);
|
||||
|
||||
/**
|
||||
* This call powers off the vApp, as specified in the vApp's ovf:Startup
|
||||
* element.
|
||||
*/
|
||||
@POST
|
||||
@Consumes(TASK_XML)
|
||||
@Path("/power/action/powerOff")
|
||||
@XMLResponseParser(TaskHandler.class)
|
||||
Task powerOffVApp(@EndpointParam URI vAppId);
|
||||
|
||||
/**
|
||||
* This call shuts down the vApp.
|
||||
*/
|
||||
@POST
|
||||
@Path("/power/action/shutdown")
|
||||
void shutdownVApp(@EndpointParam URI vAppId);
|
||||
|
||||
/**
|
||||
* This call resets the vApp.
|
||||
*/
|
||||
@POST
|
||||
@Consumes(TASK_XML)
|
||||
@Path("/power/action/reset")
|
||||
@XMLResponseParser(TaskHandler.class)
|
||||
Task resetVApp(@EndpointParam URI vAppId);
|
||||
|
||||
/**
|
||||
* This call suspends the vApp.
|
||||
*/
|
||||
@POST
|
||||
@Consumes(TASK_XML)
|
||||
@Path("/power/action/suspend")
|
||||
@XMLResponseParser(TaskHandler.class)
|
||||
Task suspendVApp(@EndpointParam URI vAppId);
|
||||
|
||||
@DELETE
|
||||
@ResponseParser(ParseTaskFromLocationHeader.class)
|
||||
@Fallback(Fallbacks.NullOnNotFoundOr404.class)
|
||||
Task deleteVApp(@EndpointParam URI vAppId);
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@GET
|
||||
@XMLResponseParser(VDCHandler.class)
|
||||
@Consumes(VDC_XML)
|
||||
@Fallback(Fallbacks.NullOnNotFoundOr404.class)
|
||||
VDC getVDC(@EndpointParam URI vdc);
|
||||
|
||||
@GET
|
||||
@XMLResponseParser(OrgHandler.class)
|
||||
@Fallback(Fallbacks.NullOnNotFoundOr404.class)
|
||||
@Consumes(ORG_XML)
|
||||
org.jclouds.trmk.vcloud_0_8.domain.Org getOrg(@EndpointParam URI orgId);
|
||||
|
||||
@GET
|
||||
@XMLResponseParser(OrgHandler.class)
|
||||
@Fallback(Fallbacks.NullOnNotFoundOr404.class)
|
||||
@Consumes(ORG_XML)
|
||||
org.jclouds.trmk.vcloud_0_8.domain.Org findOrgNamed(
|
||||
@Nullable @EndpointParam(parser = OrgNameToEndpoint.class) String orgName);
|
||||
|
||||
@GET
|
||||
@XMLResponseParser(CustomizationParametersHandler.class)
|
||||
@Consumes(CATALOGITEMCUSTOMIZATIONPARAMETERS_XML)
|
||||
CustomizationParameters getCustomizationOptions(@EndpointParam URI customization);
|
||||
|
||||
/**
|
||||
* This call returns a list of public IP addresses.
|
||||
*/
|
||||
@GET
|
||||
@Consumes(PUBLICIPSLIST_XML)
|
||||
@XMLResponseParser(PublicIpAddressesHandler.class)
|
||||
@Fallback(Fallbacks.EmptySetOnNotFoundOr404.class)
|
||||
Set<PublicIpAddress> getPublicIpsAssociatedWithVDC(
|
||||
@EndpointParam(parser = VDCURIToPublicIPsEndpoint.class) URI vDCId);
|
||||
|
||||
@DELETE
|
||||
@Fallback(TerremarkVCloudFallbacks.VoidOnDeleteDefaultIp.class)
|
||||
void deletePublicIp(@EndpointParam URI ipId);
|
||||
|
||||
/**
|
||||
* This call adds an internet service to a known, existing public IP. This
|
||||
* call is identical to Add Internet Service except you specify the public IP
|
||||
* in the request.
|
||||
*
|
||||
*/
|
||||
@POST
|
||||
@Path("/internetServices")
|
||||
@Produces(INTERNETSERVICE_XML)
|
||||
@Consumes(INTERNETSERVICE_XML)
|
||||
@XMLResponseParser(InternetServiceHandler.class)
|
||||
@MapBinder(AddInternetServiceOptions.class)
|
||||
InternetService addInternetServiceToExistingIp(@EndpointParam URI publicIpId,
|
||||
@PayloadParam("name") String serviceName, @PayloadParam("protocol") Protocol protocol,
|
||||
@PayloadParam("port") int port, AddInternetServiceOptions... options);
|
||||
|
||||
@DELETE
|
||||
@Fallback(Fallbacks.VoidOnNotFoundOr404.class)
|
||||
void deleteInternetService(@EndpointParam URI internetServiceId);
|
||||
|
||||
@GET
|
||||
@Consumes(INTERNETSERVICESLIST_XML)
|
||||
@XMLResponseParser(InternetServiceHandler.class)
|
||||
@Fallback(Fallbacks.NullOnNotFoundOr404.class)
|
||||
InternetService getInternetService(@EndpointParam URI internetServiceId);
|
||||
|
||||
@GET
|
||||
@Consumes(INTERNETSERVICESLIST_XML)
|
||||
@XMLResponseParser(InternetServicesHandler.class)
|
||||
@Fallback(Fallbacks.EmptySetOnNotFoundOr404.class)
|
||||
Set<InternetService> getAllInternetServicesInVDC(
|
||||
@EndpointParam(parser = VDCURIToInternetServicesEndpoint.class) URI vDCId);
|
||||
|
||||
/**
|
||||
* This call returns information about the internet service on a public IP.
|
||||
*/
|
||||
@GET
|
||||
@Path("/internetServices")
|
||||
@Consumes(INTERNETSERVICESLIST_XML)
|
||||
@XMLResponseParser(InternetServicesHandler.class)
|
||||
@Fallback(Fallbacks.EmptySetOnNotFoundOr404.class)
|
||||
Set<InternetService> getInternetServicesOnPublicIp(@EndpointParam URI ipId);
|
||||
|
||||
@GET
|
||||
@Consumes(PUBLICIP_XML)
|
||||
@XMLResponseParser(InternetServicesHandler.class)
|
||||
@Fallback(Fallbacks.EmptySetOnNotFoundOr404.class)
|
||||
Set<InternetService> getPublicIp(@EndpointParam URI ipId);
|
||||
|
||||
/**
|
||||
* This call adds a node to an existing internet service.
|
||||
* <p/>
|
||||
* Every vDC is assigned a network of 60 IP addresses that can be used as
|
||||
* nodes. Each node can associated with multiple internet service. You can
|
||||
* get a list of the available IP addresses by calling Get IP Addresses for a
|
||||
* Network.
|
||||
*
|
||||
* @param internetServiceId
|
||||
* @param ipAddress
|
||||
* @param name
|
||||
* @param port
|
||||
* @param options
|
||||
* @return
|
||||
*/
|
||||
@POST
|
||||
@Path("/nodeServices")
|
||||
@Produces(NODESERVICE_XML)
|
||||
@Consumes(NODESERVICE_XML)
|
||||
@XMLResponseParser(NodeHandler.class)
|
||||
@MapBinder(AddNodeOptions.class)
|
||||
Node addNode(@EndpointParam URI internetServiceId,
|
||||
@PayloadParam("ipAddress") String ipAddress, @PayloadParam("name") String name,
|
||||
@PayloadParam("port") int port, AddNodeOptions... options);
|
||||
|
||||
@GET
|
||||
@XMLResponseParser(NodeHandler.class)
|
||||
@Consumes(NODESERVICE_XML)
|
||||
@Fallback(Fallbacks.NullOnNotFoundOr404.class)
|
||||
Node getNode(@EndpointParam URI nodeId);
|
||||
|
||||
@PUT
|
||||
@Produces(NODESERVICE_XML)
|
||||
@Consumes(NODESERVICE_XML)
|
||||
@XMLResponseParser(NodeHandler.class)
|
||||
@MapBinder(BindNodeConfigurationToXmlPayload.class)
|
||||
Node configureNode(@EndpointParam URI nodeId, @PayloadParam("name") String name,
|
||||
@PayloadParam("enabled") boolean enabled, @Nullable @PayloadParam("description") String description);
|
||||
|
||||
@DELETE
|
||||
@Fallback(Fallbacks.VoidOnNotFoundOr404.class)
|
||||
void deleteNode(@EndpointParam URI nodeId);
|
||||
|
||||
@GET
|
||||
@Path("/nodeServices")
|
||||
@XMLResponseParser(NodesHandler.class)
|
||||
@Fallback(Fallbacks.EmptySetOnNotFoundOr404.class)
|
||||
@Consumes(NODESERVICE_XML)
|
||||
Set<Node> getNodes(@EndpointParam URI internetServiceId);
|
||||
|
||||
/**
|
||||
* This call configures the settings of an existing vApp by passing the new
|
||||
* configuration. The existing vApp must be in a powered off state (status =
|
||||
* 2).
|
||||
* <p/>
|
||||
* You can change the following items for a vApp.
|
||||
* <ol>
|
||||
* <li>vApp name Number of virtual CPUs</li>
|
||||
* <li>Amount of virtual memory</li>
|
||||
* <li>Add a virtual disk</li>
|
||||
* <li>Delete a virtual disk</li>
|
||||
* </ol>
|
||||
* You can make more than one change in a single request. For example, you
|
||||
* can increase the number of virtual CPUs and the amount of virtual memory
|
||||
* in the same request.
|
||||
*
|
||||
* @param VApp
|
||||
* vApp to change in power state off
|
||||
* @param configuration
|
||||
* (s) to change
|
||||
* @return task of configuration change
|
||||
*/
|
||||
@PUT
|
||||
@Produces(VAPP_XML)
|
||||
@Consumes(VAPP_XML)
|
||||
@MapBinder(BindVAppConfigurationToXmlPayload.class)
|
||||
@ResponseParser(ParseTaskFromLocationHeader.class)
|
||||
Task configureVApp(
|
||||
@EndpointParam(parser = BindVAppConfigurationToXmlPayload.class) VApp vApp, VAppConfiguration configuration);
|
||||
|
||||
/**
|
||||
*/
|
||||
Set<KeyPair> listKeyPairsInOrg(URI org);
|
||||
|
||||
/**
|
||||
* @throws IllegalStateException
|
||||
* if a key of the same name already exists
|
||||
*/
|
||||
KeyPair generateKeyPairInOrg(URI org, String name, boolean makeDefault);
|
||||
|
||||
/**
|
||||
*/
|
||||
KeyPair findKeyPairInOrg(URI org, String keyPairName);
|
||||
|
||||
KeyPair getKeyPair(URI keyPair);
|
||||
|
||||
// TODO
|
||||
// KeyPair configureKeyPair(int keyPairId, KeyPairConfiguration
|
||||
// keyPairConfiguration);
|
||||
|
||||
void deleteKeyPair(URI keyPair);
|
||||
|
||||
}
|
|
@ -1,547 +0,0 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.jclouds.trmk.vcloud_0_8;
|
||||
|
||||
import static org.jclouds.trmk.vcloud_0_8.TerremarkVCloudMediaType.CATALOGITEMCUSTOMIZATIONPARAMETERS_XML;
|
||||
import static org.jclouds.trmk.vcloud_0_8.TerremarkVCloudMediaType.CATALOGITEM_XML;
|
||||
import static org.jclouds.trmk.vcloud_0_8.TerremarkVCloudMediaType.CATALOG_XML;
|
||||
import static org.jclouds.trmk.vcloud_0_8.TerremarkVCloudMediaType.INTERNETSERVICESLIST_XML;
|
||||
import static org.jclouds.trmk.vcloud_0_8.TerremarkVCloudMediaType.INTERNETSERVICE_XML;
|
||||
import static org.jclouds.trmk.vcloud_0_8.TerremarkVCloudMediaType.NETWORK_XML;
|
||||
import static org.jclouds.trmk.vcloud_0_8.TerremarkVCloudMediaType.NODESERVICE_XML;
|
||||
import static org.jclouds.trmk.vcloud_0_8.TerremarkVCloudMediaType.ORG_XML;
|
||||
import static org.jclouds.trmk.vcloud_0_8.TerremarkVCloudMediaType.PUBLICIPSLIST_XML;
|
||||
import static org.jclouds.trmk.vcloud_0_8.TerremarkVCloudMediaType.PUBLICIP_XML;
|
||||
import static org.jclouds.trmk.vcloud_0_8.TerremarkVCloudMediaType.TASKSLIST_XML;
|
||||
import static org.jclouds.trmk.vcloud_0_8.TerremarkVCloudMediaType.TASK_XML;
|
||||
import static org.jclouds.trmk.vcloud_0_8.TerremarkVCloudMediaType.VAPPTEMPLATE_XML;
|
||||
import static org.jclouds.trmk.vcloud_0_8.TerremarkVCloudMediaType.VAPP_XML;
|
||||
import static org.jclouds.trmk.vcloud_0_8.TerremarkVCloudMediaType.VDC_XML;
|
||||
|
||||
import java.io.Closeable;
|
||||
import java.net.URI;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.DELETE;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.POST;
|
||||
import javax.ws.rs.PUT;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.Produces;
|
||||
|
||||
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
|
||||
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
|
||||
import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
|
||||
import org.jclouds.javax.annotation.Nullable;
|
||||
import org.jclouds.predicates.validators.DnsNameValidator;
|
||||
import org.jclouds.rest.annotations.EndpointParam;
|
||||
import org.jclouds.rest.annotations.Fallback;
|
||||
import org.jclouds.rest.annotations.MapBinder;
|
||||
import org.jclouds.rest.annotations.ParamValidators;
|
||||
import org.jclouds.rest.annotations.PayloadParam;
|
||||
import org.jclouds.rest.annotations.RequestFilters;
|
||||
import org.jclouds.rest.annotations.ResponseParser;
|
||||
import org.jclouds.rest.annotations.XMLResponseParser;
|
||||
import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudFallbacks.VoidOnDeleteDefaultIp;
|
||||
import org.jclouds.trmk.vcloud_0_8.binders.BindCloneVAppParamsToXmlPayload;
|
||||
import org.jclouds.trmk.vcloud_0_8.binders.BindInstantiateVAppTemplateParamsToXmlPayload;
|
||||
import org.jclouds.trmk.vcloud_0_8.binders.BindNodeConfigurationToXmlPayload;
|
||||
import org.jclouds.trmk.vcloud_0_8.binders.BindVAppConfigurationToXmlPayload;
|
||||
import org.jclouds.trmk.vcloud_0_8.binders.OrgNameAndCatalogNameToEndpoint;
|
||||
import org.jclouds.trmk.vcloud_0_8.binders.OrgNameAndTasksListNameToEndpoint;
|
||||
import org.jclouds.trmk.vcloud_0_8.binders.OrgNameAndVDCNameToEndpoint;
|
||||
import org.jclouds.trmk.vcloud_0_8.binders.OrgNameCatalogNameItemNameToEndpoint;
|
||||
import org.jclouds.trmk.vcloud_0_8.binders.OrgNameCatalogNameVAppTemplateNameToEndpoint;
|
||||
import org.jclouds.trmk.vcloud_0_8.binders.OrgNameVDCNameResourceEntityNameToEndpoint;
|
||||
import org.jclouds.trmk.vcloud_0_8.domain.Catalog;
|
||||
import org.jclouds.trmk.vcloud_0_8.domain.CatalogItem;
|
||||
import org.jclouds.trmk.vcloud_0_8.domain.CustomizationParameters;
|
||||
import org.jclouds.trmk.vcloud_0_8.domain.InternetService;
|
||||
import org.jclouds.trmk.vcloud_0_8.domain.Network;
|
||||
import org.jclouds.trmk.vcloud_0_8.domain.Node;
|
||||
import org.jclouds.trmk.vcloud_0_8.domain.Protocol;
|
||||
import org.jclouds.trmk.vcloud_0_8.domain.PublicIpAddress;
|
||||
import org.jclouds.trmk.vcloud_0_8.domain.ReferenceType;
|
||||
import org.jclouds.trmk.vcloud_0_8.domain.Task;
|
||||
import org.jclouds.trmk.vcloud_0_8.domain.TasksList;
|
||||
import org.jclouds.trmk.vcloud_0_8.domain.VApp;
|
||||
import org.jclouds.trmk.vcloud_0_8.domain.VAppConfiguration;
|
||||
import org.jclouds.trmk.vcloud_0_8.domain.VAppTemplate;
|
||||
import org.jclouds.trmk.vcloud_0_8.domain.VDC;
|
||||
import org.jclouds.trmk.vcloud_0_8.endpoints.Org;
|
||||
import org.jclouds.trmk.vcloud_0_8.filters.SetVCloudTokenCookie;
|
||||
import org.jclouds.trmk.vcloud_0_8.functions.OrgNameToEndpoint;
|
||||
import org.jclouds.trmk.vcloud_0_8.functions.ParseTaskFromLocationHeader;
|
||||
import org.jclouds.trmk.vcloud_0_8.functions.VDCURIToInternetServicesEndpoint;
|
||||
import org.jclouds.trmk.vcloud_0_8.functions.VDCURIToPublicIPsEndpoint;
|
||||
import org.jclouds.trmk.vcloud_0_8.options.AddInternetServiceOptions;
|
||||
import org.jclouds.trmk.vcloud_0_8.options.AddNodeOptions;
|
||||
import org.jclouds.trmk.vcloud_0_8.options.CloneVAppOptions;
|
||||
import org.jclouds.trmk.vcloud_0_8.options.InstantiateVAppTemplateOptions;
|
||||
import org.jclouds.trmk.vcloud_0_8.xml.CatalogHandler;
|
||||
import org.jclouds.trmk.vcloud_0_8.xml.CatalogItemHandler;
|
||||
import org.jclouds.trmk.vcloud_0_8.xml.CustomizationParametersHandler;
|
||||
import org.jclouds.trmk.vcloud_0_8.xml.InternetServiceHandler;
|
||||
import org.jclouds.trmk.vcloud_0_8.xml.InternetServicesHandler;
|
||||
import org.jclouds.trmk.vcloud_0_8.xml.NetworkHandler;
|
||||
import org.jclouds.trmk.vcloud_0_8.xml.NodeHandler;
|
||||
import org.jclouds.trmk.vcloud_0_8.xml.NodesHandler;
|
||||
import org.jclouds.trmk.vcloud_0_8.xml.OrgHandler;
|
||||
import org.jclouds.trmk.vcloud_0_8.xml.PublicIpAddressesHandler;
|
||||
import org.jclouds.trmk.vcloud_0_8.xml.TaskHandler;
|
||||
import org.jclouds.trmk.vcloud_0_8.xml.TasksListHandler;
|
||||
import org.jclouds.trmk.vcloud_0_8.xml.VAppHandler;
|
||||
import org.jclouds.trmk.vcloud_0_8.xml.VAppTemplateHandler;
|
||||
import org.jclouds.trmk.vcloud_0_8.xml.VDCHandler;
|
||||
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
import com.google.inject.Provides;
|
||||
|
||||
/**
|
||||
* Provides access to VCloud resources via their REST API.
|
||||
* <p/>
|
||||
*
|
||||
* @see <a href=
|
||||
* "https://community.vcloudexpress.terremark.com/en-us/discussion_forums/f/60.aspx"
|
||||
* />
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@RequestFilters(SetVCloudTokenCookie.class)
|
||||
public interface TerremarkVCloudAsyncClient extends Closeable {
|
||||
|
||||
/**
|
||||
* @see TerremarkVCloudClient#getCatalogItemInOrg
|
||||
*/
|
||||
@GET
|
||||
@Consumes(CATALOGITEM_XML)
|
||||
@XMLResponseParser(CatalogItemHandler.class)
|
||||
@Fallback(NullOnNotFoundOr404.class)
|
||||
@MapBinder(OrgNameCatalogNameItemNameToEndpoint.class)
|
||||
ListenableFuture<? extends CatalogItem> findCatalogItemInOrgCatalogNamed(@Nullable @PayloadParam("orgName") String orgName,
|
||||
@Nullable @PayloadParam("catalogName") String catalogName, @PayloadParam("itemName") String itemName);
|
||||
|
||||
/**
|
||||
* @see TerremarkVCloudClient#getCatalogItem
|
||||
*/
|
||||
@GET
|
||||
@Consumes(CATALOGITEM_XML)
|
||||
@XMLResponseParser(CatalogItemHandler.class)
|
||||
@Fallback(NullOnNotFoundOr404.class)
|
||||
ListenableFuture<? extends CatalogItem> getCatalogItem(@EndpointParam URI catalogItem);
|
||||
|
||||
/**
|
||||
* @see TerremarkVCloudClient#getTasksList
|
||||
*/
|
||||
@GET
|
||||
@Consumes(TASKSLIST_XML)
|
||||
@XMLResponseParser(TasksListHandler.class)
|
||||
@Fallback(NullOnNotFoundOr404.class)
|
||||
ListenableFuture<? extends TasksList> getTasksList(@EndpointParam URI tasksListId);
|
||||
|
||||
/**
|
||||
* @see TerremarkVCloudClient#findTasksListInOrgNamed
|
||||
*/
|
||||
@GET
|
||||
@XMLResponseParser(TasksListHandler.class)
|
||||
@Fallback(NullOnNotFoundOr404.class)
|
||||
@Consumes(TASKSLIST_XML)
|
||||
@MapBinder(OrgNameAndTasksListNameToEndpoint.class)
|
||||
ListenableFuture<? extends TasksList> findTasksListInOrgNamed(@Nullable @PayloadParam("orgName") String orgName,
|
||||
@Nullable @PayloadParam("tasksListName") String tasksListName);
|
||||
|
||||
/**
|
||||
* @see TerremarkVCloudClient#getTask
|
||||
*/
|
||||
@GET
|
||||
@Consumes(TASK_XML)
|
||||
@XMLResponseParser(TaskHandler.class)
|
||||
@Fallback(NullOnNotFoundOr404.class)
|
||||
ListenableFuture<? extends Task> getTask(@EndpointParam URI taskId);
|
||||
|
||||
/**
|
||||
* @see TerremarkVCloudClient#cancelTask
|
||||
*/
|
||||
@POST
|
||||
@Path("/action/cancel")
|
||||
ListenableFuture<Void> cancelTask(@EndpointParam URI taskId);
|
||||
|
||||
/**
|
||||
*
|
||||
* @return a listing of all orgs that the current user has access to.
|
||||
*/
|
||||
@Provides
|
||||
@Org
|
||||
Map<String, ReferenceType> listOrgs();
|
||||
|
||||
/**
|
||||
* @see TerremarkVCloudClient#findCatalogInOrgNamed
|
||||
*/
|
||||
@GET
|
||||
@XMLResponseParser(CatalogHandler.class)
|
||||
@Fallback(NullOnNotFoundOr404.class)
|
||||
@Consumes(CATALOG_XML)
|
||||
@MapBinder(OrgNameAndCatalogNameToEndpoint.class)
|
||||
ListenableFuture<? extends Catalog> findCatalogInOrgNamed(@Nullable @PayloadParam("orgName") String orgName,
|
||||
@Nullable @PayloadParam("catalogName") String catalogName);
|
||||
|
||||
/**
|
||||
* @see VCloudClient#getVAppTemplate
|
||||
*/
|
||||
@GET
|
||||
@Consumes(VAPPTEMPLATE_XML)
|
||||
@XMLResponseParser(VAppTemplateHandler.class)
|
||||
@Fallback(NullOnNotFoundOr404.class)
|
||||
ListenableFuture<? extends VAppTemplate> getVAppTemplate(@EndpointParam URI vAppTemplate);
|
||||
|
||||
/**
|
||||
* @see VCloudClient#findVAppTemplateInOrgCatalogNamed
|
||||
*/
|
||||
@GET
|
||||
@Consumes(VAPPTEMPLATE_XML)
|
||||
@XMLResponseParser(VAppTemplateHandler.class)
|
||||
@Fallback(NullOnNotFoundOr404.class)
|
||||
@MapBinder(OrgNameCatalogNameVAppTemplateNameToEndpoint.class)
|
||||
ListenableFuture<? extends VAppTemplate> findVAppTemplateInOrgCatalogNamed(@Nullable @PayloadParam("orgName") String orgName,
|
||||
@Nullable @PayloadParam("catalogName") String catalogName, @PayloadParam("itemName") String itemName);
|
||||
|
||||
/**
|
||||
* @see VCloudClient#findNetworkInOrgVDCNamed
|
||||
*/
|
||||
@GET
|
||||
@Consumes(NETWORK_XML)
|
||||
@XMLResponseParser(NetworkHandler.class)
|
||||
@Fallback(NullOnNotFoundOr404.class)
|
||||
@MapBinder(OrgNameVDCNameResourceEntityNameToEndpoint.class)
|
||||
ListenableFuture<? extends Network> findNetworkInOrgVDCNamed(@Nullable @PayloadParam("orgName") String orgName,
|
||||
@Nullable @PayloadParam("vdcName") String vdcName, @PayloadParam("resourceName") String networkName);
|
||||
|
||||
/**
|
||||
* @see VCloudClient#getNetwork
|
||||
*/
|
||||
@GET
|
||||
@Consumes(NETWORK_XML)
|
||||
@XMLResponseParser(NetworkHandler.class)
|
||||
@Fallback(NullOnNotFoundOr404.class)
|
||||
ListenableFuture<? extends Network> getNetwork(@EndpointParam URI network);
|
||||
|
||||
/**
|
||||
* @see TerremarkVCloudClient#cloneVAppInVDC
|
||||
*/
|
||||
@POST
|
||||
@Path("/action/cloneVApp")
|
||||
@Produces("application/vnd.vmware.vcloud.cloneVAppParams+xml")
|
||||
@Consumes(TASK_XML)
|
||||
@XMLResponseParser(TaskHandler.class)
|
||||
@MapBinder(BindCloneVAppParamsToXmlPayload.class)
|
||||
ListenableFuture<? extends Task> cloneVAppInVDC(@EndpointParam URI vdc, @PayloadParam("vApp") URI toClone,
|
||||
@PayloadParam("newName") @ParamValidators(DnsNameValidator.class) String newName, CloneVAppOptions... options);
|
||||
|
||||
/**
|
||||
* @see VCloudClient#findVAppInOrgVDCNamed
|
||||
*/
|
||||
@GET
|
||||
@Consumes(VAPP_XML)
|
||||
@XMLResponseParser(VAppHandler.class)
|
||||
@Fallback(NullOnNotFoundOr404.class)
|
||||
@MapBinder(OrgNameVDCNameResourceEntityNameToEndpoint.class)
|
||||
ListenableFuture<? extends VApp> findVAppInOrgVDCNamed(@Nullable @PayloadParam("orgName") String orgName,
|
||||
@Nullable @PayloadParam("vdcName") String vdcName, @PayloadParam("resourceName") String vAppName);
|
||||
|
||||
/**
|
||||
* @see VCloudClient#getVApp
|
||||
*/
|
||||
@GET
|
||||
@Consumes(VAPP_XML)
|
||||
@XMLResponseParser(VAppHandler.class)
|
||||
@Fallback(NullOnNotFoundOr404.class)
|
||||
ListenableFuture<? extends VApp> getVApp(@EndpointParam URI vApp);
|
||||
|
||||
/**
|
||||
* @see TerremarkVCloudClient#deployVApp
|
||||
*/
|
||||
@POST
|
||||
@Consumes(TASK_XML)
|
||||
@Path("/action/deploy")
|
||||
@XMLResponseParser(TaskHandler.class)
|
||||
ListenableFuture<? extends Task> deployVApp(@EndpointParam URI vAppId);
|
||||
|
||||
/**
|
||||
* @see TerremarkVCloudClient#undeployVApp
|
||||
*/
|
||||
@POST
|
||||
@Consumes(TASK_XML)
|
||||
@Path("/action/undeploy")
|
||||
@XMLResponseParser(TaskHandler.class)
|
||||
ListenableFuture<? extends Task> undeployVApp(@EndpointParam URI vAppId);
|
||||
|
||||
/**
|
||||
* @see TerremarkVCloudClient#powerOnVApp
|
||||
*/
|
||||
@POST
|
||||
@Consumes(TASK_XML)
|
||||
@Path("/power/action/powerOn")
|
||||
@XMLResponseParser(TaskHandler.class)
|
||||
ListenableFuture<? extends Task> powerOnVApp(@EndpointParam URI vAppId);
|
||||
|
||||
/**
|
||||
* @see TerremarkVCloudClient#powerOffVApp
|
||||
*/
|
||||
@POST
|
||||
@Consumes(TASK_XML)
|
||||
@Path("/power/action/powerOff")
|
||||
@XMLResponseParser(TaskHandler.class)
|
||||
ListenableFuture<? extends Task> powerOffVApp(@EndpointParam URI vAppId);
|
||||
|
||||
/**
|
||||
* @see TerremarkVCloudClient#shutdownVApp
|
||||
*/
|
||||
@POST
|
||||
@Path("/power/action/shutdown")
|
||||
ListenableFuture<Void> shutdownVApp(@EndpointParam URI vAppId);
|
||||
|
||||
/**
|
||||
* @see TerremarkVCloudClient#resetVApp
|
||||
*/
|
||||
@POST
|
||||
@Consumes(TASK_XML)
|
||||
@Path("/power/action/reset")
|
||||
@XMLResponseParser(TaskHandler.class)
|
||||
ListenableFuture<? extends Task> resetVApp(@EndpointParam URI vAppId);
|
||||
|
||||
/**
|
||||
* @see TerremarkVCloudClient#suspendVApp
|
||||
*/
|
||||
@POST
|
||||
@Consumes(TASK_XML)
|
||||
@Path("/power/action/suspend")
|
||||
@XMLResponseParser(TaskHandler.class)
|
||||
ListenableFuture<? extends Task> suspendVApp(@EndpointParam URI vAppId);
|
||||
|
||||
/**
|
||||
* @see TerremarkVCloudClient#deleteVApp
|
||||
*/
|
||||
@DELETE
|
||||
@ResponseParser(ParseTaskFromLocationHeader.class)
|
||||
@Fallback(NullOnNotFoundOr404.class)
|
||||
ListenableFuture<Task> deleteVApp(@EndpointParam URI vAppId);
|
||||
|
||||
@GET
|
||||
@XMLResponseParser(OrgHandler.class)
|
||||
@Fallback(NullOnNotFoundOr404.class)
|
||||
@Consumes(ORG_XML)
|
||||
ListenableFuture<? extends org.jclouds.trmk.vcloud_0_8.domain.Org> getOrg(@EndpointParam URI orgId);
|
||||
|
||||
/**
|
||||
* @see TerremarkVCloudClient#findOrgNamed
|
||||
*/
|
||||
@GET
|
||||
@XMLResponseParser(OrgHandler.class)
|
||||
@Fallback(NullOnNotFoundOr404.class)
|
||||
@Consumes(ORG_XML)
|
||||
ListenableFuture<? extends org.jclouds.trmk.vcloud_0_8.domain.Org> findOrgNamed(
|
||||
@Nullable @EndpointParam(parser = OrgNameToEndpoint.class) String orgName);
|
||||
|
||||
/**
|
||||
* Terremark does not have multiple catalogs, so we ignore this parameter.
|
||||
*/
|
||||
@GET
|
||||
@XMLResponseParser(CatalogHandler.class)
|
||||
@Consumes(CATALOG_XML)
|
||||
@Fallback(NullOnNotFoundOr404.class)
|
||||
ListenableFuture<? extends Catalog> getCatalog(@EndpointParam URI catalogId);
|
||||
|
||||
/**
|
||||
* @see TerremarkTerremarkVCloudClient#getVDC
|
||||
*/
|
||||
@GET
|
||||
@XMLResponseParser(VDCHandler.class)
|
||||
@Consumes(VDC_XML)
|
||||
@Fallback(NullOnNotFoundOr404.class)
|
||||
ListenableFuture<? extends VDC> getVDC(@EndpointParam URI vdc);
|
||||
|
||||
/**
|
||||
* @see TerremarkVCloudClient#findVDCInOrgNamed
|
||||
*/
|
||||
@GET
|
||||
@XMLResponseParser(VDCHandler.class)
|
||||
@Consumes(VDC_XML)
|
||||
@Fallback(NullOnNotFoundOr404.class)
|
||||
@MapBinder(OrgNameAndVDCNameToEndpoint.class)
|
||||
ListenableFuture<? extends VDC> findVDCInOrgNamed(@Nullable @PayloadParam("orgName") String orgName,
|
||||
@Nullable @PayloadParam("vdcName") String vdcName);
|
||||
|
||||
/**
|
||||
* @see TerremarkVCloudClient#instantiateVAppTemplateInVDC
|
||||
*/
|
||||
@POST
|
||||
@Path("/action/instantiateVAppTemplate")
|
||||
@Produces("application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml")
|
||||
@Consumes(VAPP_XML)
|
||||
@XMLResponseParser(VAppHandler.class)
|
||||
@MapBinder(BindInstantiateVAppTemplateParamsToXmlPayload.class)
|
||||
ListenableFuture<? extends VApp> instantiateVAppTemplateInVDC(@EndpointParam URI vdc,
|
||||
@PayloadParam("template") URI template,
|
||||
@PayloadParam("name") @ParamValidators(DnsNameValidator.class) String appName,
|
||||
InstantiateVAppTemplateOptions... options);
|
||||
|
||||
/**
|
||||
* @see TerremarkTerremarkVCloudClient#getAllInternetServicesInVDC
|
||||
*/
|
||||
@GET
|
||||
@Consumes(INTERNETSERVICESLIST_XML)
|
||||
@XMLResponseParser(InternetServicesHandler.class)
|
||||
@Fallback(EmptySetOnNotFoundOr404.class)
|
||||
ListenableFuture<? extends Set<InternetService>> getAllInternetServicesInVDC(
|
||||
@EndpointParam(parser = VDCURIToInternetServicesEndpoint.class) URI vDCId);
|
||||
|
||||
/**
|
||||
* @see TerremarkTerremarkVCloudClient#addInternetServiceToExistingIp
|
||||
*/
|
||||
@POST
|
||||
@Path("/internetServices")
|
||||
@Produces(INTERNETSERVICE_XML)
|
||||
@Consumes(INTERNETSERVICE_XML)
|
||||
@XMLResponseParser(InternetServiceHandler.class)
|
||||
@MapBinder(AddInternetServiceOptions.class)
|
||||
ListenableFuture<? extends InternetService> addInternetServiceToExistingIp(@EndpointParam URI publicIpId,
|
||||
@PayloadParam("name") String serviceName, @PayloadParam("protocol") Protocol protocol,
|
||||
@PayloadParam("port") int port, AddInternetServiceOptions... options);
|
||||
|
||||
/**
|
||||
* @see TerremarkTerremarkVCloudClient#deletePublicIp
|
||||
*/
|
||||
@DELETE
|
||||
@Fallback(VoidOnDeleteDefaultIp.class)
|
||||
ListenableFuture<Void> deletePublicIp(@EndpointParam URI ipId);
|
||||
|
||||
/**
|
||||
* @see TerremarkTerremarkVCloudClient#getInternetServicesOnPublicIP
|
||||
*/
|
||||
@GET
|
||||
@Path("/internetServices")
|
||||
@Consumes(INTERNETSERVICESLIST_XML)
|
||||
@XMLResponseParser(InternetServicesHandler.class)
|
||||
@Fallback(EmptySetOnNotFoundOr404.class)
|
||||
ListenableFuture<? extends Set<InternetService>> getInternetServicesOnPublicIp(@EndpointParam URI ipId);
|
||||
|
||||
/**
|
||||
* @see TerremarkTerremarkVCloudClient#getPublicIp
|
||||
*/
|
||||
@GET
|
||||
@Consumes(PUBLICIP_XML)
|
||||
@XMLResponseParser(InternetServicesHandler.class)
|
||||
@Fallback(EmptySetOnNotFoundOr404.class)
|
||||
ListenableFuture<? extends Set<InternetService>> getPublicIp(@EndpointParam URI ipId);
|
||||
|
||||
/**
|
||||
* @see TerremarkTerremarkVCloudClient#getPublicIpsAssociatedWithVDC
|
||||
*/
|
||||
@GET
|
||||
@Consumes(PUBLICIPSLIST_XML)
|
||||
@XMLResponseParser(PublicIpAddressesHandler.class)
|
||||
@Fallback(EmptySetOnNotFoundOr404.class)
|
||||
ListenableFuture<? extends Set<PublicIpAddress>> getPublicIpsAssociatedWithVDC(
|
||||
@EndpointParam(parser = VDCURIToPublicIPsEndpoint.class) URI vDCId);
|
||||
|
||||
/**
|
||||
* @see TerremarkTerremarkVCloudClient#deleteInternetService
|
||||
*/
|
||||
@DELETE
|
||||
@Fallback(VoidOnNotFoundOr404.class)
|
||||
ListenableFuture<Void> deleteInternetService(@EndpointParam URI internetServiceId);
|
||||
|
||||
/**
|
||||
* @see TerremarkTerremarkVCloudClient#getInternetService
|
||||
*/
|
||||
@GET
|
||||
@Consumes(INTERNETSERVICESLIST_XML)
|
||||
@XMLResponseParser(InternetServiceHandler.class)
|
||||
@Fallback(NullOnNotFoundOr404.class)
|
||||
ListenableFuture<? extends InternetService> getInternetService(@EndpointParam URI internetServiceId);
|
||||
|
||||
/**
|
||||
* @see TerremarkTerremarkVCloudClient#addNode
|
||||
*/
|
||||
@POST
|
||||
@Path("/nodeServices")
|
||||
@Produces(NODESERVICE_XML)
|
||||
@Consumes(NODESERVICE_XML)
|
||||
@XMLResponseParser(NodeHandler.class)
|
||||
@MapBinder(AddNodeOptions.class)
|
||||
ListenableFuture<? extends Node> addNode(@EndpointParam URI internetServiceId,
|
||||
@PayloadParam("ipAddress") String ipAddress, @PayloadParam("name") String name,
|
||||
@PayloadParam("port") int port, AddNodeOptions... options);
|
||||
|
||||
/**
|
||||
* @see TerremarkTerremarkVCloudClient#getNodes
|
||||
*/
|
||||
@GET
|
||||
@Path("/nodeServices")
|
||||
@XMLResponseParser(NodesHandler.class)
|
||||
@Fallback(EmptySetOnNotFoundOr404.class)
|
||||
@Consumes(NODESERVICE_XML)
|
||||
ListenableFuture<? extends Set<Node>> getNodes(@EndpointParam URI internetServiceId);
|
||||
|
||||
/**
|
||||
* @see TerremarkTerremarkVCloudClient#getNode
|
||||
*/
|
||||
@GET
|
||||
@XMLResponseParser(NodeHandler.class)
|
||||
@Consumes(NODESERVICE_XML)
|
||||
@Fallback(NullOnNotFoundOr404.class)
|
||||
ListenableFuture<? extends Node> getNode(@EndpointParam URI nodeId);
|
||||
|
||||
/**
|
||||
* @see TerremarkTerremarkVCloudClient#configureNode
|
||||
*/
|
||||
@PUT
|
||||
@Produces(NODESERVICE_XML)
|
||||
@Consumes(NODESERVICE_XML)
|
||||
@XMLResponseParser(NodeHandler.class)
|
||||
@MapBinder(BindNodeConfigurationToXmlPayload.class)
|
||||
ListenableFuture<? extends Node> configureNode(@EndpointParam URI nodeId, @PayloadParam("name") String name,
|
||||
@PayloadParam("enabled") boolean enabled, @Nullable @PayloadParam("description") String description);
|
||||
|
||||
/**
|
||||
* @see TerremarkTerremarkVCloudClient#deleteNode
|
||||
*/
|
||||
@DELETE
|
||||
@Fallback(VoidOnNotFoundOr404.class)
|
||||
ListenableFuture<Void> deleteNode(@EndpointParam URI nodeId);
|
||||
|
||||
/**
|
||||
* @see TerremarkTerremarkVCloudClient#configureVApp
|
||||
*/
|
||||
@PUT
|
||||
@Produces(VAPP_XML)
|
||||
@Consumes(VAPP_XML)
|
||||
@MapBinder(BindVAppConfigurationToXmlPayload.class)
|
||||
@ResponseParser(ParseTaskFromLocationHeader.class)
|
||||
ListenableFuture<? extends Task> configureVApp(
|
||||
@EndpointParam(parser = BindVAppConfigurationToXmlPayload.class) VApp vApp, VAppConfiguration configuration);
|
||||
|
||||
/**
|
||||
* @see TerremarkVCloudClient#getCustomizationOptions
|
||||
*/
|
||||
@GET
|
||||
@XMLResponseParser(CustomizationParametersHandler.class)
|
||||
@Consumes(CATALOGITEMCUSTOMIZATIONPARAMETERS_XML)
|
||||
ListenableFuture<? extends CustomizationParameters> getCustomizationOptions(@EndpointParam URI customization);
|
||||
|
||||
}
|
|
@ -1,313 +0,0 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.jclouds.trmk.vcloud_0_8;
|
||||
|
||||
import java.io.Closeable;
|
||||
import java.net.URI;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import org.jclouds.javax.annotation.Nullable;
|
||||
import org.jclouds.trmk.vcloud_0_8.domain.Catalog;
|
||||
import org.jclouds.trmk.vcloud_0_8.domain.CatalogItem;
|
||||
import org.jclouds.trmk.vcloud_0_8.domain.CustomizationParameters;
|
||||
import org.jclouds.trmk.vcloud_0_8.domain.InternetService;
|
||||
import org.jclouds.trmk.vcloud_0_8.domain.KeyPair;
|
||||
import org.jclouds.trmk.vcloud_0_8.domain.Network;
|
||||
import org.jclouds.trmk.vcloud_0_8.domain.Node;
|
||||
import org.jclouds.trmk.vcloud_0_8.domain.Org;
|
||||
import org.jclouds.trmk.vcloud_0_8.domain.Protocol;
|
||||
import org.jclouds.trmk.vcloud_0_8.domain.PublicIpAddress;
|
||||
import org.jclouds.trmk.vcloud_0_8.domain.ReferenceType;
|
||||
import org.jclouds.trmk.vcloud_0_8.domain.Task;
|
||||
import org.jclouds.trmk.vcloud_0_8.domain.TasksList;
|
||||
import org.jclouds.trmk.vcloud_0_8.domain.VApp;
|
||||
import org.jclouds.trmk.vcloud_0_8.domain.VAppConfiguration;
|
||||
import org.jclouds.trmk.vcloud_0_8.domain.VAppTemplate;
|
||||
import org.jclouds.trmk.vcloud_0_8.domain.VDC;
|
||||
import org.jclouds.trmk.vcloud_0_8.options.AddInternetServiceOptions;
|
||||
import org.jclouds.trmk.vcloud_0_8.options.AddNodeOptions;
|
||||
import org.jclouds.trmk.vcloud_0_8.options.CloneVAppOptions;
|
||||
import org.jclouds.trmk.vcloud_0_8.options.InstantiateVAppTemplateOptions;
|
||||
|
||||
import com.google.inject.Provides;
|
||||
|
||||
/**
|
||||
* Provides access to VCloud resources via their REST API.
|
||||
* <p/>
|
||||
*
|
||||
* @see <a href=
|
||||
* "https://community.vcloudexpress.terremark.com/en-us/discussion_forums/f/60.aspx"
|
||||
* />
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
public interface TerremarkVCloudClient extends Closeable {
|
||||
Catalog getCatalog(URI catalogId);
|
||||
|
||||
/**
|
||||
* returns the catalog in the organization associated with the specified
|
||||
* name. Note that both parameters can be null to choose default.
|
||||
*
|
||||
* @param orgName
|
||||
* organization name, or null for the default
|
||||
* @param catalogName
|
||||
* catalog name, or null for the default
|
||||
* @throws NoSuchElementException
|
||||
* if you specified an org or catalog name that isn't present
|
||||
*/
|
||||
Catalog findCatalogInOrgNamed(@Nullable String orgName, @Nullable String catalogName);
|
||||
|
||||
CatalogItem getCatalogItem(URI catalogItem);
|
||||
|
||||
/**
|
||||
* returns the catalog item in the catalog associated with the specified
|
||||
* name. Note that the org and catalog parameters can be null to choose
|
||||
* default.
|
||||
*
|
||||
* @param orgName
|
||||
* organization name, or null for the default
|
||||
* @param catalogName
|
||||
* catalog name, or null for the default
|
||||
* @param itemName
|
||||
* item you wish to lookup
|
||||
*
|
||||
* @throws NoSuchElementException
|
||||
* if you specified an org, catalog, or catalog item name that
|
||||
* isn't present
|
||||
*/
|
||||
CatalogItem findCatalogItemInOrgCatalogNamed(@Nullable String orgName, @Nullable String catalogName, String itemName);
|
||||
|
||||
Network findNetworkInOrgVDCNamed(@Nullable String orgName, @Nullable String catalogName, String networkName);
|
||||
|
||||
Network getNetwork(URI network);
|
||||
|
||||
/**
|
||||
* returns the VDC in the organization associated with the specified name.
|
||||
* Note that both parameters can be null to choose default.
|
||||
*
|
||||
* @param orgName
|
||||
* organization name, or null for the default
|
||||
* @param vdcName
|
||||
* catalog name, or null for the default
|
||||
* @throws NoSuchElementException
|
||||
* if you specified an org or vdc name that isn't present
|
||||
*/
|
||||
VDC findVDCInOrgNamed(String orgName, String vdcName);
|
||||
|
||||
TasksList getTasksList(URI tasksListId);
|
||||
|
||||
TasksList findTasksListInOrgNamed(String orgName, String tasksListName);
|
||||
|
||||
/**
|
||||
* Whenever the result of a request cannot be returned immediately, the
|
||||
* server creates a Task object and includes it in the response, as a member
|
||||
* of the Tasks container in the response body. Each Task has an href value,
|
||||
* which is a URL that the client can use to retrieve the Task element alone,
|
||||
* without the rest of the response in which it was contained. All
|
||||
* information about the task is included in the Task element when it is
|
||||
* returned in the response's Tasks container, so a client does not need to
|
||||
* make an additional request to the Task URL unless it wants to follow the
|
||||
* progress of a task that was incomplete.
|
||||
*/
|
||||
Task getTask(URI taskId);
|
||||
|
||||
void cancelTask(URI taskId);
|
||||
|
||||
/**
|
||||
*
|
||||
* @return a listing of all orgs that the current user has access to.
|
||||
*/
|
||||
@Provides
|
||||
@org.jclouds.trmk.vcloud_0_8.endpoints.Org
|
||||
Map<String, ReferenceType> listOrgs();
|
||||
|
||||
VApp instantiateVAppTemplateInVDC(URI vDC, URI template, String appName, InstantiateVAppTemplateOptions... options);
|
||||
|
||||
Task cloneVAppInVDC(URI vDC, URI toClone, String newName, CloneVAppOptions... options);
|
||||
|
||||
VAppTemplate getVAppTemplate(URI vAppTemplate);
|
||||
|
||||
/**
|
||||
* returns the vapp template corresponding to a catalog item in the catalog
|
||||
* associated with the specified name. Note that the org and catalog
|
||||
* parameters can be null to choose default.
|
||||
*
|
||||
* @param orgName
|
||||
* organization name, or null for the default
|
||||
* @param catalogName
|
||||
* catalog name, or null for the default
|
||||
* @param itemName
|
||||
* item you wish to lookup
|
||||
*
|
||||
* @throws NoSuchElementException
|
||||
* if you specified an org, catalog, or catalog item name that
|
||||
* isn't present
|
||||
*/
|
||||
VAppTemplate findVAppTemplateInOrgCatalogNamed(@Nullable String orgName, @Nullable String catalogName,
|
||||
String itemName);
|
||||
|
||||
VApp findVAppInOrgVDCNamed(@Nullable String orgName, @Nullable String catalogName, String vAppName);
|
||||
|
||||
VApp getVApp(URI vApp);
|
||||
|
||||
Task deployVApp(URI vAppId);
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
Task undeployVApp(URI vAppId);
|
||||
|
||||
/**
|
||||
* This call powers on the vApp, as specified in the vApp's ovf:Startup
|
||||
* element.
|
||||
*/
|
||||
Task powerOnVApp(URI vAppId);
|
||||
|
||||
/**
|
||||
* This call powers off the vApp, as specified in the vApp's ovf:Startup
|
||||
* element.
|
||||
*/
|
||||
Task powerOffVApp(URI vAppId);
|
||||
|
||||
/**
|
||||
* This call shuts down the vApp.
|
||||
*/
|
||||
void shutdownVApp(URI vAppId);
|
||||
|
||||
/**
|
||||
* This call resets the vApp.
|
||||
*/
|
||||
Task resetVApp(URI vAppId);
|
||||
|
||||
/**
|
||||
* This call suspends the vApp.
|
||||
*/
|
||||
Task suspendVApp(URI vAppId);
|
||||
|
||||
Task deleteVApp(URI vAppId);
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
VDC getVDC(URI catalogItem);
|
||||
|
||||
Org getOrg(URI orgId);
|
||||
|
||||
Org findOrgNamed(String orgName);
|
||||
|
||||
CustomizationParameters getCustomizationOptions(URI customizationOptions);
|
||||
|
||||
/**
|
||||
* This call returns a list of public IP addresses.
|
||||
*/
|
||||
Set<PublicIpAddress> getPublicIpsAssociatedWithVDC(URI vDCId);
|
||||
|
||||
void deletePublicIp(URI ipId);
|
||||
|
||||
/**
|
||||
* This call adds an internet service to a known, existing public IP. This
|
||||
* call is identical to Add Internet Service except you specify the public IP
|
||||
* in the request.
|
||||
*
|
||||
*/
|
||||
InternetService addInternetServiceToExistingIp(URI existingIpId, String serviceName, Protocol protocol, int port,
|
||||
AddInternetServiceOptions... options);
|
||||
|
||||
void deleteInternetService(URI internetServiceId);
|
||||
|
||||
InternetService getInternetService(URI internetServiceId);
|
||||
|
||||
Set<InternetService> getAllInternetServicesInVDC(URI vDCId);
|
||||
|
||||
/**
|
||||
* This call returns information about the internet service on a public IP.
|
||||
*/
|
||||
Set<InternetService> getInternetServicesOnPublicIp(URI ipId);
|
||||
|
||||
Set<InternetService> getPublicIp(URI ipId);
|
||||
|
||||
/**
|
||||
* This call adds a node to an existing internet service.
|
||||
* <p/>
|
||||
* Every vDC is assigned a network of 60 IP addresses that can be used as
|
||||
* nodes. Each node can associated with multiple internet service. You can
|
||||
* get a list of the available IP addresses by calling Get IP Addresses for a
|
||||
* Network.
|
||||
*
|
||||
* @param internetServiceId
|
||||
* @param ipAddress
|
||||
* @param name
|
||||
* @param port
|
||||
* @param options
|
||||
* @return
|
||||
*/
|
||||
Node addNode(URI internetServiceId, String ipAddress, String name, int port, AddNodeOptions... options);
|
||||
|
||||
Node getNode(URI nodeId);
|
||||
|
||||
Node configureNode(URI nodeId, String name, boolean enabled, @Nullable String description);
|
||||
|
||||
void deleteNode(URI nodeId);
|
||||
|
||||
Set<Node> getNodes(URI internetServiceId);
|
||||
|
||||
/**
|
||||
* This call configures the settings of an existing vApp by passing the new
|
||||
* configuration. The existing vApp must be in a powered off state (status =
|
||||
* 2).
|
||||
* <p/>
|
||||
* You can change the following items for a vApp.
|
||||
* <ol>
|
||||
* <li>vApp name Number of virtual CPUs</li>
|
||||
* <li>Amount of virtual memory</li>
|
||||
* <li>Add a virtual disk</li>
|
||||
* <li>Delete a virtual disk</li>
|
||||
* </ol>
|
||||
* You can make more than one change in a single request. For example, you
|
||||
* can increase the number of virtual CPUs and the amount of virtual memory
|
||||
* in the same request.
|
||||
*
|
||||
* @param VApp
|
||||
* vApp to change in power state off
|
||||
* @param configuration
|
||||
* (s) to change
|
||||
* @return task of configuration change
|
||||
*/
|
||||
Task configureVApp(VApp vApp, VAppConfiguration configuration);
|
||||
|
||||
/**
|
||||
*/
|
||||
Set<KeyPair> listKeyPairsInOrg(URI org);
|
||||
|
||||
/**
|
||||
* @throws IllegalStateException
|
||||
* if a key of the same name already exists
|
||||
*/
|
||||
KeyPair generateKeyPairInOrg(URI org, String name, boolean makeDefault);
|
||||
|
||||
/**
|
||||
*/
|
||||
KeyPair findKeyPairInOrg(URI org, String keyPairName);
|
||||
|
||||
KeyPair getKeyPair(URI keyPair);
|
||||
|
||||
// TODO
|
||||
// KeyPair configureKeyPair(int keyPairId, KeyPairConfiguration
|
||||
// keyPairConfiguration);
|
||||
|
||||
void deleteKeyPair(URI keyPair);
|
||||
|
||||
}
|
|
@ -40,7 +40,7 @@ import org.jclouds.domain.Credentials;
|
|||
import org.jclouds.domain.LoginCredentials;
|
||||
import org.jclouds.javax.annotation.Nullable;
|
||||
import org.jclouds.logging.Logger;
|
||||
import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudClient;
|
||||
import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudApi;
|
||||
import org.jclouds.trmk.vcloud_0_8.domain.InternetService;
|
||||
import org.jclouds.trmk.vcloud_0_8.domain.Node;
|
||||
import org.jclouds.trmk.vcloud_0_8.domain.Protocol;
|
||||
|
@ -67,14 +67,14 @@ public class TerremarkVCloudComputeClient {
|
|||
@Named(ComputeServiceConstants.COMPUTE_LOGGER)
|
||||
protected Logger logger = Logger.NULL;
|
||||
|
||||
protected final TerremarkVCloudClient client;
|
||||
protected final TerremarkVCloudApi client;
|
||||
protected final Provider<String> passwordGenerator;
|
||||
protected final InternetServiceAndPublicIpAddressSupplier internetServiceAndPublicIpAddressSupplier;
|
||||
protected final Map<Status, NodeMetadata.Status> vAppStatusToNodeStatus;
|
||||
protected final Predicate<URI> taskTester;
|
||||
|
||||
@Inject
|
||||
protected TerremarkVCloudComputeClient(TerremarkVCloudClient client,
|
||||
protected TerremarkVCloudComputeClient(TerremarkVCloudApi client,
|
||||
@Named("PASSWORD") Provider<String> passwordGenerator, Predicate<URI> successTester,
|
||||
Map<Status, NodeMetadata.Status> vAppStatusToNodeStatus, Map<String, Credentials> credentialStore,
|
||||
InternetServiceAndPublicIpAddressSupplier internetServiceAndPublicIpAddressSupplier) {
|
||||
|
|
|
@ -28,7 +28,7 @@ import javax.inject.Singleton;
|
|||
import org.jclouds.compute.reference.ComputeServiceConstants;
|
||||
import org.jclouds.http.HttpResponseException;
|
||||
import org.jclouds.logging.Logger;
|
||||
import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudClient;
|
||||
import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudApi;
|
||||
import org.jclouds.trmk.vcloud_0_8.compute.domain.OrgAndName;
|
||||
import org.jclouds.trmk.vcloud_0_8.domain.KeyPair;
|
||||
import org.jclouds.util.Throwables2;
|
||||
|
@ -45,11 +45,11 @@ public class CreateUniqueKeyPair implements Function<OrgAndName, KeyPair> {
|
|||
@Resource
|
||||
@Named(ComputeServiceConstants.COMPUTE_LOGGER)
|
||||
protected Logger logger = Logger.NULL;
|
||||
protected final TerremarkVCloudClient trmkClient;
|
||||
protected final TerremarkVCloudApi trmkClient;
|
||||
protected Supplier<String> randomSuffix;
|
||||
|
||||
@Inject
|
||||
CreateUniqueKeyPair(TerremarkVCloudClient trmkClient, Supplier<String> randomSuffix) {
|
||||
CreateUniqueKeyPair(TerremarkVCloudApi trmkClient, Supplier<String> randomSuffix) {
|
||||
this.trmkClient = trmkClient;
|
||||
this.randomSuffix = randomSuffix;
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ import javax.inject.Singleton;
|
|||
import org.jclouds.compute.domain.NodeMetadata;
|
||||
import org.jclouds.compute.reference.ComputeServiceConstants;
|
||||
import org.jclouds.logging.Logger;
|
||||
import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudClient;
|
||||
import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudApi;
|
||||
import org.jclouds.trmk.vcloud_0_8.compute.domain.OrgAndName;
|
||||
import org.jclouds.trmk.vcloud_0_8.domain.Org;
|
||||
import org.jclouds.trmk.vcloud_0_8.endpoints.VDC;
|
||||
|
@ -48,10 +48,10 @@ public class NodeMetadataToOrgAndName implements Function<NodeMetadata, OrgAndNa
|
|||
|
||||
final Supplier<Map<String, String>> vdcToOrg;
|
||||
|
||||
private final TerremarkVCloudClient client;
|
||||
private final TerremarkVCloudApi client;
|
||||
|
||||
@Inject
|
||||
NodeMetadataToOrgAndName(TerremarkVCloudClient client, @VDC Supplier<Map<String, String>> vdcToOrg) {
|
||||
NodeMetadataToOrgAndName(TerremarkVCloudApi client, @VDC Supplier<Map<String, String>> vdcToOrg) {
|
||||
this.vdcToOrg = vdcToOrg;
|
||||
this.client = client;
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ import javax.inject.Singleton;
|
|||
import org.jclouds.compute.reference.ComputeServiceConstants;
|
||||
import org.jclouds.domain.Credentials;
|
||||
import org.jclouds.logging.Logger;
|
||||
import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudClient;
|
||||
import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudApi;
|
||||
import org.jclouds.trmk.vcloud_0_8.compute.domain.OrgAndName;
|
||||
import org.jclouds.trmk.vcloud_0_8.domain.KeyPair;
|
||||
|
||||
|
@ -41,11 +41,11 @@ public class DeleteKeyPair {
|
|||
@Named(ComputeServiceConstants.COMPUTE_LOGGER)
|
||||
protected Logger logger = Logger.NULL;
|
||||
|
||||
final TerremarkVCloudClient terremarkClient;
|
||||
final TerremarkVCloudApi terremarkClient;
|
||||
final Map<String, Credentials> credentialStore;
|
||||
|
||||
@Inject
|
||||
DeleteKeyPair(TerremarkVCloudClient terremarkClient, Map<String, Credentials> credentialStore) {
|
||||
DeleteKeyPair(TerremarkVCloudApi terremarkClient, Map<String, Credentials> credentialStore) {
|
||||
this.terremarkClient = terremarkClient;
|
||||
this.credentialStore = credentialStore;
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ import javax.inject.Singleton;
|
|||
|
||||
import org.jclouds.compute.domain.Image;
|
||||
import org.jclouds.compute.strategy.GetImageStrategy;
|
||||
import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudClient;
|
||||
import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudApi;
|
||||
import org.jclouds.trmk.vcloud_0_8.domain.VAppTemplate;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
|
@ -36,11 +36,11 @@ import com.google.common.base.Function;
|
|||
@Singleton
|
||||
public class TerremarkVCloudGetImageStrategy implements GetImageStrategy {
|
||||
|
||||
protected final TerremarkVCloudClient client;
|
||||
protected final TerremarkVCloudApi client;
|
||||
protected final Function<VAppTemplate, Image> vAppToImage;
|
||||
|
||||
@Inject
|
||||
protected TerremarkVCloudGetImageStrategy(TerremarkVCloudClient client, Function<VAppTemplate, Image> vAppToImage) {
|
||||
protected TerremarkVCloudGetImageStrategy(TerremarkVCloudApi client, Function<VAppTemplate, Image> vAppToImage) {
|
||||
this.client = checkNotNull(client, "client");
|
||||
this.vAppToImage = vAppToImage;
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ import javax.inject.Singleton;
|
|||
|
||||
import org.jclouds.compute.domain.NodeMetadata;
|
||||
import org.jclouds.compute.strategy.GetNodeMetadataStrategy;
|
||||
import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudClient;
|
||||
import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudApi;
|
||||
import org.jclouds.trmk.vcloud_0_8.domain.VApp;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
|
@ -36,11 +36,11 @@ import com.google.common.base.Function;
|
|||
@Singleton
|
||||
public class TerremarkVCloudGetNodeMetadataStrategy implements GetNodeMetadataStrategy {
|
||||
|
||||
protected final TerremarkVCloudClient client;
|
||||
protected final TerremarkVCloudApi client;
|
||||
protected final Function<VApp, NodeMetadata> vAppToNodeMetadata;
|
||||
|
||||
@Inject
|
||||
protected TerremarkVCloudGetNodeMetadataStrategy(TerremarkVCloudClient client,
|
||||
protected TerremarkVCloudGetNodeMetadataStrategy(TerremarkVCloudApi client,
|
||||
Function<VApp, NodeMetadata> vAppToNodeMetadata) {
|
||||
this.client = checkNotNull(client, "client");
|
||||
this.vAppToNodeMetadata = vAppToNodeMetadata;
|
||||
|
|
|
@ -32,7 +32,7 @@ import org.jclouds.compute.strategy.RebootNodeStrategy;
|
|||
import org.jclouds.compute.strategy.ResumeNodeStrategy;
|
||||
import org.jclouds.compute.strategy.SuspendNodeStrategy;
|
||||
import org.jclouds.logging.Logger;
|
||||
import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudClient;
|
||||
import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudApi;
|
||||
import org.jclouds.trmk.vcloud_0_8.domain.Task;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
|
@ -46,12 +46,12 @@ public class TerremarkVCloudLifeCycleStrategy implements RebootNodeStrategy, Res
|
|||
@Named(ComputeServiceConstants.COMPUTE_LOGGER)
|
||||
protected Logger logger = Logger.NULL;
|
||||
|
||||
private final TerremarkVCloudClient client;
|
||||
private final TerremarkVCloudApi client;
|
||||
protected final Predicate<URI> taskTester;
|
||||
protected final GetNodeMetadataStrategy getNode;
|
||||
|
||||
@Inject
|
||||
protected TerremarkVCloudLifeCycleStrategy(TerremarkVCloudClient client, Predicate<URI> taskTester,
|
||||
protected TerremarkVCloudLifeCycleStrategy(TerremarkVCloudApi client, Predicate<URI> taskTester,
|
||||
GetNodeMetadataStrategy getNode) {
|
||||
this.client = client;
|
||||
this.taskTester = taskTester;
|
||||
|
|
|
@ -34,7 +34,7 @@ import org.jclouds.compute.domain.ComputeType;
|
|||
import org.jclouds.compute.domain.NodeMetadata;
|
||||
import org.jclouds.compute.strategy.ListNodesStrategy;
|
||||
import org.jclouds.logging.Logger;
|
||||
import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudClient;
|
||||
import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudApi;
|
||||
import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudMediaType;
|
||||
import org.jclouds.trmk.vcloud_0_8.compute.functions.FindLocationForResource;
|
||||
import org.jclouds.trmk.vcloud_0_8.domain.ReferenceType;
|
||||
|
@ -46,7 +46,6 @@ import com.google.common.base.Splitter;
|
|||
import com.google.common.base.Supplier;
|
||||
import com.google.common.collect.FluentIterable;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.google.inject.Inject;
|
||||
|
||||
|
@ -60,7 +59,7 @@ public class TerremarkVCloudListNodesStrategy implements ListNodesStrategy {
|
|||
@Named(COMPUTE_LOGGER)
|
||||
public Logger logger = Logger.NULL;
|
||||
protected final TerremarkVCloudGetNodeMetadataStrategy getNodeMetadata;
|
||||
protected final TerremarkVCloudClient client;
|
||||
protected final TerremarkVCloudApi client;
|
||||
protected final FindLocationForResource findLocationForResourceInVDC;
|
||||
Set<String> blackListVAppNames = ImmutableSet.<String> of();
|
||||
|
||||
|
@ -73,7 +72,7 @@ public class TerremarkVCloudListNodesStrategy implements ListNodesStrategy {
|
|||
private final Supplier<Map<String, ReferenceType>> orgNameToEndpoint;
|
||||
|
||||
@Inject
|
||||
protected TerremarkVCloudListNodesStrategy(TerremarkVCloudClient client,
|
||||
protected TerremarkVCloudListNodesStrategy(TerremarkVCloudApi client,
|
||||
@Org Supplier<Map<String, ReferenceType>> orgNameToEndpoint,
|
||||
TerremarkVCloudGetNodeMetadataStrategy getNodeMetadata, FindLocationForResource findLocationForResourceInVDC) {
|
||||
this.client = client;
|
||||
|
|
|
@ -24,7 +24,7 @@ import static com.google.common.collect.Iterables.transform;
|
|||
import static com.google.common.collect.Maps.transformValues;
|
||||
import static com.google.common.collect.Maps.uniqueIndex;
|
||||
import static org.jclouds.Constants.PROPERTY_SESSION_INTERVAL;
|
||||
import static org.jclouds.rest.config.BinderUtils.bindSyncToAsyncHttpApi;
|
||||
import static org.jclouds.rest.config.BinderUtils.bindHttpApi;
|
||||
import static org.jclouds.trmk.vcloud_0_8.reference.VCloudConstants.PROPERTY_VCLOUD_TIMEOUT_TASK_COMPLETED;
|
||||
import static org.jclouds.util.Predicates2.retry;
|
||||
|
||||
|
@ -49,9 +49,9 @@ import org.jclouds.location.suppliers.ImplicitLocationSupplier;
|
|||
import org.jclouds.location.suppliers.LocationsSupplier;
|
||||
import org.jclouds.rest.AuthorizationException;
|
||||
import org.jclouds.rest.annotations.ApiVersion;
|
||||
import org.jclouds.rest.config.RestClientModule;
|
||||
import org.jclouds.rest.config.HttpApiModule;
|
||||
import org.jclouds.rest.suppliers.MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier;
|
||||
import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudClient;
|
||||
import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudApi;
|
||||
import org.jclouds.trmk.vcloud_0_8.VCloudToken;
|
||||
import org.jclouds.trmk.vcloud_0_8.compute.functions.FindLocationForResource;
|
||||
import org.jclouds.trmk.vcloud_0_8.domain.Catalog;
|
||||
|
@ -72,10 +72,8 @@ import org.jclouds.trmk.vcloud_0_8.functions.OrgsForLocations;
|
|||
import org.jclouds.trmk.vcloud_0_8.functions.OrgsForNames;
|
||||
import org.jclouds.trmk.vcloud_0_8.functions.VAppTemplatesForCatalogItems;
|
||||
import org.jclouds.trmk.vcloud_0_8.handlers.ParseTerremarkVCloudErrorFromHttpResponse;
|
||||
import org.jclouds.trmk.vcloud_0_8.internal.TerremarkVCloudLoginAsyncClient;
|
||||
import org.jclouds.trmk.vcloud_0_8.internal.TerremarkVCloudLoginClient;
|
||||
import org.jclouds.trmk.vcloud_0_8.internal.TerremarkVCloudVersionsAsyncClient;
|
||||
import org.jclouds.trmk.vcloud_0_8.internal.TerremarkVCloudVersionsClient;
|
||||
import org.jclouds.trmk.vcloud_0_8.internal.TerremarkVCloudLoginApi;
|
||||
import org.jclouds.trmk.vcloud_0_8.internal.TerremarkVCloudVersionsApi;
|
||||
import org.jclouds.trmk.vcloud_0_8.location.DefaultVDC;
|
||||
import org.jclouds.trmk.vcloud_0_8.location.OrgAndVDCToLocationSupplier;
|
||||
import org.jclouds.trmk.vcloud_0_8.predicates.TaskSuccess;
|
||||
|
@ -94,13 +92,9 @@ import com.google.inject.Provides;
|
|||
import com.google.inject.Scopes;
|
||||
import com.google.inject.TypeLiteral;
|
||||
|
||||
public class TerremarkVCloudRestClientModule<S, A> extends RestClientModule<S, A> {
|
||||
public class TerremarkVCloudHttpApiModule<S> extends HttpApiModule<S> {
|
||||
|
||||
public TerremarkVCloudRestClientModule() {
|
||||
}
|
||||
|
||||
public TerremarkVCloudRestClientModule(Map<Class<?>, Class<?>> delegateMap) {
|
||||
super(delegateMap);
|
||||
public TerremarkVCloudHttpApiModule() {
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -132,8 +126,8 @@ public class TerremarkVCloudRestClientModule<S, A> extends RestClientModule<S, A
|
|||
bind(new TypeLiteral<Function<org.jclouds.trmk.vcloud_0_8.domain.Org, Iterable<? extends CatalogItem>>>() {
|
||||
}).to(new TypeLiteral<AllCatalogItemsInOrg>() {
|
||||
});
|
||||
bindSyncToAsyncHttpApi(binder(), TerremarkVCloudVersionsClient.class, TerremarkVCloudVersionsAsyncClient.class);
|
||||
bindSyncToAsyncHttpApi(binder(), TerremarkVCloudLoginClient.class, TerremarkVCloudLoginAsyncClient.class);
|
||||
bindHttpApi(binder(), TerremarkVCloudVersionsApi.class);
|
||||
bindHttpApi(binder(), TerremarkVCloudLoginApi.class);
|
||||
}
|
||||
|
||||
@Provides
|
||||
|
@ -310,7 +304,7 @@ public class TerremarkVCloudRestClientModule<S, A> extends RestClientModule<S, A
|
|||
@Provides
|
||||
@Singleton
|
||||
@VCloudLogin
|
||||
protected Supplier<URI> provideAuthenticationURI(final TerremarkVCloudVersionsClient versionService,
|
||||
protected Supplier<URI> provideAuthenticationURI(final TerremarkVCloudVersionsApi versionService,
|
||||
@ApiVersion final String version) {
|
||||
return new Supplier<URI>() {
|
||||
|
||||
|
@ -477,7 +471,7 @@ public class TerremarkVCloudRestClientModule<S, A> extends RestClientModule<S, A
|
|||
@Provides
|
||||
@Singleton
|
||||
protected Supplier<VCloudSession> provideVCloudTokenCache(@Named(PROPERTY_SESSION_INTERVAL) long seconds,
|
||||
AtomicReference<AuthorizationException> authException, final TerremarkVCloudLoginClient login) {
|
||||
AtomicReference<AuthorizationException> authException, final TerremarkVCloudLoginApi login) {
|
||||
return MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier.create(authException,
|
||||
new Supplier<VCloudSession>() {
|
||||
|
||||
|
@ -517,10 +511,10 @@ public class TerremarkVCloudRestClientModule<S, A> extends RestClientModule<S, A
|
|||
@Singleton
|
||||
public static class OrgNameToKeysListSupplier implements Supplier<Map<String, ReferenceType>> {
|
||||
protected final Supplier<VCloudSession> sessionSupplier;
|
||||
private final TerremarkVCloudClient client;
|
||||
private final TerremarkVCloudApi client;
|
||||
|
||||
@Inject
|
||||
protected OrgNameToKeysListSupplier(Supplier<VCloudSession> sessionSupplier, TerremarkVCloudClient client) {
|
||||
protected OrgNameToKeysListSupplier(Supplier<VCloudSession> sessionSupplier, TerremarkVCloudApi client) {
|
||||
this.sessionSupplier = sessionSupplier;
|
||||
this.client = client;
|
||||
}
|
|
@ -17,16 +17,14 @@
|
|||
package org.jclouds.trmk.vcloud_0_8.functions;
|
||||
|
||||
import static com.google.common.collect.Iterables.filter;
|
||||
import static org.jclouds.concurrent.FutureIterables.transformParallel;
|
||||
import static com.google.common.collect.Iterables.transform;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import org.jclouds.Constants;
|
||||
import org.jclouds.logging.Logger;
|
||||
import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudAsyncClient;
|
||||
import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudApi;
|
||||
import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudMediaType;
|
||||
import org.jclouds.trmk.vcloud_0_8.domain.Catalog;
|
||||
import org.jclouds.trmk.vcloud_0_8.domain.CatalogItem;
|
||||
|
@ -34,8 +32,6 @@ import org.jclouds.trmk.vcloud_0_8.domain.ReferenceType;
|
|||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
import com.google.common.util.concurrent.ListeningExecutorService;
|
||||
|
||||
/**
|
||||
* @author Adrian Cole
|
||||
|
@ -45,27 +41,24 @@ public class AllCatalogItemsInCatalog implements Function<Catalog, Iterable<? ex
|
|||
@Resource
|
||||
public Logger logger = Logger.NULL;
|
||||
|
||||
private final TerremarkVCloudAsyncClient aclient;
|
||||
private final ListeningExecutorService userExecutor;
|
||||
private final TerremarkVCloudApi aclient;
|
||||
|
||||
@Inject
|
||||
AllCatalogItemsInCatalog(TerremarkVCloudAsyncClient aclient,
|
||||
@Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor) {
|
||||
AllCatalogItemsInCatalog(TerremarkVCloudApi aclient) {
|
||||
this.aclient = aclient;
|
||||
this.userExecutor = userExecutor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<? extends CatalogItem> apply(Catalog from) {
|
||||
return transformParallel(filter(from.values(), new Predicate<ReferenceType>() {
|
||||
return transform(filter(from.values(), new Predicate<ReferenceType>() {
|
||||
public boolean apply(ReferenceType input) {
|
||||
return input.getType().equals(TerremarkVCloudMediaType.CATALOGITEM_XML);
|
||||
}
|
||||
}), new Function<ReferenceType, ListenableFuture<? extends CatalogItem>>() {
|
||||
public ListenableFuture<? extends CatalogItem> apply(ReferenceType from) {
|
||||
}), new Function<ReferenceType, CatalogItem>() {
|
||||
public CatalogItem apply(ReferenceType from) {
|
||||
return aclient.getCatalogItem(from.getHref());
|
||||
}
|
||||
}, userExecutor, null, logger, "catalogItems in " + from.getHref());
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -16,23 +16,19 @@
|
|||
*/
|
||||
package org.jclouds.trmk.vcloud_0_8.functions;
|
||||
|
||||
import static org.jclouds.concurrent.FutureIterables.transformParallel;
|
||||
import static com.google.common.collect.Iterables.transform;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import org.jclouds.Constants;
|
||||
import org.jclouds.logging.Logger;
|
||||
import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudAsyncClient;
|
||||
import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudApi;
|
||||
import org.jclouds.trmk.vcloud_0_8.domain.Catalog;
|
||||
import org.jclouds.trmk.vcloud_0_8.domain.Org;
|
||||
import org.jclouds.trmk.vcloud_0_8.domain.ReferenceType;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
import com.google.common.util.concurrent.ListeningExecutorService;
|
||||
|
||||
/**
|
||||
* @author Adrian Cole
|
||||
|
@ -42,22 +38,20 @@ public class AllCatalogsInOrg implements Function<Org, Iterable<? extends Catalo
|
|||
@Resource
|
||||
public Logger logger = Logger.NULL;
|
||||
|
||||
private final TerremarkVCloudAsyncClient aclient;
|
||||
private final ListeningExecutorService userExecutor;
|
||||
private final TerremarkVCloudApi aclient;
|
||||
|
||||
@Inject
|
||||
AllCatalogsInOrg(TerremarkVCloudAsyncClient aclient, @Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor) {
|
||||
AllCatalogsInOrg(TerremarkVCloudApi aclient) {
|
||||
this.aclient = aclient;
|
||||
this.userExecutor = userExecutor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<? extends Catalog> apply(final Org org) {
|
||||
return transformParallel(org.getCatalogs().values(),
|
||||
new Function<ReferenceType, ListenableFuture<? extends Catalog>>() {
|
||||
public ListenableFuture<? extends Catalog> apply(ReferenceType from) {
|
||||
return aclient.getCatalog(from.getHref());
|
||||
}
|
||||
}, userExecutor, null, logger, "catalogs in " + org.getName());
|
||||
return transform(org.getCatalogs().values(),
|
||||
new Function<ReferenceType, Catalog>() {
|
||||
public Catalog apply(ReferenceType from) {
|
||||
return aclient.getCatalog(from.getHref());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,22 +16,18 @@
|
|||
*/
|
||||
package org.jclouds.trmk.vcloud_0_8.functions;
|
||||
|
||||
import static org.jclouds.concurrent.FutureIterables.transformParallel;
|
||||
import static com.google.common.collect.Iterables.transform;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import org.jclouds.Constants;
|
||||
import org.jclouds.logging.Logger;
|
||||
import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudAsyncClient;
|
||||
import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudApi;
|
||||
import org.jclouds.trmk.vcloud_0_8.domain.Org;
|
||||
import org.jclouds.trmk.vcloud_0_8.domain.ReferenceType;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
import com.google.common.util.concurrent.ListeningExecutorService;
|
||||
|
||||
/**
|
||||
* @author Adrian Cole
|
||||
|
@ -41,23 +37,21 @@ public class AllVDCsInOrg implements Function<Org, Iterable<? extends org.jcloud
|
|||
@Resource
|
||||
public Logger logger = Logger.NULL;
|
||||
|
||||
private final TerremarkVCloudAsyncClient aclient;
|
||||
private final ListeningExecutorService userExecutor;
|
||||
private final TerremarkVCloudApi aclient;
|
||||
|
||||
@Inject
|
||||
AllVDCsInOrg(TerremarkVCloudAsyncClient aclient, @Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor) {
|
||||
AllVDCsInOrg(TerremarkVCloudApi aclient) {
|
||||
this.aclient = aclient;
|
||||
this.userExecutor = userExecutor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<? extends org.jclouds.trmk.vcloud_0_8.domain.VDC> apply(final Org org) {
|
||||
return transformParallel(org.getVDCs().values(),
|
||||
new Function<ReferenceType, ListenableFuture<? extends org.jclouds.trmk.vcloud_0_8.domain.VDC>>() {
|
||||
public ListenableFuture<? extends org.jclouds.trmk.vcloud_0_8.domain.VDC> apply(ReferenceType from) {
|
||||
return aclient.getVDC(from.getHref());
|
||||
}
|
||||
}, userExecutor, null, logger, "vdcs in org " + org.getName());
|
||||
return transform(org.getVDCs().values(),
|
||||
new Function<ReferenceType, org.jclouds.trmk.vcloud_0_8.domain.VDC>() {
|
||||
public org.jclouds.trmk.vcloud_0_8.domain.VDC apply(ReferenceType from) {
|
||||
return aclient.getVDC(from.getHref());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -18,27 +18,22 @@ package org.jclouds.trmk.vcloud_0_8.functions;
|
|||
|
||||
import static com.google.common.collect.Iterables.filter;
|
||||
import static com.google.common.collect.Iterables.transform;
|
||||
import static org.jclouds.concurrent.FutureIterables.transformParallel;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import org.jclouds.Constants;
|
||||
import org.jclouds.domain.Location;
|
||||
import org.jclouds.domain.LocationScope;
|
||||
import org.jclouds.logging.Logger;
|
||||
import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudAsyncClient;
|
||||
import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudApi;
|
||||
import org.jclouds.trmk.vcloud_0_8.domain.Org;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
import com.google.common.util.concurrent.ListeningExecutorService;
|
||||
|
||||
/**
|
||||
* @author Adrian Cole
|
||||
|
@ -47,13 +42,11 @@ import com.google.common.util.concurrent.ListeningExecutorService;
|
|||
public class OrgsForLocations implements Function<Iterable<? extends Location>, Iterable<? extends Org>> {
|
||||
@Resource
|
||||
public Logger logger = Logger.NULL;
|
||||
private final TerremarkVCloudAsyncClient aclient;
|
||||
private final ListeningExecutorService userExecutor;
|
||||
private final TerremarkVCloudApi aclient;
|
||||
|
||||
@Inject
|
||||
OrgsForLocations(TerremarkVCloudAsyncClient aclient, @Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor) {
|
||||
OrgsForLocations(TerremarkVCloudApi aclient) {
|
||||
this.aclient = aclient;
|
||||
this.userExecutor = userExecutor;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -62,7 +55,7 @@ public class OrgsForLocations implements Function<Iterable<? extends Location>,
|
|||
*/
|
||||
@Override
|
||||
public Iterable<? extends Org> apply(Iterable<? extends Location> from) {
|
||||
return transformParallel(Sets.newLinkedHashSet(transform(filter(from, new Predicate<Location>() {
|
||||
return transform(Sets.newLinkedHashSet(transform(filter(from, new Predicate<Location>() {
|
||||
public boolean apply(Location input) {
|
||||
return input.getScope() == LocationScope.ZONE;
|
||||
}
|
||||
|
@ -70,10 +63,10 @@ public class OrgsForLocations implements Function<Iterable<? extends Location>,
|
|||
public URI apply(Location from) {
|
||||
return URI.create(from.getParent().getId());
|
||||
}
|
||||
})), new Function<URI, ListenableFuture<? extends Org>>() {
|
||||
public ListenableFuture<? extends Org> apply(URI from) {
|
||||
})), new Function<URI, Org>() {
|
||||
public Org apply(URI from) {
|
||||
return aclient.getOrg(from);
|
||||
}
|
||||
}, userExecutor, null, logger, "organizations for uris");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,21 +16,17 @@
|
|||
*/
|
||||
package org.jclouds.trmk.vcloud_0_8.functions;
|
||||
|
||||
import static org.jclouds.concurrent.FutureIterables.transformParallel;
|
||||
import static com.google.common.collect.Iterables.transform;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import org.jclouds.Constants;
|
||||
import org.jclouds.logging.Logger;
|
||||
import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudAsyncClient;
|
||||
import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudApi;
|
||||
import org.jclouds.trmk.vcloud_0_8.domain.Org;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
import com.google.common.util.concurrent.ListeningExecutorService;
|
||||
|
||||
/**
|
||||
* @author Adrian Cole
|
||||
|
@ -39,22 +35,20 @@ import com.google.common.util.concurrent.ListeningExecutorService;
|
|||
public class OrgsForNames implements Function<Iterable<String>, Iterable<? extends Org>> {
|
||||
@Resource
|
||||
public Logger logger = Logger.NULL;
|
||||
private final TerremarkVCloudAsyncClient aclient;
|
||||
private final ListeningExecutorService userExecutor;
|
||||
private final TerremarkVCloudApi aclient;
|
||||
|
||||
@Inject
|
||||
OrgsForNames(TerremarkVCloudAsyncClient aclient, @Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor) {
|
||||
OrgsForNames(TerremarkVCloudApi aclient) {
|
||||
this.aclient = aclient;
|
||||
this.userExecutor = userExecutor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<? extends Org> apply(Iterable<String> from) {
|
||||
return transformParallel(from, new Function<String, ListenableFuture<? extends Org>>() {
|
||||
public ListenableFuture<? extends Org> apply(String from) {
|
||||
return transform(from, new Function<String, Org>() {
|
||||
public Org apply(String from) {
|
||||
return aclient.findOrgNamed(from);
|
||||
}
|
||||
}, userExecutor, null, logger, "organizations for names");
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -17,25 +17,22 @@
|
|||
package org.jclouds.trmk.vcloud_0_8.functions;
|
||||
|
||||
import static com.google.common.collect.Iterables.filter;
|
||||
import static org.jclouds.concurrent.FutureIterables.transformParallel;
|
||||
import static com.google.common.collect.Iterables.transform;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import org.jclouds.Constants;
|
||||
import org.jclouds.compute.reference.ComputeServiceConstants;
|
||||
import org.jclouds.logging.Logger;
|
||||
import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudAsyncClient;
|
||||
import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudApi;
|
||||
import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudMediaType;
|
||||
import org.jclouds.trmk.vcloud_0_8.domain.CatalogItem;
|
||||
import org.jclouds.trmk.vcloud_0_8.domain.VAppTemplate;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
import com.google.common.util.concurrent.ListeningExecutorService;
|
||||
|
||||
/**
|
||||
* @author Adrian Cole
|
||||
|
@ -46,27 +43,24 @@ public class VAppTemplatesForCatalogItems implements
|
|||
@Resource
|
||||
@Named(ComputeServiceConstants.COMPUTE_LOGGER)
|
||||
public Logger logger = Logger.NULL;
|
||||
private final TerremarkVCloudAsyncClient aclient;
|
||||
private final ListeningExecutorService userExecutor;
|
||||
private final TerremarkVCloudApi aclient;
|
||||
|
||||
@Inject
|
||||
VAppTemplatesForCatalogItems(TerremarkVCloudAsyncClient aclient,
|
||||
@Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor) {
|
||||
VAppTemplatesForCatalogItems(TerremarkVCloudApi aclient) {
|
||||
this.aclient = aclient;
|
||||
this.userExecutor = userExecutor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<? extends VAppTemplate> apply(Iterable<? extends CatalogItem> from) {
|
||||
return transformParallel(filter(from, new Predicate<CatalogItem>() {
|
||||
return transform(filter(from, new Predicate<CatalogItem>() {
|
||||
public boolean apply(CatalogItem input) {
|
||||
return input.getEntity().getType().equals(TerremarkVCloudMediaType.VAPPTEMPLATE_XML);
|
||||
}
|
||||
}), new Function<CatalogItem, ListenableFuture<? extends VAppTemplate>>() {
|
||||
public ListenableFuture<? extends VAppTemplate> apply(CatalogItem from) {
|
||||
}), new Function<CatalogItem, VAppTemplate>() {
|
||||
public VAppTemplate apply(CatalogItem from) {
|
||||
return aclient.getVAppTemplate(from.getEntity().getHref());
|
||||
}
|
||||
}, userExecutor, null, logger, "vappTemplates in");
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -18,25 +18,22 @@ package org.jclouds.trmk.vcloud_0_8.functions;
|
|||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static com.google.common.collect.Iterables.filter;
|
||||
import static org.jclouds.concurrent.FutureIterables.transformParallel;
|
||||
import static com.google.common.collect.Iterables.transform;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import org.jclouds.Constants;
|
||||
import org.jclouds.compute.reference.ComputeServiceConstants;
|
||||
import org.jclouds.logging.Logger;
|
||||
import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudAsyncClient;
|
||||
import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudApi;
|
||||
import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudMediaType;
|
||||
import org.jclouds.trmk.vcloud_0_8.domain.ReferenceType;
|
||||
import org.jclouds.trmk.vcloud_0_8.domain.VAppTemplate;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
import com.google.common.util.concurrent.ListeningExecutorService;
|
||||
|
||||
/**
|
||||
* @author Adrian Cole
|
||||
|
@ -47,27 +44,24 @@ public class VAppTemplatesForResourceEntities implements
|
|||
@Resource
|
||||
@Named(ComputeServiceConstants.COMPUTE_LOGGER)
|
||||
public Logger logger = Logger.NULL;
|
||||
private final TerremarkVCloudAsyncClient aclient;
|
||||
private final ListeningExecutorService userExecutor;
|
||||
private final TerremarkVCloudApi aclient;
|
||||
|
||||
@Inject
|
||||
VAppTemplatesForResourceEntities(TerremarkVCloudAsyncClient aclient,
|
||||
@Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor) {
|
||||
VAppTemplatesForResourceEntities(TerremarkVCloudApi aclient) {
|
||||
this.aclient = aclient;
|
||||
this.userExecutor = userExecutor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<? extends VAppTemplate> apply(Iterable<? extends ReferenceType> from) {
|
||||
return transformParallel(filter(checkNotNull(from, "named resources"), new Predicate<ReferenceType>() {
|
||||
return transform(filter(checkNotNull(from, "named resources"), new Predicate<ReferenceType>() {
|
||||
public boolean apply(ReferenceType input) {
|
||||
return input.getType().equals(TerremarkVCloudMediaType.VAPPTEMPLATE_XML);
|
||||
}
|
||||
}), new Function<ReferenceType, ListenableFuture<? extends VAppTemplate>>() {
|
||||
public ListenableFuture<? extends VAppTemplate> apply(ReferenceType from) {
|
||||
}), new Function<ReferenceType, VAppTemplate>() {
|
||||
public VAppTemplate apply(ReferenceType from) {
|
||||
return aclient.getVAppTemplate(from.getHref());
|
||||
}
|
||||
}, userExecutor, null, logger, "vappTemplates in");
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -31,21 +31,22 @@ import java.util.Properties;
|
|||
|
||||
import org.jclouds.apis.ApiMetadata;
|
||||
import org.jclouds.compute.ComputeServiceContext;
|
||||
import org.jclouds.rest.internal.BaseRestApiMetadata;
|
||||
import org.jclouds.rest.internal.BaseHttpApiMetadata;
|
||||
import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudApi;
|
||||
|
||||
/**
|
||||
* Implementation of {@link ApiMetadata} for Terremark's VCloud api.
|
||||
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
public abstract class TerremarkVCloudApiMetadata extends BaseRestApiMetadata {
|
||||
public abstract class TerremarkVCloudApiMetadata extends BaseHttpApiMetadata<TerremarkVCloudApi> {
|
||||
|
||||
protected TerremarkVCloudApiMetadata(Builder<?> builder) {
|
||||
super(builder);
|
||||
}
|
||||
|
||||
public static Properties defaultProperties() {
|
||||
Properties properties = BaseRestApiMetadata.defaultProperties();
|
||||
Properties properties = BaseHttpApiMetadata.defaultProperties();
|
||||
properties.setProperty(PROPERTY_VCLOUD_VERSION_SCHEMA, "0.8");
|
||||
properties.setProperty(PROPERTY_SESSION_INTERVAL, 8 * 60 + "");
|
||||
properties.setProperty(PROPERTY_VCLOUD_XML_SCHEMA, "http://vcloud.safesecureweb.com/ns/vcloud.xsd");
|
||||
|
@ -61,10 +62,9 @@ public abstract class TerremarkVCloudApiMetadata extends BaseRestApiMetadata {
|
|||
return properties;
|
||||
}
|
||||
|
||||
public abstract static class Builder<B extends Builder<B>> extends BaseRestApiMetadata.Builder<B> {
|
||||
public abstract static class Builder<B extends Builder<B>> extends BaseHttpApiMetadata.Builder<TerremarkVCloudApi, B> {
|
||||
|
||||
protected Builder(Class<?> syncClient, Class<?> asyncClient) {
|
||||
super(syncClient, asyncClient);
|
||||
protected Builder() {
|
||||
identityName("Email")
|
||||
.credentialName("Password")
|
||||
.version("0.8")
|
||||
|
|
|
@ -29,25 +29,12 @@ import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudMediaType;
|
|||
import org.jclouds.trmk.vcloud_0_8.domain.VCloudSession;
|
||||
import org.jclouds.trmk.vcloud_0_8.functions.ParseLoginResponseFromHeaders;
|
||||
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
/**
|
||||
* Establishes a context with a VCloud endpoint.
|
||||
* <p/>
|
||||
*
|
||||
* @see <a href="https://community.vcloudexpress.terremark.com/en-us/discussion_forums/f/60.aspx" />
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Endpoint(org.jclouds.trmk.vcloud_0_8.endpoints.VCloudLogin.class)
|
||||
@RequestFilters(BasicAuthentication.class)
|
||||
public interface TerremarkVCloudLoginAsyncClient extends Closeable {
|
||||
public interface TerremarkVCloudLoginApi extends Closeable {
|
||||
|
||||
/**
|
||||
* This request returns a token to use in subsequent requests. After ten minutes of inactivity,
|
||||
* the token expires and you have to request a new token with this call.
|
||||
*/
|
||||
@POST
|
||||
@ResponseParser(ParseLoginResponseFromHeaders.class)
|
||||
@Consumes(TerremarkVCloudMediaType.ORGLIST_XML)
|
||||
ListenableFuture<VCloudSession> login();
|
||||
VCloudSession login();
|
||||
}
|
|
@ -1,26 +0,0 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.jclouds.trmk.vcloud_0_8.internal;
|
||||
|
||||
import java.io.Closeable;
|
||||
|
||||
import org.jclouds.trmk.vcloud_0_8.domain.VCloudSession;
|
||||
|
||||
public interface TerremarkVCloudLoginClient extends Closeable {
|
||||
|
||||
VCloudSession login();
|
||||
}
|
|
@ -19,7 +19,17 @@ package org.jclouds.trmk.vcloud_0_8.internal;
|
|||
import java.io.Closeable;
|
||||
import java.net.URI;
|
||||
import java.util.SortedMap;
|
||||
public interface TerremarkVCloudVersionsClient extends Closeable {
|
||||
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.Path;
|
||||
|
||||
import org.jclouds.rest.annotations.XMLResponseParser;
|
||||
import org.jclouds.trmk.vcloud_0_8.xml.SupportedVersionsHandler;
|
||||
|
||||
public interface TerremarkVCloudVersionsApi extends Closeable {
|
||||
|
||||
@GET
|
||||
@XMLResponseParser(SupportedVersionsHandler.class)
|
||||
@Path("/versions")
|
||||
SortedMap<String, URI> getSupportedVersions();
|
||||
}
|
|
@ -1,47 +0,0 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.jclouds.trmk.vcloud_0_8.internal;
|
||||
|
||||
import java.io.Closeable;
|
||||
import java.net.URI;
|
||||
import java.util.SortedMap;
|
||||
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.Path;
|
||||
|
||||
import org.jclouds.rest.annotations.XMLResponseParser;
|
||||
import org.jclouds.trmk.vcloud_0_8.xml.SupportedVersionsHandler;
|
||||
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
/**
|
||||
* Establishes a context with a VCloud endpoint.
|
||||
* <p/>
|
||||
*
|
||||
* @see <a href="https://community.vcloudexpress.terremark.com/en-us/discussion_forums/f/60.aspx" />
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
public interface TerremarkVCloudVersionsAsyncClient extends Closeable {
|
||||
|
||||
/**
|
||||
* Retrieve information for supported versions
|
||||
*/
|
||||
@GET
|
||||
@XMLResponseParser(SupportedVersionsHandler.class)
|
||||
@Path("/versions")
|
||||
ListenableFuture<SortedMap<String, URI>> getSupportedVersions();
|
||||
}
|
|
@ -22,7 +22,7 @@ import javax.annotation.Resource;
|
|||
import javax.inject.Singleton;
|
||||
|
||||
import org.jclouds.logging.Logger;
|
||||
import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudClient;
|
||||
import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudApi;
|
||||
import org.jclouds.trmk.vcloud_0_8.domain.Task;
|
||||
import org.jclouds.trmk.vcloud_0_8.domain.TaskStatus;
|
||||
|
||||
|
@ -38,13 +38,13 @@ import com.google.inject.Inject;
|
|||
@Singleton
|
||||
public class TaskSuccess implements Predicate<URI> {
|
||||
|
||||
private final TerremarkVCloudClient client;
|
||||
private final TerremarkVCloudApi client;
|
||||
|
||||
@Resource
|
||||
protected Logger logger = Logger.NULL;
|
||||
|
||||
@Inject
|
||||
public TaskSuccess(TerremarkVCloudClient client) {
|
||||
public TaskSuccess(TerremarkVCloudApi client) {
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@ import com.google.inject.Injector;
|
|||
import com.google.inject.Module;
|
||||
|
||||
@Test(groups = "live", singleThreaded = true)
|
||||
public abstract class TerremarkClientLiveTest extends BaseApiLiveTest<TerremarkVCloudClient> {
|
||||
public abstract class TerremarkApiLiveTest extends BaseApiLiveTest<TerremarkVCloudApi> {
|
||||
|
||||
protected String expectedOs = "Ubuntu Linux (64-bit)";
|
||||
protected String itemName = "Ubuntu JeOS 9.10 (64-bit)";
|
||||
|
@ -105,7 +105,7 @@ public abstract class TerremarkClientLiveTest extends BaseApiLiveTest<TerremarkV
|
|||
|
||||
public static final String PREFIX = System.getProperty("user.name") + "-terremark";
|
||||
|
||||
public TerremarkClientLiveTest() {
|
||||
public TerremarkApiLiveTest() {
|
||||
this.provider = "trmk-vcloudexpress";
|
||||
StringBuilder name = new StringBuilder();
|
||||
for (int i = 0; i < 15; i++)
|
||||
|
@ -116,7 +116,7 @@ public abstract class TerremarkClientLiveTest extends BaseApiLiveTest<TerremarkV
|
|||
@Test
|
||||
public void testKeysList() throws Exception {
|
||||
for (Org org : orgs) {
|
||||
TerremarkVCloudClient vCloudExpressClient = TerremarkVCloudClient.class.cast(api);
|
||||
TerremarkVCloudApi vCloudExpressClient = TerremarkVCloudApi.class.cast(api);
|
||||
Set<KeyPair> response = vCloudExpressClient.listKeyPairsInOrg(org.getHref());
|
||||
assertNotNull(response);
|
||||
}
|
||||
|
@ -477,14 +477,14 @@ public abstract class TerremarkClientLiveTest extends BaseApiLiveTest<TerremarkV
|
|||
}
|
||||
|
||||
@Override
|
||||
protected TerremarkVCloudClient create(Properties props, Iterable<Module> modules) {
|
||||
protected TerremarkVCloudApi create(Properties props, Iterable<Module> modules) {
|
||||
Injector injector = newBuilder().modules(modules).overrides(props).buildInjector();
|
||||
sshFactory = injector.getInstance(SshClient.Factory.class);
|
||||
|
||||
// longer than default internet service timeout
|
||||
socketTester = retry(injector.getInstance(SocketOpen.class), 300, 10, SECONDS);
|
||||
successTester = retry(injector.getInstance(TaskSuccess.class), 650, 10, SECONDS);
|
||||
api = injector.getInstance(TerremarkVCloudClient.class);
|
||||
api = injector.getInstance(TerremarkVCloudApi.class);
|
||||
orgs = listOrgs();
|
||||
return api;
|
||||
}
|
||||
|
@ -504,7 +504,7 @@ public abstract class TerremarkClientLiveTest extends BaseApiLiveTest<TerremarkV
|
|||
@Test
|
||||
public void testPropertiesCanOverrideDefaultOrg() throws Exception {
|
||||
for (Org org : orgs) {
|
||||
TerremarkVCloudClient newApi = null;
|
||||
TerremarkVCloudApi newApi = null;
|
||||
try {
|
||||
newApi = create(
|
||||
overrideDefaults(ImmutableMap.of(VCloudConstants.PROPERTY_VCLOUD_DEFAULT_ORG, org.getName())),
|
||||
|
@ -539,7 +539,7 @@ public abstract class TerremarkClientLiveTest extends BaseApiLiveTest<TerremarkV
|
|||
public void testPropertiesCanOverrideDefaultCatalog() throws Exception {
|
||||
for (Org org : orgs) {
|
||||
for (ReferenceType cat : org.getCatalogs().values()) {
|
||||
TerremarkVCloudClient newApi = null;
|
||||
TerremarkVCloudApi newApi = null;
|
||||
try {
|
||||
newApi = create(
|
||||
overrideDefaults(ImmutableMap.of(VCloudConstants.PROPERTY_VCLOUD_DEFAULT_ORG, org.getName(),
|
||||
|
@ -581,7 +581,7 @@ public abstract class TerremarkClientLiveTest extends BaseApiLiveTest<TerremarkV
|
|||
for (ReferenceType vdc : org.getVDCs().values()) {
|
||||
VDC response = api.getVDC(vdc.getHref());
|
||||
for (ReferenceType net : response.getAvailableNetworks().values()) {
|
||||
TerremarkVCloudClient newApi = null;
|
||||
TerremarkVCloudApi newApi = null;
|
||||
try {
|
||||
newApi = create(
|
||||
overrideDefaults(ImmutableMap.of(VCloudConstants.PROPERTY_VCLOUD_DEFAULT_ORG, org.getName(),
|
||||
|
@ -659,7 +659,7 @@ public abstract class TerremarkClientLiveTest extends BaseApiLiveTest<TerremarkV
|
|||
public void testPropertiesCanOverrideDefaultVDC() throws Exception {
|
||||
for (Org org : orgs) {
|
||||
for (ReferenceType vdc : org.getVDCs().values()) {
|
||||
TerremarkVCloudClient newApi = null;
|
||||
TerremarkVCloudApi newApi = null;
|
||||
try {
|
||||
newApi = create(
|
||||
overrideDefaults(ImmutableMap.of(VCloudConstants.PROPERTY_VCLOUD_DEFAULT_ORG, org.getName(),
|
||||
|
@ -690,7 +690,7 @@ public abstract class TerremarkClientLiveTest extends BaseApiLiveTest<TerremarkV
|
|||
public void testPropertiesCanOverrideDefaultTasksList() throws Exception {
|
||||
for (Org org : orgs) {
|
||||
for (ReferenceType tasksList : org.getTasksLists().values()) {
|
||||
TerremarkVCloudClient newApi = null;
|
||||
TerremarkVCloudApi newApi = null;
|
||||
try {
|
||||
newApi = create(
|
||||
overrideDefaults(ImmutableMap.of(VCloudConstants.PROPERTY_VCLOUD_DEFAULT_ORG, org.getName(),
|
|
@ -33,7 +33,7 @@ import org.jclouds.compute.ComputeServiceAdapter.NodeAndInitialCredentials;
|
|||
import org.jclouds.compute.domain.NodeMetadata;
|
||||
import org.jclouds.domain.Credentials;
|
||||
import org.jclouds.domain.LoginCredentials;
|
||||
import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudClient;
|
||||
import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudApi;
|
||||
import org.jclouds.trmk.vcloud_0_8.domain.Status;
|
||||
import org.jclouds.trmk.vcloud_0_8.domain.Task;
|
||||
import org.jclouds.trmk.vcloud_0_8.domain.VApp;
|
||||
|
@ -64,7 +64,7 @@ public class TerremarkVCloudComputeClientTest {
|
|||
URI vdcURI = URI.create("vdc");
|
||||
|
||||
expect(template.getDescription()).andReturn(description).atLeastOnce();
|
||||
TerremarkVCloudClient client = createMock(TerremarkVCloudClient.class);
|
||||
TerremarkVCloudApi client = createMock(TerremarkVCloudApi.class);
|
||||
VApp vApp = createMock(VApp.class);
|
||||
InternetServiceAndPublicIpAddressSupplier supplier = createMock(InternetServiceAndPublicIpAddressSupplier.class);
|
||||
expect(client.getVAppTemplate(templateURI)).andReturn(template);
|
||||
|
|
|
@ -26,7 +26,7 @@ import java.util.Map;
|
|||
import java.util.concurrent.ConcurrentMap;
|
||||
|
||||
import org.jclouds.domain.Credentials;
|
||||
import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudClient;
|
||||
import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudApi;
|
||||
import org.jclouds.trmk.vcloud_0_8.compute.domain.OrgAndName;
|
||||
import org.jclouds.trmk.vcloud_0_8.domain.KeyPair;
|
||||
import org.testng.annotations.Test;
|
||||
|
@ -124,7 +124,7 @@ public class DeleteKeyPairTest {
|
|||
@SuppressWarnings("unchecked")
|
||||
private DeleteKeyPair setupStrategy() {
|
||||
Map<String, Credentials> credentialStore = createMock(ConcurrentMap.class);
|
||||
TerremarkVCloudClient terremarkClient = createMock(TerremarkVCloudClient.class);
|
||||
TerremarkVCloudApi terremarkClient = createMock(TerremarkVCloudApi.class);
|
||||
|
||||
return new DeleteKeyPair(terremarkClient, credentialStore);
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ import java.util.Set;
|
|||
|
||||
import org.jclouds.compute.domain.Image;
|
||||
import org.jclouds.compute.internal.BaseComputeServiceContextLiveTest;
|
||||
import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudClient;
|
||||
import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudApi;
|
||||
import org.jclouds.trmk.vcloud_0_8.domain.CatalogItem;
|
||||
import org.jclouds.trmk.vcloud_0_8.functions.AllCatalogItemsInOrg;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
|
@ -44,7 +44,7 @@ extends BaseComputeServiceContextLiveTest {
|
|||
provider = "trmk-vcloudexpress";
|
||||
}
|
||||
|
||||
private TerremarkVCloudClient tmClient;
|
||||
private TerremarkVCloudApi tmClient;
|
||||
private VAppTemplatesInOrgs parser;
|
||||
private AllCatalogItemsInOrg allCatalogItemsInOrg;
|
||||
|
||||
|
@ -54,7 +54,7 @@ extends BaseComputeServiceContextLiveTest {
|
|||
super.setupContext();
|
||||
Injector injector = view.utils().injector();
|
||||
|
||||
tmClient = injector.getInstance(TerremarkVCloudClient.class);
|
||||
tmClient = injector.getInstance(TerremarkVCloudApi.class);
|
||||
allCatalogItemsInOrg = injector.getInstance(AllCatalogItemsInOrg.class);
|
||||
parser = injector.getInstance(VAppTemplatesInOrgs.class);
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ import org.jclouds.compute.internal.BaseComputeServiceContextLiveTest;
|
|||
import org.jclouds.predicates.SocketOpen;
|
||||
import org.jclouds.ssh.SshClient.Factory;
|
||||
import org.jclouds.sshj.config.SshjSshClientModule;
|
||||
import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudClient;
|
||||
import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudApi;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
|
@ -38,19 +38,19 @@ import com.google.inject.Module;
|
|||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(groups = "live", enabled = true, singleThreaded = true)
|
||||
public abstract class BaseTerremarkClientLiveTest extends BaseComputeServiceContextLiveTest {
|
||||
public abstract class BaseTerremarkApiLiveTest extends BaseComputeServiceContextLiveTest {
|
||||
|
||||
protected String prefix = System.getProperty("user.name");
|
||||
|
||||
protected ComputeService client;
|
||||
|
||||
public BaseTerremarkClientLiveTest() {
|
||||
public BaseTerremarkApiLiveTest() {
|
||||
provider = "trmk-ecloud";
|
||||
}
|
||||
|
||||
protected Predicate<HostAndPort> socketTester;
|
||||
protected Factory sshFactory;
|
||||
protected TerremarkVCloudClient api;
|
||||
protected TerremarkVCloudApi api;
|
||||
|
||||
@Override
|
||||
@BeforeClass(groups = { "integration", "live" })
|
||||
|
@ -60,7 +60,7 @@ public abstract class BaseTerremarkClientLiveTest extends BaseComputeServiceCont
|
|||
SocketOpen socketOpen = injector.getInstance(SocketOpen.class);
|
||||
socketTester = retry(socketOpen, 300, 1, SECONDS);
|
||||
sshFactory = injector.getInstance(Factory.class);
|
||||
api = injector.getInstance(TerremarkVCloudClient.class);
|
||||
api = injector.getInstance(TerremarkVCloudApi.class);
|
||||
}
|
||||
|
||||
protected Module getSshModule() {
|
|
@ -43,17 +43,17 @@ import com.google.inject.Module;
|
|||
import com.google.inject.Provides;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code VCloudLoginAsyncClient}
|
||||
* Tests behavior of {@code VCloudLoginApi}
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
// NOTE:without testName, this will not call @Before* and fail w/NPE during
|
||||
// surefire
|
||||
@Test(groups = "unit", testName = "VCloudLoginAsyncClientTest")
|
||||
public class TerremarkVCloudLoginAsyncClientTest extends BaseAsyncClientTest<TerremarkVCloudLoginAsyncClient> {
|
||||
@Test(groups = "unit", testName = "VCloudLoginApiTest")
|
||||
public class TerremarkVCloudLoginApiTest extends BaseAsyncClientTest<TerremarkVCloudLoginApi> {
|
||||
|
||||
public void testLogin() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = method(TerremarkVCloudLoginAsyncClient.class, "login");
|
||||
Invokable<?, ?> method = method(TerremarkVCloudLoginApi.class, "login");
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertEquals(request.getRequestLine(), "POST http://localhost:8080/login HTTP/1.1");
|
||||
|
@ -92,8 +92,8 @@ public class TerremarkVCloudLoginAsyncClientTest extends BaseAsyncClientTest<Ter
|
|||
|
||||
@Override
|
||||
protected ProviderMetadata createProviderMetadata() {
|
||||
return AnonymousProviderMetadata.forClientMappedToAsyncClientOnEndpoint(TerremarkVCloudLoginClient.class,
|
||||
TerremarkVCloudLoginAsyncClient.class, "http://localhost:8080/login");
|
||||
return AnonymousProviderMetadata.forApiOnEndpoint(TerremarkVCloudLoginApi.class,
|
||||
"http://localhost:8080/login");
|
||||
}
|
||||
|
||||
}
|
|
@ -38,11 +38,11 @@ import com.google.common.reflect.Invokable;
|
|||
* @author Adrian Cole
|
||||
*/
|
||||
// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire
|
||||
@Test(groups = "unit", testName = "VCloudVersionsAsyncClientTest")
|
||||
public class TerremarkVCloudVersionsAsyncClientTest extends BaseAsyncClientTest<TerremarkVCloudVersionsAsyncClient> {
|
||||
@Test(groups = "unit", testName = "VCloudVersionsApiTest")
|
||||
public class TerremarkVCloudVersionsApiTest extends BaseAsyncClientTest<TerremarkVCloudVersionsApi> {
|
||||
|
||||
public void testVersions() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = method(TerremarkVCloudVersionsAsyncClient.class, "getSupportedVersions");
|
||||
Invokable<?, ?> method = method(TerremarkVCloudVersionsApi.class, "getSupportedVersions");
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertEquals(request.getRequestLine(), "GET http://localhost:8080/versions HTTP/1.1");
|
||||
|
@ -63,8 +63,8 @@ public class TerremarkVCloudVersionsAsyncClientTest extends BaseAsyncClientTest<
|
|||
|
||||
@Override
|
||||
protected ProviderMetadata createProviderMetadata() {
|
||||
return AnonymousProviderMetadata.forClientMappedToAsyncClientOnEndpoint(TerremarkVCloudVersionsClient.class,
|
||||
TerremarkVCloudVersionsAsyncClient.class, "http://localhost:8080");
|
||||
return AnonymousProviderMetadata.forApiOnEndpoint(TerremarkVCloudVersionsApi.class,
|
||||
"http://localhost:8080");
|
||||
}
|
||||
|
||||
}
|
|
@ -16,7 +16,7 @@
|
|||
*/
|
||||
package org.jclouds.bluelock.vcloud.zone01.features;
|
||||
|
||||
import org.jclouds.vcloud.features.VAppClientLiveTest;
|
||||
import org.jclouds.vcloud.features.CatalogApiLiveTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
|
@ -24,10 +24,10 @@ import org.testng.annotations.Test;
|
|||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(groups = "live", enabled = true, singleThreaded = true, testName = "BluelockVCloudZone01VAppClientLiveTest")
|
||||
public class BluelockVCloudZone01VAppClientLiveTest extends VAppClientLiveTest {
|
||||
@Test(groups = "live", enabled = true, singleThreaded = true, testName = "BluelockVCloudZone01CatalogApiLiveTest")
|
||||
public class BluelockVCloudZone01CatalogApiLiveTest extends CatalogApiLiveTest {
|
||||
|
||||
public BluelockVCloudZone01VAppClientLiveTest() {
|
||||
public BluelockVCloudZone01CatalogApiLiveTest() {
|
||||
provider = "bluelock-vcloud-zone01";
|
||||
}
|
||||
}
|
|
@ -16,7 +16,7 @@
|
|||
*/
|
||||
package org.jclouds.bluelock.vcloud.zone01.features;
|
||||
|
||||
import org.jclouds.vcloud.features.TaskClientLiveTest;
|
||||
import org.jclouds.vcloud.features.NetworkApiLiveTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
|
@ -24,10 +24,10 @@ import org.testng.annotations.Test;
|
|||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(groups = "live", enabled = true, singleThreaded = true, testName = "BluelockVCloudZone01TaskClientLiveTest")
|
||||
public class BluelockVCloudZone01TaskClientLiveTest extends TaskClientLiveTest {
|
||||
@Test(groups = "live", enabled = true, singleThreaded = true, testName = "BluelockVCloudZone01NetworkApiLiveTest")
|
||||
public class BluelockVCloudZone01NetworkApiLiveTest extends NetworkApiLiveTest {
|
||||
|
||||
public BluelockVCloudZone01TaskClientLiveTest() {
|
||||
public BluelockVCloudZone01NetworkApiLiveTest() {
|
||||
provider = "bluelock-vcloud-zone01";
|
||||
}
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.jclouds.bluelock.vcloud.zone01.features;
|
||||
|
||||
import org.jclouds.vcloud.features.NetworkClientLiveTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(groups = "live", enabled = true, singleThreaded = true, testName = "BluelockVCloudZone01NetworkClientLiveTest")
|
||||
public class BluelockVCloudZone01NetworkClientLiveTest extends NetworkClientLiveTest {
|
||||
|
||||
public BluelockVCloudZone01NetworkClientLiveTest() {
|
||||
provider = "bluelock-vcloud-zone01";
|
||||
}
|
||||
}
|
|
@ -16,7 +16,7 @@
|
|||
*/
|
||||
package org.jclouds.bluelock.vcloud.zone01.features;
|
||||
|
||||
import org.jclouds.vcloud.features.VmClientLiveTest;
|
||||
import org.jclouds.vcloud.features.OrgApiLiveTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
|
@ -24,10 +24,10 @@ import org.testng.annotations.Test;
|
|||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(groups = "live", enabled = true, singleThreaded = true, testName = "BluelockVCloudZone01VmClientLiveTest")
|
||||
public class BluelockVCloudZone01VmClientLiveTest extends VmClientLiveTest {
|
||||
@Test(groups = "live", enabled = true, singleThreaded = true, testName = "BluelockVCloudZone01OrgApiLiveTest")
|
||||
public class BluelockVCloudZone01OrgApiLiveTest extends OrgApiLiveTest {
|
||||
|
||||
public BluelockVCloudZone01VmClientLiveTest() {
|
||||
public BluelockVCloudZone01OrgApiLiveTest() {
|
||||
provider = "bluelock-vcloud-zone01";
|
||||
}
|
||||
}
|
|
@ -16,7 +16,7 @@
|
|||
*/
|
||||
package org.jclouds.bluelock.vcloud.zone01.features;
|
||||
|
||||
import org.jclouds.vcloud.features.VDCClientLiveTest;
|
||||
import org.jclouds.vcloud.features.TaskApiLiveTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
|
@ -24,10 +24,10 @@ import org.testng.annotations.Test;
|
|||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(groups = "live", enabled = true, singleThreaded = true, testName = "BluelockVCloudZone01VDCClientLiveTest")
|
||||
public class BluelockVCloudZone01VDCClientLiveTest extends VDCClientLiveTest {
|
||||
@Test(groups = "live", enabled = true, singleThreaded = true, testName = "BluelockVCloudZone01TaskApiLiveTest")
|
||||
public class BluelockVCloudZone01TaskApiLiveTest extends TaskApiLiveTest {
|
||||
|
||||
public BluelockVCloudZone01VDCClientLiveTest() {
|
||||
public BluelockVCloudZone01TaskApiLiveTest() {
|
||||
provider = "bluelock-vcloud-zone01";
|
||||
}
|
||||
}
|
|
@ -16,7 +16,7 @@
|
|||
*/
|
||||
package org.jclouds.bluelock.vcloud.zone01.features;
|
||||
|
||||
import org.jclouds.vcloud.features.OrgClientLiveTest;
|
||||
import org.jclouds.vcloud.features.VAppApiLiveTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
|
@ -24,10 +24,10 @@ import org.testng.annotations.Test;
|
|||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(groups = "live", enabled = true, singleThreaded = true, testName = "BluelockVCloudZone01OrgClientLiveTest")
|
||||
public class BluelockVCloudZone01OrgClientLiveTest extends OrgClientLiveTest {
|
||||
@Test(groups = "live", enabled = true, singleThreaded = true, testName = "BluelockVCloudZone01VAppApiLiveTest")
|
||||
public class BluelockVCloudZone01VAppApiLiveTest extends VAppApiLiveTest {
|
||||
|
||||
public BluelockVCloudZone01OrgClientLiveTest() {
|
||||
public BluelockVCloudZone01VAppApiLiveTest() {
|
||||
provider = "bluelock-vcloud-zone01";
|
||||
}
|
||||
}
|
|
@ -16,7 +16,7 @@
|
|||
*/
|
||||
package org.jclouds.bluelock.vcloud.zone01.features;
|
||||
|
||||
import org.jclouds.vcloud.features.CatalogClientLiveTest;
|
||||
import org.jclouds.vcloud.features.VAppTemplateApiLiveTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
|
@ -24,10 +24,10 @@ import org.testng.annotations.Test;
|
|||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(groups = "live", enabled = true, singleThreaded = true, testName = "BluelockVCloudZone01CatalogClientLiveTest")
|
||||
public class BluelockVCloudZone01CatalogClientLiveTest extends CatalogClientLiveTest {
|
||||
@Test(groups = "live", enabled = true, singleThreaded = true, testName = "BluelockVCloudZone01VAppTemplateApiLiveTest")
|
||||
public class BluelockVCloudZone01VAppTemplateApiLiveTest extends VAppTemplateApiLiveTest {
|
||||
|
||||
public BluelockVCloudZone01CatalogClientLiveTest() {
|
||||
public BluelockVCloudZone01VAppTemplateApiLiveTest() {
|
||||
provider = "bluelock-vcloud-zone01";
|
||||
}
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.jclouds.bluelock.vcloud.zone01.features;
|
||||
|
||||
import org.jclouds.vcloud.features.VAppTemplateClientLiveTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(groups = "live", enabled = true, singleThreaded = true, testName = "BluelockVCloudZone01VAppTemplateClientLiveTest")
|
||||
public class BluelockVCloudZone01VAppTemplateClientLiveTest extends VAppTemplateClientLiveTest {
|
||||
|
||||
public BluelockVCloudZone01VAppTemplateClientLiveTest() {
|
||||
provider = "bluelock-vcloud-zone01";
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.jclouds.bluelock.vcloud.zone01.features;
|
||||
|
||||
import org.jclouds.vcloud.features.VDCApiLiveTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(groups = "live", enabled = true, singleThreaded = true, testName = "BluelockVCloudZone01VDCApiLiveTest")
|
||||
public class BluelockVCloudZone01VDCApiLiveTest extends VDCApiLiveTest {
|
||||
|
||||
public BluelockVCloudZone01VDCApiLiveTest() {
|
||||
provider = "bluelock-vcloud-zone01";
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue