mirror of https://github.com/apache/jclouds.git
Issue 1022:Move naming convention to Api from Client or Services:: glesys jenkins openstack-* opsource-servers savvis-symphonyvpdc cloudwatch cloudidentity rackspace-cloudidentity aws-cloudwatch rackspace-cloudservers-us hpcloud-compute rackspace-cloudservers-us trystack-nova
This commit is contained in:
parent
b49f2e99c7
commit
180265fe49
|
@ -22,7 +22,7 @@ import java.util.List;
|
||||||
|
|
||||||
import org.jclouds.cloudwatch.domain.Metric;
|
import org.jclouds.cloudwatch.domain.Metric;
|
||||||
import org.jclouds.cloudwatch.domain.MetricDatum;
|
import org.jclouds.cloudwatch.domain.MetricDatum;
|
||||||
import org.jclouds.cloudwatch.features.MetricClient;
|
import org.jclouds.cloudwatch.features.MetricApi;
|
||||||
import org.jclouds.cloudwatch.options.ListMetricsOptions;
|
import org.jclouds.cloudwatch.options.ListMetricsOptions;
|
||||||
import org.jclouds.collect.PaginatedIterable;
|
import org.jclouds.collect.PaginatedIterable;
|
||||||
import org.jclouds.collect.PaginatedIterables;
|
import org.jclouds.collect.PaginatedIterables;
|
||||||
|
@ -40,17 +40,17 @@ public class CloudWatch {
|
||||||
/**
|
/**
|
||||||
* List metrics based on the criteria in the {@link ListMetricsOptions} passed in.
|
* List metrics based on the criteria in the {@link ListMetricsOptions} passed in.
|
||||||
*
|
*
|
||||||
* @param metricClient the {@link MetricClient} to use for the request
|
* @param metricApi the {@link MetricApi} to use for the request
|
||||||
* @param options the {@link ListMetricsOptions} describing the ListMetrics request
|
* @param options the {@link ListMetricsOptions} describing the ListMetrics request
|
||||||
*
|
*
|
||||||
* @return iterable of metrics fitting the criteria
|
* @return iterable of metrics fitting the criteria
|
||||||
*/
|
*/
|
||||||
public static Iterable<Metric> listMetrics(final MetricClient metricClient, final ListMetricsOptions options) {
|
public static Iterable<Metric> listMetrics(final MetricApi metricApi, final ListMetricsOptions options) {
|
||||||
return PaginatedIterables.lazyContinue(metricClient.list(options), new Function<Object, PaginatedIterable<Metric>>() {
|
return PaginatedIterables.lazyContinue(metricApi.list(options), new Function<Object, PaginatedIterable<Metric>>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PaginatedIterable<Metric> apply(Object input) {
|
public PaginatedIterable<Metric> apply(Object input) {
|
||||||
return metricClient.list(options.clone().afterMarker(input));
|
return metricApi.list(options.clone().afterMarker(input));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -63,31 +63,31 @@ public class CloudWatch {
|
||||||
/**
|
/**
|
||||||
* List metrics based on the criteria in the {@link ListMetricsOptions} passed in.
|
* List metrics based on the criteria in the {@link ListMetricsOptions} passed in.
|
||||||
*
|
*
|
||||||
* @param cloudWatchClient the {@link CloudWatchClient} to use for the request
|
* @param cloudWatchApi the {@link CloudWatchApi} to use for the request
|
||||||
* @param region the region to list metrics in
|
* @param region the region to list metrics in
|
||||||
* @param options the options describing the ListMetrics request
|
* @param options the options describing the ListMetrics request
|
||||||
*
|
*
|
||||||
* @return iterable of metrics fitting the criteria
|
* @return iterable of metrics fitting the criteria
|
||||||
*/
|
*/
|
||||||
public static Iterable<Metric> listMetrics(CloudWatchClient cloudWatchClient, String region,
|
public static Iterable<Metric> listMetrics(CloudWatchApi cloudWatchApi, String region,
|
||||||
final ListMetricsOptions options) {
|
final ListMetricsOptions options) {
|
||||||
return listMetrics(cloudWatchClient.getMetricClientForRegion(region), options);
|
return listMetrics(cloudWatchApi.getMetricApiForRegion(region), options);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pushes metrics to CloudWatch.
|
* Pushes metrics to CloudWatch.
|
||||||
*
|
*
|
||||||
* @param cloudWatchClient the {@link CloudWatchClient} to use for the request
|
* @param cloudWatchApi the {@link CloudWatchApi} to use for the request
|
||||||
* @param region the region to put the metrics in
|
* @param region the region to put the metrics in
|
||||||
* @param metrics the metrics to publish
|
* @param metrics the metrics to publish
|
||||||
* @param namespace the namespace to publish the metrics in
|
* @param namespace the namespace to publish the metrics in
|
||||||
*/
|
*/
|
||||||
public static void putMetricData(CloudWatchClient cloudWatchClient, String region, Iterable<MetricDatum> metrics,
|
public static void putMetricData(CloudWatchApi cloudWatchApi, String region, Iterable<MetricDatum> metrics,
|
||||||
String namespace) {
|
String namespace) {
|
||||||
MetricClient metricClient = cloudWatchClient.getMetricClientForRegion(region);
|
MetricApi metricApi = cloudWatchApi.getMetricApiForRegion(region);
|
||||||
|
|
||||||
for (List<MetricDatum> slice : Iterables.partition(metrics, 10)) {
|
for (List<MetricDatum> slice : Iterables.partition(metrics, 10)) {
|
||||||
metricClient.putMetricsInNamespace(slice, namespace);
|
metricApi.putMetricsInNamespace(slice, namespace);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ package org.jclouds.cloudwatch;
|
||||||
import com.google.inject.Provides;
|
import com.google.inject.Provides;
|
||||||
import org.jclouds.cloudwatch.domain.Datapoint;
|
import org.jclouds.cloudwatch.domain.Datapoint;
|
||||||
import org.jclouds.cloudwatch.domain.Statistics;
|
import org.jclouds.cloudwatch.domain.Statistics;
|
||||||
import org.jclouds.cloudwatch.features.MetricClient;
|
import org.jclouds.cloudwatch.features.MetricApi;
|
||||||
import org.jclouds.cloudwatch.options.GetMetricStatisticsOptions;
|
import org.jclouds.cloudwatch.options.GetMetricStatisticsOptions;
|
||||||
import org.jclouds.concurrent.Timeout;
|
import org.jclouds.concurrent.Timeout;
|
||||||
import org.jclouds.javax.annotation.Nullable;
|
import org.jclouds.javax.annotation.Nullable;
|
||||||
|
@ -44,7 +44,7 @@ import java.util.concurrent.TimeUnit;
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
@Timeout(duration = 30, timeUnit = TimeUnit.SECONDS)
|
@Timeout(duration = 30, timeUnit = TimeUnit.SECONDS)
|
||||||
public interface CloudWatchClient {
|
public interface CloudWatchApi {
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return the Region codes configured
|
* @return the Region codes configured
|
||||||
|
@ -89,7 +89,7 @@ public interface CloudWatchClient {
|
||||||
* The statistics to be returned for the given metric. ex. Average
|
* The statistics to be returned for the given metric. ex. Average
|
||||||
* @param options
|
* @param options
|
||||||
* more filtering options (e.g. instance ID)
|
* more filtering options (e.g. instance ID)
|
||||||
* @see MetricClient#getMetricStatistics(org.jclouds.cloudwatch.domain.GetMetricStatistics)
|
* @see MetricApi#getMetricStatistics(org.jclouds.cloudwatch.domain.GetMetricStatistics)
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
Set<Datapoint> getMetricStatisticsInRegion(@Nullable String region, String metricName, String namespace,
|
Set<Datapoint> getMetricStatisticsInRegion(@Nullable String region, String metricName, String namespace,
|
||||||
|
@ -99,11 +99,11 @@ public interface CloudWatchClient {
|
||||||
* Provides synchronous access to Metric features.
|
* Provides synchronous access to Metric features.
|
||||||
*/
|
*/
|
||||||
@Delegate
|
@Delegate
|
||||||
MetricClient getMetricClient();
|
MetricApi getMetricApi();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides synchronous access to Metric features.
|
* Provides synchronous access to Metric features.
|
||||||
*/
|
*/
|
||||||
@Delegate
|
@Delegate
|
||||||
MetricClient getMetricClientForRegion(@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region);
|
MetricApi getMetricApiForRegion(@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region);
|
||||||
}
|
}
|
|
@ -41,7 +41,7 @@ public class CloudWatchApiMetadata extends BaseRestApiMetadata {
|
||||||
/** The serialVersionUID */
|
/** The serialVersionUID */
|
||||||
private static final long serialVersionUID = 3450830053589179249L;
|
private static final long serialVersionUID = 3450830053589179249L;
|
||||||
|
|
||||||
public static final TypeToken<RestContext<CloudWatchClient, CloudWatchAsyncClient>> CONTEXT_TOKEN = new TypeToken<RestContext<CloudWatchClient, CloudWatchAsyncClient>>() {
|
public static final TypeToken<RestContext<CloudWatchApi, CloudWatchAsyncApi>> CONTEXT_TOKEN = new TypeToken<RestContext<CloudWatchApi, CloudWatchAsyncApi>>() {
|
||||||
private static final long serialVersionUID = -5070937833892503232L;
|
private static final long serialVersionUID = -5070937833892503232L;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ public class CloudWatchApiMetadata extends BaseRestApiMetadata {
|
||||||
}
|
}
|
||||||
|
|
||||||
public CloudWatchApiMetadata() {
|
public CloudWatchApiMetadata() {
|
||||||
this(new Builder(CloudWatchClient.class, CloudWatchAsyncClient.class));
|
this(new Builder(CloudWatchApi.class, CloudWatchAsyncApi.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected CloudWatchApiMetadata(Builder builder) {
|
protected CloudWatchApiMetadata(Builder builder) {
|
||||||
|
@ -67,8 +67,8 @@ public class CloudWatchApiMetadata extends BaseRestApiMetadata {
|
||||||
|
|
||||||
public static class Builder extends BaseRestApiMetadata.Builder {
|
public static class Builder extends BaseRestApiMetadata.Builder {
|
||||||
|
|
||||||
protected Builder(Class<?> client, Class<?> asyncClient) {
|
protected Builder(Class<?> api, Class<?> asyncApi) {
|
||||||
super(client, asyncClient);
|
super(api, asyncApi);
|
||||||
id("cloudwatch")
|
id("cloudwatch")
|
||||||
.name("Amazon CloudWatch Api")
|
.name("Amazon CloudWatch Api")
|
||||||
.identityName("Access Key ID")
|
.identityName("Access Key ID")
|
||||||
|
|
|
@ -28,7 +28,7 @@ import javax.ws.rs.Path;
|
||||||
import org.jclouds.aws.filters.FormSigner;
|
import org.jclouds.aws.filters.FormSigner;
|
||||||
import org.jclouds.cloudwatch.domain.Datapoint;
|
import org.jclouds.cloudwatch.domain.Datapoint;
|
||||||
import org.jclouds.cloudwatch.domain.Statistics;
|
import org.jclouds.cloudwatch.domain.Statistics;
|
||||||
import org.jclouds.cloudwatch.features.MetricAsyncClient;
|
import org.jclouds.cloudwatch.features.MetricAsyncApi;
|
||||||
import org.jclouds.cloudwatch.functions.ISO8601Format;
|
import org.jclouds.cloudwatch.functions.ISO8601Format;
|
||||||
import org.jclouds.cloudwatch.options.GetMetricStatisticsOptions;
|
import org.jclouds.cloudwatch.options.GetMetricStatisticsOptions;
|
||||||
import org.jclouds.cloudwatch.xml.GetMetricStatisticsResponseHandler;
|
import org.jclouds.cloudwatch.xml.GetMetricStatisticsResponseHandler;
|
||||||
|
@ -57,7 +57,7 @@ import com.google.inject.Provides;
|
||||||
*/
|
*/
|
||||||
@RequestFilters(FormSigner.class)
|
@RequestFilters(FormSigner.class)
|
||||||
@VirtualHost
|
@VirtualHost
|
||||||
public interface CloudWatchAsyncClient {
|
public interface CloudWatchAsyncApi {
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return the Region codes configured
|
* @return the Region codes configured
|
||||||
|
@ -67,7 +67,7 @@ public interface CloudWatchAsyncClient {
|
||||||
Set<String> getConfiguredRegions();
|
Set<String> getConfiguredRegions();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see MetricAsyncClient#getMetricStatistics
|
* @see MetricAsyncApi#getMetricStatistics
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@POST
|
@POST
|
||||||
|
@ -88,9 +88,9 @@ public interface CloudWatchAsyncClient {
|
||||||
* Provides asynchronous access to Metric features.
|
* Provides asynchronous access to Metric features.
|
||||||
*/
|
*/
|
||||||
@Delegate
|
@Delegate
|
||||||
MetricAsyncClient getMetricClient();
|
MetricAsyncApi getMetricApi();
|
||||||
|
|
||||||
@Delegate
|
@Delegate
|
||||||
MetricAsyncClient getMetricClientForRegion(@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region);
|
MetricAsyncApi getMetricApiForRegion(@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region);
|
||||||
|
|
||||||
}
|
}
|
|
@ -21,10 +21,10 @@ package org.jclouds.cloudwatch.config;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.jclouds.aws.config.FormSigningRestClientModule;
|
import org.jclouds.aws.config.FormSigningRestClientModule;
|
||||||
import org.jclouds.cloudwatch.CloudWatchAsyncClient;
|
import org.jclouds.cloudwatch.CloudWatchAsyncApi;
|
||||||
import org.jclouds.cloudwatch.CloudWatchClient;
|
import org.jclouds.cloudwatch.CloudWatchApi;
|
||||||
import org.jclouds.cloudwatch.features.MetricAsyncClient;
|
import org.jclouds.cloudwatch.features.MetricAsyncApi;
|
||||||
import org.jclouds.cloudwatch.features.MetricClient;
|
import org.jclouds.cloudwatch.features.MetricApi;
|
||||||
import org.jclouds.rest.ConfiguresRestClient;
|
import org.jclouds.rest.ConfiguresRestClient;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
|
@ -36,13 +36,13 @@ import com.google.common.reflect.TypeToken;
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
@ConfiguresRestClient
|
@ConfiguresRestClient
|
||||||
public class CloudWatchRestClientModule extends FormSigningRestClientModule<CloudWatchClient, CloudWatchAsyncClient> {
|
public class CloudWatchRestClientModule extends FormSigningRestClientModule<CloudWatchApi, CloudWatchAsyncApi> {
|
||||||
public static final Map<Class<?>, Class<?>> DELEGATE_MAP = ImmutableMap.<Class<?>, Class<?>> builder()//
|
public static final Map<Class<?>, Class<?>> DELEGATE_MAP = ImmutableMap.<Class<?>, Class<?>> builder()//
|
||||||
.put(MetricClient.class, MetricAsyncClient.class)
|
.put(MetricApi.class, MetricAsyncApi.class)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
public CloudWatchRestClientModule() {
|
public CloudWatchRestClientModule() {
|
||||||
super(TypeToken.of(CloudWatchClient.class), TypeToken.of(CloudWatchAsyncClient.class), DELEGATE_MAP);
|
super(TypeToken.of(CloudWatchApi.class), TypeToken.of(CloudWatchAsyncApi.class), DELEGATE_MAP);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@ import org.jclouds.concurrent.Timeout;
|
||||||
* @author Jeremy Whitlock
|
* @author Jeremy Whitlock
|
||||||
*/
|
*/
|
||||||
@Timeout(duration = 30, timeUnit = TimeUnit.SECONDS)
|
@Timeout(duration = 30, timeUnit = TimeUnit.SECONDS)
|
||||||
public interface MetricClient {
|
public interface MetricApi {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a list of valid metrics stored for the AWS account owner.
|
* Returns a list of valid metrics stored for the AWS account owner.
|
||||||
|
@ -47,7 +47,7 @@ public interface MetricClient {
|
||||||
* use returned NextToken (
|
* use returned NextToken (
|
||||||
* {@link org.jclouds.cloudwatch.domain.ListMetricsResponse#getNextToken()}) value with
|
* {@link org.jclouds.cloudwatch.domain.ListMetricsResponse#getNextToken()}) value with
|
||||||
* subsequent calls .To retrieve all available metrics with one call, use
|
* subsequent calls .To retrieve all available metrics with one call, use
|
||||||
* {@link org.jclouds.cloudwatch.CloudWatch#listMetrics(MetricClient,
|
* {@link org.jclouds.cloudwatch.CloudWatch#listMetrics(MetricApi,
|
||||||
* org.jclouds.cloudwatch.options.ListMetricsOptions)}
|
* org.jclouds.cloudwatch.options.ListMetricsOptions)}
|
||||||
*
|
*
|
||||||
* @param options the options describing the metrics query
|
* @param options the options describing the metrics query
|
|
@ -51,10 +51,10 @@ import com.google.common.util.concurrent.ListenableFuture;
|
||||||
*/
|
*/
|
||||||
@RequestFilters(FormSigner.class)
|
@RequestFilters(FormSigner.class)
|
||||||
@VirtualHost
|
@VirtualHost
|
||||||
public interface MetricAsyncClient {
|
public interface MetricAsyncApi {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see MetricClient#list()
|
* @see MetricApi#list()
|
||||||
*/
|
*/
|
||||||
@POST
|
@POST
|
||||||
@Path("/")
|
@Path("/")
|
||||||
|
@ -63,7 +63,7 @@ public interface MetricAsyncClient {
|
||||||
ListenableFuture<? extends PaginatedIterable<Metric>> list();
|
ListenableFuture<? extends PaginatedIterable<Metric>> list();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see MetricClient#list(ListMetricsOptions)
|
* @see MetricApi#list(ListMetricsOptions)
|
||||||
*/
|
*/
|
||||||
@POST
|
@POST
|
||||||
@Path("/")
|
@Path("/")
|
||||||
|
@ -72,7 +72,7 @@ public interface MetricAsyncClient {
|
||||||
ListenableFuture<? extends PaginatedIterable<Metric>> list(ListMetricsOptions options);
|
ListenableFuture<? extends PaginatedIterable<Metric>> list(ListMetricsOptions options);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see MetricClient#getMetricStatistics(GetMetricStatistics)
|
* @see MetricApi#getMetricStatistics(GetMetricStatistics)
|
||||||
*/
|
*/
|
||||||
@POST
|
@POST
|
||||||
@Path("/")
|
@Path("/")
|
||||||
|
@ -82,7 +82,7 @@ public interface MetricAsyncClient {
|
||||||
@BinderParam(GetMetricStatisticsBinder.class) GetMetricStatistics statistics);
|
@BinderParam(GetMetricStatisticsBinder.class) GetMetricStatistics statistics);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see MetricClient#getMetricStatistics(GetMetricStatistics, GetMetricStatisticsOptions)
|
* @see MetricApi#getMetricStatistics(GetMetricStatistics, GetMetricStatisticsOptions)
|
||||||
*/
|
*/
|
||||||
@POST
|
@POST
|
||||||
@Path("/")
|
@Path("/")
|
||||||
|
@ -93,7 +93,7 @@ public interface MetricAsyncClient {
|
||||||
GetMetricStatisticsOptions options);
|
GetMetricStatisticsOptions options);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see MetricClient#putMetricsInNamespace(Iterable, String)
|
* @see MetricApi#putMetricsInNamespace(Iterable, String)
|
||||||
*/
|
*/
|
||||||
@POST
|
@POST
|
||||||
@Path("/")
|
@Path("/")
|
|
@ -36,24 +36,24 @@ import org.testng.annotations.Test;
|
||||||
import com.google.common.reflect.TypeToken;
|
import com.google.common.reflect.TypeToken;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests behavior of {@code CloudWatchClient}
|
* Tests behavior of {@code CloudWatchApi}
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
@Test(groups = "live", testName ="CloudWatchClientLiveTest", singleThreaded = true)
|
@Test(groups = "live", testName ="CloudWatchApiLiveTest", singleThreaded = true)
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public class CloudWatchClientLiveTest extends BaseContextLiveTest<RestContext<CloudWatchClient, CloudWatchAsyncClient>> {
|
public class CloudWatchApiLiveTest extends BaseContextLiveTest<RestContext<CloudWatchApi, CloudWatchAsyncApi>> {
|
||||||
public CloudWatchClientLiveTest() {
|
public CloudWatchApiLiveTest() {
|
||||||
provider = "cloudwatch";
|
provider = "cloudwatch";
|
||||||
}
|
}
|
||||||
|
|
||||||
private CloudWatchClient client;
|
private CloudWatchApi api;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@BeforeClass(groups = { "integration", "live" })
|
@BeforeClass(groups = { "integration", "live" })
|
||||||
public void setupContext() {
|
public void setupContext() {
|
||||||
super.setupContext();
|
super.setupContext();
|
||||||
client = context.getApi();
|
api = context.getApi();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -61,14 +61,14 @@ public class CloudWatchClientLiveTest extends BaseContextLiveTest<RestContext<Cl
|
||||||
Calendar cal = Calendar.getInstance();
|
Calendar cal = Calendar.getInstance();
|
||||||
cal.add(Calendar.MINUTE, -60 * 24 * 3); // 3 days
|
cal.add(Calendar.MINUTE, -60 * 24 * 3); // 3 days
|
||||||
|
|
||||||
Set<Datapoint> datapoints = client.getMetricStatisticsInRegion(region, "CPUUtilization", "AWS/EC2",
|
Set<Datapoint> datapoints = api.getMetricStatisticsInRegion(region, "CPUUtilization", "AWS/EC2",
|
||||||
cal.getTime(), new Date(), 180, Statistics.AVERAGE, GetMetricStatisticsOptions.Builder.unit(Unit.PERCENT));
|
cal.getTime(), new Date(), 180, Statistics.AVERAGE, GetMetricStatisticsOptions.Builder.unit(Unit.PERCENT));
|
||||||
|
|
||||||
return checkNotNull(datapoints, "Got null response for EC2 datapoints in region ");
|
return checkNotNull(datapoints, "Got null response for EC2 datapoints in region ");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected TypeToken<RestContext<CloudWatchClient, CloudWatchAsyncClient>> contextType() {
|
protected TypeToken<RestContext<CloudWatchApi, CloudWatchAsyncApi>> contextType() {
|
||||||
return CloudWatchApiMetadata.CONTEXT_TOKEN;
|
return CloudWatchApiMetadata.CONTEXT_TOKEN;
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@ import org.jclouds.http.functions.ParseSax;
|
||||||
import org.jclouds.location.config.LocationModule;
|
import org.jclouds.location.config.LocationModule;
|
||||||
import org.jclouds.location.suppliers.RegionIdToURISupplier;
|
import org.jclouds.location.suppliers.RegionIdToURISupplier;
|
||||||
import org.jclouds.rest.ConfiguresRestClient;
|
import org.jclouds.rest.ConfiguresRestClient;
|
||||||
import org.jclouds.rest.internal.BaseAsyncClientTest;
|
import org.jclouds.rest.internal.BaseAsyncApiTest;
|
||||||
import org.jclouds.rest.internal.RestAnnotationProcessor;
|
import org.jclouds.rest.internal.RestAnnotationProcessor;
|
||||||
import org.jclouds.util.Suppliers2;
|
import org.jclouds.util.Suppliers2;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
@ -51,19 +51,19 @@ import com.google.inject.Module;
|
||||||
import com.google.inject.TypeLiteral;
|
import com.google.inject.TypeLiteral;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests behavior of {@code CloudWatchAsyncClient}
|
* Tests behavior of {@code CloudWatchAsyncApi}
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
// NOTE:without testName, this will not call @Before* and fail w/NPE during
|
// NOTE:without testName, this will not call @Before* and fail w/NPE during
|
||||||
// surefire
|
// surefire
|
||||||
@Test(groups = "unit", testName = "CloudWatchAsyncClientTest")
|
@Test(groups = "unit", testName = "CloudWatchAsyncApiTest")
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public class CloudWatchAsyncClientTest extends BaseAsyncClientTest<CloudWatchAsyncClient> {
|
public class CloudWatchAsyncApiTest extends BaseAsyncApiTest<CloudWatchAsyncApi> {
|
||||||
|
|
||||||
public void testRegisterInstancesWithMeasure() throws SecurityException, NoSuchMethodException, IOException {
|
public void testRegisterInstancesWithMeasure() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Date date = new Date(10000000l);
|
Date date = new Date(10000000l);
|
||||||
Method method = CloudWatchAsyncClient.class.getMethod("getMetricStatisticsInRegion", String.class, String.class,
|
Method method = CloudWatchAsyncApi.class.getMethod("getMetricStatisticsInRegion", String.class, String.class,
|
||||||
String.class, Date.class, Date.class, int.class, Statistics.class, GetMetricStatisticsOptions[].class);
|
String.class, Date.class, Date.class, int.class, Statistics.class, GetMetricStatisticsOptions[].class);
|
||||||
HttpRequest request = processor.createRequest(method, (String) null, "CPUUtilization", "AWS/EC2", date, date, 60,
|
HttpRequest request = processor.createRequest(method, (String) null, "CPUUtilization", "AWS/EC2", date, date, 60,
|
||||||
Statistics.AVERAGE, GetMetricStatisticsOptions.Builder.instanceId("i-12312313"));
|
Statistics.AVERAGE, GetMetricStatisticsOptions.Builder.instanceId("i-12312313"));
|
||||||
|
@ -83,8 +83,8 @@ public class CloudWatchAsyncClientTest extends BaseAsyncClientTest<CloudWatchAsy
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected TypeLiteral<RestAnnotationProcessor<CloudWatchAsyncClient>> createTypeLiteral() {
|
protected TypeLiteral<RestAnnotationProcessor<CloudWatchAsyncApi>> createTypeLiteral() {
|
||||||
return new TypeLiteral<RestAnnotationProcessor<CloudWatchAsyncClient>>() {
|
return new TypeLiteral<RestAnnotationProcessor<CloudWatchAsyncApi>>() {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,30 +44,30 @@ import static com.google.common.base.Preconditions.checkArgument;
|
||||||
*
|
*
|
||||||
* @author Jeremy Whitlock
|
* @author Jeremy Whitlock
|
||||||
*/
|
*/
|
||||||
public class CloudWatchLiveTest extends BaseContextLiveTest<RestContext<CloudWatchClient, CloudWatchAsyncClient>> {
|
public class CloudWatchLiveTest extends BaseContextLiveTest<RestContext<CloudWatchApi, CloudWatchAsyncApi>> {
|
||||||
|
|
||||||
public CloudWatchLiveTest() {
|
public CloudWatchLiveTest() {
|
||||||
provider = "cloudwatch";
|
provider = "cloudwatch";
|
||||||
}
|
}
|
||||||
|
|
||||||
private CloudWatchClient client;
|
private CloudWatchApi api;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@BeforeClass(groups = { "integration", "live" })
|
@BeforeClass(groups = { "integration", "live" })
|
||||||
public void setupContext() {
|
public void setupContext() {
|
||||||
super.setupContext();
|
super.setupContext();
|
||||||
client = context.getApi();
|
api = context.getApi();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected TypeToken<RestContext<CloudWatchClient, CloudWatchAsyncClient>> contextType() {
|
protected TypeToken<RestContext<CloudWatchApi, CloudWatchAsyncApi>> contextType() {
|
||||||
return CloudWatchApiMetadata.CONTEXT_TOKEN;
|
return CloudWatchApiMetadata.CONTEXT_TOKEN;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
protected void testCloudWatchListMetrics() {
|
protected void testCloudWatchListMetrics() {
|
||||||
// Just make sure there is at least one metric returned (Much better if the account you use has more than 500)
|
// Just make sure there is at least one metric returned (Much better if the account you use has more than 500)
|
||||||
checkArgument(CloudWatch.listMetrics(client, null, new ListMetricsOptions()).iterator().hasNext());
|
checkArgument(CloudWatch.listMetrics(api, null, new ListMetricsOptions()).iterator().hasNext());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -87,14 +87,14 @@ public class CloudWatchLiveTest extends BaseContextLiveTest<RestContext<CloudWat
|
||||||
.build());
|
.build());
|
||||||
}
|
}
|
||||||
|
|
||||||
CloudWatch.putMetricData(client, null, metrics, namespace);
|
CloudWatch.putMetricData(api, null, metrics, namespace);
|
||||||
|
|
||||||
ListMetricsOptions lmo = ListMetricsOptions.Builder.namespace(namespace)
|
ListMetricsOptions lmo = ListMetricsOptions.Builder.namespace(namespace)
|
||||||
.dimension(new Dimension("BaseMetricName", metricName));
|
.dimension(new Dimension("BaseMetricName", metricName));
|
||||||
boolean success = new RetryablePredicate<ListMetricsOptions>(new Predicate<ListMetricsOptions>() {
|
boolean success = new RetryablePredicate<ListMetricsOptions>(new Predicate<ListMetricsOptions>() {
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(ListMetricsOptions options) {
|
public boolean apply(ListMetricsOptions options) {
|
||||||
return Iterables.size(CloudWatch.listMetrics(client, null, options)) == 11;
|
return Iterables.size(CloudWatch.listMetrics(api, null, options)) == 11;
|
||||||
}
|
}
|
||||||
}, 20, 1, TimeUnit.MINUTES).apply(lmo);
|
}, 20, 1, TimeUnit.MINUTES).apply(lmo);
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ import java.util.Set;
|
||||||
import org.easymock.EasyMock;
|
import org.easymock.EasyMock;
|
||||||
import org.jclouds.cloudwatch.domain.Metric;
|
import org.jclouds.cloudwatch.domain.Metric;
|
||||||
import org.jclouds.cloudwatch.domain.MetricDatum;
|
import org.jclouds.cloudwatch.domain.MetricDatum;
|
||||||
import org.jclouds.cloudwatch.features.MetricClient;
|
import org.jclouds.cloudwatch.features.MetricApi;
|
||||||
import org.jclouds.cloudwatch.options.ListMetricsOptions;
|
import org.jclouds.cloudwatch.options.ListMetricsOptions;
|
||||||
import org.jclouds.collect.PaginatedIterable;
|
import org.jclouds.collect.PaginatedIterable;
|
||||||
import org.jclouds.collect.PaginatedIterables;
|
import org.jclouds.collect.PaginatedIterables;
|
||||||
|
@ -48,72 +48,72 @@ import com.google.common.collect.Sets;
|
||||||
public class CloudWatchTest {
|
public class CloudWatchTest {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests {@link CloudWatch#listMetrics(CloudWatchClient, String, org.jclouds.cloudwatch.options.ListMetricsOptions)}
|
* Tests {@link CloudWatch#listMetrics(CloudWatchApi, String, org.jclouds.cloudwatch.options.ListMetricsOptions)}
|
||||||
* where a single response returns all results.
|
* where a single response returns all results.
|
||||||
*
|
*
|
||||||
* @throws Exception if anything goes wrong
|
* @throws Exception if anything goes wrong
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testSinglePageResult() throws Exception {
|
public void testSinglePageResult() throws Exception {
|
||||||
CloudWatchClient client = createMock(CloudWatchClient.class);
|
CloudWatchApi api = createMock(CloudWatchApi.class);
|
||||||
MetricClient metricClient = createMock(MetricClient.class);
|
MetricApi metricApi = createMock(MetricApi.class);
|
||||||
ListMetricsOptions options = new ListMetricsOptions();
|
ListMetricsOptions options = new ListMetricsOptions();
|
||||||
PaginatedIterable<Metric> response = PaginatedIterables.forwardWithMarker(ImmutableSet.of(createMock(Metric.class)), null);
|
PaginatedIterable<Metric> response = PaginatedIterables.forwardWithMarker(ImmutableSet.of(createMock(Metric.class)), null);
|
||||||
|
|
||||||
expect(client.getMetricClientForRegion(null))
|
expect(api.getMetricApiForRegion(null))
|
||||||
.andReturn(metricClient)
|
.andReturn(metricApi)
|
||||||
.atLeastOnce();
|
.atLeastOnce();
|
||||||
|
|
||||||
expect(metricClient.list(options))
|
expect(metricApi.list(options))
|
||||||
.andReturn(response)
|
.andReturn(response)
|
||||||
.once();
|
.once();
|
||||||
|
|
||||||
EasyMock.replay(client, metricClient);
|
EasyMock.replay(api, metricApi);
|
||||||
|
|
||||||
Assert.assertEquals(1, Iterables.size(CloudWatch.listMetrics(client, null, options)));
|
Assert.assertEquals(1, Iterables.size(CloudWatch.listMetrics(api, null, options)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests {@link CloudWatch#listMetrics(CloudWatchClient, String, org.jclouds.cloudwatch.options.ListMetricsOptions)}
|
* Tests {@link CloudWatch#listMetrics(CloudWatchApi, String, org.jclouds.cloudwatch.options.ListMetricsOptions)}
|
||||||
* where retrieving all results requires multiple requests.
|
* where retrieving all results requires multiple requests.
|
||||||
*
|
*
|
||||||
* @throws Exception if anything goes wrong
|
* @throws Exception if anything goes wrong
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testMultiPageResult() throws Exception {
|
public void testMultiPageResult() throws Exception {
|
||||||
CloudWatchClient client = createMock(CloudWatchClient.class);
|
CloudWatchApi api = createMock(CloudWatchApi.class);
|
||||||
MetricClient metricClient = createMock(MetricClient.class);
|
MetricApi metricApi = createMock(MetricApi.class);
|
||||||
ListMetricsOptions options = new ListMetricsOptions();
|
ListMetricsOptions options = new ListMetricsOptions();
|
||||||
PaginatedIterable<Metric> response1 = PaginatedIterables.forwardWithMarker(ImmutableSet.of(createMock(Metric.class)), "NEXTTOKEN");
|
PaginatedIterable<Metric> response1 = PaginatedIterables.forwardWithMarker(ImmutableSet.of(createMock(Metric.class)), "NEXTTOKEN");
|
||||||
PaginatedIterable<Metric> response2 = PaginatedIterables.forwardWithMarker(ImmutableSet.of(createMock(Metric.class)), null);
|
PaginatedIterable<Metric> response2 = PaginatedIterables.forwardWithMarker(ImmutableSet.of(createMock(Metric.class)), null);
|
||||||
|
|
||||||
// Using EasyMock.eq("") because EasyMock makes it impossible to pass null as a String value here
|
// Using EasyMock.eq("") because EasyMock makes it impossible to pass null as a String value here
|
||||||
expect(client.getMetricClientForRegion(EasyMock.eq("")))
|
expect(api.getMetricApiForRegion(EasyMock.eq("")))
|
||||||
.andReturn(metricClient)
|
.andReturn(metricApi)
|
||||||
.atLeastOnce();
|
.atLeastOnce();
|
||||||
|
|
||||||
expect(metricClient.list(anyObject(ListMetricsOptions.class)))
|
expect(metricApi.list(anyObject(ListMetricsOptions.class)))
|
||||||
.andReturn(response1)
|
.andReturn(response1)
|
||||||
.once();
|
.once();
|
||||||
expect(metricClient.list(anyObject(ListMetricsOptions.class)))
|
expect(metricApi.list(anyObject(ListMetricsOptions.class)))
|
||||||
.andReturn(response2)
|
.andReturn(response2)
|
||||||
.once();
|
.once();
|
||||||
|
|
||||||
EasyMock.replay(client, metricClient);
|
EasyMock.replay(api, metricApi);
|
||||||
|
|
||||||
Assert.assertEquals(2, Iterables.size(CloudWatch.listMetrics(client, "", options)));
|
Assert.assertEquals(2, Iterables.size(CloudWatch.listMetrics(api, "", options)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests {@link CloudWatch#putMetricData(CloudWatchClient, String, Iterable, String)} where the set of metrics is
|
* Tests {@link CloudWatch#putMetricData(CloudWatchApi, String, Iterable, String)} where the set of metrics is
|
||||||
* greater than 10.
|
* greater than 10.
|
||||||
*
|
*
|
||||||
* @throws Exception if anything goes wrong
|
* @throws Exception if anything goes wrong
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testPutMetricData() throws Exception {
|
public void testPutMetricData() throws Exception {
|
||||||
CloudWatchClient client = createMock(CloudWatchClient.class);
|
CloudWatchApi api = createMock(CloudWatchApi.class);
|
||||||
MetricClient metricClient = createMock(MetricClient.class);
|
MetricApi metricApi = createMock(MetricApi.class);
|
||||||
Set<MetricDatum> metrics = Sets.newLinkedHashSet();
|
Set<MetricDatum> metrics = Sets.newLinkedHashSet();
|
||||||
String namespace = "JCLOUDS/Test";
|
String namespace = "JCLOUDS/Test";
|
||||||
|
|
||||||
|
@ -122,19 +122,19 @@ public class CloudWatchTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Using EasyMock.eq("") because EasyMock makes it impossible to pass null as a String value here
|
// Using EasyMock.eq("") because EasyMock makes it impossible to pass null as a String value here
|
||||||
expect(client.getMetricClientForRegion(EasyMock.eq("")))
|
expect(api.getMetricApiForRegion(EasyMock.eq("")))
|
||||||
.andReturn(metricClient)
|
.andReturn(metricApi)
|
||||||
.atLeastOnce();
|
.atLeastOnce();
|
||||||
|
|
||||||
for (List<MetricDatum> slice : Iterables.partition(metrics, 10)) {
|
for (List<MetricDatum> slice : Iterables.partition(metrics, 10)) {
|
||||||
metricClient.putMetricsInNamespace(slice, namespace);
|
metricApi.putMetricsInNamespace(slice, namespace);
|
||||||
}
|
}
|
||||||
|
|
||||||
EasyMock.replay(client, metricClient);
|
EasyMock.replay(api, metricApi);
|
||||||
|
|
||||||
CloudWatch.putMetricData(client, "", metrics, namespace);
|
CloudWatch.putMetricData(api, "", metrics, namespace);
|
||||||
|
|
||||||
EasyMock.verify(metricClient);
|
EasyMock.verify(metricApi);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,14 +23,14 @@ import static org.testng.Assert.assertEquals;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.TimeZone;
|
import java.util.TimeZone;
|
||||||
|
|
||||||
import org.jclouds.cloudwatch.CloudWatchClient;
|
import org.jclouds.cloudwatch.CloudWatchApi;
|
||||||
import org.jclouds.cloudwatch.domain.Dimension;
|
import org.jclouds.cloudwatch.domain.Dimension;
|
||||||
import org.jclouds.cloudwatch.domain.EC2Constants;
|
import org.jclouds.cloudwatch.domain.EC2Constants;
|
||||||
import org.jclouds.cloudwatch.domain.GetMetricStatistics;
|
import org.jclouds.cloudwatch.domain.GetMetricStatistics;
|
||||||
import org.jclouds.cloudwatch.domain.Namespaces;
|
import org.jclouds.cloudwatch.domain.Namespaces;
|
||||||
import org.jclouds.cloudwatch.domain.Statistics;
|
import org.jclouds.cloudwatch.domain.Statistics;
|
||||||
import org.jclouds.cloudwatch.domain.Unit;
|
import org.jclouds.cloudwatch.domain.Unit;
|
||||||
import org.jclouds.cloudwatch.internal.BaseCloudWatchClientExpectTest;
|
import org.jclouds.cloudwatch.internal.BaseCloudWatchApiExpectTest;
|
||||||
import org.jclouds.cloudwatch.options.GetMetricStatisticsOptions;
|
import org.jclouds.cloudwatch.options.GetMetricStatisticsOptions;
|
||||||
import org.jclouds.cloudwatch.options.ListMetricsOptions;
|
import org.jclouds.cloudwatch.options.ListMetricsOptions;
|
||||||
import org.jclouds.http.HttpRequest;
|
import org.jclouds.http.HttpRequest;
|
||||||
|
@ -41,10 +41,10 @@ import org.testng.annotations.Test;
|
||||||
/**
|
/**
|
||||||
* @author Jeremy Whitlock, Adrian Cole
|
* @author Jeremy Whitlock, Adrian Cole
|
||||||
*/
|
*/
|
||||||
@Test(groups = "unit", testName = "MetricClientExpectTest")
|
@Test(groups = "unit", testName = "MetricApiExpectTest")
|
||||||
public class MetricClientExpectTest extends BaseCloudWatchClientExpectTest {
|
public class MetricApiExpectTest extends BaseCloudWatchApiExpectTest {
|
||||||
|
|
||||||
public MetricClientExpectTest() {
|
public MetricApiExpectTest() {
|
||||||
TimeZone.setDefault(TimeZone.getTimeZone("America/Los_Angeles"));
|
TimeZone.setDefault(TimeZone.getTimeZone("America/Los_Angeles"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,10 +69,10 @@ public class MetricClientExpectTest extends BaseCloudWatchClientExpectTest {
|
||||||
HttpResponse listMetricsResponse = HttpResponse.builder().statusCode(200)
|
HttpResponse listMetricsResponse = HttpResponse.builder().statusCode(200)
|
||||||
.payload(payloadFromResourceWithContentType("/list_metrics.xml", "text/xml")).build();
|
.payload(payloadFromResourceWithContentType("/list_metrics.xml", "text/xml")).build();
|
||||||
|
|
||||||
CloudWatchClient clientWhenMetricsExist = requestSendsResponse(
|
CloudWatchApi apiWhenMetricsExist = requestSendsResponse(
|
||||||
listMetrics, listMetricsResponse);
|
listMetrics, listMetricsResponse);
|
||||||
|
|
||||||
assertEquals(clientWhenMetricsExist.getMetricClientForRegion(null).list().toString(),
|
assertEquals(apiWhenMetricsExist.getMetricApiForRegion(null).list().toString(),
|
||||||
"{elements=[Metric{namespace=AWS/EC2, metricName=CPUUtilization, dimension=[Dimension{name=InstanceId, value=i-689fcf0f}]}], marker=null}");
|
"{elements=[Metric{namespace=AWS/EC2, metricName=CPUUtilization, dimension=[Dimension{name=InstanceId, value=i-689fcf0f}]}], marker=null}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,10 +82,10 @@ public class MetricClientExpectTest extends BaseCloudWatchClientExpectTest {
|
||||||
|
|
||||||
HttpResponse listMetricsResponse = HttpResponse.builder().statusCode(404).build();
|
HttpResponse listMetricsResponse = HttpResponse.builder().statusCode(404).build();
|
||||||
|
|
||||||
CloudWatchClient clientWhenMetricsDontExist = requestSendsResponse(
|
CloudWatchApi apiWhenMetricsDontExist = requestSendsResponse(
|
||||||
listMetrics, listMetricsResponse);
|
listMetrics, listMetricsResponse);
|
||||||
|
|
||||||
clientWhenMetricsDontExist.getMetricClientForRegion(null).list();
|
apiWhenMetricsDontExist.getMetricApiForRegion(null).list();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testListMetricsWithOptionsWhenResponseIs2xx() throws Exception {
|
public void testListMetricsWithOptionsWhenResponseIs2xx() throws Exception {
|
||||||
|
@ -113,11 +113,11 @@ public class MetricClientExpectTest extends BaseCloudWatchClientExpectTest {
|
||||||
HttpResponse listMetricsWithOptionsResponse = HttpResponse.builder().statusCode(200)
|
HttpResponse listMetricsWithOptionsResponse = HttpResponse.builder().statusCode(200)
|
||||||
.payload(payloadFromResourceWithContentType("/list_metrics.xml", "text/xml")).build();
|
.payload(payloadFromResourceWithContentType("/list_metrics.xml", "text/xml")).build();
|
||||||
|
|
||||||
CloudWatchClient clientWhenMetricsWithOptionsExist = requestSendsResponse(listMetricsWithOptions,
|
CloudWatchApi apiWhenMetricsWithOptionsExist = requestSendsResponse(listMetricsWithOptions,
|
||||||
listMetricsWithOptionsResponse);
|
listMetricsWithOptionsResponse);
|
||||||
|
|
||||||
assertEquals(
|
assertEquals(
|
||||||
clientWhenMetricsWithOptionsExist.getMetricClientForRegion(null).list(
|
apiWhenMetricsWithOptionsExist.getMetricApiForRegion(null).list(
|
||||||
ListMetricsOptions.Builder
|
ListMetricsOptions.Builder
|
||||||
.dimension(new Dimension(EC2Constants.Dimension.INSTANCE_ID,
|
.dimension(new Dimension(EC2Constants.Dimension.INSTANCE_ID,
|
||||||
"SOMEINSTANCEID"))
|
"SOMEINSTANCEID"))
|
||||||
|
@ -166,10 +166,10 @@ public class MetricClientExpectTest extends BaseCloudWatchClientExpectTest {
|
||||||
HttpResponse getMetricStatisticsResponse = HttpResponse.builder().statusCode(200).payload(
|
HttpResponse getMetricStatisticsResponse = HttpResponse.builder().statusCode(200).payload(
|
||||||
payloadFromResourceWithContentType("/get_metric_statistics.xml", "text/xml")).build();
|
payloadFromResourceWithContentType("/get_metric_statistics.xml", "text/xml")).build();
|
||||||
|
|
||||||
CloudWatchClient clientWhenMetricsExist = requestSendsResponse(getMetricStatistics, getMetricStatisticsResponse);
|
CloudWatchApi apiWhenMetricsExist = requestSendsResponse(getMetricStatistics, getMetricStatisticsResponse);
|
||||||
|
|
||||||
assertEquals(
|
assertEquals(
|
||||||
clientWhenMetricsExist.getMetricClientForRegion(null).getMetricStatistics(stats).toString(),
|
apiWhenMetricsExist.getMetricApiForRegion(null).getMetricStatistics(stats).toString(),
|
||||||
// TODO: make an object for this
|
// TODO: make an object for this
|
||||||
"GetMetricStatisticsResponse{label=CPUUtilization, " +
|
"GetMetricStatisticsResponse{label=CPUUtilization, " +
|
||||||
"datapoints=[Datapoint{timestamp=Thu Jan 15 16:00:00 PST 2009, customUnit=null, maximum=null, " +
|
"datapoints=[Datapoint{timestamp=Thu Jan 15 16:00:00 PST 2009, customUnit=null, maximum=null, " +
|
||||||
|
@ -184,9 +184,9 @@ public class MetricClientExpectTest extends BaseCloudWatchClientExpectTest {
|
||||||
|
|
||||||
HttpResponse getMetricStatisticsResponse = HttpResponse.builder().statusCode(404).build();
|
HttpResponse getMetricStatisticsResponse = HttpResponse.builder().statusCode(404).build();
|
||||||
|
|
||||||
CloudWatchClient clientWhenMetricsDontExist = requestSendsResponse(getMetricStatistics, getMetricStatisticsResponse);
|
CloudWatchApi apiWhenMetricsDontExist = requestSendsResponse(getMetricStatistics, getMetricStatisticsResponse);
|
||||||
|
|
||||||
clientWhenMetricsDontExist.getMetricClientForRegion(null).getMetricStatistics(stats);
|
apiWhenMetricsDontExist.getMetricApiForRegion(null).getMetricStatistics(stats);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGetMetricStatisticsWithOptionsWhenResponseIs2xx() throws Exception {
|
public void testGetMetricStatisticsWithOptionsWhenResponseIs2xx() throws Exception {
|
||||||
|
@ -221,13 +221,13 @@ public class MetricClientExpectTest extends BaseCloudWatchClientExpectTest {
|
||||||
HttpResponse getMetricStatisticsResponse = HttpResponse.builder().statusCode(200).payload(
|
HttpResponse getMetricStatisticsResponse = HttpResponse.builder().statusCode(200).payload(
|
||||||
payloadFromResourceWithContentType("/get_metric_statistics.xml", "text/xml")).build();
|
payloadFromResourceWithContentType("/get_metric_statistics.xml", "text/xml")).build();
|
||||||
|
|
||||||
CloudWatchClient clientWhenMetricsExist = requestSendsResponse(getMetricStatistics, getMetricStatisticsResponse);
|
CloudWatchApi apiWhenMetricsExist = requestSendsResponse(getMetricStatistics, getMetricStatisticsResponse);
|
||||||
|
|
||||||
Dimension dimension1 = new Dimension(EC2Constants.Dimension.INSTANCE_ID, "SOMEINSTANCEID");
|
Dimension dimension1 = new Dimension(EC2Constants.Dimension.INSTANCE_ID, "SOMEINSTANCEID");
|
||||||
Dimension dimension2 = new Dimension(EC2Constants.Dimension.INSTANCE_TYPE, "t1.micro");
|
Dimension dimension2 = new Dimension(EC2Constants.Dimension.INSTANCE_TYPE, "t1.micro");
|
||||||
|
|
||||||
assertEquals(
|
assertEquals(
|
||||||
clientWhenMetricsExist.getMetricClientForRegion(null).getMetricStatistics(stats,
|
apiWhenMetricsExist.getMetricApiForRegion(null).getMetricStatistics(stats,
|
||||||
GetMetricStatisticsOptions.Builder.dimension(dimension1).dimension(dimension2)).toString(),
|
GetMetricStatisticsOptions.Builder.dimension(dimension1).dimension(dimension2)).toString(),
|
||||||
// TODO: make an object for this
|
// TODO: make an object for this
|
||||||
"GetMetricStatisticsResponse{label=CPUUtilization, " +
|
"GetMetricStatisticsResponse{label=CPUUtilization, " +
|
|
@ -37,7 +37,7 @@ import org.jclouds.cloudwatch.domain.Namespaces;
|
||||||
import org.jclouds.cloudwatch.domain.StatisticValues;
|
import org.jclouds.cloudwatch.domain.StatisticValues;
|
||||||
import org.jclouds.cloudwatch.domain.Statistics;
|
import org.jclouds.cloudwatch.domain.Statistics;
|
||||||
import org.jclouds.cloudwatch.domain.Unit;
|
import org.jclouds.cloudwatch.domain.Unit;
|
||||||
import org.jclouds.cloudwatch.internal.BaseCloudWatchClientLiveTest;
|
import org.jclouds.cloudwatch.internal.BaseCloudWatchApiLiveTest;
|
||||||
import org.jclouds.cloudwatch.options.ListMetricsOptions;
|
import org.jclouds.cloudwatch.options.ListMetricsOptions;
|
||||||
import org.jclouds.collect.PaginatedIterable;
|
import org.jclouds.collect.PaginatedIterable;
|
||||||
import org.jclouds.predicates.RetryablePredicate;
|
import org.jclouds.predicates.RetryablePredicate;
|
||||||
|
@ -51,8 +51,8 @@ import com.google.common.collect.Iterables;
|
||||||
/**
|
/**
|
||||||
* @author Jeremy Whitlock, Adrian Cole
|
* @author Jeremy Whitlock, Adrian Cole
|
||||||
*/
|
*/
|
||||||
@Test(groups = "live", testName = "MetricClientLiveTest")
|
@Test(groups = "live", testName = "MetricApiLiveTest")
|
||||||
public class MetricClientLiveTest extends BaseCloudWatchClientLiveTest {
|
public class MetricApiLiveTest extends BaseCloudWatchApiLiveTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
protected void testPutMetricData() throws Exception {
|
protected void testPutMetricData() throws Exception {
|
||||||
|
@ -84,14 +84,14 @@ public class MetricClientLiveTest extends BaseCloudWatchClientLiveTest {
|
||||||
.value(10.0)
|
.value(10.0)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
client().putMetricsInNamespace(ImmutableSet.of(metricDatum, metricDatum2), namespace);
|
api().putMetricsInNamespace(ImmutableSet.of(metricDatum, metricDatum2), namespace);
|
||||||
|
|
||||||
ListMetricsOptions lmo = ListMetricsOptions.Builder.namespace(namespace)
|
ListMetricsOptions lmo = ListMetricsOptions.Builder.namespace(namespace)
|
||||||
.dimension(new Dimension("BaseMetricName", metricName));
|
.dimension(new Dimension("BaseMetricName", metricName));
|
||||||
boolean success = new RetryablePredicate<ListMetricsOptions>(new Predicate<ListMetricsOptions>() {
|
boolean success = new RetryablePredicate<ListMetricsOptions>(new Predicate<ListMetricsOptions>() {
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(ListMetricsOptions options) {
|
public boolean apply(ListMetricsOptions options) {
|
||||||
return Iterables.size(client().list(options)) == 2;
|
return Iterables.size(api().list(options)) == 2;
|
||||||
}
|
}
|
||||||
}, 20, 1, TimeUnit.MINUTES).apply(lmo);
|
}, 20, 1, TimeUnit.MINUTES).apply(lmo);
|
||||||
|
|
||||||
|
@ -99,7 +99,7 @@ public class MetricClientLiveTest extends BaseCloudWatchClientLiveTest {
|
||||||
Assert.fail("Unable to gather the created CloudWatch data within the time (20m) allotted.");
|
Assert.fail("Unable to gather the created CloudWatch data within the time (20m) allotted.");
|
||||||
}
|
}
|
||||||
|
|
||||||
PaginatedIterable<Metric> lmr = client().list(lmo);
|
PaginatedIterable<Metric> lmr = api().list(lmo);
|
||||||
Date endTime = new Date(metricTimestampInCloudWatch.getTime() + (60 * 1000)); // Pad a minute just in case
|
Date endTime = new Date(metricTimestampInCloudWatch.getTime() + (60 * 1000)); // Pad a minute just in case
|
||||||
Date startTime = new Date(metricTimestampInCloudWatch.getTime() - (60 * 1000)); // Pad a minute just in case
|
Date startTime = new Date(metricTimestampInCloudWatch.getTime() - (60 * 1000)); // Pad a minute just in case
|
||||||
|
|
||||||
|
@ -117,7 +117,7 @@ public class MetricClientLiveTest extends BaseCloudWatchClientLiveTest {
|
||||||
.startTime(startTime)
|
.startTime(startTime)
|
||||||
.unit(Unit.COUNT)
|
.unit(Unit.COUNT)
|
||||||
.build();
|
.build();
|
||||||
GetMetricStatisticsResponse gmr = client().getMetricStatistics(gms);
|
GetMetricStatisticsResponse gmr = api().getMetricStatistics(gms);
|
||||||
|
|
||||||
Assert.assertEquals(1, Iterables.size(gmr));
|
Assert.assertEquals(1, Iterables.size(gmr));
|
||||||
|
|
||||||
|
@ -145,7 +145,7 @@ public class MetricClientLiveTest extends BaseCloudWatchClientLiveTest {
|
||||||
// TODO: change this test to retrieve pre-seeded custom metrics
|
// TODO: change this test to retrieve pre-seeded custom metrics
|
||||||
@Test
|
@Test
|
||||||
protected void testGetMetricStatistics() {
|
protected void testGetMetricStatistics() {
|
||||||
PaginatedIterable<Metric> metricsResponse = client().list();
|
PaginatedIterable<Metric> metricsResponse = api().list();
|
||||||
|
|
||||||
// Walk through all datapoints in all metrics until we find a metric datapoint that returns statistics
|
// Walk through all datapoints in all metrics until we find a metric datapoint that returns statistics
|
||||||
if (Iterables.size(metricsResponse) > 0) {
|
if (Iterables.size(metricsResponse) > 0) {
|
||||||
|
@ -170,7 +170,7 @@ public class MetricClientLiveTest extends BaseCloudWatchClientLiveTest {
|
||||||
.statistics(ImmutableSet.of(Statistics.MAXIMUM,
|
.statistics(ImmutableSet.of(Statistics.MAXIMUM,
|
||||||
Statistics.MINIMUM))
|
Statistics.MINIMUM))
|
||||||
.unit(Unit.PERCENT).build();
|
.unit(Unit.PERCENT).build();
|
||||||
GetMetricStatisticsResponse response = client().getMetricStatistics(options);
|
GetMetricStatisticsResponse response = api().getMetricStatistics(options);
|
||||||
|
|
||||||
if (response.size() > 0) {
|
if (response.size() > 0) {
|
||||||
checkNotNull(response.getLabel());
|
checkNotNull(response.getLabel());
|
||||||
|
@ -202,7 +202,7 @@ public class MetricClientLiveTest extends BaseCloudWatchClientLiveTest {
|
||||||
String testDimensionValue = "t1.micro";
|
String testDimensionValue = "t1.micro";
|
||||||
|
|
||||||
// Test an empty request (pulls all stored metric options across all products)
|
// Test an empty request (pulls all stored metric options across all products)
|
||||||
response = client().list();
|
response = api().list();
|
||||||
|
|
||||||
performDefaultMetricsTests(response);
|
performDefaultMetricsTests(response);
|
||||||
|
|
||||||
|
@ -236,12 +236,12 @@ public class MetricClientLiveTest extends BaseCloudWatchClientLiveTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test with a NextToken, even if it's null
|
// Test with a NextToken, even if it's null
|
||||||
response = client().list(ListMetricsOptions.Builder.afterMarker(response.getNextMarker().toString()));
|
response = api().list(ListMetricsOptions.Builder.afterMarker(response.getNextMarker().toString()));
|
||||||
|
|
||||||
performDefaultMetricsTests(response);
|
performDefaultMetricsTests(response);
|
||||||
|
|
||||||
// Test with a Namespace
|
// Test with a Namespace
|
||||||
response = client().list(ListMetricsOptions.Builder.namespace(testNamespace));
|
response = api().list(ListMetricsOptions.Builder.namespace(testNamespace));
|
||||||
|
|
||||||
performDefaultMetricsTests(response);
|
performDefaultMetricsTests(response);
|
||||||
|
|
||||||
|
@ -251,7 +251,7 @@ public class MetricClientLiveTest extends BaseCloudWatchClientLiveTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test with a MetricName
|
// Test with a MetricName
|
||||||
response = client().list(ListMetricsOptions.Builder.metricName(testMetricName));
|
response = api().list(ListMetricsOptions.Builder.metricName(testMetricName));
|
||||||
|
|
||||||
performDefaultMetricsTests(response);
|
performDefaultMetricsTests(response);
|
||||||
|
|
||||||
|
@ -264,7 +264,7 @@ public class MetricClientLiveTest extends BaseCloudWatchClientLiveTest {
|
||||||
if (testDimensionName != null) {
|
if (testDimensionName != null) {
|
||||||
Dimension testDimension = new Dimension(testDimensionName, testDimensionValue);
|
Dimension testDimension = new Dimension(testDimensionName, testDimensionValue);
|
||||||
|
|
||||||
response = client().list(ListMetricsOptions.Builder.dimension(testDimension));
|
response = api().list(ListMetricsOptions.Builder.dimension(testDimension));
|
||||||
|
|
||||||
performDefaultMetricsTests(response);
|
performDefaultMetricsTests(response);
|
||||||
|
|
||||||
|
@ -303,7 +303,7 @@ public class MetricClientLiveTest extends BaseCloudWatchClientLiveTest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected MetricClient client() {
|
protected MetricApi api() {
|
||||||
return context.getApi().getMetricClientForRegion(null);
|
return context.getApi().getMetricApiForRegion(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -18,12 +18,12 @@
|
||||||
*/
|
*/
|
||||||
package org.jclouds.cloudwatch.internal;
|
package org.jclouds.cloudwatch.internal;
|
||||||
|
|
||||||
import org.jclouds.cloudwatch.CloudWatchClient;
|
import org.jclouds.cloudwatch.CloudWatchApi;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
public class BaseCloudWatchClientExpectTest extends BaseCloudWatchExpectTest<CloudWatchClient> {
|
public class BaseCloudWatchApiExpectTest extends BaseCloudWatchExpectTest<CloudWatchApi> {
|
||||||
|
|
||||||
}
|
}
|
|
@ -20,8 +20,8 @@ package org.jclouds.cloudwatch.internal;
|
||||||
|
|
||||||
import org.jclouds.apis.BaseContextLiveTest;
|
import org.jclouds.apis.BaseContextLiveTest;
|
||||||
import org.jclouds.cloudwatch.CloudWatchApiMetadata;
|
import org.jclouds.cloudwatch.CloudWatchApiMetadata;
|
||||||
import org.jclouds.cloudwatch.CloudWatchAsyncClient;
|
import org.jclouds.cloudwatch.CloudWatchAsyncApi;
|
||||||
import org.jclouds.cloudwatch.CloudWatchClient;
|
import org.jclouds.cloudwatch.CloudWatchApi;
|
||||||
import org.jclouds.rest.RestContext;
|
import org.jclouds.rest.RestContext;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
@ -32,14 +32,14 @@ import com.google.common.reflect.TypeToken;
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
@Test(groups = "live")
|
@Test(groups = "live")
|
||||||
public class BaseCloudWatchClientLiveTest extends BaseContextLiveTest<RestContext<CloudWatchClient, CloudWatchAsyncClient>> {
|
public class BaseCloudWatchApiLiveTest extends BaseContextLiveTest<RestContext<CloudWatchApi, CloudWatchAsyncApi>> {
|
||||||
|
|
||||||
public BaseCloudWatchClientLiveTest() {
|
public BaseCloudWatchApiLiveTest() {
|
||||||
provider = "cloudwatch";
|
provider = "cloudwatch";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected TypeToken<RestContext<CloudWatchClient, CloudWatchAsyncClient>> contextType() {
|
protected TypeToken<RestContext<CloudWatchApi, CloudWatchAsyncApi>> contextType() {
|
||||||
return CloudWatchApiMetadata.CONTEXT_TOKEN;
|
return CloudWatchApiMetadata.CONTEXT_TOKEN;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ package org.jclouds.cloudwatch.internal;
|
||||||
|
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
import org.jclouds.cloudwatch.CloudWatchAsyncClient;
|
import org.jclouds.cloudwatch.CloudWatchAsyncApi;
|
||||||
import org.jclouds.http.HttpRequest;
|
import org.jclouds.http.HttpRequest;
|
||||||
import org.jclouds.http.HttpResponse;
|
import org.jclouds.http.HttpResponse;
|
||||||
|
|
||||||
|
@ -31,8 +31,8 @@ import com.google.inject.Module;
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
public class BaseCloudWatchAsyncClientExpectTest extends BaseCloudWatchExpectTest<CloudWatchAsyncClient> {
|
public class BaseCloudWatchAsyncApiExpectTest extends BaseCloudWatchExpectTest<CloudWatchAsyncApi> {
|
||||||
public CloudWatchAsyncClient createClient(Function<HttpRequest, HttpResponse> fn, Module module, Properties props) {
|
public CloudWatchAsyncApi createClient(Function<HttpRequest, HttpResponse> fn, Module module, Properties props) {
|
||||||
return createInjector(fn, module, props).getInstance(CloudWatchAsyncClient.class);
|
return createInjector(fn, module, props).getInstance(CloudWatchAsyncApi.class);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -29,7 +29,7 @@ import org.jclouds.date.DateService;
|
||||||
import org.jclouds.location.config.LocationModule;
|
import org.jclouds.location.config.LocationModule;
|
||||||
import org.jclouds.location.suppliers.RegionIdToURISupplier;
|
import org.jclouds.location.suppliers.RegionIdToURISupplier;
|
||||||
import org.jclouds.rest.ConfiguresRestClient;
|
import org.jclouds.rest.ConfiguresRestClient;
|
||||||
import org.jclouds.rest.internal.BaseRestClientExpectTest;
|
import org.jclouds.rest.internal.BaseRestApiExpectTest;
|
||||||
import org.jclouds.util.Suppliers2;
|
import org.jclouds.util.Suppliers2;
|
||||||
|
|
||||||
import com.google.common.base.Supplier;
|
import com.google.common.base.Supplier;
|
||||||
|
@ -40,7 +40,7 @@ import com.google.inject.Module;
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
public class BaseCloudWatchExpectTest<T> extends BaseRestClientExpectTest<T> {
|
public class BaseCloudWatchExpectTest<T> extends BaseRestApiExpectTest<T> {
|
||||||
|
|
||||||
public BaseCloudWatchExpectTest() {
|
public BaseCloudWatchExpectTest() {
|
||||||
provider = "cloudwatch";
|
provider = "cloudwatch";
|
||||||
|
|
|
@ -30,13 +30,13 @@ import org.jclouds.openstack.keystone.v2_0.domain.PasswordCredentials;
|
||||||
* Provides synchronous access to the KeyStone Service API.
|
* Provides synchronous access to the KeyStone Service API.
|
||||||
* <p/>
|
* <p/>
|
||||||
*
|
*
|
||||||
* @see AuthenticationAsyncClient
|
* @see AuthenticationAsyncApi
|
||||||
* @see <a href="http://docs.openstack.org/api/openstack-identity-service/2.0/content/Service_API_Client_Operations.html"
|
* @see <a href="http://docs.openstack.org/api/openstack-identity-service/2.0/content/Service_API_Api_Operations.html"
|
||||||
* />
|
* />
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
@Timeout(duration = 30, timeUnit = TimeUnit.SECONDS)
|
@Timeout(duration = 30, timeUnit = TimeUnit.SECONDS)
|
||||||
public interface AuthenticationClient {
|
public interface AuthenticationApi {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Authenticate to generate a token.
|
* Authenticate to generate a token.
|
|
@ -38,16 +38,16 @@ import com.google.common.util.concurrent.ListenableFuture;
|
||||||
* Provides asynchronous access to Service via their REST API.
|
* Provides asynchronous access to Service via their REST API.
|
||||||
* <p/>
|
* <p/>
|
||||||
*
|
*
|
||||||
* @see AuthenticationClient
|
* @see AuthenticationApi
|
||||||
* @see <a href="http://docs.openstack.org/api/openstack-identity-service/2.0/content/Service_API_Client_Operations.html"
|
* @see <a href="http://docs.openstack.org/api/openstack-identity-service/2.0/content/Service_API_Api_Operations.html"
|
||||||
* />
|
* />
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
@Path("/v2.0")
|
@Path("/v2.0")
|
||||||
public interface AuthenticationAsyncClient {
|
public interface AuthenticationAsyncApi {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see AuthenticationClient#authenticateWithTenantNameAndCredentials(String,PasswordCredentials)
|
* @see AuthenticationApi#authenticateWithTenantNameAndCredentials(String,PasswordCredentials)
|
||||||
*/
|
*/
|
||||||
@POST
|
@POST
|
||||||
@SelectJson("access")
|
@SelectJson("access")
|
||||||
|
@ -58,7 +58,7 @@ public interface AuthenticationAsyncClient {
|
||||||
PasswordCredentials passwordCredentials);
|
PasswordCredentials passwordCredentials);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see AuthenticationClient#authenticateWithTenantIdAndCredentials(String,PasswordCredentials)
|
* @see AuthenticationApi#authenticateWithTenantIdAndCredentials(String,PasswordCredentials)
|
||||||
*/
|
*/
|
||||||
@POST
|
@POST
|
||||||
@SelectJson("access")
|
@SelectJson("access")
|
||||||
|
@ -69,7 +69,7 @@ public interface AuthenticationAsyncClient {
|
||||||
PasswordCredentials passwordCredentials);
|
PasswordCredentials passwordCredentials);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see AuthenticationClient#authenticateWithTenantNameAndCredentials(String,ApiAccessKeyCredentials)
|
* @see AuthenticationApi#authenticateWithTenantNameAndCredentials(String,ApiAccessKeyCredentials)
|
||||||
*/
|
*/
|
||||||
@POST
|
@POST
|
||||||
@SelectJson("access")
|
@SelectJson("access")
|
||||||
|
@ -82,7 +82,7 @@ public interface AuthenticationAsyncClient {
|
||||||
ApiAccessKeyCredentials apiAccessKeyCredentials);
|
ApiAccessKeyCredentials apiAccessKeyCredentials);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see AuthenticationClient#authenticateWithTenantIdAndCredentials(String,ApiAccessKeyCredentials)
|
* @see AuthenticationApi#authenticateWithTenantIdAndCredentials(String,ApiAccessKeyCredentials)
|
||||||
*/
|
*/
|
||||||
@POST
|
@POST
|
||||||
@SelectJson("access")
|
@SelectJson("access")
|
|
@ -22,10 +22,10 @@ import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import org.jclouds.concurrent.Timeout;
|
import org.jclouds.concurrent.Timeout;
|
||||||
import org.jclouds.openstack.keystone.v2_0.domain.ApiMetadata;
|
import org.jclouds.openstack.keystone.v2_0.domain.ApiMetadata;
|
||||||
import org.jclouds.openstack.keystone.v2_0.features.ServiceClient;
|
import org.jclouds.openstack.keystone.v2_0.features.ServiceApi;
|
||||||
import org.jclouds.openstack.keystone.v2_0.features.TenantClient;
|
import org.jclouds.openstack.keystone.v2_0.features.TenantApi;
|
||||||
import org.jclouds.openstack.keystone.v2_0.features.TokenClient;
|
import org.jclouds.openstack.keystone.v2_0.features.TokenApi;
|
||||||
import org.jclouds.openstack.keystone.v2_0.features.UserClient;
|
import org.jclouds.openstack.keystone.v2_0.features.UserApi;
|
||||||
import org.jclouds.rest.annotations.Delegate;
|
import org.jclouds.rest.annotations.Delegate;
|
||||||
|
|
||||||
import com.google.common.base.Optional;
|
import com.google.common.base.Optional;
|
||||||
|
@ -36,10 +36,10 @@ import com.google.common.base.Optional;
|
||||||
*
|
*
|
||||||
* @author Adam Lowe
|
* @author Adam Lowe
|
||||||
* @see <a href="http://keystone.openstack.org/" />
|
* @see <a href="http://keystone.openstack.org/" />
|
||||||
* @see KeystoneAsyncClient
|
* @see KeystoneAsyncApi
|
||||||
*/
|
*/
|
||||||
@Timeout(duration = 10, timeUnit = TimeUnit.SECONDS)
|
@Timeout(duration = 10, timeUnit = TimeUnit.SECONDS)
|
||||||
public interface KeystoneClient {
|
public interface KeystoneApi {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Discover API version information, links to documentation (PDF, HTML, WADL), and supported media types
|
* Discover API version information, links to documentation (PDF, HTML, WADL), and supported media types
|
||||||
|
@ -52,24 +52,24 @@ public interface KeystoneClient {
|
||||||
* Provides synchronous access to Token features
|
* Provides synchronous access to Token features
|
||||||
*/
|
*/
|
||||||
@Delegate
|
@Delegate
|
||||||
ServiceClient getServiceClient();
|
ServiceApi getServiceApi();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides synchronous access to Token features
|
* Provides synchronous access to Token features
|
||||||
*/
|
*/
|
||||||
@Delegate
|
@Delegate
|
||||||
Optional<TokenClient> getTokenClient();
|
Optional<TokenApi> getTokenApi();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides synchronous access to User features
|
* Provides synchronous access to User features
|
||||||
*/
|
*/
|
||||||
@Delegate
|
@Delegate
|
||||||
Optional<UserClient> getUserClient();
|
Optional<UserApi> getUserApi();
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides synchronous access to Tenant features
|
* Provides synchronous access to Tenant features
|
||||||
*/
|
*/
|
||||||
@Delegate
|
@Delegate
|
||||||
Optional<TenantClient> getTenantClient();
|
Optional<TenantApi> getTenantApi();
|
||||||
}
|
}
|
|
@ -50,7 +50,7 @@ public class KeystoneApiMetadata extends BaseRestApiMetadata {
|
||||||
private static final long serialVersionUID = 6725672099385580694L;
|
private static final long serialVersionUID = 6725672099385580694L;
|
||||||
|
|
||||||
|
|
||||||
public static final TypeToken<RestContext<? extends KeystoneClient,? extends KeystoneAsyncClient>> CONTEXT_TOKEN = new TypeToken<RestContext<? extends KeystoneClient,? extends KeystoneAsyncClient>>() {
|
public static final TypeToken<RestContext<? extends KeystoneApi,? extends KeystoneAsyncApi>> CONTEXT_TOKEN = new TypeToken<RestContext<? extends KeystoneApi,? extends KeystoneAsyncApi>>() {
|
||||||
private static final long serialVersionUID = -5070937833892503232L;
|
private static final long serialVersionUID = -5070937833892503232L;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ public class KeystoneApiMetadata extends BaseRestApiMetadata {
|
||||||
}
|
}
|
||||||
|
|
||||||
public KeystoneApiMetadata() {
|
public KeystoneApiMetadata() {
|
||||||
this(new Builder(KeystoneClient.class, KeystoneAsyncClient.class));
|
this(new Builder(KeystoneApi.class, KeystoneAsyncApi.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected KeystoneApiMetadata(Builder builder) {
|
protected KeystoneApiMetadata(Builder builder) {
|
||||||
|
|
|
@ -25,10 +25,10 @@ import javax.ws.rs.core.MediaType;
|
||||||
|
|
||||||
import org.jclouds.Constants;
|
import org.jclouds.Constants;
|
||||||
import org.jclouds.openstack.keystone.v2_0.domain.ApiMetadata;
|
import org.jclouds.openstack.keystone.v2_0.domain.ApiMetadata;
|
||||||
import org.jclouds.openstack.keystone.v2_0.features.ServiceAsyncClient;
|
import org.jclouds.openstack.keystone.v2_0.features.ServiceAsyncApi;
|
||||||
import org.jclouds.openstack.keystone.v2_0.features.TenantAsyncClient;
|
import org.jclouds.openstack.keystone.v2_0.features.TenantAsyncApi;
|
||||||
import org.jclouds.openstack.keystone.v2_0.features.TokenAsyncClient;
|
import org.jclouds.openstack.keystone.v2_0.features.TokenAsyncApi;
|
||||||
import org.jclouds.openstack.keystone.v2_0.features.UserAsyncClient;
|
import org.jclouds.openstack.keystone.v2_0.features.UserAsyncApi;
|
||||||
import org.jclouds.rest.annotations.Delegate;
|
import org.jclouds.rest.annotations.Delegate;
|
||||||
import org.jclouds.rest.annotations.ExceptionParser;
|
import org.jclouds.rest.annotations.ExceptionParser;
|
||||||
import org.jclouds.rest.annotations.SelectJson;
|
import org.jclouds.rest.annotations.SelectJson;
|
||||||
|
@ -43,12 +43,12 @@ import com.google.common.util.concurrent.ListenableFuture;
|
||||||
*
|
*
|
||||||
* @author Adam Lowe
|
* @author Adam Lowe
|
||||||
* @see <a href="http://keystone.openstack.org/" />
|
* @see <a href="http://keystone.openstack.org/" />
|
||||||
* @see KeystoneClient
|
* @see KeystoneApi
|
||||||
*/
|
*/
|
||||||
public interface KeystoneAsyncClient {
|
public interface KeystoneAsyncApi {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see KeystoneClient#getApiMetadata()
|
* @see KeystoneApi#getApiMetadata()
|
||||||
*/
|
*/
|
||||||
@GET
|
@GET
|
||||||
@SelectJson("version")
|
@SelectJson("version")
|
||||||
|
@ -58,27 +58,27 @@ public interface KeystoneAsyncClient {
|
||||||
ListenableFuture<ApiMetadata> getApiMetadata();
|
ListenableFuture<ApiMetadata> getApiMetadata();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see KeystoneClient#getServiceClient()
|
* @see KeystoneApi#getServiceApi()
|
||||||
*/
|
*/
|
||||||
@Delegate
|
@Delegate
|
||||||
ServiceAsyncClient getServiceClient();
|
ServiceAsyncApi getServiceApi();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see KeystoneClient#getTokenClient()
|
* @see KeystoneApi#getTokenApi()
|
||||||
*/
|
*/
|
||||||
@Delegate
|
@Delegate
|
||||||
Optional<TokenAsyncClient> getTokenClient();
|
Optional<TokenAsyncApi> getTokenApi();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see KeystoneClient#getUserClient()
|
* @see KeystoneApi#getUserApi()
|
||||||
*/
|
*/
|
||||||
@Delegate
|
@Delegate
|
||||||
Optional<UserAsyncClient> getUserClient();
|
Optional<UserAsyncApi> getUserApi();
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see KeystoneClient#getTenantClient()
|
* @see KeystoneApi#getTenantApi()
|
||||||
*/
|
*/
|
||||||
@Delegate
|
@Delegate
|
||||||
Optional<TenantAsyncClient> getTenantClient();
|
Optional<TenantAsyncApi> getTenantApi();
|
||||||
}
|
}
|
|
@ -47,8 +47,8 @@ import org.jclouds.location.suppliers.derived.RegionIdsFromRegionIdToURIKeySet;
|
||||||
import org.jclouds.location.suppliers.derived.ZoneIdsFromZoneIdToURIKeySet;
|
import org.jclouds.location.suppliers.derived.ZoneIdsFromZoneIdToURIKeySet;
|
||||||
import org.jclouds.location.suppliers.implicit.FirstRegion;
|
import org.jclouds.location.suppliers.implicit.FirstRegion;
|
||||||
import org.jclouds.location.suppliers.implicit.FirstZone;
|
import org.jclouds.location.suppliers.implicit.FirstZone;
|
||||||
import org.jclouds.openstack.keystone.v2_0.AuthenticationAsyncClient;
|
import org.jclouds.openstack.keystone.v2_0.AuthenticationAsyncApi;
|
||||||
import org.jclouds.openstack.keystone.v2_0.AuthenticationClient;
|
import org.jclouds.openstack.keystone.v2_0.AuthenticationApi;
|
||||||
import org.jclouds.openstack.keystone.v2_0.domain.Access;
|
import org.jclouds.openstack.keystone.v2_0.domain.Access;
|
||||||
import org.jclouds.openstack.keystone.v2_0.functions.AuthenticateApiAccessKeyCredentials;
|
import org.jclouds.openstack.keystone.v2_0.functions.AuthenticateApiAccessKeyCredentials;
|
||||||
import org.jclouds.openstack.keystone.v2_0.functions.AuthenticatePasswordCredentials;
|
import org.jclouds.openstack.keystone.v2_0.functions.AuthenticatePasswordCredentials;
|
||||||
|
@ -140,13 +140,13 @@ public class KeystoneAuthenticationModule extends AbstractModule {
|
||||||
@Override
|
@Override
|
||||||
protected void configure() {
|
protected void configure() {
|
||||||
bind(HttpRetryHandler.class).annotatedWith(ClientError.class).to(RetryOnRenew.class);
|
bind(HttpRetryHandler.class).annotatedWith(ClientError.class).to(RetryOnRenew.class);
|
||||||
bindAuthenticationClient();
|
bindAuthenticationApi();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void bindAuthenticationClient() {
|
protected void bindAuthenticationApi() {
|
||||||
// AuthenticationClient is used directly for filters and retry handlers, so let's bind it
|
// AuthenticationApi is used directly for filters and retry handlers, so let's bind it
|
||||||
// explicitly
|
// explicitly
|
||||||
bindClientAndAsyncClient(binder(), AuthenticationClient.class, AuthenticationAsyncClient.class);
|
bindClientAndAsyncClient(binder(), AuthenticationApi.class, AuthenticationAsyncApi.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -37,7 +37,7 @@ public interface KeystoneProperties {
|
||||||
* </ul>
|
* </ul>
|
||||||
*
|
*
|
||||||
* @see CredentialTypes
|
* @see CredentialTypes
|
||||||
* @see <a href="http://docs.openstack.org/api/openstack-identity-service/2.0/content/POST_authenticate_v2.0_tokens_Service_API_Client_Operations.html"
|
* @see <a href="http://docs.openstack.org/api/openstack-identity-service/2.0/content/POST_authenticate_v2.0_tokens_Service_API_Api_Operations.html"
|
||||||
* />
|
* />
|
||||||
*/
|
*/
|
||||||
public static final String CREDENTIAL_TYPE = "jclouds.keystone.credential-type";
|
public static final String CREDENTIAL_TYPE = "jclouds.keystone.credential-type";
|
||||||
|
|
|
@ -30,16 +30,16 @@ import org.jclouds.http.HttpErrorHandler;
|
||||||
import org.jclouds.http.annotation.ClientError;
|
import org.jclouds.http.annotation.ClientError;
|
||||||
import org.jclouds.http.annotation.Redirection;
|
import org.jclouds.http.annotation.Redirection;
|
||||||
import org.jclouds.http.annotation.ServerError;
|
import org.jclouds.http.annotation.ServerError;
|
||||||
import org.jclouds.openstack.keystone.v2_0.KeystoneAsyncClient;
|
import org.jclouds.openstack.keystone.v2_0.KeystoneAsyncApi;
|
||||||
import org.jclouds.openstack.keystone.v2_0.KeystoneClient;
|
import org.jclouds.openstack.keystone.v2_0.KeystoneApi;
|
||||||
import org.jclouds.openstack.keystone.v2_0.features.ServiceAsyncClient;
|
import org.jclouds.openstack.keystone.v2_0.features.ServiceAsyncApi;
|
||||||
import org.jclouds.openstack.keystone.v2_0.features.ServiceClient;
|
import org.jclouds.openstack.keystone.v2_0.features.ServiceApi;
|
||||||
import org.jclouds.openstack.keystone.v2_0.features.TenantAsyncClient;
|
import org.jclouds.openstack.keystone.v2_0.features.TenantAsyncApi;
|
||||||
import org.jclouds.openstack.keystone.v2_0.features.TenantClient;
|
import org.jclouds.openstack.keystone.v2_0.features.TenantApi;
|
||||||
import org.jclouds.openstack.keystone.v2_0.features.TokenAsyncClient;
|
import org.jclouds.openstack.keystone.v2_0.features.TokenAsyncApi;
|
||||||
import org.jclouds.openstack.keystone.v2_0.features.TokenClient;
|
import org.jclouds.openstack.keystone.v2_0.features.TokenApi;
|
||||||
import org.jclouds.openstack.keystone.v2_0.features.UserAsyncClient;
|
import org.jclouds.openstack.keystone.v2_0.features.UserAsyncApi;
|
||||||
import org.jclouds.openstack.keystone.v2_0.features.UserClient;
|
import org.jclouds.openstack.keystone.v2_0.features.UserApi;
|
||||||
import org.jclouds.openstack.keystone.v2_0.functions.PresentWhenAdminURLExistsForIdentityService;
|
import org.jclouds.openstack.keystone.v2_0.functions.PresentWhenAdminURLExistsForIdentityService;
|
||||||
import org.jclouds.openstack.keystone.v2_0.handlers.KeystoneErrorHandler;
|
import org.jclouds.openstack.keystone.v2_0.handlers.KeystoneErrorHandler;
|
||||||
import org.jclouds.openstack.keystone.v2_0.suppliers.RegionIdToAdminURIFromAccessForTypeAndVersion;
|
import org.jclouds.openstack.keystone.v2_0.suppliers.RegionIdToAdminURIFromAccessForTypeAndVersion;
|
||||||
|
@ -63,22 +63,22 @@ import com.google.inject.assistedinject.FactoryModuleBuilder;
|
||||||
* @author Adam Lowe
|
* @author Adam Lowe
|
||||||
*/
|
*/
|
||||||
@ConfiguresRestClient
|
@ConfiguresRestClient
|
||||||
public class KeystoneRestClientModule<S extends KeystoneClient, A extends KeystoneAsyncClient> extends
|
public class KeystoneRestClientModule<S extends KeystoneApi, A extends KeystoneAsyncApi> extends
|
||||||
RestClientModule<S, A> {
|
RestClientModule<S, A> {
|
||||||
|
|
||||||
public static final Map<Class<?>, Class<?>> DELEGATE_MAP = ImmutableMap.<Class<?>, Class<?>> builder()
|
public static final Map<Class<?>, Class<?>> DELEGATE_MAP = ImmutableMap.<Class<?>, Class<?>> builder()
|
||||||
.put(ServiceClient.class, ServiceAsyncClient.class).put(TokenClient.class, TokenAsyncClient.class)
|
.put(ServiceApi.class, ServiceAsyncApi.class).put(TokenApi.class, TokenAsyncApi.class)
|
||||||
.put(UserClient.class, UserAsyncClient.class).put(TenantClient.class, TenantAsyncClient.class).build();
|
.put(UserApi.class, UserAsyncApi.class).put(TenantApi.class, TenantAsyncApi.class).build();
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public KeystoneRestClientModule() {
|
public KeystoneRestClientModule() {
|
||||||
super(TypeToken.class.cast(TypeToken.of(KeystoneClient.class)), TypeToken.class.cast(TypeToken
|
super(TypeToken.class.cast(TypeToken.of(KeystoneApi.class)), TypeToken.class.cast(TypeToken
|
||||||
.of(KeystoneAsyncClient.class)), DELEGATE_MAP);
|
.of(KeystoneAsyncApi.class)), DELEGATE_MAP);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected KeystoneRestClientModule(TypeToken<S> syncClientType, TypeToken<A> asyncClientType,
|
protected KeystoneRestClientModule(TypeToken<S> syncApiType, TypeToken<A> asyncApiType,
|
||||||
Map<Class<?>, Class<?>> sync2Async) {
|
Map<Class<?>, Class<?>> sync2Async) {
|
||||||
super(syncClientType, asyncClientType, sync2Async);
|
super(syncApiType, asyncApiType, sync2Async);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class KeystoneAdminURLModule extends AbstractModule {
|
public static class KeystoneAdminURLModule extends AbstractModule {
|
||||||
|
|
|
@ -31,7 +31,7 @@ import com.google.common.collect.ImmutableSet;
|
||||||
* TODO
|
* TODO
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
* @see <a href="http://docs.openstack.org/api/openstack-identity-service/2.0/content/Service_API_Client_Operations.html"
|
* @see <a href="http://docs.openstack.org/api/openstack-identity-service/2.0/content/Service_API_Api_Operations.html"
|
||||||
/>
|
/>
|
||||||
*/
|
*/
|
||||||
public class Access implements Comparable<Access> {
|
public class Access implements Comparable<Access> {
|
||||||
|
|
|
@ -31,7 +31,7 @@ import com.google.common.base.Objects.ToStringHelper;
|
||||||
/**
|
/**
|
||||||
* Api AccessKey Credentials
|
* Api AccessKey Credentials
|
||||||
*
|
*
|
||||||
* @see <a href="http://docs.openstack.org/api/openstack-identity-service/2.0/content/POST_authenticate_v2.0_tokens_Service_API_Client_Operations.html#d662e583"
|
* @see <a href="http://docs.openstack.org/api/openstack-identity-service/2.0/content/POST_authenticate_v2.0_tokens_Service_API_Api_Operations.html#d662e583"
|
||||||
/>
|
/>
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -30,7 +30,7 @@ import com.google.common.base.Objects.ToStringHelper;
|
||||||
/**
|
/**
|
||||||
* Password Credentials
|
* Password Credentials
|
||||||
*
|
*
|
||||||
* @see <a href="http://docs.openstack.org/api/openstack-identity-service/2.0/content/POST_authenticate_v2.0_tokens_Service_API_Client_Operations.html#d662e583"
|
* @see <a href="http://docs.openstack.org/api/openstack-identity-service/2.0/content/POST_authenticate_v2.0_tokens_Service_API_Api_Operations.html#d662e583"
|
||||||
/>
|
/>
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -29,13 +29,13 @@ import org.jclouds.openstack.keystone.v2_0.domain.Tenant;
|
||||||
* <p/>
|
* <p/>
|
||||||
*
|
*
|
||||||
* @author Adam Lowe
|
* @author Adam Lowe
|
||||||
* @see ServiceAsyncClient
|
* @see ServiceAsyncApi
|
||||||
* @see <a href=
|
* @see <a href=
|
||||||
* "http://docs.openstack.org/api/openstack-identity-service/2.0/content/Service_API_Client_Operations.html"
|
* "http://docs.openstack.org/api/openstack-identity-service/2.0/content/Service_API_Api_Operations.html"
|
||||||
* />
|
* />
|
||||||
*/
|
*/
|
||||||
@Timeout(duration = 30, timeUnit = TimeUnit.SECONDS)
|
@Timeout(duration = 30, timeUnit = TimeUnit.SECONDS)
|
||||||
public interface ServiceClient {
|
public interface ServiceApi {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The operation returns a list of tenants which the current token provides access to.
|
* The operation returns a list of tenants which the current token provides access to.
|
|
@ -40,18 +40,18 @@ import com.google.common.util.concurrent.ListenableFuture;
|
||||||
* Provides asynchronous access to Service via their REST API.
|
* Provides asynchronous access to Service via their REST API.
|
||||||
* <p/>
|
* <p/>
|
||||||
*
|
*
|
||||||
* @see ServiceClient
|
* @see ServiceApi
|
||||||
* @see <a href=
|
* @see <a href=
|
||||||
* "http://docs.openstack.org/api/openstack-identity-service/2.0/content/Service_API_Client_Operations.html"
|
* "http://docs.openstack.org/api/openstack-identity-service/2.0/content/Service_API_Api_Operations.html"
|
||||||
* />
|
* />
|
||||||
* @author Adam Lowe
|
* @author Adam Lowe
|
||||||
*/
|
*/
|
||||||
@Path("/v{" + Constants.PROPERTY_API_VERSION + "}")
|
@Path("/v{" + Constants.PROPERTY_API_VERSION + "}")
|
||||||
@SkipEncoding( { '/', '=' })
|
@SkipEncoding( { '/', '=' })
|
||||||
public interface ServiceAsyncClient {
|
public interface ServiceAsyncApi {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see ServiceClient#listTenants()
|
* @see ServiceApi#listTenants()
|
||||||
*/
|
*/
|
||||||
@GET
|
@GET
|
||||||
@SelectJson("tenants")
|
@SelectJson("tenants")
|
|
@ -29,13 +29,13 @@ import org.jclouds.openstack.keystone.v2_0.domain.Tenant;
|
||||||
* <p/>
|
* <p/>
|
||||||
*
|
*
|
||||||
* @author Adam Lowe
|
* @author Adam Lowe
|
||||||
* @see TenantAsyncClient
|
* @see TenantAsyncApi
|
||||||
* @see <a href=
|
* @see <a href=
|
||||||
* "http://docs.openstack.org/api/openstack-identity-service/2.0/content/Tenant_Operations.html"
|
* "http://docs.openstack.org/api/openstack-identity-service/2.0/content/Tenant_Operations.html"
|
||||||
* />
|
* />
|
||||||
*/
|
*/
|
||||||
@Timeout(duration = 30, timeUnit = TimeUnit.SECONDS)
|
@Timeout(duration = 30, timeUnit = TimeUnit.SECONDS)
|
||||||
public interface TenantClient {
|
public interface TenantApi {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The operation returns a list of tenants which the current token provides access to.
|
* The operation returns a list of tenants which the current token provides access to.
|
|
@ -43,7 +43,7 @@ import com.google.common.util.concurrent.ListenableFuture;
|
||||||
* Provides asynchronous access to Tenant via their REST API.
|
* Provides asynchronous access to Tenant via their REST API.
|
||||||
* <p/>
|
* <p/>
|
||||||
*
|
*
|
||||||
* @see TenantClient
|
* @see TenantApi
|
||||||
* @see <a href=
|
* @see <a href=
|
||||||
* "http://docs.openstack.org/api/openstack-identity-service/2.0/content/Tenant_Operations.html"
|
* "http://docs.openstack.org/api/openstack-identity-service/2.0/content/Tenant_Operations.html"
|
||||||
* />
|
* />
|
||||||
|
@ -51,10 +51,10 @@ import com.google.common.util.concurrent.ListenableFuture;
|
||||||
*/
|
*/
|
||||||
@org.jclouds.rest.annotations.Endpoint(Identity.class)
|
@org.jclouds.rest.annotations.Endpoint(Identity.class)
|
||||||
@SkipEncoding( { '/', '=' })
|
@SkipEncoding( { '/', '=' })
|
||||||
public interface TenantAsyncClient {
|
public interface TenantAsyncApi {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see TenantClient#list()
|
* @see TenantApi#list()
|
||||||
*/
|
*/
|
||||||
@GET
|
@GET
|
||||||
@SelectJson("tenants")
|
@SelectJson("tenants")
|
||||||
|
@ -64,7 +64,7 @@ public interface TenantAsyncClient {
|
||||||
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
|
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
|
||||||
ListenableFuture<Set<Tenant>> list();
|
ListenableFuture<Set<Tenant>> list();
|
||||||
|
|
||||||
/** @see TenantClient#get(String) */
|
/** @see TenantApi#get(String) */
|
||||||
@GET
|
@GET
|
||||||
@SelectJson("tenant")
|
@SelectJson("tenant")
|
||||||
@Consumes(MediaType.APPLICATION_JSON)
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
|
@ -73,7 +73,7 @@ public interface TenantAsyncClient {
|
||||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||||
ListenableFuture<Tenant> get(@PathParam("tenantId") String tenantId);
|
ListenableFuture<Tenant> get(@PathParam("tenantId") String tenantId);
|
||||||
|
|
||||||
/** @see TenantClient#getByName(String) */
|
/** @see TenantApi#getByName(String) */
|
||||||
@GET
|
@GET
|
||||||
@SelectJson("tenant")
|
@SelectJson("tenant")
|
||||||
@Consumes(MediaType.APPLICATION_JSON)
|
@Consumes(MediaType.APPLICATION_JSON)
|
|
@ -33,14 +33,14 @@ import com.google.common.annotations.Beta;
|
||||||
* <p/>
|
* <p/>
|
||||||
*
|
*
|
||||||
* @author Adam Lowe
|
* @author Adam Lowe
|
||||||
* @see TokenAsyncClient
|
* @see TokenAsyncApi
|
||||||
* @see <a href=
|
* @see <a href=
|
||||||
* "http://docs.openstack.org/api/openstack-identity-service/2.0/content/Token_Operations.html"
|
* "http://docs.openstack.org/api/openstack-identity-service/2.0/content/Token_Operations.html"
|
||||||
* />
|
* />
|
||||||
*/
|
*/
|
||||||
@Beta
|
@Beta
|
||||||
@Timeout(duration = 30, timeUnit = TimeUnit.SECONDS)
|
@Timeout(duration = 30, timeUnit = TimeUnit.SECONDS)
|
||||||
public interface TokenClient {
|
public interface TokenApi {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
|
@ -46,7 +46,7 @@ import com.google.common.util.concurrent.ListenableFuture;
|
||||||
* Provides asynchronous access to Token via their REST API.
|
* Provides asynchronous access to Token via their REST API.
|
||||||
* <p/>
|
* <p/>
|
||||||
*
|
*
|
||||||
* @see TokenClient
|
* @see TokenApi
|
||||||
* @see <a href=
|
* @see <a href=
|
||||||
* "http://docs.openstack.org/api/openstack-identity-service/2.0/content/Token_Operations.html"
|
* "http://docs.openstack.org/api/openstack-identity-service/2.0/content/Token_Operations.html"
|
||||||
* />
|
* />
|
||||||
|
@ -54,10 +54,10 @@ import com.google.common.util.concurrent.ListenableFuture;
|
||||||
*/
|
*/
|
||||||
@SkipEncoding({ '/', '=' })
|
@SkipEncoding({ '/', '=' })
|
||||||
@org.jclouds.rest.annotations.Endpoint(Identity.class)
|
@org.jclouds.rest.annotations.Endpoint(Identity.class)
|
||||||
public interface TokenAsyncClient {
|
public interface TokenAsyncApi {
|
||||||
|
|
||||||
|
|
||||||
/** @see TokenClient#get(String) */
|
/** @see TokenApi#get(String) */
|
||||||
@GET
|
@GET
|
||||||
@SelectJson("token")
|
@SelectJson("token")
|
||||||
@Consumes(MediaType.APPLICATION_JSON)
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
|
@ -66,7 +66,7 @@ public interface TokenAsyncClient {
|
||||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||||
ListenableFuture<Token> get(@PathParam("token") String token);
|
ListenableFuture<Token> get(@PathParam("token") String token);
|
||||||
|
|
||||||
/** @see TokenClient#getUserOfToken(String) */
|
/** @see TokenApi#getUserOfToken(String) */
|
||||||
@GET
|
@GET
|
||||||
@SelectJson("user")
|
@SelectJson("user")
|
||||||
@Consumes(MediaType.APPLICATION_JSON)
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
|
@ -75,14 +75,14 @@ public interface TokenAsyncClient {
|
||||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||||
ListenableFuture<User> getUserOfToken(@PathParam("token") String token);
|
ListenableFuture<User> getUserOfToken(@PathParam("token") String token);
|
||||||
|
|
||||||
/** @see TokenClient#isValid(String) */
|
/** @see TokenApi#isValid(String) */
|
||||||
@HEAD
|
@HEAD
|
||||||
@Path("/tokens/{token}")
|
@Path("/tokens/{token}")
|
||||||
@RequestFilters(AuthenticateRequest.class)
|
@RequestFilters(AuthenticateRequest.class)
|
||||||
@ExceptionParser(ReturnFalseOnNotFoundOr404.class)
|
@ExceptionParser(ReturnFalseOnNotFoundOr404.class)
|
||||||
ListenableFuture<Boolean> isValid(@PathParam("token") String token);
|
ListenableFuture<Boolean> isValid(@PathParam("token") String token);
|
||||||
|
|
||||||
/** @see TokenClient#listEndpointsForToken(String) */
|
/** @see TokenApi#listEndpointsForToken(String) */
|
||||||
@GET
|
@GET
|
||||||
@SelectJson("endpoints")
|
@SelectJson("endpoints")
|
||||||
@Consumes(MediaType.APPLICATION_JSON)
|
@Consumes(MediaType.APPLICATION_JSON)
|
|
@ -32,14 +32,14 @@ import com.google.common.annotations.Beta;
|
||||||
* <p/>
|
* <p/>
|
||||||
*
|
*
|
||||||
* @author Adam Lowe
|
* @author Adam Lowe
|
||||||
* @see UserAsyncClient
|
* @see UserAsyncApi
|
||||||
* @see <a href=
|
* @see <a href=
|
||||||
* "http://docs.openstack.org/api/openstack-identity-service/2.0/content/User_Operations.html"
|
* "http://docs.openstack.org/api/openstack-identity-service/2.0/content/User_Operations.html"
|
||||||
* />
|
* />
|
||||||
*/
|
*/
|
||||||
@Beta
|
@Beta
|
||||||
@Timeout(duration = 30, timeUnit = TimeUnit.SECONDS)
|
@Timeout(duration = 30, timeUnit = TimeUnit.SECONDS)
|
||||||
public interface UserClient {
|
public interface UserApi {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve the list of users
|
* Retrieve the list of users
|
|
@ -44,7 +44,7 @@ import com.google.common.util.concurrent.ListenableFuture;
|
||||||
* Provides asynchronous access to User via their REST API.
|
* Provides asynchronous access to User via their REST API.
|
||||||
* <p/>
|
* <p/>
|
||||||
*
|
*
|
||||||
* @see UserClient
|
* @see UserApi
|
||||||
* @see <a href=
|
* @see <a href=
|
||||||
* "http://docs.openstack.org/api/openstack-identity-service/2.0/content/User_Operations.html"
|
* "http://docs.openstack.org/api/openstack-identity-service/2.0/content/User_Operations.html"
|
||||||
* />
|
* />
|
||||||
|
@ -52,9 +52,9 @@ import com.google.common.util.concurrent.ListenableFuture;
|
||||||
*/
|
*/
|
||||||
@org.jclouds.rest.annotations.Endpoint(Identity.class)
|
@org.jclouds.rest.annotations.Endpoint(Identity.class)
|
||||||
@SkipEncoding({ '/', '=' })
|
@SkipEncoding({ '/', '=' })
|
||||||
public interface UserAsyncClient {
|
public interface UserAsyncApi {
|
||||||
|
|
||||||
/** @see UserClient#list() */
|
/** @see UserApi#list() */
|
||||||
@GET
|
@GET
|
||||||
@SelectJson("users")
|
@SelectJson("users")
|
||||||
@Consumes(MediaType.APPLICATION_JSON)
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
|
@ -63,7 +63,7 @@ public interface UserAsyncClient {
|
||||||
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
|
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
|
||||||
ListenableFuture<Set<User>> list();
|
ListenableFuture<Set<User>> list();
|
||||||
|
|
||||||
/** @see UserClient#get(String) */
|
/** @see UserApi#get(String) */
|
||||||
@GET
|
@GET
|
||||||
@SelectJson("user")
|
@SelectJson("user")
|
||||||
@Consumes(MediaType.APPLICATION_JSON)
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
|
@ -72,7 +72,7 @@ public interface UserAsyncClient {
|
||||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||||
ListenableFuture<User> get(@PathParam("userId") String userId);
|
ListenableFuture<User> get(@PathParam("userId") String userId);
|
||||||
|
|
||||||
/** @see UserClient#getByName(String) */
|
/** @see UserApi#getByName(String) */
|
||||||
@GET
|
@GET
|
||||||
@SelectJson("user")
|
@SelectJson("user")
|
||||||
@Consumes(MediaType.APPLICATION_JSON)
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
|
@ -81,7 +81,7 @@ public interface UserAsyncClient {
|
||||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||||
ListenableFuture<User> getByName(@QueryParam("name") String userName);
|
ListenableFuture<User> getByName(@QueryParam("name") String userName);
|
||||||
|
|
||||||
/** @see UserClient#listRolesOfUser(String) */
|
/** @see UserApi#listRolesOfUser(String) */
|
||||||
@GET
|
@GET
|
||||||
@SelectJson("roles")
|
@SelectJson("roles")
|
||||||
@Consumes(MediaType.APPLICATION_JSON)
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
|
@ -90,7 +90,7 @@ public interface UserAsyncClient {
|
||||||
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
|
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
|
||||||
ListenableFuture<Set<Role>> listRolesOfUser(@PathParam("userId") String userId);
|
ListenableFuture<Set<Role>> listRolesOfUser(@PathParam("userId") String userId);
|
||||||
|
|
||||||
/** @see UserClient#listRolesOfUserOnTenant(String, String) */
|
/** @see UserApi#listRolesOfUserOnTenant(String, String) */
|
||||||
@GET
|
@GET
|
||||||
@SelectJson("roles")
|
@SelectJson("roles")
|
||||||
@Consumes(MediaType.APPLICATION_JSON)
|
@Consumes(MediaType.APPLICATION_JSON)
|
|
@ -21,7 +21,7 @@ package org.jclouds.openstack.keystone.v2_0.functions;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import org.jclouds.openstack.keystone.v2_0.AuthenticationClient;
|
import org.jclouds.openstack.keystone.v2_0.AuthenticationApi;
|
||||||
import org.jclouds.openstack.keystone.v2_0.config.CredentialType;
|
import org.jclouds.openstack.keystone.v2_0.config.CredentialType;
|
||||||
import org.jclouds.openstack.keystone.v2_0.config.CredentialTypes;
|
import org.jclouds.openstack.keystone.v2_0.config.CredentialTypes;
|
||||||
import org.jclouds.openstack.keystone.v2_0.domain.Access;
|
import org.jclouds.openstack.keystone.v2_0.domain.Access;
|
||||||
|
@ -33,21 +33,21 @@ import com.google.common.base.Optional;
|
||||||
@CredentialType(CredentialTypes.API_ACCESS_KEY_CREDENTIALS)
|
@CredentialType(CredentialTypes.API_ACCESS_KEY_CREDENTIALS)
|
||||||
@Singleton
|
@Singleton
|
||||||
public class AuthenticateApiAccessKeyCredentials extends BaseAuthenticator<ApiAccessKeyCredentials> {
|
public class AuthenticateApiAccessKeyCredentials extends BaseAuthenticator<ApiAccessKeyCredentials> {
|
||||||
protected final AuthenticationClient client;
|
protected final AuthenticationApi api;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public AuthenticateApiAccessKeyCredentials(AuthenticationClient client) {
|
public AuthenticateApiAccessKeyCredentials(AuthenticationApi api) {
|
||||||
this.client = client;
|
this.api = api;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Access authenticateWithTenantName(Optional<String> tenantName, ApiAccessKeyCredentials apiAccessKeyCredentials) {
|
protected Access authenticateWithTenantName(Optional<String> tenantName, ApiAccessKeyCredentials apiAccessKeyCredentials) {
|
||||||
return client.authenticateWithTenantNameAndCredentials(tenantName.orNull(), apiAccessKeyCredentials);
|
return api.authenticateWithTenantNameAndCredentials(tenantName.orNull(), apiAccessKeyCredentials);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Access authenticateWithTenantId(Optional<String> tenantId, ApiAccessKeyCredentials apiAccessKeyCredentials) {
|
protected Access authenticateWithTenantId(Optional<String> tenantId, ApiAccessKeyCredentials apiAccessKeyCredentials) {
|
||||||
return client.authenticateWithTenantIdAndCredentials(tenantId.orNull(), apiAccessKeyCredentials);
|
return api.authenticateWithTenantIdAndCredentials(tenantId.orNull(), apiAccessKeyCredentials);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -21,7 +21,7 @@ package org.jclouds.openstack.keystone.v2_0.functions;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import org.jclouds.openstack.keystone.v2_0.AuthenticationClient;
|
import org.jclouds.openstack.keystone.v2_0.AuthenticationApi;
|
||||||
import org.jclouds.openstack.keystone.v2_0.config.CredentialType;
|
import org.jclouds.openstack.keystone.v2_0.config.CredentialType;
|
||||||
import org.jclouds.openstack.keystone.v2_0.config.CredentialTypes;
|
import org.jclouds.openstack.keystone.v2_0.config.CredentialTypes;
|
||||||
import org.jclouds.openstack.keystone.v2_0.domain.Access;
|
import org.jclouds.openstack.keystone.v2_0.domain.Access;
|
||||||
|
@ -33,21 +33,21 @@ import com.google.common.base.Optional;
|
||||||
@CredentialType(CredentialTypes.PASSWORD_CREDENTIALS)
|
@CredentialType(CredentialTypes.PASSWORD_CREDENTIALS)
|
||||||
@Singleton
|
@Singleton
|
||||||
public class AuthenticatePasswordCredentials extends BaseAuthenticator<PasswordCredentials> {
|
public class AuthenticatePasswordCredentials extends BaseAuthenticator<PasswordCredentials> {
|
||||||
protected final AuthenticationClient client;
|
protected final AuthenticationApi api;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public AuthenticatePasswordCredentials(AuthenticationClient client) {
|
public AuthenticatePasswordCredentials(AuthenticationApi api) {
|
||||||
this.client = client;
|
this.api = api;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Access authenticateWithTenantName(Optional<String> tenantName, PasswordCredentials apiAccessKeyCredentials) {
|
protected Access authenticateWithTenantName(Optional<String> tenantName, PasswordCredentials apiAccessKeyCredentials) {
|
||||||
return client.authenticateWithTenantNameAndCredentials(tenantName.orNull(), apiAccessKeyCredentials);
|
return api.authenticateWithTenantNameAndCredentials(tenantName.orNull(), apiAccessKeyCredentials);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Access authenticateWithTenantId(Optional<String> tenantId, PasswordCredentials apiAccessKeyCredentials) {
|
protected Access authenticateWithTenantId(Optional<String> tenantId, PasswordCredentials apiAccessKeyCredentials) {
|
||||||
return client.authenticateWithTenantIdAndCredentials(tenantId.orNull(), apiAccessKeyCredentials);
|
return api.authenticateWithTenantIdAndCredentials(tenantId.orNull(), apiAccessKeyCredentials);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -31,7 +31,7 @@ import com.google.common.base.Objects;
|
||||||
import com.google.common.base.Objects.ToStringHelper;
|
import com.google.common.base.Objects.ToStringHelper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For convenience, resources contain links to themselves. This allows a client to easily obtain a
|
* For convenience, resources contain links to themselves. This allows a api to easily obtain a
|
||||||
* resource URIs rather than to construct them.
|
* resource URIs rather than to construct them.
|
||||||
*
|
*
|
||||||
* @author AdrianCole
|
* @author AdrianCole
|
||||||
|
|
|
@ -25,7 +25,7 @@ import static org.testng.Assert.assertNull;
|
||||||
import org.jclouds.http.HttpRequest;
|
import org.jclouds.http.HttpRequest;
|
||||||
import org.jclouds.http.HttpResponse;
|
import org.jclouds.http.HttpResponse;
|
||||||
import org.jclouds.openstack.keystone.v2_0.domain.ApiMetadata;
|
import org.jclouds.openstack.keystone.v2_0.domain.ApiMetadata;
|
||||||
import org.jclouds.openstack.keystone.v2_0.internal.BaseKeystoneRestClientExpectTest;
|
import org.jclouds.openstack.keystone.v2_0.internal.BaseKeystoneRestApiExpectTest;
|
||||||
import org.jclouds.openstack.keystone.v2_0.parse.ParseRackspaceApiMetadataTest;
|
import org.jclouds.openstack.keystone.v2_0.parse.ParseRackspaceApiMetadataTest;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
@ -33,27 +33,27 @@ import org.testng.annotations.Test;
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
@Test(testName = "KeystoneClientExpectTest")
|
@Test(testName = "KeystoneApiExpectTest")
|
||||||
public class KeystoneClientExpectTest extends BaseKeystoneRestClientExpectTest<KeystoneClient> {
|
public class KeystoneApiExpectTest extends BaseKeystoneRestApiExpectTest<KeystoneApi> {
|
||||||
|
|
||||||
public void testGetApiMetaData() {
|
public void testGetApiMetaData() {
|
||||||
KeystoneClient client = requestsSendResponses(
|
KeystoneApi api = requestsSendResponses(
|
||||||
keystoneAuthWithUsernameAndPassword, responseWithKeystoneAccess,
|
keystoneAuthWithUsernameAndPassword, responseWithKeystoneAccess,
|
||||||
HttpRequest.builder().method("GET").endpoint(endpoint + "/v2.0/").
|
HttpRequest.builder().method("GET").endpoint(endpoint + "/v2.0/").
|
||||||
addHeader("Accept", APPLICATION_JSON).build(),
|
addHeader("Accept", APPLICATION_JSON).build(),
|
||||||
HttpResponse.builder().statusCode(200).
|
HttpResponse.builder().statusCode(200).
|
||||||
payload(payloadFromResourceWithContentType("/raxVersion.json", APPLICATION_JSON)).build());
|
payload(payloadFromResourceWithContentType("/raxVersion.json", APPLICATION_JSON)).build());
|
||||||
ApiMetadata metadata = client.getApiMetadata();
|
ApiMetadata metadata = api.getApiMetadata();
|
||||||
|
|
||||||
assertEquals(metadata, new ParseRackspaceApiMetadataTest().expected());
|
assertEquals(metadata, new ParseRackspaceApiMetadataTest().expected());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGetApiMetaDataFailNotFound() {
|
public void testGetApiMetaDataFailNotFound() {
|
||||||
KeystoneClient client = requestsSendResponses(
|
KeystoneApi api = requestsSendResponses(
|
||||||
keystoneAuthWithUsernameAndPassword, responseWithKeystoneAccess,
|
keystoneAuthWithUsernameAndPassword, responseWithKeystoneAccess,
|
||||||
HttpRequest.builder().method("GET").endpoint(endpoint + "/v2.0/").addHeader("Accept", APPLICATION_JSON).build(),
|
HttpRequest.builder().method("GET").endpoint(endpoint + "/v2.0/").addHeader("Accept", APPLICATION_JSON).build(),
|
||||||
HttpResponse.builder().statusCode(404).build());
|
HttpResponse.builder().statusCode(404).build());
|
||||||
assertNull(client.getApiMetadata());
|
assertNull(api.getApiMetadata());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -21,16 +21,16 @@ package org.jclouds.openstack.keystone.v2_0;
|
||||||
import static org.testng.Assert.assertNotNull;
|
import static org.testng.Assert.assertNotNull;
|
||||||
|
|
||||||
import org.jclouds.openstack.keystone.v2_0.domain.ApiMetadata;
|
import org.jclouds.openstack.keystone.v2_0.domain.ApiMetadata;
|
||||||
import org.jclouds.openstack.keystone.v2_0.internal.BaseKeystoneClientLiveTest;
|
import org.jclouds.openstack.keystone.v2_0.internal.BaseKeystoneApiLiveTest;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests KeystoneClient
|
* Tests KeystoneApi
|
||||||
*
|
*
|
||||||
* @author Adam Lowe
|
* @author Adam Lowe
|
||||||
*/
|
*/
|
||||||
@Test(groups = "live", testName = "KeystoneClientLiveTest")
|
@Test(groups = "live", testName = "KeystoneApiLiveTest")
|
||||||
public class KeystoneClientLiveTest extends BaseKeystoneClientLiveTest {
|
public class KeystoneApiLiveTest extends BaseKeystoneApiLiveTest {
|
||||||
|
|
||||||
public void testGetApiMetaData() {
|
public void testGetApiMetaData() {
|
||||||
ApiMetadata result = keystoneContext.getApi().getApiMetadata();
|
ApiMetadata result = keystoneContext.getApi().getApiMetadata();
|
|
@ -27,30 +27,30 @@ import static org.testng.Assert.assertTrue;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.jclouds.http.HttpResponse;
|
import org.jclouds.http.HttpResponse;
|
||||||
import org.jclouds.openstack.keystone.v2_0.KeystoneClient;
|
import org.jclouds.openstack.keystone.v2_0.KeystoneApi;
|
||||||
import org.jclouds.openstack.keystone.v2_0.domain.Tenant;
|
import org.jclouds.openstack.keystone.v2_0.domain.Tenant;
|
||||||
import org.jclouds.openstack.keystone.v2_0.internal.BaseKeystoneRestClientExpectTest;
|
import org.jclouds.openstack.keystone.v2_0.internal.BaseKeystoneRestApiExpectTest;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests parsing and Guice wiring of ServiceClient
|
* Tests parsing and Guice wiring of ServiceApi
|
||||||
*
|
*
|
||||||
* @author Adam Lowe
|
* @author Adam Lowe
|
||||||
*/
|
*/
|
||||||
@Test(testName = "ServiceClientExpectTest")
|
@Test(testName = "ServiceApiExpectTest")
|
||||||
public class ServiceClientExpectTest extends BaseKeystoneRestClientExpectTest<KeystoneClient> {
|
public class ServiceApiExpectTest extends BaseKeystoneRestApiExpectTest<KeystoneApi> {
|
||||||
|
|
||||||
public void testListTenants() {
|
public void testListTenants() {
|
||||||
ServiceClient client = requestsSendResponses(
|
ServiceApi api = requestsSendResponses(
|
||||||
keystoneAuthWithUsernameAndPassword,
|
keystoneAuthWithUsernameAndPassword,
|
||||||
responseWithKeystoneAccess,
|
responseWithKeystoneAccess,
|
||||||
authenticatedGET().endpoint(endpoint + "/v2.0/tenants").build(),
|
authenticatedGET().endpoint(endpoint + "/v2.0/tenants").build(),
|
||||||
HttpResponse.builder().statusCode(200)
|
HttpResponse.builder().statusCode(200)
|
||||||
.payload(payloadFromResourceWithContentType("/tenant_list.json", APPLICATION_JSON)).build())
|
.payload(payloadFromResourceWithContentType("/tenant_list.json", APPLICATION_JSON)).build())
|
||||||
.getServiceClient();
|
.getServiceApi();
|
||||||
Set<Tenant> tenants = client.listTenants();
|
Set<Tenant> tenants = api.listTenants();
|
||||||
assertNotNull(tenants);
|
assertNotNull(tenants);
|
||||||
assertFalse(tenants.isEmpty());
|
assertFalse(tenants.isEmpty());
|
||||||
|
|
||||||
|
@ -61,9 +61,9 @@ public class ServiceClientExpectTest extends BaseKeystoneRestClientExpectTest<Ke
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testListTenantsFailNotFound() {
|
public void testListTenantsFailNotFound() {
|
||||||
ServiceClient client = requestsSendResponses(keystoneAuthWithUsernameAndPassword, responseWithKeystoneAccess,
|
ServiceApi api = requestsSendResponses(keystoneAuthWithUsernameAndPassword, responseWithKeystoneAccess,
|
||||||
authenticatedGET().endpoint(endpoint + "/v2.0/tenants").build(),
|
authenticatedGET().endpoint(endpoint + "/v2.0/tenants").build(),
|
||||||
HttpResponse.builder().statusCode(404).build()).getServiceClient();
|
HttpResponse.builder().statusCode(404).build()).getServiceApi();
|
||||||
assertTrue(client.listTenants().isEmpty());
|
assertTrue(api.listTenants().isEmpty());
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -24,20 +24,20 @@ import static org.testng.Assert.assertNotNull;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.jclouds.openstack.keystone.v2_0.domain.Tenant;
|
import org.jclouds.openstack.keystone.v2_0.domain.Tenant;
|
||||||
import org.jclouds.openstack.keystone.v2_0.internal.BaseKeystoneClientLiveTest;
|
import org.jclouds.openstack.keystone.v2_0.internal.BaseKeystoneApiLiveTest;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests ServiceClient
|
* Tests ServiceApi
|
||||||
*
|
*
|
||||||
* @author Adam Lowe
|
* @author Adam Lowe
|
||||||
*/
|
*/
|
||||||
@Test(groups = "live", testName = "ServiceClientLiveTest")
|
@Test(groups = "live", testName = "ServiceApiLiveTest")
|
||||||
public class ServiceClientLiveTest extends BaseKeystoneClientLiveTest {
|
public class ServiceApiLiveTest extends BaseKeystoneApiLiveTest {
|
||||||
|
|
||||||
public void testTenants() {
|
public void testTenants() {
|
||||||
ServiceClient client = keystoneContext.getApi().getServiceClient();
|
ServiceApi api = keystoneContext.getApi().getServiceApi();
|
||||||
Set<Tenant> result = client.listTenants();
|
Set<Tenant> result = api.listTenants();
|
||||||
assertNotNull(result);
|
assertNotNull(result);
|
||||||
assertFalse(result.isEmpty());
|
assertFalse(result.isEmpty());
|
||||||
|
|
|
@ -28,35 +28,35 @@ import static org.testng.Assert.assertTrue;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.jclouds.http.HttpResponse;
|
import org.jclouds.http.HttpResponse;
|
||||||
import org.jclouds.openstack.keystone.v2_0.KeystoneClient;
|
import org.jclouds.openstack.keystone.v2_0.KeystoneApi;
|
||||||
import org.jclouds.openstack.keystone.v2_0.domain.Tenant;
|
import org.jclouds.openstack.keystone.v2_0.domain.Tenant;
|
||||||
import org.jclouds.openstack.keystone.v2_0.internal.BaseKeystoneRestClientExpectTest;
|
import org.jclouds.openstack.keystone.v2_0.internal.BaseKeystoneRestApiExpectTest;
|
||||||
import org.jclouds.rest.AuthorizationException;
|
import org.jclouds.rest.AuthorizationException;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests parsing and Guice wiring of TenantClient
|
* Tests parsing and Guice wiring of TenantApi
|
||||||
*
|
*
|
||||||
* @author Adam Lowe
|
* @author Adam Lowe
|
||||||
*/
|
*/
|
||||||
@Test(testName = "TenantClientExpectTest")
|
@Test(testName = "TenantApiExpectTest")
|
||||||
public class TenantClientExpectTest extends BaseKeystoneRestClientExpectTest<KeystoneClient> {
|
public class TenantApiExpectTest extends BaseKeystoneRestApiExpectTest<KeystoneApi> {
|
||||||
|
|
||||||
public TenantClientExpectTest(){
|
public TenantApiExpectTest(){
|
||||||
endpoint = "https://csnode.jclouds.org:35357";
|
endpoint = "https://csnode.jclouds.org:35357";
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testListTenants() {
|
public void testListTenants() {
|
||||||
TenantClient client = requestsSendResponses(
|
TenantApi api = requestsSendResponses(
|
||||||
keystoneAuthWithUsernameAndPassword,
|
keystoneAuthWithUsernameAndPassword,
|
||||||
responseWithKeystoneAccess,
|
responseWithKeystoneAccess,
|
||||||
authenticatedGET().endpoint(endpoint + "/v2.0/tenants").build(),
|
authenticatedGET().endpoint(endpoint + "/v2.0/tenants").build(),
|
||||||
HttpResponse.builder().statusCode(200).payload(
|
HttpResponse.builder().statusCode(200).payload(
|
||||||
payloadFromResourceWithContentType("/tenant_list.json", APPLICATION_JSON)).build())
|
payloadFromResourceWithContentType("/tenant_list.json", APPLICATION_JSON)).build())
|
||||||
.getTenantClient().get();
|
.getTenantApi().get();
|
||||||
Set<Tenant> tenants = client.list();
|
Set<Tenant> tenants = api.list();
|
||||||
assertNotNull(tenants);
|
assertNotNull(tenants);
|
||||||
assertFalse(tenants.isEmpty());
|
assertFalse(tenants.isEmpty());
|
||||||
|
|
||||||
|
@ -67,14 +67,14 @@ public class TenantClientExpectTest extends BaseKeystoneRestClientExpectTest<Key
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testListTenantsATT() {
|
public void testListTenantsATT() {
|
||||||
TenantClient client = requestsSendResponses(
|
TenantApi api = requestsSendResponses(
|
||||||
keystoneAuthWithUsernameAndPassword,
|
keystoneAuthWithUsernameAndPassword,
|
||||||
responseWithKeystoneAccess,
|
responseWithKeystoneAccess,
|
||||||
authenticatedGET().endpoint(endpoint + "/v2.0/tenants").build(),
|
authenticatedGET().endpoint(endpoint + "/v2.0/tenants").build(),
|
||||||
HttpResponse.builder().statusCode(200).payload(
|
HttpResponse.builder().statusCode(200).payload(
|
||||||
payloadFromResourceWithContentType("/tenant_list_att.json", APPLICATION_JSON)).build())
|
payloadFromResourceWithContentType("/tenant_list_att.json", APPLICATION_JSON)).build())
|
||||||
.getTenantClient().get();
|
.getTenantApi().get();
|
||||||
Set<Tenant> tenants = client.list();
|
Set<Tenant> tenants = api.list();
|
||||||
assertNotNull(tenants);
|
assertNotNull(tenants);
|
||||||
assertFalse(tenants.isEmpty());
|
assertFalse(tenants.isEmpty());
|
||||||
|
|
||||||
|
@ -84,51 +84,51 @@ public class TenantClientExpectTest extends BaseKeystoneRestClientExpectTest<Key
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testListTenantsFailNotFound() {
|
public void testListTenantsFailNotFound() {
|
||||||
TenantClient client = requestsSendResponses(keystoneAuthWithUsernameAndPassword, responseWithKeystoneAccess,
|
TenantApi api = requestsSendResponses(keystoneAuthWithUsernameAndPassword, responseWithKeystoneAccess,
|
||||||
authenticatedGET().endpoint(endpoint + "/v2.0/tenants").build(), HttpResponse.builder().statusCode(404).build())
|
authenticatedGET().endpoint(endpoint + "/v2.0/tenants").build(), HttpResponse.builder().statusCode(404).build())
|
||||||
.getTenantClient().get();
|
.getTenantApi().get();
|
||||||
assertTrue(client.list().isEmpty());
|
assertTrue(api.list().isEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGetTenant() {
|
public void testGetTenant() {
|
||||||
TenantClient client = requestsSendResponses(
|
TenantApi api = requestsSendResponses(
|
||||||
keystoneAuthWithUsernameAndPassword,
|
keystoneAuthWithUsernameAndPassword,
|
||||||
responseWithKeystoneAccess,
|
responseWithKeystoneAccess,
|
||||||
authenticatedGET().endpoint(endpoint + "/v2.0/tenants/013ba41150a14830bec85ffe93353bcc").build(),
|
authenticatedGET().endpoint(endpoint + "/v2.0/tenants/013ba41150a14830bec85ffe93353bcc").build(),
|
||||||
HttpResponse.builder().statusCode(200).payload(
|
HttpResponse.builder().statusCode(200).payload(
|
||||||
payloadFromResourceWithContentType("/tenant_details.json", APPLICATION_JSON)).build())
|
payloadFromResourceWithContentType("/tenant_details.json", APPLICATION_JSON)).build())
|
||||||
.getTenantClient().get();
|
.getTenantApi().get();
|
||||||
Tenant tenant = client.get("013ba41150a14830bec85ffe93353bcc");
|
Tenant tenant = api.get("013ba41150a14830bec85ffe93353bcc");
|
||||||
assertNotNull(tenant);
|
assertNotNull(tenant);
|
||||||
assertEquals(tenant, Tenant.builder().id("013ba41150a14830bec85ffe93353bcc").name("admin").build());
|
assertEquals(tenant, Tenant.builder().id("013ba41150a14830bec85ffe93353bcc").name("admin").build());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expectedExceptions = AuthorizationException.class)
|
@Test(expectedExceptions = AuthorizationException.class)
|
||||||
public void testListTenantsFailNotAuthorized() {
|
public void testListTenantsFailNotAuthorized() {
|
||||||
TenantClient client = requestsSendResponses(keystoneAuthWithUsernameAndPassword, responseWithKeystoneAccess,
|
TenantApi api = requestsSendResponses(keystoneAuthWithUsernameAndPassword, responseWithKeystoneAccess,
|
||||||
authenticatedGET().endpoint(endpoint + "/v2.0/tenants/013ba41150a14830bec85ffe93353bcc").build(),
|
authenticatedGET().endpoint(endpoint + "/v2.0/tenants/013ba41150a14830bec85ffe93353bcc").build(),
|
||||||
HttpResponse.builder().statusCode(401).build()).getTenantClient().get();
|
HttpResponse.builder().statusCode(401).build()).getTenantApi().get();
|
||||||
client.get("013ba41150a14830bec85ffe93353bcc");
|
api.get("013ba41150a14830bec85ffe93353bcc");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGetTenantByName() {
|
public void testGetTenantByName() {
|
||||||
TenantClient client = requestsSendResponses(
|
TenantApi api = requestsSendResponses(
|
||||||
keystoneAuthWithUsernameAndPassword,
|
keystoneAuthWithUsernameAndPassword,
|
||||||
responseWithKeystoneAccess,
|
responseWithKeystoneAccess,
|
||||||
authenticatedGET().endpoint(endpoint + "/v2.0/tenants?name=admin").build(),
|
authenticatedGET().endpoint(endpoint + "/v2.0/tenants?name=admin").build(),
|
||||||
HttpResponse.builder().statusCode(200).payload(
|
HttpResponse.builder().statusCode(200).payload(
|
||||||
payloadFromResourceWithContentType("/tenant_details.json", APPLICATION_JSON)).build())
|
payloadFromResourceWithContentType("/tenant_details.json", APPLICATION_JSON)).build())
|
||||||
.getTenantClient().get();
|
.getTenantApi().get();
|
||||||
Tenant tenant = client.getByName("admin");
|
Tenant tenant = api.getByName("admin");
|
||||||
assertNotNull(tenant);
|
assertNotNull(tenant);
|
||||||
assertEquals(tenant, Tenant.builder().id("013ba41150a14830bec85ffe93353bcc").name("admin").build());
|
assertEquals(tenant, Tenant.builder().id("013ba41150a14830bec85ffe93353bcc").name("admin").build());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGetTenantByNameFailNotFound() {
|
public void testGetTenantByNameFailNotFound() {
|
||||||
TenantClient client = requestsSendResponses(keystoneAuthWithUsernameAndPassword, responseWithKeystoneAccess,
|
TenantApi api = requestsSendResponses(keystoneAuthWithUsernameAndPassword, responseWithKeystoneAccess,
|
||||||
authenticatedGET().endpoint(endpoint + "/v2.0/tenants?name=admin").build(),
|
authenticatedGET().endpoint(endpoint + "/v2.0/tenants?name=admin").build(),
|
||||||
HttpResponse.builder().statusCode(404).build()).getTenantClient().get();
|
HttpResponse.builder().statusCode(404).build()).getTenantApi().get();
|
||||||
assertNull(client.getByName("admin"));
|
assertNull(api.getByName("admin"));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -25,27 +25,27 @@ import static org.testng.Assert.assertNotNull;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.jclouds.openstack.keystone.v2_0.domain.Tenant;
|
import org.jclouds.openstack.keystone.v2_0.domain.Tenant;
|
||||||
import org.jclouds.openstack.keystone.v2_0.internal.BaseKeystoneClientLiveTest;
|
import org.jclouds.openstack.keystone.v2_0.internal.BaseKeystoneApiLiveTest;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests TenantClient
|
* Tests TenantApi
|
||||||
*
|
*
|
||||||
* @author Adam Lowe
|
* @author Adam Lowe
|
||||||
*/
|
*/
|
||||||
@Test(groups = "live", testName = "TenantClientLiveTest")
|
@Test(groups = "live", testName = "TenantApiLiveTest")
|
||||||
public class TenantClientLiveTest extends BaseKeystoneClientLiveTest {
|
public class TenantApiLiveTest extends BaseKeystoneApiLiveTest {
|
||||||
|
|
||||||
public void testTenants() {
|
public void testTenants() {
|
||||||
TenantClient client = keystoneContext.getApi().getTenantClient().get();
|
TenantApi api = keystoneContext.getApi().getTenantApi().get();
|
||||||
Set<Tenant> result = client.list();
|
Set<Tenant> result = api.list();
|
||||||
assertNotNull(result);
|
assertNotNull(result);
|
||||||
assertFalse(result.isEmpty());
|
assertFalse(result.isEmpty());
|
||||||
|
|
||||||
for (Tenant tenant : result) {
|
for (Tenant tenant : result) {
|
||||||
assertNotNull(tenant.getId());
|
assertNotNull(tenant.getId());
|
||||||
|
|
||||||
Tenant aTenant = client.get(tenant.getId());
|
Tenant aTenant = api.get(tenant.getId());
|
||||||
assertNotNull(aTenant, "get returned null for tenant: " + tenant);
|
assertNotNull(aTenant, "get returned null for tenant: " + tenant);
|
||||||
|
|
||||||
assertEquals(aTenant, tenant);
|
assertEquals(aTenant, tenant);
|
||||||
|
@ -54,10 +54,10 @@ public class TenantClientLiveTest extends BaseKeystoneClientLiveTest {
|
||||||
|
|
||||||
public void testTenantsByName() {
|
public void testTenantsByName() {
|
||||||
|
|
||||||
TenantClient client = keystoneContext.getApi().getTenantClient().get();
|
TenantApi api = keystoneContext.getApi().getTenantApi().get();
|
||||||
|
|
||||||
for (Tenant tenant : client.list()) {
|
for (Tenant tenant : api.list()) {
|
||||||
Tenant aTenant = client.getByName(tenant.getName());
|
Tenant aTenant = api.getByName(tenant.getName());
|
||||||
assertNotNull(aTenant, "get returned null for tenant: " + tenant);
|
assertNotNull(aTenant, "get returned null for tenant: " + tenant);
|
||||||
|
|
||||||
assertEquals(aTenant, tenant);
|
assertEquals(aTenant, tenant);
|
|
@ -33,38 +33,38 @@ import org.jclouds.date.internal.SimpleDateFormatDateService;
|
||||||
import org.jclouds.http.HttpRequest;
|
import org.jclouds.http.HttpRequest;
|
||||||
import org.jclouds.http.HttpResponse;
|
import org.jclouds.http.HttpResponse;
|
||||||
import org.jclouds.http.HttpResponseException;
|
import org.jclouds.http.HttpResponseException;
|
||||||
import org.jclouds.openstack.keystone.v2_0.KeystoneClient;
|
import org.jclouds.openstack.keystone.v2_0.KeystoneApi;
|
||||||
import org.jclouds.openstack.keystone.v2_0.domain.Endpoint;
|
import org.jclouds.openstack.keystone.v2_0.domain.Endpoint;
|
||||||
import org.jclouds.openstack.keystone.v2_0.domain.Role;
|
import org.jclouds.openstack.keystone.v2_0.domain.Role;
|
||||||
import org.jclouds.openstack.keystone.v2_0.domain.Tenant;
|
import org.jclouds.openstack.keystone.v2_0.domain.Tenant;
|
||||||
import org.jclouds.openstack.keystone.v2_0.domain.Token;
|
import org.jclouds.openstack.keystone.v2_0.domain.Token;
|
||||||
import org.jclouds.openstack.keystone.v2_0.domain.User;
|
import org.jclouds.openstack.keystone.v2_0.domain.User;
|
||||||
import org.jclouds.openstack.keystone.v2_0.internal.BaseKeystoneRestClientExpectTest;
|
import org.jclouds.openstack.keystone.v2_0.internal.BaseKeystoneRestApiExpectTest;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests parsing and Guice wiring of TokenClient
|
* Tests parsing and Guice wiring of TokenApi
|
||||||
*
|
*
|
||||||
* @author Adam Lowe
|
* @author Adam Lowe
|
||||||
*/
|
*/
|
||||||
@Test(testName = "TokenClientExpectTest")
|
@Test(testName = "TokenApiExpectTest")
|
||||||
public class TokenClientExpectTest extends BaseKeystoneRestClientExpectTest<KeystoneClient> {
|
public class TokenApiExpectTest extends BaseKeystoneRestApiExpectTest<KeystoneApi> {
|
||||||
|
|
||||||
public TokenClientExpectTest(){
|
public TokenApiExpectTest(){
|
||||||
endpoint = "https://csnode.jclouds.org:35357";
|
endpoint = "https://csnode.jclouds.org:35357";
|
||||||
}
|
}
|
||||||
|
|
||||||
private DateService dateService = new SimpleDateFormatDateService();
|
private DateService dateService = new SimpleDateFormatDateService();
|
||||||
|
|
||||||
public void testGetToken() {
|
public void testGetToken() {
|
||||||
TokenClient client = requestsSendResponses(
|
TokenApi api = requestsSendResponses(
|
||||||
keystoneAuthWithUsernameAndPassword, responseWithKeystoneAccess,
|
keystoneAuthWithUsernameAndPassword, responseWithKeystoneAccess,
|
||||||
authenticatedGET().endpoint(endpoint + "/v2.0/tokens/sometokenorother").build(),
|
authenticatedGET().endpoint(endpoint + "/v2.0/tokens/sometokenorother").build(),
|
||||||
HttpResponse.builder().statusCode(200).payload(payloadFromResourceWithContentType("/token_details.json", APPLICATION_JSON)).build())
|
HttpResponse.builder().statusCode(200).payload(payloadFromResourceWithContentType("/token_details.json", APPLICATION_JSON)).build())
|
||||||
.getTokenClient().get();
|
.getTokenApi().get();
|
||||||
Token token = client.get("sometokenorother");
|
Token token = api.get("sometokenorother");
|
||||||
assertNotNull(token);
|
assertNotNull(token);
|
||||||
assertEquals(token,
|
assertEquals(token,
|
||||||
Token.builder().id("167eccdc790946969ced473732e8109b").expires(dateService.iso8601SecondsDateParse("2012-04-28T12:42:50Z"))
|
Token.builder().id("167eccdc790946969ced473732e8109b").expires(dateService.iso8601SecondsDateParse("2012-04-28T12:42:50Z"))
|
||||||
|
@ -72,30 +72,30 @@ public class TokenClientExpectTest extends BaseKeystoneRestClientExpectTest<Keys
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGetTokenFailNotFound() {
|
public void testGetTokenFailNotFound() {
|
||||||
TokenClient client = requestsSendResponses(
|
TokenApi api = requestsSendResponses(
|
||||||
keystoneAuthWithUsernameAndPassword, responseWithKeystoneAccess,
|
keystoneAuthWithUsernameAndPassword, responseWithKeystoneAccess,
|
||||||
authenticatedGET().endpoint(endpoint + "/v2.0/tokens/sometokenorother").build(),
|
authenticatedGET().endpoint(endpoint + "/v2.0/tokens/sometokenorother").build(),
|
||||||
HttpResponse.builder().statusCode(404).build())
|
HttpResponse.builder().statusCode(404).build())
|
||||||
.getTokenClient().get();
|
.getTokenApi().get();
|
||||||
assertNull(client.get("sometokenorother"));
|
assertNull(api.get("sometokenorother"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expectedExceptions = HttpResponseException.class)
|
@Test(expectedExceptions = HttpResponseException.class)
|
||||||
public void testGetTokenFail500() {
|
public void testGetTokenFail500() {
|
||||||
TokenClient client = requestsSendResponses(
|
TokenApi api = requestsSendResponses(
|
||||||
keystoneAuthWithUsernameAndPassword, responseWithKeystoneAccess,
|
keystoneAuthWithUsernameAndPassword, responseWithKeystoneAccess,
|
||||||
authenticatedGET().endpoint(endpoint + "/v2.0/tokens/sometokenorother").build(),
|
authenticatedGET().endpoint(endpoint + "/v2.0/tokens/sometokenorother").build(),
|
||||||
HttpResponse.builder().statusCode(500).build()).getTokenClient().get();
|
HttpResponse.builder().statusCode(500).build()).getTokenApi().get();
|
||||||
client.get("sometokenorother");
|
api.get("sometokenorother");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGetUserOfToken() {
|
public void testGetUserOfToken() {
|
||||||
TokenClient client = requestsSendResponses(
|
TokenApi api = requestsSendResponses(
|
||||||
keystoneAuthWithUsernameAndPassword, responseWithKeystoneAccess,
|
keystoneAuthWithUsernameAndPassword, responseWithKeystoneAccess,
|
||||||
authenticatedGET().endpoint(endpoint + "/v2.0/tokens/sometokenorother").build(),
|
authenticatedGET().endpoint(endpoint + "/v2.0/tokens/sometokenorother").build(),
|
||||||
HttpResponse.builder().statusCode(200).payload(payloadFromResourceWithContentType("/token_details.json", APPLICATION_JSON)).build())
|
HttpResponse.builder().statusCode(200).payload(payloadFromResourceWithContentType("/token_details.json", APPLICATION_JSON)).build())
|
||||||
.getTokenClient().get();
|
.getTokenApi().get();
|
||||||
User user = client.getUserOfToken("sometokenorother");
|
User user = api.getUserOfToken("sometokenorother");
|
||||||
assertNotNull(user);
|
assertNotNull(user);
|
||||||
assertEquals(user, User.builder().id("2b9b606181634ae9ac86fd95a8bc2cde").name("admin")
|
assertEquals(user, User.builder().id("2b9b606181634ae9ac86fd95a8bc2cde").name("admin")
|
||||||
.roles(ImmutableSet.of(Role.builder().id("79cada5c02814b57a52e0eed4dd388cb").name("admin").build()))
|
.roles(ImmutableSet.of(Role.builder().id("79cada5c02814b57a52e0eed4dd388cb").name("admin").build()))
|
||||||
|
@ -103,42 +103,42 @@ public class TokenClientExpectTest extends BaseKeystoneRestClientExpectTest<Keys
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGetUserOfTokenFailNotFound() {
|
public void testGetUserOfTokenFailNotFound() {
|
||||||
TokenClient client = requestsSendResponses(
|
TokenApi api = requestsSendResponses(
|
||||||
keystoneAuthWithUsernameAndPassword, responseWithKeystoneAccess,
|
keystoneAuthWithUsernameAndPassword, responseWithKeystoneAccess,
|
||||||
authenticatedGET().endpoint(endpoint + "/v2.0/tokens/sometokenorother").build(),
|
authenticatedGET().endpoint(endpoint + "/v2.0/tokens/sometokenorother").build(),
|
||||||
HttpResponse.builder().statusCode(404).build()).getTokenClient().get();
|
HttpResponse.builder().statusCode(404).build()).getTokenApi().get();
|
||||||
assertNull(client.getUserOfToken("sometokenorother"));
|
assertNull(api.getUserOfToken("sometokenorother"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testCheckTokenIsValid() {
|
public void testCheckTokenIsValid() {
|
||||||
TokenClient client = requestsSendResponses(
|
TokenApi api = requestsSendResponses(
|
||||||
keystoneAuthWithUsernameAndPassword, responseWithKeystoneAccess,
|
keystoneAuthWithUsernameAndPassword, responseWithKeystoneAccess,
|
||||||
HttpRequest.builder().method("HEAD")
|
HttpRequest.builder().method("HEAD")
|
||||||
.endpoint(endpoint + "/v2.0/tokens/sometokenorother")
|
.endpoint(endpoint + "/v2.0/tokens/sometokenorother")
|
||||||
.addHeader("X-Auth-Token", authToken).build(),
|
.addHeader("X-Auth-Token", authToken).build(),
|
||||||
HttpResponse.builder().statusCode(200).payload(payloadFromResourceWithContentType("/token_details.json", APPLICATION_JSON)).build())
|
HttpResponse.builder().statusCode(200).payload(payloadFromResourceWithContentType("/token_details.json", APPLICATION_JSON)).build())
|
||||||
.getTokenClient().get();
|
.getTokenApi().get();
|
||||||
assertTrue(client.isValid("sometokenorother"));
|
assertTrue(api.isValid("sometokenorother"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testCheckTokenIsValidFailNotValid() {
|
public void testCheckTokenIsValidFailNotValid() {
|
||||||
TokenClient client = requestsSendResponses(
|
TokenApi api = requestsSendResponses(
|
||||||
keystoneAuthWithUsernameAndPassword, responseWithKeystoneAccess,
|
keystoneAuthWithUsernameAndPassword, responseWithKeystoneAccess,
|
||||||
HttpRequest.builder().method("HEAD")
|
HttpRequest.builder().method("HEAD")
|
||||||
.endpoint(endpoint + "/v2.0/tokens/sometokenorother")
|
.endpoint(endpoint + "/v2.0/tokens/sometokenorother")
|
||||||
.addHeader("X-Auth-Token", authToken).build(),
|
.addHeader("X-Auth-Token", authToken).build(),
|
||||||
HttpResponse.builder().statusCode(404).build()).getTokenClient().get();
|
HttpResponse.builder().statusCode(404).build()).getTokenApi().get();
|
||||||
assertFalse(client.isValid("sometokenorother"));
|
assertFalse(api.isValid("sometokenorother"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetEndpointsForToken() {
|
public void testGetEndpointsForToken() {
|
||||||
TokenClient client = requestsSendResponses(
|
TokenApi api = requestsSendResponses(
|
||||||
keystoneAuthWithUsernameAndPassword, responseWithKeystoneAccess,
|
keystoneAuthWithUsernameAndPassword, responseWithKeystoneAccess,
|
||||||
authenticatedGET().endpoint(endpoint + "/v2.0/tokens/XXXXXX/endpoints").build(),
|
authenticatedGET().endpoint(endpoint + "/v2.0/tokens/XXXXXX/endpoints").build(),
|
||||||
HttpResponse.builder().statusCode(200).payload(payloadFromResourceWithContentType("/user_endpoints.json", APPLICATION_JSON)).build())
|
HttpResponse.builder().statusCode(200).payload(payloadFromResourceWithContentType("/user_endpoints.json", APPLICATION_JSON)).build())
|
||||||
.getTokenClient().get();
|
.getTokenApi().get();
|
||||||
Set<Endpoint> endpoints = client.listEndpointsForToken("XXXXXX");
|
Set<Endpoint> endpoints = api.listEndpointsForToken("XXXXXX");
|
||||||
|
|
||||||
assertEquals(endpoints, ImmutableSet.of(
|
assertEquals(endpoints, ImmutableSet.of(
|
||||||
Endpoint.builder().publicURL(URI.create("https://csnode.jclouds.org/v2.0/"))
|
Endpoint.builder().publicURL(URI.create("https://csnode.jclouds.org/v2.0/"))
|
||||||
|
@ -149,12 +149,12 @@ public class TokenClientExpectTest extends BaseKeystoneRestClientExpectTest<Keys
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetEndpointsForTokenFailNotFound() {
|
public void testGetEndpointsForTokenFailNotFound() {
|
||||||
TokenClient client = requestsSendResponses(
|
TokenApi api = requestsSendResponses(
|
||||||
keystoneAuthWithUsernameAndPassword, responseWithKeystoneAccess,
|
keystoneAuthWithUsernameAndPassword, responseWithKeystoneAccess,
|
||||||
authenticatedGET().endpoint(endpoint + "/v2.0/tokens/XXXXXX/endpoints").build(),
|
authenticatedGET().endpoint(endpoint + "/v2.0/tokens/XXXXXX/endpoints").build(),
|
||||||
HttpResponse.builder().statusCode(404).build())
|
HttpResponse.builder().statusCode(404).build())
|
||||||
.getTokenClient().get();
|
.getTokenApi().get();
|
||||||
assertTrue(client.listEndpointsForToken("XXXXXX").isEmpty());
|
assertTrue(api.listEndpointsForToken("XXXXXX").isEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,19 +31,19 @@ import org.jclouds.openstack.keystone.v2_0.domain.Endpoint;
|
||||||
import org.jclouds.openstack.keystone.v2_0.domain.Token;
|
import org.jclouds.openstack.keystone.v2_0.domain.Token;
|
||||||
import org.jclouds.openstack.keystone.v2_0.domain.User;
|
import org.jclouds.openstack.keystone.v2_0.domain.User;
|
||||||
import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
|
import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
|
||||||
import org.jclouds.openstack.keystone.v2_0.internal.BaseKeystoneClientLiveTest;
|
import org.jclouds.openstack.keystone.v2_0.internal.BaseKeystoneApiLiveTest;
|
||||||
import org.testng.annotations.BeforeMethod;
|
import org.testng.annotations.BeforeMethod;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import com.google.common.collect.Iterables;
|
import com.google.common.collect.Iterables;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests TokenClient
|
* Tests TokenApi
|
||||||
*
|
*
|
||||||
* @author Adam Lowe
|
* @author Adam Lowe
|
||||||
*/
|
*/
|
||||||
@Test(groups = "live", testName = "TokenClientLiveTest", singleThreaded = true)
|
@Test(groups = "live", testName = "TokenApiLiveTest", singleThreaded = true)
|
||||||
public class TokenClientLiveTest extends BaseKeystoneClientLiveTest {
|
public class TokenApiLiveTest extends BaseKeystoneApiLiveTest {
|
||||||
|
|
||||||
protected String token;
|
protected String token;
|
||||||
|
|
||||||
|
@ -57,14 +57,14 @@ public class TokenClientLiveTest extends BaseKeystoneClientLiveTest {
|
||||||
|
|
||||||
public void testToken() {
|
public void testToken() {
|
||||||
|
|
||||||
TokenClient client = keystoneContext.getApi().getTokenClient().get();
|
TokenApi api = keystoneContext.getApi().getTokenApi().get();
|
||||||
assertTrue(client.isValid(token));
|
assertTrue(api.isValid(token));
|
||||||
Token result = client.get(token);
|
Token result = api.get(token);
|
||||||
assertNotNull(result);
|
assertNotNull(result);
|
||||||
assertEquals(result.getId(), token);
|
assertEquals(result.getId(), token);
|
||||||
assertNotNull(result.getTenant());
|
assertNotNull(result.getTenant());
|
||||||
|
|
||||||
User user = client.getUserOfToken(token);
|
User user = api.getUserOfToken(token);
|
||||||
assertNotNull(user);
|
assertNotNull(user);
|
||||||
assertNotNull(user.getId());
|
assertNotNull(user.getId());
|
||||||
assertNotNull(user.getName());
|
assertNotNull(user.getName());
|
||||||
|
@ -73,16 +73,16 @@ public class TokenClientLiveTest extends BaseKeystoneClientLiveTest {
|
||||||
|
|
||||||
public void testInvalidToken() {
|
public void testInvalidToken() {
|
||||||
|
|
||||||
TokenClient client = keystoneContext.getApi().getTokenClient().get();
|
TokenApi api = keystoneContext.getApi().getTokenApi().get();
|
||||||
assertFalse(client.isValid("thisisnotarealtoken!"));
|
assertFalse(api.isValid("thisisnotarealtoken!"));
|
||||||
assertNull(client.get("thisisnotarealtoken!"));
|
assertNull(api.get("thisisnotarealtoken!"));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testTokenEndpoints() {
|
public void testTokenEndpoints() {
|
||||||
|
|
||||||
TokenClient client = keystoneContext.getApi().getTokenClient().get();
|
TokenApi api = keystoneContext.getApi().getTokenApi().get();
|
||||||
Set<Endpoint> endpoints = client.listEndpointsForToken(token);
|
Set<Endpoint> endpoints = api.listEndpointsForToken(token);
|
||||||
assertNotNull(endpoints);
|
assertNotNull(endpoints);
|
||||||
assertFalse(endpoints.isEmpty());
|
assertFalse(endpoints.isEmpty());
|
||||||
|
|
||||||
|
@ -90,8 +90,8 @@ public class TokenClientLiveTest extends BaseKeystoneClientLiveTest {
|
||||||
|
|
||||||
public void testInvalidTokenEndpoints() {
|
public void testInvalidTokenEndpoints() {
|
||||||
|
|
||||||
TokenClient client = keystoneContext.getApi().getTokenClient().get();
|
TokenApi api = keystoneContext.getApi().getTokenApi().get();
|
||||||
assertTrue(client.listEndpointsForToken("thisisnotarealtoken!").isEmpty());
|
assertTrue(api.listEndpointsForToken("thisisnotarealtoken!").isEmpty());
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -29,34 +29,34 @@ import java.util.Set;
|
||||||
|
|
||||||
import org.jclouds.http.HttpResponse;
|
import org.jclouds.http.HttpResponse;
|
||||||
import org.jclouds.http.HttpResponseException;
|
import org.jclouds.http.HttpResponseException;
|
||||||
import org.jclouds.openstack.keystone.v2_0.KeystoneClient;
|
import org.jclouds.openstack.keystone.v2_0.KeystoneApi;
|
||||||
import org.jclouds.openstack.keystone.v2_0.domain.Role;
|
import org.jclouds.openstack.keystone.v2_0.domain.Role;
|
||||||
import org.jclouds.openstack.keystone.v2_0.domain.User;
|
import org.jclouds.openstack.keystone.v2_0.domain.User;
|
||||||
import org.jclouds.openstack.keystone.v2_0.internal.BaseKeystoneRestClientExpectTest;
|
import org.jclouds.openstack.keystone.v2_0.internal.BaseKeystoneRestApiExpectTest;
|
||||||
import org.jclouds.rest.AuthorizationException;
|
import org.jclouds.rest.AuthorizationException;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests parsing and Guice wiring of UserClient
|
* Tests parsing and Guice wiring of UserApi
|
||||||
*
|
*
|
||||||
* @author Adam Lowe
|
* @author Adam Lowe
|
||||||
*/
|
*/
|
||||||
@Test(testName = "UserClientExpectTest")
|
@Test(testName = "UserApiExpectTest")
|
||||||
public class UserClientExpectTest extends BaseKeystoneRestClientExpectTest<KeystoneClient> {
|
public class UserApiExpectTest extends BaseKeystoneRestApiExpectTest<KeystoneApi> {
|
||||||
|
|
||||||
public UserClientExpectTest(){
|
public UserApiExpectTest(){
|
||||||
endpoint = "https://csnode.jclouds.org:35357";
|
endpoint = "https://csnode.jclouds.org:35357";
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testListUsers() {
|
public void testListUsers() {
|
||||||
UserClient client = requestsSendResponses(
|
UserApi api = requestsSendResponses(
|
||||||
keystoneAuthWithUsernameAndPassword, responseWithKeystoneAccess,
|
keystoneAuthWithUsernameAndPassword, responseWithKeystoneAccess,
|
||||||
authenticatedGET().endpoint(endpoint + "/v2.0/users").build(),
|
authenticatedGET().endpoint(endpoint + "/v2.0/users").build(),
|
||||||
HttpResponse.builder().statusCode(200).payload(payloadFromResourceWithContentType("/user_list.json", APPLICATION_JSON)).build())
|
HttpResponse.builder().statusCode(200).payload(payloadFromResourceWithContentType("/user_list.json", APPLICATION_JSON)).build())
|
||||||
.getUserClient().get();
|
.getUserApi().get();
|
||||||
Set<User> users = client.list();
|
Set<User> users = api.list();
|
||||||
assertNotNull(users);
|
assertNotNull(users);
|
||||||
assertFalse(users.isEmpty());
|
assertFalse(users.isEmpty());
|
||||||
|
|
||||||
|
@ -72,58 +72,58 @@ public class UserClientExpectTest extends BaseKeystoneRestClientExpectTest<Keyst
|
||||||
|
|
||||||
@Test(expectedExceptions = AuthorizationException.class)
|
@Test(expectedExceptions = AuthorizationException.class)
|
||||||
public void testListUsersFailNotAuth() {
|
public void testListUsersFailNotAuth() {
|
||||||
UserClient client = requestsSendResponses(
|
UserApi api = requestsSendResponses(
|
||||||
keystoneAuthWithUsernameAndPassword, responseWithKeystoneAccess,
|
keystoneAuthWithUsernameAndPassword, responseWithKeystoneAccess,
|
||||||
authenticatedGET().endpoint(endpoint + "/v2.0/users").build(),
|
authenticatedGET().endpoint(endpoint + "/v2.0/users").build(),
|
||||||
HttpResponse.builder().statusCode(401).build()).getUserClient().get();
|
HttpResponse.builder().statusCode(401).build()).getUserApi().get();
|
||||||
client.list();
|
api.list();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGetUser() {
|
public void testGetUser() {
|
||||||
UserClient client = requestsSendResponses(
|
UserApi api = requestsSendResponses(
|
||||||
keystoneAuthWithUsernameAndPassword, responseWithKeystoneAccess,
|
keystoneAuthWithUsernameAndPassword, responseWithKeystoneAccess,
|
||||||
authenticatedGET().endpoint(endpoint + "/v2.0/users/e021dfd758eb44a89f1c57c8ef3be8e2").build(),
|
authenticatedGET().endpoint(endpoint + "/v2.0/users/e021dfd758eb44a89f1c57c8ef3be8e2").build(),
|
||||||
HttpResponse.builder().statusCode(200).payload(payloadFromResourceWithContentType("/user_details.json", APPLICATION_JSON)).build())
|
HttpResponse.builder().statusCode(200).payload(payloadFromResourceWithContentType("/user_details.json", APPLICATION_JSON)).build())
|
||||||
.getUserClient().get();
|
.getUserApi().get();
|
||||||
User user = client.get("e021dfd758eb44a89f1c57c8ef3be8e2");
|
User user = api.get("e021dfd758eb44a89f1c57c8ef3be8e2");
|
||||||
assertNotNull(user);
|
assertNotNull(user);
|
||||||
assertEquals(user, User.builder().name("nova").id("e021dfd758eb44a89f1c57c8ef3be8e2").build());
|
assertEquals(user, User.builder().name("nova").id("e021dfd758eb44a89f1c57c8ef3be8e2").build());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGetUserFailNotFound() {
|
public void testGetUserFailNotFound() {
|
||||||
UserClient client = requestsSendResponses(
|
UserApi api = requestsSendResponses(
|
||||||
keystoneAuthWithUsernameAndPassword, responseWithKeystoneAccess,
|
keystoneAuthWithUsernameAndPassword, responseWithKeystoneAccess,
|
||||||
authenticatedGET().endpoint(endpoint + "/v2.0/users/f021dfd758eb44a89f1c57c8ef3be8e2").build(),
|
authenticatedGET().endpoint(endpoint + "/v2.0/users/f021dfd758eb44a89f1c57c8ef3be8e2").build(),
|
||||||
HttpResponse.builder().statusCode(404).build()).getUserClient().get();
|
HttpResponse.builder().statusCode(404).build()).getUserApi().get();
|
||||||
assertNull(client.get("f021dfd758eb44a89f1c57c8ef3be8e2"));
|
assertNull(api.get("f021dfd758eb44a89f1c57c8ef3be8e2"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGetUserByName() {
|
public void testGetUserByName() {
|
||||||
UserClient client = requestsSendResponses(
|
UserApi api = requestsSendResponses(
|
||||||
keystoneAuthWithUsernameAndPassword, responseWithKeystoneAccess,
|
keystoneAuthWithUsernameAndPassword, responseWithKeystoneAccess,
|
||||||
authenticatedGET().endpoint(endpoint + "/v2.0/users?name=nova").build(),
|
authenticatedGET().endpoint(endpoint + "/v2.0/users?name=nova").build(),
|
||||||
HttpResponse.builder().statusCode(200).payload(payloadFromResourceWithContentType("/user_details.json", APPLICATION_JSON)).build())
|
HttpResponse.builder().statusCode(200).payload(payloadFromResourceWithContentType("/user_details.json", APPLICATION_JSON)).build())
|
||||||
.getUserClient().get();
|
.getUserApi().get();
|
||||||
User user = client.getByName("nova");
|
User user = api.getByName("nova");
|
||||||
assertNotNull(user);
|
assertNotNull(user);
|
||||||
assertEquals(user, User.builder().name("nova").id("e021dfd758eb44a89f1c57c8ef3be8e2").build());
|
assertEquals(user, User.builder().name("nova").id("e021dfd758eb44a89f1c57c8ef3be8e2").build());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGetUserByNameFailNotFound() {
|
public void testGetUserByNameFailNotFound() {
|
||||||
UserClient client = requestsSendResponses(
|
UserApi api = requestsSendResponses(
|
||||||
keystoneAuthWithUsernameAndPassword, responseWithKeystoneAccess,
|
keystoneAuthWithUsernameAndPassword, responseWithKeystoneAccess,
|
||||||
authenticatedGET().endpoint(endpoint + "/v2.0/users?name=fred").build(),
|
authenticatedGET().endpoint(endpoint + "/v2.0/users?name=fred").build(),
|
||||||
HttpResponse.builder().statusCode(404).build()).getUserClient().get();
|
HttpResponse.builder().statusCode(404).build()).getUserApi().get();
|
||||||
assertNull(client.getByName("fred"));
|
assertNull(api.getByName("fred"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testListRolesOfUser() {
|
public void testListRolesOfUser() {
|
||||||
UserClient client = requestsSendResponses(
|
UserApi api = requestsSendResponses(
|
||||||
keystoneAuthWithUsernameAndPassword, responseWithKeystoneAccess,
|
keystoneAuthWithUsernameAndPassword, responseWithKeystoneAccess,
|
||||||
authenticatedGET().endpoint(endpoint + "/v2.0/users/3f6c1c9ba993495ead7d2eb2192e284f/roles").build(),
|
authenticatedGET().endpoint(endpoint + "/v2.0/users/3f6c1c9ba993495ead7d2eb2192e284f/roles").build(),
|
||||||
HttpResponse.builder().statusCode(200).payload(payloadFromResourceWithContentType("/user_role_list.json", APPLICATION_JSON)).build())
|
HttpResponse.builder().statusCode(200).payload(payloadFromResourceWithContentType("/user_role_list.json", APPLICATION_JSON)).build())
|
||||||
.getUserClient().get();
|
.getUserApi().get();
|
||||||
Set<Role> roles = client.listRolesOfUser("3f6c1c9ba993495ead7d2eb2192e284f");
|
Set<Role> roles = api.listRolesOfUser("3f6c1c9ba993495ead7d2eb2192e284f");
|
||||||
assertNotNull(roles);
|
assertNotNull(roles);
|
||||||
assertFalse(roles.isEmpty());
|
assertFalse(roles.isEmpty());
|
||||||
assertEquals(roles, ImmutableSet.of(
|
assertEquals(roles, ImmutableSet.of(
|
||||||
|
@ -132,29 +132,29 @@ public class UserClientExpectTest extends BaseKeystoneRestClientExpectTest<Keyst
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testListRolesOfUserFailNotFound() {
|
public void testListRolesOfUserFailNotFound() {
|
||||||
UserClient client = requestsSendResponses(
|
UserApi api = requestsSendResponses(
|
||||||
keystoneAuthWithUsernameAndPassword, responseWithKeystoneAccess,
|
keystoneAuthWithUsernameAndPassword, responseWithKeystoneAccess,
|
||||||
authenticatedGET().endpoint(endpoint + "/v2.0/users/4f6c1c9ba993495ead7d2eb2192e284f/roles").build(),
|
authenticatedGET().endpoint(endpoint + "/v2.0/users/4f6c1c9ba993495ead7d2eb2192e284f/roles").build(),
|
||||||
HttpResponse.builder().statusCode(404).build()).getUserClient().get();
|
HttpResponse.builder().statusCode(404).build()).getUserApi().get();
|
||||||
assertTrue(client.listRolesOfUser("4f6c1c9ba993495ead7d2eb2192e284f").isEmpty());
|
assertTrue(api.listRolesOfUser("4f6c1c9ba993495ead7d2eb2192e284f").isEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expectedExceptions = HttpResponseException.class)
|
@Test(expectedExceptions = HttpResponseException.class)
|
||||||
public void testListRolesOfUserFailNotImplemented() {
|
public void testListRolesOfUserFailNotImplemented() {
|
||||||
UserClient client = requestsSendResponses(
|
UserApi api = requestsSendResponses(
|
||||||
keystoneAuthWithUsernameAndPassword, responseWithKeystoneAccess,
|
keystoneAuthWithUsernameAndPassword, responseWithKeystoneAccess,
|
||||||
authenticatedGET().endpoint(endpoint + "/v2.0/users/5f6c1c9ba993495ead7d2eb2192e284f/roles").build(),
|
authenticatedGET().endpoint(endpoint + "/v2.0/users/5f6c1c9ba993495ead7d2eb2192e284f/roles").build(),
|
||||||
HttpResponse.builder().statusCode(501).build()).getUserClient().get();
|
HttpResponse.builder().statusCode(501).build()).getUserApi().get();
|
||||||
assertTrue(client.listRolesOfUser("5f6c1c9ba993495ead7d2eb2192e284f").isEmpty());
|
assertTrue(api.listRolesOfUser("5f6c1c9ba993495ead7d2eb2192e284f").isEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testListRolesOfUserInTenant() {
|
public void testListRolesOfUserInTenant() {
|
||||||
UserClient client = requestsSendResponses(
|
UserApi api = requestsSendResponses(
|
||||||
keystoneAuthWithUsernameAndPassword, responseWithKeystoneAccess,
|
keystoneAuthWithUsernameAndPassword, responseWithKeystoneAccess,
|
||||||
authenticatedGET().endpoint(endpoint + "/v2.0/users/3f6c1c9ba993495ead7d2eb2192e284f/roles").build(),
|
authenticatedGET().endpoint(endpoint + "/v2.0/users/3f6c1c9ba993495ead7d2eb2192e284f/roles").build(),
|
||||||
HttpResponse.builder().statusCode(200).payload(payloadFromResourceWithContentType("/user_tenant_role_list.json", APPLICATION_JSON)).build())
|
HttpResponse.builder().statusCode(200).payload(payloadFromResourceWithContentType("/user_tenant_role_list.json", APPLICATION_JSON)).build())
|
||||||
.getUserClient().get();
|
.getUserApi().get();
|
||||||
Set<Role> roles = client.listRolesOfUser("3f6c1c9ba993495ead7d2eb2192e284f");
|
Set<Role> roles = api.listRolesOfUser("3f6c1c9ba993495ead7d2eb2192e284f");
|
||||||
assertNotNull(roles);
|
assertNotNull(roles);
|
||||||
assertFalse(roles.isEmpty());
|
assertFalse(roles.isEmpty());
|
||||||
assertEquals(roles, ImmutableSet.of(
|
assertEquals(roles, ImmutableSet.of(
|
||||||
|
@ -164,11 +164,11 @@ public class UserClientExpectTest extends BaseKeystoneRestClientExpectTest<Keyst
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testListRolesOfUserInTenantFailNotFound() {
|
public void testListRolesOfUserInTenantFailNotFound() {
|
||||||
UserClient client = requestsSendResponses(
|
UserApi api = requestsSendResponses(
|
||||||
keystoneAuthWithUsernameAndPassword, responseWithKeystoneAccess,
|
keystoneAuthWithUsernameAndPassword, responseWithKeystoneAccess,
|
||||||
authenticatedGET().endpoint(endpoint + "/v2.0/users/3f6c1c9ba993495ead7d2eb2192e284f/roles").build(),
|
authenticatedGET().endpoint(endpoint + "/v2.0/users/3f6c1c9ba993495ead7d2eb2192e284f/roles").build(),
|
||||||
HttpResponse.builder().statusCode(404).build()).getUserClient().get();
|
HttpResponse.builder().statusCode(404).build()).getUserApi().get();
|
||||||
assertTrue(client.listRolesOfUser("3f6c1c9ba993495ead7d2eb2192e284f").isEmpty());
|
assertTrue(api.listRolesOfUser("3f6c1c9ba993495ead7d2eb2192e284f").isEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -27,25 +27,25 @@ import java.util.Set;
|
||||||
import org.jclouds.openstack.keystone.v2_0.domain.Role;
|
import org.jclouds.openstack.keystone.v2_0.domain.Role;
|
||||||
import org.jclouds.openstack.keystone.v2_0.domain.Tenant;
|
import org.jclouds.openstack.keystone.v2_0.domain.Tenant;
|
||||||
import org.jclouds.openstack.keystone.v2_0.domain.User;
|
import org.jclouds.openstack.keystone.v2_0.domain.User;
|
||||||
import org.jclouds.openstack.keystone.v2_0.internal.BaseKeystoneClientLiveTest;
|
import org.jclouds.openstack.keystone.v2_0.internal.BaseKeystoneApiLiveTest;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests UserClient
|
* Tests UserApi
|
||||||
*
|
*
|
||||||
* @author Adam Lowe
|
* @author Adam Lowe
|
||||||
*/
|
*/
|
||||||
@Test(groups = "live", testName = "UserClientLiveTest", singleThreaded = true)
|
@Test(groups = "live", testName = "UserApiLiveTest", singleThreaded = true)
|
||||||
public class UserClientLiveTest extends BaseKeystoneClientLiveTest {
|
public class UserApiLiveTest extends BaseKeystoneApiLiveTest {
|
||||||
|
|
||||||
public void testUsers() {
|
public void testUsers() {
|
||||||
|
|
||||||
UserClient client = keystoneContext.getApi().getUserClient().get();
|
UserApi api = keystoneContext.getApi().getUserApi().get();
|
||||||
Set<User> users = client.list();
|
Set<User> users = api.list();
|
||||||
assertNotNull(users);
|
assertNotNull(users);
|
||||||
assertFalse(users.isEmpty());
|
assertFalse(users.isEmpty());
|
||||||
for (User user : users) {
|
for (User user : users) {
|
||||||
User aUser = client.get(user.getId());
|
User aUser = api.get(user.getId());
|
||||||
assertEquals(aUser, user);
|
assertEquals(aUser, user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,13 +53,13 @@ public class UserClientLiveTest extends BaseKeystoneClientLiveTest {
|
||||||
|
|
||||||
public void testUserRolesOnTenant() {
|
public void testUserRolesOnTenant() {
|
||||||
|
|
||||||
UserClient client = keystoneContext.getApi().getUserClient().get();
|
UserApi api = keystoneContext.getApi().getUserApi().get();
|
||||||
Set<User> users = client.list();
|
Set<User> users = api.list();
|
||||||
Set<Tenant> tenants = keystoneContext.getApi().getTenantClient().get().list();
|
Set<Tenant> tenants = keystoneContext.getApi().getTenantApi().get().list();
|
||||||
|
|
||||||
for (User user : users) {
|
for (User user : users) {
|
||||||
for (Tenant tenant : tenants) {
|
for (Tenant tenant : tenants) {
|
||||||
Set<Role> roles = client.listRolesOfUserOnTenant(user.getId(), tenant.getId());
|
Set<Role> roles = api.listRolesOfUserOnTenant(user.getId(), tenant.getId());
|
||||||
for (Role role : roles) {
|
for (Role role : roles) {
|
||||||
assertNotNull(role.getId());
|
assertNotNull(role.getId());
|
||||||
}
|
}
|
||||||
|
@ -70,9 +70,9 @@ public class UserClientLiveTest extends BaseKeystoneClientLiveTest {
|
||||||
|
|
||||||
public void testListRolesOfUser() {
|
public void testListRolesOfUser() {
|
||||||
|
|
||||||
UserClient client = keystoneContext.getApi().getUserClient().get();
|
UserApi api = keystoneContext.getApi().getUserApi().get();
|
||||||
for (User user : client.list()) {
|
for (User user : api.list()) {
|
||||||
Set<Role> roles = client.listRolesOfUser(user.getId());
|
Set<Role> roles = api.listRolesOfUser(user.getId());
|
||||||
for (Role role : roles) {
|
for (Role role : roles) {
|
||||||
assertNotNull(role.getId());
|
assertNotNull(role.getId());
|
||||||
}
|
}
|
||||||
|
@ -82,9 +82,9 @@ public class UserClientLiveTest extends BaseKeystoneClientLiveTest {
|
||||||
|
|
||||||
public void testUsersByName() {
|
public void testUsersByName() {
|
||||||
|
|
||||||
UserClient client = keystoneContext.getApi().getUserClient().get();
|
UserApi api = keystoneContext.getApi().getUserApi().get();
|
||||||
for (User user : client.list()) {
|
for (User user : api.list()) {
|
||||||
User aUser = client.getByName(user.getName());
|
User aUser = api.getByName(user.getName());
|
||||||
assertEquals(aUser, user);
|
assertEquals(aUser, user);
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,8 +22,8 @@ import java.util.Properties;
|
||||||
|
|
||||||
import org.jclouds.apis.BaseContextLiveTest;
|
import org.jclouds.apis.BaseContextLiveTest;
|
||||||
import org.jclouds.openstack.keystone.v2_0.KeystoneApiMetadata;
|
import org.jclouds.openstack.keystone.v2_0.KeystoneApiMetadata;
|
||||||
import org.jclouds.openstack.keystone.v2_0.KeystoneAsyncClient;
|
import org.jclouds.openstack.keystone.v2_0.KeystoneAsyncApi;
|
||||||
import org.jclouds.openstack.keystone.v2_0.KeystoneClient;
|
import org.jclouds.openstack.keystone.v2_0.KeystoneApi;
|
||||||
import org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties;
|
import org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties;
|
||||||
import org.jclouds.rest.RestContext;
|
import org.jclouds.rest.RestContext;
|
||||||
import org.testng.annotations.AfterGroups;
|
import org.testng.annotations.AfterGroups;
|
||||||
|
@ -33,18 +33,18 @@ import org.testng.annotations.Test;
|
||||||
import com.google.common.reflect.TypeToken;
|
import com.google.common.reflect.TypeToken;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests behavior of {@code KeystoneClient}
|
* Tests behavior of {@code KeystoneApi}
|
||||||
*
|
*
|
||||||
* @author Adam Lowe
|
* @author Adam Lowe
|
||||||
*/
|
*/
|
||||||
@Test(groups = "live")
|
@Test(groups = "live")
|
||||||
public class BaseKeystoneClientLiveTest extends BaseContextLiveTest<RestContext<? extends KeystoneClient,? extends KeystoneAsyncClient>> {
|
public class BaseKeystoneApiLiveTest extends BaseContextLiveTest<RestContext<? extends KeystoneApi,? extends KeystoneAsyncApi>> {
|
||||||
|
|
||||||
public BaseKeystoneClientLiveTest() {
|
public BaseKeystoneApiLiveTest() {
|
||||||
provider = "openstack-keystone";
|
provider = "openstack-keystone";
|
||||||
}
|
}
|
||||||
|
|
||||||
protected RestContext<? extends KeystoneClient,? extends KeystoneAsyncClient> keystoneContext;
|
protected RestContext<? extends KeystoneApi,? extends KeystoneAsyncApi> keystoneContext;
|
||||||
|
|
||||||
@BeforeGroups(groups = { "integration", "live" })
|
@BeforeGroups(groups = { "integration", "live" })
|
||||||
@Override
|
@Override
|
||||||
|
@ -67,7 +67,7 @@ public class BaseKeystoneClientLiveTest extends BaseContextLiveTest<RestContext<
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected TypeToken<RestContext<? extends KeystoneClient,? extends KeystoneAsyncClient>> contextType() {
|
protected TypeToken<RestContext<? extends KeystoneApi,? extends KeystoneAsyncApi>> contextType() {
|
||||||
return KeystoneApiMetadata.CONTEXT_TOKEN;
|
return KeystoneApiMetadata.CONTEXT_TOKEN;
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,23 +29,23 @@ import org.jclouds.http.HttpRequest;
|
||||||
import org.jclouds.http.HttpResponse;
|
import org.jclouds.http.HttpResponse;
|
||||||
import org.jclouds.openstack.keystone.v2_0.KeystoneApiMetadata;
|
import org.jclouds.openstack.keystone.v2_0.KeystoneApiMetadata;
|
||||||
import org.jclouds.openstack.v2_0.ServiceType;
|
import org.jclouds.openstack.v2_0.ServiceType;
|
||||||
import org.jclouds.rest.internal.BaseRestClientExpectTest;
|
import org.jclouds.rest.internal.BaseRestApiExpectTest;
|
||||||
|
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base class for writing KeyStone 2.0 Rest Client Expect tests
|
* Base class for writing KeyStone 2.0 Rest Api Expect tests
|
||||||
*
|
*
|
||||||
* @author Adam Lowe
|
* @author Adam Lowe
|
||||||
*/
|
*/
|
||||||
public class BaseKeystoneRestClientExpectTest<S> extends BaseRestClientExpectTest<S> {
|
public class BaseKeystoneRestApiExpectTest<S> extends BaseRestApiExpectTest<S> {
|
||||||
protected HttpRequest keystoneAuthWithUsernameAndPassword;
|
protected HttpRequest keystoneAuthWithUsernameAndPassword;
|
||||||
protected HttpRequest keystoneAuthWithAccessKeyAndSecretKey;
|
protected HttpRequest keystoneAuthWithAccessKeyAndSecretKey;
|
||||||
protected String authToken;
|
protected String authToken;
|
||||||
protected HttpResponse responseWithKeystoneAccess;
|
protected HttpResponse responseWithKeystoneAccess;
|
||||||
protected String endpoint = "http://localhost:5000";
|
protected String endpoint = "http://localhost:5000";
|
||||||
|
|
||||||
public BaseKeystoneRestClientExpectTest() {
|
public BaseKeystoneRestApiExpectTest() {
|
||||||
provider = "openstack-keystone";
|
provider = "openstack-keystone";
|
||||||
keystoneAuthWithUsernameAndPassword = KeystoneFixture.INSTANCE.initialAuthWithUsernameAndPasswordAndTenantName(identity,
|
keystoneAuthWithUsernameAndPassword = KeystoneFixture.INSTANCE.initialAuthWithUsernameAndPasswordAndTenantName(identity,
|
||||||
credential);
|
credential);
|
|
@ -31,7 +31,7 @@ import com.google.common.base.Throwables;
|
||||||
import com.google.common.net.HttpHeaders;
|
import com.google.common.net.HttpHeaders;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base class for writing KeyStone Rest Client Expect tests
|
* Base class for writing KeyStone Rest Api Expect tests
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -25,24 +25,24 @@ import org.jclouds.concurrent.Timeout;
|
||||||
import org.jclouds.javax.annotation.Nullable;
|
import org.jclouds.javax.annotation.Nullable;
|
||||||
import org.jclouds.location.Zone;
|
import org.jclouds.location.Zone;
|
||||||
import org.jclouds.location.functions.ZoneToEndpoint;
|
import org.jclouds.location.functions.ZoneToEndpoint;
|
||||||
import org.jclouds.openstack.nova.v2_0.extensions.AdminActionsClient;
|
import org.jclouds.openstack.nova.v2_0.extensions.AdminActionsApi;
|
||||||
import org.jclouds.openstack.nova.v2_0.extensions.FlavorExtraSpecsClient;
|
import org.jclouds.openstack.nova.v2_0.extensions.FlavorExtraSpecsApi;
|
||||||
import org.jclouds.openstack.nova.v2_0.extensions.FloatingIPClient;
|
import org.jclouds.openstack.nova.v2_0.extensions.FloatingIPApi;
|
||||||
import org.jclouds.openstack.nova.v2_0.extensions.HostAdministrationClient;
|
import org.jclouds.openstack.nova.v2_0.extensions.HostAdministrationApi;
|
||||||
import org.jclouds.openstack.nova.v2_0.extensions.HostAggregateClient;
|
import org.jclouds.openstack.nova.v2_0.extensions.HostAggregateApi;
|
||||||
import org.jclouds.openstack.nova.v2_0.extensions.KeyPairClient;
|
import org.jclouds.openstack.nova.v2_0.extensions.KeyPairApi;
|
||||||
import org.jclouds.openstack.nova.v2_0.extensions.QuotaClassClient;
|
import org.jclouds.openstack.nova.v2_0.extensions.QuotaClassApi;
|
||||||
import org.jclouds.openstack.nova.v2_0.extensions.QuotaClient;
|
import org.jclouds.openstack.nova.v2_0.extensions.QuotaApi;
|
||||||
import org.jclouds.openstack.nova.v2_0.extensions.SecurityGroupClient;
|
import org.jclouds.openstack.nova.v2_0.extensions.SecurityGroupApi;
|
||||||
import org.jclouds.openstack.nova.v2_0.extensions.ServerWithSecurityGroupsClient;
|
import org.jclouds.openstack.nova.v2_0.extensions.ServerWithSecurityGroupsApi;
|
||||||
import org.jclouds.openstack.nova.v2_0.extensions.SimpleTenantUsageClient;
|
import org.jclouds.openstack.nova.v2_0.extensions.SimpleTenantUsageApi;
|
||||||
import org.jclouds.openstack.nova.v2_0.extensions.VirtualInterfaceClient;
|
import org.jclouds.openstack.nova.v2_0.extensions.VirtualInterfaceApi;
|
||||||
import org.jclouds.openstack.nova.v2_0.extensions.VolumeClient;
|
import org.jclouds.openstack.nova.v2_0.extensions.VolumeApi;
|
||||||
import org.jclouds.openstack.nova.v2_0.extensions.VolumeTypeClient;
|
import org.jclouds.openstack.nova.v2_0.extensions.VolumeTypeApi;
|
||||||
import org.jclouds.openstack.nova.v2_0.features.ExtensionClient;
|
import org.jclouds.openstack.nova.v2_0.features.ExtensionApi;
|
||||||
import org.jclouds.openstack.nova.v2_0.features.FlavorClient;
|
import org.jclouds.openstack.nova.v2_0.features.FlavorApi;
|
||||||
import org.jclouds.openstack.nova.v2_0.features.ImageClient;
|
import org.jclouds.openstack.nova.v2_0.features.ImageApi;
|
||||||
import org.jclouds.openstack.nova.v2_0.features.ServerClient;
|
import org.jclouds.openstack.nova.v2_0.features.ServerApi;
|
||||||
import org.jclouds.rest.annotations.Delegate;
|
import org.jclouds.rest.annotations.Delegate;
|
||||||
import org.jclouds.rest.annotations.EndpointParam;
|
import org.jclouds.rest.annotations.EndpointParam;
|
||||||
|
|
||||||
|
@ -53,13 +53,13 @@ import com.google.inject.Provides;
|
||||||
* Provides synchronous access to Nova.
|
* Provides synchronous access to Nova.
|
||||||
* <p/>
|
* <p/>
|
||||||
*
|
*
|
||||||
* @see NovaAsyncClient
|
* @see NovaAsyncApi
|
||||||
* @see <a href="http://docs.openstack.org/api/openstack-compute/1.1/content/"
|
* @see <a href="http://docs.openstack.org/api/openstack-compute/1.1/content/"
|
||||||
* />
|
* />
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
@Timeout(duration = 60, timeUnit = TimeUnit.SECONDS)
|
@Timeout(duration = 60, timeUnit = TimeUnit.SECONDS)
|
||||||
public interface NovaClient {
|
public interface NovaApi {
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return the Zone codes configured
|
* @return the Zone codes configured
|
||||||
|
@ -72,126 +72,126 @@ public interface NovaClient {
|
||||||
* Provides synchronous access to Server features.
|
* Provides synchronous access to Server features.
|
||||||
*/
|
*/
|
||||||
@Delegate
|
@Delegate
|
||||||
ServerClient getServerClientForZone(
|
ServerApi getServerApiForZone(
|
||||||
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
|
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides synchronous access to Flavor features.
|
* Provides synchronous access to Flavor features.
|
||||||
*/
|
*/
|
||||||
@Delegate
|
@Delegate
|
||||||
FlavorClient getFlavorClientForZone(
|
FlavorApi getFlavorApiForZone(
|
||||||
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
|
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides synchronous access to Extension features.
|
* Provides synchronous access to Extension features.
|
||||||
*/
|
*/
|
||||||
@Delegate
|
@Delegate
|
||||||
ExtensionClient getExtensionClientForZone(
|
ExtensionApi getExtensionApiForZone(
|
||||||
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
|
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides synchronous access to Image features.
|
* Provides synchronous access to Image features.
|
||||||
*/
|
*/
|
||||||
@Delegate
|
@Delegate
|
||||||
ImageClient getImageClientForZone(
|
ImageApi getImageApiForZone(
|
||||||
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
|
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides synchronous access to Floating IP features.
|
* Provides synchronous access to Floating IP features.
|
||||||
*/
|
*/
|
||||||
@Delegate
|
@Delegate
|
||||||
Optional<FloatingIPClient> getFloatingIPExtensionForZone(
|
Optional<FloatingIPApi> getFloatingIPExtensionForZone(
|
||||||
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
|
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides synchronous access to Security Group features.
|
* Provides synchronous access to Security Group features.
|
||||||
*/
|
*/
|
||||||
@Delegate
|
@Delegate
|
||||||
Optional<SecurityGroupClient> getSecurityGroupExtensionForZone(
|
Optional<SecurityGroupApi> getSecurityGroupExtensionForZone(
|
||||||
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
|
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides synchronous access to Key Pair features.
|
* Provides synchronous access to Key Pair features.
|
||||||
*/
|
*/
|
||||||
@Delegate
|
@Delegate
|
||||||
Optional<KeyPairClient> getKeyPairExtensionForZone(
|
Optional<KeyPairApi> getKeyPairExtensionForZone(
|
||||||
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
|
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides synchronous access to Host Administration features.
|
* Provides synchronous access to Host Administration features.
|
||||||
*/
|
*/
|
||||||
@Delegate
|
@Delegate
|
||||||
Optional<HostAdministrationClient> getHostAdministrationExtensionForZone(
|
Optional<HostAdministrationApi> getHostAdministrationExtensionForZone(
|
||||||
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
|
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides synchronous access to Simple Tenant Usage features.
|
* Provides synchronous access to Simple Tenant Usage features.
|
||||||
*/
|
*/
|
||||||
@Delegate
|
@Delegate
|
||||||
Optional<SimpleTenantUsageClient> getSimpleTenantUsageExtensionForZone(
|
Optional<SimpleTenantUsageApi> getSimpleTenantUsageExtensionForZone(
|
||||||
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
|
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides synchronous access to Volume features.
|
* Provides synchronous access to Volume features.
|
||||||
*/
|
*/
|
||||||
@Delegate
|
@Delegate
|
||||||
Optional<VolumeClient> getVolumeExtensionForZone(
|
Optional<VolumeApi> getVolumeExtensionForZone(
|
||||||
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
|
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides synchronous access to Virtual Interface features.
|
* Provides synchronous access to Virtual Interface features.
|
||||||
*/
|
*/
|
||||||
@Delegate
|
@Delegate
|
||||||
Optional<VirtualInterfaceClient> getVirtualInterfaceExtensionForZone(
|
Optional<VirtualInterfaceApi> getVirtualInterfaceExtensionForZone(
|
||||||
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
|
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides synchronous access to Server Extra Data features.
|
* Provides synchronous access to Server Extra Data features.
|
||||||
*/
|
*/
|
||||||
@Delegate
|
@Delegate
|
||||||
Optional<ServerWithSecurityGroupsClient> getServerWithSecurityGroupsExtensionForZone(
|
Optional<ServerWithSecurityGroupsApi> getServerWithSecurityGroupsExtensionForZone(
|
||||||
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
|
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides synchronous access to Server Admin Actions features.
|
* Provides synchronous access to Server Admin Actions features.
|
||||||
*/
|
*/
|
||||||
@Delegate
|
@Delegate
|
||||||
Optional<AdminActionsClient> getAdminActionsExtensionForZone(
|
Optional<AdminActionsApi> getAdminActionsExtensionForZone(
|
||||||
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
|
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides synchronous access to Aggregate features.
|
* Provides synchronous access to Aggregate features.
|
||||||
*/
|
*/
|
||||||
@Delegate
|
@Delegate
|
||||||
Optional<HostAggregateClient> getHostAggregateExtensionForZone(
|
Optional<HostAggregateApi> getHostAggregateExtensionForZone(
|
||||||
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
|
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides synchronous access to Flavor extra specs features.
|
* Provides synchronous access to Flavor extra specs features.
|
||||||
*/
|
*/
|
||||||
@Delegate
|
@Delegate
|
||||||
Optional<FlavorExtraSpecsClient> getFlavorExtraSpecsExtensionForZone(
|
Optional<FlavorExtraSpecsApi> getFlavorExtraSpecsExtensionForZone(
|
||||||
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
|
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides synchronous access to Quota features.
|
* Provides synchronous access to Quota features.
|
||||||
*/
|
*/
|
||||||
@Delegate
|
@Delegate
|
||||||
Optional<QuotaClient> getQuotaExtensionForZone(
|
Optional<QuotaApi> getQuotaExtensionForZone(
|
||||||
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
|
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides synchronous access to Quota Classes features.
|
* Provides synchronous access to Quota Classes features.
|
||||||
*/
|
*/
|
||||||
@Delegate
|
@Delegate
|
||||||
Optional<QuotaClassClient> getQuotaClassExtensionForZone(
|
Optional<QuotaClassApi> getQuotaClassExtensionForZone(
|
||||||
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
|
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides synchronous access to Volume Type features.
|
* Provides synchronous access to Volume Type features.
|
||||||
*/
|
*/
|
||||||
@Delegate
|
@Delegate
|
||||||
Optional<VolumeTypeClient> getVolumeTypeExtensionForZone(
|
Optional<VolumeTypeApi> getVolumeTypeExtensionForZone(
|
||||||
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
|
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
|
||||||
|
|
||||||
}
|
}
|
|
@ -53,7 +53,7 @@ public class NovaApiMetadata extends BaseRestApiMetadata {
|
||||||
/** The serialVersionUID */
|
/** The serialVersionUID */
|
||||||
private static final long serialVersionUID = 6725672099385580694L;
|
private static final long serialVersionUID = 6725672099385580694L;
|
||||||
|
|
||||||
public static final TypeToken<RestContext<NovaClient, NovaAsyncClient>> CONTEXT_TOKEN = new TypeToken<RestContext<NovaClient, NovaAsyncClient>>() {
|
public static final TypeToken<RestContext<NovaApi, NovaAsyncApi>> CONTEXT_TOKEN = new TypeToken<RestContext<NovaApi, NovaAsyncApi>>() {
|
||||||
private static final long serialVersionUID = -5070937833892503232L;
|
private static final long serialVersionUID = -5070937833892503232L;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ public class NovaApiMetadata extends BaseRestApiMetadata {
|
||||||
public static class Builder extends BaseRestApiMetadata.Builder {
|
public static class Builder extends BaseRestApiMetadata.Builder {
|
||||||
|
|
||||||
protected Builder() {
|
protected Builder() {
|
||||||
super(NovaClient.class, NovaAsyncClient.class);
|
super(NovaApi.class, NovaAsyncApi.class);
|
||||||
id("openstack-nova")
|
id("openstack-nova")
|
||||||
.name("OpenStack Nova Diablo+ API")
|
.name("OpenStack Nova Diablo+ API")
|
||||||
.identityName("tenantName:user or user")
|
.identityName("tenantName:user or user")
|
||||||
|
|
|
@ -23,24 +23,24 @@ import java.util.Set;
|
||||||
import org.jclouds.javax.annotation.Nullable;
|
import org.jclouds.javax.annotation.Nullable;
|
||||||
import org.jclouds.location.Zone;
|
import org.jclouds.location.Zone;
|
||||||
import org.jclouds.location.functions.ZoneToEndpoint;
|
import org.jclouds.location.functions.ZoneToEndpoint;
|
||||||
import org.jclouds.openstack.nova.v2_0.extensions.AdminActionsAsyncClient;
|
import org.jclouds.openstack.nova.v2_0.extensions.AdminActionsAsyncApi;
|
||||||
import org.jclouds.openstack.nova.v2_0.extensions.FlavorExtraSpecsAsyncClient;
|
import org.jclouds.openstack.nova.v2_0.extensions.FlavorExtraSpecsAsyncApi;
|
||||||
import org.jclouds.openstack.nova.v2_0.extensions.FloatingIPAsyncClient;
|
import org.jclouds.openstack.nova.v2_0.extensions.FloatingIPAsyncApi;
|
||||||
import org.jclouds.openstack.nova.v2_0.extensions.HostAdministrationAsyncClient;
|
import org.jclouds.openstack.nova.v2_0.extensions.HostAdministrationAsyncApi;
|
||||||
import org.jclouds.openstack.nova.v2_0.extensions.HostAggregateAsyncClient;
|
import org.jclouds.openstack.nova.v2_0.extensions.HostAggregateAsyncApi;
|
||||||
import org.jclouds.openstack.nova.v2_0.extensions.KeyPairAsyncClient;
|
import org.jclouds.openstack.nova.v2_0.extensions.KeyPairAsyncApi;
|
||||||
import org.jclouds.openstack.nova.v2_0.extensions.QuotaAsyncClient;
|
import org.jclouds.openstack.nova.v2_0.extensions.QuotaAsyncApi;
|
||||||
import org.jclouds.openstack.nova.v2_0.extensions.QuotaClassAsyncClient;
|
import org.jclouds.openstack.nova.v2_0.extensions.QuotaClassAsyncApi;
|
||||||
import org.jclouds.openstack.nova.v2_0.extensions.SecurityGroupAsyncClient;
|
import org.jclouds.openstack.nova.v2_0.extensions.SecurityGroupAsyncApi;
|
||||||
import org.jclouds.openstack.nova.v2_0.extensions.ServerWithSecurityGroupsAsyncClient;
|
import org.jclouds.openstack.nova.v2_0.extensions.ServerWithSecurityGroupsAsyncApi;
|
||||||
import org.jclouds.openstack.nova.v2_0.extensions.SimpleTenantUsageAsyncClient;
|
import org.jclouds.openstack.nova.v2_0.extensions.SimpleTenantUsageAsyncApi;
|
||||||
import org.jclouds.openstack.nova.v2_0.extensions.VirtualInterfaceAsyncClient;
|
import org.jclouds.openstack.nova.v2_0.extensions.VirtualInterfaceAsyncApi;
|
||||||
import org.jclouds.openstack.nova.v2_0.extensions.VolumeAsyncClient;
|
import org.jclouds.openstack.nova.v2_0.extensions.VolumeAsyncApi;
|
||||||
import org.jclouds.openstack.nova.v2_0.extensions.VolumeTypeAsyncClient;
|
import org.jclouds.openstack.nova.v2_0.extensions.VolumeTypeAsyncApi;
|
||||||
import org.jclouds.openstack.nova.v2_0.features.ExtensionAsyncClient;
|
import org.jclouds.openstack.nova.v2_0.features.ExtensionAsyncApi;
|
||||||
import org.jclouds.openstack.nova.v2_0.features.FlavorAsyncClient;
|
import org.jclouds.openstack.nova.v2_0.features.FlavorAsyncApi;
|
||||||
import org.jclouds.openstack.nova.v2_0.features.ImageAsyncClient;
|
import org.jclouds.openstack.nova.v2_0.features.ImageAsyncApi;
|
||||||
import org.jclouds.openstack.nova.v2_0.features.ServerAsyncClient;
|
import org.jclouds.openstack.nova.v2_0.features.ServerAsyncApi;
|
||||||
import org.jclouds.rest.annotations.Delegate;
|
import org.jclouds.rest.annotations.Delegate;
|
||||||
import org.jclouds.rest.annotations.EndpointParam;
|
import org.jclouds.rest.annotations.EndpointParam;
|
||||||
|
|
||||||
|
@ -51,12 +51,12 @@ import com.google.inject.Provides;
|
||||||
* Provides asynchronous access to Nova via their REST API.
|
* Provides asynchronous access to Nova via their REST API.
|
||||||
* <p/>
|
* <p/>
|
||||||
*
|
*
|
||||||
* @see NovaClient
|
* @see NovaApi
|
||||||
* @see <a href="http://docs.openstack.org/api/openstack-compute/1.1/content/"
|
* @see <a href="http://docs.openstack.org/api/openstack-compute/1.1/content/"
|
||||||
* />
|
* />
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
public interface NovaAsyncClient {
|
public interface NovaAsyncApi {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -70,77 +70,77 @@ public interface NovaAsyncClient {
|
||||||
* Provides asynchronous access to Server features.
|
* Provides asynchronous access to Server features.
|
||||||
*/
|
*/
|
||||||
@Delegate
|
@Delegate
|
||||||
ServerAsyncClient getServerClientForZone(
|
ServerAsyncApi getServerApiForZone(
|
||||||
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
|
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides asynchronous access to Flavor features.
|
* Provides asynchronous access to Flavor features.
|
||||||
*/
|
*/
|
||||||
@Delegate
|
@Delegate
|
||||||
FlavorAsyncClient getFlavorClientForZone(
|
FlavorAsyncApi getFlavorApiForZone(
|
||||||
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
|
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides asynchronous access to Extension features.
|
* Provides asynchronous access to Extension features.
|
||||||
*/
|
*/
|
||||||
@Delegate
|
@Delegate
|
||||||
ExtensionAsyncClient getExtensionClientForZone(
|
ExtensionAsyncApi getExtensionApiForZone(
|
||||||
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
|
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides asynchronous access to Image features.
|
* Provides asynchronous access to Image features.
|
||||||
*/
|
*/
|
||||||
@Delegate
|
@Delegate
|
||||||
ImageAsyncClient getImageClientForZone(
|
ImageAsyncApi getImageApiForZone(
|
||||||
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
|
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides asynchronous access to Floating IP features.
|
* Provides asynchronous access to Floating IP features.
|
||||||
*/
|
*/
|
||||||
@Delegate
|
@Delegate
|
||||||
Optional<FloatingIPAsyncClient> getFloatingIPExtensionForZone(
|
Optional<FloatingIPAsyncApi> getFloatingIPExtensionForZone(
|
||||||
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
|
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides asynchronous access to Security Group features.
|
* Provides asynchronous access to Security Group features.
|
||||||
*/
|
*/
|
||||||
@Delegate
|
@Delegate
|
||||||
Optional<SecurityGroupAsyncClient> getSecurityGroupExtensionForZone(
|
Optional<SecurityGroupAsyncApi> getSecurityGroupExtensionForZone(
|
||||||
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
|
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides asynchronous access to Key Pair features.
|
* Provides asynchronous access to Key Pair features.
|
||||||
*/
|
*/
|
||||||
@Delegate
|
@Delegate
|
||||||
Optional<KeyPairAsyncClient> getKeyPairExtensionForZone(
|
Optional<KeyPairAsyncApi> getKeyPairExtensionForZone(
|
||||||
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
|
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides asynchronous access to Host Administration features.
|
* Provides asynchronous access to Host Administration features.
|
||||||
*/
|
*/
|
||||||
@Delegate
|
@Delegate
|
||||||
Optional<HostAdministrationAsyncClient> getHostAdministrationExtensionForZone(
|
Optional<HostAdministrationAsyncApi> getHostAdministrationExtensionForZone(
|
||||||
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
|
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides asynchronous access to Simple Tenant Usage features.
|
* Provides asynchronous access to Simple Tenant Usage features.
|
||||||
*/
|
*/
|
||||||
@Delegate
|
@Delegate
|
||||||
Optional<SimpleTenantUsageAsyncClient> getSimpleTenantUsageExtensionForZone(
|
Optional<SimpleTenantUsageAsyncApi> getSimpleTenantUsageExtensionForZone(
|
||||||
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
|
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides asynchronous access to Volume features.
|
* Provides asynchronous access to Volume features.
|
||||||
*/
|
*/
|
||||||
@Delegate
|
@Delegate
|
||||||
Optional<VolumeAsyncClient> getVolumeExtensionForZone(
|
Optional<VolumeAsyncApi> getVolumeExtensionForZone(
|
||||||
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
|
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides asynchronous access to Virtual Interface features.
|
* Provides asynchronous access to Virtual Interface features.
|
||||||
*/
|
*/
|
||||||
@Delegate
|
@Delegate
|
||||||
Optional<VirtualInterfaceAsyncClient> getVirtualInterfaceExtensionForZone(
|
Optional<VirtualInterfaceAsyncApi> getVirtualInterfaceExtensionForZone(
|
||||||
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
|
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
|
||||||
|
|
||||||
|
|
||||||
|
@ -148,49 +148,49 @@ public interface NovaAsyncClient {
|
||||||
* Provides asynchronous access to Server Extra Data features.
|
* Provides asynchronous access to Server Extra Data features.
|
||||||
*/
|
*/
|
||||||
@Delegate
|
@Delegate
|
||||||
Optional<ServerWithSecurityGroupsAsyncClient> getServerWithSecurityGroupsExtensionForZone(
|
Optional<ServerWithSecurityGroupsAsyncApi> getServerWithSecurityGroupsExtensionForZone(
|
||||||
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
|
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides asynchronous access to Server Admin Actions features.
|
* Provides asynchronous access to Server Admin Actions features.
|
||||||
*/
|
*/
|
||||||
@Delegate
|
@Delegate
|
||||||
Optional<AdminActionsAsyncClient> getAdminActionsExtensionForZone(
|
Optional<AdminActionsAsyncApi> getAdminActionsExtensionForZone(
|
||||||
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
|
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides asynchronous access to HostAggregate features.
|
* Provides asynchronous access to HostAggregate features.
|
||||||
*/
|
*/
|
||||||
@Delegate
|
@Delegate
|
||||||
Optional<HostAggregateAsyncClient> getHostAggregateExtensionForZone(
|
Optional<HostAggregateAsyncApi> getHostAggregateExtensionForZone(
|
||||||
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
|
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides asynchronous access to Flavor extra specs features.
|
* Provides asynchronous access to Flavor extra specs features.
|
||||||
*/
|
*/
|
||||||
@Delegate
|
@Delegate
|
||||||
Optional<FlavorExtraSpecsAsyncClient> getFlavorExtraSpecsExtensionForZone(
|
Optional<FlavorExtraSpecsAsyncApi> getFlavorExtraSpecsExtensionForZone(
|
||||||
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
|
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides asynchronous access to Quota features.
|
* Provides asynchronous access to Quota features.
|
||||||
*/
|
*/
|
||||||
@Delegate
|
@Delegate
|
||||||
Optional<QuotaAsyncClient> getQuotaExtensionForZone(
|
Optional<QuotaAsyncApi> getQuotaExtensionForZone(
|
||||||
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
|
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides asynchronous access to Quota Classes features.
|
* Provides asynchronous access to Quota Classes features.
|
||||||
*/
|
*/
|
||||||
@Delegate
|
@Delegate
|
||||||
Optional<QuotaClassAsyncClient> getQuotaClassExtensionForZone(
|
Optional<QuotaClassAsyncApi> getQuotaClassExtensionForZone(
|
||||||
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
|
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides asynchronous access to Volume Type features.
|
* Provides asynchronous access to Volume Type features.
|
||||||
*/
|
*/
|
||||||
@Delegate
|
@Delegate
|
||||||
Optional<VolumeTypeAsyncClient> getVolumeTypeExtensionForZone(
|
Optional<VolumeTypeAsyncApi> getVolumeTypeExtensionForZone(
|
||||||
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
|
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
|
||||||
|
|
||||||
}
|
}
|
|
@ -57,14 +57,14 @@ import org.jclouds.compute.strategy.ResumeNodeStrategy;
|
||||||
import org.jclouds.compute.strategy.SuspendNodeStrategy;
|
import org.jclouds.compute.strategy.SuspendNodeStrategy;
|
||||||
import org.jclouds.domain.Credentials;
|
import org.jclouds.domain.Credentials;
|
||||||
import org.jclouds.domain.Location;
|
import org.jclouds.domain.Location;
|
||||||
import org.jclouds.openstack.nova.v2_0.NovaClient;
|
import org.jclouds.openstack.nova.v2_0.NovaApi;
|
||||||
import org.jclouds.openstack.nova.v2_0.compute.options.NovaTemplateOptions;
|
import org.jclouds.openstack.nova.v2_0.compute.options.NovaTemplateOptions;
|
||||||
import org.jclouds.openstack.nova.v2_0.domain.KeyPair;
|
import org.jclouds.openstack.nova.v2_0.domain.KeyPair;
|
||||||
import org.jclouds.openstack.nova.v2_0.domain.SecurityGroup;
|
import org.jclouds.openstack.nova.v2_0.domain.SecurityGroup;
|
||||||
import org.jclouds.openstack.nova.v2_0.domain.zonescoped.SecurityGroupInZone;
|
import org.jclouds.openstack.nova.v2_0.domain.zonescoped.SecurityGroupInZone;
|
||||||
import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndName;
|
import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndName;
|
||||||
import org.jclouds.openstack.nova.v2_0.extensions.KeyPairClient;
|
import org.jclouds.openstack.nova.v2_0.extensions.KeyPairApi;
|
||||||
import org.jclouds.openstack.nova.v2_0.extensions.SecurityGroupClient;
|
import org.jclouds.openstack.nova.v2_0.extensions.SecurityGroupApi;
|
||||||
import org.jclouds.openstack.nova.v2_0.predicates.KeyPairPredicates;
|
import org.jclouds.openstack.nova.v2_0.predicates.KeyPairPredicates;
|
||||||
import org.jclouds.openstack.nova.v2_0.predicates.SecurityGroupPredicates;
|
import org.jclouds.openstack.nova.v2_0.predicates.SecurityGroupPredicates;
|
||||||
import org.jclouds.scriptbuilder.functions.InitAdminAccess;
|
import org.jclouds.scriptbuilder.functions.InitAdminAccess;
|
||||||
|
@ -83,7 +83,7 @@ import com.google.common.collect.Multimap;
|
||||||
*/
|
*/
|
||||||
@Singleton
|
@Singleton
|
||||||
public class NovaComputeService extends BaseComputeService {
|
public class NovaComputeService extends BaseComputeService {
|
||||||
protected final NovaClient novaClient;
|
protected final NovaApi novaApi;
|
||||||
protected final LoadingCache<ZoneAndName, SecurityGroupInZone> securityGroupMap;
|
protected final LoadingCache<ZoneAndName, SecurityGroupInZone> securityGroupMap;
|
||||||
protected final LoadingCache<ZoneAndName, KeyPair> keyPairCache;
|
protected final LoadingCache<ZoneAndName, KeyPair> keyPairCache;
|
||||||
protected final Function<Set<? extends NodeMetadata>, Multimap<String, String>> orphanedGroupsByZoneId;
|
protected final Function<Set<? extends NodeMetadata>, Multimap<String, String>> orphanedGroupsByZoneId;
|
||||||
|
@ -104,7 +104,7 @@ public class NovaComputeService extends BaseComputeService {
|
||||||
InitializeRunScriptOnNodeOrPlaceInBadMap.Factory initScriptRunnerFactory,
|
InitializeRunScriptOnNodeOrPlaceInBadMap.Factory initScriptRunnerFactory,
|
||||||
RunScriptOnNode.Factory runScriptOnNodeFactory, InitAdminAccess initAdminAccess,
|
RunScriptOnNode.Factory runScriptOnNodeFactory, InitAdminAccess initAdminAccess,
|
||||||
PersistNodeCredentials persistNodeCredentials, Timeouts timeouts,
|
PersistNodeCredentials persistNodeCredentials, Timeouts timeouts,
|
||||||
@Named(Constants.PROPERTY_USER_THREADS) ExecutorService executor, NovaClient novaClient,
|
@Named(Constants.PROPERTY_USER_THREADS) ExecutorService executor, NovaApi novaApi,
|
||||||
LoadingCache<ZoneAndName, SecurityGroupInZone> securityGroupMap,
|
LoadingCache<ZoneAndName, SecurityGroupInZone> securityGroupMap,
|
||||||
LoadingCache<ZoneAndName, KeyPair> keyPairCache,
|
LoadingCache<ZoneAndName, KeyPair> keyPairCache,
|
||||||
Function<Set<? extends NodeMetadata>, Multimap<String, String>> orphanedGroupsByZoneId,
|
Function<Set<? extends NodeMetadata>, Multimap<String, String>> orphanedGroupsByZoneId,
|
||||||
|
@ -114,7 +114,7 @@ public class NovaComputeService extends BaseComputeService {
|
||||||
startNodeStrategy, stopNodeStrategy, templateBuilderProvider, templateOptionsProvider, nodeRunning,
|
startNodeStrategy, stopNodeStrategy, templateBuilderProvider, templateOptionsProvider, nodeRunning,
|
||||||
nodeTerminated, nodeSuspended, initScriptRunnerFactory, initAdminAccess, runScriptOnNodeFactory,
|
nodeTerminated, nodeSuspended, initScriptRunnerFactory, initAdminAccess, runScriptOnNodeFactory,
|
||||||
persistNodeCredentials, timeouts, executor, imageExtension);
|
persistNodeCredentials, timeouts, executor, imageExtension);
|
||||||
this.novaClient = checkNotNull(novaClient, "novaClient");
|
this.novaApi = checkNotNull(novaApi, "novaApi");
|
||||||
this.securityGroupMap = checkNotNull(securityGroupMap, "securityGroupMap");
|
this.securityGroupMap = checkNotNull(securityGroupMap, "securityGroupMap");
|
||||||
this.keyPairCache = checkNotNull(keyPairCache, "keyPairCache");
|
this.keyPairCache = checkNotNull(keyPairCache, "keyPairCache");
|
||||||
this.orphanedGroupsByZoneId = checkNotNull(orphanedGroupsByZoneId, "orphanedGroupsByZoneId");
|
this.orphanedGroupsByZoneId = checkNotNull(orphanedGroupsByZoneId, "orphanedGroupsByZoneId");
|
||||||
|
@ -135,14 +135,14 @@ public class NovaComputeService extends BaseComputeService {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void cleanupOrphanedSecurityGroupsInZone(Set<String> groups, String zoneId) {
|
private void cleanupOrphanedSecurityGroupsInZone(Set<String> groups, String zoneId) {
|
||||||
Optional<SecurityGroupClient> securityGroupClient = novaClient.getSecurityGroupExtensionForZone(zoneId);
|
Optional<SecurityGroupApi> securityGroupApi = novaApi.getSecurityGroupExtensionForZone(zoneId);
|
||||||
if (securityGroupClient.isPresent()) {
|
if (securityGroupApi.isPresent()) {
|
||||||
for (String group : groups) {
|
for (String group : groups) {
|
||||||
for (SecurityGroup securityGroup : Iterables.filter(securityGroupClient.get().listSecurityGroups(),
|
for (SecurityGroup securityGroup : Iterables.filter(securityGroupApi.get().listSecurityGroups(),
|
||||||
SecurityGroupPredicates.nameMatches(namingConvention.create().containsGroup(group)))) {
|
SecurityGroupPredicates.nameMatches(namingConvention.create().containsGroup(group)))) {
|
||||||
ZoneAndName zoneAndName = ZoneAndName.fromZoneAndName(zoneId, securityGroup.getName());
|
ZoneAndName zoneAndName = ZoneAndName.fromZoneAndName(zoneId, securityGroup.getName());
|
||||||
logger.debug(">> deleting securityGroup(%s)", zoneAndName);
|
logger.debug(">> deleting securityGroup(%s)", zoneAndName);
|
||||||
securityGroupClient.get().deleteSecurityGroup(securityGroup.getId());
|
securityGroupApi.get().deleteSecurityGroup(securityGroup.getId());
|
||||||
// TODO: test this clear happens
|
// TODO: test this clear happens
|
||||||
securityGroupMap.invalidate(zoneAndName);
|
securityGroupMap.invalidate(zoneAndName);
|
||||||
logger.debug("<< deleted securityGroup(%s)", zoneAndName);
|
logger.debug("<< deleted securityGroup(%s)", zoneAndName);
|
||||||
|
@ -152,15 +152,15 @@ public class NovaComputeService extends BaseComputeService {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void cleanupOrphanedKeyPairsInZone(Set<String> groups, String zoneId) {
|
private void cleanupOrphanedKeyPairsInZone(Set<String> groups, String zoneId) {
|
||||||
Optional<KeyPairClient> keyPairClient = novaClient.getKeyPairExtensionForZone(zoneId);
|
Optional<KeyPairApi> keyPairApi = novaApi.getKeyPairExtensionForZone(zoneId);
|
||||||
if (keyPairClient.isPresent()) {
|
if (keyPairApi.isPresent()) {
|
||||||
for (String group : groups) {
|
for (String group : groups) {
|
||||||
for (Map<String, KeyPair> view : keyPairClient.get().listKeyPairs()) {
|
for (Map<String, KeyPair> view : keyPairApi.get().listKeyPairs()) {
|
||||||
for (KeyPair pair : Iterables.filter(view.values(),
|
for (KeyPair pair : Iterables.filter(view.values(),
|
||||||
KeyPairPredicates.nameMatches(namingConvention.create().containsGroup(group)))) {
|
KeyPairPredicates.nameMatches(namingConvention.create().containsGroup(group)))) {
|
||||||
ZoneAndName zoneAndName = ZoneAndName.fromZoneAndName(zoneId, pair.getName());
|
ZoneAndName zoneAndName = ZoneAndName.fromZoneAndName(zoneId, pair.getName());
|
||||||
logger.debug(">> deleting keypair(%s)", zoneAndName);
|
logger.debug(">> deleting keypair(%s)", zoneAndName);
|
||||||
keyPairClient.get().deleteKeyPair(pair.getName());
|
keyPairApi.get().deleteKeyPair(pair.getName());
|
||||||
// TODO: test this clear happens
|
// TODO: test this clear happens
|
||||||
keyPairCache.invalidate(zoneAndName);
|
keyPairCache.invalidate(zoneAndName);
|
||||||
logger.debug("<< deleted keypair(%s)", zoneAndName);
|
logger.debug("<< deleted keypair(%s)", zoneAndName);
|
||||||
|
|
|
@ -37,7 +37,7 @@ import org.jclouds.domain.Location;
|
||||||
import org.jclouds.domain.LoginCredentials;
|
import org.jclouds.domain.LoginCredentials;
|
||||||
import org.jclouds.location.Zone;
|
import org.jclouds.location.Zone;
|
||||||
import org.jclouds.logging.Logger;
|
import org.jclouds.logging.Logger;
|
||||||
import org.jclouds.openstack.nova.v2_0.NovaClient;
|
import org.jclouds.openstack.nova.v2_0.NovaApi;
|
||||||
import org.jclouds.openstack.nova.v2_0.compute.functions.RemoveFloatingIpFromNodeAndDeallocate;
|
import org.jclouds.openstack.nova.v2_0.compute.functions.RemoveFloatingIpFromNodeAndDeallocate;
|
||||||
import org.jclouds.openstack.nova.v2_0.compute.options.NovaTemplateOptions;
|
import org.jclouds.openstack.nova.v2_0.compute.options.NovaTemplateOptions;
|
||||||
import org.jclouds.openstack.nova.v2_0.compute.strategy.ApplyNovaTemplateOptionsCreateNodesWithGroupEncodedIntoNameThenAddToSet;
|
import org.jclouds.openstack.nova.v2_0.compute.strategy.ApplyNovaTemplateOptionsCreateNodesWithGroupEncodedIntoNameThenAddToSet;
|
||||||
|
@ -76,16 +76,16 @@ public class NovaComputeServiceAdapter implements
|
||||||
@Named(ComputeServiceConstants.COMPUTE_LOGGER)
|
@Named(ComputeServiceConstants.COMPUTE_LOGGER)
|
||||||
protected Logger logger = Logger.NULL;
|
protected Logger logger = Logger.NULL;
|
||||||
|
|
||||||
protected final NovaClient novaClient;
|
protected final NovaApi novaApi;
|
||||||
protected final Supplier<Set<String>> zoneIds;
|
protected final Supplier<Set<String>> zoneIds;
|
||||||
protected final RemoveFloatingIpFromNodeAndDeallocate removeFloatingIpFromNodeAndDeallocate;
|
protected final RemoveFloatingIpFromNodeAndDeallocate removeFloatingIpFromNodeAndDeallocate;
|
||||||
protected final LoadingCache<ZoneAndName, KeyPair> keyPairCache;
|
protected final LoadingCache<ZoneAndName, KeyPair> keyPairCache;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public NovaComputeServiceAdapter(NovaClient novaClient, @Zone Supplier<Set<String>> zoneIds,
|
public NovaComputeServiceAdapter(NovaApi novaApi, @Zone Supplier<Set<String>> zoneIds,
|
||||||
RemoveFloatingIpFromNodeAndDeallocate removeFloatingIpFromNodeAndDeallocate,
|
RemoveFloatingIpFromNodeAndDeallocate removeFloatingIpFromNodeAndDeallocate,
|
||||||
LoadingCache<ZoneAndName, KeyPair> keyPairCache) {
|
LoadingCache<ZoneAndName, KeyPair> keyPairCache) {
|
||||||
this.novaClient = checkNotNull(novaClient, "novaClient");
|
this.novaApi = checkNotNull(novaApi, "novaApi");
|
||||||
this.zoneIds = checkNotNull(zoneIds, "zoneIds");
|
this.zoneIds = checkNotNull(zoneIds, "zoneIds");
|
||||||
this.removeFloatingIpFromNodeAndDeallocate = checkNotNull(removeFloatingIpFromNodeAndDeallocate,
|
this.removeFloatingIpFromNodeAndDeallocate = checkNotNull(removeFloatingIpFromNodeAndDeallocate,
|
||||||
"removeFloatingIpFromNodeAndDeallocate");
|
"removeFloatingIpFromNodeAndDeallocate");
|
||||||
|
@ -124,8 +124,8 @@ public class NovaComputeServiceAdapter implements
|
||||||
String flavorId = template.getHardware().getProviderId();
|
String flavorId = template.getHardware().getProviderId();
|
||||||
|
|
||||||
logger.debug(">> creating new server zone(%s) name(%s) image(%s) flavor(%s) options(%s)", zoneId, name, imageId, flavorId, options);
|
logger.debug(">> creating new server zone(%s) name(%s) image(%s) flavor(%s) options(%s)", zoneId, name, imageId, flavorId, options);
|
||||||
ServerCreated lightweightServer = novaClient.getServerClientForZone(zoneId).createServer(name, imageId, flavorId, options);
|
ServerCreated lightweightServer = novaApi.getServerApiForZone(zoneId).createServer(name, imageId, flavorId, options);
|
||||||
Server server = novaClient.getServerClientForZone(zoneId).getServer(lightweightServer.getId());
|
Server server = novaApi.getServerApiForZone(zoneId).getServer(lightweightServer.getId());
|
||||||
|
|
||||||
logger.trace("<< server(%s)", server.getId());
|
logger.trace("<< server(%s)", server.getId());
|
||||||
|
|
||||||
|
@ -140,7 +140,7 @@ public class NovaComputeServiceAdapter implements
|
||||||
public Iterable<FlavorInZone> listHardwareProfiles() {
|
public Iterable<FlavorInZone> listHardwareProfiles() {
|
||||||
Builder<FlavorInZone> builder = ImmutableSet.builder();
|
Builder<FlavorInZone> builder = ImmutableSet.builder();
|
||||||
for (final String zoneId : zoneIds.get()) {
|
for (final String zoneId : zoneIds.get()) {
|
||||||
builder.addAll(transform(novaClient.getFlavorClientForZone(zoneId).listFlavorsInDetail(),
|
builder.addAll(transform(novaApi.getFlavorApiForZone(zoneId).listFlavorsInDetail(),
|
||||||
new Function<Flavor, FlavorInZone>() {
|
new Function<Flavor, FlavorInZone>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -159,7 +159,7 @@ public class NovaComputeServiceAdapter implements
|
||||||
Set<String> zones = zoneIds.get();
|
Set<String> zones = zoneIds.get();
|
||||||
checkState(zones.size() > 0, "no zones found in supplier %s", zoneIds);
|
checkState(zones.size() > 0, "no zones found in supplier %s", zoneIds);
|
||||||
for (final String zoneId : zones) {
|
for (final String zoneId : zones) {
|
||||||
Set<Image> images = novaClient.getImageClientForZone(zoneId).listImagesInDetail();
|
Set<Image> images = novaApi.getImageApiForZone(zoneId).listImagesInDetail();
|
||||||
if (images.size() == 0) {
|
if (images.size() == 0) {
|
||||||
logger.debug("no images found in zone %s", zoneId);
|
logger.debug("no images found in zone %s", zoneId);
|
||||||
continue;
|
continue;
|
||||||
|
@ -194,7 +194,7 @@ public class NovaComputeServiceAdapter implements
|
||||||
public Iterable<ServerInZone> listNodes() {
|
public Iterable<ServerInZone> listNodes() {
|
||||||
Builder<ServerInZone> builder = ImmutableSet.builder();
|
Builder<ServerInZone> builder = ImmutableSet.builder();
|
||||||
for (final String zoneId : zoneIds.get()) {
|
for (final String zoneId : zoneIds.get()) {
|
||||||
builder.addAll(transform(novaClient.getServerClientForZone(zoneId).listServersInDetail(),
|
builder.addAll(transform(novaApi.getServerApiForZone(zoneId).listServersInDetail(),
|
||||||
new Function<Server, ServerInZone>() {
|
new Function<Server, ServerInZone>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -216,41 +216,41 @@ public class NovaComputeServiceAdapter implements
|
||||||
@Override
|
@Override
|
||||||
public ServerInZone getNode(String id) {
|
public ServerInZone getNode(String id) {
|
||||||
ZoneAndId zoneAndId = ZoneAndId.fromSlashEncoded(id);
|
ZoneAndId zoneAndId = ZoneAndId.fromSlashEncoded(id);
|
||||||
Server server = novaClient.getServerClientForZone(zoneAndId.getZone()).getServer(zoneAndId.getId());
|
Server server = novaApi.getServerApiForZone(zoneAndId.getZone()).getServer(zoneAndId.getId());
|
||||||
return server == null ? null : new ServerInZone(server, zoneAndId.getZone());
|
return server == null ? null : new ServerInZone(server, zoneAndId.getZone());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ImageInZone getImage(String id) {
|
public ImageInZone getImage(String id) {
|
||||||
ZoneAndId zoneAndId = ZoneAndId.fromSlashEncoded(id);
|
ZoneAndId zoneAndId = ZoneAndId.fromSlashEncoded(id);
|
||||||
Image image = novaClient.getImageClientForZone(zoneAndId.getZone()).getImage(zoneAndId.getId());
|
Image image = novaApi.getImageApiForZone(zoneAndId.getZone()).getImage(zoneAndId.getId());
|
||||||
return image == null ? null : new ImageInZone(image, zoneAndId.getZone());
|
return image == null ? null : new ImageInZone(image, zoneAndId.getZone());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void destroyNode(String id) {
|
public void destroyNode(String id) {
|
||||||
ZoneAndId zoneAndId = ZoneAndId.fromSlashEncoded(id);
|
ZoneAndId zoneAndId = ZoneAndId.fromSlashEncoded(id);
|
||||||
if (novaClient.getFloatingIPExtensionForZone(zoneAndId.getZone()).isPresent()) {
|
if (novaApi.getFloatingIPExtensionForZone(zoneAndId.getZone()).isPresent()) {
|
||||||
try {
|
try {
|
||||||
removeFloatingIpFromNodeAndDeallocate.apply(zoneAndId);
|
removeFloatingIpFromNodeAndDeallocate.apply(zoneAndId);
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
logger.warn(e, "<< error removing and deallocating ip from node(%s): %s", id, e.getMessage());
|
logger.warn(e, "<< error removing and deallocating ip from node(%s): %s", id, e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
novaClient.getServerClientForZone(zoneAndId.getZone()).deleteServer(zoneAndId.getId());
|
novaApi.getServerApiForZone(zoneAndId.getZone()).deleteServer(zoneAndId.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void rebootNode(String id) {
|
public void rebootNode(String id) {
|
||||||
ZoneAndId zoneAndId = ZoneAndId.fromSlashEncoded(id);
|
ZoneAndId zoneAndId = ZoneAndId.fromSlashEncoded(id);
|
||||||
novaClient.getServerClientForZone(zoneAndId.getZone()).rebootServer(zoneAndId.getId(), RebootType.HARD);
|
novaApi.getServerApiForZone(zoneAndId.getZone()).rebootServer(zoneAndId.getId(), RebootType.HARD);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void resumeNode(String id) {
|
public void resumeNode(String id) {
|
||||||
ZoneAndId zoneAndId = ZoneAndId.fromSlashEncoded(id);
|
ZoneAndId zoneAndId = ZoneAndId.fromSlashEncoded(id);
|
||||||
if (novaClient.getAdminActionsExtensionForZone(zoneAndId.getZone()).isPresent()) {
|
if (novaApi.getAdminActionsExtensionForZone(zoneAndId.getZone()).isPresent()) {
|
||||||
novaClient.getAdminActionsExtensionForZone(zoneAndId.getZone()).get().resumeServer(zoneAndId.getId());
|
novaApi.getAdminActionsExtensionForZone(zoneAndId.getZone()).get().resumeServer(zoneAndId.getId());
|
||||||
}
|
}
|
||||||
throw new UnsupportedOperationException("resume requires installation of the Admin Actions extension");
|
throw new UnsupportedOperationException("resume requires installation of the Admin Actions extension");
|
||||||
}
|
}
|
||||||
|
@ -258,8 +258,8 @@ public class NovaComputeServiceAdapter implements
|
||||||
@Override
|
@Override
|
||||||
public void suspendNode(String id) {
|
public void suspendNode(String id) {
|
||||||
ZoneAndId zoneAndId = ZoneAndId.fromSlashEncoded(id);
|
ZoneAndId zoneAndId = ZoneAndId.fromSlashEncoded(id);
|
||||||
if (novaClient.getAdminActionsExtensionForZone(zoneAndId.getZone()).isPresent()) {
|
if (novaApi.getAdminActionsExtensionForZone(zoneAndId.getZone()).isPresent()) {
|
||||||
novaClient.getAdminActionsExtensionForZone(zoneAndId.getZone()).get().suspendServer(zoneAndId.getId());
|
novaApi.getAdminActionsExtensionForZone(zoneAndId.getZone()).get().suspendServer(zoneAndId.getId());
|
||||||
}
|
}
|
||||||
throw new UnsupportedOperationException("suspend requires installation of the Admin Actions extension");
|
throw new UnsupportedOperationException("suspend requires installation of the Admin Actions extension");
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ import org.jclouds.compute.extensions.ImageExtension;
|
||||||
import org.jclouds.compute.reference.ComputeServiceConstants;
|
import org.jclouds.compute.reference.ComputeServiceConstants;
|
||||||
import org.jclouds.concurrent.Futures;
|
import org.jclouds.concurrent.Futures;
|
||||||
import org.jclouds.logging.Logger;
|
import org.jclouds.logging.Logger;
|
||||||
import org.jclouds.openstack.nova.v2_0.NovaClient;
|
import org.jclouds.openstack.nova.v2_0.NovaApi;
|
||||||
import org.jclouds.openstack.nova.v2_0.domain.Server;
|
import org.jclouds.openstack.nova.v2_0.domain.Server;
|
||||||
import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndId;
|
import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndId;
|
||||||
import org.jclouds.predicates.PredicateWithResult;
|
import org.jclouds.predicates.PredicateWithResult;
|
||||||
|
@ -62,7 +62,7 @@ public class NovaImageExtension implements ImageExtension {
|
||||||
@Named(ComputeServiceConstants.COMPUTE_LOGGER)
|
@Named(ComputeServiceConstants.COMPUTE_LOGGER)
|
||||||
protected Logger logger = Logger.NULL;
|
protected Logger logger = Logger.NULL;
|
||||||
|
|
||||||
private final NovaClient novaClient;
|
private final NovaApi novaApi;
|
||||||
private final ExecutorService executor;
|
private final ExecutorService executor;
|
||||||
@com.google.inject.Inject(optional = true)
|
@com.google.inject.Inject(optional = true)
|
||||||
@Named("IMAGE_MAX_WAIT")
|
@Named("IMAGE_MAX_WAIT")
|
||||||
|
@ -73,10 +73,10 @@ public class NovaImageExtension implements ImageExtension {
|
||||||
private PredicateWithResult<ZoneAndId, Image> imageReadyPredicate;
|
private PredicateWithResult<ZoneAndId, Image> imageReadyPredicate;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public NovaImageExtension(NovaClient novaClient,
|
public NovaImageExtension(NovaApi novaApi,
|
||||||
@Named(Constants.PROPERTY_USER_THREADS) ExecutorService userThreads,
|
@Named(Constants.PROPERTY_USER_THREADS) ExecutorService userThreads,
|
||||||
PredicateWithResult<ZoneAndId, Image> imageReadyPredicate) {
|
PredicateWithResult<ZoneAndId, Image> imageReadyPredicate) {
|
||||||
this.novaClient = checkNotNull(novaClient);
|
this.novaApi = checkNotNull(novaApi);
|
||||||
this.executor = userThreads;
|
this.executor = userThreads;
|
||||||
this.imageReadyPredicate = imageReadyPredicate;
|
this.imageReadyPredicate = imageReadyPredicate;
|
||||||
}
|
}
|
||||||
|
@ -84,7 +84,7 @@ public class NovaImageExtension implements ImageExtension {
|
||||||
@Override
|
@Override
|
||||||
public ImageTemplate buildImageTemplateFromNode(String name, final String id) {
|
public ImageTemplate buildImageTemplateFromNode(String name, final String id) {
|
||||||
ZoneAndId zoneAndId = ZoneAndId.fromSlashEncoded(id);
|
ZoneAndId zoneAndId = ZoneAndId.fromSlashEncoded(id);
|
||||||
Server server = novaClient.getServerClientForZone(zoneAndId.getZone()).getServer(zoneAndId.getId());
|
Server server = novaApi.getServerApiForZone(zoneAndId.getZone()).getServer(zoneAndId.getId());
|
||||||
if (server == null)
|
if (server == null)
|
||||||
throw new NoSuchElementException("Cannot find server with id: " + zoneAndId);
|
throw new NoSuchElementException("Cannot find server with id: " + zoneAndId);
|
||||||
CloneImageTemplate template = new ImageTemplateBuilder.CloneImageTemplateBuilder().nodeId(id).name(name).build();
|
CloneImageTemplate template = new ImageTemplateBuilder.CloneImageTemplateBuilder().nodeId(id).name(name).build();
|
||||||
|
@ -98,7 +98,7 @@ public class NovaImageExtension implements ImageExtension {
|
||||||
CloneImageTemplate cloneTemplate = (CloneImageTemplate) template;
|
CloneImageTemplate cloneTemplate = (CloneImageTemplate) template;
|
||||||
ZoneAndId sourceImageZoneAndId = ZoneAndId.fromSlashEncoded(cloneTemplate.getSourceNodeId());
|
ZoneAndId sourceImageZoneAndId = ZoneAndId.fromSlashEncoded(cloneTemplate.getSourceNodeId());
|
||||||
|
|
||||||
String newImageId = novaClient.getServerClientForZone(sourceImageZoneAndId.getZone()).createImageFromServer(
|
String newImageId = novaApi.getServerApiForZone(sourceImageZoneAndId.getZone()).createImageFromServer(
|
||||||
cloneTemplate.getName(), sourceImageZoneAndId.getId());
|
cloneTemplate.getName(), sourceImageZoneAndId.getId());
|
||||||
|
|
||||||
final ZoneAndId targetImageZoneAndId = ZoneAndId.fromZoneAndId(sourceImageZoneAndId.getZone(), newImageId);
|
final ZoneAndId targetImageZoneAndId = ZoneAndId.fromZoneAndId(sourceImageZoneAndId.getZone(), newImageId);
|
||||||
|
@ -119,7 +119,7 @@ public class NovaImageExtension implements ImageExtension {
|
||||||
public boolean deleteImage(String id) {
|
public boolean deleteImage(String id) {
|
||||||
ZoneAndId zoneAndId = ZoneAndId.fromSlashEncoded(id);
|
ZoneAndId zoneAndId = ZoneAndId.fromSlashEncoded(id);
|
||||||
try {
|
try {
|
||||||
this.novaClient.getImageClientForZone(zoneAndId.getZone()).deleteImage(zoneAndId.getId());
|
this.novaApi.getImageApiForZone(zoneAndId.getZone()).deleteImage(zoneAndId.getId());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,10 +33,10 @@ import org.jclouds.compute.domain.NodeMetadata;
|
||||||
import org.jclouds.compute.domain.NodeMetadataBuilder;
|
import org.jclouds.compute.domain.NodeMetadataBuilder;
|
||||||
import org.jclouds.compute.reference.ComputeServiceConstants;
|
import org.jclouds.compute.reference.ComputeServiceConstants;
|
||||||
import org.jclouds.logging.Logger;
|
import org.jclouds.logging.Logger;
|
||||||
import org.jclouds.openstack.nova.v2_0.NovaClient;
|
import org.jclouds.openstack.nova.v2_0.NovaApi;
|
||||||
import org.jclouds.openstack.nova.v2_0.domain.FloatingIP;
|
import org.jclouds.openstack.nova.v2_0.domain.FloatingIP;
|
||||||
import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndId;
|
import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndId;
|
||||||
import org.jclouds.openstack.nova.v2_0.extensions.FloatingIPClient;
|
import org.jclouds.openstack.nova.v2_0.extensions.FloatingIPApi;
|
||||||
import org.jclouds.rest.InsufficientResourcesException;
|
import org.jclouds.rest.InsufficientResourcesException;
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
|
@ -60,14 +60,14 @@ public class AllocateAndAddFloatingIpToNode implements
|
||||||
protected Logger logger = Logger.NULL;
|
protected Logger logger = Logger.NULL;
|
||||||
|
|
||||||
private final Predicate<AtomicReference<NodeMetadata>> nodeRunning;
|
private final Predicate<AtomicReference<NodeMetadata>> nodeRunning;
|
||||||
private final NovaClient novaClient;
|
private final NovaApi novaApi;
|
||||||
private final LoadingCache<ZoneAndId, Iterable<FloatingIP>> floatingIpCache;
|
private final LoadingCache<ZoneAndId, Iterable<FloatingIP>> floatingIpCache;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public AllocateAndAddFloatingIpToNode(@Named(TIMEOUT_NODE_RUNNING) Predicate<AtomicReference<NodeMetadata>> nodeRunning,
|
public AllocateAndAddFloatingIpToNode(@Named(TIMEOUT_NODE_RUNNING) Predicate<AtomicReference<NodeMetadata>> nodeRunning,
|
||||||
NovaClient novaClient, @Named("FLOATINGIP") LoadingCache<ZoneAndId, Iterable<FloatingIP>> floatingIpCache) {
|
NovaApi novaApi, @Named("FLOATINGIP") LoadingCache<ZoneAndId, Iterable<FloatingIP>> floatingIpCache) {
|
||||||
this.nodeRunning = checkNotNull(nodeRunning, "nodeRunning");
|
this.nodeRunning = checkNotNull(nodeRunning, "nodeRunning");
|
||||||
this.novaClient = checkNotNull(novaClient, "novaClient");
|
this.novaApi = checkNotNull(novaApi, "novaApi");
|
||||||
this.floatingIpCache = checkNotNull(floatingIpCache, "floatingIpCache");
|
this.floatingIpCache = checkNotNull(floatingIpCache, "floatingIpCache");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,16 +77,16 @@ public class AllocateAndAddFloatingIpToNode implements
|
||||||
NodeMetadata node = input.get();
|
NodeMetadata node = input.get();
|
||||||
// node's location is a host
|
// node's location is a host
|
||||||
String zoneId = node.getLocation().getParent().getId();
|
String zoneId = node.getLocation().getParent().getId();
|
||||||
FloatingIPClient floatingIpClient = novaClient.getFloatingIPExtensionForZone(zoneId).get();
|
FloatingIPApi floatingIpApi = novaApi.getFloatingIPExtensionForZone(zoneId).get();
|
||||||
|
|
||||||
FloatingIP ip = null;
|
FloatingIP ip = null;
|
||||||
try {
|
try {
|
||||||
logger.debug(">> allocating or reassigning floating ip for node(%s)", node.getId());
|
logger.debug(">> allocating or reassigning floating ip for node(%s)", node.getId());
|
||||||
ip = floatingIpClient.allocate();
|
ip = floatingIpApi.allocate();
|
||||||
} catch (InsufficientResourcesException e) {
|
} catch (InsufficientResourcesException e) {
|
||||||
logger.trace("<< [%s] allocating a new floating ip for node(%s)", e.getMessage(), node.getId());
|
logger.trace("<< [%s] allocating a new floating ip for node(%s)", e.getMessage(), node.getId());
|
||||||
logger.trace(">> searching for existing, unassigned floating ip for node(%s)", node.getId());
|
logger.trace(">> searching for existing, unassigned floating ip for node(%s)", node.getId());
|
||||||
ArrayList<FloatingIP> unassignedIps = Lists.newArrayList(Iterables.filter(floatingIpClient.listFloatingIPs(),
|
ArrayList<FloatingIP> unassignedIps = Lists.newArrayList(Iterables.filter(floatingIpApi.listFloatingIPs(),
|
||||||
new Predicate<FloatingIP>() {
|
new Predicate<FloatingIP>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -101,7 +101,7 @@ public class AllocateAndAddFloatingIpToNode implements
|
||||||
}
|
}
|
||||||
logger.debug(">> adding floatingIp(%s) to node(%s)", ip.getIp(), node.getId());
|
logger.debug(">> adding floatingIp(%s) to node(%s)", ip.getIp(), node.getId());
|
||||||
|
|
||||||
floatingIpClient.addFloatingIPToServer(ip.getIp(), node.getProviderId());
|
floatingIpApi.addFloatingIPToServer(ip.getIp(), node.getProviderId());
|
||||||
input.set(NodeMetadataBuilder.fromNodeMetadata(node).publicAddresses(ImmutableSet.of(ip.getIp())).build());
|
input.set(NodeMetadataBuilder.fromNodeMetadata(node).publicAddresses(ImmutableSet.of(ip.getIp())).build());
|
||||||
floatingIpCache.invalidate(ZoneAndId.fromSlashEncoded(node.getId()));
|
floatingIpCache.invalidate(ZoneAndId.fromSlashEncoded(node.getId()));
|
||||||
return input;
|
return input;
|
||||||
|
|
|
@ -30,13 +30,13 @@ import javax.inject.Singleton;
|
||||||
|
|
||||||
import org.jclouds.compute.reference.ComputeServiceConstants;
|
import org.jclouds.compute.reference.ComputeServiceConstants;
|
||||||
import org.jclouds.logging.Logger;
|
import org.jclouds.logging.Logger;
|
||||||
import org.jclouds.openstack.nova.v2_0.NovaClient;
|
import org.jclouds.openstack.nova.v2_0.NovaApi;
|
||||||
import org.jclouds.openstack.nova.v2_0.domain.Ingress;
|
import org.jclouds.openstack.nova.v2_0.domain.Ingress;
|
||||||
import org.jclouds.openstack.nova.v2_0.domain.IpProtocol;
|
import org.jclouds.openstack.nova.v2_0.domain.IpProtocol;
|
||||||
import org.jclouds.openstack.nova.v2_0.domain.SecurityGroup;
|
import org.jclouds.openstack.nova.v2_0.domain.SecurityGroup;
|
||||||
import org.jclouds.openstack.nova.v2_0.domain.zonescoped.SecurityGroupInZone;
|
import org.jclouds.openstack.nova.v2_0.domain.zonescoped.SecurityGroupInZone;
|
||||||
import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneSecurityGroupNameAndPorts;
|
import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneSecurityGroupNameAndPorts;
|
||||||
import org.jclouds.openstack.nova.v2_0.extensions.SecurityGroupClient;
|
import org.jclouds.openstack.nova.v2_0.extensions.SecurityGroupApi;
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
import com.google.common.base.Optional;
|
import com.google.common.base.Optional;
|
||||||
|
@ -50,11 +50,11 @@ public class CreateSecurityGroupIfNeeded implements Function<ZoneSecurityGroupNa
|
||||||
@Resource
|
@Resource
|
||||||
@Named(ComputeServiceConstants.COMPUTE_LOGGER)
|
@Named(ComputeServiceConstants.COMPUTE_LOGGER)
|
||||||
protected Logger logger = Logger.NULL;
|
protected Logger logger = Logger.NULL;
|
||||||
protected final NovaClient novaClient;
|
protected final NovaApi novaApi;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public CreateSecurityGroupIfNeeded(NovaClient novaClient) {
|
public CreateSecurityGroupIfNeeded(NovaApi novaApi) {
|
||||||
this.novaClient = checkNotNull(novaClient, "novaClient");
|
this.novaApi = checkNotNull(novaApi, "novaApi");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -62,33 +62,33 @@ public class CreateSecurityGroupIfNeeded implements Function<ZoneSecurityGroupNa
|
||||||
checkNotNull(zoneSecurityGroupNameAndPorts, "zoneSecurityGroupNameAndPorts");
|
checkNotNull(zoneSecurityGroupNameAndPorts, "zoneSecurityGroupNameAndPorts");
|
||||||
|
|
||||||
String zoneId = zoneSecurityGroupNameAndPorts.getZone();
|
String zoneId = zoneSecurityGroupNameAndPorts.getZone();
|
||||||
Optional<SecurityGroupClient> client = novaClient.getSecurityGroupExtensionForZone(zoneId);
|
Optional<SecurityGroupApi> api = novaApi.getSecurityGroupExtensionForZone(zoneId);
|
||||||
checkArgument(client.isPresent(), "Security groups are required, but the extension is not availablein zone %s!", zoneId);
|
checkArgument(api.isPresent(), "Security groups are required, but the extension is not availablein zone %s!", zoneId);
|
||||||
logger.debug(">> creating securityGroup %s", zoneSecurityGroupNameAndPorts);
|
logger.debug(">> creating securityGroup %s", zoneSecurityGroupNameAndPorts);
|
||||||
try {
|
try {
|
||||||
|
|
||||||
SecurityGroup securityGroup = client.get().createSecurityGroupWithNameAndDescription(
|
SecurityGroup securityGroup = api.get().createSecurityGroupWithNameAndDescription(
|
||||||
zoneSecurityGroupNameAndPorts.getName(), zoneSecurityGroupNameAndPorts.getName());
|
zoneSecurityGroupNameAndPorts.getName(), zoneSecurityGroupNameAndPorts.getName());
|
||||||
|
|
||||||
logger.debug("<< created securityGroup(%s)", securityGroup);
|
logger.debug("<< created securityGroup(%s)", securityGroup);
|
||||||
for (int port : zoneSecurityGroupNameAndPorts.getPorts()) {
|
for (int port : zoneSecurityGroupNameAndPorts.getPorts()) {
|
||||||
authorizeGroupToItselfAndAllIPsToTCPPort(client.get(), securityGroup, port);
|
authorizeGroupToItselfAndAllIPsToTCPPort(api.get(), securityGroup, port);
|
||||||
}
|
}
|
||||||
return new SecurityGroupInZone(client.get().getSecurityGroup(securityGroup.getId()), zoneId);
|
return new SecurityGroupInZone(api.get().getSecurityGroup(securityGroup.getId()), zoneId);
|
||||||
} catch (IllegalStateException e) {
|
} catch (IllegalStateException e) {
|
||||||
logger.trace("<< trying to find securityGroup(%s): %s", zoneSecurityGroupNameAndPorts, e.getMessage());
|
logger.trace("<< trying to find securityGroup(%s): %s", zoneSecurityGroupNameAndPorts, e.getMessage());
|
||||||
SecurityGroup group = find(client.get().listSecurityGroups(), nameEquals(zoneSecurityGroupNameAndPorts
|
SecurityGroup group = find(api.get().listSecurityGroups(), nameEquals(zoneSecurityGroupNameAndPorts
|
||||||
.getName()));
|
.getName()));
|
||||||
logger.debug("<< reused securityGroup(%s)", group.getId());
|
logger.debug("<< reused securityGroup(%s)", group.getId());
|
||||||
return new SecurityGroupInZone(group, zoneId);
|
return new SecurityGroupInZone(group, zoneId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void authorizeGroupToItselfAndAllIPsToTCPPort(SecurityGroupClient securityGroupClient,
|
private void authorizeGroupToItselfAndAllIPsToTCPPort(SecurityGroupApi securityGroupApi,
|
||||||
SecurityGroup securityGroup, int port) {
|
SecurityGroup securityGroup, int port) {
|
||||||
// NOTE that permission to itself isn't supported on trystack!
|
// NOTE that permission to itself isn't supported on trystack!
|
||||||
logger.debug(">> authorizing securityGroup(%s) permission to 0.0.0.0/0 on port %d", securityGroup, port);
|
logger.debug(">> authorizing securityGroup(%s) permission to 0.0.0.0/0 on port %d", securityGroup, port);
|
||||||
securityGroupClient.createSecurityGroupRuleAllowingCidrBlock(securityGroup.getId(), Ingress.builder().ipProtocol(
|
securityGroupApi.createSecurityGroupRuleAllowingCidrBlock(securityGroup.getId(), Ingress.builder().ipProtocol(
|
||||||
IpProtocol.TCP).fromPort(port).toPort(port).build(), "0.0.0.0/0");
|
IpProtocol.TCP).fromPort(port).toPort(port).build(), "0.0.0.0/0");
|
||||||
logger.debug("<< authorized securityGroup(%s) permission to 0.0.0.0/0 on port %d", securityGroup, port);
|
logger.debug("<< authorized securityGroup(%s) permission to 0.0.0.0/0 on port %d", securityGroup, port);
|
||||||
|
|
||||||
|
|
|
@ -26,10 +26,10 @@ import javax.inject.Named;
|
||||||
|
|
||||||
import org.jclouds.compute.reference.ComputeServiceConstants;
|
import org.jclouds.compute.reference.ComputeServiceConstants;
|
||||||
import org.jclouds.logging.Logger;
|
import org.jclouds.logging.Logger;
|
||||||
import org.jclouds.openstack.nova.v2_0.NovaClient;
|
import org.jclouds.openstack.nova.v2_0.NovaApi;
|
||||||
import org.jclouds.openstack.nova.v2_0.domain.FloatingIP;
|
import org.jclouds.openstack.nova.v2_0.domain.FloatingIP;
|
||||||
import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndId;
|
import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndId;
|
||||||
import org.jclouds.openstack.nova.v2_0.extensions.FloatingIPClient;
|
import org.jclouds.openstack.nova.v2_0.extensions.FloatingIPApi;
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
|
@ -46,24 +46,24 @@ public class RemoveFloatingIpFromNodeAndDeallocate implements Function<ZoneAndId
|
||||||
@Named(ComputeServiceConstants.COMPUTE_LOGGER)
|
@Named(ComputeServiceConstants.COMPUTE_LOGGER)
|
||||||
protected Logger logger = Logger.NULL;
|
protected Logger logger = Logger.NULL;
|
||||||
|
|
||||||
private final NovaClient novaClient;
|
private final NovaApi novaApi;
|
||||||
private final LoadingCache<ZoneAndId, Iterable<FloatingIP>> floatingIpCache;
|
private final LoadingCache<ZoneAndId, Iterable<FloatingIP>> floatingIpCache;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RemoveFloatingIpFromNodeAndDeallocate(NovaClient novaClient,
|
public RemoveFloatingIpFromNodeAndDeallocate(NovaApi novaApi,
|
||||||
@Named("FLOATINGIP") LoadingCache<ZoneAndId, Iterable<FloatingIP>> floatingIpCache) {
|
@Named("FLOATINGIP") LoadingCache<ZoneAndId, Iterable<FloatingIP>> floatingIpCache) {
|
||||||
this.novaClient = checkNotNull(novaClient, "novaClient");
|
this.novaApi = checkNotNull(novaApi, "novaApi");
|
||||||
this.floatingIpCache = checkNotNull(floatingIpCache, "floatingIpCache");
|
this.floatingIpCache = checkNotNull(floatingIpCache, "floatingIpCache");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ZoneAndId apply(ZoneAndId id) {
|
public ZoneAndId apply(ZoneAndId id) {
|
||||||
FloatingIPClient floatingIpClient = novaClient.getFloatingIPExtensionForZone(id.getZone()).get();
|
FloatingIPApi floatingIpApi = novaApi.getFloatingIPExtensionForZone(id.getZone()).get();
|
||||||
for (FloatingIP ip : floatingIpCache.getUnchecked(id)) {
|
for (FloatingIP ip : floatingIpCache.getUnchecked(id)) {
|
||||||
logger.debug(">> removing floatingIp(%s) from node(%s)", ip, id);
|
logger.debug(">> removing floatingIp(%s) from node(%s)", ip, id);
|
||||||
floatingIpClient.removeFloatingIPFromServer(ip.getIp(), id.getId());
|
floatingIpApi.removeFloatingIPFromServer(ip.getIp(), id.getId());
|
||||||
logger.debug(">> deallocating floatingIp(%s)", ip);
|
logger.debug(">> deallocating floatingIp(%s)", ip);
|
||||||
floatingIpClient.deallocate(ip.getId());
|
floatingIpApi.deallocate(ip.getId());
|
||||||
}
|
}
|
||||||
floatingIpCache.invalidate(id);
|
floatingIpCache.invalidate(id);
|
||||||
return id;
|
return id;
|
||||||
|
|
|
@ -28,10 +28,10 @@ import javax.inject.Singleton;
|
||||||
import org.jclouds.compute.functions.GroupNamingConvention;
|
import org.jclouds.compute.functions.GroupNamingConvention;
|
||||||
import org.jclouds.compute.reference.ComputeServiceConstants;
|
import org.jclouds.compute.reference.ComputeServiceConstants;
|
||||||
import org.jclouds.logging.Logger;
|
import org.jclouds.logging.Logger;
|
||||||
import org.jclouds.openstack.nova.v2_0.NovaClient;
|
import org.jclouds.openstack.nova.v2_0.NovaApi;
|
||||||
import org.jclouds.openstack.nova.v2_0.domain.KeyPair;
|
import org.jclouds.openstack.nova.v2_0.domain.KeyPair;
|
||||||
import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndName;
|
import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndName;
|
||||||
import org.jclouds.openstack.nova.v2_0.extensions.KeyPairClient;
|
import org.jclouds.openstack.nova.v2_0.extensions.KeyPairApi;
|
||||||
|
|
||||||
import com.google.common.base.Optional;
|
import com.google.common.base.Optional;
|
||||||
import com.google.common.cache.CacheLoader;
|
import com.google.common.cache.CacheLoader;
|
||||||
|
@ -45,12 +45,12 @@ public class CreateUniqueKeyPair extends CacheLoader<ZoneAndName, KeyPair> {
|
||||||
@Resource
|
@Resource
|
||||||
@Named(ComputeServiceConstants.COMPUTE_LOGGER)
|
@Named(ComputeServiceConstants.COMPUTE_LOGGER)
|
||||||
protected Logger logger = Logger.NULL;
|
protected Logger logger = Logger.NULL;
|
||||||
protected final NovaClient novaClient;
|
protected final NovaApi novaApi;
|
||||||
protected final GroupNamingConvention.Factory namingConvention;
|
protected final GroupNamingConvention.Factory namingConvention;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public CreateUniqueKeyPair(NovaClient novaClient, GroupNamingConvention.Factory namingConvention) {
|
public CreateUniqueKeyPair(NovaApi novaApi, GroupNamingConvention.Factory namingConvention) {
|
||||||
this.novaClient = checkNotNull(novaClient, "novaClient");
|
this.novaApi = checkNotNull(novaApi, "novaApi");
|
||||||
this.namingConvention = checkNotNull(namingConvention, "namingConvention");
|
this.namingConvention = checkNotNull(namingConvention, "namingConvention");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,8 +59,8 @@ public class CreateUniqueKeyPair extends CacheLoader<ZoneAndName, KeyPair> {
|
||||||
String zoneId = checkNotNull(zoneAndName, "zoneAndName").getZone();
|
String zoneId = checkNotNull(zoneAndName, "zoneAndName").getZone();
|
||||||
String prefix = zoneAndName.getName();
|
String prefix = zoneAndName.getName();
|
||||||
|
|
||||||
Optional<KeyPairClient> client = novaClient.getKeyPairExtensionForZone(zoneId);
|
Optional<KeyPairApi> api = novaApi.getKeyPairExtensionForZone(zoneId);
|
||||||
checkArgument(client.isPresent(), "Key pairs are required, but the extension is not available in zone %s!",
|
checkArgument(api.isPresent(), "Key pairs are required, but the extension is not available in zone %s!",
|
||||||
zoneId);
|
zoneId);
|
||||||
|
|
||||||
logger.debug(">> creating keyPair zone(%s) prefix(%s)", zoneId, prefix);
|
logger.debug(">> creating keyPair zone(%s) prefix(%s)", zoneId, prefix);
|
||||||
|
@ -68,7 +68,7 @@ public class CreateUniqueKeyPair extends CacheLoader<ZoneAndName, KeyPair> {
|
||||||
KeyPair keyPair = null;
|
KeyPair keyPair = null;
|
||||||
while (keyPair == null) {
|
while (keyPair == null) {
|
||||||
try {
|
try {
|
||||||
keyPair = client.get().createKeyPair(namingConvention.createWithoutPrefix().uniqueNameForGroup(prefix));
|
keyPair = api.get().createKeyPair(namingConvention.createWithoutPrefix().uniqueNameForGroup(prefix));
|
||||||
} catch (IllegalStateException e) {
|
} catch (IllegalStateException e) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,10 +21,10 @@ package org.jclouds.openstack.nova.v2_0.compute.loaders;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import org.jclouds.openstack.nova.v2_0.NovaClient;
|
import org.jclouds.openstack.nova.v2_0.NovaApi;
|
||||||
import org.jclouds.openstack.nova.v2_0.domain.FloatingIP;
|
import org.jclouds.openstack.nova.v2_0.domain.FloatingIP;
|
||||||
import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndId;
|
import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndId;
|
||||||
import org.jclouds.openstack.nova.v2_0.extensions.FloatingIPClient;
|
import org.jclouds.openstack.nova.v2_0.extensions.FloatingIPApi;
|
||||||
|
|
||||||
import com.google.common.base.Optional;
|
import com.google.common.base.Optional;
|
||||||
import com.google.common.base.Predicate;
|
import com.google.common.base.Predicate;
|
||||||
|
@ -41,19 +41,19 @@ import com.google.common.collect.Iterables;
|
||||||
*/
|
*/
|
||||||
@Singleton
|
@Singleton
|
||||||
public class LoadFloatingIpsForInstance extends CacheLoader<ZoneAndId, Iterable<FloatingIP>> {
|
public class LoadFloatingIpsForInstance extends CacheLoader<ZoneAndId, Iterable<FloatingIP>> {
|
||||||
private final NovaClient client;
|
private final NovaApi api;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public LoadFloatingIpsForInstance(NovaClient client) {
|
public LoadFloatingIpsForInstance(NovaApi api) {
|
||||||
this.client = client;
|
this.api = api;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Iterable<FloatingIP> load(final ZoneAndId key) throws Exception {
|
public Iterable<FloatingIP> load(final ZoneAndId key) throws Exception {
|
||||||
String zone = key.getZone();
|
String zone = key.getZone();
|
||||||
Optional<FloatingIPClient> ipClientOptional = client.getFloatingIPExtensionForZone(zone);
|
Optional<FloatingIPApi> ipApiOptional = api.getFloatingIPExtensionForZone(zone);
|
||||||
if (ipClientOptional.isPresent()) {
|
if (ipApiOptional.isPresent()) {
|
||||||
return Iterables.filter(ipClientOptional.get().listFloatingIPs(),
|
return Iterables.filter(ipApiOptional.get().listFloatingIPs(),
|
||||||
new Predicate<FloatingIP>() {
|
new Predicate<FloatingIP>() {
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(FloatingIP input) {
|
public boolean apply(FloatingIP input) {
|
||||||
|
|
|
@ -28,7 +28,7 @@ import java.util.Set;
|
||||||
|
|
||||||
import org.jclouds.compute.options.TemplateOptions;
|
import org.jclouds.compute.options.TemplateOptions;
|
||||||
import org.jclouds.domain.LoginCredentials;
|
import org.jclouds.domain.LoginCredentials;
|
||||||
import org.jclouds.openstack.nova.v2_0.NovaClient;
|
import org.jclouds.openstack.nova.v2_0.NovaApi;
|
||||||
import org.jclouds.scriptbuilder.domain.Statement;
|
import org.jclouds.scriptbuilder.domain.Statement;
|
||||||
import org.jclouds.util.Preconditions2;
|
import org.jclouds.util.Preconditions2;
|
||||||
|
|
||||||
|
@ -46,9 +46,9 @@ import com.google.common.collect.ImmutableSet;
|
||||||
* <code>
|
* <code>
|
||||||
* import static org.jclouds.aws.ec2.compute.options.NovaTemplateOptions.Builder.*;
|
* import static org.jclouds.aws.ec2.compute.options.NovaTemplateOptions.Builder.*;
|
||||||
* <p/>
|
* <p/>
|
||||||
* ComputeService client = // get connection
|
* ComputeService api = // get connection
|
||||||
* templateBuilder.options(inboundPorts(22, 80, 8080, 443));
|
* templateBuilder.options(inboundPorts(22, 80, 8080, 443));
|
||||||
* Set<? extends NodeMetadata> set = client.createNodesInGroup(tag, 2, templateBuilder.build());
|
* Set<? extends NodeMetadata> set = api.createNodesInGroup(tag, 2, templateBuilder.build());
|
||||||
* <code>
|
* <code>
|
||||||
*
|
*
|
||||||
* @author Adam Lowe
|
* @author Adam Lowe
|
||||||
|
@ -162,7 +162,7 @@ public class NovaTemplateOptions extends TemplateOptions implements Cloneable {
|
||||||
/**
|
/**
|
||||||
* <h3>Note</h3>
|
* <h3>Note</h3>
|
||||||
*
|
*
|
||||||
* This requires that {@link NovaClient#getFloatingIPExtensionForZone(String)} to return
|
* This requires that {@link NovaApi#getFloatingIPExtensionForZone(String)} to return
|
||||||
* {@link Optional#isPresent present}
|
* {@link Optional#isPresent present}
|
||||||
*
|
*
|
||||||
* @return true if auto assignment of a floating ip to each vm is enabled
|
* @return true if auto assignment of a floating ip to each vm is enabled
|
||||||
|
@ -182,7 +182,7 @@ public class NovaTemplateOptions extends TemplateOptions implements Cloneable {
|
||||||
/**
|
/**
|
||||||
* <h3>Note</h3>
|
* <h3>Note</h3>
|
||||||
*
|
*
|
||||||
* This requires that {@link NovaClient#getKeyPairExtensionForZone(String)} to return
|
* This requires that {@link NovaApi#getKeyPairExtensionForZone(String)} to return
|
||||||
* {@link Optional#isPresent present}
|
* {@link Optional#isPresent present}
|
||||||
*
|
*
|
||||||
* @return true if auto generation of keypairs is enabled
|
* @return true if auto generation of keypairs is enabled
|
||||||
|
|
|
@ -28,7 +28,7 @@ import javax.inject.Named;
|
||||||
import org.jclouds.compute.domain.Image;
|
import org.jclouds.compute.domain.Image;
|
||||||
import org.jclouds.compute.reference.ComputeServiceConstants;
|
import org.jclouds.compute.reference.ComputeServiceConstants;
|
||||||
import org.jclouds.logging.Logger;
|
import org.jclouds.logging.Logger;
|
||||||
import org.jclouds.openstack.nova.v2_0.NovaClient;
|
import org.jclouds.openstack.nova.v2_0.NovaApi;
|
||||||
import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ImageInZone;
|
import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ImageInZone;
|
||||||
import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndId;
|
import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndId;
|
||||||
import org.jclouds.predicates.PredicateWithResult;
|
import org.jclouds.predicates.PredicateWithResult;
|
||||||
|
@ -51,13 +51,13 @@ public final class GetImageWhenImageInZoneHasActiveStatusPredicateWithResult imp
|
||||||
private ZoneAndId resultZoneAndId;
|
private ZoneAndId resultZoneAndId;
|
||||||
private RuntimeException lastFailure;
|
private RuntimeException lastFailure;
|
||||||
private Function<ImageInZone, Image> imageInZoneToImage;
|
private Function<ImageInZone, Image> imageInZoneToImage;
|
||||||
private NovaClient client;
|
private NovaApi api;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public GetImageWhenImageInZoneHasActiveStatusPredicateWithResult(Function<ImageInZone, Image> imageInZoneToImage,
|
public GetImageWhenImageInZoneHasActiveStatusPredicateWithResult(Function<ImageInZone, Image> imageInZoneToImage,
|
||||||
NovaClient client) {
|
NovaApi api) {
|
||||||
this.imageInZoneToImage = imageInZoneToImage;
|
this.imageInZoneToImage = imageInZoneToImage;
|
||||||
this.client = client;
|
this.api = api;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -89,7 +89,7 @@ public final class GetImageWhenImageInZoneHasActiveStatusPredicateWithResult imp
|
||||||
}
|
}
|
||||||
|
|
||||||
public org.jclouds.openstack.nova.v2_0.domain.Image findImage(final ZoneAndId zoneAndId) {
|
public org.jclouds.openstack.nova.v2_0.domain.Image findImage(final ZoneAndId zoneAndId) {
|
||||||
return Iterables.tryFind(client.getImageClientForZone(zoneAndId.getZone()).listImagesInDetail(),
|
return Iterables.tryFind(api.getImageApiForZone(zoneAndId.getZone()).listImagesInDetail(),
|
||||||
new Predicate<org.jclouds.openstack.nova.v2_0.domain.Image>() {
|
new Predicate<org.jclouds.openstack.nova.v2_0.domain.Image>() {
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(org.jclouds.openstack.nova.v2_0.domain.Image input) {
|
public boolean apply(org.jclouds.openstack.nova.v2_0.domain.Image input) {
|
||||||
|
|
|
@ -44,7 +44,7 @@ import org.jclouds.compute.strategy.CustomizeNodeAndAddToGoodMapOrPutExceptionIn
|
||||||
import org.jclouds.compute.strategy.ListNodesStrategy;
|
import org.jclouds.compute.strategy.ListNodesStrategy;
|
||||||
import org.jclouds.compute.strategy.impl.CreateNodesWithGroupEncodedIntoNameThenAddToSet;
|
import org.jclouds.compute.strategy.impl.CreateNodesWithGroupEncodedIntoNameThenAddToSet;
|
||||||
import org.jclouds.concurrent.Futures;
|
import org.jclouds.concurrent.Futures;
|
||||||
import org.jclouds.openstack.nova.v2_0.NovaClient;
|
import org.jclouds.openstack.nova.v2_0.NovaApi;
|
||||||
import org.jclouds.openstack.nova.v2_0.compute.functions.AllocateAndAddFloatingIpToNode;
|
import org.jclouds.openstack.nova.v2_0.compute.functions.AllocateAndAddFloatingIpToNode;
|
||||||
import org.jclouds.openstack.nova.v2_0.compute.options.NovaTemplateOptions;
|
import org.jclouds.openstack.nova.v2_0.compute.options.NovaTemplateOptions;
|
||||||
import org.jclouds.openstack.nova.v2_0.domain.KeyPair;
|
import org.jclouds.openstack.nova.v2_0.domain.KeyPair;
|
||||||
|
@ -68,7 +68,7 @@ public class ApplyNovaTemplateOptionsCreateNodesWithGroupEncodedIntoNameThenAddT
|
||||||
private final AllocateAndAddFloatingIpToNode allocateAndAddFloatingIpToNode;
|
private final AllocateAndAddFloatingIpToNode allocateAndAddFloatingIpToNode;
|
||||||
private final LoadingCache<ZoneAndName, SecurityGroupInZone> securityGroupCache;
|
private final LoadingCache<ZoneAndName, SecurityGroupInZone> securityGroupCache;
|
||||||
private final LoadingCache<ZoneAndName, KeyPair> keyPairCache;
|
private final LoadingCache<ZoneAndName, KeyPair> keyPairCache;
|
||||||
private final NovaClient novaClient;
|
private final NovaApi novaApi;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
protected ApplyNovaTemplateOptionsCreateNodesWithGroupEncodedIntoNameThenAddToSet(
|
protected ApplyNovaTemplateOptionsCreateNodesWithGroupEncodedIntoNameThenAddToSet(
|
||||||
|
@ -79,14 +79,14 @@ public class ApplyNovaTemplateOptionsCreateNodesWithGroupEncodedIntoNameThenAddT
|
||||||
@Named(Constants.PROPERTY_USER_THREADS) ExecutorService executor,
|
@Named(Constants.PROPERTY_USER_THREADS) ExecutorService executor,
|
||||||
AllocateAndAddFloatingIpToNode allocateAndAddFloatingIpToNode,
|
AllocateAndAddFloatingIpToNode allocateAndAddFloatingIpToNode,
|
||||||
LoadingCache<ZoneAndName, SecurityGroupInZone> securityGroupCache,
|
LoadingCache<ZoneAndName, SecurityGroupInZone> securityGroupCache,
|
||||||
LoadingCache<ZoneAndName, KeyPair> keyPairCache, NovaClient novaClient) {
|
LoadingCache<ZoneAndName, KeyPair> keyPairCache, NovaApi novaApi) {
|
||||||
super(addNodeWithTagStrategy, listNodesStrategy, namingConvention, executor,
|
super(addNodeWithTagStrategy, listNodesStrategy, namingConvention, executor,
|
||||||
customizeNodeAndAddToGoodMapOrPutExceptionIntoBadMapFactory);
|
customizeNodeAndAddToGoodMapOrPutExceptionIntoBadMapFactory);
|
||||||
this.securityGroupCache = checkNotNull(securityGroupCache, "securityGroupCache");
|
this.securityGroupCache = checkNotNull(securityGroupCache, "securityGroupCache");
|
||||||
this.keyPairCache = checkNotNull(keyPairCache, "keyPairCache");
|
this.keyPairCache = checkNotNull(keyPairCache, "keyPairCache");
|
||||||
this.allocateAndAddFloatingIpToNode = checkNotNull(allocateAndAddFloatingIpToNode,
|
this.allocateAndAddFloatingIpToNode = checkNotNull(allocateAndAddFloatingIpToNode,
|
||||||
"allocateAndAddFloatingIpToNode");
|
"allocateAndAddFloatingIpToNode");
|
||||||
this.novaClient = checkNotNull(novaClient, "novaClient");
|
this.novaApi = checkNotNull(novaApi, "novaApi");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -102,12 +102,12 @@ public class ApplyNovaTemplateOptionsCreateNodesWithGroupEncodedIntoNameThenAddT
|
||||||
String zone = mutableTemplate.getLocation().getId();
|
String zone = mutableTemplate.getLocation().getId();
|
||||||
|
|
||||||
if (templateOptions.shouldAutoAssignFloatingIp()) {
|
if (templateOptions.shouldAutoAssignFloatingIp()) {
|
||||||
checkArgument(novaClient.getFloatingIPExtensionForZone(zone).isPresent(),
|
checkArgument(novaApi.getFloatingIPExtensionForZone(zone).isPresent(),
|
||||||
"Floating IPs are required by options, but the extension is not available! options: %s",
|
"Floating IPs are required by options, but the extension is not available! options: %s",
|
||||||
templateOptions);
|
templateOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean keyPairExensionPresent = novaClient.getKeyPairExtensionForZone(zone).isPresent();
|
boolean keyPairExensionPresent = novaApi.getKeyPairExtensionForZone(zone).isPresent();
|
||||||
if (templateOptions.shouldGenerateKeyPair()) {
|
if (templateOptions.shouldGenerateKeyPair()) {
|
||||||
checkArgument(keyPairExensionPresent,
|
checkArgument(keyPairExensionPresent,
|
||||||
"Key Pairs are required by options, but the extension is not available! options: %s", templateOptions);
|
"Key Pairs are required by options, but the extension is not available! options: %s", templateOptions);
|
||||||
|
@ -126,10 +126,10 @@ public class ApplyNovaTemplateOptionsCreateNodesWithGroupEncodedIntoNameThenAddT
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean securityGroupExensionPresent = novaClient.getSecurityGroupExtensionForZone(zone).isPresent();
|
boolean securityGroupExensionPresent = novaApi.getSecurityGroupExtensionForZone(zone).isPresent();
|
||||||
List<Integer> inboundPorts = Ints.asList(templateOptions.getInboundPorts());
|
List<Integer> inboundPorts = Ints.asList(templateOptions.getInboundPorts());
|
||||||
if (templateOptions.getSecurityGroupNames().size() > 0) {
|
if (templateOptions.getSecurityGroupNames().size() > 0) {
|
||||||
checkArgument(novaClient.getSecurityGroupExtensionForZone(zone).isPresent(),
|
checkArgument(novaApi.getSecurityGroupExtensionForZone(zone).isPresent(),
|
||||||
"Security groups are required by options, but the extension is not available! options: %s",
|
"Security groups are required by options, but the extension is not available! options: %s",
|
||||||
templateOptions);
|
templateOptions);
|
||||||
} else if (securityGroupExensionPresent && inboundPorts.size() > 0) {
|
} else if (securityGroupExensionPresent && inboundPorts.size() > 0) {
|
||||||
|
|
|
@ -29,45 +29,45 @@ import org.jclouds.http.HttpErrorHandler;
|
||||||
import org.jclouds.http.annotation.ClientError;
|
import org.jclouds.http.annotation.ClientError;
|
||||||
import org.jclouds.http.annotation.Redirection;
|
import org.jclouds.http.annotation.Redirection;
|
||||||
import org.jclouds.http.annotation.ServerError;
|
import org.jclouds.http.annotation.ServerError;
|
||||||
import org.jclouds.openstack.nova.v2_0.NovaAsyncClient;
|
import org.jclouds.openstack.nova.v2_0.NovaAsyncApi;
|
||||||
import org.jclouds.openstack.nova.v2_0.NovaClient;
|
import org.jclouds.openstack.nova.v2_0.NovaApi;
|
||||||
import org.jclouds.openstack.nova.v2_0.domain.Extension;
|
import org.jclouds.openstack.nova.v2_0.domain.Extension;
|
||||||
import org.jclouds.openstack.nova.v2_0.extensions.AdminActionsAsyncClient;
|
import org.jclouds.openstack.nova.v2_0.extensions.AdminActionsAsyncApi;
|
||||||
import org.jclouds.openstack.nova.v2_0.extensions.AdminActionsClient;
|
import org.jclouds.openstack.nova.v2_0.extensions.AdminActionsApi;
|
||||||
import org.jclouds.openstack.nova.v2_0.extensions.FlavorExtraSpecsAsyncClient;
|
import org.jclouds.openstack.nova.v2_0.extensions.FlavorExtraSpecsAsyncApi;
|
||||||
import org.jclouds.openstack.nova.v2_0.extensions.FlavorExtraSpecsClient;
|
import org.jclouds.openstack.nova.v2_0.extensions.FlavorExtraSpecsApi;
|
||||||
import org.jclouds.openstack.nova.v2_0.extensions.FloatingIPAsyncClient;
|
import org.jclouds.openstack.nova.v2_0.extensions.FloatingIPAsyncApi;
|
||||||
import org.jclouds.openstack.nova.v2_0.extensions.FloatingIPClient;
|
import org.jclouds.openstack.nova.v2_0.extensions.FloatingIPApi;
|
||||||
import org.jclouds.openstack.nova.v2_0.extensions.HostAdministrationAsyncClient;
|
import org.jclouds.openstack.nova.v2_0.extensions.HostAdministrationAsyncApi;
|
||||||
import org.jclouds.openstack.nova.v2_0.extensions.HostAdministrationClient;
|
import org.jclouds.openstack.nova.v2_0.extensions.HostAdministrationApi;
|
||||||
import org.jclouds.openstack.nova.v2_0.extensions.HostAggregateAsyncClient;
|
import org.jclouds.openstack.nova.v2_0.extensions.HostAggregateAsyncApi;
|
||||||
import org.jclouds.openstack.nova.v2_0.extensions.HostAggregateClient;
|
import org.jclouds.openstack.nova.v2_0.extensions.HostAggregateApi;
|
||||||
import org.jclouds.openstack.nova.v2_0.extensions.KeyPairAsyncClient;
|
import org.jclouds.openstack.nova.v2_0.extensions.KeyPairAsyncApi;
|
||||||
import org.jclouds.openstack.nova.v2_0.extensions.KeyPairClient;
|
import org.jclouds.openstack.nova.v2_0.extensions.KeyPairApi;
|
||||||
import org.jclouds.openstack.nova.v2_0.extensions.QuotaAsyncClient;
|
import org.jclouds.openstack.nova.v2_0.extensions.QuotaAsyncApi;
|
||||||
import org.jclouds.openstack.nova.v2_0.extensions.QuotaClassAsyncClient;
|
import org.jclouds.openstack.nova.v2_0.extensions.QuotaClassAsyncApi;
|
||||||
import org.jclouds.openstack.nova.v2_0.extensions.QuotaClassClient;
|
import org.jclouds.openstack.nova.v2_0.extensions.QuotaClassApi;
|
||||||
import org.jclouds.openstack.nova.v2_0.extensions.QuotaClient;
|
import org.jclouds.openstack.nova.v2_0.extensions.QuotaApi;
|
||||||
import org.jclouds.openstack.nova.v2_0.extensions.SecurityGroupAsyncClient;
|
import org.jclouds.openstack.nova.v2_0.extensions.SecurityGroupAsyncApi;
|
||||||
import org.jclouds.openstack.nova.v2_0.extensions.SecurityGroupClient;
|
import org.jclouds.openstack.nova.v2_0.extensions.SecurityGroupApi;
|
||||||
import org.jclouds.openstack.nova.v2_0.extensions.ServerWithSecurityGroupsAsyncClient;
|
import org.jclouds.openstack.nova.v2_0.extensions.ServerWithSecurityGroupsAsyncApi;
|
||||||
import org.jclouds.openstack.nova.v2_0.extensions.ServerWithSecurityGroupsClient;
|
import org.jclouds.openstack.nova.v2_0.extensions.ServerWithSecurityGroupsApi;
|
||||||
import org.jclouds.openstack.nova.v2_0.extensions.SimpleTenantUsageAsyncClient;
|
import org.jclouds.openstack.nova.v2_0.extensions.SimpleTenantUsageAsyncApi;
|
||||||
import org.jclouds.openstack.nova.v2_0.extensions.SimpleTenantUsageClient;
|
import org.jclouds.openstack.nova.v2_0.extensions.SimpleTenantUsageApi;
|
||||||
import org.jclouds.openstack.nova.v2_0.extensions.VirtualInterfaceAsyncClient;
|
import org.jclouds.openstack.nova.v2_0.extensions.VirtualInterfaceAsyncApi;
|
||||||
import org.jclouds.openstack.nova.v2_0.extensions.VirtualInterfaceClient;
|
import org.jclouds.openstack.nova.v2_0.extensions.VirtualInterfaceApi;
|
||||||
import org.jclouds.openstack.nova.v2_0.extensions.VolumeAsyncClient;
|
import org.jclouds.openstack.nova.v2_0.extensions.VolumeAsyncApi;
|
||||||
import org.jclouds.openstack.nova.v2_0.extensions.VolumeClient;
|
import org.jclouds.openstack.nova.v2_0.extensions.VolumeApi;
|
||||||
import org.jclouds.openstack.nova.v2_0.extensions.VolumeTypeAsyncClient;
|
import org.jclouds.openstack.nova.v2_0.extensions.VolumeTypeAsyncApi;
|
||||||
import org.jclouds.openstack.nova.v2_0.extensions.VolumeTypeClient;
|
import org.jclouds.openstack.nova.v2_0.extensions.VolumeTypeApi;
|
||||||
import org.jclouds.openstack.nova.v2_0.features.ExtensionAsyncClient;
|
import org.jclouds.openstack.nova.v2_0.features.ExtensionAsyncApi;
|
||||||
import org.jclouds.openstack.nova.v2_0.features.ExtensionClient;
|
import org.jclouds.openstack.nova.v2_0.features.ExtensionApi;
|
||||||
import org.jclouds.openstack.nova.v2_0.features.FlavorAsyncClient;
|
import org.jclouds.openstack.nova.v2_0.features.FlavorAsyncApi;
|
||||||
import org.jclouds.openstack.nova.v2_0.features.FlavorClient;
|
import org.jclouds.openstack.nova.v2_0.features.FlavorApi;
|
||||||
import org.jclouds.openstack.nova.v2_0.features.ImageAsyncClient;
|
import org.jclouds.openstack.nova.v2_0.features.ImageAsyncApi;
|
||||||
import org.jclouds.openstack.nova.v2_0.features.ImageClient;
|
import org.jclouds.openstack.nova.v2_0.features.ImageApi;
|
||||||
import org.jclouds.openstack.nova.v2_0.features.ServerAsyncClient;
|
import org.jclouds.openstack.nova.v2_0.features.ServerAsyncApi;
|
||||||
import org.jclouds.openstack.nova.v2_0.features.ServerClient;
|
import org.jclouds.openstack.nova.v2_0.features.ServerApi;
|
||||||
import org.jclouds.openstack.nova.v2_0.functions.PresentWhenExtensionAnnotationNamespaceEqualsAnyNamespaceInExtensionsSet;
|
import org.jclouds.openstack.nova.v2_0.functions.PresentWhenExtensionAnnotationNamespaceEqualsAnyNamespaceInExtensionsSet;
|
||||||
import org.jclouds.openstack.nova.v2_0.handlers.NovaErrorHandler;
|
import org.jclouds.openstack.nova.v2_0.handlers.NovaErrorHandler;
|
||||||
import org.jclouds.rest.ConfiguresRestClient;
|
import org.jclouds.rest.ConfiguresRestClient;
|
||||||
|
@ -86,25 +86,25 @@ import com.google.inject.Provides;
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
@ConfiguresRestClient
|
@ConfiguresRestClient
|
||||||
public class NovaRestClientModule extends RestClientModule<NovaClient, NovaAsyncClient> {
|
public class NovaRestClientModule extends RestClientModule<NovaApi, NovaAsyncApi> {
|
||||||
|
|
||||||
public static final Map<Class<?>, Class<?>> DELEGATE_MAP = ImmutableMap.<Class<?>, Class<?>> builder()
|
public static final Map<Class<?>, Class<?>> DELEGATE_MAP = ImmutableMap.<Class<?>, Class<?>> builder()
|
||||||
.put(ServerClient.class, ServerAsyncClient.class).put(FlavorClient.class, FlavorAsyncClient.class)
|
.put(ServerApi.class, ServerAsyncApi.class).put(FlavorApi.class, FlavorAsyncApi.class)
|
||||||
.put(ImageClient.class, ImageAsyncClient.class).put(ExtensionClient.class, ExtensionAsyncClient.class)
|
.put(ImageApi.class, ImageAsyncApi.class).put(ExtensionApi.class, ExtensionAsyncApi.class)
|
||||||
.put(FloatingIPClient.class, FloatingIPAsyncClient.class)
|
.put(FloatingIPApi.class, FloatingIPAsyncApi.class)
|
||||||
.put(SecurityGroupClient.class, SecurityGroupAsyncClient.class)
|
.put(SecurityGroupApi.class, SecurityGroupAsyncApi.class)
|
||||||
.put(KeyPairClient.class, KeyPairAsyncClient.class)
|
.put(KeyPairApi.class, KeyPairAsyncApi.class)
|
||||||
.put(HostAdministrationClient.class, HostAdministrationAsyncClient.class)
|
.put(HostAdministrationApi.class, HostAdministrationAsyncApi.class)
|
||||||
.put(SimpleTenantUsageClient.class, SimpleTenantUsageAsyncClient.class)
|
.put(SimpleTenantUsageApi.class, SimpleTenantUsageAsyncApi.class)
|
||||||
.put(VolumeClient.class, VolumeAsyncClient.class)
|
.put(VolumeApi.class, VolumeAsyncApi.class)
|
||||||
.put(VirtualInterfaceClient.class, VirtualInterfaceAsyncClient.class)
|
.put(VirtualInterfaceApi.class, VirtualInterfaceAsyncApi.class)
|
||||||
.put(ServerWithSecurityGroupsClient.class, ServerWithSecurityGroupsAsyncClient.class)
|
.put(ServerWithSecurityGroupsApi.class, ServerWithSecurityGroupsAsyncApi.class)
|
||||||
.put(AdminActionsClient.class, AdminActionsAsyncClient.class)
|
.put(AdminActionsApi.class, AdminActionsAsyncApi.class)
|
||||||
.put(HostAggregateClient.class, HostAggregateAsyncClient.class)
|
.put(HostAggregateApi.class, HostAggregateAsyncApi.class)
|
||||||
.put(FlavorExtraSpecsClient.class, FlavorExtraSpecsAsyncClient.class)
|
.put(FlavorExtraSpecsApi.class, FlavorExtraSpecsAsyncApi.class)
|
||||||
.put(QuotaClient.class, QuotaAsyncClient.class)
|
.put(QuotaApi.class, QuotaAsyncApi.class)
|
||||||
.put(QuotaClassClient.class, QuotaClassAsyncClient.class)
|
.put(QuotaClassApi.class, QuotaClassAsyncApi.class)
|
||||||
.put(VolumeTypeClient.class, VolumeTypeAsyncClient.class)
|
.put(VolumeTypeApi.class, VolumeTypeAsyncApi.class)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
public NovaRestClientModule() {
|
public NovaRestClientModule() {
|
||||||
|
@ -121,13 +121,13 @@ public class NovaRestClientModule extends RestClientModule<NovaClient, NovaAsync
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
public LoadingCache<String, Set<Extension>> provideExtensionsByZone(final Provider<NovaClient> novaClient) {
|
public LoadingCache<String, Set<Extension>> provideExtensionsByZone(final Provider<NovaApi> novaApi) {
|
||||||
return CacheBuilder.newBuilder().expireAfterWrite(23, TimeUnit.HOURS)
|
return CacheBuilder.newBuilder().expireAfterWrite(23, TimeUnit.HOURS)
|
||||||
.build(new CacheLoader<String, Set<Extension>>() {
|
.build(new CacheLoader<String, Set<Extension>>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<Extension> load(String key) throws Exception {
|
public Set<Extension> load(String key) throws Exception {
|
||||||
return novaClient.get().getExtensionClientForZone(key).listExtensions();
|
return novaApi.get().getExtensionApiForZone(key).listExtensions();
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -175,7 +175,7 @@ public class Flavor extends Resource {
|
||||||
* <p/>
|
* <p/>
|
||||||
* NOTE: This field is only present if the Flavor Extra Data extension is installed (alias "OS-FLV-EXT-DATA").
|
* NOTE: This field is only present if the Flavor Extra Data extension is installed (alias "OS-FLV-EXT-DATA").
|
||||||
*
|
*
|
||||||
* @see org.jclouds.openstack.nova.v2_0.features.ExtensionClient#getExtensionByAlias
|
* @see org.jclouds.openstack.nova.v2_0.features.ExtensionApi#getExtensionByAlias
|
||||||
* @see org.jclouds.openstack.nova.v2_0.extensions.ExtensionNamespaces#FLAVOR_EXTRA_DATA
|
* @see org.jclouds.openstack.nova.v2_0.extensions.ExtensionNamespaces#FLAVOR_EXTRA_DATA
|
||||||
*/
|
*/
|
||||||
public Optional<Integer> getEphemeral() {
|
public Optional<Integer> getEphemeral() {
|
||||||
|
|
|
@ -38,7 +38,7 @@ import com.google.common.collect.ImmutableSet;
|
||||||
/**
|
/**
|
||||||
* Aggregates can be manipulated using the Aggregate Extension to Nova (alias "OS-AGGREGATES")
|
* Aggregates can be manipulated using the Aggregate Extension to Nova (alias "OS-AGGREGATES")
|
||||||
*
|
*
|
||||||
* @see org.jclouds.openstack.nova.v2_0.extensions.HostAggregateClient
|
* @see org.jclouds.openstack.nova.v2_0.extensions.HostAggregateApi
|
||||||
*/
|
*/
|
||||||
public class HostAggregate {
|
public class HostAggregate {
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ import java.beans.ConstructorProperties;
|
||||||
/**
|
/**
|
||||||
* Represents the set of limits (quota class) returned by the Quota Class Extension
|
* Represents the set of limits (quota class) returned by the Quota Class Extension
|
||||||
*
|
*
|
||||||
* @see org.jclouds.openstack.nova.v2_0.extensions.QuotaClassClient
|
* @see org.jclouds.openstack.nova.v2_0.extensions.QuotaClassApi
|
||||||
*/
|
*/
|
||||||
public class QuotaClass extends Quotas {
|
public class QuotaClass extends Quotas {
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ import com.google.common.base.Objects.ToStringHelper;
|
||||||
/**
|
/**
|
||||||
* Represents the set of limits (quotas) returned by the Quota Extension
|
* Represents the set of limits (quotas) returned by the Quota Extension
|
||||||
*
|
*
|
||||||
* @see org.jclouds.openstack.nova.v2_0.extensions.QuotaClient
|
* @see org.jclouds.openstack.nova.v2_0.extensions.QuotaApi
|
||||||
*/
|
*/
|
||||||
public class Quotas {
|
public class Quotas {
|
||||||
|
|
||||||
|
@ -298,7 +298,7 @@ public class Quotas {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the limit of the number of security groups that can be created for the tenant
|
* @return the limit of the number of security groups that can be created for the tenant
|
||||||
* @see org.jclouds.openstack.nova.v2_0.extensions.SecurityGroupClient
|
* @see org.jclouds.openstack.nova.v2_0.extensions.SecurityGroupApi
|
||||||
*/
|
*/
|
||||||
public int getSecurityGroups() {
|
public int getSecurityGroups() {
|
||||||
return this.securityGroups;
|
return this.securityGroups;
|
||||||
|
@ -306,7 +306,7 @@ public class Quotas {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the limit of the number of security group rules that can be created for the tenant
|
* @return the limit of the number of security group rules that can be created for the tenant
|
||||||
* @see org.jclouds.openstack.nova.v2_0.extensions.SecurityGroupClient
|
* @see org.jclouds.openstack.nova.v2_0.extensions.SecurityGroupApi
|
||||||
*/
|
*/
|
||||||
public int getSecurityGroupRules() {
|
public int getSecurityGroupRules() {
|
||||||
return this.securityGroupRules;
|
return this.securityGroupRules;
|
||||||
|
@ -314,7 +314,7 @@ public class Quotas {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the limit of the number of key pairs that can be created for the tenant
|
* @return the limit of the number of key pairs that can be created for the tenant
|
||||||
* @see org.jclouds.openstack.nova.v2_0.extensions.KeyPairClient
|
* @see org.jclouds.openstack.nova.v2_0.extensions.KeyPairApi
|
||||||
*/
|
*/
|
||||||
public int getKeyPairs() {
|
public int getKeyPairs() {
|
||||||
return this.keyPairs;
|
return this.keyPairs;
|
||||||
|
|
|
@ -27,7 +27,7 @@ import java.util.Map;
|
||||||
import javax.inject.Named;
|
import javax.inject.Named;
|
||||||
|
|
||||||
import org.jclouds.javax.annotation.Nullable;
|
import org.jclouds.javax.annotation.Nullable;
|
||||||
import org.jclouds.openstack.nova.v2_0.extensions.KeyPairClient;
|
import org.jclouds.openstack.nova.v2_0.extensions.KeyPairApi;
|
||||||
import org.jclouds.openstack.v2_0.domain.Link;
|
import org.jclouds.openstack.v2_0.domain.Link;
|
||||||
import org.jclouds.openstack.v2_0.domain.Resource;
|
import org.jclouds.openstack.v2_0.domain.Resource;
|
||||||
|
|
||||||
|
@ -412,7 +412,7 @@ public class Server extends Resource {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return keyName if extension is present and there is a valur for this server
|
* @return keyName if extension is present and there is a valur for this server
|
||||||
* @see KeyPairClient
|
* @see KeyPairApi
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable
|
||||||
public String getKeyName() {
|
public String getKeyName() {
|
||||||
|
@ -424,7 +424,7 @@ public class Server extends Resource {
|
||||||
* <p/>
|
* <p/>
|
||||||
* NOTE: This field is only present if the Extended Status extension is installed.
|
* NOTE: This field is only present if the Extended Status extension is installed.
|
||||||
*
|
*
|
||||||
* @see org.jclouds.openstack.nova.v2_0.features.ExtensionClient#getExtensionByAlias
|
* @see org.jclouds.openstack.nova.v2_0.features.ExtensionApi#getExtensionByAlias
|
||||||
* @see org.jclouds.openstack.nova.v2_0.extensions.ExtensionNamespaces#EXTENDED_STATUS
|
* @see org.jclouds.openstack.nova.v2_0.extensions.ExtensionNamespaces#EXTENDED_STATUS
|
||||||
*/
|
*/
|
||||||
public Optional<ServerExtendedStatus> getExtendedStatus() {
|
public Optional<ServerExtendedStatus> getExtendedStatus() {
|
||||||
|
@ -436,7 +436,7 @@ public class Server extends Resource {
|
||||||
* <p/>
|
* <p/>
|
||||||
* NOTE: This field is only present if the The Extended Server Attributes API extension is installed.
|
* NOTE: This field is only present if the The Extended Server Attributes API extension is installed.
|
||||||
*
|
*
|
||||||
* @see org.jclouds.openstack.nova.v2_0.features.ExtensionClient#getExtensionByAlias
|
* @see org.jclouds.openstack.nova.v2_0.features.ExtensionApi#getExtensionByAlias
|
||||||
* @see org.jclouds.openstack.nova.v2_0.extensions.ExtensionNamespaces#EXTENDED_STATUS
|
* @see org.jclouds.openstack.nova.v2_0.extensions.ExtensionNamespaces#EXTENDED_STATUS
|
||||||
*/
|
*/
|
||||||
public Optional<ServerExtendedAttributes> getExtendedAttributes() {
|
public Optional<ServerExtendedAttributes> getExtendedAttributes() {
|
||||||
|
@ -448,7 +448,7 @@ public class Server extends Resource {
|
||||||
* <p/>
|
* <p/>
|
||||||
* NOTE: This field is only present if the Disk Config extension is installed
|
* NOTE: This field is only present if the Disk Config extension is installed
|
||||||
*
|
*
|
||||||
* @see org.jclouds.openstack.nova.v2_0.features.ExtensionClient#getExtensionByAlias
|
* @see org.jclouds.openstack.nova.v2_0.features.ExtensionApi#getExtensionByAlias
|
||||||
* @see org.jclouds.openstack.nova.v2_0.extensions.ExtensionNamespaces#DISK_CONFIG
|
* @see org.jclouds.openstack.nova.v2_0.extensions.ExtensionNamespaces#DISK_CONFIG
|
||||||
*/
|
*/
|
||||||
public Optional<String> getDiskConfig() {
|
public Optional<String> getDiskConfig() {
|
||||||
|
|
|
@ -31,7 +31,7 @@ import com.google.common.base.Objects;
|
||||||
import com.google.common.base.Objects.ToStringHelper;
|
import com.google.common.base.Objects.ToStringHelper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Server Resource with administrative password returned by ServerClient#CreateServer calls
|
* Server Resource with administrative password returned by ServerApi#CreateServer calls
|
||||||
*
|
*
|
||||||
* @author Adam Lowe
|
* @author Adam Lowe
|
||||||
* @see <a href=
|
* @see <a href=
|
||||||
|
|
|
@ -34,7 +34,7 @@ import com.google.common.base.Objects.ToStringHelper;
|
||||||
* @see <a href=
|
* @see <a href=
|
||||||
"http://nova.openstack.org/api/nova.api.openstack.compute.contrib.extended_server_attributes.html"
|
"http://nova.openstack.org/api/nova.api.openstack.compute.contrib.extended_server_attributes.html"
|
||||||
/>
|
/>
|
||||||
* @see org.jclouds.openstack.nova.v2_0.features.ExtensionClient#getExtensionByAlias
|
* @see org.jclouds.openstack.nova.v2_0.features.ExtensionApi#getExtensionByAlias
|
||||||
* @see org.jclouds.openstack.nova.v2_0.extensions.ExtensionNamespaces#EXTENDED_STATUS
|
* @see org.jclouds.openstack.nova.v2_0.extensions.ExtensionNamespaces#EXTENDED_STATUS
|
||||||
*/
|
*/
|
||||||
public class ServerExtendedAttributes {
|
public class ServerExtendedAttributes {
|
||||||
|
|
|
@ -34,7 +34,7 @@ import com.google.common.base.Objects.ToStringHelper;
|
||||||
* @see <a href=
|
* @see <a href=
|
||||||
"http://nova.openstack.org/api/nova.api.openstack.compute.contrib.extended_status.html"
|
"http://nova.openstack.org/api/nova.api.openstack.compute.contrib.extended_status.html"
|
||||||
/>
|
/>
|
||||||
* @see org.jclouds.openstack.nova.v2_0.features.ExtensionClient#getExtensionByAlias
|
* @see org.jclouds.openstack.nova.v2_0.features.ExtensionApi#getExtensionByAlias
|
||||||
* @see org.jclouds.openstack.nova.v1_1.extensions.ExtensionNamespaces#EXTENDED_STATUS (extended status?)
|
* @see org.jclouds.openstack.nova.v1_1.extensions.ExtensionNamespaces#EXTENDED_STATUS (extended status?)
|
||||||
*/
|
*/
|
||||||
public class ServerExtendedStatus {
|
public class ServerExtendedStatus {
|
||||||
|
|
|
@ -37,7 +37,7 @@ import com.google.common.collect.ImmutableSet;
|
||||||
import com.google.common.collect.Multimap;
|
import com.google.common.collect.Multimap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extended server returned by ServerWithSecurityGroupsClient
|
* Extended server returned by ServerWithSecurityGroupsApi
|
||||||
*
|
*
|
||||||
* @author Adam Lowe
|
* @author Adam Lowe
|
||||||
* @see <a href=
|
* @see <a href=
|
||||||
|
|
|
@ -31,7 +31,7 @@ import com.google.common.base.Objects.ToStringHelper;
|
||||||
* Represents a Virtual Interface (VIF)
|
* Represents a Virtual Interface (VIF)
|
||||||
*
|
*
|
||||||
* @author Adam Lowe
|
* @author Adam Lowe
|
||||||
* @see org.jclouds.openstack.nova.v2_0.extensions.VirtualInterfaceClient
|
* @see org.jclouds.openstack.nova.v2_0.extensions.VirtualInterfaceApi
|
||||||
*/
|
*/
|
||||||
public class VirtualInterface {
|
public class VirtualInterface {
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ import com.google.common.collect.ImmutableMap;
|
||||||
/**
|
/**
|
||||||
* Volume Type used in the Volume Type Extension for Nova
|
* Volume Type used in the Volume Type Extension for Nova
|
||||||
*
|
*
|
||||||
* @see org.jclouds.openstack.nova.v2_0.extensions.VolumeTypeClient
|
* @see org.jclouds.openstack.nova.v2_0.extensions.VolumeTypeApi
|
||||||
*/
|
*/
|
||||||
public class VolumeType {
|
public class VolumeType {
|
||||||
|
|
||||||
|
|
|
@ -32,11 +32,11 @@ import org.jclouds.openstack.v2_0.services.Extension;
|
||||||
* 'injectNetworkInfo', 'unpause'
|
* 'injectNetworkInfo', 'unpause'
|
||||||
*
|
*
|
||||||
* @author Adam Lowe
|
* @author Adam Lowe
|
||||||
* @see org.jclouds.openstack.nova.v2_0.extensions.AdminActionsAsyncClient
|
* @see org.jclouds.openstack.nova.v2_0.extensions.AdminActionsAsyncApi
|
||||||
*/
|
*/
|
||||||
@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.ADMIN_ACTIONS)
|
@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.ADMIN_ACTIONS)
|
||||||
@Timeout(duration = 180, timeUnit = TimeUnit.SECONDS)
|
@Timeout(duration = 180, timeUnit = TimeUnit.SECONDS)
|
||||||
public interface AdminActionsClient {
|
public interface AdminActionsApi {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Suspend a server.
|
* Suspend a server.
|
|
@ -47,16 +47,16 @@ import com.google.common.util.concurrent.ListenableFuture;
|
||||||
* Provide access to Admin Server Actions via REST API
|
* Provide access to Admin Server Actions via REST API
|
||||||
*
|
*
|
||||||
* @author Adam Lowe
|
* @author Adam Lowe
|
||||||
* @see org.jclouds.openstack.nova.v2_0.extensions.AdminActionsClient
|
* @see org.jclouds.openstack.nova.v2_0.extensions.AdminActionsApi
|
||||||
*/
|
*/
|
||||||
@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.ADMIN_ACTIONS)
|
@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.ADMIN_ACTIONS)
|
||||||
@SkipEncoding( { '/', '=' })
|
@SkipEncoding( { '/', '=' })
|
||||||
@RequestFilters(AuthenticateRequest.class)
|
@RequestFilters(AuthenticateRequest.class)
|
||||||
@Path("/servers/{id}/action")
|
@Path("/servers/{id}/action")
|
||||||
public interface AdminActionsAsyncClient {
|
public interface AdminActionsAsyncApi {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see AdminActionsClient#suspendServer(String)
|
* @see AdminActionsApi#suspendServer(String)
|
||||||
*/
|
*/
|
||||||
@POST
|
@POST
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
|
@ -65,7 +65,7 @@ public interface AdminActionsAsyncClient {
|
||||||
ListenableFuture<Boolean> suspendServer(@PathParam("id") String id);
|
ListenableFuture<Boolean> suspendServer(@PathParam("id") String id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see AdminActionsClient#resumeServer(String)
|
* @see AdminActionsApi#resumeServer(String)
|
||||||
*/
|
*/
|
||||||
@POST
|
@POST
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
|
@ -74,7 +74,7 @@ public interface AdminActionsAsyncClient {
|
||||||
ListenableFuture<Boolean> resumeServer(@PathParam("id") String id);
|
ListenableFuture<Boolean> resumeServer(@PathParam("id") String id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see AdminActionsClient#migrateServer(String)
|
* @see AdminActionsApi#migrateServer(String)
|
||||||
*/
|
*/
|
||||||
@POST
|
@POST
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
|
@ -83,7 +83,7 @@ public interface AdminActionsAsyncClient {
|
||||||
ListenableFuture<Boolean> migrateServer(@PathParam("id") String id);
|
ListenableFuture<Boolean> migrateServer(@PathParam("id") String id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see AdminActionsClient#suspendServer(String)
|
* @see AdminActionsApi#suspendServer(String)
|
||||||
*/
|
*/
|
||||||
@POST
|
@POST
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
|
@ -92,7 +92,7 @@ public interface AdminActionsAsyncClient {
|
||||||
ListenableFuture<Boolean> lockServer(@PathParam("id") String id);
|
ListenableFuture<Boolean> lockServer(@PathParam("id") String id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see AdminActionsClient#unlockServer(String)
|
* @see AdminActionsApi#unlockServer(String)
|
||||||
*/
|
*/
|
||||||
@POST
|
@POST
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
|
@ -101,7 +101,7 @@ public interface AdminActionsAsyncClient {
|
||||||
ListenableFuture<Boolean> unlockServer(@PathParam("id") String id);
|
ListenableFuture<Boolean> unlockServer(@PathParam("id") String id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see AdminActionsClient#resetNetworkOfServer(String)
|
* @see AdminActionsApi#resetNetworkOfServer(String)
|
||||||
*/
|
*/
|
||||||
@POST
|
@POST
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
|
@ -110,7 +110,7 @@ public interface AdminActionsAsyncClient {
|
||||||
ListenableFuture<Boolean> resetNetworkOfServer(@PathParam("id") String id);
|
ListenableFuture<Boolean> resetNetworkOfServer(@PathParam("id") String id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see AdminActionsClient#createBackupOfServer
|
* @see AdminActionsApi#createBackupOfServer
|
||||||
*/
|
*/
|
||||||
@POST
|
@POST
|
||||||
@Consumes(MediaType.APPLICATION_JSON)
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
|
@ -125,7 +125,7 @@ public interface AdminActionsAsyncClient {
|
||||||
CreateBackupOfServerOptions... options);
|
CreateBackupOfServerOptions... options);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see AdminActionsClient#pauseServer(String)
|
* @see AdminActionsApi#pauseServer(String)
|
||||||
*/
|
*/
|
||||||
@POST
|
@POST
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
|
@ -134,7 +134,7 @@ public interface AdminActionsAsyncClient {
|
||||||
ListenableFuture<Boolean> pauseServer(@PathParam("id") String id);
|
ListenableFuture<Boolean> pauseServer(@PathParam("id") String id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see AdminActionsClient#unpauseServer(String)
|
* @see AdminActionsApi#unpauseServer(String)
|
||||||
*/
|
*/
|
||||||
@POST
|
@POST
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
|
@ -143,7 +143,7 @@ public interface AdminActionsAsyncClient {
|
||||||
ListenableFuture<Boolean> unpauseServer(@PathParam("id") String id);
|
ListenableFuture<Boolean> unpauseServer(@PathParam("id") String id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see AdminActionsClient#suspendServer(String)
|
* @see AdminActionsApi#suspendServer(String)
|
||||||
*/
|
*/
|
||||||
@POST
|
@POST
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
|
@ -152,7 +152,7 @@ public interface AdminActionsAsyncClient {
|
||||||
ListenableFuture<Boolean> injectNetworkInfoIntoServer(@PathParam("id") String id);
|
ListenableFuture<Boolean> injectNetworkInfoIntoServer(@PathParam("id") String id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see AdminActionsClient#migrateServer(String)
|
* @see AdminActionsApi#migrateServer(String)
|
||||||
*/
|
*/
|
||||||
@POST
|
@POST
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
@Produces(MediaType.APPLICATION_JSON)
|
|
@ -32,13 +32,13 @@ import org.jclouds.rest.annotations.RequestFilters;
|
||||||
*
|
*
|
||||||
* @author Adam Lowe
|
* @author Adam Lowe
|
||||||
* @see <a href="http://nova.openstack.org/api/nova.api.openstack.compute.contrib.flavorextraspecs.html"/>
|
* @see <a href="http://nova.openstack.org/api/nova.api.openstack.compute.contrib.flavorextraspecs.html"/>
|
||||||
* @see org.jclouds.openstack.nova.v2_0.features.FlavorClient
|
* @see org.jclouds.openstack.nova.v2_0.features.FlavorApi
|
||||||
* @see org.jclouds.openstack.nova.v2_0.extensions.FlavorExtraSpecsAsyncClient
|
* @see org.jclouds.openstack.nova.v2_0.extensions.FlavorExtraSpecsAsyncApi
|
||||||
*/
|
*/
|
||||||
@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.FLAVOR_EXTRA_SPECS)
|
@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.FLAVOR_EXTRA_SPECS)
|
||||||
@Timeout(duration = 180, timeUnit = TimeUnit.SECONDS)
|
@Timeout(duration = 180, timeUnit = TimeUnit.SECONDS)
|
||||||
@RequestFilters(AuthenticateRequest.class)
|
@RequestFilters(AuthenticateRequest.class)
|
||||||
public interface FlavorExtraSpecsClient {
|
public interface FlavorExtraSpecsApi {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve all extra specs for a flavor
|
* Retrieve all extra specs for a flavor
|
|
@ -54,17 +54,17 @@ import com.google.common.util.concurrent.ListenableFuture;
|
||||||
*
|
*
|
||||||
* @author Adam Lowe
|
* @author Adam Lowe
|
||||||
* @see <a href="http://nova.openstack.org/api/nova.api.openstack.compute.contrib.flavorextraspecs.html"/>
|
* @see <a href="http://nova.openstack.org/api/nova.api.openstack.compute.contrib.flavorextraspecs.html"/>
|
||||||
* @see org.jclouds.openstack.nova.v2_0.features.FlavorClient
|
* @see org.jclouds.openstack.nova.v2_0.features.FlavorApi
|
||||||
* @see FlavorExtraSpecsClient
|
* @see FlavorExtraSpecsApi
|
||||||
*/
|
*/
|
||||||
@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.FLAVOR_EXTRA_SPECS)
|
@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.FLAVOR_EXTRA_SPECS)
|
||||||
@Timeout(duration = 180, timeUnit = TimeUnit.SECONDS)
|
@Timeout(duration = 180, timeUnit = TimeUnit.SECONDS)
|
||||||
@RequestFilters(AuthenticateRequest.class)
|
@RequestFilters(AuthenticateRequest.class)
|
||||||
@Consumes(MediaType.APPLICATION_JSON)
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
public interface FlavorExtraSpecsAsyncClient {
|
public interface FlavorExtraSpecsAsyncApi {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see FlavorExtraSpecsClient#getAllExtraSpecs(String)
|
* @see FlavorExtraSpecsApi#getAllExtraSpecs(String)
|
||||||
*/
|
*/
|
||||||
@GET
|
@GET
|
||||||
@SelectJson("extra_specs")
|
@SelectJson("extra_specs")
|
||||||
|
@ -73,7 +73,7 @@ public interface FlavorExtraSpecsAsyncClient {
|
||||||
ListenableFuture<Map<String, String>> getAllExtraSpecs(@PathParam("flavor_id") String flavorId);
|
ListenableFuture<Map<String, String>> getAllExtraSpecs(@PathParam("flavor_id") String flavorId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see FlavorExtraSpecsClient#setExtraSpec(String, String, String)
|
* @see FlavorExtraSpecsApi#setExtraSpec(String, String, String)
|
||||||
*/
|
*/
|
||||||
@POST
|
@POST
|
||||||
@Path("/flavors/{flavor_id}/os-extra_specs")
|
@Path("/flavors/{flavor_id}/os-extra_specs")
|
||||||
|
@ -83,7 +83,7 @@ public interface FlavorExtraSpecsAsyncClient {
|
||||||
ListenableFuture<Boolean> setAllExtraSpecs(@PathParam("flavor_id") String flavorId, @PayloadParam("extra_specs") Map<String, String> specs);
|
ListenableFuture<Boolean> setAllExtraSpecs(@PathParam("flavor_id") String flavorId, @PayloadParam("extra_specs") Map<String, String> specs);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see FlavorExtraSpecsClient#getExtraSpec(String, String)
|
* @see FlavorExtraSpecsApi#getExtraSpec(String, String)
|
||||||
*/
|
*/
|
||||||
@GET
|
@GET
|
||||||
@Path("/flavors/{flavor_id}/os-extra_specs/{key}")
|
@Path("/flavors/{flavor_id}/os-extra_specs/{key}")
|
||||||
|
@ -92,7 +92,7 @@ public interface FlavorExtraSpecsAsyncClient {
|
||||||
ListenableFuture<String> getExtraSpec(@PathParam("flavor_id") String flavorId, @PathParam("key") String key);
|
ListenableFuture<String> getExtraSpec(@PathParam("flavor_id") String flavorId, @PathParam("key") String key);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see FlavorExtraSpecsClient#setExtraSpec(String, String, String)
|
* @see FlavorExtraSpecsApi#setExtraSpec(String, String, String)
|
||||||
*/
|
*/
|
||||||
@PUT
|
@PUT
|
||||||
@Path("/flavors/{flavor_id}/os-extra_specs/{key}")
|
@Path("/flavors/{flavor_id}/os-extra_specs/{key}")
|
||||||
|
@ -104,7 +104,7 @@ public interface FlavorExtraSpecsAsyncClient {
|
||||||
@PayloadParam("value") String value);
|
@PayloadParam("value") String value);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see FlavorExtraSpecsClient#deleteExtraSpec(String, String)
|
* @see FlavorExtraSpecsApi#deleteExtraSpec(String, String)
|
||||||
*/
|
*/
|
||||||
@DELETE
|
@DELETE
|
||||||
@Path("/flavors/{flavor_id}/os-extra_specs/{key}")
|
@Path("/flavors/{flavor_id}/os-extra_specs/{key}")
|
|
@ -30,12 +30,12 @@ import org.jclouds.openstack.v2_0.services.Extension;
|
||||||
* Provides synchronous access to Floating IPs.
|
* Provides synchronous access to Floating IPs.
|
||||||
* <p/>
|
* <p/>
|
||||||
*
|
*
|
||||||
* @see FloatingIPAsyncClient
|
* @see FloatingIPAsyncApi
|
||||||
* @author Jeremy Daggett
|
* @author Jeremy Daggett
|
||||||
*/
|
*/
|
||||||
@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.FLOATING_IPS)
|
@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.FLOATING_IPS)
|
||||||
@Timeout(duration = 180, timeUnit = TimeUnit.SECONDS)
|
@Timeout(duration = 180, timeUnit = TimeUnit.SECONDS)
|
||||||
public interface FloatingIPClient {
|
public interface FloatingIPApi {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List all Floating IP addresses
|
* List all Floating IP addresses
|
||||||
|
@ -74,7 +74,7 @@ public interface FloatingIPClient {
|
||||||
* @param address
|
* @param address
|
||||||
* the IP address to add
|
* the IP address to add
|
||||||
*
|
*
|
||||||
* NOTE: Possibly move this to ServerClient?
|
* NOTE: Possibly move this to ServerApi?
|
||||||
*/
|
*/
|
||||||
void addFloatingIPToServer(String address, String serverId);
|
void addFloatingIPToServer(String address, String serverId);
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ public interface FloatingIPClient {
|
||||||
* @param address
|
* @param address
|
||||||
* the IP address to remove
|
* the IP address to remove
|
||||||
*
|
*
|
||||||
* NOTE: Possibly move this to ServerClient?
|
* NOTE: Possibly move this to ServerApi?
|
||||||
*/
|
*/
|
||||||
void removeFloatingIPFromServer(String address, String serverId);
|
void removeFloatingIPFromServer(String address, String serverId);
|
||||||
}
|
}
|
|
@ -31,7 +31,7 @@ import javax.ws.rs.core.MediaType;
|
||||||
|
|
||||||
import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
|
import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
|
||||||
import org.jclouds.openstack.nova.v2_0.domain.FloatingIP;
|
import org.jclouds.openstack.nova.v2_0.domain.FloatingIP;
|
||||||
import org.jclouds.openstack.nova.v2_0.features.ExtensionAsyncClient;
|
import org.jclouds.openstack.nova.v2_0.features.ExtensionAsyncApi;
|
||||||
import org.jclouds.openstack.v2_0.ServiceType;
|
import org.jclouds.openstack.v2_0.ServiceType;
|
||||||
import org.jclouds.openstack.v2_0.services.Extension;
|
import org.jclouds.openstack.v2_0.services.Extension;
|
||||||
import org.jclouds.rest.annotations.ExceptionParser;
|
import org.jclouds.rest.annotations.ExceptionParser;
|
||||||
|
@ -49,9 +49,9 @@ import com.google.common.util.concurrent.ListenableFuture;
|
||||||
* Provides asynchronous access to Floating IPs via the REST API.
|
* Provides asynchronous access to Floating IPs via the REST API.
|
||||||
* <p/>
|
* <p/>
|
||||||
*
|
*
|
||||||
* @see FloatingIPClient
|
* @see FloatingIPApi
|
||||||
* @author Jeremy Daggett
|
* @author Jeremy Daggett
|
||||||
* @see ExtensionAsyncClient
|
* @see ExtensionAsyncApi
|
||||||
* @see <a href= "http://docs.openstack.org/api/openstack-compute/2/content/Extensions-d1e1444.html"
|
* @see <a href= "http://docs.openstack.org/api/openstack-compute/2/content/Extensions-d1e1444.html"
|
||||||
* />
|
* />
|
||||||
* @see <a href="http://nova.openstack.org/api_ext" />
|
* @see <a href="http://nova.openstack.org/api_ext" />
|
||||||
|
@ -60,10 +60,10 @@ import com.google.common.util.concurrent.ListenableFuture;
|
||||||
@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.FLOATING_IPS)
|
@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.FLOATING_IPS)
|
||||||
@SkipEncoding( { '/', '=' })
|
@SkipEncoding( { '/', '=' })
|
||||||
@RequestFilters(AuthenticateRequest.class)
|
@RequestFilters(AuthenticateRequest.class)
|
||||||
public interface FloatingIPAsyncClient {
|
public interface FloatingIPAsyncApi {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see FloatingIPClient#listFloatingIPs
|
* @see FloatingIPApi#listFloatingIPs
|
||||||
*/
|
*/
|
||||||
@GET
|
@GET
|
||||||
@Path("/os-floating-ips")
|
@Path("/os-floating-ips")
|
||||||
|
@ -73,7 +73,7 @@ public interface FloatingIPAsyncClient {
|
||||||
ListenableFuture<Set<FloatingIP>> listFloatingIPs();
|
ListenableFuture<Set<FloatingIP>> listFloatingIPs();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see FloatingIPClient#getFloatingIP
|
* @see FloatingIPApi#getFloatingIP
|
||||||
*/
|
*/
|
||||||
@GET
|
@GET
|
||||||
@Path("/os-floating-ips/{id}")
|
@Path("/os-floating-ips/{id}")
|
||||||
|
@ -83,7 +83,7 @@ public interface FloatingIPAsyncClient {
|
||||||
ListenableFuture<FloatingIP> getFloatingIP(@PathParam("id") String id);
|
ListenableFuture<FloatingIP> getFloatingIP(@PathParam("id") String id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see FloatingIPClient#allocate
|
* @see FloatingIPApi#allocate
|
||||||
*/
|
*/
|
||||||
@POST
|
@POST
|
||||||
@Path("/os-floating-ips")
|
@Path("/os-floating-ips")
|
||||||
|
@ -95,7 +95,7 @@ public interface FloatingIPAsyncClient {
|
||||||
ListenableFuture<FloatingIP> allocate();
|
ListenableFuture<FloatingIP> allocate();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see FloatingIPClient#deallocate
|
* @see FloatingIPApi#deallocate
|
||||||
*/
|
*/
|
||||||
@DELETE
|
@DELETE
|
||||||
@Consumes(MediaType.APPLICATION_JSON)
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
|
@ -104,7 +104,7 @@ public interface FloatingIPAsyncClient {
|
||||||
ListenableFuture<Void> deallocate(@PathParam("id") String id);
|
ListenableFuture<Void> deallocate(@PathParam("id") String id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see FloatingIPClient#addFloatingIPToServer
|
* @see FloatingIPApi#addFloatingIPToServer
|
||||||
*/
|
*/
|
||||||
@POST
|
@POST
|
||||||
@Path("/servers/{server}/action")
|
@Path("/servers/{server}/action")
|
||||||
|
@ -115,7 +115,7 @@ public interface FloatingIPAsyncClient {
|
||||||
@PathParam("server") String serverId);
|
@PathParam("server") String serverId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see FloatingIPClient#removeFloatingIPFromServer
|
* @see FloatingIPApi#removeFloatingIPFromServer
|
||||||
*/
|
*/
|
||||||
@POST
|
@POST
|
||||||
@Path("/servers/{server}/action")
|
@Path("/servers/{server}/action")
|
|
@ -32,11 +32,11 @@ import org.jclouds.openstack.v2_0.services.Extension;
|
||||||
* <p/>
|
* <p/>
|
||||||
*
|
*
|
||||||
* @author Adam Lowe
|
* @author Adam Lowe
|
||||||
* @see HostAdministrationAsyncClient
|
* @see HostAdministrationAsyncApi
|
||||||
*/
|
*/
|
||||||
@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.HOSTS)
|
@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.HOSTS)
|
||||||
@Timeout(duration = 180, timeUnit = TimeUnit.SECONDS)
|
@Timeout(duration = 180, timeUnit = TimeUnit.SECONDS)
|
||||||
public interface HostAdministrationClient {
|
public interface HostAdministrationApi {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the list of hosts
|
* Returns the list of hosts
|
|
@ -55,7 +55,7 @@ import com.google.common.util.concurrent.ListenableFuture;
|
||||||
* <p/>
|
* <p/>
|
||||||
*
|
*
|
||||||
* @author Adam Lowe
|
* @author Adam Lowe
|
||||||
* @see HostAdministrationClient
|
* @see HostAdministrationApi
|
||||||
* @see <a href= "http://docs.openstack.org/api/openstack-compute/2/content/Extensions-d1e1444.html"/>
|
* @see <a href= "http://docs.openstack.org/api/openstack-compute/2/content/Extensions-d1e1444.html"/>
|
||||||
* @see <a href="http://nova.openstack.org/api_ext" />
|
* @see <a href="http://nova.openstack.org/api_ext" />
|
||||||
* @see <a href="http://nova.openstack.org/api/nova.api.openstack.compute.contrib.hosts.html" />
|
* @see <a href="http://nova.openstack.org/api/nova.api.openstack.compute.contrib.hosts.html" />
|
||||||
|
@ -65,10 +65,10 @@ import com.google.common.util.concurrent.ListenableFuture;
|
||||||
@RequestFilters(AuthenticateRequest.class)
|
@RequestFilters(AuthenticateRequest.class)
|
||||||
@Path("/os-hosts")
|
@Path("/os-hosts")
|
||||||
@Consumes(MediaType.APPLICATION_JSON)
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
public interface HostAdministrationAsyncClient {
|
public interface HostAdministrationAsyncApi {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see HostAdministrationClient#listHosts()
|
* @see HostAdministrationApi#listHosts()
|
||||||
*/
|
*/
|
||||||
@GET
|
@GET
|
||||||
@SelectJson("hosts")
|
@SelectJson("hosts")
|
||||||
|
@ -76,7 +76,7 @@ public interface HostAdministrationAsyncClient {
|
||||||
ListenableFuture<Set<Host>> listHosts();
|
ListenableFuture<Set<Host>> listHosts();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see HostAdministrationClient#getHostResourceUsage(String)
|
* @see HostAdministrationApi#getHostResourceUsage(String)
|
||||||
*/
|
*/
|
||||||
@GET
|
@GET
|
||||||
@Path("/{id}")
|
@Path("/{id}")
|
||||||
|
@ -85,7 +85,7 @@ public interface HostAdministrationAsyncClient {
|
||||||
ListenableFuture<Set<HostResourceUsage>> getHostResourceUsage(@PathParam("id") String hostId);
|
ListenableFuture<Set<HostResourceUsage>> getHostResourceUsage(@PathParam("id") String hostId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see HostAdministrationClient#enableHost(String)
|
* @see HostAdministrationApi#enableHost(String)
|
||||||
*/
|
*/
|
||||||
@PUT
|
@PUT
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
|
@ -95,7 +95,7 @@ public interface HostAdministrationAsyncClient {
|
||||||
ListenableFuture<Boolean> enableHost(@PathParam("id") String hostId);
|
ListenableFuture<Boolean> enableHost(@PathParam("id") String hostId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see HostAdministrationClient#disableHost(String)
|
* @see HostAdministrationApi#disableHost(String)
|
||||||
*/
|
*/
|
||||||
@PUT
|
@PUT
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
|
@ -105,7 +105,7 @@ public interface HostAdministrationAsyncClient {
|
||||||
ListenableFuture<Boolean> disableHost(@PathParam("id") String hostId);
|
ListenableFuture<Boolean> disableHost(@PathParam("id") String hostId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see HostAdministrationClient#startHostMaintenance(String)
|
* @see HostAdministrationApi#startHostMaintenance(String)
|
||||||
*/
|
*/
|
||||||
@PUT
|
@PUT
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
|
@ -115,7 +115,7 @@ public interface HostAdministrationAsyncClient {
|
||||||
ListenableFuture<Boolean> startHostMaintenance(@PathParam("id") String hostId);
|
ListenableFuture<Boolean> startHostMaintenance(@PathParam("id") String hostId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see HostAdministrationClient#stopHostMaintenance(String)
|
* @see HostAdministrationApi#stopHostMaintenance(String)
|
||||||
*/
|
*/
|
||||||
@PUT
|
@PUT
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
|
@ -125,7 +125,7 @@ public interface HostAdministrationAsyncClient {
|
||||||
ListenableFuture<Boolean> stopHostMaintenance(@PathParam("id") String hostId);
|
ListenableFuture<Boolean> stopHostMaintenance(@PathParam("id") String hostId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see HostAdministrationClient#startupHost(String)
|
* @see HostAdministrationApi#startupHost(String)
|
||||||
*/
|
*/
|
||||||
@GET
|
@GET
|
||||||
@Path("/{id}/startup")
|
@Path("/{id}/startup")
|
||||||
|
@ -133,7 +133,7 @@ public interface HostAdministrationAsyncClient {
|
||||||
ListenableFuture<Boolean> startupHost(@PathParam("id") String hostId);
|
ListenableFuture<Boolean> startupHost(@PathParam("id") String hostId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see HostAdministrationClient#shutdownHost(String)
|
* @see HostAdministrationApi#shutdownHost(String)
|
||||||
*/
|
*/
|
||||||
@GET
|
@GET
|
||||||
@Path("/{id}/shutdown")
|
@Path("/{id}/shutdown")
|
||||||
|
@ -141,7 +141,7 @@ public interface HostAdministrationAsyncClient {
|
||||||
ListenableFuture<Boolean> shutdownHost(@PathParam("id") String hostId);
|
ListenableFuture<Boolean> shutdownHost(@PathParam("id") String hostId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see HostAdministrationClient#rebootHost(String)
|
* @see HostAdministrationApi#rebootHost(String)
|
||||||
*/
|
*/
|
||||||
@GET
|
@GET
|
||||||
@Path("/{id}/reboot")
|
@Path("/{id}/reboot")
|
|
@ -33,14 +33,14 @@ import org.jclouds.rest.annotations.RequestFilters;
|
||||||
* Provide access to Host Aggregates in Nova (alias "OS-AGGREGATES")
|
* Provide access to Host Aggregates in Nova (alias "OS-AGGREGATES")
|
||||||
*
|
*
|
||||||
* @author Adam Lowe
|
* @author Adam Lowe
|
||||||
* @see HostAggregateAsyncClient
|
* @see HostAggregateAsyncApi
|
||||||
* @see <a href="http://nova.openstack.org/api_ext/ext_aggregates.html"/>
|
* @see <a href="http://nova.openstack.org/api_ext/ext_aggregates.html"/>
|
||||||
* @see <a href="http://wiki.openstack.org/host-aggregates"/>
|
* @see <a href="http://wiki.openstack.org/host-aggregates"/>
|
||||||
*/
|
*/
|
||||||
@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.AGGREGATES)
|
@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.AGGREGATES)
|
||||||
@Timeout(duration = 180, timeUnit = TimeUnit.SECONDS)
|
@Timeout(duration = 180, timeUnit = TimeUnit.SECONDS)
|
||||||
@RequestFilters(AuthenticateRequest.class)
|
@RequestFilters(AuthenticateRequest.class)
|
||||||
public interface HostAggregateClient {
|
public interface HostAggregateApi {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the set of host aggregates.
|
* @return the set of host aggregates.
|
|
@ -51,16 +51,16 @@ import com.google.common.util.concurrent.ListenableFuture;
|
||||||
* Provide access to Aggregates in Nova.
|
* Provide access to Aggregates in Nova.
|
||||||
*
|
*
|
||||||
* @author Adam Lowe
|
* @author Adam Lowe
|
||||||
* @see HostAggregateClient
|
* @see HostAggregateApi
|
||||||
*/
|
*/
|
||||||
@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.AGGREGATES)
|
@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.AGGREGATES)
|
||||||
@Timeout(duration = 180, timeUnit = TimeUnit.SECONDS)
|
@Timeout(duration = 180, timeUnit = TimeUnit.SECONDS)
|
||||||
@RequestFilters(AuthenticateRequest.class)
|
@RequestFilters(AuthenticateRequest.class)
|
||||||
@Path("/os-aggregates")
|
@Path("/os-aggregates")
|
||||||
public interface HostAggregateAsyncClient {
|
public interface HostAggregateAsyncApi {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see HostAggregateClient#listAggregates()
|
* @see HostAggregateApi#listAggregates()
|
||||||
*/
|
*/
|
||||||
@GET
|
@GET
|
||||||
@SelectJson("aggregates")
|
@SelectJson("aggregates")
|
||||||
|
@ -69,7 +69,7 @@ public interface HostAggregateAsyncClient {
|
||||||
ListenableFuture<Set<HostAggregate>> listAggregates();
|
ListenableFuture<Set<HostAggregate>> listAggregates();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see HostAggregateClient#getAggregate(String)
|
* @see HostAggregateApi#getAggregate(String)
|
||||||
*/
|
*/
|
||||||
@GET
|
@GET
|
||||||
@Path("/{id}")
|
@Path("/{id}")
|
||||||
|
@ -79,7 +79,7 @@ public interface HostAggregateAsyncClient {
|
||||||
ListenableFuture<HostAggregate> getAggregate(@PathParam("id") String id);
|
ListenableFuture<HostAggregate> getAggregate(@PathParam("id") String id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see HostAggregateClient#createAggregate(String, String)
|
* @see HostAggregateApi#createAggregate(String, String)
|
||||||
*/
|
*/
|
||||||
@POST
|
@POST
|
||||||
@SelectJson("aggregate")
|
@SelectJson("aggregate")
|
||||||
|
@ -90,7 +90,7 @@ public interface HostAggregateAsyncClient {
|
||||||
@PayloadParam("availability_zone") String availablityZone);
|
@PayloadParam("availability_zone") String availablityZone);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see HostAggregateClient#updateName
|
* @see HostAggregateApi#updateName
|
||||||
*/
|
*/
|
||||||
@POST
|
@POST
|
||||||
@Path("/{id}")
|
@Path("/{id}")
|
||||||
|
@ -100,7 +100,7 @@ public interface HostAggregateAsyncClient {
|
||||||
ListenableFuture<HostAggregate> updateName(@PathParam("id") String id, @PayloadParam("name") String name);
|
ListenableFuture<HostAggregate> updateName(@PathParam("id") String id, @PayloadParam("name") String name);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see HostAggregateClient#updateAvailabilityZone
|
* @see HostAggregateApi#updateAvailabilityZone
|
||||||
*/
|
*/
|
||||||
@POST
|
@POST
|
||||||
@Path("/{id}")
|
@Path("/{id}")
|
||||||
|
@ -110,7 +110,7 @@ public interface HostAggregateAsyncClient {
|
||||||
ListenableFuture<HostAggregate> updateAvailabilityZone(@PathParam("id") String id, @PayloadParam("availability_zone") String availabilityZone);
|
ListenableFuture<HostAggregate> updateAvailabilityZone(@PathParam("id") String id, @PayloadParam("availability_zone") String availabilityZone);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see HostAggregateClient#deleteAggregate(String)
|
* @see HostAggregateApi#deleteAggregate(String)
|
||||||
*/
|
*/
|
||||||
@DELETE
|
@DELETE
|
||||||
@Path("/{id}")
|
@Path("/{id}")
|
||||||
|
@ -119,7 +119,7 @@ public interface HostAggregateAsyncClient {
|
||||||
ListenableFuture<Boolean> deleteAggregate(@PathParam("id") String id);
|
ListenableFuture<Boolean> deleteAggregate(@PathParam("id") String id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see HostAggregateClient#addHost(String,String)
|
* @see HostAggregateApi#addHost(String,String)
|
||||||
*/
|
*/
|
||||||
@POST
|
@POST
|
||||||
@Path("/{id}/action")
|
@Path("/{id}/action")
|
||||||
|
@ -131,7 +131,7 @@ public interface HostAggregateAsyncClient {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see HostAggregateClient#removeHost(String,String)
|
* @see HostAggregateApi#removeHost(String,String)
|
||||||
*/
|
*/
|
||||||
@POST
|
@POST
|
||||||
@Path("/{id}/action")
|
@Path("/{id}/action")
|
||||||
|
@ -142,7 +142,7 @@ public interface HostAggregateAsyncClient {
|
||||||
ListenableFuture<HostAggregate> removeHost(@PathParam("id") String id, @PayloadParam("host") String host);
|
ListenableFuture<HostAggregate> removeHost(@PathParam("id") String id, @PayloadParam("host") String host);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see HostAggregateClient#setMetadata
|
* @see HostAggregateApi#setMetadata
|
||||||
*/
|
*/
|
||||||
@POST
|
@POST
|
||||||
@Path("/{id}/action")
|
@Path("/{id}/action")
|
|
@ -31,12 +31,12 @@ import org.jclouds.openstack.v2_0.services.Extension;
|
||||||
* Provides synchronous access to Security Groups.
|
* Provides synchronous access to Security Groups.
|
||||||
* <p/>
|
* <p/>
|
||||||
*
|
*
|
||||||
* @see KeyPairAsyncClient
|
* @see KeyPairAsyncApi
|
||||||
* @author Jeremy Daggett
|
* @author Jeremy Daggett
|
||||||
*/
|
*/
|
||||||
@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.KEYPAIRS)
|
@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.KEYPAIRS)
|
||||||
@Timeout(duration = 180, timeUnit = TimeUnit.SECONDS)
|
@Timeout(duration = 180, timeUnit = TimeUnit.SECONDS)
|
||||||
public interface KeyPairClient {
|
public interface KeyPairApi {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List all Key Pairs.
|
* List all Key Pairs.
|
|
@ -32,7 +32,7 @@ import javax.ws.rs.core.MediaType;
|
||||||
|
|
||||||
import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
|
import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
|
||||||
import org.jclouds.openstack.nova.v2_0.domain.KeyPair;
|
import org.jclouds.openstack.nova.v2_0.domain.KeyPair;
|
||||||
import org.jclouds.openstack.nova.v2_0.features.ExtensionAsyncClient;
|
import org.jclouds.openstack.nova.v2_0.features.ExtensionAsyncApi;
|
||||||
import org.jclouds.openstack.v2_0.ServiceType;
|
import org.jclouds.openstack.v2_0.ServiceType;
|
||||||
import org.jclouds.openstack.v2_0.services.Extension;
|
import org.jclouds.openstack.v2_0.services.Extension;
|
||||||
import org.jclouds.rest.annotations.ExceptionParser;
|
import org.jclouds.rest.annotations.ExceptionParser;
|
||||||
|
@ -50,9 +50,9 @@ import com.google.common.util.concurrent.ListenableFuture;
|
||||||
* Provides asynchronous access to Key Pairs via the REST API.
|
* Provides asynchronous access to Key Pairs via the REST API.
|
||||||
* <p/>
|
* <p/>
|
||||||
*
|
*
|
||||||
* @see KeyPairClient
|
* @see KeyPairApi
|
||||||
* @author Jeremy Daggett
|
* @author Jeremy Daggett
|
||||||
* @see ExtensionAsyncClient
|
* @see ExtensionAsyncApi
|
||||||
* @see <a href=
|
* @see <a href=
|
||||||
* "http://docs.openstack.org/api/openstack-compute/2/content/Extensions-d1e1444.html"
|
* "http://docs.openstack.org/api/openstack-compute/2/content/Extensions-d1e1444.html"
|
||||||
* />
|
* />
|
||||||
|
@ -62,7 +62,7 @@ import com.google.common.util.concurrent.ListenableFuture;
|
||||||
@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.KEYPAIRS)
|
@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.KEYPAIRS)
|
||||||
@SkipEncoding({ '/', '=' })
|
@SkipEncoding({ '/', '=' })
|
||||||
@RequestFilters(AuthenticateRequest.class)
|
@RequestFilters(AuthenticateRequest.class)
|
||||||
public interface KeyPairAsyncClient {
|
public interface KeyPairAsyncApi {
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("/os-keypairs")
|
@Path("/os-keypairs")
|
|
@ -35,13 +35,13 @@ import org.jclouds.rest.annotations.RequestFilters;
|
||||||
* To use this extension, you need to have administrative rights to the tenants upon which you are placing quotas.
|
* To use this extension, you need to have administrative rights to the tenants upon which you are placing quotas.
|
||||||
*
|
*
|
||||||
* @author Adam Lowe
|
* @author Adam Lowe
|
||||||
* @see QuotaAsyncClient
|
* @see QuotaAsyncApi
|
||||||
* @see <a href="http://nova.openstack.org/api_ext/ext_quotas.html"/>
|
* @see <a href="http://nova.openstack.org/api_ext/ext_quotas.html"/>
|
||||||
*/
|
*/
|
||||||
@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.QUOTAS)
|
@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.QUOTAS)
|
||||||
@Timeout(duration = 180, timeUnit = TimeUnit.SECONDS)
|
@Timeout(duration = 180, timeUnit = TimeUnit.SECONDS)
|
||||||
@RequestFilters(AuthenticateRequest.class)
|
@RequestFilters(AuthenticateRequest.class)
|
||||||
public interface QuotaClient {
|
public interface QuotaApi {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the quota settings for the tenant
|
* @return the quota settings for the tenant
|
|
@ -47,17 +47,17 @@ import com.google.common.util.concurrent.ListenableFuture;
|
||||||
* Provide access to Quota information for Nova tenants.
|
* Provide access to Quota information for Nova tenants.
|
||||||
*
|
*
|
||||||
* @author Adam Lowe
|
* @author Adam Lowe
|
||||||
* @see QuotaClient
|
* @see QuotaApi
|
||||||
* @see <a href="http://nova.openstack.org/api_ext/ext_quotas.html"/>
|
* @see <a href="http://nova.openstack.org/api_ext/ext_quotas.html"/>
|
||||||
*/
|
*/
|
||||||
@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.QUOTAS)
|
@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.QUOTAS)
|
||||||
@Timeout(duration = 180, timeUnit = TimeUnit.SECONDS)
|
@Timeout(duration = 180, timeUnit = TimeUnit.SECONDS)
|
||||||
@RequestFilters(AuthenticateRequest.class)
|
@RequestFilters(AuthenticateRequest.class)
|
||||||
@Path("/os-quota-sets")
|
@Path("/os-quota-sets")
|
||||||
public interface QuotaAsyncClient {
|
public interface QuotaAsyncApi {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see QuotaClient#getDefaultQuotasForTenant(String)
|
* @see QuotaApi#getDefaultQuotasForTenant(String)
|
||||||
*/
|
*/
|
||||||
@GET
|
@GET
|
||||||
@SelectJson("quota_set")
|
@SelectJson("quota_set")
|
||||||
|
@ -67,7 +67,7 @@ public interface QuotaAsyncClient {
|
||||||
ListenableFuture<Quotas> getQuotasForTenant(@PathParam("tenant_id") String tenantId);
|
ListenableFuture<Quotas> getQuotasForTenant(@PathParam("tenant_id") String tenantId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see QuotaClient#updateQuotasForTenant(String, org.jclouds.openstack.nova.v2_0.domain.Quotas)
|
* @see QuotaApi#updateQuotasForTenant(String, org.jclouds.openstack.nova.v2_0.domain.Quotas)
|
||||||
*/
|
*/
|
||||||
@PUT
|
@PUT
|
||||||
@Path("/{tenant_id}")
|
@Path("/{tenant_id}")
|
||||||
|
@ -76,7 +76,7 @@ public interface QuotaAsyncClient {
|
||||||
ListenableFuture<Boolean> updateQuotasForTenant(@PathParam("tenant_id") String tenantId, @PayloadParam("quota_set") Quotas quotas);
|
ListenableFuture<Boolean> updateQuotasForTenant(@PathParam("tenant_id") String tenantId, @PayloadParam("quota_set") Quotas quotas);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see QuotaClient#getDefaultQuotasForTenant(String)
|
* @see QuotaApi#getDefaultQuotasForTenant(String)
|
||||||
*/
|
*/
|
||||||
@GET
|
@GET
|
||||||
@SelectJson("quota_set")
|
@SelectJson("quota_set")
|
|
@ -33,14 +33,14 @@ import org.jclouds.rest.annotations.RequestFilters;
|
||||||
* To use this extension, you need to have administrative rights to the tenants upon which you are placing quotas.
|
* To use this extension, you need to have administrative rights to the tenants upon which you are placing quotas.
|
||||||
*
|
*
|
||||||
* @author Adam Lowe
|
* @author Adam Lowe
|
||||||
* @see QuotaClassAsyncClient
|
* @see QuotaClassAsyncApi
|
||||||
* @see <a href="http://nova.openstack.org/api/nova.api.openstack.compute.contrib.quota_classes.html"/>
|
* @see <a href="http://nova.openstack.org/api/nova.api.openstack.compute.contrib.quota_classes.html"/>
|
||||||
* @see <a href="http://wiki.openstack.org/QuotaClass"/>
|
* @see <a href="http://wiki.openstack.org/QuotaClass"/>
|
||||||
*/
|
*/
|
||||||
@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.QUOTA_CLASSES)
|
@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.QUOTA_CLASSES)
|
||||||
@Timeout(duration = 180, timeUnit = TimeUnit.SECONDS)
|
@Timeout(duration = 180, timeUnit = TimeUnit.SECONDS)
|
||||||
@RequestFilters(AuthenticateRequest.class)
|
@RequestFilters(AuthenticateRequest.class)
|
||||||
public interface QuotaClassClient {
|
public interface QuotaClassApi {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the quota settings for the tenant
|
* @return the quota settings for the tenant
|
|
@ -47,7 +47,7 @@ import com.google.common.util.concurrent.ListenableFuture;
|
||||||
* Provides asynchronous access to Quota Classes via the REST API.
|
* Provides asynchronous access to Quota Classes via the REST API.
|
||||||
*
|
*
|
||||||
* @author Adam Lowe
|
* @author Adam Lowe
|
||||||
* @see QuotaClassClient
|
* @see QuotaClassApi
|
||||||
* @see <a href="http://nova.openstack.org/api/nova.api.openstack.compute.contrib.quota_classes.html"/>
|
* @see <a href="http://nova.openstack.org/api/nova.api.openstack.compute.contrib.quota_classes.html"/>
|
||||||
* @see <a href="http://wiki.openstack.org/QuotaClass"/>
|
* @see <a href="http://wiki.openstack.org/QuotaClass"/>
|
||||||
*/
|
*/
|
||||||
|
@ -55,10 +55,10 @@ import com.google.common.util.concurrent.ListenableFuture;
|
||||||
@Timeout(duration = 180, timeUnit = TimeUnit.SECONDS)
|
@Timeout(duration = 180, timeUnit = TimeUnit.SECONDS)
|
||||||
@RequestFilters(AuthenticateRequest.class)
|
@RequestFilters(AuthenticateRequest.class)
|
||||||
@Path("/os-quota-class-sets")
|
@Path("/os-quota-class-sets")
|
||||||
public interface QuotaClassAsyncClient {
|
public interface QuotaClassAsyncApi {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see QuotaClassClient#getQuotaClass
|
* @see QuotaClassApi#getQuotaClass
|
||||||
*/
|
*/
|
||||||
@GET
|
@GET
|
||||||
@SelectJson("quota_class_set")
|
@SelectJson("quota_class_set")
|
||||||
|
@ -68,7 +68,7 @@ public interface QuotaClassAsyncClient {
|
||||||
ListenableFuture<QuotaClass> getQuotaClass(@PathParam("id") String id);
|
ListenableFuture<QuotaClass> getQuotaClass(@PathParam("id") String id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see QuotaClassClient#updateQuotaClass
|
* @see QuotaClassApi#updateQuotaClass
|
||||||
*/
|
*/
|
||||||
@PUT
|
@PUT
|
||||||
@Path("/{id}")
|
@Path("/{id}")
|
|
@ -32,12 +32,12 @@ import org.jclouds.openstack.v2_0.services.Extension;
|
||||||
* Provides synchronous access to Security Groups.
|
* Provides synchronous access to Security Groups.
|
||||||
* <p/>
|
* <p/>
|
||||||
*
|
*
|
||||||
* @see SecurityGroupAsyncClient
|
* @see SecurityGroupAsyncApi
|
||||||
* @author Jeremy Daggett
|
* @author Jeremy Daggett
|
||||||
*/
|
*/
|
||||||
@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.SECURITY_GROUPS)
|
@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.SECURITY_GROUPS)
|
||||||
@Timeout(duration = 180, timeUnit = TimeUnit.SECONDS)
|
@Timeout(duration = 180, timeUnit = TimeUnit.SECONDS)
|
||||||
public interface SecurityGroupClient {
|
public interface SecurityGroupApi {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List all Security Groups.
|
* List all Security Groups.
|
|
@ -53,7 +53,7 @@ import com.google.common.util.concurrent.ListenableFuture;
|
||||||
* Provides asynchronous access to Security Groups via the REST API.
|
* Provides asynchronous access to Security Groups via the REST API.
|
||||||
* <p/>
|
* <p/>
|
||||||
*
|
*
|
||||||
* @see SecurityGroupClient
|
* @see SecurityGroupApi
|
||||||
* @author Jeremy Daggett
|
* @author Jeremy Daggett
|
||||||
* @see <a href= "http://docs.openstack.org/api/openstack-compute/2/content/Extensions-d1e1444.html"
|
* @see <a href= "http://docs.openstack.org/api/openstack-compute/2/content/Extensions-d1e1444.html"
|
||||||
* />
|
* />
|
||||||
|
@ -63,10 +63,10 @@ import com.google.common.util.concurrent.ListenableFuture;
|
||||||
@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.SECURITY_GROUPS)
|
@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.SECURITY_GROUPS)
|
||||||
@SkipEncoding( { '/', '=' })
|
@SkipEncoding( { '/', '=' })
|
||||||
@RequestFilters(AuthenticateRequest.class)
|
@RequestFilters(AuthenticateRequest.class)
|
||||||
public interface SecurityGroupAsyncClient {
|
public interface SecurityGroupAsyncApi {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see SecurityGroupClient#listSecurityGroups
|
* @see SecurityGroupApi#listSecurityGroups
|
||||||
*/
|
*/
|
||||||
@GET
|
@GET
|
||||||
@SelectJson("security_groups")
|
@SelectJson("security_groups")
|
||||||
|
@ -76,7 +76,7 @@ public interface SecurityGroupAsyncClient {
|
||||||
ListenableFuture<Set<SecurityGroup>> listSecurityGroups();
|
ListenableFuture<Set<SecurityGroup>> listSecurityGroups();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see SecurityGroupClient#getSecurityGroup
|
* @see SecurityGroupApi#getSecurityGroup
|
||||||
*/
|
*/
|
||||||
@GET
|
@GET
|
||||||
@Path("/os-security-groups/{id}")
|
@Path("/os-security-groups/{id}")
|
||||||
|
@ -86,7 +86,7 @@ public interface SecurityGroupAsyncClient {
|
||||||
ListenableFuture<SecurityGroup> getSecurityGroup(@PathParam("id") String id);
|
ListenableFuture<SecurityGroup> getSecurityGroup(@PathParam("id") String id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see SecurityGroupClient#createSecurityGroupWithNameAndDescription
|
* @see SecurityGroupApi#createSecurityGroupWithNameAndDescription
|
||||||
*/
|
*/
|
||||||
@POST
|
@POST
|
||||||
@Path("/os-security-groups")
|
@Path("/os-security-groups")
|
||||||
|
@ -99,7 +99,7 @@ public interface SecurityGroupAsyncClient {
|
||||||
@PayloadParam("description") String description);
|
@PayloadParam("description") String description);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see SecurityGroupClient#deleteSecurityGroup
|
* @see SecurityGroupApi#deleteSecurityGroup
|
||||||
*/
|
*/
|
||||||
@DELETE
|
@DELETE
|
||||||
@Path("/os-security-groups/{id}")
|
@Path("/os-security-groups/{id}")
|
||||||
|
@ -108,7 +108,7 @@ public interface SecurityGroupAsyncClient {
|
||||||
ListenableFuture<Boolean> deleteSecurityGroup(@PathParam("id") String id);
|
ListenableFuture<Boolean> deleteSecurityGroup(@PathParam("id") String id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see SecurityGroupClient#createSecurityGroupRuleAllowingCidrBlock
|
* @see SecurityGroupApi#createSecurityGroupRuleAllowingCidrBlock
|
||||||
*/
|
*/
|
||||||
@POST
|
@POST
|
||||||
@Path("/os-security-group-rules")
|
@Path("/os-security-group-rules")
|
||||||
|
@ -122,7 +122,7 @@ public interface SecurityGroupAsyncClient {
|
||||||
@PayloadParam("cidr") String cidr);
|
@PayloadParam("cidr") String cidr);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see SecurityGroupClient#createRuleOnSecurityGroupToCidrBlock
|
* @see SecurityGroupApi#createRuleOnSecurityGroupToCidrBlock
|
||||||
*/
|
*/
|
||||||
@POST
|
@POST
|
||||||
@Path("/os-security-group-rules")
|
@Path("/os-security-group-rules")
|
||||||
|
@ -136,7 +136,7 @@ public interface SecurityGroupAsyncClient {
|
||||||
@PayloadParam("group_id") String group_id);
|
@PayloadParam("group_id") String group_id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see SecurityGroupClient#deleteSecurityGroupRule
|
* @see SecurityGroupApi#deleteSecurityGroupRule
|
||||||
*/
|
*/
|
||||||
@DELETE
|
@DELETE
|
||||||
@Path("/os-security-group-rules/{security_group_rule_ID}")
|
@Path("/os-security-group-rules/{security_group_rule_ID}")
|
|
@ -29,17 +29,17 @@ import org.jclouds.openstack.v2_0.services.Extension;
|
||||||
* Provides synchronous access to Server details including security group, referred to as the CREATESERVEREXT extension
|
* Provides synchronous access to Server details including security group, referred to as the CREATESERVEREXT extension
|
||||||
* in the nova documentation
|
* in the nova documentation
|
||||||
* <p/>
|
* <p/>
|
||||||
* NOTE: the equivalent to listServersInDetail() isn't available at the other end, so not extending ServerClient at this
|
* NOTE: the equivalent to listServersInDetail() isn't available at the other end, so not extending ServerApi at this
|
||||||
* time.
|
* time.
|
||||||
*
|
*
|
||||||
* @author Adam Lowe
|
* @author Adam Lowe
|
||||||
* @see org.jclouds.openstack.nova.v2_0.features.ServerClient
|
* @see org.jclouds.openstack.nova.v2_0.features.ServerApi
|
||||||
* @see ServerWithSecurityGroupsAsyncClient
|
* @see ServerWithSecurityGroupsAsyncApi
|
||||||
* @see <a href="http://nova.openstack.org/api/nova.api.openstack.compute.contrib.createserverext.html"/>
|
* @see <a href="http://nova.openstack.org/api/nova.api.openstack.compute.contrib.createserverext.html"/>
|
||||||
*/
|
*/
|
||||||
@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.CREATESERVEREXT)
|
@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.CREATESERVEREXT)
|
||||||
@Timeout(duration = 180, timeUnit = TimeUnit.SECONDS)
|
@Timeout(duration = 180, timeUnit = TimeUnit.SECONDS)
|
||||||
public interface ServerWithSecurityGroupsClient {
|
public interface ServerWithSecurityGroupsApi {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve details of the specified server, including security groups
|
* Retrieve details of the specified server, including security groups
|
|
@ -40,17 +40,17 @@ import com.google.common.util.concurrent.ListenableFuture;
|
||||||
* Provides synchronous access to Servers with Security Groups.
|
* Provides synchronous access to Servers with Security Groups.
|
||||||
*
|
*
|
||||||
* @author Adam Lowe
|
* @author Adam Lowe
|
||||||
* @see org.jclouds.openstack.nova.v2_0.features.ServerAsyncClient
|
* @see org.jclouds.openstack.nova.v2_0.features.ServerAsyncApi
|
||||||
* @see ServerWithSecurityGroupsClient
|
* @see ServerWithSecurityGroupsApi
|
||||||
* @see <a href="http://nova.openstack.org/api/nova.api.openstack.compute.contrib.createserverext.html"/>
|
* @see <a href="http://nova.openstack.org/api/nova.api.openstack.compute.contrib.createserverext.html"/>
|
||||||
*/
|
*/
|
||||||
@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.CREATESERVEREXT)
|
@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.CREATESERVEREXT)
|
||||||
@SkipEncoding({'/', '='})
|
@SkipEncoding({'/', '='})
|
||||||
@RequestFilters(AuthenticateRequest.class)
|
@RequestFilters(AuthenticateRequest.class)
|
||||||
public interface ServerWithSecurityGroupsAsyncClient {
|
public interface ServerWithSecurityGroupsAsyncApi {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see ServerWithSecurityGroupsClient#getServer(String)
|
* @see ServerWithSecurityGroupsApi#getServer(String)
|
||||||
*/
|
*/
|
||||||
@GET
|
@GET
|
||||||
@SelectJson("server")
|
@SelectJson("server")
|
|
@ -31,11 +31,11 @@ import org.jclouds.openstack.v2_0.services.Extension;
|
||||||
* <p/>
|
* <p/>
|
||||||
*
|
*
|
||||||
* @author Adam Lowe
|
* @author Adam Lowe
|
||||||
* @see SimpleTenantUsageAsyncClient
|
* @see SimpleTenantUsageAsyncApi
|
||||||
*/
|
*/
|
||||||
@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.SIMPLE_TENANT_USAGE)
|
@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.SIMPLE_TENANT_USAGE)
|
||||||
@Timeout(duration = 180, timeUnit = TimeUnit.SECONDS)
|
@Timeout(duration = 180, timeUnit = TimeUnit.SECONDS)
|
||||||
public interface SimpleTenantUsageClient {
|
public interface SimpleTenantUsageApi {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrive tenant_usage for all tenants
|
* Retrive tenant_usage for all tenants
|
|
@ -44,7 +44,7 @@ import com.google.common.util.concurrent.ListenableFuture;
|
||||||
* <p/>
|
* <p/>
|
||||||
*
|
*
|
||||||
* @author Adam Lowe
|
* @author Adam Lowe
|
||||||
* @see SimpleTenantUsageClient
|
* @see SimpleTenantUsageApi
|
||||||
* @see <a href= "http://docs.openstack.org/api/openstack-compute/2/content/Extensions-d1e1444.html" />
|
* @see <a href= "http://docs.openstack.org/api/openstack-compute/2/content/Extensions-d1e1444.html" />
|
||||||
* @see <a href="http://nova.openstack.org/api_ext" />
|
* @see <a href="http://nova.openstack.org/api_ext" />
|
||||||
* @see <a href="http://nova.openstack.org/api/nova.api.openstack.compute.contrib.simple_tenant_usage.html" />
|
* @see <a href="http://nova.openstack.org/api/nova.api.openstack.compute.contrib.simple_tenant_usage.html" />
|
||||||
|
@ -52,10 +52,10 @@ import com.google.common.util.concurrent.ListenableFuture;
|
||||||
@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.SIMPLE_TENANT_USAGE)
|
@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.SIMPLE_TENANT_USAGE)
|
||||||
@SkipEncoding({'/', '='})
|
@SkipEncoding({'/', '='})
|
||||||
@RequestFilters(AuthenticateRequest.class)
|
@RequestFilters(AuthenticateRequest.class)
|
||||||
public interface SimpleTenantUsageAsyncClient {
|
public interface SimpleTenantUsageAsyncApi {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see SimpleTenantUsageClient#listTenantUsages()
|
* @see SimpleTenantUsageApi#listTenantUsages()
|
||||||
*/
|
*/
|
||||||
@GET
|
@GET
|
||||||
@Path("/os-simple-tenant-usage")
|
@Path("/os-simple-tenant-usage")
|
||||||
|
@ -65,7 +65,7 @@ public interface SimpleTenantUsageAsyncClient {
|
||||||
ListenableFuture<Set<SimpleTenantUsage>> listTenantUsages();
|
ListenableFuture<Set<SimpleTenantUsage>> listTenantUsages();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see SimpleTenantUsageClient#getTenantUsage(String)
|
* @see SimpleTenantUsageApi#getTenantUsage(String)
|
||||||
*/
|
*/
|
||||||
@GET
|
@GET
|
||||||
@Path("/os-simple-tenant-usage/{id}")
|
@Path("/os-simple-tenant-usage/{id}")
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue