From d260ce4cc5ac3fbb3941aa23ab540b664485a72e Mon Sep 17 00:00:00 2001 From: danikov Date: Thu, 10 Nov 2011 06:28:19 +0000 Subject: [PATCH] added uk cloudloadbalancer provider --- .../cloudloadbalancers/reference/Region.java | 5 + core/src/main/resources/rest.properties | 3 + providers/cloudloadbalancers-uk/pom.xml | 152 ++++++++++++++++++ ...CloudLoadBalancersUKPropertiesBuilder.java | 61 +++++++ .../CloudLoadBalancersUKProviderMetadata.java | 116 +++++++++++++ .../org.jclouds.providers.ProviderMetadata | 1 + .../CloudLoadBalancersUKClientLiveTest.java | 33 ++++ .../CloudLoadBalancersUKProviderTest.java | 36 +++++ 8 files changed, 407 insertions(+) create mode 100644 providers/cloudloadbalancers-uk/pom.xml create mode 100644 providers/cloudloadbalancers-uk/src/main/java/org/jclouds/rackspace/cloudloadbalancers/CloudLoadBalancersUKPropertiesBuilder.java create mode 100644 providers/cloudloadbalancers-uk/src/main/java/org/jclouds/rackspace/cloudloadbalancers/CloudLoadBalancersUKProviderMetadata.java create mode 100644 providers/cloudloadbalancers-uk/src/main/resources/META-INF/services/org.jclouds.providers.ProviderMetadata create mode 100644 providers/cloudloadbalancers-uk/src/test/java/org/jclouds/rackspace/cloudloadbalancers/CloudLoadBalancersUKClientLiveTest.java create mode 100644 providers/cloudloadbalancers-uk/src/test/java/org/jclouds/rackspace/cloudloadbalancers/CloudLoadBalancersUKProviderTest.java diff --git a/apis/cloudloadbalancers/src/main/java/org/jclouds/cloudloadbalancers/reference/Region.java b/apis/cloudloadbalancers/src/main/java/org/jclouds/cloudloadbalancers/reference/Region.java index 13ad311d2c..b0d40cae6f 100644 --- a/apis/cloudloadbalancers/src/main/java/org/jclouds/cloudloadbalancers/reference/Region.java +++ b/apis/cloudloadbalancers/src/main/java/org/jclouds/cloudloadbalancers/reference/Region.java @@ -50,4 +50,9 @@ public interface Region { */ public final static String DFW = "DFW"; + /** + * London/Slough (LON) https://lon.loadbalancers.api.rackspacecloud.com/v1.0/1234/ + */ + public final static String LON = "LON"; + } diff --git a/core/src/main/resources/rest.properties b/core/src/main/resources/rest.properties index e441344755..f3b3850b55 100644 --- a/core/src/main/resources/rest.properties +++ b/core/src/main/resources/rest.properties @@ -172,6 +172,9 @@ savvis-symphonyvpdc.propertiesbuilder=org.jclouds.savvis.vpdc.VPDCPropertiesBuil cloudloadbalancers-us.contextbuilder=org.jclouds.cloudloadbalancers.CloudLoadBalancersContextBuilder cloudloadbalancers-us.propertiesbuilder=org.jclouds.rackspace.cloudloadbalancers.CloudLoadBalancersUSPropertiesBuilder +cloudloadbalancers-uk.contextbuilder=org.jclouds.cloudloadbalancers.CloudLoadBalancersContextBuilder +cloudloadbalancers-uk.propertiesbuilder=org.jclouds.rackspace.cloudloadbalancers.CloudLoadBalancersUKPropertiesBuilder + cloudfiles-us.contextbuilder=org.jclouds.cloudfiles.CloudFilesContextBuilder cloudfiles-us.propertiesbuilder=org.jclouds.rackspace.cloudfiles.CloudFilesUSPropertiesBuilder diff --git a/providers/cloudloadbalancers-uk/pom.xml b/providers/cloudloadbalancers-uk/pom.xml new file mode 100644 index 0000000000..84ca2f11cb --- /dev/null +++ b/providers/cloudloadbalancers-uk/pom.xml @@ -0,0 +1,152 @@ + + + + 4.0.0 + + org.jclouds + jclouds-project + 1.3.0-SNAPSHOT + ../../project/pom.xml + + org.jclouds.provider + cloudloadbalancers-uk + jclouds CloudLoadBalancers UK provider + LoadBalancer implementation targeted to Rackspace UK + bundle + + + https://lon.auth.api.rackspacecloud.com + 1.0 + ${test.rackspace-uk.identity} + ${test.rackspace-uk.credential} + + + + + org.jclouds.api + cloudloadbalancers + ${project.version} + + + org.jclouds.api + cloudloadbalancers + ${project.version} + test-jar + test + + + org.jclouds + jclouds-loadbalancer + ${project.version} + + + org.jclouds.common + openstack-common + ${project.version} + + + org.jclouds + jclouds-core + ${project.version} + test-jar + test + + + org.jclouds + jclouds-loadbalancer + ${project.version} + test-jar + test + + + org.jclouds.common + openstack-common + ${project.version} + test-jar + test + + + org.jclouds.driver + jclouds-log4j + ${project.version} + test + + + + + live + + + + org.apache.maven.plugins + maven-surefire-plugin + + + integration + integration-test + + test + + + + + test.cloudloadbalancers-uk.endpoint + ${test.cloudloadbalancers-uk.endpoint} + + + test.cloudloadbalancers-uk.apiversion + ${test.cloudloadbalancers-uk.apiversion} + + + test.cloudloadbalancers-uk.identity + ${test.cloudloadbalancers-uk.identity} + + + test.cloudloadbalancers-uk.credential + ${test.cloudloadbalancers-uk.credential} + + + + + + + + + + + + + + + org.apache.felix + maven-bundle-plugin + + + ${project.artifactId} + org.jclouds.rackspace.cloudloadbalancers.*;version="${project.version}" + org.jclouds.*;version="${project.version}",* + + + + + + diff --git a/providers/cloudloadbalancers-uk/src/main/java/org/jclouds/rackspace/cloudloadbalancers/CloudLoadBalancersUKPropertiesBuilder.java b/providers/cloudloadbalancers-uk/src/main/java/org/jclouds/rackspace/cloudloadbalancers/CloudLoadBalancersUKPropertiesBuilder.java new file mode 100644 index 0000000000..15e09ce7cf --- /dev/null +++ b/providers/cloudloadbalancers-uk/src/main/java/org/jclouds/rackspace/cloudloadbalancers/CloudLoadBalancersUKPropertiesBuilder.java @@ -0,0 +1,61 @@ +/** + * 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.rackspace.cloudloadbalancers; + +import static org.jclouds.Constants.PROPERTY_API_VERSION; +import static org.jclouds.Constants.PROPERTY_ENDPOINT; +import static org.jclouds.Constants.PROPERTY_ISO3166_CODES; +import static org.jclouds.cloudloadbalancers.reference.RackspaceConstants.PROPERTY_ACCOUNT_ID; +import static org.jclouds.cloudloadbalancers.reference.Region.LON; +import static org.jclouds.location.reference.LocationConstants.ENDPOINT; +import static org.jclouds.location.reference.LocationConstants.ISO3166_CODES; +import static org.jclouds.location.reference.LocationConstants.PROPERTY_REGION; +import static org.jclouds.location.reference.LocationConstants.PROPERTY_REGIONS; + +import java.util.Properties; + +import org.jclouds.PropertiesBuilder; + +/** + * Builds properties used inRackspace Cloud Load Balancers Clients + * + * @author Dan Lo Bianco + */ +public class CloudLoadBalancersUKPropertiesBuilder extends PropertiesBuilder { + @Override + protected Properties defaultProperties() { + Properties properties = super.defaultProperties(); + properties.setProperty(PROPERTY_API_VERSION, "1.0"); + properties.setProperty(PROPERTY_REGIONS, "UK"); + properties.setProperty(PROPERTY_ENDPOINT, "https://lon.auth.api.rackspacecloud.com"); + properties.setProperty(PROPERTY_ISO3166_CODES, "GB-SLG"); + + properties.setProperty(PROPERTY_REGION + "." + LON + "." + ISO3166_CODES, "GB-SLG"); + properties.setProperty(PROPERTY_REGION + "." + LON + "." + ENDPOINT, String + .format("https://lon.loadbalancers.api.rackspacecloud.com/v{%s}/{%s}", PROPERTY_API_VERSION, + PROPERTY_ACCOUNT_ID)); + + return properties; + } + + public CloudLoadBalancersUKPropertiesBuilder(Properties properties) { + super(properties); + } + +} diff --git a/providers/cloudloadbalancers-uk/src/main/java/org/jclouds/rackspace/cloudloadbalancers/CloudLoadBalancersUKProviderMetadata.java b/providers/cloudloadbalancers-uk/src/main/java/org/jclouds/rackspace/cloudloadbalancers/CloudLoadBalancersUKProviderMetadata.java new file mode 100644 index 0000000000..6f4fea16ce --- /dev/null +++ b/providers/cloudloadbalancers-uk/src/main/java/org/jclouds/rackspace/cloudloadbalancers/CloudLoadBalancersUKProviderMetadata.java @@ -0,0 +1,116 @@ +/** + * 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.rackspace.cloudloadbalancers; + +import com.google.common.collect.ImmutableSet; + +import java.net.URI; +import java.util.Set; + +import org.jclouds.providers.BaseProviderMetadata; +import org.jclouds.providers.ProviderMetadata; + +/** + * Implementation of {@link org.jclouds.types.ProviderMetadata} for Rackspace Cloud LoadBalancers in UK. + * + * @author Dan Lo Bianco + */ +public class CloudLoadBalancersUKProviderMetadata extends BaseProviderMetadata { + + /** + * {@inheritDoc} + */ + @Override + public String getId() { + return "cloudloadbalancers-uk"; + } + + /** + * {@inheritDoc} + */ + @Override + public String getType() { + return ProviderMetadata.LOADBALANCER_TYPE; + } + + /** + * {@inheritDoc} + */ + @Override + public String getName() { + return "Rackspace Cloud Load Balancers UK"; + } + + /** + * {@inheritDoc} + */ + @Override + public String getIdentityName() { + return "Username"; + } + + /** + * {@inheritDoc} + */ + @Override + public String getCredentialName() { + return "API Key"; + } + + /** + * {@inheritDoc} + */ + @Override + public URI getHomepage() { + return URI.create("http://www.rackspace.com/cloud/cloud_hosting_products/loadbalancers"); + } + + /** + * {@inheritDoc} + */ + @Override + public URI getConsole() { + return URI.create("https://manage.rackspacecloud.com"); + } + + /** + * {@inheritDoc} + */ + @Override + public URI getApiDocumentation() { + return URI.create("http://docs.rackspacecloud.com/loadbalancers/api/v1.0/clb-devguide/content/ch01.html"); + } + + /** + * {@inheritDoc} + */ + @Override + public Set getLinkedServices() { + return ImmutableSet.of("cloudfiles-uk", "cloudservers-uk", "cloudloadbalancers-uk"); + } + + /** + * {@inheritDoc} + */ + @Override + public Set getIso3166Codes() { + return ImmutableSet.of("GB-SLG"); + } + +} \ No newline at end of file diff --git a/providers/cloudloadbalancers-uk/src/main/resources/META-INF/services/org.jclouds.providers.ProviderMetadata b/providers/cloudloadbalancers-uk/src/main/resources/META-INF/services/org.jclouds.providers.ProviderMetadata new file mode 100644 index 0000000000..1b6ed19515 --- /dev/null +++ b/providers/cloudloadbalancers-uk/src/main/resources/META-INF/services/org.jclouds.providers.ProviderMetadata @@ -0,0 +1 @@ +org.jclouds.rackspace.cloudloadbalancers.CloudLoadBalancersUKProviderMetadata diff --git a/providers/cloudloadbalancers-uk/src/test/java/org/jclouds/rackspace/cloudloadbalancers/CloudLoadBalancersUKClientLiveTest.java b/providers/cloudloadbalancers-uk/src/test/java/org/jclouds/rackspace/cloudloadbalancers/CloudLoadBalancersUKClientLiveTest.java new file mode 100644 index 0000000000..39826465b9 --- /dev/null +++ b/providers/cloudloadbalancers-uk/src/test/java/org/jclouds/rackspace/cloudloadbalancers/CloudLoadBalancersUKClientLiveTest.java @@ -0,0 +1,33 @@ +/** + * 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.rackspace.cloudloadbalancers; + +import org.jclouds.cloudloadbalancers.features.LoadBalancerClientLiveTest; +import org.testng.annotations.Test; + +/** + * + * @author Dan Lo Bianco + */ +@Test(groups = "live", singleThreaded = true) +public class CloudLoadBalancersUKClientLiveTest extends LoadBalancerClientLiveTest { + public CloudLoadBalancersUKClientLiveTest() { + provider = "cloudloadbalancers-uk"; + } +} diff --git a/providers/cloudloadbalancers-uk/src/test/java/org/jclouds/rackspace/cloudloadbalancers/CloudLoadBalancersUKProviderTest.java b/providers/cloudloadbalancers-uk/src/test/java/org/jclouds/rackspace/cloudloadbalancers/CloudLoadBalancersUKProviderTest.java new file mode 100644 index 0000000000..b7673b6aac --- /dev/null +++ b/providers/cloudloadbalancers-uk/src/test/java/org/jclouds/rackspace/cloudloadbalancers/CloudLoadBalancersUKProviderTest.java @@ -0,0 +1,36 @@ +/** + * 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.rackspace.cloudloadbalancers; + +import org.jclouds.providers.BaseProviderMetadataTest; +import org.jclouds.providers.ProviderMetadata; +import org.jclouds.rackspace.cloudloadbalancers.CloudLoadBalancersUKProviderMetadata; +import org.testng.annotations.Test; + +/** + * + * @author Dan Lo Bianco + */ +@Test(groups = "unit", testName = "CloudLoadBalancersUKProviderTest") +public class CloudLoadBalancersUKProviderTest extends BaseProviderMetadataTest { + + public CloudLoadBalancersUKProviderTest() { + super(new CloudLoadBalancersUKProviderMetadata(), ProviderMetadata.LOADBALANCER_TYPE); + } +} \ No newline at end of file