mirror of https://github.com/apache/jclouds.git
Merge branch 'master' of github.com:jclouds/jclouds into 1.5.x
* 'master' of github.com:jclouds/jclouds: (50 commits) wrapper -> view; typo undo wrapper -> view removed freegeoip, as it hasn't worked in ages created base Context class with ProviderMetadata and Identity 'uniqueVersion' is no longer supported in Maven 3 Using the Javadoc plugin's 'aggregate-jar' goal instead of 'aggregate' for the jclouds-multi Javadoc build, so the Javadocs are actually attached and deployed Modify a warning message to state the problem in full right at the beginning of the message (instead of having the crucial part of the message drifting in the middle of an ocean of toString()ed objects) fixed aws-ec2 image parsing Issue 905:create openstack-swift api functions for regions base implemenation of nodepool Switch to calling apt-get update before every apt-get install. added javadoc functions and endpoints for vCloud Director bugfix for self-referential loop + test Add a live test for swift multipart upload. Remove useless comment. Remove deub prints and fall back to traditional upload if file is not large enough. Enable multipart for HPCloud. Use CommonSwiftClient instead of SwiftClient in multipart code. ...
This commit is contained in:
commit
00fc02736b
|
@ -26,9 +26,9 @@ import java.util.Set;
|
|||
|
||||
import org.apache.tools.ant.BuildException;
|
||||
import org.apache.tools.ant.Project;
|
||||
import org.jclouds.ContextBuilder;
|
||||
import org.jclouds.compute.ComputeService;
|
||||
import org.jclouds.compute.ComputeServiceContext;
|
||||
import org.jclouds.compute.ComputeServiceContextFactory;
|
||||
import org.jclouds.compute.domain.OsFamily;
|
||||
import org.jclouds.compute.domain.Template;
|
||||
import org.jclouds.compute.domain.TemplateBuilder;
|
||||
|
@ -73,14 +73,16 @@ public class ComputeTaskUtils {
|
|||
public ComputeServiceContext load(URI from) {
|
||||
Properties props = new Properties();
|
||||
props.putAll(projectProvider.get().getProperties());
|
||||
Set<Module> modules = ImmutableSet.<Module> of(new AntLoggingModule(projectProvider.get(),
|
||||
ComputeServiceConstants.COMPUTE_LOGGER), new JschSshClientModule());
|
||||
// adding the properties to the factory will allow us to pass
|
||||
// alternate endpoints
|
||||
String provider = from.getHost();
|
||||
Credentials creds = Credentials.parse(from);
|
||||
return new ComputeServiceContextFactory().createContext(provider, creds.identity, creds.credential,
|
||||
ImmutableSet.of((Module) new AntLoggingModule(projectProvider.get(),
|
||||
ComputeServiceConstants.COMPUTE_LOGGER), new JschSshClientModule()), props);
|
||||
|
||||
return ContextBuilder.newBuilder(provider)
|
||||
.credentials(creds.identity, creds.credential)
|
||||
.modules(modules)
|
||||
.overrides(props).buildView(ComputeServiceContext.class);
|
||||
}
|
||||
|
||||
});
|
||||
|
|
|
@ -85,7 +85,7 @@ public class AtmosApiMetadata extends BaseRestApiMetadata {
|
|||
.version("1.4.0")
|
||||
.defaultEndpoint("https://accesspoint.atmosonline.com")
|
||||
.defaultProperties(AtmosApiMetadata.defaultProperties())
|
||||
.wrapper(TypeToken.of(BlobStoreContext.class))
|
||||
.view(TypeToken.of(BlobStoreContext.class))
|
||||
.defaultModules(ImmutableSet.<Class<? extends Module>>of(AtmosRestClientModule.class, AtmosBlobStoreContextModule.class));
|
||||
}
|
||||
|
||||
|
|
|
@ -19,8 +19,6 @@
|
|||
package org.jclouds.atmos.filters;
|
||||
|
||||
import static org.jclouds.Constants.LOGGER_SIGNATURE;
|
||||
import static org.jclouds.Constants.PROPERTY_CREDENTIAL;
|
||||
import static org.jclouds.Constants.PROPERTY_IDENTITY;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
|
@ -37,6 +35,8 @@ import org.jclouds.http.HttpException;
|
|||
import org.jclouds.io.InputSuppliers;
|
||||
import org.jclouds.location.Provider;
|
||||
import org.jclouds.logging.Logger;
|
||||
import org.jclouds.rest.annotations.Credential;
|
||||
import org.jclouds.rest.annotations.Identity;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.base.Supplier;
|
||||
|
@ -66,7 +66,7 @@ public class ShareUrl implements Function<String, URI> {
|
|||
Logger signatureLog = Logger.NULL;
|
||||
|
||||
@Inject
|
||||
public ShareUrl(@Named(PROPERTY_IDENTITY) String uid, @Named(PROPERTY_CREDENTIAL) String encodedKey,
|
||||
public ShareUrl(@Identity String uid, @Credential String encodedKey,
|
||||
@Provider Supplier<URI> provider, @TimeStamp javax.inject.Provider<Long> timeStampProvider,
|
||||
javax.inject.Provider<UriBuilder> uriBuilders, Crypto crypto) {
|
||||
this.uid = uid;
|
||||
|
|
|
@ -19,8 +19,6 @@
|
|||
package org.jclouds.atmos.filters;
|
||||
|
||||
import static org.jclouds.Constants.LOGGER_SIGNATURE;
|
||||
import static org.jclouds.Constants.PROPERTY_CREDENTIAL;
|
||||
import static org.jclouds.Constants.PROPERTY_IDENTITY;
|
||||
import static org.jclouds.util.Patterns.NEWLINE_PATTERN;
|
||||
import static org.jclouds.util.Patterns.TWO_SPACE_PATTERN;
|
||||
|
||||
|
@ -46,6 +44,8 @@ import org.jclouds.http.internal.SignatureWire;
|
|||
import org.jclouds.http.utils.ModifyRequest;
|
||||
import org.jclouds.io.InputSuppliers;
|
||||
import org.jclouds.logging.Logger;
|
||||
import org.jclouds.rest.annotations.Credential;
|
||||
import org.jclouds.rest.annotations.Identity;
|
||||
import org.jclouds.util.Strings2;
|
||||
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
|
@ -79,8 +79,8 @@ public class SignRequest implements HttpRequestFilter {
|
|||
Logger signatureLog = Logger.NULL;
|
||||
|
||||
@Inject
|
||||
public SignRequest(SignatureWire signatureWire, @Named(PROPERTY_IDENTITY) String uid,
|
||||
@Named(PROPERTY_CREDENTIAL) String encodedKey, @TimeStamp Provider<String> timeStampProvider, Crypto crypto,
|
||||
public SignRequest(SignatureWire signatureWire, @Identity String uid,
|
||||
@Credential String encodedKey, @TimeStamp Provider<String> timeStampProvider, Crypto crypto,
|
||||
HttpUtils utils) {
|
||||
this.signatureWire = signatureWire;
|
||||
this.uid = uid;
|
||||
|
|
|
@ -57,7 +57,7 @@ import com.google.common.collect.Sets;
|
|||
public class AtmosClientLiveTest extends BaseBlobStoreIntegrationTest {
|
||||
|
||||
public AtmosClient getApi() {
|
||||
return context.unwrap(AtmosApiMetadata.CONTEXT_TOKEN).getApi();
|
||||
return view.unwrap(AtmosApiMetadata.CONTEXT_TOKEN).getApi();
|
||||
}
|
||||
|
||||
private static final class HeadMatches implements Runnable {
|
||||
|
|
|
@ -34,6 +34,6 @@ public class AtmosLiveTest extends BaseBlobLiveTest {
|
|||
}
|
||||
protected void checkMD5(String container, String name, byte[] md5) {
|
||||
// atmos does not support content-md5 yet
|
||||
assertEquals(context.getBlobStore().blobMetadata(container, name).getContentMetadata().getContentMD5(), null);
|
||||
assertEquals(view.getBlobStore().blobMetadata(container, name).getContentMetadata().getContentMD5(), null);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@ public class BYONApiMetadata extends BaseApiMetadata {
|
|||
.documentation(URI.create("https://github.com/jclouds/jclouds/tree/master/apis/byon"))
|
||||
.version(String.format("%s.%s", JcloudsVersion.get().majorVersion, JcloudsVersion.get().minorVersion))
|
||||
.buildVersion(JcloudsVersion.get().toString())
|
||||
.wrapper(ComputeServiceContext.class)
|
||||
.view(ComputeServiceContext.class)
|
||||
.defaultModules(ImmutableSet.<Class<? extends Module>>of(YamlNodeStoreModule.class, BYONComputeServiceContextModule.class));
|
||||
}
|
||||
|
||||
|
|
|
@ -83,7 +83,7 @@ public class CloudFilesApiMetadata extends BaseRestApiMetadata {
|
|||
.documentation(URI.create("http://docs.rackspacecloud.com/files/api/v1/cfdevguide_d5/content/ch01.html"))
|
||||
.version(OpenStackAuthAsyncClient.VERSION)
|
||||
.defaultProperties(CloudFilesApiMetadata.defaultProperties())
|
||||
.wrapper(TypeToken.of(BlobStoreContext.class))
|
||||
.view(TypeToken.of(BlobStoreContext.class))
|
||||
.defaultModules(ImmutableSet.<Class<? extends Module>>of(CloudFilesRestClientModule.class, CloudFilesBlobStoreContextModule.class));
|
||||
}
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ import com.google.common.util.concurrent.ListenableFuture;
|
|||
* Provides asynchronous access to Cloud Files via their REST API.
|
||||
* <p/>
|
||||
* All commands return a ListenableFuture of the result from Cloud Files. Any exceptions incurred
|
||||
* during processing will be wrapped in an {@link ExecutionException} as documented in
|
||||
* during processing will be backend in an {@link ExecutionException} as documented in
|
||||
* {@link ListenableFuture#get()}.
|
||||
*
|
||||
* @see CloudFilesClient
|
||||
|
|
|
@ -33,7 +33,7 @@ import org.jclouds.openstack.swift.CommonSwiftClient;
|
|||
* Provides access to Cloud Files via their REST API.
|
||||
* <p/>
|
||||
* All commands return a Future of the result from Cloud Files. Any exceptions incurred during
|
||||
* processing will be wrapped in an {@link ExecutionException} as documented in {@link Future#get()}.
|
||||
* processing will be backend in an {@link ExecutionException} as documented in {@link Future#get()}.
|
||||
*
|
||||
* @see <a href="http://www.rackspacecloud.com/cf-devguide-20090812.pdf" />
|
||||
* @author Adrian Cole
|
||||
|
|
|
@ -49,6 +49,7 @@ import org.jclouds.openstack.swift.blobstore.functions.ObjectToBlobMetadata;
|
|||
import com.google.common.base.Function;
|
||||
import com.google.common.base.Supplier;
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
import org.jclouds.openstack.swift.blobstore.strategy.internal.AsyncMultipartUploadStrategy;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -66,10 +67,11 @@ public class CloudFilesAsyncBlobStore extends SwiftAsyncBlobStore {
|
|||
BlobStoreListContainerOptionsToListContainerOptions container2ContainerListOptions,
|
||||
ContainerToResourceList container2ResourceList, ObjectToBlob object2Blob, BlobToObject blob2Object,
|
||||
ObjectToBlobMetadata object2BlobMd, BlobToHttpGetOptions blob2ObjectGetOptions,
|
||||
Provider<FetchBlobMetadata> fetchBlobMetadataProvider, EnableCDNAndCache enableCDNAndCache) {
|
||||
Provider<FetchBlobMetadata> fetchBlobMetadataProvider, EnableCDNAndCache enableCDNAndCache,
|
||||
Provider<AsyncMultipartUploadStrategy> multipartUploadStrategy) {
|
||||
super(context, blobUtils, service, defaultLocation, locations, sync, async, container2ResourceMd,
|
||||
container2ContainerListOptions, container2ResourceList, object2Blob, blob2Object, object2BlobMd,
|
||||
blob2ObjectGetOptions, fetchBlobMetadataProvider);
|
||||
blob2ObjectGetOptions, fetchBlobMetadataProvider, multipartUploadStrategy);
|
||||
this.enableCDNAndCache = enableCDNAndCache;
|
||||
}
|
||||
|
||||
|
|
|
@ -42,6 +42,7 @@ import org.jclouds.openstack.swift.blobstore.functions.ObjectToBlob;
|
|||
import org.jclouds.openstack.swift.blobstore.functions.ObjectToBlobMetadata;
|
||||
|
||||
import com.google.common.base.Supplier;
|
||||
import org.jclouds.openstack.swift.blobstore.strategy.internal.MultipartUploadStrategy;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -59,10 +60,11 @@ public class CloudFilesBlobStore extends SwiftBlobStore {
|
|||
BlobStoreListContainerOptionsToListContainerOptions container2ContainerListOptions,
|
||||
ContainerToResourceList container2ResourceList, ObjectToBlob object2Blob, BlobToObject blob2Object,
|
||||
ObjectToBlobMetadata object2BlobMd, BlobToHttpGetOptions blob2ObjectGetOptions,
|
||||
Provider<FetchBlobMetadata> fetchBlobMetadataProvider, EnableCDNAndCache enableCDNAndCache) {
|
||||
Provider<FetchBlobMetadata> fetchBlobMetadataProvider, EnableCDNAndCache enableCDNAndCache,
|
||||
Provider<MultipartUploadStrategy> multipartUploadStrategy) {
|
||||
super(context, blobUtils, defaultLocation, locations, sync, container2ResourceMd, container2ContainerListOptions,
|
||||
container2ResourceList, object2Blob, blob2Object, object2BlobMd, blob2ObjectGetOptions,
|
||||
fetchBlobMetadataProvider);
|
||||
fetchBlobMetadataProvider, multipartUploadStrategy);
|
||||
this.enableCDNAndCache = enableCDNAndCache;
|
||||
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ public class CloudFilesClientLiveTest extends CommonSwiftClientLiveTest<CloudFil
|
|||
|
||||
@Override
|
||||
public CloudFilesClient getApi() {
|
||||
return context.unwrap(CloudFilesApiMetadata.CONTEXT_TOKEN).getApi();
|
||||
return view.unwrap(CloudFilesApiMetadata.CONTEXT_TOKEN).getApi();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -78,7 +78,7 @@ public class CloudLoadBalancersApiMetadata extends BaseRestApiMetadata {
|
|||
.version(OpenStackAuthAsyncClient.VERSION)
|
||||
.defaultEndpoint("https://auth.api.rackspacecloud.com")
|
||||
.defaultProperties(CloudLoadBalancersApiMetadata.defaultProperties())
|
||||
.wrapper(TypeToken.of(LoadBalancerServiceContext.class))
|
||||
.view(TypeToken.of(LoadBalancerServiceContext.class))
|
||||
.defaultModules(ImmutableSet.<Class<? extends Module>>of(CloudLoadBalancersRestClientModule.class, CloudLoadBalancersLoadBalancerContextModule.class));
|
||||
}
|
||||
|
||||
|
|
|
@ -77,6 +77,7 @@ public abstract class BaseCloudLoadBalancersAsyncClientTest<T> extends BaseAsync
|
|||
protected void configure() {
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@Provides
|
||||
@Singleton
|
||||
GetAuth provideGetAuth() {
|
||||
|
|
|
@ -20,7 +20,7 @@ package org.jclouds.cloudloadbalancers.internal;
|
|||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.jclouds.apis.BaseContextLiveTest;
|
||||
import org.jclouds.apis.BaseViewLiveTest;
|
||||
import org.jclouds.cloudloadbalancers.CloudLoadBalancersAsyncClient;
|
||||
import org.jclouds.cloudloadbalancers.CloudLoadBalancersClient;
|
||||
import org.jclouds.cloudloadbalancers.domain.LoadBalancer;
|
||||
|
@ -42,7 +42,7 @@ import com.google.inject.Injector;
|
|||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
public class BaseCloudLoadBalancersClientLiveTest extends BaseContextLiveTest<LoadBalancerServiceContext> {
|
||||
public class BaseCloudLoadBalancersClientLiveTest extends BaseViewLiveTest<LoadBalancerServiceContext> {
|
||||
|
||||
public BaseCloudLoadBalancersClientLiveTest() {
|
||||
provider = "cloudloadbalancers";
|
||||
|
@ -61,7 +61,7 @@ public class BaseCloudLoadBalancersClientLiveTest extends BaseContextLiveTest<Lo
|
|||
@Override
|
||||
public void setupContext() {
|
||||
super.setupContext();
|
||||
lbContext = context.unwrap();
|
||||
lbContext = view.unwrap();
|
||||
|
||||
client = lbContext.getApi();
|
||||
|
||||
|
@ -75,7 +75,7 @@ public class BaseCloudLoadBalancersClientLiveTest extends BaseContextLiveTest<Lo
|
|||
}
|
||||
|
||||
@Override
|
||||
protected TypeToken<LoadBalancerServiceContext> contextType() {
|
||||
protected TypeToken<LoadBalancerServiceContext> viewType() {
|
||||
return TypeToken.of(LoadBalancerServiceContext.class);
|
||||
}
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@ public class CloudServersApiMetadata extends BaseRestApiMetadata {
|
|||
.version(OpenStackAuthAsyncClient.VERSION)
|
||||
.defaultEndpoint("https://auth.api.rackspacecloud.com")
|
||||
.defaultProperties(CloudServersApiMetadata.defaultProperties())
|
||||
.wrapper(TypeToken.of(ComputeServiceContext.class))
|
||||
.view(TypeToken.of(ComputeServiceContext.class))
|
||||
.defaultModules(ImmutableSet.<Class<? extends Module>>of(CloudServersRestClientModule.class, CloudServersComputeServiceContextModule.class));
|
||||
}
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@ import com.google.common.util.concurrent.ListenableFuture;
|
|||
* Provides asynchronous access to Cloud Servers via their REST API.
|
||||
* <p/>
|
||||
* All commands return a ListenableFuture of the result from Cloud Servers. Any exceptions incurred
|
||||
* during processing will be wrapped in an {@link ExecutionException} as documented in
|
||||
* during processing will be backend in an {@link ExecutionException} as documented in
|
||||
* {@link ListenableFuture#get()}.
|
||||
*
|
||||
* @see CloudServersClient
|
||||
|
|
|
@ -44,7 +44,7 @@ import org.jclouds.rest.ResourceNotFoundException;
|
|||
* Provides access to Cloud Servers via their REST API.
|
||||
* <p/>
|
||||
* All commands return a Future of the result from Cloud Servers. Any exceptions incurred during
|
||||
* processing will be wrapped in an {@link ExecutionException} as documented in {@link Future#get()}.
|
||||
* processing will be backend in an {@link ExecutionException} as documented in {@link Future#get()}.
|
||||
*
|
||||
* @see CloudServersAsyncClient
|
||||
* @see <a href="http://docs.rackspacecloud.com/servers/api/cs-devguide-latest.pdf" />
|
||||
|
|
|
@ -85,7 +85,7 @@ public class CloudServersClientLiveTest extends BaseComputeServiceContextLiveTes
|
|||
@Override
|
||||
public void setupContext() {
|
||||
super.setupContext();
|
||||
Injector injector = context.utils().injector();
|
||||
Injector injector = view.utils().injector();
|
||||
client = injector.getInstance(CloudServersClient.class);
|
||||
sshFactory = injector.getInstance(SshClient.Factory.class);
|
||||
SocketOpen socketOpen = injector.getInstance(SocketOpen.class);
|
||||
|
|
|
@ -82,7 +82,7 @@ public class CloudSigmaApiMetadata extends BaseRestApiMetadata {
|
|||
.version("1.0")
|
||||
.defaultEndpoint("https://api.cloudsigma.com")
|
||||
.defaultProperties(CloudSigmaApiMetadata.defaultProperties())
|
||||
.wrapper(TypeToken.of(ComputeServiceContext.class))
|
||||
.view(TypeToken.of(ComputeServiceContext.class))
|
||||
.defaultModules(ImmutableSet.<Class<? extends Module>>of(CloudSigmaRestClientModule.class, CloudSigmaComputeServiceContextModule.class));
|
||||
}
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@ public class CloudSigmaClientLiveTest extends BaseComputeServiceContextLiveTest
|
|||
@Override
|
||||
public void setupContext() {
|
||||
super.setupContext();
|
||||
cloudSigmaContext = context.unwrap();
|
||||
cloudSigmaContext = view.unwrap();
|
||||
|
||||
client = cloudSigmaContext.getApi();
|
||||
driveNotClaimed = new RetryablePredicate<DriveInfo>(Predicates.not(new DriveClaimed(client)), maxDriveImageTime,
|
||||
|
@ -98,7 +98,7 @@ public class CloudSigmaClientLiveTest extends BaseComputeServiceContextLiveTest
|
|||
TimeUnit.SECONDS);
|
||||
|
||||
if (Strings.emptyToNull(imageId) == null) {
|
||||
imageId = context.getComputeService().templateBuilder().build().getImage().getId();
|
||||
imageId = view.getComputeService().templateBuilder().build().getImage().getId();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@ public class CloudStackApiMetadata extends BaseRestApiMetadata {
|
|||
.documentation(URI.create("http://download.cloud.com/releases/2.2.0/api_2.2.12/TOC_User.html"))
|
||||
.defaultEndpoint("http://localhost:8080/client/api")
|
||||
.version("2.2")
|
||||
.wrapper(TypeToken.of(CloudStackContext.class))
|
||||
.view(TypeToken.of(CloudStackContext.class))
|
||||
.defaultProperties(CloudStackApiMetadata.defaultProperties())
|
||||
.defaultModules(ImmutableSet.<Class<? extends Module>>of(CloudStackRestClientModule.class, CloudStackComputeServiceContextModule.class));
|
||||
}
|
||||
|
|
|
@ -72,14 +72,14 @@ public class TemplateToOperatingSystem implements Function<Template, OperatingSy
|
|||
|
||||
OSType type = osTypes.get().get(from.getOSTypeId());
|
||||
if (type == null) {
|
||||
logger.warn("type for template %s not found in %s", from, osTypes.get());
|
||||
logger.warn("Template refers to OS type ID %s but this does not exist. Template=%s Known OS types=%s", from.getOSTypeId(), from, osTypes.get());
|
||||
return builder.build();
|
||||
}
|
||||
builder.description(type.getDescription());
|
||||
builder.is64Bit(type.getDescription().indexOf("64-bit") != -1);
|
||||
String osCategory = osCategories.get().get(type.getOSCategoryId());
|
||||
if (osCategory == null) {
|
||||
logger.warn("category for OSType %s not found in %s", type, osCategories.get());
|
||||
logger.warn("OS type refers to OS category ID %s but this does not exist. OS type=%s Known OS categories=%s", type.getOSCategoryId(), type, osCategories.get());
|
||||
return builder.build();
|
||||
}
|
||||
builder.name(osCategory);
|
||||
|
|
|
@ -40,6 +40,8 @@ import org.jclouds.http.utils.ModifyRequest;
|
|||
import org.jclouds.io.InputSuppliers;
|
||||
import org.jclouds.logging.Logger;
|
||||
import org.jclouds.rest.RequestSigner;
|
||||
import org.jclouds.rest.annotations.Credential;
|
||||
import org.jclouds.rest.annotations.Identity;
|
||||
import org.jclouds.util.Strings2;
|
||||
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
|
@ -71,9 +73,8 @@ public class QuerySigner implements AuthenticationFilter, RequestSigner {
|
|||
private Logger signatureLog = Logger.NULL;
|
||||
|
||||
@Inject
|
||||
public QuerySigner(SignatureWire signatureWire, @Named(Constants.PROPERTY_IDENTITY) String accessKey,
|
||||
@Named(Constants.PROPERTY_CREDENTIAL) String secretKey, Crypto crypto, HttpUtils utils,
|
||||
Provider<UriBuilder> builder) {
|
||||
public QuerySigner(SignatureWire signatureWire, @Identity String accessKey, @Credential String secretKey,
|
||||
Crypto crypto, HttpUtils utils, Provider<UriBuilder> builder) {
|
||||
this.signatureWire = signatureWire;
|
||||
this.accessKey = accessKey;
|
||||
this.secretKey = secretKey;
|
||||
|
|
|
@ -46,10 +46,10 @@ public class ParseAsyncJobsFromHttpResponse implements Function<HttpResponse, Se
|
|||
private final ParseTypedAsyncJob parseTyped;
|
||||
|
||||
@Inject
|
||||
public ParseAsyncJobsFromHttpResponse(ParseTypedAsyncJob parseTyped, GsonWrapper gsonWrapper) {
|
||||
public ParseAsyncJobsFromHttpResponse(ParseTypedAsyncJob parseTyped, GsonWrapper gsonView) {
|
||||
this.parseTyped = checkNotNull(parseTyped, "parseTyped");
|
||||
this.parser = new ParseFirstJsonValueNamed<Set<AsyncJob<Map<String, JsonBall>>>>(
|
||||
checkNotNull(gsonWrapper, "gsonWrapper"),
|
||||
checkNotNull(gsonView, "gsonView"),
|
||||
new TypeLiteral<Set<AsyncJob<Map<String, JsonBall>>>>() { },
|
||||
"asyncjobs");
|
||||
}
|
||||
|
|
|
@ -54,8 +54,8 @@ public class ParseEventTypesFromHttpResponse implements Function<HttpResponse, S
|
|||
}
|
||||
|
||||
@Inject
|
||||
public ParseEventTypesFromHttpResponse(GsonWrapper gsonWrapper) {
|
||||
this.parser = new ParseFirstJsonValueNamed<Set<EventType>>(checkNotNull(gsonWrapper, "gsonWrapper"),
|
||||
public ParseEventTypesFromHttpResponse(GsonWrapper gsonView) {
|
||||
this.parser = new ParseFirstJsonValueNamed<Set<EventType>>(checkNotNull(gsonView, "gsonView"),
|
||||
new TypeLiteral<Set<EventType>>() {
|
||||
}, "eventtype");
|
||||
}
|
||||
|
|
|
@ -78,8 +78,8 @@ public class ParseIdToNameFromHttpResponse implements Function<HttpResponse, Map
|
|||
}
|
||||
|
||||
@Inject
|
||||
public ParseIdToNameFromHttpResponse(GsonWrapper gsonWrapper) {
|
||||
this.parser = new ParseFirstJsonValueNamed<Set<IdName>>(checkNotNull(gsonWrapper, "gsonWrapper"),
|
||||
public ParseIdToNameFromHttpResponse(GsonWrapper gsonView) {
|
||||
this.parser = new ParseFirstJsonValueNamed<Set<IdName>>(checkNotNull(gsonView, "gsonView"),
|
||||
new TypeLiteral<Set<IdName>>() {
|
||||
}, "oscategory");
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ public class ParseLoginResponseFromHttpResponse implements Function<HttpResponse
|
|||
|
||||
@Inject
|
||||
ParseLoginResponseFromHttpResponse(GsonWrapper gson) {
|
||||
this.parser = new ParseFirstJsonValueNamed<LoginResponse>(checkNotNull(gson, "gsonWrapper"),
|
||||
this.parser = new ParseFirstJsonValueNamed<LoginResponse>(checkNotNull(gson, "gsonView"),
|
||||
new TypeLiteral<LoginResponse>(){}, "loginresponse");
|
||||
}
|
||||
|
||||
|
|
|
@ -73,8 +73,8 @@ public class ParseNamesFromHttpResponse implements Function<HttpResponse, Set<St
|
|||
}
|
||||
|
||||
@Inject
|
||||
public ParseNamesFromHttpResponse(GsonWrapper gsonWrapper) {
|
||||
this.parser = new ParseFirstJsonValueNamed<Set<Name>>(checkNotNull(gsonWrapper, "gsonWrapper"),
|
||||
public ParseNamesFromHttpResponse(GsonWrapper gsonView) {
|
||||
this.parser = new ParseFirstJsonValueNamed<Set<Name>>(checkNotNull(gsonView, "gsonView"),
|
||||
new TypeLiteral<Set<Name>>() {
|
||||
}, "hypervisor");
|
||||
}
|
||||
|
|
|
@ -18,12 +18,10 @@
|
|||
*/
|
||||
package org.jclouds.cloudstack.internal;
|
||||
|
||||
import java.io.Closeable;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import org.jclouds.Context;
|
||||
import org.jclouds.cloudstack.CloudStackAsyncClient;
|
||||
import org.jclouds.cloudstack.CloudStackClient;
|
||||
import org.jclouds.cloudstack.CloudStackContext;
|
||||
|
@ -34,7 +32,6 @@ import org.jclouds.cloudstack.CloudStackGlobalClient;
|
|||
import org.jclouds.compute.ComputeService;
|
||||
import org.jclouds.compute.Utils;
|
||||
import org.jclouds.compute.internal.ComputeServiceContextImpl;
|
||||
import org.jclouds.domain.Credentials;
|
||||
import org.jclouds.location.Provider;
|
||||
import org.jclouds.rest.RestContext;
|
||||
|
||||
|
@ -49,11 +46,11 @@ public class CloudStackContextImpl extends ComputeServiceContextImpl implements
|
|||
private final RestContext<CloudStackGlobalClient, CloudStackGlobalAsyncClient> globalContext;
|
||||
|
||||
@Inject
|
||||
public CloudStackContextImpl(@Provider Closeable wrapped, @Provider TypeToken<? extends Closeable> wrappedType,
|
||||
ComputeService computeService, Map<String, Credentials> credentialStore, Utils utils,
|
||||
public CloudStackContextImpl(@Provider Context backend, @Provider TypeToken<? extends Context> backendType,
|
||||
ComputeService computeService, Utils utils,
|
||||
RestContext<CloudStackDomainClient, CloudStackDomainAsyncClient> domainContext,
|
||||
RestContext<CloudStackGlobalClient, CloudStackGlobalAsyncClient> globalContext) {
|
||||
super(wrapped, wrappedType, computeService, credentialStore, utils);
|
||||
super(backend, backendType, computeService, utils);
|
||||
this.domainContext = domainContext;
|
||||
this.globalContext = globalContext;
|
||||
}
|
||||
|
|
|
@ -157,7 +157,7 @@ public class CloudStackComputeServiceAdapterLiveTest extends BaseCloudStackClien
|
|||
public void testCreateNodeWithGroupEncodedIntoName() throws InterruptedException {
|
||||
String group = prefix + "-foo";
|
||||
String name = group + "-node-" + new Random().nextInt();
|
||||
Template template = context.getComputeService().templateBuilder().build();
|
||||
Template template = view.getComputeService().templateBuilder().build();
|
||||
|
||||
if (!client
|
||||
.getTemplateClient()
|
||||
|
|
|
@ -90,9 +90,9 @@ public class CloudStackExperimentLiveTest extends BaseCloudStackClientLiveTest {
|
|||
Network network = null;
|
||||
Set<? extends NodeMetadata> nodes = null;
|
||||
try {
|
||||
assert context.getComputeService().listAssignableLocations().size() > 0;
|
||||
assert view.getComputeService().listAssignableLocations().size() > 0;
|
||||
|
||||
Template template = context.getComputeService().templateBuilder().build();
|
||||
Template template = view.getComputeService().templateBuilder().build();
|
||||
|
||||
// get the zone we are launching into
|
||||
long zoneId = Long.parseLong(template.getLocation().getId());
|
||||
|
@ -115,7 +115,7 @@ public class CloudStackExperimentLiveTest extends BaseCloudStackClientLiveTest {
|
|||
template.getOptions().as(CloudStackTemplateOptions.class).networkId(network.getId());
|
||||
|
||||
// launch the VM
|
||||
nodes = context.getComputeService().createNodesInGroup(group, 1, template);
|
||||
nodes = view.getComputeService().createNodesInGroup(group, 1, template);
|
||||
|
||||
assert nodes.size() > 0;
|
||||
|
||||
|
@ -124,7 +124,7 @@ public class CloudStackExperimentLiveTest extends BaseCloudStackClientLiveTest {
|
|||
nodes = newTreeSet(concat(e.getSuccessfulNodes(), e.getNodeErrors().keySet()));
|
||||
} finally {
|
||||
if (nodes != null)
|
||||
context.getComputeService().destroyNodesMatching(NodePredicates.inGroup(group));
|
||||
view.getComputeService().destroyNodesMatching(NodePredicates.inGroup(group));
|
||||
if (network != null)
|
||||
domainAdminContext.getApi().getNetworkClient().deleteNetwork(network.getId());
|
||||
}
|
||||
|
@ -143,14 +143,14 @@ public class CloudStackExperimentLiveTest extends BaseCloudStackClientLiveTest {
|
|||
SshKeyPair keyPair = client.getSSHKeyPairClient().createSSHKeyPair(keyPairName);
|
||||
|
||||
String group = prefix + "-windows-test";
|
||||
Template template = context.getComputeService().templateBuilder()
|
||||
Template template = view.getComputeService().templateBuilder()
|
||||
.imageId("290").locationId("1")
|
||||
.options(new CloudStackTemplateOptions().setupStaticNat(false).keyPair(keyPairName))
|
||||
.build();
|
||||
|
||||
NodeMetadata node = null;
|
||||
try {
|
||||
node = getOnlyElement(context.getComputeService()
|
||||
node = getOnlyElement(view.getComputeService()
|
||||
.createNodesInGroup(group, 1, template));
|
||||
|
||||
String encryptedPassword = client.getVirtualMachineClient()
|
||||
|
@ -165,7 +165,7 @@ public class CloudStackExperimentLiveTest extends BaseCloudStackClientLiveTest {
|
|||
|
||||
} finally {
|
||||
if (node != null) {
|
||||
context.getComputeService().destroyNode(node.getId());
|
||||
view.getComputeService().destroyNode(node.getId());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ import org.jclouds.cloudstack.predicates.VirtualMachineRunning;
|
|||
import org.jclouds.cloudstack.strategy.BlockUntilJobCompletesAndReturnResult;
|
||||
import org.jclouds.compute.ComputeService;
|
||||
import org.jclouds.compute.domain.ExecResponse;
|
||||
import org.jclouds.compute.internal.BaseComputeServiceContextLiveTest;
|
||||
import org.jclouds.compute.internal.BaseGenericComputeServiceContextLiveTest;
|
||||
import org.jclouds.net.IPSocket;
|
||||
import org.jclouds.predicates.InetSocketAddressConnect;
|
||||
import org.jclouds.predicates.RetryablePredicate;
|
||||
|
@ -65,6 +65,7 @@ import com.google.common.base.Predicate;
|
|||
import com.google.common.base.Predicates;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.reflect.TypeToken;
|
||||
import com.google.inject.Guice;
|
||||
import com.google.inject.Injector;
|
||||
import com.google.inject.Module;
|
||||
|
@ -73,7 +74,7 @@ import com.google.inject.Module;
|
|||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
public class BaseCloudStackClientLiveTest extends BaseComputeServiceContextLiveTest {
|
||||
public class BaseCloudStackClientLiveTest extends BaseGenericComputeServiceContextLiveTest<CloudStackContext> {
|
||||
protected String domainAdminIdentity;
|
||||
protected String domainAdminCredential;
|
||||
protected String globalAdminIdentity;
|
||||
|
@ -83,6 +84,11 @@ public class BaseCloudStackClientLiveTest extends BaseComputeServiceContextLiveT
|
|||
provider = "cloudstack";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected TypeToken<CloudStackContext> viewType() {
|
||||
return TypeToken.of(CloudStackContext.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Properties setupProperties() {
|
||||
Properties overrides = super.setupProperties();
|
||||
|
@ -193,14 +199,14 @@ public class BaseCloudStackClientLiveTest extends BaseComputeServiceContextLiveT
|
|||
@Override
|
||||
public void setupContext() {
|
||||
super.setupContext();
|
||||
computeClient = context.getComputeService();
|
||||
cloudStackContext = context.unwrap();
|
||||
computeClient = view.getComputeService();
|
||||
cloudStackContext = view.unwrap();
|
||||
client = cloudStackContext.getApi();
|
||||
user = verifyCurrentUserIsOfType(cloudStackContext, Account.Type.USER);
|
||||
|
||||
domainAdminEnabled = setupDomainAdminProperties() != null;
|
||||
if (domainAdminEnabled) {
|
||||
domainAdminComputeContext = createContext(setupDomainAdminProperties(), setupModules()).unwrap();
|
||||
domainAdminComputeContext = createView(setupDomainAdminProperties(), setupModules());
|
||||
domainAdminContext = domainAdminComputeContext.getDomainContext();
|
||||
domainAdminClient = domainAdminContext.getApi();
|
||||
domainAdminUser = verifyCurrentUserIsOfType(domainAdminContext, Account.Type.DOMAIN_ADMIN);
|
||||
|
@ -209,7 +215,7 @@ public class BaseCloudStackClientLiveTest extends BaseComputeServiceContextLiveT
|
|||
|
||||
globalAdminEnabled = setupGlobalAdminProperties() != null;
|
||||
if (globalAdminEnabled) {
|
||||
globalAdminComputeContext = createContext(setupGlobalAdminProperties(), setupModules()).unwrap();
|
||||
globalAdminComputeContext = createView(setupGlobalAdminProperties(), setupModules());
|
||||
globalAdminContext = globalAdminComputeContext.getGlobalContext();
|
||||
globalAdminClient = globalAdminContext.getApi();
|
||||
globalAdminUser = verifyCurrentUserIsOfType(globalAdminContext, Account.Type.ADMIN);
|
||||
|
|
|
@ -27,6 +27,7 @@ import static org.testng.Assert.assertNotNull;
|
|||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
|
||||
import org.jclouds.cloudstack.CloudStackApiMetadata;
|
||||
import org.jclouds.cloudstack.CloudStackClient;
|
||||
import org.jclouds.cloudstack.CloudStackGlobalClient;
|
||||
import org.jclouds.cloudstack.domain.Account;
|
||||
|
@ -83,9 +84,9 @@ public class GlobalUserClientLiveTest extends BaseCloudStackClientLiveTest {
|
|||
}
|
||||
|
||||
private void checkAuthAsUser(ApiKeyPair keyPair) {
|
||||
ComputeServiceContext context = createContext(credentialsAsProperties(keyPair), setupModules());
|
||||
ComputeServiceContext context = createView(credentialsAsProperties(keyPair), setupModules());
|
||||
|
||||
CloudStackClient client = CloudStackClient.class.cast(context.getProviderSpecificContext().getApi());
|
||||
CloudStackClient client = context.unwrap(CloudStackApiMetadata.CONTEXT_TOKEN).getApi();
|
||||
Set<Account> accounts = client.getAccountClient().listAccounts();
|
||||
|
||||
assert accounts.size() > 0;
|
||||
|
|
|
@ -66,7 +66,8 @@ public class OfferingClientLiveTest extends BaseCloudStackClientLiveTest {
|
|||
|
||||
} catch (NoSuchElementException e) {
|
||||
// This bug is present both in 2.2.8 and 2.2.12
|
||||
assertTrue(Predicates.in(ImmutableSet.of("2.2.8", "2.2.12")).apply(cloudStackContext.getApiVersion()));
|
||||
assertTrue(Predicates.in(ImmutableSet.of("2.2.8", "2.2.12")).apply(
|
||||
cloudStackContext.getProviderMetadata().getApiMetadata().getVersion()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ public class SessionClientLiveTest extends BaseCloudStackClientLiveTest {
|
|||
|
||||
@Test
|
||||
public void testCreateContextUsingUserAndPasswordAuthentication() {
|
||||
String endpoint = cloudStackContext.getEndpoint().toASCIIString();
|
||||
String endpoint = cloudStackContext.getProviderMetadata().getEndpoint();
|
||||
assert globalAdminEnabled;
|
||||
|
||||
Account testAccount = null;
|
||||
|
@ -75,7 +75,7 @@ public class SessionClientLiveTest extends BaseCloudStackClientLiveTest {
|
|||
|
||||
@Test(expectedExceptions = AuthorizationException.class)
|
||||
public void testTryToGetApiKeypairWithWrongCredentials() {
|
||||
String endpoint = cloudStackContext.getEndpoint().toASCIIString();
|
||||
String endpoint = cloudStackContext.getProviderMetadata().getEndpoint();
|
||||
ApiKeyPairs.loginToEndpointAsUsernameInDomainWithPasswordAndReturnApiKeyPair(
|
||||
URI.create(endpoint), "dummy-missing-user", "with-a-wrong-password", "");
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
package org.jclouds.cloudwatch;
|
||||
|
||||
import org.jclouds.Wrapper;
|
||||
import org.jclouds.View;
|
||||
import org.jclouds.rest.internal.BaseRestApiMetadataTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
|
@ -34,6 +34,6 @@ public class CloudWatchApiMetadataTest extends BaseRestApiMetadataTest {
|
|||
|
||||
// no monitoring abstraction, yet
|
||||
public CloudWatchApiMetadataTest() {
|
||||
super(new CloudWatchApiMetadata(), ImmutableSet.<TypeToken<? extends Wrapper>> of());
|
||||
super(new CloudWatchApiMetadata(), ImmutableSet.<TypeToken<? extends View>> of());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -75,7 +75,7 @@ public class DeltacloudApiMetadata extends BaseRestApiMetadata {
|
|||
.version("0.3.0")
|
||||
.defaultEndpoint("http://localhost:3001/api")
|
||||
.defaultProperties(DeltacloudApiMetadata.defaultProperties())
|
||||
.wrapper(TypeToken.of(ComputeServiceContext.class))
|
||||
.view(TypeToken.of(ComputeServiceContext.class))
|
||||
.defaultModules(ImmutableSet.<Class<? extends Module>>of(DeltacloudRestClientModule.class, DeltacloudComputeServiceContextModule.class));
|
||||
}
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ public class ReadOnlyDeltacloudClientLiveTest extends BaseComputeServiceContextL
|
|||
@BeforeClass(groups = { "integration", "live" })
|
||||
public void setupContext() {
|
||||
super.setupContext();
|
||||
client = context.unwrap(DeltacloudApiMetadata.CONTEXT_TOKEN).getApi();
|
||||
client = view.unwrap(DeltacloudApiMetadata.CONTEXT_TOKEN).getApi();
|
||||
socketTester = new RetryablePredicate<IPSocket>(new InetSocketAddressConnect(), 180, 1, TimeUnit.SECONDS);
|
||||
stateChanges = ImmutableMap.<Instance.State, Predicate<Instance>> of(//
|
||||
Instance.State.RUNNING, new RetryablePredicate<Instance>(new InstanceRunning(client), 600, 1,
|
||||
|
|
|
@ -70,7 +70,7 @@ public class DeltacloudTemplateBuilderLiveTest extends BaseTemplateBuilderLiveTe
|
|||
|
||||
@Test
|
||||
public void testTemplateBuilder() {
|
||||
Template defaultTemplate = this.context.getComputeService().templateBuilder().build();
|
||||
Template defaultTemplate = this.view.getComputeService().templateBuilder().build();
|
||||
assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), true);
|
||||
assertEquals(defaultTemplate.getImage().getOperatingSystem().getVersion(), "10.04");
|
||||
assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU);
|
||||
|
|
|
@ -104,7 +104,7 @@ public class EC2ApiMetadata extends BaseRestApiMetadata {
|
|||
.version(EC2AsyncClient.VERSION)
|
||||
.defaultProperties(EC2ApiMetadata.defaultProperties())
|
||||
.context(CONTEXT_TOKEN)
|
||||
.wrapper(EC2ComputeServiceContext.class)
|
||||
.view(EC2ComputeServiceContext.class)
|
||||
.defaultModules(ImmutableSet.<Class<? extends Module>>of(EC2RestClientModule.class, EC2ResolveImagesModule.class, EC2ComputeServiceContextModule.class));
|
||||
}
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ public class EC2ComputeServiceContextModule extends BaseComputeServiceContextMod
|
|||
}
|
||||
|
||||
@Override
|
||||
protected boolean shouldParseImagesOnDemand(Injector injector) {
|
||||
protected boolean shouldEagerlyParseImages(Injector injector) {
|
||||
// If no owners to query, then will never lookup all images
|
||||
String[] amiOwners = injector.getInstance(Key.get(String[].class, Names.named(PROPERTY_EC2_AMI_OWNERS)));
|
||||
return (amiOwners.length > 0);
|
||||
|
|
|
@ -18,15 +18,12 @@
|
|||
*/
|
||||
package org.jclouds.ec2.compute.internal;
|
||||
|
||||
import java.io.Closeable;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import org.jclouds.Context;
|
||||
import org.jclouds.compute.Utils;
|
||||
import org.jclouds.compute.internal.ComputeServiceContextImpl;
|
||||
import org.jclouds.domain.Credentials;
|
||||
import org.jclouds.ec2.compute.EC2ComputeService;
|
||||
import org.jclouds.ec2.compute.EC2ComputeServiceContext;
|
||||
import org.jclouds.location.Provider;
|
||||
|
@ -39,9 +36,9 @@ import com.google.common.reflect.TypeToken;
|
|||
@Singleton
|
||||
public class EC2ComputeServiceContextImpl extends ComputeServiceContextImpl implements EC2ComputeServiceContext {
|
||||
@Inject
|
||||
public EC2ComputeServiceContextImpl(@Provider Closeable wrapped, @Provider TypeToken<? extends Closeable> wrappedType,
|
||||
EC2ComputeService computeService, Map<String, Credentials> credentialStore, Utils utils){
|
||||
super(wrapped, wrappedType, computeService, credentialStore, utils);
|
||||
public EC2ComputeServiceContextImpl(@Provider Context backend, @Provider TypeToken<? extends Context> backendType,
|
||||
EC2ComputeService computeService, Utils utils) {
|
||||
super(backend, backendType, computeService, utils);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -20,11 +20,9 @@ package org.jclouds.ec2.options;
|
|||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static com.google.common.base.Preconditions.checkState;
|
||||
import static org.jclouds.Constants.PROPERTY_IDENTITY;
|
||||
|
||||
import javax.inject.Named;
|
||||
|
||||
import org.jclouds.ec2.options.internal.BaseEC2RequestOptions;
|
||||
import org.jclouds.rest.annotations.Identity;
|
||||
|
||||
import com.google.common.collect.Multimap;
|
||||
import com.google.inject.Inject;
|
||||
|
@ -52,7 +50,7 @@ import com.google.inject.Inject;
|
|||
public class BundleInstanceS3StorageOptions extends BaseEC2RequestOptions {
|
||||
|
||||
@Inject(optional = true)
|
||||
@Named(PROPERTY_IDENTITY)
|
||||
@Identity
|
||||
String currentAwsAccessKeyId;
|
||||
|
||||
@Override
|
||||
|
|
|
@ -95,7 +95,7 @@ public class CloudApplicationArchitecturesEC2ClientLiveTest extends BaseComputeS
|
|||
@BeforeClass(groups = { "integration", "live" })
|
||||
public void setupContext() {
|
||||
super.setupContext();
|
||||
Injector injector = context.utils().injector();
|
||||
Injector injector = view.utils().injector();
|
||||
client = injector.getInstance(EC2Client.class);
|
||||
sshFactory = injector.getInstance(SshClient.Factory.class);
|
||||
runningTester = new RetryablePredicate<RunningInstance>(new InstanceStateRunning(client), 180, 5,
|
||||
|
|
|
@ -126,7 +126,7 @@ public class EBSBootEC2ClientLiveTest extends BaseComputeServiceContextLiveTest
|
|||
@BeforeClass(groups = { "integration", "live" })
|
||||
public void setupContext() {
|
||||
super.setupContext();
|
||||
Injector injector = context.utils().injector();
|
||||
Injector injector = view.utils().injector();
|
||||
client = injector.getInstance(EC2Client.class);
|
||||
sshFactory = injector.getInstance(SshClient.Factory.class);
|
||||
SocketOpen socketOpen = injector.getInstance(SocketOpen.class);
|
||||
|
|
|
@ -102,13 +102,13 @@ public class EC2ComputeServiceLiveTest extends BaseComputeServiceLiveTest {
|
|||
|
||||
@Test(enabled = true, dependsOnMethods = "testCompareSizes")
|
||||
public void testExtendedOptionsAndLogin() throws Exception {
|
||||
SecurityGroupClient securityGroupClient = EC2Client.class.cast(context.unwrap(EC2ApiMetadata.CONTEXT_TOKEN).getApi())
|
||||
SecurityGroupClient securityGroupClient = EC2Client.class.cast(view.unwrap(EC2ApiMetadata.CONTEXT_TOKEN).getApi())
|
||||
.getSecurityGroupServices();
|
||||
|
||||
KeyPairClient keyPairClient = EC2Client.class.cast(context.unwrap(EC2ApiMetadata.CONTEXT_TOKEN).getApi())
|
||||
KeyPairClient keyPairClient = EC2Client.class.cast(view.unwrap(EC2ApiMetadata.CONTEXT_TOKEN).getApi())
|
||||
.getKeyPairServices();
|
||||
|
||||
InstanceClient instanceClient = EC2Client.class.cast(context.unwrap(EC2ApiMetadata.CONTEXT_TOKEN).getApi())
|
||||
InstanceClient instanceClient = EC2Client.class.cast(view.unwrap(EC2ApiMetadata.CONTEXT_TOKEN).getApi())
|
||||
.getInstanceServices();
|
||||
|
||||
String group = this.group + "o";
|
||||
|
@ -181,7 +181,7 @@ public class EC2ComputeServiceLiveTest extends BaseComputeServiceLiveTest {
|
|||
Properties overrides = setupProperties();
|
||||
overrides.setProperty(EC2Constants.PROPERTY_EC2_AUTO_ALLOCATE_ELASTIC_IPS, "true");
|
||||
|
||||
context = createContext(overrides, setupModules());
|
||||
context = createView(overrides, setupModules());
|
||||
|
||||
// create a node
|
||||
Set<? extends NodeMetadata> nodes =
|
||||
|
@ -233,19 +233,19 @@ public class EC2ComputeServiceLiveTest extends BaseComputeServiceLiveTest {
|
|||
@Test(enabled = true)
|
||||
public void testMapEBS() throws Exception {
|
||||
|
||||
InstanceClient instanceClient = EC2Client.class.cast(context.unwrap(EC2ApiMetadata.CONTEXT_TOKEN).getApi())
|
||||
InstanceClient instanceClient = EC2Client.class.cast(view.unwrap(EC2ApiMetadata.CONTEXT_TOKEN).getApi())
|
||||
.getInstanceServices();
|
||||
|
||||
ElasticBlockStoreClient ebsClient = EC2Client.class.cast(context.unwrap(EC2ApiMetadata.CONTEXT_TOKEN).getApi())
|
||||
ElasticBlockStoreClient ebsClient = EC2Client.class.cast(view.unwrap(EC2ApiMetadata.CONTEXT_TOKEN).getApi())
|
||||
.getElasticBlockStoreServices();
|
||||
|
||||
String group = this.group + "e";
|
||||
int volumeSize = 8;
|
||||
|
||||
final Template template = context.getComputeService().templateBuilder().hardwareId(InstanceType.M1_SMALL)
|
||||
final Template template = view.getComputeService().templateBuilder().hardwareId(InstanceType.M1_SMALL)
|
||||
.osFamily(OsFamily.UBUNTU).osVersionMatches("10.04").imageDescriptionMatches(".*ebs.*").build();
|
||||
|
||||
Location zone = Iterables.find(context.getComputeService().listAssignableLocations(), new Predicate<Location>() {
|
||||
Location zone = Iterables.find(view.getComputeService().listAssignableLocations(), new Predicate<Location>() {
|
||||
|
||||
@Override
|
||||
public boolean apply(Location arg0) {
|
||||
|
|
|
@ -50,7 +50,7 @@ public abstract class EC2TemplateBuilderLiveTest extends BaseTemplateBuilderLive
|
|||
|
||||
@Test
|
||||
public void testTemplateBuilderCanUseImageIdWithoutFetchingAllImages() throws Exception {
|
||||
Template defaultTemplate = context.getComputeService().templateBuilder().build();
|
||||
Template defaultTemplate = view.getComputeService().templateBuilder().build();
|
||||
String defaultImageId = defaultTemplate.getImage().getId();
|
||||
String defaultImageProviderId = defaultTemplate.getImage().getProviderId();
|
||||
|
||||
|
@ -58,7 +58,7 @@ public abstract class EC2TemplateBuilderLiveTest extends BaseTemplateBuilderLive
|
|||
try {
|
||||
// Track http commands
|
||||
final List<HttpCommand> commandsInvoked = Lists.newArrayList();
|
||||
context = createContext(
|
||||
context = createView(
|
||||
setupProperties(),
|
||||
ImmutableSet.<Module> of(new Log4JLoggingModule(),
|
||||
TrackingJavaUrlHttpCommandExecutorService.newTrackingModule(commandsInvoked)));
|
||||
|
|
|
@ -39,18 +39,18 @@ public class TestCanRecreateGroupLiveTest extends BaseComputeServiceContextLiveT
|
|||
public void testCanRecreateGroup() throws Exception {
|
||||
|
||||
String tag = PREFIX + "recreate";
|
||||
context.getComputeService().destroyNodesMatching(NodePredicates.inGroup(tag));
|
||||
view.getComputeService().destroyNodesMatching(NodePredicates.inGroup(tag));
|
||||
|
||||
try {
|
||||
Template template = context.getComputeService().templateBuilder().build();
|
||||
context.getComputeService().createNodesInGroup(tag, 1, template);
|
||||
context.getComputeService().destroyNodesMatching(NodePredicates.inGroup(tag));
|
||||
context.getComputeService().createNodesInGroup(tag, 1, template);
|
||||
Template template = view.getComputeService().templateBuilder().build();
|
||||
view.getComputeService().createNodesInGroup(tag, 1, template);
|
||||
view.getComputeService().destroyNodesMatching(NodePredicates.inGroup(tag));
|
||||
view.getComputeService().createNodesInGroup(tag, 1, template);
|
||||
} catch (RunNodesException e) {
|
||||
System.err.println(e.getNodeErrors().keySet());
|
||||
Throwables.propagate(e);
|
||||
} finally {
|
||||
context.getComputeService().destroyNodesMatching(NodePredicates.inGroup(tag));
|
||||
view.getComputeService().destroyNodesMatching(NodePredicates.inGroup(tag));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ public class AvailabilityZoneAndRegionClientLiveTest extends BaseComputeServiceC
|
|||
@BeforeClass(groups = { "integration", "live" })
|
||||
public void setupContext() {
|
||||
super.setupContext();
|
||||
client = context.unwrap(EC2ApiMetadata.CONTEXT_TOKEN).getApi().getAvailabilityZoneAndRegionServices();
|
||||
client = view.unwrap(EC2ApiMetadata.CONTEXT_TOKEN).getApi().getAvailabilityZoneAndRegionServices();
|
||||
}
|
||||
|
||||
public void testDescribeAvailabilityZones() {
|
||||
|
|
|
@ -61,12 +61,12 @@ public class ElasticBlockStoreClientLiveTest extends BaseComputeServiceContextLi
|
|||
@BeforeClass(groups = { "integration", "live" })
|
||||
public void setupContext() {
|
||||
super.setupContext();
|
||||
client = context.unwrap(EC2ApiMetadata.CONTEXT_TOKEN).getApi().getElasticBlockStoreServices();
|
||||
client = view.unwrap(EC2ApiMetadata.CONTEXT_TOKEN).getApi().getElasticBlockStoreServices();
|
||||
}
|
||||
|
||||
@Test
|
||||
void testDescribeVolumes() {
|
||||
for (String region : context.unwrap(EC2ApiMetadata.CONTEXT_TOKEN).getApi().getAvailabilityZoneAndRegionServices().describeRegions().keySet()) {
|
||||
for (String region : view.unwrap(EC2ApiMetadata.CONTEXT_TOKEN).getApi().getAvailabilityZoneAndRegionServices().describeRegions().keySet()) {
|
||||
SortedSet<Volume> allResults = Sets.newTreeSet(client.describeVolumesInRegion(region));
|
||||
assertNotNull(allResults);
|
||||
if (allResults.size() >= 1) {
|
||||
|
|
|
@ -50,7 +50,7 @@ public class ElasticIPAddressClientLiveTest extends BaseComputeServiceContextLiv
|
|||
@BeforeClass(groups = { "integration", "live" })
|
||||
public void setupContext() {
|
||||
super.setupContext();
|
||||
client = context.unwrap(EC2ApiMetadata.CONTEXT_TOKEN).getApi().getElasticIPAddressServices();
|
||||
client = view.unwrap(EC2ApiMetadata.CONTEXT_TOKEN).getApi().getElasticIPAddressServices();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -49,7 +49,7 @@ public class InstanceClientLiveTest extends BaseComputeServiceContextLiveTest {
|
|||
@BeforeClass(groups = { "integration", "live" })
|
||||
public void setupContext() {
|
||||
super.setupContext();
|
||||
client = context.unwrap(EC2ApiMetadata.CONTEXT_TOKEN).getApi().getInstanceServices();
|
||||
client = view.unwrap(EC2ApiMetadata.CONTEXT_TOKEN).getApi().getInstanceServices();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -51,7 +51,7 @@ public class KeyPairClientLiveTest extends BaseComputeServiceContextLiveTest {
|
|||
@BeforeClass(groups = { "integration", "live" })
|
||||
public void setupContext() {
|
||||
super.setupContext();
|
||||
client = context.unwrap(EC2ApiMetadata.CONTEXT_TOKEN).getApi().getKeyPairServices();
|
||||
client = view.unwrap(EC2ApiMetadata.CONTEXT_TOKEN).getApi().getKeyPairServices();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -60,7 +60,7 @@ public class SecurityGroupClientLiveTest extends BaseComputeServiceContextLiveTe
|
|||
@BeforeClass(groups = { "integration", "live" })
|
||||
public void setupContext() {
|
||||
super.setupContext();
|
||||
client = context.unwrap(EC2ApiMetadata.CONTEXT_TOKEN).getApi().getSecurityGroupServices();
|
||||
client = view.unwrap(EC2ApiMetadata.CONTEXT_TOKEN).getApi().getSecurityGroupServices();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -281,6 +281,6 @@ public class SecurityGroupClientLiveTest extends BaseComputeServiceContextLiveTe
|
|||
|
||||
@AfterTest
|
||||
public void shutdown() {
|
||||
context.close();
|
||||
view.close();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -76,8 +76,8 @@ public class WindowsClientLiveTest extends BaseComputeServiceContextLiveTest {
|
|||
@BeforeClass(groups = { "integration", "live" })
|
||||
public void setupContext() {
|
||||
super.setupContext();
|
||||
client = context.unwrap(EC2ApiMetadata.CONTEXT_TOKEN).getApi().getWindowsServices();
|
||||
computeService = context.getComputeService();
|
||||
client = view.unwrap(EC2ApiMetadata.CONTEXT_TOKEN).getApi().getWindowsServices();
|
||||
computeService = view.getComputeService();
|
||||
}
|
||||
|
||||
|
||||
|
@ -141,7 +141,7 @@ public class WindowsClientLiveTest extends BaseComputeServiceContextLiveTest {
|
|||
node.getCredentials().getPrivateKey());
|
||||
|
||||
// And apply it to the decryption function
|
||||
WindowsLoginCredentialsFromEncryptedData f = context.getUtils().getInjector().getInstance(WindowsLoginCredentialsFromEncryptedData.class);
|
||||
WindowsLoginCredentialsFromEncryptedData f = view.getUtils().getInjector().getInstance(WindowsLoginCredentialsFromEncryptedData.class);
|
||||
LoginCredentials credentials = f.apply(dataAndKey);
|
||||
|
||||
assertEquals(credentials.getUser(), "Administrator");
|
||||
|
|
|
@ -85,7 +85,7 @@ public class ElasticStackApiMetadata extends BaseRestApiMetadata {
|
|||
.version("1.0")
|
||||
.defaultEndpoint("https://api.lon-p.elastichosts.com")
|
||||
.defaultProperties(ElasticStackApiMetadata.defaultProperties())
|
||||
.wrapper(TypeToken.of(ComputeServiceContext.class))
|
||||
.view(TypeToken.of(ComputeServiceContext.class))
|
||||
.defaultModules(ImmutableSet.<Class<? extends Module>>of(ElasticStackRestClientModule.class, ElasticStackComputeServiceContextModule.class));
|
||||
}
|
||||
|
||||
|
|
|
@ -88,7 +88,7 @@ public class ElasticStackClientLiveTest
|
|||
@Override
|
||||
public void setupContext() {
|
||||
super.setupContext();
|
||||
cloudStackContext = context.unwrap();
|
||||
cloudStackContext = view.unwrap();
|
||||
|
||||
client = cloudStackContext.getApi();
|
||||
driveNotClaimed = new RetryablePredicate<DriveInfo>(Predicates.not(new DriveClaimed(client)), maxDriveImageTime,
|
||||
|
@ -97,7 +97,7 @@ public class ElasticStackClientLiveTest
|
|||
TimeUnit.SECONDS);
|
||||
|
||||
if (Strings.emptyToNull(imageId) == null) {
|
||||
imageId = context.getComputeService().templateBuilder().build().getImage().getId();
|
||||
imageId = view.getComputeService().templateBuilder().build().getImage().getId();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ public class FilesystemApiMetadata extends BaseApiMetadata {
|
|||
.defaultCredential("bar")
|
||||
.version("1")
|
||||
.documentation(URI.create("http://www.jclouds.org/documentation/userguide/blobstore-guide"))
|
||||
.wrapper(BlobStoreContext.class)
|
||||
.view(BlobStoreContext.class)
|
||||
.defaultModule(FilesystemBlobStoreContextModule.class);
|
||||
}
|
||||
|
||||
|
|
|
@ -131,7 +131,7 @@ public class FilesystemAsyncBlobStoreTest {
|
|||
// no base directory declared in properties
|
||||
try {
|
||||
Properties props = new Properties();
|
||||
context = ContextBuilder.newBuilder(PROVIDER).overrides(props).build();
|
||||
context = ContextBuilder.newBuilder(PROVIDER).overrides(props).build(BlobStoreContext.class);
|
||||
fail("No error if base directory is not specified");
|
||||
} catch (CreationException e) {
|
||||
}
|
||||
|
@ -140,7 +140,7 @@ public class FilesystemAsyncBlobStoreTest {
|
|||
try {
|
||||
Properties props = new Properties();
|
||||
props.setProperty(FilesystemConstants.PROPERTY_BASEDIR, null);
|
||||
context = ContextBuilder.newBuilder(PROVIDER).overrides(props).build();
|
||||
context = ContextBuilder.newBuilder(PROVIDER).overrides(props).build(BlobStoreContext.class);
|
||||
fail("No error if base directory is null in the option");
|
||||
} catch (NullPointerException e) {
|
||||
}
|
||||
|
|
|
@ -62,14 +62,14 @@ public class FilesystemContainerIntegrationTestDisabled extends BaseContainerInt
|
|||
|
||||
// NOTE all metadata in jclouds comes out as lowercase, in an effort to normalize the
|
||||
// providers.
|
||||
Blob object = context.getBlobStore().blobBuilder(key).userMetadata(ImmutableMap.of("Adrian", "powderpuff"))
|
||||
Blob object = view.getBlobStore().blobBuilder(key).userMetadata(ImmutableMap.of("Adrian", "powderpuff"))
|
||||
.payload(TEST_STRING).contentType(MediaType.TEXT_PLAIN).build();
|
||||
String containerName = getContainerName();
|
||||
try {
|
||||
addBlobToContainer(containerName, object);
|
||||
validateContent(containerName, key);
|
||||
|
||||
PageSet<? extends StorageMetadata> container = context.getBlobStore().list(containerName, maxResults(1));
|
||||
PageSet<? extends StorageMetadata> container = view.getBlobStore().list(containerName, maxResults(1));
|
||||
|
||||
BlobMetadata metadata = (BlobMetadata) Iterables.getOnlyElement(container);
|
||||
// transient container should be lenient and not return metadata on undetailed listing.
|
||||
|
|
|
@ -76,7 +76,7 @@ public class NovaApiMetadata extends BaseRestApiMetadata {
|
|||
.version("1.1")
|
||||
.defaultEndpoint("http://localhost:5000")
|
||||
.defaultProperties(NovaApiMetadata.defaultProperties())
|
||||
.wrapper(TypeToken.of(ComputeServiceContext.class))
|
||||
.view(TypeToken.of(ComputeServiceContext.class))
|
||||
.defaultModules(ImmutableSet.<Class<? extends Module>>of(NovaRestClientModule.class, NovaComputeServiceContextModule.class));
|
||||
}
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ import com.google.common.util.concurrent.ListenableFuture;
|
|||
* Provides asynchronous access to OpenStack Nova via their REST API.
|
||||
* <p/>
|
||||
* All commands return a ListenableFuture of the result from OpenStack Nova. Any exceptions incurred
|
||||
* during processing will be wrapped in an {@link ExecutionException} as documented in
|
||||
* during processing will be backend in an {@link ExecutionException} as documented in
|
||||
* {@link ListenableFuture#get()}.
|
||||
*
|
||||
* @author Adrian Cole
|
||||
|
|
|
@ -40,7 +40,7 @@ import org.jclouds.rest.ResourceNotFoundException;
|
|||
* Provides access to OpenStack Nova via their REST API.
|
||||
* <p/>
|
||||
* All commands return a Future of the result from OpenStack Nova. Any exceptions incurred
|
||||
* during processing will be wrapped in an {@link ExecutionException} as documented in
|
||||
* during processing will be backend in an {@link ExecutionException} as documented in
|
||||
* {@link Future#get()}.
|
||||
*
|
||||
* @see NovaAsyncClient
|
||||
|
|
|
@ -78,7 +78,7 @@ public class NovaClientLiveTest extends BaseComputeServiceContextLiveTest {
|
|||
@Override
|
||||
public void setupContext() {
|
||||
super.setupContext();
|
||||
Injector injector = context.utils().injector();
|
||||
Injector injector = view.utils().injector();
|
||||
client = injector.getInstance(NovaClient.class);
|
||||
sshFactory = injector.getInstance(SshClient.Factory.class);
|
||||
SocketOpen socketOpen = injector.getInstance(SocketOpen.class);
|
||||
|
|
|
@ -94,7 +94,7 @@ public class NovaApiMetadata extends BaseRestApiMetadata {
|
|||
.version("1.1")
|
||||
.defaultEndpoint("http://localhost:5000")
|
||||
.defaultProperties(NovaApiMetadata.defaultProperties())
|
||||
.wrapper(TypeToken.of(ComputeServiceContext.class))
|
||||
.view(TypeToken.of(ComputeServiceContext.class))
|
||||
.defaultModules(ImmutableSet.<Class<? extends Module>>of(NovaRestClientModule.class, NovaComputeServiceContextModule.class));
|
||||
}
|
||||
|
||||
|
|
|
@ -24,8 +24,10 @@ import org.jclouds.javax.annotation.Nullable;
|
|||
import org.jclouds.location.Zone;
|
||||
import org.jclouds.location.functions.ZoneToEndpoint;
|
||||
import org.jclouds.openstack.nova.v1_1.extensions.FloatingIPAsyncClient;
|
||||
import org.jclouds.openstack.nova.v1_1.extensions.HostAdministrationAsyncClient;
|
||||
import org.jclouds.openstack.nova.v1_1.extensions.KeyPairAsyncClient;
|
||||
import org.jclouds.openstack.nova.v1_1.extensions.SecurityGroupAsyncClient;
|
||||
import org.jclouds.openstack.nova.v1_1.extensions.SimpleTenantUsageAsyncClient;
|
||||
import org.jclouds.openstack.nova.v1_1.features.ExtensionAsyncClient;
|
||||
import org.jclouds.openstack.nova.v1_1.features.FlavorAsyncClient;
|
||||
import org.jclouds.openstack.nova.v1_1.features.ImageAsyncClient;
|
||||
|
@ -103,4 +105,19 @@ public interface NovaAsyncClient {
|
|||
@Delegate
|
||||
Optional<KeyPairAsyncClient> getKeyPairExtensionForZone(
|
||||
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
|
||||
|
||||
/**
|
||||
* Provides asynchronous access to Host Administration features.
|
||||
*/
|
||||
@Delegate
|
||||
Optional<HostAdministrationAsyncClient> getHostAdministrationExtensionForZone(
|
||||
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
|
||||
|
||||
/**
|
||||
* Provides asynchronous access to Simple Tenant Usage features.
|
||||
*/
|
||||
@Delegate
|
||||
Optional<SimpleTenantUsageAsyncClient> getSimpleTenantUsageExtensionForZone(
|
||||
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
|
||||
|
||||
}
|
||||
|
|
|
@ -26,8 +26,10 @@ import org.jclouds.javax.annotation.Nullable;
|
|||
import org.jclouds.location.Zone;
|
||||
import org.jclouds.location.functions.ZoneToEndpoint;
|
||||
import org.jclouds.openstack.nova.v1_1.extensions.FloatingIPClient;
|
||||
import org.jclouds.openstack.nova.v1_1.extensions.HostAdministrationClient;
|
||||
import org.jclouds.openstack.nova.v1_1.extensions.KeyPairClient;
|
||||
import org.jclouds.openstack.nova.v1_1.extensions.SecurityGroupClient;
|
||||
import org.jclouds.openstack.nova.v1_1.extensions.SimpleTenantUsageClient;
|
||||
import org.jclouds.openstack.nova.v1_1.features.ExtensionClient;
|
||||
import org.jclouds.openstack.nova.v1_1.features.FlavorClient;
|
||||
import org.jclouds.openstack.nova.v1_1.features.ImageClient;
|
||||
|
@ -106,4 +108,18 @@ public interface NovaClient {
|
|||
Optional<KeyPairClient> getKeyPairExtensionForZone(
|
||||
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
|
||||
|
||||
/**
|
||||
* Provides synchronous access to Host Administration features.
|
||||
*/
|
||||
@Delegate
|
||||
Optional<HostAdministrationClient> getHostAdministrationExtensionForZone(
|
||||
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
|
||||
|
||||
/**
|
||||
* Provides synchronous access to Simple Tenant Usage features.
|
||||
*/
|
||||
@Delegate
|
||||
Optional<SimpleTenantUsageClient> getSimpleTenantUsageExtensionForZone(
|
||||
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
|
||||
|
||||
}
|
||||
|
|
|
@ -151,8 +151,8 @@ public class NovaComputeService extends BaseComputeService {
|
|||
Optional<KeyPairClient> keyPairClient = novaClient.getKeyPairExtensionForZone(zoneId);
|
||||
if (keyPairClient.isPresent()) {
|
||||
for (String group : groups) {
|
||||
for (Map<String, KeyPair> wrapper : keyPairClient.get().listKeyPairs()) {
|
||||
for (KeyPair pair : Iterables.filter(wrapper.values(),
|
||||
for (Map<String, KeyPair> view : keyPairClient.get().listKeyPairs()) {
|
||||
for (KeyPair pair : Iterables.filter(view.values(),
|
||||
KeyPairPredicates.nameMatches(namingConvention.create().containsGroup(group)))) {
|
||||
ZoneAndName zoneAndName = ZoneAndName.fromZoneAndName(zoneId, pair.getName());
|
||||
logger.debug(">> deleting keypair(%s)", zoneAndName);
|
||||
|
|
|
@ -25,8 +25,15 @@ import javax.inject.Singleton;
|
|||
|
||||
import org.jclouds.json.config.GsonModule;
|
||||
import org.jclouds.json.config.GsonModule.DateAdapter;
|
||||
import org.jclouds.openstack.nova.v1_1.domain.HostResourceUsage;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.gson.JsonDeserializationContext;
|
||||
import com.google.gson.JsonDeserializer;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonParseException;
|
||||
import com.google.gson.JsonSerializationContext;
|
||||
import com.google.gson.JsonSerializer;
|
||||
import com.google.inject.AbstractModule;
|
||||
import com.google.inject.Provides;
|
||||
|
||||
|
@ -38,7 +45,7 @@ public class NovaParserModule extends AbstractModule {
|
|||
@Provides
|
||||
@Singleton
|
||||
public Map<Type, Object> provideCustomAdapterBindings() {
|
||||
return ImmutableMap.<Type, Object> of();
|
||||
return ImmutableMap.<Type, Object> of(HostResourceUsage.class, new HostResourceUsageAdapter());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -46,4 +53,30 @@ public class NovaParserModule extends AbstractModule {
|
|||
bind(DateAdapter.class).to(GsonModule.Iso8601DateAdapter.class);
|
||||
}
|
||||
|
||||
@Singleton
|
||||
public static class HostResourceUsageAdapter implements JsonSerializer<HostResourceUsage>, JsonDeserializer<HostResourceUsage> {
|
||||
public HostResourceUsage apply(HostResourceUsageView in) {
|
||||
return in.resource.toBuilder().build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public HostResourceUsage deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext context) throws JsonParseException {
|
||||
return apply((HostResourceUsageView) context.deserialize(jsonElement, HostResourceUsageView.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
public JsonElement serialize(HostResourceUsage hostResourceUsage, Type type, JsonSerializationContext context) {
|
||||
return context.serialize(hostResourceUsage);
|
||||
}
|
||||
|
||||
private static class HostResourceUsageView {
|
||||
protected HostResourceUsageInternal resource;
|
||||
}
|
||||
private static class HostResourceUsageInternal extends HostResourceUsage {
|
||||
protected HostResourceUsageInternal(Builder<?> builder) {
|
||||
super(builder);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -35,12 +35,7 @@ import org.jclouds.openstack.keystone.v2_0.config.KeystoneAuthenticationModule;
|
|||
import org.jclouds.openstack.nova.v1_1.NovaAsyncClient;
|
||||
import org.jclouds.openstack.nova.v1_1.NovaClient;
|
||||
import org.jclouds.openstack.nova.v1_1.domain.Extension;
|
||||
import org.jclouds.openstack.nova.v1_1.extensions.FloatingIPAsyncClient;
|
||||
import org.jclouds.openstack.nova.v1_1.extensions.FloatingIPClient;
|
||||
import org.jclouds.openstack.nova.v1_1.extensions.KeyPairAsyncClient;
|
||||
import org.jclouds.openstack.nova.v1_1.extensions.KeyPairClient;
|
||||
import org.jclouds.openstack.nova.v1_1.extensions.SecurityGroupAsyncClient;
|
||||
import org.jclouds.openstack.nova.v1_1.extensions.SecurityGroupClient;
|
||||
import org.jclouds.openstack.nova.v1_1.extensions.*;
|
||||
import org.jclouds.openstack.nova.v1_1.features.ExtensionAsyncClient;
|
||||
import org.jclouds.openstack.nova.v1_1.features.ExtensionClient;
|
||||
import org.jclouds.openstack.nova.v1_1.features.FlavorAsyncClient;
|
||||
|
@ -75,7 +70,10 @@ public class NovaRestClientModule extends RestClientModule<NovaClient, NovaAsync
|
|||
.put(ImageClient.class, ImageAsyncClient.class).put(ExtensionClient.class, ExtensionAsyncClient.class)
|
||||
.put(FloatingIPClient.class, FloatingIPAsyncClient.class)
|
||||
.put(SecurityGroupClient.class, SecurityGroupAsyncClient.class)
|
||||
.put(KeyPairClient.class, KeyPairAsyncClient.class).build();
|
||||
.put(KeyPairClient.class, KeyPairAsyncClient.class)
|
||||
.put(HostAdministrationClient.class, HostAdministrationAsyncClient.class)
|
||||
.put(SimpleTenantUsageClient.class, SimpleTenantUsageAsyncClient.class)
|
||||
.build();
|
||||
|
||||
public NovaRestClientModule() {
|
||||
super(DELEGATE_MAP);
|
||||
|
|
|
@ -0,0 +1,126 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.openstack.nova.v1_1.domain;
|
||||
|
||||
import org.jclouds.javax.annotation.Nullable;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.base.Objects.ToStringHelper;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
/**
|
||||
* Class Host
|
||||
*/
|
||||
public class Host {
|
||||
|
||||
public static Builder<?> builder() {
|
||||
return new ConcreteBuilder();
|
||||
}
|
||||
|
||||
public Builder<?> toBuilder() {
|
||||
return new ConcreteBuilder().fromHost(this);
|
||||
}
|
||||
|
||||
public static abstract class Builder<T extends Builder<T>> {
|
||||
protected abstract T self();
|
||||
|
||||
private String name;
|
||||
private String service;
|
||||
|
||||
public T name(String name) {
|
||||
this.name = name;
|
||||
return self();
|
||||
}
|
||||
|
||||
public T service(String service) {
|
||||
this.service = service;
|
||||
return self();
|
||||
}
|
||||
|
||||
public Host build() {
|
||||
return new Host(this);
|
||||
}
|
||||
|
||||
public T fromHost(Host in) {
|
||||
return this
|
||||
.name(in.getName())
|
||||
.service(in.getService())
|
||||
;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
|
||||
@Override
|
||||
protected ConcreteBuilder self() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@SerializedName(value="host_name")
|
||||
private final String name;
|
||||
private final String service;
|
||||
|
||||
protected Host(Builder<?> builder) {
|
||||
this.name = builder.name;
|
||||
this.service = builder.service;
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
@Nullable
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
@Nullable
|
||||
public String getService() {
|
||||
return this.service;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(name, service);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) return true;
|
||||
if (obj == null || getClass() != obj.getClass()) return false;
|
||||
Host that = Host.class.cast(obj);
|
||||
return Objects.equal(this.name, that.name)
|
||||
&& Objects.equal(this.service, that.service)
|
||||
;
|
||||
}
|
||||
|
||||
protected ToStringHelper string() {
|
||||
return Objects.toStringHelper("")
|
||||
.add("name", name)
|
||||
.add("service", service)
|
||||
;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return string().toString();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,177 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.openstack.nova.v1_1.domain;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import org.jclouds.javax.annotation.Nullable;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.base.Objects.ToStringHelper;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
/**
|
||||
* Class HostResourceUsage
|
||||
*/
|
||||
public class HostResourceUsage {
|
||||
|
||||
public static Builder<?> builder() {
|
||||
return new ConcreteBuilder();
|
||||
}
|
||||
|
||||
public Builder<?> toBuilder() {
|
||||
return new ConcreteBuilder().fromHostResourceUsage(this);
|
||||
}
|
||||
|
||||
public static abstract class Builder<T extends Builder<T>> {
|
||||
protected abstract T self();
|
||||
|
||||
private String host;
|
||||
private String project;
|
||||
private int memoryMb;
|
||||
private int cpu;
|
||||
private int diskGb;
|
||||
|
||||
public T host(String host) {
|
||||
this.host = host;
|
||||
return self();
|
||||
}
|
||||
|
||||
public T project(String project) {
|
||||
this.project = project;
|
||||
return self();
|
||||
}
|
||||
|
||||
public T memoryMb(int memoryMb) {
|
||||
this.memoryMb = memoryMb;
|
||||
return self();
|
||||
}
|
||||
|
||||
public T cpu(int cpu) {
|
||||
this.cpu = cpu;
|
||||
return self();
|
||||
}
|
||||
|
||||
public T diskGb(int diskGb) {
|
||||
this.diskGb = diskGb;
|
||||
return self();
|
||||
}
|
||||
|
||||
public HostResourceUsage build() {
|
||||
return new HostResourceUsage(this);
|
||||
}
|
||||
|
||||
public T fromHostResourceUsage(HostResourceUsage in) {
|
||||
return this
|
||||
.host(in.getHost())
|
||||
.project(in.getProject())
|
||||
.memoryMb(in.getMemoryMb())
|
||||
.cpu(in.getCpu())
|
||||
.diskGb(in.getDiskGb())
|
||||
;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
|
||||
@Override
|
||||
protected ConcreteBuilder self() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
private final String host;
|
||||
private final String project;
|
||||
@SerializedName(value="memory_mb")
|
||||
private final int memoryMb;
|
||||
private final int cpu;
|
||||
@SerializedName(value="disk_gb")
|
||||
private final int diskGb;
|
||||
|
||||
protected HostResourceUsage(Builder<?> builder) {
|
||||
this.host = checkNotNull(builder.host, "host");
|
||||
this.project = builder.project;
|
||||
this.memoryMb = checkNotNull(builder.memoryMb, "memoryMb");
|
||||
this.cpu = checkNotNull(builder.cpu, "cpu");
|
||||
this.diskGb = checkNotNull(builder.diskGb, "diskGb");
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public String getHost() {
|
||||
return this.host;
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
@Nullable
|
||||
public String getProject() {
|
||||
return this.project;
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public int getMemoryMb() {
|
||||
return this.memoryMb;
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public int getCpu() {
|
||||
return this.cpu;
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public int getDiskGb() {
|
||||
return this.diskGb;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(host, project, memoryMb, cpu, diskGb);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) return true;
|
||||
if (obj == null || getClass() != obj.getClass()) return false;
|
||||
HostResourceUsage that = HostResourceUsage.class.cast(obj);
|
||||
return Objects.equal(this.host, that.host)
|
||||
&& Objects.equal(this.project, that.project)
|
||||
&& Objects.equal(this.memoryMb, that.memoryMb)
|
||||
&& Objects.equal(this.cpu, that.cpu)
|
||||
&& Objects.equal(this.diskGb, that.diskGb);
|
||||
}
|
||||
|
||||
protected ToStringHelper string() {
|
||||
return Objects.toStringHelper("")
|
||||
.add("host", host)
|
||||
.add("project", project)
|
||||
.add("memoryMb", memoryMb)
|
||||
.add("cpu", cpu)
|
||||
.add("diskGb", diskGb);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return string().toString();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,302 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.openstack.nova.v1_1.domain;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.jclouds.javax.annotation.Nullable;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.base.Objects.ToStringHelper;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
/**
|
||||
* Information the SimpleTenantUsage extension return data about each Server
|
||||
*
|
||||
* @author Adam Lowe
|
||||
*/
|
||||
public class SimpleServerUsage {
|
||||
|
||||
public static enum Status {
|
||||
|
||||
UNRECOGNIZED, ACTIVE;
|
||||
|
||||
public String value() {
|
||||
return name();
|
||||
}
|
||||
|
||||
public static Status fromValue(String v) {
|
||||
try {
|
||||
return valueOf(v.toUpperCase());
|
||||
} catch (IllegalArgumentException e) {
|
||||
return UNRECOGNIZED;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static Builder<?> builder() {
|
||||
return new ConcreteBuilder();
|
||||
}
|
||||
|
||||
public Builder<?> toBuilder() {
|
||||
return new ConcreteBuilder().fromSimpleServerUsage(this);
|
||||
}
|
||||
|
||||
public static abstract class Builder<T extends Builder<T>> {
|
||||
private String instanceName;
|
||||
private double hours;
|
||||
private double flavorMemoryMb;
|
||||
private double flavorLocalGb;
|
||||
private double flavorVcpus;
|
||||
private String tenantId;
|
||||
private String flavorName;
|
||||
private Date instanceCreated;
|
||||
private Date instanceTerminiated;
|
||||
private Status instanceStatus;
|
||||
private long uptime;
|
||||
|
||||
protected abstract T self();
|
||||
|
||||
public T instanceName(String instanceName) {
|
||||
this.instanceName = instanceName;
|
||||
return self();
|
||||
}
|
||||
|
||||
public T hours(double hours) {
|
||||
this.hours = hours;
|
||||
return self();
|
||||
}
|
||||
|
||||
public T flavorMemoryMb(double flavorMemoryMb) {
|
||||
this.flavorMemoryMb = flavorMemoryMb;
|
||||
return self();
|
||||
}
|
||||
|
||||
public T flavorLocalGb(double flavorLocalGb) {
|
||||
this.flavorLocalGb = flavorLocalGb;
|
||||
return self();
|
||||
}
|
||||
|
||||
public T flavorVcpus(double flavorVcpus) {
|
||||
this.flavorVcpus = flavorVcpus;
|
||||
return self();
|
||||
}
|
||||
|
||||
public T tenantId(String tenantId) {
|
||||
this.tenantId = tenantId;
|
||||
return self();
|
||||
}
|
||||
|
||||
public T flavorName(String flavorName) {
|
||||
this.flavorName = flavorName;
|
||||
return self();
|
||||
}
|
||||
|
||||
public T instanceCreated(Date instanceCreated) {
|
||||
this.instanceCreated = instanceCreated;
|
||||
return self();
|
||||
}
|
||||
|
||||
public T instanceTerminiated(Date instanceTerminiated) {
|
||||
this.instanceTerminiated = instanceTerminiated;
|
||||
return self();
|
||||
}
|
||||
|
||||
public T instanceStatus(Status instanceStatus) {
|
||||
this.instanceStatus = instanceStatus;
|
||||
return self();
|
||||
}
|
||||
|
||||
public T uptime(long uptime) {
|
||||
this.uptime = uptime;
|
||||
return self();
|
||||
}
|
||||
|
||||
public SimpleServerUsage build() {
|
||||
return new SimpleServerUsage(this);
|
||||
}
|
||||
|
||||
|
||||
public T fromSimpleServerUsage(SimpleServerUsage in) {
|
||||
return this
|
||||
.instanceName(in.getInstanceName())
|
||||
.flavorMemoryMb(in.getFlavorMemoryMb())
|
||||
.flavorLocalGb(in.getFlavorLocalGb())
|
||||
.flavorVcpus(in.getFlavorVcpus())
|
||||
.tenantId(in.getTenantId())
|
||||
.flavorName(in.getFlavorName())
|
||||
.instanceCreated(in.getInstanceCreated())
|
||||
.instanceTerminiated(in.getInstanceTerminiated())
|
||||
.instanceStatus(in.getInstanceStatus())
|
||||
.uptime(in.getUptime())
|
||||
;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
|
||||
@Override
|
||||
protected ConcreteBuilder self() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@SerializedName("name")
|
||||
private final String instanceName;
|
||||
private final double hours;
|
||||
@SerializedName("memory_mb")
|
||||
private final double flavorMemoryMb;
|
||||
@SerializedName("local_gb")
|
||||
private final double flavorLocalGb;
|
||||
@SerializedName("vcpus")
|
||||
private final double flavorVcpus;
|
||||
@SerializedName("tenant_id")
|
||||
private final String tenantId;
|
||||
@SerializedName("flavor")
|
||||
private final String flavorName;
|
||||
@SerializedName("started_at")
|
||||
private final Date instanceCreated;
|
||||
@SerializedName("ended_at")
|
||||
private final Date instanceTerminiated;
|
||||
@SerializedName("state")
|
||||
private final Status instanceStatus;
|
||||
private final long uptime;
|
||||
|
||||
private SimpleServerUsage(Builder<?> builder) {
|
||||
this.instanceName = checkNotNull(builder.instanceName, "instanceName");
|
||||
this.hours = builder.hours;
|
||||
this.flavorMemoryMb = builder.flavorMemoryMb;
|
||||
this.flavorLocalGb = builder.flavorLocalGb;
|
||||
this.flavorVcpus = builder.flavorVcpus;
|
||||
this.tenantId = checkNotNull(builder.tenantId, "tenantId");
|
||||
this.flavorName = checkNotNull(builder.flavorName, "flavorName");
|
||||
this.instanceCreated = builder.instanceCreated; //checkNotNull(builder.instanceCreated, "instanceCreated");
|
||||
this.instanceTerminiated = builder.instanceTerminiated;
|
||||
this.instanceStatus = checkNotNull(builder.instanceStatus, "instanceStatus");
|
||||
this.uptime = checkNotNull(builder.uptime, "uptime");
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public String getInstanceName() {
|
||||
return this.instanceName;
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public double getFlavorMemoryMb() {
|
||||
return this.flavorMemoryMb;
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public double getFlavorLocalGb() {
|
||||
return this.flavorLocalGb;
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public double getFlavorVcpus() {
|
||||
return this.flavorVcpus;
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public String getTenantId() {
|
||||
return this.tenantId;
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public String getFlavorName() {
|
||||
return this.flavorName;
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public Date getInstanceCreated() {
|
||||
return this.instanceCreated;
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
@Nullable
|
||||
public Date getInstanceTerminiated() {
|
||||
return this.instanceTerminiated;
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public Status getInstanceStatus() {
|
||||
return this.instanceStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public long getUptime() {
|
||||
return this.uptime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(instanceName, flavorMemoryMb, flavorLocalGb, flavorVcpus, tenantId, flavorName, instanceCreated, instanceTerminiated, instanceStatus, uptime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) return true;
|
||||
if (obj == null || getClass() != obj.getClass()) return false;
|
||||
SimpleServerUsage that = SimpleServerUsage.class.cast(obj);
|
||||
return Objects.equal(this.instanceName, that.instanceName)
|
||||
&& Objects.equal(this.flavorMemoryMb, that.flavorMemoryMb)
|
||||
&& Objects.equal(this.flavorLocalGb, that.flavorLocalGb)
|
||||
&& Objects.equal(this.flavorVcpus, that.flavorVcpus)
|
||||
&& Objects.equal(this.tenantId, that.tenantId)
|
||||
&& Objects.equal(this.flavorName, that.flavorName)
|
||||
&& Objects.equal(this.instanceCreated, that.instanceCreated)
|
||||
&& Objects.equal(this.instanceTerminiated, that.instanceTerminiated)
|
||||
&& Objects.equal(this.instanceStatus, that.instanceStatus)
|
||||
&& Objects.equal(this.uptime, that.uptime)
|
||||
;
|
||||
}
|
||||
|
||||
protected ToStringHelper string() {
|
||||
return Objects.toStringHelper("")
|
||||
.add("instanceName", instanceName)
|
||||
.add("flavorMemoryMb", flavorMemoryMb)
|
||||
.add("flavorLocalGb", flavorLocalGb)
|
||||
.add("flavorVcpus", flavorVcpus)
|
||||
.add("tenantId", tenantId)
|
||||
.add("flavorName", flavorName)
|
||||
.add("instanceCreated", instanceCreated)
|
||||
.add("instanceTerminiated", instanceTerminiated)
|
||||
.add("instanceStatus", instanceStatus)
|
||||
.add("uptime", uptime)
|
||||
;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return string().toString();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,239 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.openstack.nova.v1_1.domain;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.Set;
|
||||
|
||||
import org.jclouds.javax.annotation.Nullable;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.base.Objects.ToStringHelper;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
/**
|
||||
* Information the SimpleTenantUsage extension returns data about each tenant
|
||||
*
|
||||
* @author Adam Lowe
|
||||
*/
|
||||
public class SimpleTenantUsage {
|
||||
public static Builder<?> builder() {
|
||||
return new ConcreteBuilder();
|
||||
}
|
||||
|
||||
public Builder<?> toBuilder() {
|
||||
return new ConcreteBuilder().fromSimpleTenantUsage(this);
|
||||
}
|
||||
|
||||
public static abstract class Builder<T extends Builder<T>> {
|
||||
private String tenantId;
|
||||
private double totalLocalGbUsage;
|
||||
private double totalVcpusUsage;
|
||||
private double totalMemoryMbUsage;
|
||||
private double totalHours;
|
||||
private Date start;
|
||||
private Date stop;
|
||||
private Set<SimpleServerUsage> serverUsages = Sets.newLinkedHashSet();
|
||||
|
||||
protected abstract T self();
|
||||
|
||||
public T tenantId(String tenantId) {
|
||||
this.tenantId = tenantId;
|
||||
return self();
|
||||
}
|
||||
|
||||
public T totalLocalGbUsage(double total_local_gb_usage) {
|
||||
this.totalLocalGbUsage = total_local_gb_usage;
|
||||
return self();
|
||||
}
|
||||
|
||||
public T totalVcpusUsage(double total_vcpus_usage) {
|
||||
this.totalVcpusUsage = total_vcpus_usage;
|
||||
return self();
|
||||
}
|
||||
|
||||
public T totalMemoryMbUsage(double total_memory_mb_usage) {
|
||||
this.totalMemoryMbUsage = total_memory_mb_usage;
|
||||
return self();
|
||||
}
|
||||
|
||||
public T totalHours(double total_hours) {
|
||||
this.totalHours = total_hours;
|
||||
return self();
|
||||
}
|
||||
|
||||
public T start(Date start) {
|
||||
this.start = start;
|
||||
return self();
|
||||
}
|
||||
|
||||
public T stop(Date stop) {
|
||||
this.stop = stop;
|
||||
return self();
|
||||
}
|
||||
|
||||
public T serverUsages(Set<SimpleServerUsage> serverUsages) {
|
||||
this.serverUsages = serverUsages;
|
||||
return self();
|
||||
}
|
||||
|
||||
public SimpleTenantUsage build() {
|
||||
return new SimpleTenantUsage(this);
|
||||
}
|
||||
|
||||
|
||||
public T fromSimpleTenantUsage(SimpleTenantUsage in) {
|
||||
return this
|
||||
.totalLocalGbUsage(in.getTotalLocalGbUsage())
|
||||
.totalVcpusUsage(in.getTotalVcpusUsage())
|
||||
.totalMemoryMbUsage(in.getTotalMemoryMbUsage())
|
||||
.totalHours(in.getTotalHours())
|
||||
.start(in.getStart())
|
||||
.stop(in.getStop())
|
||||
.serverUsages(in.getServerUsages())
|
||||
;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
|
||||
@Override
|
||||
protected ConcreteBuilder self() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@SerializedName("tenant_id")
|
||||
private final String tenantId;
|
||||
@SerializedName("total_local_gb_usage")
|
||||
private final double totalLocalGbUsage;
|
||||
@SerializedName("total_vcpus_usage")
|
||||
private final double totalVcpusUsage;
|
||||
@SerializedName("total_memory_mb_usage")
|
||||
private final double totalMemoryMbUsage;
|
||||
@SerializedName("total_hours")
|
||||
private final double totalHours;
|
||||
private final Date start;
|
||||
private final Date stop;
|
||||
@SerializedName("server_usages")
|
||||
private final Set<SimpleServerUsage> serverUsages;
|
||||
|
||||
private SimpleTenantUsage(Builder<?> builder) {
|
||||
this.tenantId = builder.tenantId;
|
||||
this.totalLocalGbUsage = builder.totalLocalGbUsage;
|
||||
this.totalVcpusUsage = builder.totalVcpusUsage;
|
||||
this.totalMemoryMbUsage = builder.totalMemoryMbUsage;
|
||||
this.totalHours = builder.totalHours;
|
||||
this.start = builder.start;
|
||||
this.stop = builder.stop;
|
||||
this.serverUsages = ImmutableSet.copyOf(checkNotNull(builder.serverUsages, "serverUsages"));
|
||||
}
|
||||
|
||||
public String getTenantId() {
|
||||
return tenantId;
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public double getTotalLocalGbUsage() {
|
||||
return this.totalLocalGbUsage;
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public double getTotalVcpusUsage() {
|
||||
return this.totalVcpusUsage;
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public double getTotalMemoryMbUsage() {
|
||||
return this.totalMemoryMbUsage;
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public double getTotalHours() {
|
||||
return this.totalHours;
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
@Nullable
|
||||
public Date getStart() {
|
||||
return this.start;
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
@Nullable
|
||||
public Date getStop() {
|
||||
return this.stop;
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
@Nullable
|
||||
public Set<SimpleServerUsage> getServerUsages() {
|
||||
return serverUsages == null ? ImmutableSet.<SimpleServerUsage>of() : Collections.unmodifiableSet(this.serverUsages);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(totalLocalGbUsage, totalVcpusUsage, totalMemoryMbUsage, totalHours, start, stop, serverUsages);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) return true;
|
||||
if (obj == null || getClass() != obj.getClass()) return false;
|
||||
SimpleTenantUsage that = SimpleTenantUsage.class.cast(obj);
|
||||
return Objects.equal(this.totalLocalGbUsage, that.totalLocalGbUsage)
|
||||
&& Objects.equal(this.totalVcpusUsage, that.totalVcpusUsage)
|
||||
&& Objects.equal(this.totalMemoryMbUsage, that.totalMemoryMbUsage)
|
||||
&& Objects.equal(this.totalHours, that.totalHours)
|
||||
&& Objects.equal(this.start, that.start)
|
||||
&& Objects.equal(this.stop, that.stop)
|
||||
&& Objects.equal(this.serverUsages, that.serverUsages)
|
||||
;
|
||||
}
|
||||
|
||||
protected ToStringHelper string() {
|
||||
return Objects.toStringHelper("")
|
||||
.add("totalLocalGbUsage", totalLocalGbUsage)
|
||||
.add("totalVcpusUsage", totalVcpusUsage)
|
||||
.add("totalMemoryMbUsage", totalMemoryMbUsage)
|
||||
.add("totalHours", totalHours)
|
||||
.add("start", start)
|
||||
.add("stop", stop)
|
||||
.add("serverUsages", serverUsages)
|
||||
;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return string().toString();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,78 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.openstack.nova.v1_1.extensions;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.PathParam;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
|
||||
import org.jclouds.openstack.filters.AuthenticateRequest;
|
||||
import org.jclouds.openstack.nova.v1_1.domain.Host;
|
||||
import org.jclouds.openstack.nova.v1_1.domain.HostResourceUsage;
|
||||
import org.jclouds.openstack.services.Extension;
|
||||
import org.jclouds.openstack.services.ServiceType;
|
||||
import org.jclouds.rest.annotations.ExceptionParser;
|
||||
import org.jclouds.rest.annotations.RequestFilters;
|
||||
import org.jclouds.rest.annotations.SelectJson;
|
||||
import org.jclouds.rest.annotations.SkipEncoding;
|
||||
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
|
||||
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
|
||||
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
/**
|
||||
* Provides asynchronous access to Host Administration features via the REST API.
|
||||
* <p/>
|
||||
*
|
||||
* @author Adam Lowe
|
||||
* @see SimpleTenantUsageClient
|
||||
* @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/nova.api.openstack.compute.contrib.hosts.html" />
|
||||
*/
|
||||
@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.HOSTS)
|
||||
@SkipEncoding({'/', '='})
|
||||
@RequestFilters(AuthenticateRequest.class)
|
||||
public interface HostAdministrationAsyncClient {
|
||||
|
||||
/**
|
||||
* @see HostAdministrationClient#listHosts()
|
||||
*/
|
||||
@GET
|
||||
@Path("/os-hosts")
|
||||
@SelectJson("hosts")
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
|
||||
ListenableFuture<Set<Host>> listHosts();
|
||||
|
||||
/**
|
||||
* @see HostAdministrationClient#getHostResourceUsage(String)
|
||||
*/
|
||||
@GET
|
||||
@Path("/os-hosts/{id}")
|
||||
@SelectJson("host")
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<Set<HostResourceUsage>> getHostResourceUsage(@PathParam("id") String hostId);
|
||||
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.openstack.nova.v1_1.extensions;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import javax.ws.rs.PathParam;
|
||||
|
||||
import org.jclouds.concurrent.Timeout;
|
||||
import org.jclouds.openstack.nova.v1_1.domain.Host;
|
||||
import org.jclouds.openstack.nova.v1_1.domain.HostResourceUsage;
|
||||
import org.jclouds.openstack.services.Extension;
|
||||
import org.jclouds.openstack.services.ServiceType;
|
||||
|
||||
/**
|
||||
* Provides asynchronous access to Host Administration features via the REST API.
|
||||
* <p/>
|
||||
* TODO reboot, shutdown, startup, update
|
||||
*
|
||||
* @author Adam Lowe
|
||||
* @see HostAdministrationAsyncClient
|
||||
*/
|
||||
@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.HOSTS)
|
||||
@Timeout(duration = 180, timeUnit = TimeUnit.SECONDS)
|
||||
public interface HostAdministrationClient {
|
||||
|
||||
/**
|
||||
* Returns the list of hosts
|
||||
* @return the usage information
|
||||
*/
|
||||
Set<Host> listHosts();
|
||||
|
||||
/**
|
||||
* Retrieves the physical/usage resource on a specific host
|
||||
* @return the usage information
|
||||
*/
|
||||
Set<HostResourceUsage> getHostResourceUsage(@PathParam("id") String hostId);
|
||||
|
||||
}
|
|
@ -0,0 +1,77 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.openstack.nova.v1_1.extensions;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.PathParam;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
|
||||
import org.jclouds.openstack.filters.AuthenticateRequest;
|
||||
import org.jclouds.openstack.nova.v1_1.domain.SimpleTenantUsage;
|
||||
import org.jclouds.openstack.services.Extension;
|
||||
import org.jclouds.openstack.services.ServiceType;
|
||||
import org.jclouds.rest.annotations.ExceptionParser;
|
||||
import org.jclouds.rest.annotations.RequestFilters;
|
||||
import org.jclouds.rest.annotations.SelectJson;
|
||||
import org.jclouds.rest.annotations.SkipEncoding;
|
||||
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
|
||||
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
|
||||
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
/**
|
||||
* Provides asynchronous access to Simple Tenant Usage via the REST API.
|
||||
* <p/>
|
||||
*
|
||||
* @author Adam Lowe
|
||||
* @see SimpleTenantUsageClient
|
||||
* @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/nova.api.openstack.compute.contrib.simple_tenant_usage.html" />
|
||||
*/
|
||||
@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.SIMPLE_TENANT_USAGE)
|
||||
@SkipEncoding({'/', '='})
|
||||
@RequestFilters(AuthenticateRequest.class)
|
||||
public interface SimpleTenantUsageAsyncClient {
|
||||
|
||||
/**
|
||||
* @see SimpleTenantUsageClient#listTenantUsages()
|
||||
*/
|
||||
@GET
|
||||
@Path("/os-simple-tenant-usage")
|
||||
@SelectJson("tenant_usages")
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
|
||||
ListenableFuture<Set<SimpleTenantUsage>> listTenantUsages();
|
||||
|
||||
/**
|
||||
* @see SimpleTenantUsageClient#getTenantUsage(String)
|
||||
*/
|
||||
@GET
|
||||
@Path("/os-simple-tenant-usage/{id}")
|
||||
@SelectJson("tenant_usage")
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<SimpleTenantUsage> getTenantUsage(@PathParam("id") String tenantId);
|
||||
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.openstack.nova.v1_1.extensions;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.jclouds.concurrent.Timeout;
|
||||
import org.jclouds.openstack.nova.v1_1.domain.SimpleTenantUsage;
|
||||
import org.jclouds.openstack.services.Extension;
|
||||
import org.jclouds.openstack.services.ServiceType;
|
||||
|
||||
/**
|
||||
* Provides asynchronous access to Simple Tenant Usage via the REST API.
|
||||
* <p/>
|
||||
*
|
||||
* @author Adam Lowe
|
||||
* @see SimpleTenantUsageAsyncClient
|
||||
*/
|
||||
@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.SIMPLE_TENANT_USAGE)
|
||||
@Timeout(duration = 180, timeUnit = TimeUnit.SECONDS)
|
||||
public interface SimpleTenantUsageClient {
|
||||
|
||||
/**
|
||||
* Retrive tenant_usage for all tenants
|
||||
*
|
||||
* @return the set of TenantUsage reports
|
||||
*/
|
||||
Set<SimpleTenantUsage> listTenantUsages();
|
||||
|
||||
/**
|
||||
* Retrive tenant_usage for a specified tenant
|
||||
*
|
||||
* @return the requested tenant usage
|
||||
*/
|
||||
SimpleTenantUsage getTenantUsage(String tenantId);
|
||||
}
|
|
@ -43,7 +43,7 @@ import com.google.common.collect.Multimap;
|
|||
/**
|
||||
* We use the annotation {@link org.jclouds.openstack.services.Extension} to
|
||||
* bind a class that is an extension to an extension found in the
|
||||
* {@link ExtensionsClient#listExtensions} call.
|
||||
* {@link org.jclouds.openstack.nova.v1_1.features.ExtensionClient#listExtensions} call.
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*
|
||||
|
@ -62,6 +62,10 @@ public class PresentWhenExtensionAnnotationNamespaceEqualsAnyNamespaceInExtensio
|
|||
URI.create("http://docs.openstack.org/compute/ext/floating_ips/api/v1.1"))
|
||||
.put(URI.create(ExtensionNamespaces.KEYPAIRS),
|
||||
URI.create("http://docs.openstack.org/compute/ext/keypairs/api/v1.1"))
|
||||
.put(URI.create(ExtensionNamespaces.SIMPLE_TENANT_USAGE),
|
||||
URI.create("http://docs.openstack.org/compute/ext/os-simple-tenant-usage/api/v1.1"))
|
||||
.put(URI.create(ExtensionNamespaces.HOSTS),
|
||||
URI.create("http://docs.openstack.org/compute/ext/hosts/api/v1.1"))
|
||||
.build();
|
||||
|
||||
@Inject
|
||||
|
|
|
@ -0,0 +1,84 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.openstack.nova.v1_1.extensions;
|
||||
|
||||
import static org.testng.Assert.assertEquals;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.ws.rs.core.MediaType;
|
||||
|
||||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.HttpResponse;
|
||||
import org.jclouds.openstack.nova.v1_1.domain.Host;
|
||||
import org.jclouds.openstack.nova.v1_1.domain.HostResourceUsage;
|
||||
import org.jclouds.openstack.nova.v1_1.internal.BaseNovaClientExpectTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.ImmutableMultimap;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Iterables;
|
||||
|
||||
/**
|
||||
* Tests HostAdministrationClient guice wiring and parsing
|
||||
*
|
||||
* @author Adam Lowe
|
||||
*/
|
||||
@Test(groups = "unit", testName = "HostAdministrationClientExpectTest")
|
||||
public class HostAdministrationClientExpectTest extends BaseNovaClientExpectTest {
|
||||
|
||||
|
||||
public void testList() throws Exception {
|
||||
URI endpoint = URI.create("https://compute.north.host/v1.1/3456/os-hosts");
|
||||
HostAdministrationClient client = requestsSendResponses(keystoneAuthWithUsernameAndPassword,
|
||||
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
|
||||
HttpRequest.builder().method("GET").headers(ImmutableMultimap.of("Accept", MediaType.APPLICATION_JSON, "X-Auth-Token", authToken))
|
||||
.endpoint(endpoint).build(),
|
||||
HttpResponse.builder().statusCode(200).payload(payloadFromResource("/hosts_list.json")).build()).getHostAdministrationExtensionForZone("az-1.region-a.geo-1").get();
|
||||
|
||||
Host expected = Host.builder().name("ubuntu").service("compute").build();
|
||||
|
||||
Set<Host> result = client.listHosts();
|
||||
Host host = Iterables.getOnlyElement(result);
|
||||
assertEquals(host.getName(), "ubuntu");
|
||||
assertEquals(host.getService(), "compute");
|
||||
|
||||
assertEquals(host, expected);
|
||||
}
|
||||
|
||||
public void testGet() throws Exception {
|
||||
URI endpoint = URI.create("https://compute.north.host/v1.1/3456/os-hosts/xyz");
|
||||
HostAdministrationClient client = requestsSendResponses(keystoneAuthWithUsernameAndPassword,
|
||||
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
|
||||
HttpRequest.builder().method("GET").headers(ImmutableMultimap.of("Accept", MediaType.APPLICATION_JSON, "X-Auth-Token", authToken))
|
||||
.endpoint(endpoint).build(),
|
||||
HttpResponse.builder().statusCode(200).payload(payloadFromResource("/host.json")).build()).getHostAdministrationExtensionForZone("az-1.region-a.geo-1").get();
|
||||
|
||||
Set<HostResourceUsage> expected = ImmutableSet.of(
|
||||
HostResourceUsage.builder().memoryMb(16083).project("(total)").cpu(4).diskGb(181).host("ubuntu").build(),
|
||||
HostResourceUsage.builder().memoryMb(3396).project("(used_now)").cpu(3).diskGb(5).host("ubuntu").build(),
|
||||
HostResourceUsage.builder().memoryMb(6144).project("(used_max)").cpu(3).diskGb(80).host("ubuntu").build(),
|
||||
HostResourceUsage.builder().memoryMb(6144).project("f8535069c3fb404cb61c873b1a0b4921").cpu(3).diskGb(80).host("ubuntu").build()
|
||||
);
|
||||
|
||||
assertEquals(client.getHostResourceUsage("xyz"), expected);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.openstack.nova.v1_1.extensions;
|
||||
|
||||
import static org.testng.Assert.assertEquals;
|
||||
import static org.testng.Assert.assertNotNull;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import org.jclouds.openstack.nova.v1_1.domain.Host;
|
||||
import org.jclouds.openstack.nova.v1_1.domain.HostResourceUsage;
|
||||
import org.jclouds.openstack.nova.v1_1.internal.BaseNovaClientLiveTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
/**
|
||||
* Tests behavior of HostAdministrationClient
|
||||
*
|
||||
* @author Adam Lowe
|
||||
*/
|
||||
@Test(groups = "live", testName = "HostAdministrationClientLiveTest")
|
||||
public class HostAdministrationClientLiveTest extends BaseNovaClientLiveTest {
|
||||
|
||||
public void testListAndGet() throws Exception {
|
||||
for (String zoneId : novaContext.getApi().getConfiguredZones()) {
|
||||
Optional<HostAdministrationClient> optClient = novaContext.getApi().getHostAdministrationExtensionForZone(zoneId);
|
||||
if (optClient.isPresent() && identity.endsWith(":admin")) {
|
||||
HostAdministrationClient client = optClient.get();
|
||||
Set<Host> hosts = client.listHosts();
|
||||
assertNotNull(hosts);
|
||||
for(Host host : hosts) {
|
||||
for (HostResourceUsage usage : client.getHostResourceUsage(host.getName())) {
|
||||
assertEquals(usage.getHost(), host.getName());
|
||||
assertNotNull(usage);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,100 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.openstack.nova.v1_1.extensions;
|
||||
|
||||
import static org.testng.Assert.assertEquals;
|
||||
import static org.testng.Assert.assertNotNull;
|
||||
import static org.testng.Assert.assertTrue;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.ws.rs.core.MediaType;
|
||||
|
||||
import org.jclouds.date.DateService;
|
||||
import org.jclouds.date.internal.SimpleDateFormatDateService;
|
||||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.HttpResponse;
|
||||
import org.jclouds.openstack.nova.v1_1.domain.SimpleServerUsage;
|
||||
import org.jclouds.openstack.nova.v1_1.domain.SimpleTenantUsage;
|
||||
import org.jclouds.openstack.nova.v1_1.internal.BaseNovaClientExpectTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.ImmutableMultimap;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Iterables;
|
||||
|
||||
/**
|
||||
* Tests SimpleTenantUsageClient guice wiring and parsing
|
||||
*
|
||||
* @author Adam Lowe
|
||||
*/
|
||||
@Test(groups = "unit", testName = "SimpleTenantUsageClientExpectTest")
|
||||
public class SimpleTenantUsageClientExpectTest extends BaseNovaClientExpectTest {
|
||||
private DateService dateService = new SimpleDateFormatDateService();
|
||||
|
||||
public void testList() throws Exception {
|
||||
URI endpoint = URI.create("https://compute.north.host/v1.1/3456/os-simple-tenant-usage");
|
||||
SimpleTenantUsageClient client = requestsSendResponses(keystoneAuthWithUsernameAndPassword,
|
||||
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
|
||||
HttpRequest.builder().method("GET").headers(ImmutableMultimap.of("Accept", MediaType.APPLICATION_JSON, "X-Auth-Token", authToken))
|
||||
.endpoint(endpoint).build(),
|
||||
HttpResponse.builder().statusCode(200)
|
||||
.payload(payloadFromResource("/simple_tenant_usages.json")).build())
|
||||
.getSimpleTenantUsageExtensionForZone("az-1.region-a.geo-1").get();
|
||||
|
||||
Set<SimpleTenantUsage> results = client.listTenantUsages();
|
||||
|
||||
SimpleTenantUsage usage = Iterables.getOnlyElement(results);
|
||||
assertEquals(usage.getTenantId(), "f8535069c3fb404cb61c873b1a0b4921");
|
||||
assertEquals(usage.getTotalHours(), 4.888888888888889e-07);
|
||||
assertEquals(usage.getTotalLocalGbUsage(), 1.9555555555555557e-05);
|
||||
assertEquals(usage.getTotalMemoryMbUsage(), 0.0015018666666666667);
|
||||
assertEquals(usage.getTotalVcpusUsage(), 7.333333333333333e-07);
|
||||
assertEquals(usage.getStart(), dateService.iso8601DateParse("2012-04-18 12:18:39.702411"));
|
||||
assertEquals(usage.getStop(), dateService.iso8601DateParse("2012-04-18 12:18:39.702499"));
|
||||
assertNotNull(usage.getServerUsages());
|
||||
assertTrue(usage.getServerUsages().isEmpty());
|
||||
}
|
||||
|
||||
public void testGet() throws Exception {
|
||||
URI endpoint = URI.create("https://compute.north.host/v1.1/3456/os-simple-tenant-usage/test-1234");
|
||||
SimpleTenantUsageClient client = requestsSendResponses(keystoneAuthWithUsernameAndPassword,
|
||||
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
|
||||
HttpRequest.builder().method("GET").headers(ImmutableMultimap.of("Accept", MediaType.APPLICATION_JSON, "X-Auth-Token", authToken))
|
||||
.endpoint(endpoint).build(),
|
||||
HttpResponse.builder().statusCode(200)
|
||||
.payload(payloadFromResource("/simple_tenant_usage.json")).build())
|
||||
.getSimpleTenantUsageExtensionForZone("az-1.region-a.geo-1").get();
|
||||
|
||||
SimpleTenantUsage usage = client.getTenantUsage("test-1234");
|
||||
assertEquals(usage.getTenantId(), "f8535069c3fb404cb61c873b1a0b4921");
|
||||
|
||||
SimpleTenantUsage expected = SimpleTenantUsage.builder().totalHours(4.833333333333333E-7).totalLocalGbUsage(1.933333333333333E-05)
|
||||
.start(dateService.iso8601DateParse("2012-04-18 13:32:07.255743")).stop(dateService.iso8601DateParse("2012-04-18 13:32:07.255743"))
|
||||
.totalMemoryMbUsage(0.0014847999999999999).totalVcpusUsage(7.249999999999999E-07).serverUsages(
|
||||
ImmutableSet.of(
|
||||
SimpleServerUsage.builder().hours(2.4166666666666665e-07).uptime(91149).flavorLocalGb(50).instanceName("test1").tenantId("f8535069c3fb404cb61c873b1a0b4921").flavorVcpus(2).flavorMemoryMb(4096).instanceStatus(SimpleServerUsage.Status.ACTIVE).flavorName("m1.medium").instanceCreated(this.dateService.iso8601SecondsDateParse("2012-04-17T12:12:58")).build(),
|
||||
SimpleServerUsage.builder().hours(2.4166666666666665e-07).uptime(84710).flavorLocalGb(30).instanceName("mish_test").tenantId("f8535069c3fb404cb61c873b1a0b4921").flavorVcpus(1).flavorMemoryMb(2048).instanceStatus(SimpleServerUsage.Status.ACTIVE).flavorName("m1.small").instanceCreated(this.dateService.iso8601SecondsDateParse("2012-04-17T14:00:17")).build()
|
||||
)).build();
|
||||
|
||||
assertEquals(usage, expected);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.openstack.nova.v1_1.extensions;
|
||||
|
||||
import static org.testng.Assert.assertNotNull;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import org.jclouds.openstack.nova.v1_1.domain.SimpleTenantUsage;
|
||||
import org.jclouds.openstack.nova.v1_1.internal.BaseNovaClientLiveTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
/**
|
||||
* Tests behavior of SimpleTenantUsageClient
|
||||
*
|
||||
* @author Adam Lowe
|
||||
*/
|
||||
@Test(groups = "live", testName = "SimpleTenantUsageClientLiveTest")
|
||||
public class SimpleTenantUsageClientLiveTest extends BaseNovaClientLiveTest {
|
||||
|
||||
public void testList() throws Exception {
|
||||
for (String zoneId : novaContext.getApi().getConfiguredZones()) {
|
||||
Optional<SimpleTenantUsageClient> optClient = novaContext.getApi().getSimpleTenantUsageExtensionForZone(zoneId);
|
||||
if (optClient.isPresent() && identity.endsWith(":admin")) {
|
||||
SimpleTenantUsageClient client = optClient.get();
|
||||
Set<SimpleTenantUsage> usages = client.listTenantUsages();
|
||||
assertNotNull(usages);
|
||||
for (SimpleTenantUsage usage : usages) {
|
||||
SimpleTenantUsage details = client.getTenantUsage(usage.getTenantId());
|
||||
assertNotNull(details);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -123,17 +123,25 @@ public class PresentWhenExtensionAnnotationNamespaceEqualsAnyNamespaceInExtensio
|
|||
CacheLoader.from(Functions.forMap(ImmutableMap.of("expectedzone", extensions, "differentzone",
|
||||
ImmutableSet.<Extension> of()))));
|
||||
|
||||
PresentWhenExtensionAnnotationNamespaceEqualsAnyNamespaceInExtensionsSet fn = Guice.createInjector(new AbstractModule() {
|
||||
@Override
|
||||
protected void configure() {}
|
||||
PresentWhenExtensionAnnotationNamespaceEqualsAnyNamespaceInExtensionsSet fn = Guice.createInjector(
|
||||
new AbstractModule() {
|
||||
@Override
|
||||
protected void configure() {
|
||||
}
|
||||
|
||||
@Provides
|
||||
LoadingCache<String, Set<Extension>> getExtensions() { return extensionsForZone;}
|
||||
@SuppressWarnings("unused")
|
||||
@Provides
|
||||
LoadingCache<String, Set<Extension>> getExtensions() {
|
||||
return extensionsForZone;
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Named("openstack.nova.extensions")
|
||||
Multimap<URI, URI> getAliases() { return aliases;}
|
||||
}).getInstance(PresentWhenExtensionAnnotationNamespaceEqualsAnyNamespaceInExtensionsSet.class);
|
||||
@SuppressWarnings("unused")
|
||||
@Provides
|
||||
@Named("openstack.nova.extensions")
|
||||
Multimap<URI, URI> getAliases() {
|
||||
return aliases;
|
||||
}
|
||||
}).getInstance(PresentWhenExtensionAnnotationNamespaceEqualsAnyNamespaceInExtensionsSet.class);
|
||||
|
||||
return fn;
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ public class BaseNovaClientLiveTest extends BaseComputeServiceContextLiveTest {
|
|||
@Override
|
||||
public void setupContext() {
|
||||
super.setupContext();
|
||||
novaContext = context.unwrap();
|
||||
novaContext = view.unwrap();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -63,7 +63,7 @@ public class BaseNovaExpectTest<T> extends BaseRestClientExpectTest<T> {
|
|||
.put("X-Auth-Token", authToken).build()).build();
|
||||
|
||||
extensionsOfNovaResponse = HttpResponse.builder().statusCode(200)
|
||||
.payload(payloadFromResource("/extension_list_normal.json")).build();
|
||||
.payload(payloadFromResource("/extension_list_full.json")).build();
|
||||
|
||||
unmatchedExtensionsOfNovaResponse = HttpResponse.builder().statusCode(200)
|
||||
.payload(payloadFromResource("/extension_list.json")).build();
|
||||
|
|
|
@ -25,7 +25,7 @@ import java.util.Set;
|
|||
import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
|
||||
import org.jclouds.json.BaseParserTest;
|
||||
import org.jclouds.json.BaseItemParserTest;
|
||||
import org.jclouds.json.config.GsonModule;
|
||||
import org.jclouds.openstack.nova.v1_1.config.NovaParserModule;
|
||||
import org.jclouds.openstack.nova.v1_1.domain.KeyPair;
|
||||
|
@ -41,7 +41,7 @@ import com.google.inject.Injector;
|
|||
* @author Michael Arnold
|
||||
*/
|
||||
@Test(groups = "unit", testName = "ParseKeyPairListTest")
|
||||
public class ParseKeyPairListTest extends BaseParserTest {
|
||||
public class ParseKeyPairListTest extends BaseItemParserTest<Set<Map<String, KeyPair>>> {
|
||||
|
||||
@Override
|
||||
public String resource() {
|
||||
|
|
|
@ -0,0 +1,123 @@
|
|||
{
|
||||
"extensions": [{
|
||||
"updated": "2011-06-09T00:00:00+00:00",
|
||||
"name": "Multinic",
|
||||
"links": [],
|
||||
"namespace": "https://docs.openstack.org/ext/multinic/api/v1.1",
|
||||
"alias": "NMN",
|
||||
"description": "Multiple network support"
|
||||
}, {
|
||||
"updated": "2011-06-29T00:00:00+00:00",
|
||||
"name": "Hosts",
|
||||
"links": [],
|
||||
"namespace": "https://docs.openstack.org/ext/hosts/api/v1.1",
|
||||
"alias": "os-hosts",
|
||||
"description": "Host administration"
|
||||
}, {
|
||||
"updated": "2011-03-25T00:00:00+00:00",
|
||||
"name": "Volumes",
|
||||
"links": [],
|
||||
"namespace": "https://docs.openstack.org/ext/volumes/api/v1.1",
|
||||
"alias": "os-volumes",
|
||||
"description": "Volumes support"
|
||||
}, {
|
||||
"updated": "2011-05-25 16:12:21.656723",
|
||||
"name": "Admin Controller",
|
||||
"links": [],
|
||||
"namespace": "https:TODO/",
|
||||
"alias": "ADMIN",
|
||||
"description": "The Admin API Extension"
|
||||
}, {
|
||||
"updated": "2011-08-08T00:00:00+00:00",
|
||||
"name": "Quotas",
|
||||
"links": [],
|
||||
"namespace": "https://docs.openstack.org/ext/quotas-sets/api/v1.1",
|
||||
"alias": "os-quota-sets",
|
||||
"description": "Quotas management support"
|
||||
}, {
|
||||
"updated": "2011-08-24T00:00:00+00:00",
|
||||
"name": "VolumeTypes",
|
||||
"links": [],
|
||||
"namespace": "https://docs.openstack.org/ext/volume_types/api/v1.1",
|
||||
"alias": "os-volume-types",
|
||||
"description": "Volume types support"
|
||||
}, {
|
||||
"updated": "2011-06-23T00:00:00+00:00",
|
||||
"name": "FlavorExtraSpecs",
|
||||
"links": [],
|
||||
"namespace": "https://docs.openstack.org/ext/flavor_extra_specs/api/v1.1",
|
||||
"alias": "os-flavor-extra-specs",
|
||||
"description": "Instance type (flavor) extra specs"
|
||||
}, {
|
||||
"updated": "2011-09-14T00:00:00+00:00",
|
||||
"name": "FlavorExtraData",
|
||||
"links": [],
|
||||
"namespace": "https://docs.openstack.org/ext/flavor_extra_data/api/v1.1",
|
||||
"alias": "os-flavor-extra-data",
|
||||
"description": "Provide additional data for flavors"
|
||||
}, {
|
||||
"updated": "2011-08-17T00:00:00+00:00",
|
||||
"name": "VirtualInterfaces",
|
||||
"links": [],
|
||||
"namespace": "https://docs.openstack.org/ext/virtual_interfaces/api/v1.1",
|
||||
"alias": "virtual_interfaces",
|
||||
"description": "Virtual interface support"
|
||||
}, {
|
||||
"updated": "2011-07-19T00:00:00+00:00",
|
||||
"name": "Createserverext",
|
||||
"links": [],
|
||||
"namespace": "https://docs.openstack.org/ext/createserverext/api/v1.1",
|
||||
"alias": "os-create-server-ext",
|
||||
"description": "Extended support to the Create Server v1.1 API"
|
||||
}, {
|
||||
"updated": "2011-08-08T00:00:00+00:00",
|
||||
"name": "Keypairs",
|
||||
"links": [],
|
||||
"namespace": "https://docs.openstack.org/ext/keypairs/api/v1.1",
|
||||
"alias": "os-keypairs",
|
||||
"description": "Keypair Support"
|
||||
}, {
|
||||
"updated": "2011-08-25T00:00:00+00:00",
|
||||
"name": "VSAs",
|
||||
"links": [],
|
||||
"namespace": "https://docs.openstack.org/ext/vsa/api/v1.1",
|
||||
"alias": "zadr-vsa",
|
||||
"description": "Virtual Storage Arrays support"
|
||||
}, {
|
||||
"updated": "2011-08-19T00:00:00+00:00",
|
||||
"name": "SimpleTenantUsage",
|
||||
"links": [],
|
||||
"namespace": "https://docs.openstack.org/ext/os-simple-tenant-usage/api/v1.1",
|
||||
"alias": "os-simple-tenant-usage",
|
||||
"description": "Simple tenant usage extension"
|
||||
}, {
|
||||
"updated": "2011-08-18T00:00:00+00:00",
|
||||
"name": "Rescue",
|
||||
"links": [],
|
||||
"namespace": "https://docs.openstack.org/ext/rescue/api/v1.1",
|
||||
"alias": "os-rescue",
|
||||
"description": "Instance rescue mode"
|
||||
}, {
|
||||
"updated": "2011-07-21T00:00:00+00:00",
|
||||
"name": "SecurityGroups",
|
||||
"links": [],
|
||||
"namespace": "https://docs.openstack.org/ext/securitygroups/api/v1.1",
|
||||
"alias": "security_groups",
|
||||
"description": "Security group support"
|
||||
}, {
|
||||
"updated": "2011-06-16T00:00:00+00:00",
|
||||
"name": "Floating_ips",
|
||||
"links": [],
|
||||
"namespace": "https://docs.openstack.org/ext/floating_ips/api/v1.1",
|
||||
"alias": "os-floating-ips",
|
||||
"description": "Floating IPs support"
|
||||
}, {
|
||||
"updated": "2011-06-16T00:00:00+00:00",
|
||||
"name": "Users",
|
||||
"links": [],
|
||||
"namespace": "http://docs.openstack.org/compute/ext/users/api/v1.1",
|
||||
"alias": "os-users",
|
||||
"description": "Users support"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
{"host": [{"resource": {"project": "(total)", "memory_mb": 16083, "host": "ubuntu", "cpu": 4, "disk_gb": 181}}, {"resource": {"project": "(used_now)", "memory_mb": 3396, "host": "ubuntu", "cpu": 3, "disk_gb": 5}}, {"resource": {"project": "(used_max)", "memory_mb": 6144, "host": "ubuntu", "cpu": 3, "disk_gb": 80}}, {"resource": {"project": "f8535069c3fb404cb61c873b1a0b4921", "memory_mb": 6144, "host": "ubuntu", "cpu": 3, "disk_gb": 80}}]}
|
|
@ -0,0 +1 @@
|
|||
{"hosts": [{"host_name": "ubuntu", "service": "compute"}]}
|
|
@ -0,0 +1 @@
|
|||
{"tenant_usage": {"total_memory_mb_usage": 0.0014847999999999999, "total_vcpus_usage": 7.249999999999999e-07, "total_hours": 4.833333333333333e-07, "tenant_id": "f8535069c3fb404cb61c873b1a0b4921", "stop": "2012-04-18 13:32:07.255830", "server_usages": [{"hours": 2.4166666666666665e-07, "uptime": 91149, "local_gb": 50, "ended_at": null, "name": "test1", "tenant_id": "f8535069c3fb404cb61c873b1a0b4921", "vcpus": 2, "memory_mb": 4096, "state": "active", "flavor": "m1.medium", "started_at": "2012-04-17 12:12:58"}, {"hours": 2.4166666666666665e-07, "uptime": 84710, "local_gb": 30, "ended_at": null, "name": "mish_test", "tenant_id": "f8535069c3fb404cb61c873b1a0b4921", "vcpus": 1, "memory_mb": 2048, "state": "active", "flavor": "m1.small", "started_at": "2012-04-17 14:00:17"}], "start": "2012-04-18 13:32:07.255743", "total_local_gb_usage": 1.933333333333333e-05}}
|
|
@ -0,0 +1 @@
|
|||
{"tenant_usages": [{"total_memory_mb_usage": 0.0015018666666666667, "total_vcpus_usage": 7.333333333333333e-07, "start": "2012-04-18 12:18:39.702411", "tenant_id": "f8535069c3fb404cb61c873b1a0b4921", "stop": "2012-04-18 12:18:39.702499", "total_hours": 4.888888888888889e-07, "total_local_gb_usage": 1.9555555555555557e-05}]
|
|
@ -108,7 +108,7 @@ public class S3ApiMetadata extends BaseRestApiMetadata {
|
|||
.version(S3AsyncClient.VERSION)
|
||||
.defaultProperties(S3ApiMetadata.defaultProperties())
|
||||
.context(CONTEXT_TOKEN)
|
||||
.wrapper(TypeToken.of(S3BlobStoreContext.class))
|
||||
.view(TypeToken.of(S3BlobStoreContext.class))
|
||||
.defaultModules(ImmutableSet.<Class<? extends Module>>of(S3RestClientModule.class, S3BlobStoreContextModule.class));
|
||||
}
|
||||
|
||||
|
|
|
@ -95,7 +95,7 @@ import com.google.inject.Provides;
|
|||
* Provides asynchronous access to S3 via their REST API.
|
||||
* <p/>
|
||||
* All commands return a ListenableFuture of the result from S3. Any exceptions incurred during
|
||||
* processing will be wrapped in an {@link ExecutionException} as documented in
|
||||
* processing will be backend in an {@link ExecutionException} as documented in
|
||||
* {@link ListenableFuture#get()}.
|
||||
*
|
||||
* @author Adrian Cole
|
||||
|
|
|
@ -44,7 +44,7 @@ import com.google.inject.Provides;
|
|||
* Provides access to S3 via their REST API.
|
||||
* <p/>
|
||||
* All commands return a Future of the result from S3. Any exceptions incurred during
|
||||
* processing will be wrapped in an {@link ExecutionException} as documented in
|
||||
* processing will be backend in an {@link ExecutionException} as documented in
|
||||
* {@link Future#get()}.
|
||||
*
|
||||
* @author Adrian Cole
|
||||
|
|
|
@ -18,11 +18,10 @@
|
|||
*/
|
||||
package org.jclouds.s3.blobstore.internal;
|
||||
|
||||
import java.io.Closeable;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import org.jclouds.Context;
|
||||
import org.jclouds.blobstore.AsyncBlobStore;
|
||||
import org.jclouds.blobstore.BlobMap;
|
||||
import org.jclouds.blobstore.BlobRequestSigner;
|
||||
|
@ -45,11 +44,11 @@ import com.google.common.reflect.TypeToken;
|
|||
public class S3BlobStoreContextImpl extends BlobStoreContextImpl implements S3BlobStoreContext {
|
||||
|
||||
@Inject
|
||||
public S3BlobStoreContextImpl(@Provider Closeable wrapped, @Provider TypeToken<? extends Closeable> wrappedType,
|
||||
public S3BlobStoreContextImpl(@Provider Context backend, @Provider TypeToken<? extends Context> backendType,
|
||||
BlobMap.Factory blobMapFactory, Utils utils, ConsistencyModel consistencyModel,
|
||||
InputStreamMap.Factory inputStreamMapFactory, AsyncBlobStore ablobStore, BlobStore blobStore,
|
||||
BlobRequestSigner blobRequestSigner) {
|
||||
super(wrapped, wrappedType, blobMapFactory, utils, consistencyModel, inputStreamMapFactory, ablobStore,
|
||||
super(backend, backendType, blobMapFactory, utils, consistencyModel, inputStreamMapFactory, ablobStore,
|
||||
blobStore, blobRequestSigner);
|
||||
}
|
||||
|
||||
|
|
|
@ -21,8 +21,6 @@ package org.jclouds.s3.filters;
|
|||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
import static com.google.common.collect.Iterables.any;
|
||||
import static com.google.common.collect.Iterables.get;
|
||||
import static org.jclouds.Constants.PROPERTY_CREDENTIAL;
|
||||
import static org.jclouds.Constants.PROPERTY_IDENTITY;
|
||||
import static org.jclouds.aws.reference.AWSConstants.PROPERTY_AUTH_TAG;
|
||||
import static org.jclouds.aws.reference.AWSConstants.PROPERTY_HEADER_TAG;
|
||||
import static org.jclouds.http.utils.ModifyRequest.parseQueryToMap;
|
||||
|
@ -35,8 +33,8 @@ import java.lang.annotation.Annotation;
|
|||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Locale;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.inject.Inject;
|
||||
|
@ -57,6 +55,8 @@ import org.jclouds.http.internal.SignatureWire;
|
|||
import org.jclouds.io.InputSuppliers;
|
||||
import org.jclouds.logging.Logger;
|
||||
import org.jclouds.rest.RequestSigner;
|
||||
import org.jclouds.rest.annotations.Credential;
|
||||
import org.jclouds.rest.annotations.Identity;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.jclouds.s3.Bucket;
|
||||
|
||||
|
@ -114,7 +114,7 @@ public class RequestAuthorizeSignature implements HttpRequestFilter, RequestSign
|
|||
public RequestAuthorizeSignature(SignatureWire signatureWire, @Named(PROPERTY_AUTH_TAG) String authTag,
|
||||
@Named(PROPERTY_S3_VIRTUAL_HOST_BUCKETS) boolean isVhostStyle,
|
||||
@Named(PROPERTY_S3_SERVICE_PATH) String servicePath, @Named(PROPERTY_HEADER_TAG) String headerTag,
|
||||
@Named(PROPERTY_IDENTITY) String accessKey, @Named(PROPERTY_CREDENTIAL) String secretKey,
|
||||
@Identity String accessKey, @Credential String secretKey,
|
||||
@TimeStamp Provider<String> timeStampProvider, Crypto crypto, HttpUtils utils) {
|
||||
this.isVhostStyle = isVhostStyle;
|
||||
this.servicePath = servicePath;
|
||||
|
|
|
@ -68,7 +68,7 @@ public class S3ClientLiveTest extends BaseBlobStoreIntegrationTest {
|
|||
}
|
||||
|
||||
public S3Client getApi() {
|
||||
return context.unwrap(S3ApiMetadata.CONTEXT_TOKEN).getApi();
|
||||
return view.unwrap(S3ApiMetadata.CONTEXT_TOKEN).getApi();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue