mirror of https://github.com/apache/jclouds.git
Issue 176: remove interim vcloud express support
This commit is contained in:
parent
e8d07a9e91
commit
4c0fc5d0e0
|
@ -83,9 +83,6 @@ cloudservers.propertiesbuilder=org.jclouds.rackspace.RackspacePropertiesBuilder
|
||||||
bluelock-vclouddirector.contextbuilder=org.jclouds.vcloud.bluelock.BlueLockVCloudDirectorContextBuilder
|
bluelock-vclouddirector.contextbuilder=org.jclouds.vcloud.bluelock.BlueLockVCloudDirectorContextBuilder
|
||||||
bluelock-vclouddirector.propertiesbuilder=org.jclouds.vcloud.bluelock.BlueLockVCloudDirectorPropertiesBuilder
|
bluelock-vclouddirector.propertiesbuilder=org.jclouds.vcloud.bluelock.BlueLockVCloudDirectorPropertiesBuilder
|
||||||
|
|
||||||
bluelock-vcloudexpress.contextbuilder=org.jclouds.vcloud.bluelock.BlueLockVCloudExpressContextBuilder
|
|
||||||
bluelock-vcloudexpress.propertiesbuilder=org.jclouds.vcloud.bluelock.BlueLockVCloudExpressPropertiesBuilder
|
|
||||||
|
|
||||||
gogrid.propertiesbuilder=org.jclouds.gogrid.GoGridPropertiesBuilder
|
gogrid.propertiesbuilder=org.jclouds.gogrid.GoGridPropertiesBuilder
|
||||||
gogrid.contextbuilder=org.jclouds.gogrid.GoGridContextBuilder
|
gogrid.contextbuilder=org.jclouds.gogrid.GoGridContextBuilder
|
||||||
|
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
provider=bluelock-vcloudexpress
|
|
||||||
driver=bluelock
|
|
||||||
identity=user@youregistered.com
|
|
||||||
credential=password
|
|
||||||
tag=name_of_your_vapp
|
|
|
@ -1,5 +0,0 @@
|
||||||
provider=ibmdev
|
|
||||||
driver=ibmdev
|
|
||||||
identity=user@youregistered.com
|
|
||||||
credential=password
|
|
||||||
tag=name_of_your_server
|
|
|
@ -38,7 +38,7 @@
|
||||||
|
|
||||||
<input
|
<input
|
||||||
message="Which provider would you like to use (ec2, cloudservers, vcloud, terremark, rimuhosting)?"
|
message="Which provider would you like to use (ec2, cloudservers, vcloud, terremark, rimuhosting)?"
|
||||||
validargs="ec2,cloudservers,vcloud,trmk-ecloud,trmk-vcloudexpress,ibmdev,eucalyptus,bluelock-vcloudexpress,bluelock-vclouddirector,gogrid,rimuhosting"
|
validargs="ec2,cloudservers,vcloud,trmk-ecloud,trmk-vcloudexpress,eucalyptus,bluelock-vclouddirector,gogrid,rimuhosting"
|
||||||
addproperty="provider"
|
addproperty="provider"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
provider=bluelock-vcloudexpress
|
|
||||||
driver=bluelock
|
|
||||||
identity=user@youregistered.com
|
|
||||||
credential=password
|
|
||||||
tag=name_of_your_vapp
|
|
|
@ -1,5 +0,0 @@
|
||||||
provider=ibmdev
|
|
||||||
driver=ibmdev
|
|
||||||
identity=user@youregistered.com
|
|
||||||
credential=password
|
|
||||||
tag=name_of_your_server
|
|
|
@ -31,7 +31,7 @@
|
||||||
|
|
||||||
<input
|
<input
|
||||||
message="Which provider would you like to use (ec2, cloudservers, vcloud, terremark, rimuhosting)?"
|
message="Which provider would you like to use (ec2, cloudservers, vcloud, terremark, rimuhosting)?"
|
||||||
validargs="ec2,cloudservers,vcloud,trmk-ecloud,trmk-vcloudexpress,ibmdev,eucalyptus,bluelock-vcloudexpress,bluelock-vclouddirector,gogrid,rimuhosting"
|
validargs="ec2,cloudservers,vcloud,trmk-ecloud,trmk-vcloudexpress,eucalyptus,bluelock-vclouddirector,gogrid,rimuhosting"
|
||||||
addproperty="provider"
|
addproperty="provider"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
====
|
====
|
||||||
|
|
||||||
#
|
#
|
||||||
# The jclouds provider for Hosting.com's vCloud Express (http://www.bluelock/vcloudexpress/) platform.
|
# The jclouds provider for BlueLock's vCloud Director platform.
|
||||||
#
|
#
|
||||||
# TODO: Implementation status.
|
# TODO: Implementation status.
|
||||||
# TODO: Supported features.
|
# TODO: Supported features.
|
||||||
|
|
|
@ -35,10 +35,6 @@
|
||||||
<properties>
|
<properties>
|
||||||
<!-- when instances are hung, open a ticket and add their names here -->
|
<!-- when instances are hung, open a ticket and add their names here -->
|
||||||
<jclouds.compute.blacklist.nodes></jclouds.compute.blacklist.nodes>
|
<jclouds.compute.blacklist.nodes></jclouds.compute.blacklist.nodes>
|
||||||
<bluelock-vcloudexpress.endpoint>https://express.bluelock.com/api</bluelock-vcloudexpress.endpoint>
|
|
||||||
<bluelock-vcloudexpress.apiversion>0.8</bluelock-vcloudexpress.apiversion>
|
|
||||||
<bluelock-vcloudexpress.identity>FIXME</bluelock-vcloudexpress.identity>
|
|
||||||
<bluelock-vcloudexpress.credential>FIXME</bluelock-vcloudexpress.credential>
|
|
||||||
<bluelock-vclouddirector.endpoint>https://vcenterprise.bluelock.com/api</bluelock-vclouddirector.endpoint>
|
<bluelock-vclouddirector.endpoint>https://vcenterprise.bluelock.com/api</bluelock-vclouddirector.endpoint>
|
||||||
<bluelock-vclouddirector.apiversion>1.0</bluelock-vclouddirector.apiversion>
|
<bluelock-vclouddirector.apiversion>1.0</bluelock-vclouddirector.apiversion>
|
||||||
<bluelock-vclouddirector.identity>FIXME</bluelock-vclouddirector.identity>
|
<bluelock-vclouddirector.identity>FIXME</bluelock-vclouddirector.identity>
|
||||||
|
@ -82,22 +78,6 @@
|
||||||
</goals>
|
</goals>
|
||||||
<configuration>
|
<configuration>
|
||||||
<systemProperties>
|
<systemProperties>
|
||||||
<property>
|
|
||||||
<name>bluelock-vcloudexpress.endpoint</name>
|
|
||||||
<value>${bluelock-vcloudexpress.endpoint}</value>
|
|
||||||
</property>
|
|
||||||
<property>
|
|
||||||
<name>bluelock-vcloudexpress.apiversion</name>
|
|
||||||
<value>${bluelock-vcloudexpress.apiversion}</value>
|
|
||||||
</property>
|
|
||||||
<property>
|
|
||||||
<name>bluelock-vcloudexpress.identity</name>
|
|
||||||
<value>${bluelock-vcloudexpress.identity}</value>
|
|
||||||
</property>
|
|
||||||
<property>
|
|
||||||
<name>bluelock-vcloudexpress.credential</name>
|
|
||||||
<value>${bluelock-vcloudexpress.credential}</value>
|
|
||||||
</property>
|
|
||||||
<property>
|
<property>
|
||||||
<name>bluelock-vclouddirector.endpoint</name>
|
<name>bluelock-vclouddirector.endpoint</name>
|
||||||
<value>${bluelock-vclouddirector.endpoint}</value>
|
<value>${bluelock-vclouddirector.endpoint}</value>
|
||||||
|
|
|
@ -1,63 +0,0 @@
|
||||||
/**
|
|
||||||
*
|
|
||||||
* Copyright (C) 2010 Cloud Conscious, LLC. <info@cloudconscious.com>
|
|
||||||
*
|
|
||||||
* ====================================================================
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
* ====================================================================
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.jclouds.vcloud.bluelock;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Properties;
|
|
||||||
|
|
||||||
import org.jclouds.http.config.JavaUrlHttpCommandExecutorServiceModule;
|
|
||||||
import org.jclouds.logging.jdk.config.JDKLoggingModule;
|
|
||||||
import org.jclouds.vcloud.VCloudExpressContextBuilder;
|
|
||||||
import org.jclouds.vcloud.bluelock.compute.config.BlueLockVCloudExpressComputeServiceContextModule;
|
|
||||||
import org.jclouds.vcloud.bluelock.config.BlueLockVCloudExpressRestClientModule;
|
|
||||||
|
|
||||||
import com.google.inject.Injector;
|
|
||||||
import com.google.inject.Module;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates {@link BlueLockVCloudComputeServiceContext} or {@link Injector} instances based on the
|
|
||||||
* most commonly requested arguments.
|
|
||||||
* <p/>
|
|
||||||
* Note that Threadsafe objects will be bound as singletons to the Injector or Context provided.
|
|
||||||
* <p/>
|
|
||||||
* <p/>
|
|
||||||
* If no <code>Module</code>s are specified, the default {@link JDKLoggingModule logging} and
|
|
||||||
* {@link JavaUrlHttpCommandExecutorServiceModule http transports} will be installed.
|
|
||||||
*
|
|
||||||
* @author Adrian Cole
|
|
||||||
* @see BlueLockVCloudComputeServiceContext
|
|
||||||
*/
|
|
||||||
public class BlueLockVCloudExpressContextBuilder extends VCloudExpressContextBuilder {
|
|
||||||
|
|
||||||
public BlueLockVCloudExpressContextBuilder(Properties props) {
|
|
||||||
super(props);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void addContextModule(List<Module> modules) {
|
|
||||||
modules.add(new BlueLockVCloudExpressComputeServiceContextModule());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void addClientModule(List<Module> modules) {
|
|
||||||
modules.add(new BlueLockVCloudExpressRestClientModule());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,46 +0,0 @@
|
||||||
/**
|
|
||||||
*
|
|
||||||
* Copyright (C) 2010 Cloud Conscious, LLC. <info@cloudconscious.com>
|
|
||||||
*
|
|
||||||
* ====================================================================
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
* ====================================================================
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.jclouds.vcloud.bluelock;
|
|
||||||
|
|
||||||
import static org.jclouds.Constants.PROPERTY_ENDPOINT;
|
|
||||||
import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_DEFAULT_NETWORK;
|
|
||||||
|
|
||||||
import java.util.Properties;
|
|
||||||
|
|
||||||
import org.jclouds.vcloud.VCloudExpressPropertiesBuilder;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Builds properties used in bluelock VCloud Clients
|
|
||||||
*
|
|
||||||
* @author Adrian Cole
|
|
||||||
*/
|
|
||||||
public class BlueLockVCloudExpressPropertiesBuilder extends VCloudExpressPropertiesBuilder {
|
|
||||||
@Override
|
|
||||||
protected Properties defaultProperties() {
|
|
||||||
Properties properties = super.defaultProperties();
|
|
||||||
properties.setProperty(PROPERTY_ENDPOINT, "https://express.bluelock.com/api");
|
|
||||||
properties.setProperty(PROPERTY_VCLOUD_DEFAULT_NETWORK, "Internal In and Out");
|
|
||||||
return properties;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BlueLockVCloudExpressPropertiesBuilder(Properties properties) {
|
|
||||||
super(properties);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,63 +0,0 @@
|
||||||
/**
|
|
||||||
*
|
|
||||||
* Copyright (C) 2010 Cloud Conscious, LLC. <info@cloudconscious.com>
|
|
||||||
*
|
|
||||||
* ====================================================================
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
* ====================================================================
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.jclouds.vcloud.bluelock.compute;
|
|
||||||
|
|
||||||
import java.net.URI;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import javax.inject.Inject;
|
|
||||||
import javax.inject.Singleton;
|
|
||||||
|
|
||||||
import org.jclouds.compute.domain.NodeState;
|
|
||||||
import org.jclouds.compute.strategy.PopulateDefaultLoginCredentialsForImageStrategy;
|
|
||||||
import org.jclouds.domain.Credentials;
|
|
||||||
import org.jclouds.vcloud.VCloudExpressClient;
|
|
||||||
import org.jclouds.vcloud.compute.internal.VCloudExpressComputeClientImpl;
|
|
||||||
import org.jclouds.vcloud.domain.Status;
|
|
||||||
import org.jclouds.vcloud.domain.VCloudExpressVApp;
|
|
||||||
import org.jclouds.vcloud.domain.VCloudExpressVAppTemplate;
|
|
||||||
|
|
||||||
import com.google.common.base.Predicate;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Adrian Cole
|
|
||||||
*/
|
|
||||||
@Singleton
|
|
||||||
public class BlueLockVCloudExpressComputeClient extends VCloudExpressComputeClientImpl {
|
|
||||||
private final PopulateDefaultLoginCredentialsForImageStrategy credentialsProvider;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
protected BlueLockVCloudExpressComputeClient(PopulateDefaultLoginCredentialsForImageStrategy credentialsProvider,
|
|
||||||
VCloudExpressClient client, Predicate<URI> successTester, Map<Status, NodeState> vAppStatusToNodeState) {
|
|
||||||
super(client, successTester, vAppStatusToNodeState);
|
|
||||||
this.credentialsProvider = credentialsProvider;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Map<String, String> parseAndValidateResponse(VCloudExpressVAppTemplate template,
|
|
||||||
VCloudExpressVApp vAppResponse) {
|
|
||||||
Credentials credentials = credentialsProvider.execute(template);
|
|
||||||
Map<String, String> toReturn = super.parseResponse(template, vAppResponse);
|
|
||||||
toReturn.put("username", credentials.identity);
|
|
||||||
toReturn.put("password", credentials.credential);
|
|
||||||
return toReturn;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,57 +0,0 @@
|
||||||
/**
|
|
||||||
*
|
|
||||||
* Copyright (C) 2010 Cloud Conscious, LLC. <info@cloudconscious.com>
|
|
||||||
*
|
|
||||||
* ====================================================================
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
* ====================================================================
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.jclouds.vcloud.bluelock.compute.config;
|
|
||||||
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import org.jclouds.compute.domain.Size;
|
|
||||||
import org.jclouds.compute.strategy.PopulateDefaultLoginCredentialsForImageStrategy;
|
|
||||||
import org.jclouds.vcloud.bluelock.compute.BlueLockVCloudExpressComputeClient;
|
|
||||||
import org.jclouds.vcloud.bluelock.compute.config.suppliers.ParseSizeFromImageSupplier;
|
|
||||||
import org.jclouds.vcloud.bluelock.compute.functions.BlueLockVCloudImageForVAppTemplate;
|
|
||||||
import org.jclouds.vcloud.bluelock.compute.strategy.DefaultLoginCredentialsFromBlueLockFAQ;
|
|
||||||
import org.jclouds.vcloud.compute.VCloudExpressComputeClient;
|
|
||||||
import org.jclouds.vcloud.compute.config.VCloudExpressComputeServiceContextModule;
|
|
||||||
import org.jclouds.vcloud.compute.functions.ImageForVCloudExpressVAppTemplate;
|
|
||||||
|
|
||||||
import com.google.common.base.Supplier;
|
|
||||||
import com.google.inject.Injector;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Configures the {@link BlueLockVCloudComputeServiceContext}; requires
|
|
||||||
* {@link BlueLockVCloudExpressComputeClient} bound.
|
|
||||||
*
|
|
||||||
* @author Adrian Cole
|
|
||||||
*/
|
|
||||||
public class BlueLockVCloudExpressComputeServiceContextModule extends VCloudExpressComputeServiceContextModule {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void configure() {
|
|
||||||
super.configure();
|
|
||||||
bind(ImageForVCloudExpressVAppTemplate.class).to(BlueLockVCloudImageForVAppTemplate.class);
|
|
||||||
bind(VCloudExpressComputeClient.class).to(BlueLockVCloudExpressComputeClient.class);
|
|
||||||
bind(PopulateDefaultLoginCredentialsForImageStrategy.class).to(DefaultLoginCredentialsFromBlueLockFAQ.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Supplier<Set<? extends Size>> getSourceSizeSupplier(Injector injector) {
|
|
||||||
return injector.getInstance(ParseSizeFromImageSupplier.class);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,111 +0,0 @@
|
||||||
/**
|
|
||||||
*
|
|
||||||
* Copyright (C) 2010 Cloud Conscious, LLC. <info@cloudconscious.com>
|
|
||||||
*
|
|
||||||
* ====================================================================
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
* ====================================================================
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.jclouds.vcloud.bluelock.compute.config.suppliers;
|
|
||||||
|
|
||||||
import static com.google.common.collect.Iterables.filter;
|
|
||||||
import static com.google.common.collect.Iterables.transform;
|
|
||||||
import static com.google.common.collect.Sets.newLinkedHashSet;
|
|
||||||
|
|
||||||
import java.util.NoSuchElementException;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.regex.Matcher;
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
import javax.inject.Inject;
|
|
||||||
import javax.inject.Named;
|
|
||||||
import javax.inject.Singleton;
|
|
||||||
|
|
||||||
import org.jclouds.compute.domain.Image;
|
|
||||||
import org.jclouds.compute.domain.Size;
|
|
||||||
import org.jclouds.compute.domain.internal.SizeImpl;
|
|
||||||
import org.jclouds.compute.predicates.ImagePredicates;
|
|
||||||
import org.jclouds.compute.reference.ComputeServiceConstants;
|
|
||||||
import org.jclouds.logging.Logger;
|
|
||||||
import org.jclouds.vcloud.compute.domain.VCloudExpressImage;
|
|
||||||
import org.jclouds.vcloud.domain.VCloudExpressVAppTemplate;
|
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
|
||||||
import com.google.common.base.Predicates;
|
|
||||||
import com.google.common.base.Supplier;
|
|
||||||
import com.google.common.collect.ImmutableMap;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Adrian Cole
|
|
||||||
*/
|
|
||||||
@Singleton
|
|
||||||
public class ParseSizeFromImageSupplier implements Supplier<Set<? extends Size>> {
|
|
||||||
// ex Ubuntu904Serverx64 1CPUx16GBx20GB
|
|
||||||
public static final Pattern GBRAM_PATTERN = Pattern.compile("[^ ] ([0-9]+)CPUx([0-9]+)GBx([0-9]+)GB");
|
|
||||||
|
|
||||||
// ex Windows2008stdx64 1CPUx512MBx30GB
|
|
||||||
public static final Pattern MBRAM_PATTERN = Pattern.compile("[^ ] ([0-9]+)CPUx([0-9]+)MBx([0-9]+)GB");
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
@Named(ComputeServiceConstants.COMPUTE_LOGGER)
|
|
||||||
public Logger logger = Logger.NULL;
|
|
||||||
|
|
||||||
private final Supplier<Set<? extends Image>> images;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
ParseSizeFromImageSupplier(Supplier<Set<? extends Image>> images) {
|
|
||||||
this.images = images;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Set<? extends Size> get() {
|
|
||||||
|
|
||||||
return newLinkedHashSet(filter(transform(images.get(), new Function<Image, Size>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Size apply(Image from) {
|
|
||||||
try {
|
|
||||||
VCloudExpressVAppTemplate template = VCloudExpressImage.class.cast(from).getVAppTemplate();
|
|
||||||
Matcher matcher = getMatcherAndFind(template.getName());
|
|
||||||
double cores = Double.parseDouble(matcher.group(1));
|
|
||||||
int ram = Integer.parseInt(matcher.group(2));
|
|
||||||
if (matcher.pattern().equals(GBRAM_PATTERN))
|
|
||||||
ram *= 1024;
|
|
||||||
int disk = Integer.parseInt(matcher.group(3));
|
|
||||||
String name = template.getName().split(" ")[1];
|
|
||||||
return new SizeImpl(from.getId(), name, from.getId(), from.getLocation(), null, ImmutableMap
|
|
||||||
.<String, String> of(), cores, ram, disk, ImagePredicates.idEquals(from.getId()));
|
|
||||||
} catch (NoSuchElementException e) {
|
|
||||||
logger.debug("<< didn't match at all(%s)", from);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}), Predicates.notNull()));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @throws NoSuchElementException
|
|
||||||
* if no configured matcher matches the name.
|
|
||||||
*/
|
|
||||||
private Matcher getMatcherAndFind(String name) {
|
|
||||||
for (Pattern pattern : new Pattern[] { GBRAM_PATTERN, MBRAM_PATTERN }) {
|
|
||||||
Matcher matcher = pattern.matcher(name);
|
|
||||||
if (matcher.find())
|
|
||||||
return matcher;
|
|
||||||
}
|
|
||||||
throw new NoSuchElementException(name);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,47 +0,0 @@
|
||||||
/**
|
|
||||||
*
|
|
||||||
* Copyright (C) 2010 Cloud Conscious, LLC. <info@cloudconscious.com>
|
|
||||||
*
|
|
||||||
* ====================================================================
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
* ====================================================================
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.jclouds.vcloud.bluelock.compute.functions;
|
|
||||||
|
|
||||||
import javax.inject.Inject;
|
|
||||||
import javax.inject.Singleton;
|
|
||||||
|
|
||||||
import org.jclouds.compute.strategy.PopulateDefaultLoginCredentialsForImageStrategy;
|
|
||||||
import org.jclouds.vcloud.compute.functions.FindLocationForResource;
|
|
||||||
import org.jclouds.vcloud.compute.functions.ImageForVCloudExpressVAppTemplate;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Adrian Cole
|
|
||||||
*/
|
|
||||||
@Singleton
|
|
||||||
public class BlueLockVCloudImageForVAppTemplate extends ImageForVCloudExpressVAppTemplate {
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
protected BlueLockVCloudImageForVAppTemplate(FindLocationForResource findLocationForResource,
|
|
||||||
PopulateDefaultLoginCredentialsForImageStrategy credentialsProvider) {
|
|
||||||
super(findLocationForResource, credentialsProvider);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Extremely important, as otherwise the size encoded into the name will throw off the
|
|
||||||
// template matching, accidentally choosing the largest size by default
|
|
||||||
protected String getName(String name) {
|
|
||||||
return name.split(" ")[0];
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,57 +0,0 @@
|
||||||
/**
|
|
||||||
*
|
|
||||||
* Copyright (C) 2010 Cloud Conscious, LLC. <info@cloudconscious.com>
|
|
||||||
*
|
|
||||||
* ====================================================================
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
* ====================================================================
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.jclouds.vcloud.bluelock.compute.strategy;
|
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkArgument;
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
|
||||||
|
|
||||||
import javax.inject.Singleton;
|
|
||||||
|
|
||||||
import org.jclouds.compute.strategy.PopulateDefaultLoginCredentialsForImageStrategy;
|
|
||||||
import org.jclouds.domain.Credentials;
|
|
||||||
import org.jclouds.vcloud.domain.VCloudExpressVAppTemplate;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* from https://forums.bluelock.com/faq.php?faq=vcloudexpressfaq
|
|
||||||
*
|
|
||||||
* @author Adrian Cole
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@Singleton
|
|
||||||
public class DefaultLoginCredentialsFromBlueLockFAQ implements PopulateDefaultLoginCredentialsForImageStrategy {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Credentials execute(Object resourceToAuthenticate) {
|
|
||||||
checkNotNull(resourceToAuthenticate);
|
|
||||||
checkArgument(resourceToAuthenticate instanceof VCloudExpressVAppTemplate,
|
|
||||||
"Resource must be an VCloudExpressVAppTemplate (for Bluelock vCloud Express)");
|
|
||||||
VCloudExpressVAppTemplate template = (VCloudExpressVAppTemplate) resourceToAuthenticate;
|
|
||||||
if (template.getDescription().indexOf("Windows") >= 0) {
|
|
||||||
return new Credentials("expressuser", "ExpressPassword#1");
|
|
||||||
} else {
|
|
||||||
if (template.getDescription().indexOf("buntu") != -1) {
|
|
||||||
return new Credentials("express", "ExpressPassword#1");
|
|
||||||
} else {
|
|
||||||
return new Credentials("root", "ExpressPassword#1");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,60 +0,0 @@
|
||||||
/**
|
|
||||||
*
|
|
||||||
* Copyright (C) 2010 Cloud Conscious, LLC. <info@cloudconscious.com>
|
|
||||||
*
|
|
||||||
* ====================================================================
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
* ====================================================================
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.jclouds.vcloud.bluelock.config;
|
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkState;
|
|
||||||
import static org.jclouds.Constants.PROPERTY_IDENTITY;
|
|
||||||
|
|
||||||
import java.net.URI;
|
|
||||||
|
|
||||||
import javax.inject.Named;
|
|
||||||
|
|
||||||
import org.jclouds.http.RequiresHttp;
|
|
||||||
import org.jclouds.rest.ConfiguresRestClient;
|
|
||||||
import org.jclouds.vcloud.config.VCloudExpressRestClientModule;
|
|
||||||
import org.jclouds.vcloud.domain.Org;
|
|
||||||
import org.jclouds.vcloud.domain.ReferenceType;
|
|
||||||
|
|
||||||
import com.google.common.base.Predicate;
|
|
||||||
import com.google.common.collect.Iterables;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Configures the VCloud authentication service connection, including logging and http transport.
|
|
||||||
*
|
|
||||||
* @author Adrian Cole
|
|
||||||
*/
|
|
||||||
@RequiresHttp
|
|
||||||
@ConfiguresRestClient
|
|
||||||
public class BlueLockVCloudExpressRestClientModule extends VCloudExpressRestClientModule {
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected URI provideCatalog(Org org, @Named(PROPERTY_IDENTITY) final String user) {
|
|
||||||
checkState(org.getCatalogs().size() > 0, "No catalogs present in org: " + org.getName());
|
|
||||||
return Iterables.getOnlyElement(Iterables.filter(org.getCatalogs().values(), new Predicate<ReferenceType>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(ReferenceType input) {
|
|
||||||
return input.getName().startsWith(user);
|
|
||||||
}
|
|
||||||
|
|
||||||
})).getHref();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,54 +0,0 @@
|
||||||
/**
|
|
||||||
*
|
|
||||||
* Copyright (C) 2010 Cloud Conscious, LLC. <info@cloudconscious.com>
|
|
||||||
*
|
|
||||||
* ====================================================================
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
* ====================================================================
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.jclouds.vcloud.bluelock;
|
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
|
||||||
|
|
||||||
import java.util.Properties;
|
|
||||||
|
|
||||||
import org.jclouds.compute.ComputeServiceContextFactory;
|
|
||||||
import org.jclouds.logging.log4j.config.Log4JLoggingModule;
|
|
||||||
import org.jclouds.vcloud.VCloudExpressClientLiveTest;
|
|
||||||
import org.testng.annotations.BeforeGroups;
|
|
||||||
import org.testng.annotations.Test;
|
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableSet;
|
|
||||||
import com.google.inject.Module;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Tests behavior of {@code BlueLockVCloudClient}
|
|
||||||
*
|
|
||||||
* @author Adrian Cole
|
|
||||||
*/
|
|
||||||
@Test(groups = "live", sequential = true, testName = "vcloud.BlueLockVCloudClientLiveTest")
|
|
||||||
public class BlueLockVCloudExpressClientLiveTest extends VCloudExpressClientLiveTest {
|
|
||||||
|
|
||||||
@BeforeGroups(groups = { "live" })
|
|
||||||
@Override
|
|
||||||
public void setupClient() {
|
|
||||||
identity = checkNotNull(System.getProperty("bluelock-vcloudexpress.identity"), "bluelock-vcloudexpress.identity");
|
|
||||||
String credential = checkNotNull(System.getProperty("bluelock-vcloudexpress.credential"),
|
|
||||||
"bluelock-vcloudexpress.credential");
|
|
||||||
context = new ComputeServiceContextFactory().createContext("bluelock-vcloudexpress", identity, credential,
|
|
||||||
ImmutableSet.<Module> of(new Log4JLoggingModule()), new Properties()).getProviderSpecificContext();
|
|
||||||
connection = context.getApi();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -36,7 +36,6 @@ public class ProvidersInPropertiesTest {
|
||||||
@Test
|
@Test
|
||||||
public void testSupportedProviders() {
|
public void testSupportedProviders() {
|
||||||
Iterable<String> providers = Utils.getSupportedProviders();
|
Iterable<String> providers = Utils.getSupportedProviders();
|
||||||
assert Iterables.contains(providers, "bluelock-vcloudexpress") : providers;
|
|
||||||
assert Iterables.contains(providers, "bluelock-vclouddirector") : providers;
|
assert Iterables.contains(providers, "bluelock-vclouddirector") : providers;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -44,7 +43,6 @@ public class ProvidersInPropertiesTest {
|
||||||
@Test
|
@Test
|
||||||
public void testSupportedComputeServiceProviders() {
|
public void testSupportedComputeServiceProviders() {
|
||||||
Iterable<String> providers = ComputeServiceUtils.getSupportedProviders();
|
Iterable<String> providers = ComputeServiceUtils.getSupportedProviders();
|
||||||
assert Iterables.contains(providers, "bluelock-vcloudexpress") : providers;
|
|
||||||
assert Iterables.contains(providers, "bluelock-vclouddirector") : providers;
|
assert Iterables.contains(providers, "bluelock-vclouddirector") : providers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,70 +0,0 @@
|
||||||
/**
|
|
||||||
*
|
|
||||||
* Copyright (C) 2010 Cloud Conscious, LLC. <info@cloudconscious.com>
|
|
||||||
*
|
|
||||||
* ====================================================================
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
* ====================================================================
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.jclouds.vcloud.bluelock.compute;
|
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
|
||||||
import static org.testng.Assert.assertEquals;
|
|
||||||
|
|
||||||
import org.jclouds.compute.domain.Image;
|
|
||||||
import org.jclouds.compute.domain.OsFamily;
|
|
||||||
import org.jclouds.compute.domain.Template;
|
|
||||||
import org.jclouds.compute.domain.TemplateBuilder;
|
|
||||||
import org.jclouds.vcloud.compute.VCloudExpressComputeServiceLiveTest;
|
|
||||||
import org.testng.annotations.Test;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @author Adrian Cole
|
|
||||||
*/
|
|
||||||
@Test(groups = "live", enabled = true, sequential = true, testName = "bluelock.BlueLockVCloudExpressComputeServiceLiveTest")
|
|
||||||
public class BlueLockVCloudExpressComputeServiceLiveTest extends VCloudExpressComputeServiceLiveTest {
|
|
||||||
@Override
|
|
||||||
public void setServiceDefaults() {
|
|
||||||
provider = "bluelock-vcloudexpress";
|
|
||||||
tag = "vcx";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void setupCredentials() {
|
|
||||||
identity = checkNotNull(System.getProperty("bluelock-vcloudexpress.identity"), "bluelock-vcloudexpress.identity");
|
|
||||||
credential = checkNotNull(System.getProperty("bluelock-vcloudexpress.credential"),
|
|
||||||
"bluelock-vcloudexpress.credential");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testTemplateBuilder() {
|
|
||||||
Template defaultTemplate = client.templateBuilder().build();
|
|
||||||
assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), true);
|
|
||||||
assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU);
|
|
||||||
assertEquals(defaultTemplate.getLocation().getId(), "https://express3.bluelock.com/api/v0.8/vdc/133");
|
|
||||||
assertEquals(defaultTemplate.getSize().getCores(), 1.0d);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Template buildTemplate(TemplateBuilder templateBuilder) {
|
|
||||||
Template template = super.buildTemplate(templateBuilder);
|
|
||||||
Image image = template.getImage();
|
|
||||||
assert image.getDefaultCredentials().identity != null : image;
|
|
||||||
assert image.getDefaultCredentials().credential != null : image;
|
|
||||||
return template;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
Loading…
Reference in New Issue