mirror of https://github.com/apache/jclouds.git
Issue 710: update existing vcloud providers
This commit is contained in:
parent
0b40a3b280
commit
82673e0dd5
|
@ -141,8 +141,8 @@ cloudsigma-lvs.contextbuilder=org.jclouds.cloudsigma.CloudSigmaContextBuilder
|
|||
ibm-smartcloud.propertiesbuilder=org.jclouds.ibm.smartcloud.IBMSmartCloudPropertiesBuilder
|
||||
ibm-smartcloud.contextbuilder=org.jclouds.ibm.smartcloud.IBMSmartCloudContextBuilder
|
||||
|
||||
virtacore-vcloudexpress.propertiesbuilder=org.jclouds.virtacore.vcloudexpress.VirtacoreVCloudExpressPropertiesBuilder
|
||||
virtacore-vcloudexpress.contextbuilder=org.jclouds.virtacore.vcloudexpress.VirtacoreVCloudExpressContextBuilder
|
||||
virtacore-publiccloud-lax.propertiesbuilder=org.jclouds.virtacore.publiccloud.VirtacorePublicCloudLAXPropertiesBuilder
|
||||
virtacore-publiccloud-lax.contextbuilder=org.jclouds.virtacore.publiccloud.VirtacorePublicCloudLAXContextBuilder
|
||||
|
||||
dunkel-vcd.propertiesbuilder=org.jclouds.dunkel.vcd.DunkelVCloudDirectorPropertiesBuilder
|
||||
dunkel-vcd.contextbuilder=org.jclouds.dunkel.vcd.DunkelVCloudDirectorContextBuilder
|
||||
|
|
|
@ -34,11 +34,6 @@ public class BluelockVCloudZone01ComputeServiceLiveTest extends VCloudComputeSer
|
|||
provider = "bluelock-vcloud-zone01";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setServiceDefaults() {
|
||||
group = "director";
|
||||
}
|
||||
|
||||
protected void checkResponseEqualsHostname(ExecResponse execResponse, NodeMetadata node1) {
|
||||
// hostname is not completely predictable based on node metadata
|
||||
assert execResponse.getOutput().trim().equals("Ubuntu1004") : execResponse + ": " + node1;
|
||||
|
|
|
@ -40,6 +40,8 @@
|
|||
<test.greenhousedata-element-vcloud.identity>FIXME_IDENTITY</test.greenhousedata-element-vcloud.identity>
|
||||
<test.greenhousedata-element-vcloud.credential>FIXME_CREDENTIAL</test.greenhousedata-element-vcloud.credential>
|
||||
<test.greenhousedata-element-vcloud.image-id></test.greenhousedata-element-vcloud.image-id>
|
||||
<test.greenhousedata-element-vcloud.image.login-user></test.greenhousedata-element-vcloud.image.login-user>
|
||||
<test.greenhousedata-element-vcloud.image.authenticate-sudo></test.greenhousedata-element-vcloud.image.authenticate-sudo>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
@ -106,6 +108,8 @@
|
|||
<test.greenhousedata-element-vcloud.identity>${test.greenhousedata-element-vcloud.identity}</test.greenhousedata-element-vcloud.identity>
|
||||
<test.greenhousedata-element-vcloud.credential>${test.greenhousedata-element-vcloud.credential}</test.greenhousedata-element-vcloud.credential>
|
||||
<test.greenhousedata-element-vcloud.image-id>${test.greenhousedata-element-vcloud.image-id}</test.greenhousedata-element-vcloud.image-id>
|
||||
<test.greenhousedata-element-vcloud.image.login-user>${test.greenhousedata-element-vcloud.image.login-user}</test.greenhousedata-element-vcloud.image.login-user>
|
||||
<test.greenhousedata-element-vcloud.image.authenticate-sudo>${test.greenhousedata-element-vcloud.image.authenticate-sudo}</test.greenhousedata-element-vcloud.image.authenticate-sudo>
|
||||
</systemPropertyVariables>
|
||||
</configuration>
|
||||
</execution>
|
||||
|
|
|
@ -18,8 +18,6 @@
|
|||
*/
|
||||
package org.jclouds.greenhousedata.element.vcloud.compute;
|
||||
|
||||
import org.jclouds.compute.domain.ExecResponse;
|
||||
import org.jclouds.compute.domain.NodeMetadata;
|
||||
import org.jclouds.vcloud.compute.VCloudComputeServiceLiveTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
|
@ -32,17 +30,6 @@ import org.testng.annotations.Test;
|
|||
public class GreenHouseDataElementVCloudComputeServiceLiveTest extends VCloudComputeServiceLiveTest {
|
||||
public GreenHouseDataElementVCloudComputeServiceLiveTest() {
|
||||
provider = "greenhousedata-element-vcloud";
|
||||
// vcloud requires instantiate before deploy, which takes longer than 30 seconds
|
||||
nonBlockDurationSeconds = 300;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setServiceDefaults() {
|
||||
group = "director";
|
||||
}
|
||||
|
||||
protected void checkResponseEqualsHostname(ExecResponse execResponse, NodeMetadata node1) {
|
||||
// hostname is not predictable based on node metadata
|
||||
assert execResponse.getOutput().trim().equals("(none)");
|
||||
}
|
||||
}
|
|
@ -18,7 +18,6 @@
|
|||
*/
|
||||
package org.jclouds.greenhousedata.element.vcloud.features;
|
||||
|
||||
import org.jclouds.compute.domain.ExecResponse;
|
||||
import org.jclouds.vcloud.features.VmClientLiveTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
|
@ -34,14 +33,4 @@ public class GreenHouseDataElementVCloudVmClientLiveTest extends VmClientLiveTes
|
|||
provider = "greenhousedata-element-vcloud";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void checkApiOutput(String apiOutput) {
|
||||
checkApiOutput1_0_0(apiOutput);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void checkCustomizationOccurred(ExecResponse exec) {
|
||||
// for some reason customization doesn't actually occur
|
||||
assert exec.getOutput().equals("") : exec;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,10 +36,12 @@
|
|||
<properties>
|
||||
<test.stratogen-vcloud-mycloud.endpoint>https://vcd.stratogen.net/api</test.stratogen-vcloud-mycloud.endpoint>
|
||||
<test.stratogen-vcloud-mycloud.api-version>1.0</test.stratogen-vcloud-mycloud.api-version>
|
||||
<test.stratogen-vcloud-mycloud.build-version></test.stratogen-vcloud-mycloud.build-version>
|
||||
<test.stratogen-vcloud-mycloud.build-version>1.5.0.464915</test.stratogen-vcloud-mycloud.build-version>
|
||||
<test.stratogen-vcloud-mycloud.identity>FIXME_IDENTITY</test.stratogen-vcloud-mycloud.identity>
|
||||
<test.stratogen-vcloud-mycloud.credential>FIXME_CREDENTIAL</test.stratogen-vcloud-mycloud.credential>
|
||||
<test.stratogen-vcloud-mycloud.image-id></test.stratogen-vcloud-mycloud.image-id>
|
||||
<test.stratogen-vcloud-mycloud.image.login-user></test.stratogen-vcloud-mycloud.image.login-user>
|
||||
<test.stratogen-vcloud-mycloud.image.authenticate-sudo></test.stratogen-vcloud-mycloud.image.authenticate-sudo>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
@ -106,6 +108,8 @@
|
|||
<test.stratogen-vcloud-mycloud.identity>${test.stratogen-vcloud-mycloud.identity}</test.stratogen-vcloud-mycloud.identity>
|
||||
<test.stratogen-vcloud-mycloud.credential>${test.stratogen-vcloud-mycloud.credential}</test.stratogen-vcloud-mycloud.credential>
|
||||
<test.stratogen-vcloud-mycloud.image-id>${test.stratogen-vcloud-mycloud.image-id}</test.stratogen-vcloud-mycloud.image-id>
|
||||
<test.stratogen-vcloud-mycloud.image.login-user>${test.stratogen-vcloud-mycloud.image.login-user}</test.stratogen-vcloud-mycloud.image.login-user>
|
||||
<test.stratogen-vcloud-mycloud.image.authenticate-sudo>${test.stratogen-vcloud-mycloud.image.authenticate-sudo}</test.stratogen-vcloud-mycloud.image.authenticate-sudo>
|
||||
</systemPropertyVariables>
|
||||
</configuration>
|
||||
</execution>
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
*/
|
||||
package org.jclouds.stratogen.vcloud.mycloud;
|
||||
|
||||
import static org.jclouds.Constants.PROPERTY_BUILD_VERSION;
|
||||
import static org.jclouds.Constants.PROPERTY_ENDPOINT;
|
||||
import static org.jclouds.Constants.PROPERTY_ISO3166_CODES;
|
||||
import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_DEFAULT_NETWORK;
|
||||
|
@ -37,6 +38,7 @@ public class StratoGenVCloudMyCloudPropertiesBuilder extends VCloudPropertiesBui
|
|||
Properties properties = super.defaultProperties();
|
||||
properties.setProperty(PROPERTY_ISO3166_CODES, "GB");
|
||||
properties.setProperty(PROPERTY_ENDPOINT, "https://vcd.stratogen.net/api");
|
||||
properties.setProperty(PROPERTY_BUILD_VERSION, "1.5.0.464915");
|
||||
properties.setProperty(PROPERTY_VCLOUD_DEFAULT_NETWORK, "Direct Internet");
|
||||
return properties;
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
*/
|
||||
package org.jclouds.stratogen.vcloud.mycloud.config;
|
||||
|
||||
import org.jclouds.compute.domain.TemplateBuilder;
|
||||
import org.jclouds.compute.options.TemplateOptions;
|
||||
import org.jclouds.vcloud.compute.config.VCloudComputeServiceContextModule;
|
||||
import org.jclouds.vcloud.compute.options.VCloudTemplateOptions;
|
||||
|
@ -31,6 +32,12 @@ import com.google.inject.Injector;
|
|||
* @author Adrian Cole
|
||||
*/
|
||||
public class StratoGenVCloudMyCloudComputeServiceContextModule extends VCloudComputeServiceContextModule {
|
||||
|
||||
@Override
|
||||
protected TemplateBuilder provideTemplate(Injector injector, TemplateBuilder template) {
|
||||
return template.imageNameMatches("Ubuntu server 11.04 64bit no GUI (base)");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected TemplateOptions provideTemplateOptions(Injector injector, TemplateOptions options) {
|
||||
return options.as(VCloudTemplateOptions.class).ipAddressAllocationMode(IpAddressAllocationMode.POOL);
|
||||
|
|
|
@ -18,16 +18,8 @@
|
|||
*/
|
||||
package org.jclouds.stratogen.vcloud.mycloud.compute;
|
||||
|
||||
import static org.jclouds.compute.util.ComputeServiceUtils.getCores;
|
||||
import static org.testng.Assert.assertEquals;
|
||||
|
||||
import org.jclouds.compute.domain.ExecResponse;
|
||||
import org.jclouds.compute.domain.Image;
|
||||
import org.jclouds.compute.domain.NodeMetadata;
|
||||
import org.jclouds.compute.domain.OsFamily;
|
||||
import org.jclouds.compute.domain.Template;
|
||||
import org.jclouds.compute.domain.TemplateBuilder;
|
||||
import org.jclouds.compute.predicates.OperatingSystemPredicates;
|
||||
import org.jclouds.vcloud.compute.VCloudComputeServiceLiveTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
|
@ -40,34 +32,6 @@ import org.testng.annotations.Test;
|
|||
public class StratoGenVCloudMyCloudComputeServiceLiveTest extends VCloudComputeServiceLiveTest {
|
||||
public StratoGenVCloudMyCloudComputeServiceLiveTest() {
|
||||
provider = "stratogen-vcloud-mycloud";
|
||||
// vcloud requires instantiate before deploy, which takes longer than 30
|
||||
// seconds
|
||||
nonBlockDurationSeconds = 300;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setServiceDefaults() {
|
||||
group = "director";
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTemplateBuilder() {
|
||||
Template defaultTemplate = client.templateBuilder().build();
|
||||
assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), true);
|
||||
assert OperatingSystemPredicates.supportsApt().apply(defaultTemplate.getImage().getOperatingSystem());
|
||||
assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU);
|
||||
assertEquals(defaultTemplate.getImage().getOperatingSystem().getDescription(), "Ubuntu Linux (64-bit)");
|
||||
assert defaultTemplate.getLocation().getId() != null : defaultTemplate.getLocation();
|
||||
assertEquals(getCores(defaultTemplate.getHardware()), 1.0d);
|
||||
System.out.println(defaultTemplate.getHardware());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Template buildTemplate(TemplateBuilder templateBuilder) {
|
||||
Template template = super.buildTemplate(templateBuilder);
|
||||
Image image = template.getImage();
|
||||
assert image.getDefaultCredentials().credential != null : image;
|
||||
return template;
|
||||
}
|
||||
|
||||
protected void checkResponseEqualsHostname(ExecResponse execResponse, NodeMetadata node1) {
|
||||
|
|
|
@ -31,6 +31,7 @@ import org.jclouds.compute.domain.Template;
|
|||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.base.Predicates;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
/**
|
||||
|
@ -46,24 +47,31 @@ public class StratoGenVCloudMyCloudTemplateBuilderLiveTest extends BaseTemplateB
|
|||
|
||||
@Override
|
||||
protected Predicate<OsFamilyVersion64Bit> defineUnsupportedOperatingSystems() {
|
||||
return new Predicate<OsFamilyVersion64Bit>() {
|
||||
return Predicates.not(new Predicate<OsFamilyVersion64Bit>() {
|
||||
|
||||
@Override
|
||||
public boolean apply(OsFamilyVersion64Bit input) {
|
||||
switch (input.family) {
|
||||
case UBUNTU:
|
||||
return !input.version.equals("") || !input.is64Bit;
|
||||
return input.version.equals("");
|
||||
case DEBIAN:
|
||||
return input.version.equals("") && !input.is64Bit;
|
||||
case RHEL:
|
||||
return input.version.equals("") && input.is64Bit;
|
||||
case WINDOWS:
|
||||
return input.version.equals("") && input.is64Bit;
|
||||
default:
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void testDefaultTemplateBuilder() throws IOException {
|
||||
Template defaultTemplate = context.getComputeService().templateBuilder().build();
|
||||
assertEquals(defaultTemplate.getImage().getName(), "Ubuntu server 11.04 64bit no GUI (base)");
|
||||
assertEquals(defaultTemplate.getImage().getOperatingSystem().getVersion(), "");
|
||||
assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), true);
|
||||
assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU);
|
||||
|
|
|
@ -35,10 +35,12 @@
|
|||
<properties>
|
||||
<test.dunkel-vcd.endpoint>https://vcd.dunkel.de/api</test.dunkel-vcd.endpoint>
|
||||
<test.dunkel-vcd.api-version>1.0</test.dunkel-vcd.api-version>
|
||||
<test.dunkel-vcd.build-version></test.dunkel-vcd.build-version>
|
||||
<test.dunkel-vcd.build-version>1.0.1.356485</test.dunkel-vcd.build-version>
|
||||
<test.dunkel-vcd.identity>FIXME_IDENTITY</test.dunkel-vcd.identity>
|
||||
<test.dunkel-vcd.credential>FIXME_CREDENTIAL</test.dunkel-vcd.credential>
|
||||
<test.dunkel-vcd.image-id></test.dunkel-vcd.image-id>
|
||||
<test.dunkel-vcd.image.login-user></test.dunkel-vcd.image.login-user>
|
||||
<test.dunkel-vcd.image.authenticate-sudo></test.dunkel-vcd.image.authenticate-sudo>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
@ -98,14 +100,16 @@
|
|||
<goal>test</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<systemPropertyVariables>
|
||||
<test.dunkel-vcd.endpoint>${test.dunkel-vcd.endpoint}</test.dunkel-vcd.endpoint>
|
||||
<test.dunkel-vcd.api-version>${test.dunkel-vcd.api-version}</test.dunkel-vcd.api-version>
|
||||
<test.dunkel-vcd.build-version>${test.dunkel-vcd.build-version}</test.dunkel-vcd.build-version>
|
||||
<test.dunkel-vcd.identity>${test.dunkel-vcd.identity}</test.dunkel-vcd.identity>
|
||||
<test.dunkel-vcd.credential>${test.dunkel-vcd.credential}</test.dunkel-vcd.credential>
|
||||
<test.dunkel-vcd.image-id>${test.dunkel-vcd.image-id}</test.dunkel-vcd.image-id>
|
||||
</systemPropertyVariables>
|
||||
<systemPropertyVariables>
|
||||
<test.dunkel-vcd.endpoint>${test.dunkel-vcd.endpoint}</test.dunkel-vcd.endpoint>
|
||||
<test.dunkel-vcd.api-version>${test.dunkel-vcd.api-version}</test.dunkel-vcd.api-version>
|
||||
<test.dunkel-vcd.build-version>${test.dunkel-vcd.build-version}</test.dunkel-vcd.build-version>
|
||||
<test.dunkel-vcd.identity>${test.dunkel-vcd.identity}</test.dunkel-vcd.identity>
|
||||
<test.dunkel-vcd.credential>${test.dunkel-vcd.credential}</test.dunkel-vcd.credential>
|
||||
<test.dunkel-vcd.image-id>${test.dunkel-vcd.image-id}</test.dunkel-vcd.image-id>
|
||||
<test.dunkel-vcd.image.login-user>${test.dunkel-vcd.image.login-user}</test.dunkel-vcd.image.login-user>
|
||||
<test.dunkel-vcd.image.authenticate-sudo>${test.dunkel-vcd.image.authenticate-sudo}</test.dunkel-vcd.image.authenticate-sudo>
|
||||
</systemPropertyVariables>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
|
@ -115,6 +119,21 @@
|
|||
</profile>
|
||||
</profiles>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.felix</groupId>
|
||||
<artifactId>maven-bundle-plugin</artifactId>
|
||||
<configuration>
|
||||
<instructions>
|
||||
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
|
||||
<Export-Package>org.jclouds.dunkel.vcd.*;version="${project.version}"</Export-Package>
|
||||
<Import-Package>org.jclouds.*;version="${project.version}",*</Import-Package>
|
||||
</instructions>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
*/
|
||||
package org.jclouds.dunkel.vcd;
|
||||
|
||||
import static org.jclouds.Constants.PROPERTY_BUILD_VERSION;
|
||||
import static org.jclouds.Constants.PROPERTY_ENDPOINT;
|
||||
import static org.jclouds.Constants.PROPERTY_ISO3166_CODES;
|
||||
import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_DEFAULT_NETWORK;
|
||||
|
@ -35,6 +36,7 @@ public class DunkelVCloudDirectorPropertiesBuilder extends VCloudPropertiesBuild
|
|||
protected Properties defaultProperties() {
|
||||
Properties properties = super.defaultProperties();
|
||||
properties.setProperty(PROPERTY_ISO3166_CODES, "DE");
|
||||
properties.setProperty(PROPERTY_BUILD_VERSION, "1.0.1.356485");
|
||||
properties.setProperty(PROPERTY_ENDPOINT, "https://vcd.dunkel.de/api");
|
||||
properties.setProperty(PROPERTY_VCLOUD_DEFAULT_NETWORK, ".*-intranet");
|
||||
return properties;
|
||||
|
|
|
@ -21,8 +21,6 @@ package org.jclouds.dunkel.vcd.config;
|
|||
import org.jclouds.http.RequiresHttp;
|
||||
import org.jclouds.rest.ConfiguresRestClient;
|
||||
import org.jclouds.vcloud.config.VCloudRestClientModule;
|
||||
import org.jclouds.vcloud.filters.SetVCloudTokenCookie;
|
||||
import org.jclouds.dunkel.vcd.filters.SetVCloudTokenCookieAndAuthorizationHeader;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -32,10 +30,4 @@ import org.jclouds.dunkel.vcd.filters.SetVCloudTokenCookieAndAuthorizationHeader
|
|||
@ConfiguresRestClient
|
||||
public class DunkelVCloudDirectorRestClientModule extends VCloudRestClientModule {
|
||||
|
||||
@Override
|
||||
protected void configure() {
|
||||
super.configure();
|
||||
bind(SetVCloudTokenCookie.class).to(SetVCloudTokenCookieAndAuthorizationHeader.class);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,53 +0,0 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.dunkel.vcd.filters;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Provider;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import org.jclouds.http.HttpException;
|
||||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.utils.ModifyRequest;
|
||||
import org.jclouds.vcloud.VCloudToken;
|
||||
import org.jclouds.vcloud.filters.SetVCloudTokenCookie;
|
||||
|
||||
/**
|
||||
* Adds the VCloud Token to the request as a cookie
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*
|
||||
*/
|
||||
@Singleton
|
||||
public class SetVCloudTokenCookieAndAuthorizationHeader extends SetVCloudTokenCookie {
|
||||
|
||||
private final Provider<String> vcloudTokenProvider;
|
||||
|
||||
@Inject
|
||||
public SetVCloudTokenCookieAndAuthorizationHeader(@VCloudToken Provider<String> authTokenProvider) {
|
||||
super(authTokenProvider);
|
||||
this.vcloudTokenProvider = authTokenProvider;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpRequest filter(HttpRequest request) throws HttpException {
|
||||
return ModifyRequest.replaceHeader(super.filter(request), "x-vcloud-authorization", vcloudTokenProvider.get());
|
||||
}
|
||||
|
||||
}
|
|
@ -32,9 +32,4 @@ public class DunkelVCloudDirectorComputeServiceLiveTest extends VCloudComputeSer
|
|||
provider = "dunkel-vcd";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setServiceDefaults() {
|
||||
group = "director";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -28,17 +28,17 @@
|
|||
<relativePath>../../project/pom.xml</relativePath>
|
||||
</parent>
|
||||
<groupId>org.jclouds.provider</groupId>
|
||||
<artifactId>virtacore-vcloudexpress</artifactId>
|
||||
<name>jclouds Virtacore vCloud Express provider</name>
|
||||
<description>vCloud implementation targeted to Virtacore</description>
|
||||
<artifactId>virtacore-publiccloud-lax</artifactId>
|
||||
<name>jclouds Virtacore Public Cloud LAX provider</name>
|
||||
<description>vCloud implementation targeted to Virtacore's LAX datacenter</description>
|
||||
|
||||
<properties>
|
||||
<test.virtacore-vcloudexpress.endpoint>https://vcloud.virtacore.com/api</test.virtacore-vcloudexpress.endpoint>
|
||||
<test.virtacore-vcloudexpress.api-version>1.0</test.virtacore-vcloudexpress.api-version>
|
||||
<test.virtacore-vcloudexpress.build-version></test.virtacore-vcloudexpress.build-version>
|
||||
<test.virtacore-vcloudexpress.identity>FIXME_IDENTITY</test.virtacore-vcloudexpress.identity>
|
||||
<test.virtacore-vcloudexpress.credential>FIXME_CREDENTIAL</test.virtacore-vcloudexpress.credential>
|
||||
<test.virtacore-vcloudexpress.image-id></test.virtacore-vcloudexpress.image-id>
|
||||
<test.virtacore-publiccloud-lax.endpoint>https://cloud.lax.virtacore.com/api/</test.virtacore-publiccloud-lax.endpoint>
|
||||
<test.virtacore-publiccloud-lax.api-version>1.0</test.virtacore-publiccloud-lax.api-version>
|
||||
<test.virtacore-publiccloud-lax.build-version>1.5.0.464915</test.virtacore-publiccloud-lax.build-version>
|
||||
<test.virtacore-publiccloud-lax.identity>FIXME_IDENTITY</test.virtacore-publiccloud-lax.identity>
|
||||
<test.virtacore-publiccloud-lax.credential>FIXME_CREDENTIAL</test.virtacore-publiccloud-lax.credential>
|
||||
<test.virtacore-publiccloud-lax.image-id></test.virtacore-publiccloud-lax.image-id>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
@ -99,12 +99,15 @@
|
|||
</goals>
|
||||
<configuration>
|
||||
<systemPropertyVariables>
|
||||
<test.virtacore-vcloudexpress.endpoint>${test.virtacore-vcloudexpress.endpoint}</test.virtacore-vcloudexpress.endpoint>
|
||||
<test.virtacore-vcloudexpress.api-version>${test.virtacore-vcloudexpress.api-version}</test.virtacore-vcloudexpress.api-version>
|
||||
<test.virtacore-vcloudexpress.build-version>${test.virtacore-vcloudexpress.build-version}</test.virtacore-vcloudexpress.build-version>
|
||||
<test.virtacore-vcloudexpress.identity>${test.virtacore-vcloudexpress.identity}</test.virtacore-vcloudexpress.identity>
|
||||
<test.virtacore-vcloudexpress.credential>${test.virtacore-vcloudexpress.credential}</test.virtacore-vcloudexpress.credential>
|
||||
<test.virtacore-vcloudexpress.image-id>${test.virtacore-vcloudexpress.image-id}</test.virtacore-vcloudexpress.image-id>
|
||||
<test.virtacore-publiccloud-lax.endpoint>${test.virtacore-publiccloud-lax.endpoint}</test.virtacore-publiccloud-lax.endpoint>
|
||||
<test.virtacore-publiccloud-lax.api-version>${test.virtacore-publiccloud-lax.api-version}</test.virtacore-publiccloud-lax.api-version>
|
||||
<test.virtacore-publiccloud-lax.build-version>${test.virtacore-publiccloud-lax.build-version}</test.virtacore-publiccloud-lax.build-version>
|
||||
<test.virtacore-publiccloud-lax.identity>${test.virtacore-publiccloud-lax.identity}</test.virtacore-publiccloud-lax.identity>
|
||||
<test.virtacore-publiccloud-lax.credential>${test.virtacore-publiccloud-lax.credential}</test.virtacore-publiccloud-lax.credential>
|
||||
<test.virtacore-publiccloud-lax.image-id>${test.virtacore-publiccloud-lax.image-id}</test.virtacore-publiccloud-lax.image-id>
|
||||
<test.virtacore-publiccloud-lax.image-id>${test.virtacore-publiccloud-lax.image-id}</test.virtacore-publiccloud-lax.image-id>
|
||||
<test.virtacore-publiccloud-lax.image.login-user>${test.virtacore-publiccloud-lax.image.login-user}</test.virtacore-publiccloud-lax.image.login-user>
|
||||
<test.virtacore-publiccloud-lax.image.authenticate-sudo>${test.virtacore-publiccloud-lax.image.authenticate-sudo}</test.virtacore-publiccloud-lax.image.authenticate-sudo>
|
||||
</systemPropertyVariables>
|
||||
</configuration>
|
||||
</execution>
|
||||
|
@ -116,5 +119,20 @@
|
|||
</profiles>
|
||||
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.felix</groupId>
|
||||
<artifactId>maven-bundle-plugin</artifactId>
|
||||
<configuration>
|
||||
<instructions>
|
||||
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
|
||||
<Export-Package>org.jclouds.virtacore.publiccloud.*;version="${project.version}"</Export-Package>
|
||||
<Import-Package>org.jclouds.*;version="${project.version}",*</Import-Package>
|
||||
</instructions>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
|
@ -16,14 +16,14 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.virtacore.vcloudexpress;
|
||||
package org.jclouds.virtacore.publiccloud;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.jclouds.vcloud.VCloudContextBuilder;
|
||||
import org.jclouds.virtacore.vcloudexpress.config.VirtacoreVCloudExpressComputeServiceContextModule;
|
||||
import org.jclouds.virtacore.vcloudexpress.config.VirtacoreVCloudExpressRestClientModule;
|
||||
import org.jclouds.virtacore.publiccloud.config.VirtacorePublicCloudLAXComputeServiceContextModule;
|
||||
import org.jclouds.virtacore.publiccloud.config.VirtacorePublicCloudLAXRestClientModule;
|
||||
|
||||
import com.google.inject.Module;
|
||||
|
||||
|
@ -32,20 +32,20 @@ import com.google.inject.Module;
|
|||
* @author Adrian Cole
|
||||
*
|
||||
*/
|
||||
public class VirtacoreVCloudExpressContextBuilder extends VCloudContextBuilder {
|
||||
public class VirtacorePublicCloudLAXContextBuilder extends VCloudContextBuilder {
|
||||
|
||||
public VirtacoreVCloudExpressContextBuilder(Properties props) {
|
||||
public VirtacorePublicCloudLAXContextBuilder(Properties props) {
|
||||
super(props);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addContextModule(List<Module> modules) {
|
||||
modules.add(new VirtacoreVCloudExpressComputeServiceContextModule());
|
||||
modules.add(new VirtacorePublicCloudLAXComputeServiceContextModule());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addClientModule(List<Module> modules) {
|
||||
modules.add(new VirtacoreVCloudExpressRestClientModule());
|
||||
modules.add(new VirtacorePublicCloudLAXRestClientModule());
|
||||
}
|
||||
|
||||
}
|
|
@ -16,10 +16,12 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.virtacore.vcloudexpress;
|
||||
package org.jclouds.virtacore.publiccloud;
|
||||
|
||||
import static org.jclouds.Constants.PROPERTY_BUILD_VERSION;
|
||||
import static org.jclouds.Constants.PROPERTY_ENDPOINT;
|
||||
import static org.jclouds.Constants.PROPERTY_ISO3166_CODES;
|
||||
import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_DEFAULT_CATALOG;
|
||||
import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_DEFAULT_NETWORK;
|
||||
|
||||
import java.util.Properties;
|
||||
|
@ -30,17 +32,19 @@ import org.jclouds.vcloud.VCloudPropertiesBuilder;
|
|||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
public class VirtacoreVCloudExpressPropertiesBuilder extends VCloudPropertiesBuilder {
|
||||
public class VirtacorePublicCloudLAXPropertiesBuilder extends VCloudPropertiesBuilder {
|
||||
@Override
|
||||
protected Properties defaultProperties() {
|
||||
Properties properties = super.defaultProperties();
|
||||
properties.setProperty(PROPERTY_ISO3166_CODES, "US-VA,US-CA");
|
||||
properties.setProperty(PROPERTY_ENDPOINT, "https://vcloud.virtacore.com/api");
|
||||
properties.setProperty(PROPERTY_ISO3166_CODES, "US-CA");
|
||||
properties.setProperty(PROPERTY_ENDPOINT, "https://cloud.lax.virtacore.com/api");
|
||||
properties.setProperty(PROPERTY_BUILD_VERSION, "1.5.0.464915");
|
||||
properties.setProperty(PROPERTY_VCLOUD_DEFAULT_NETWORK, ".*-Public");
|
||||
properties.setProperty(PROPERTY_VCLOUD_DEFAULT_CATALOG, "Virtacore Templates - .*");
|
||||
return properties;
|
||||
}
|
||||
|
||||
public VirtacoreVCloudExpressPropertiesBuilder(Properties properties) {
|
||||
public VirtacorePublicCloudLAXPropertiesBuilder(Properties properties) {
|
||||
super(properties);
|
||||
}
|
||||
}
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.virtacore.vcloudexpress;
|
||||
package org.jclouds.virtacore.publiccloud;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
|
@ -27,18 +27,18 @@ import org.jclouds.providers.BaseProviderMetadata;
|
|||
import org.jclouds.providers.ProviderMetadata;
|
||||
|
||||
/**
|
||||
* Implementation of {@link org.jclouds.types.ProviderMetadata} for Virtacore vCloud Express
|
||||
* Implementation of {@link org.jclouds.types.ProviderMetadata} for Virtacore Public Cloud LAX
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
public class VirtacoreVCloudExpressProviderMetadata extends BaseProviderMetadata {
|
||||
public class VirtacorePublicCloudLAXProviderMetadata extends BaseProviderMetadata {
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getId() {
|
||||
return "virtacore-vcloudexpress";
|
||||
return "virtacore-publiccloud-lax";
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -54,7 +54,7 @@ public class VirtacoreVCloudExpressProviderMetadata extends BaseProviderMetadata
|
|||
*/
|
||||
@Override
|
||||
public String getName() {
|
||||
return "Virtacore vCloud Express";
|
||||
return "Virtacore Public Cloud LAX";
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -94,7 +94,7 @@ public class VirtacoreVCloudExpressProviderMetadata extends BaseProviderMetadata
|
|||
*/
|
||||
@Override
|
||||
public URI getApiDocumentation() {
|
||||
return URI.create("http://kb.virtacore.com/categories/vCloud+Express/");
|
||||
return URI.create("http://kb.virtacore.com/questions/100/Does+the+Virtacore+Public+Cloud+have+an+API%3F");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -102,7 +102,7 @@ public class VirtacoreVCloudExpressProviderMetadata extends BaseProviderMetadata
|
|||
*/
|
||||
@Override
|
||||
public Set<String> getLinkedServices() {
|
||||
return ImmutableSet.of("virtacore-vcloudexpress");
|
||||
return ImmutableSet.of("virtacore-publiccloud-lax", "virtacore-publiccloud-iad");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -110,7 +110,7 @@ public class VirtacoreVCloudExpressProviderMetadata extends BaseProviderMetadata
|
|||
*/
|
||||
@Override
|
||||
public Set<String> getIso3166Codes() {
|
||||
return ImmutableSet.of("US-VA","US-CA");
|
||||
return ImmutableSet.of("US-CA");
|
||||
}
|
||||
|
||||
}
|
|
@ -16,8 +16,11 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.virtacore.vcloudexpress.config;
|
||||
package org.jclouds.virtacore.publiccloud.config;
|
||||
|
||||
import static org.jclouds.compute.domain.OsFamily.RHEL;
|
||||
|
||||
import org.jclouds.compute.domain.TemplateBuilder;
|
||||
import org.jclouds.compute.options.TemplateOptions;
|
||||
import org.jclouds.vcloud.compute.config.VCloudComputeServiceContextModule;
|
||||
import org.jclouds.vcloud.compute.options.VCloudTemplateOptions;
|
||||
|
@ -29,7 +32,13 @@ import com.google.inject.Injector;
|
|||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
public class VirtacoreVCloudExpressComputeServiceContextModule extends VCloudComputeServiceContextModule {
|
||||
public class VirtacorePublicCloudLAXComputeServiceContextModule extends VCloudComputeServiceContextModule {
|
||||
|
||||
// CIM ostype does not include version info
|
||||
@Override
|
||||
protected TemplateBuilder provideTemplate(Injector injector, TemplateBuilder template) {
|
||||
return template.osFamily(RHEL).os64Bit(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected TemplateOptions provideTemplateOptions(Injector injector, TemplateOptions options) {
|
|
@ -16,13 +16,11 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.virtacore.vcloudexpress.config;
|
||||
package org.jclouds.virtacore.publiccloud.config;
|
||||
|
||||
import org.jclouds.http.RequiresHttp;
|
||||
import org.jclouds.rest.ConfiguresRestClient;
|
||||
import org.jclouds.vcloud.config.VCloudRestClientModule;
|
||||
import org.jclouds.vcloud.filters.SetVCloudTokenCookie;
|
||||
import org.jclouds.virtacore.vcloudexpress.filters.SetVCloudTokenCookieAndAuthorizationHeader;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -30,12 +28,11 @@ import org.jclouds.virtacore.vcloudexpress.filters.SetVCloudTokenCookieAndAuthor
|
|||
*/
|
||||
@RequiresHttp
|
||||
@ConfiguresRestClient
|
||||
public class VirtacoreVCloudExpressRestClientModule extends VCloudRestClientModule {
|
||||
public class VirtacorePublicCloudLAXRestClientModule extends VCloudRestClientModule {
|
||||
|
||||
@Override
|
||||
protected void configure() {
|
||||
super.configure();
|
||||
bind(SetVCloudTokenCookie.class).to(SetVCloudTokenCookieAndAuthorizationHeader.class);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
org.jclouds.virtacore.publiccloud.VirtacorePublicCloudLAXProviderMetadata
|
|
@ -16,21 +16,21 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.virtacore.vcloudexpress;
|
||||
package org.jclouds.virtacore.publiccloud;
|
||||
|
||||
import org.jclouds.providers.BaseProviderMetadataTest;
|
||||
import org.jclouds.providers.ProviderMetadata;
|
||||
import org.jclouds.virtacore.vcloudexpress.VirtacoreVCloudExpressProviderMetadata;
|
||||
import org.jclouds.virtacore.publiccloud.VirtacorePublicCloudLAXProviderMetadata;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(groups = "unit", testName = "VirtacoreVCloudExpressProviderTest")
|
||||
public class VirtacoreVCloudExpressProviderTest extends BaseProviderMetadataTest {
|
||||
@Test(groups = "unit", testName = "VirtacorePublicCloudLAXProviderTest")
|
||||
public class VirtacorePublicCloudLAXProviderTest extends BaseProviderMetadataTest {
|
||||
|
||||
public VirtacoreVCloudExpressProviderTest() {
|
||||
super(new VirtacoreVCloudExpressProviderMetadata(), ProviderMetadata.COMPUTE_TYPE);
|
||||
public VirtacorePublicCloudLAXProviderTest() {
|
||||
super(new VirtacorePublicCloudLAXProviderMetadata(), ProviderMetadata.COMPUTE_TYPE);
|
||||
}
|
||||
}
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.virtacore.vcloudexpress.compute;
|
||||
package org.jclouds.virtacore.publiccloud.compute;
|
||||
|
||||
import org.jclouds.vcloud.compute.VCloudComputeServiceLiveTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
@ -27,14 +27,9 @@ import org.testng.annotations.Test;
|
|||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(groups = "live", enabled = true, singleThreaded = true)
|
||||
public class VirtacoreVCloudExpressComputeServiceLiveTest extends VCloudComputeServiceLiveTest {
|
||||
public VirtacoreVCloudExpressComputeServiceLiveTest() {
|
||||
provider = "virtacore-vcloudexpress";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setServiceDefaults() {
|
||||
group = "director";
|
||||
public class VirtacorePublicCloudLAXComputeServiceLiveTest extends VCloudComputeServiceLiveTest {
|
||||
public VirtacorePublicCloudLAXComputeServiceLiveTest() {
|
||||
provider = "virtacore-publiccloud-lax";
|
||||
}
|
||||
|
||||
}
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.virtacore.vcloudexpress.compute;
|
||||
package org.jclouds.virtacore.publiccloud.compute;
|
||||
|
||||
import static org.jclouds.compute.util.ComputeServiceUtils.getCores;
|
||||
import static org.testng.Assert.assertEquals;
|
||||
|
@ -31,6 +31,7 @@ import org.jclouds.compute.domain.Template;
|
|||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.base.Predicates;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
/**
|
||||
|
@ -38,42 +39,45 @@ import com.google.common.collect.ImmutableSet;
|
|||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(groups = "live")
|
||||
public class VirtacoreVCloudExpressTemplateBuilderLiveTest extends BaseTemplateBuilderLiveTest {
|
||||
public class VirtacorePublicCloudLAXTemplateBuilderLiveTest extends BaseTemplateBuilderLiveTest {
|
||||
|
||||
public VirtacoreVCloudExpressTemplateBuilderLiveTest() {
|
||||
provider = "virtacore-vcloudexpress";
|
||||
public VirtacorePublicCloudLAXTemplateBuilderLiveTest() {
|
||||
provider = "virtacore-publiccloud-lax";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Predicate<OsFamilyVersion64Bit> defineUnsupportedOperatingSystems() {
|
||||
return new Predicate<OsFamilyVersion64Bit>() {
|
||||
return Predicates.not(new Predicate<OsFamilyVersion64Bit>() {
|
||||
|
||||
@Override
|
||||
public boolean apply(OsFamilyVersion64Bit input) {
|
||||
switch (input.family) {
|
||||
case UBUNTU:
|
||||
return !input.version.equals("");
|
||||
case RHEL:
|
||||
return !input.version.equals("");
|
||||
default:
|
||||
return true;
|
||||
case RHEL:
|
||||
return input.version.equals("");
|
||||
case SUSE:
|
||||
// vCloud Connector
|
||||
return input.version.equals("") && input.is64Bit;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
// NOTE: almost all virtacore templates are dual-network
|
||||
@Override
|
||||
public void testDefaultTemplateBuilder() throws IOException {
|
||||
Template defaultTemplate = context.getComputeService().templateBuilder().build();
|
||||
assertEquals(defaultTemplate.getImage().getName(), "RHEL 5.6 64bit");
|
||||
assertEquals(defaultTemplate.getImage().getOperatingSystem().getVersion(), "");
|
||||
assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), true);
|
||||
assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU);
|
||||
assertEquals(getCores(defaultTemplate.getHardware()), 1.0d);
|
||||
assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.RHEL);
|
||||
assertEquals(getCores(defaultTemplate.getHardware()), 2.0d);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Set<String> getIso3166Codes() {
|
||||
return ImmutableSet.<String> of("US-VA", "US-CA");
|
||||
return ImmutableSet.<String> of("US-CA");
|
||||
}
|
||||
}
|
|
@ -1,53 +0,0 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.virtacore.vcloudexpress.filters;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Provider;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import org.jclouds.http.HttpException;
|
||||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.utils.ModifyRequest;
|
||||
import org.jclouds.vcloud.VCloudToken;
|
||||
import org.jclouds.vcloud.filters.SetVCloudTokenCookie;
|
||||
|
||||
/**
|
||||
* Adds the VCloud Token to the request as a cookie
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*
|
||||
*/
|
||||
@Singleton
|
||||
public class SetVCloudTokenCookieAndAuthorizationHeader extends SetVCloudTokenCookie {
|
||||
|
||||
private final Provider<String> vcloudTokenProvider;
|
||||
|
||||
@Inject
|
||||
public SetVCloudTokenCookieAndAuthorizationHeader(@VCloudToken Provider<String> authTokenProvider) {
|
||||
super(authTokenProvider);
|
||||
this.vcloudTokenProvider = authTokenProvider;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpRequest filter(HttpRequest request) throws HttpException {
|
||||
return ModifyRequest.replaceHeader(super.filter(request), "x-vcloud-authorization", vcloudTokenProvider.get());
|
||||
}
|
||||
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
org.jclouds.virtacore.vcloudexpress.VirtacoreVCloudExpressProviderMetadata
|
Loading…
Reference in New Issue