You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jclouds.apache.org by na...@apache.org on 2014/10/27 18:25:50 UTC
[3/3] git commit: JCLOUDS-292: Added CloudSigma2 ComputeService
JCLOUDS-292: Added CloudSigma2 ComputeService
* Added the ComputeService implementation
* Added the San Jose region
* Added the Honolulu region
Project: http://git-wip-us.apache.org/repos/asf/jclouds-labs/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds-labs/commit/a7dd1933
Tree: http://git-wip-us.apache.org/repos/asf/jclouds-labs/tree/a7dd1933
Diff: http://git-wip-us.apache.org/repos/asf/jclouds-labs/diff/a7dd1933
Branch: refs/heads/master
Commit: a7dd1933d8ca283e1118b538be8aa2e2ac5e8be7
Parents: 75178c7
Author: Vladimir Shevchenko <sh...@gmail.com>
Authored: Thu Jun 12 04:29:25 2014 +0700
Committer: Ignasi Barrera <na...@apache.org>
Committed: Mon Oct 27 18:24:56 2014 +0100
----------------------------------------------------------------------
cloudsigma2-hnl/pom.xml | 127 ++++++
.../CloudSigma2HonoluluProviderMetadata.java | 80 ++++
.../org.jclouds.providers.ProviderMetadata | 1 +
.../CloudSigma2HonoluluLiveTest.java | 27 ++
...oudSigma2HonoluluComputeServiceLiveTest.java | 28 ++
cloudsigma2-lvs/pom.xml | 3 +-
.../CloudSigma2LasVegasLiveTest.java | 11 +-
...oudSigma2LasVegasComputeServiceLiveTest.java | 28 ++
cloudsigma2-sjc/pom.xml | 127 ++++++
.../CloudSigma2SanJoseProviderMetadata.java | 80 ++++
.../org.jclouds.providers.ProviderMetadata | 1 +
.../cloudsigma2/CloudSigma2SanJoseLiveTest.java | 27 ++
...loudSigma2SanJoseComputeServiceLiveTest.java | 28 ++
cloudsigma2-wdc/pom.xml | 3 +-
.../CloudSigma2WashingtonLiveTest.java | 9 +-
...dSigma2WashingtonComputeServiceLiveTest.java | 28 ++
cloudsigma2-zrh/pom.xml | 3 +-
.../cloudsigma2/CloudSigma2ZurichLiveTest.java | 11 +-
...CloudSigma2ZurichComputeServiceLiveTest.java | 28 ++
cloudsigma2/pom.xml | 2 +-
.../org/jclouds/cloudsigma2/CloudSigma2Api.java | 119 +++---
.../cloudsigma2/CloudSigma2ApiMetadata.java | 24 +-
.../BindCreateSubscriptionRequestList.java | 3 +
.../cloudsigma2/binders/BindDrivesToJson.java | 3 +
.../BindFirewallPoliciesListToJsonRequest.java | 3 +
.../BindServerInfoListToJsonRequest.java | 3 +
.../binders/BindTagListToJsonRequest.java | 3 +
.../binders/BindUuidStringsToJsonArray.java | 3 +
.../CloudSigma2ComputeServiceContextModule.java | 177 ++++++++
.../compute/functions/LibraryDriveToImage.java | 61 +++
.../compute/functions/NICToAddress.java | 55 +++
.../compute/functions/ServerDriveToVolume.java | 52 +++
.../functions/ServerInfoToNodeMetadata.java | 135 ++++++
...plateOptionsToStatementWithoutPublicKey.java | 59 +++
.../options/CloudSigma2TemplateOptions.java | 153 +++++++
.../CloudSigma2ComputeServiceAdapter.java | 407 +++++++++++++++++++
.../config/CloudSigma2Properties.java | 15 +-
.../org/jclouds/cloudsigma2/domain/Drive.java | 2 +-
.../domain/DrivesListRequestFieldsGroup.java | 16 +-
.../cloudsigma2/domain/FirewallPolicy.java | 43 +-
.../cloudsigma2/domain/LibraryDrive.java | 35 +-
.../domain/ServerAvailabilityGroup.java | 17 +-
.../jclouds/cloudsigma2/domain/ServerDrive.java | 30 +-
.../jclouds/cloudsigma2/domain/ServerInfo.java | 10 +-
.../functions/internal/ParseTags.java | 21 -
.../handlers/CloudSigmaErrorHandler.java | 12 +-
.../cloudsigma2/CloudSigma2ApiExpectTest.java | 115 +++---
.../cloudsigma2/CloudSigma2ApiLiveTest.java | 71 +++-
.../CloudSigma2ComputeServiceLiveTest.java | 56 +++
.../config/DriveClonedPredicateTest.java | 60 +++
.../ServerStatusPredicatePredicateTest.java | 54 +++
.../functions/LibraryDriveToImageTest.java | 83 ++++
.../compute/functions/NICToAddressTest.java | 90 ++++
.../functions/ServerDriveToVolumeTest.java | 79 ++++
.../functions/ServerInfoToNodeMetadataTest.java | 186 +++++++++
...eOptionsToStatementWithoutPublicKeyTest.java | 75 ++++
.../options/CloudSigma2TemplateOptionsTest.java | 49 +++
.../functions/ServerInfoToJsonTest.java | 36 +-
.../src/test/resources/drive-cloned.json | 57 +++
.../test/resources/fwpolicies-get-single.json | 61 +++
.../src/test/resources/libdrives-cloned.json | 34 ++
.../resources/server-detail-first-page.json | 4 +-
.../src/test/resources/server-detail.json | 4 +-
.../src/test/resources/servers-single.json | 4 +-
pom.xml | 2 +
65 files changed, 2991 insertions(+), 242 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/a7dd1933/cloudsigma2-hnl/pom.xml
----------------------------------------------------------------------
diff --git a/cloudsigma2-hnl/pom.xml b/cloudsigma2-hnl/pom.xml
new file mode 100644
index 0000000..4a58c7f
--- /dev/null
+++ b/cloudsigma2-hnl/pom.xml
@@ -0,0 +1,127 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF 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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.jclouds.labs</groupId>
+ <artifactId>jclouds-labs</artifactId>
+ <version>2.0.0-SNAPSHOT</version>
+ </parent>
+
+ <!-- TODO: when out of labs, switch to org.jclouds.provider -->
+ <groupId>org.apache.jclouds.labs</groupId>
+ <artifactId>cloudsigma2-hnl</artifactId>
+ <version>2.0.0-SNAPSHOT</version>
+ <name>jclouds CloudSigma v2 Honolulu Provider</name>
+ <description>ComputeService binding to the CloudSigma datacenter in Honolulu</description>
+ <packaging>bundle</packaging>
+
+ <properties>
+ <test.cloudsigma2-hnl.endpoint>https://hnl.cloudsigma.com/api/2.0/</test.cloudsigma2-hnl.endpoint>
+ <test.cloudsigma2-hnl.api-version>2.0</test.cloudsigma2-hnl.api-version>
+ <test.cloudsigma2-hnl.build-version />
+ <test.cloudsigma2-hnl.identity>FIXME</test.cloudsigma2-hnl.identity>
+ <test.cloudsigma2-hnl.credential>FIXME</test.cloudsigma2-hnl.credential>
+ <!-- Ubuntu 14.04 Cloud Image -->
+ <test.cloudsigma2-hnl.template>imageId=9e0400ab-d911-4232-971d-f552330b61be,loginUser=ubuntu</test.cloudsigma2-hnl.template>
+ <jclouds.osgi.export>org.jclouds.cloudsigma2*;version="${project.version}"</jclouds.osgi.export>
+ <jclouds.osgi.import>
+ org.jclouds.compute.internal;version="${project.version}",
+ org.jclouds.rest.internal;version="${project.version}",
+ org.jclouds*;version="${project.version}",
+ *
+ </jclouds.osgi.import>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.jclouds.labs</groupId>
+ <artifactId>cloudsigma2</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.jclouds.labs</groupId>
+ <artifactId>cloudsigma2</artifactId>
+ <version>${project.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.jclouds</groupId>
+ <artifactId>jclouds-core</artifactId>
+ <version>${project.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.jclouds</groupId>
+ <artifactId>jclouds-compute</artifactId>
+ <version>${project.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.jclouds.driver</groupId>
+ <artifactId>jclouds-log4j</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.jclouds.driver</groupId>
+ <artifactId>jclouds-sshj</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <profiles>
+ <profile>
+ <id>live</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>integration</id>
+ <phase>integration-test</phase>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <systemPropertyVariables>
+ <test.cloudsigma2-hnl.endpoint>${test.cloudsigma2-hnl.endpoint}</test.cloudsigma2-hnl.endpoint>
+ <test.cloudsigma2-hnl.api-version>${test.cloudsigma2-hnl.api-version}</test.cloudsigma2-hnl.api-version>
+ <test.cloudsigma2-hnl.build-version>${test.cloudsigma2-hnl.build-version}</test.cloudsigma2-hnl.build-version>
+ <test.cloudsigma2-hnl.identity>${test.cloudsigma2-hnl.identity}</test.cloudsigma2-hnl.identity>
+ <test.cloudsigma2-hnl.credential>${test.cloudsigma2-hnl.credential}</test.cloudsigma2-hnl.credential>
+ <test.cloudsigma2-hnl.template>${test.cloudsigma2-hnl.template}</test.cloudsigma2-hnl.template>
+ </systemPropertyVariables>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+</project>
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/a7dd1933/cloudsigma2-hnl/src/main/java/org/jclouds/cloudsigma2/CloudSigma2HonoluluProviderMetadata.java
----------------------------------------------------------------------
diff --git a/cloudsigma2-hnl/src/main/java/org/jclouds/cloudsigma2/CloudSigma2HonoluluProviderMetadata.java b/cloudsigma2-hnl/src/main/java/org/jclouds/cloudsigma2/CloudSigma2HonoluluProviderMetadata.java
new file mode 100644
index 0000000..ed5860c
--- /dev/null
+++ b/cloudsigma2-hnl/src/main/java/org/jclouds/cloudsigma2/CloudSigma2HonoluluProviderMetadata.java
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.cloudsigma2;
+
+import java.net.URI;
+import java.util.Properties;
+
+import org.jclouds.providers.ProviderMetadata;
+import org.jclouds.providers.internal.BaseProviderMetadata;
+
+/**
+ * Implementation of {@link org.jclouds.providers.internal.BaseProviderMetadata} for CloudSigma Honolulu.
+ */
+public class CloudSigma2HonoluluProviderMetadata extends BaseProviderMetadata {
+
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ @Override
+ public Builder toBuilder() {
+ return builder().fromProviderMetadata(this);
+ }
+
+ public CloudSigma2HonoluluProviderMetadata() {
+ super(builder());
+ }
+
+ public CloudSigma2HonoluluProviderMetadata(Builder builder) {
+ super(builder);
+ }
+
+ public static Properties defaultProperties() {
+ Properties properties = new Properties();
+ return properties;
+ }
+
+ public static class Builder
+ extends
+ BaseProviderMetadata.Builder {
+
+ protected Builder() {
+ id("cloudsigma2-hnl")
+ .name("CloudSigma 2 Honolulu")
+ .apiMetadata(new CloudSigma2ApiMetadata())
+ .homepage(URI.create("http://www.cloudsigma.com/en/our-cloud/features"))
+ .console(URI.create("https://gui.hnl.cloudsigma.com/"))
+ .iso3166Codes("US-NV")
+ .endpoint("https://hnl.cloudsigma.com/api/2.0/")
+ .defaultProperties(CloudSigma2HonoluluProviderMetadata.defaultProperties());
+ }
+
+ @Override
+ public CloudSigma2HonoluluProviderMetadata build() {
+ return new CloudSigma2HonoluluProviderMetadata(this);
+ }
+
+ @Override
+ public Builder fromProviderMetadata(
+ ProviderMetadata in) {
+ super.fromProviderMetadata(in);
+ return this;
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/a7dd1933/cloudsigma2-hnl/src/main/resources/META-INF/services/org.jclouds.providers.ProviderMetadata
----------------------------------------------------------------------
diff --git a/cloudsigma2-hnl/src/main/resources/META-INF/services/org.jclouds.providers.ProviderMetadata b/cloudsigma2-hnl/src/main/resources/META-INF/services/org.jclouds.providers.ProviderMetadata
new file mode 100644
index 0000000..01eff09
--- /dev/null
+++ b/cloudsigma2-hnl/src/main/resources/META-INF/services/org.jclouds.providers.ProviderMetadata
@@ -0,0 +1 @@
+org.jclouds.cloudsigma2.CloudSigma2HonoluluProviderMetadata
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/a7dd1933/cloudsigma2-hnl/src/test/java/org/jclouds/cloudsigma2/CloudSigma2HonoluluLiveTest.java
----------------------------------------------------------------------
diff --git a/cloudsigma2-hnl/src/test/java/org/jclouds/cloudsigma2/CloudSigma2HonoluluLiveTest.java b/cloudsigma2-hnl/src/test/java/org/jclouds/cloudsigma2/CloudSigma2HonoluluLiveTest.java
new file mode 100644
index 0000000..d980ffd
--- /dev/null
+++ b/cloudsigma2-hnl/src/test/java/org/jclouds/cloudsigma2/CloudSigma2HonoluluLiveTest.java
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.cloudsigma2;
+
+import org.testng.annotations.Test;
+
+@Test(groups = "live", testName = "CloudSigma2HonoluluLiveTest")
+public class CloudSigma2HonoluluLiveTest extends CloudSigma2ApiLiveTest {
+
+ public CloudSigma2HonoluluLiveTest() {
+ provider = "cloudsigma2-hnl";
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/a7dd1933/cloudsigma2-hnl/src/test/java/org/jclouds/cloudsigma2/compute/CloudSigma2HonoluluComputeServiceLiveTest.java
----------------------------------------------------------------------
diff --git a/cloudsigma2-hnl/src/test/java/org/jclouds/cloudsigma2/compute/CloudSigma2HonoluluComputeServiceLiveTest.java b/cloudsigma2-hnl/src/test/java/org/jclouds/cloudsigma2/compute/CloudSigma2HonoluluComputeServiceLiveTest.java
new file mode 100644
index 0000000..3d97ed1
--- /dev/null
+++ b/cloudsigma2-hnl/src/test/java/org/jclouds/cloudsigma2/compute/CloudSigma2HonoluluComputeServiceLiveTest.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.cloudsigma2.compute;
+
+import org.testng.annotations.Test;
+
+@Test(groups = "live", testName = "CloudSigma2HonoluluComputeServiceLiveTest")
+public class CloudSigma2HonoluluComputeServiceLiveTest extends CloudSigma2ComputeServiceLiveTest {
+
+ public CloudSigma2HonoluluComputeServiceLiveTest() {
+ provider = "cloudsigma2-hnl";
+ group = "cloudsigma2";
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/a7dd1933/cloudsigma2-lvs/pom.xml
----------------------------------------------------------------------
diff --git a/cloudsigma2-lvs/pom.xml b/cloudsigma2-lvs/pom.xml
index 54874c8..699b963 100644
--- a/cloudsigma2-lvs/pom.xml
+++ b/cloudsigma2-lvs/pom.xml
@@ -39,7 +39,8 @@
<test.cloudsigma2-lvs.build-version />
<test.cloudsigma2-lvs.identity>FIXME</test.cloudsigma2-lvs.identity>
<test.cloudsigma2-lvs.credential>FIXME</test.cloudsigma2-lvs.credential>
- <test.cloudsigma2-lvs.template />
+ <!-- Ubuntu 14.04 Cloud Image -->
+ <test.cloudsigma2-lvs.template>imageId=9e0400ab-d911-4232-971d-f552330b61be,loginUser=ubuntu</test.cloudsigma2-lvs.template>
<jclouds.osgi.export>org.jclouds.cloudsigma2*;version="${project.version}"</jclouds.osgi.export>
<jclouds.osgi.import>
org.jclouds.compute.internal;version="${project.version}",
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/a7dd1933/cloudsigma2-lvs/src/test/java/org/jclouds/cloudsigma2/CloudSigma2LasVegasLiveTest.java
----------------------------------------------------------------------
diff --git a/cloudsigma2-lvs/src/test/java/org/jclouds/cloudsigma2/CloudSigma2LasVegasLiveTest.java b/cloudsigma2-lvs/src/test/java/org/jclouds/cloudsigma2/CloudSigma2LasVegasLiveTest.java
index 5a560cd..e42523e 100644
--- a/cloudsigma2-lvs/src/test/java/org/jclouds/cloudsigma2/CloudSigma2LasVegasLiveTest.java
+++ b/cloudsigma2-lvs/src/test/java/org/jclouds/cloudsigma2/CloudSigma2LasVegasLiveTest.java
@@ -18,9 +18,10 @@ package org.jclouds.cloudsigma2;
import org.testng.annotations.Test;
-@Test(groups = {"live"})
-public class CloudSigma2LasVegasLiveTest extends CloudSigma2ApiLiveTest{
- public CloudSigma2LasVegasLiveTest() {
- provider = "cloudsigma2-lvs";
- }
+@Test(groups = "live", testName = "CloudSigma2LasVegasLiveTest")
+public class CloudSigma2LasVegasLiveTest extends CloudSigma2ApiLiveTest {
+
+ public CloudSigma2LasVegasLiveTest() {
+ provider = "cloudsigma2-lvs";
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/a7dd1933/cloudsigma2-lvs/src/test/java/org/jclouds/cloudsigma2/compute/CloudSigma2LasVegasComputeServiceLiveTest.java
----------------------------------------------------------------------
diff --git a/cloudsigma2-lvs/src/test/java/org/jclouds/cloudsigma2/compute/CloudSigma2LasVegasComputeServiceLiveTest.java b/cloudsigma2-lvs/src/test/java/org/jclouds/cloudsigma2/compute/CloudSigma2LasVegasComputeServiceLiveTest.java
new file mode 100644
index 0000000..f4f4aaf
--- /dev/null
+++ b/cloudsigma2-lvs/src/test/java/org/jclouds/cloudsigma2/compute/CloudSigma2LasVegasComputeServiceLiveTest.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.cloudsigma2.compute;
+
+import org.testng.annotations.Test;
+
+@Test(groups = "live", testName = "CloudSigma2LasVegasComputeServiceLiveTest")
+public class CloudSigma2LasVegasComputeServiceLiveTest extends CloudSigma2ComputeServiceLiveTest {
+
+ public CloudSigma2LasVegasComputeServiceLiveTest() {
+ provider = "cloudsigma2-lvs";
+ group = "cloudsigma2";
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/a7dd1933/cloudsigma2-sjc/pom.xml
----------------------------------------------------------------------
diff --git a/cloudsigma2-sjc/pom.xml b/cloudsigma2-sjc/pom.xml
new file mode 100644
index 0000000..a4b2200
--- /dev/null
+++ b/cloudsigma2-sjc/pom.xml
@@ -0,0 +1,127 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF 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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.jclouds.labs</groupId>
+ <artifactId>jclouds-labs</artifactId>
+ <version>2.0.0-SNAPSHOT</version>
+ </parent>
+
+ <!-- TODO: when out of labs, switch to org.jclouds.provider -->
+ <groupId>org.apache.jclouds.labs</groupId>
+ <artifactId>cloudsigma2-sjc</artifactId>
+ <version>2.0.0-SNAPSHOT</version>
+ <name>jclouds CloudSigma v2 San Jose Provider</name>
+ <description>ComputeService binding to the CloudSigma datacenter in San Jose</description>
+ <packaging>bundle</packaging>
+
+ <properties>
+ <test.cloudsigma2-sjc.endpoint>https://sjc.cloudsigma.com/api/2.0/</test.cloudsigma2-sjc.endpoint>
+ <test.cloudsigma2-sjc.api-version>2.0</test.cloudsigma2-sjc.api-version>
+ <test.cloudsigma2-sjc.build-version />
+ <test.cloudsigma2-sjc.identity>FIXME</test.cloudsigma2-sjc.identity>
+ <test.cloudsigma2-sjc.credential>FIXME</test.cloudsigma2-sjc.credential>
+ <!-- Ubuntu 14.04 Cloud Image -->
+ <test.cloudsigma2-sjc.template>imageId=4e1fb3af-5da9-4575-9b38-b8adac549aad,loginUser=ubuntu</test.cloudsigma2-sjc.template>
+ <jclouds.osgi.export>org.jclouds.cloudsigma2*;version="${project.version}"</jclouds.osgi.export>
+ <jclouds.osgi.import>
+ org.jclouds.compute.internal;version="${project.version}",
+ org.jclouds.rest.internal;version="${project.version}",
+ org.jclouds*;version="${project.version}",
+ *
+ </jclouds.osgi.import>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.jclouds.labs</groupId>
+ <artifactId>cloudsigma2</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.jclouds.labs</groupId>
+ <artifactId>cloudsigma2</artifactId>
+ <version>${project.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.jclouds</groupId>
+ <artifactId>jclouds-core</artifactId>
+ <version>${project.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.jclouds</groupId>
+ <artifactId>jclouds-compute</artifactId>
+ <version>${project.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.jclouds.driver</groupId>
+ <artifactId>jclouds-log4j</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.jclouds.driver</groupId>
+ <artifactId>jclouds-sshj</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <profiles>
+ <profile>
+ <id>live</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>integration</id>
+ <phase>integration-test</phase>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <systemPropertyVariables>
+ <test.cloudsigma2-sjc.endpoint>${test.cloudsigma2-sjc.endpoint}</test.cloudsigma2-sjc.endpoint>
+ <test.cloudsigma2-sjc.api-version>${test.cloudsigma2-sjc.api-version}</test.cloudsigma2-sjc.api-version>
+ <test.cloudsigma2-sjc.build-version>${test.cloudsigma2-sjc.build-version}</test.cloudsigma2-sjc.build-version>
+ <test.cloudsigma2-sjc.identity>${test.cloudsigma2-sjc.identity}</test.cloudsigma2-sjc.identity>
+ <test.cloudsigma2-sjc.credential>${test.cloudsigma2-sjc.credential}</test.cloudsigma2-sjc.credential>
+ <test.cloudsigma2-sjc.template>${test.cloudsigma2-sjc.template}</test.cloudsigma2-sjc.template>
+ </systemPropertyVariables>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+</project>
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/a7dd1933/cloudsigma2-sjc/src/main/java/org/jclouds/cloudsigma2/CloudSigma2SanJoseProviderMetadata.java
----------------------------------------------------------------------
diff --git a/cloudsigma2-sjc/src/main/java/org/jclouds/cloudsigma2/CloudSigma2SanJoseProviderMetadata.java b/cloudsigma2-sjc/src/main/java/org/jclouds/cloudsigma2/CloudSigma2SanJoseProviderMetadata.java
new file mode 100644
index 0000000..b47b399
--- /dev/null
+++ b/cloudsigma2-sjc/src/main/java/org/jclouds/cloudsigma2/CloudSigma2SanJoseProviderMetadata.java
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.cloudsigma2;
+
+import java.net.URI;
+import java.util.Properties;
+
+import org.jclouds.providers.ProviderMetadata;
+import org.jclouds.providers.internal.BaseProviderMetadata;
+
+/**
+ * Implementation of {@link org.jclouds.providers.internal.BaseProviderMetadata} for CloudSigma San Jose.
+ */
+public class CloudSigma2SanJoseProviderMetadata extends BaseProviderMetadata {
+
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ @Override
+ public Builder toBuilder() {
+ return builder().fromProviderMetadata(this);
+ }
+
+ public CloudSigma2SanJoseProviderMetadata() {
+ super(builder());
+ }
+
+ public CloudSigma2SanJoseProviderMetadata(Builder builder) {
+ super(builder);
+ }
+
+ public static Properties defaultProperties() {
+ Properties properties = new Properties();
+ return properties;
+ }
+
+ public static class Builder
+ extends
+ BaseProviderMetadata.Builder {
+
+ protected Builder() {
+ id("cloudsigma2-sjc")
+ .name("CloudSigma 2 San Jose")
+ .apiMetadata(new CloudSigma2ApiMetadata())
+ .homepage(URI.create("http://www.cloudsigma.com/en/our-cloud/features"))
+ .console(URI.create("https://gui.sjc.cloudsigma.com/"))
+ .iso3166Codes("US-CA")
+ .endpoint("https://sjc.cloudsigma.com/api/2.0/")
+ .defaultProperties(CloudSigma2SanJoseProviderMetadata.defaultProperties());
+ }
+
+ @Override
+ public CloudSigma2SanJoseProviderMetadata build() {
+ return new CloudSigma2SanJoseProviderMetadata(this);
+ }
+
+ @Override
+ public Builder fromProviderMetadata(
+ ProviderMetadata in) {
+ super.fromProviderMetadata(in);
+ return this;
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/a7dd1933/cloudsigma2-sjc/src/main/resources/META-INF/services/org.jclouds.providers.ProviderMetadata
----------------------------------------------------------------------
diff --git a/cloudsigma2-sjc/src/main/resources/META-INF/services/org.jclouds.providers.ProviderMetadata b/cloudsigma2-sjc/src/main/resources/META-INF/services/org.jclouds.providers.ProviderMetadata
new file mode 100644
index 0000000..d8aa542
--- /dev/null
+++ b/cloudsigma2-sjc/src/main/resources/META-INF/services/org.jclouds.providers.ProviderMetadata
@@ -0,0 +1 @@
+org.jclouds.cloudsigma2.CloudSigma2SanJoseProviderMetadata
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/a7dd1933/cloudsigma2-sjc/src/test/java/org/jclouds/cloudsigma2/CloudSigma2SanJoseLiveTest.java
----------------------------------------------------------------------
diff --git a/cloudsigma2-sjc/src/test/java/org/jclouds/cloudsigma2/CloudSigma2SanJoseLiveTest.java b/cloudsigma2-sjc/src/test/java/org/jclouds/cloudsigma2/CloudSigma2SanJoseLiveTest.java
new file mode 100644
index 0000000..70f8050
--- /dev/null
+++ b/cloudsigma2-sjc/src/test/java/org/jclouds/cloudsigma2/CloudSigma2SanJoseLiveTest.java
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.cloudsigma2;
+
+import org.testng.annotations.Test;
+
+@Test(groups = "live", testName = "CloudSigma2SanJoseLiveTest")
+public class CloudSigma2SanJoseLiveTest extends CloudSigma2ApiLiveTest {
+
+ public CloudSigma2SanJoseLiveTest() {
+ provider = "cloudsigma2-sjc";
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/a7dd1933/cloudsigma2-sjc/src/test/java/org/jclouds/cloudsigma2/compute/CloudSigma2SanJoseComputeServiceLiveTest.java
----------------------------------------------------------------------
diff --git a/cloudsigma2-sjc/src/test/java/org/jclouds/cloudsigma2/compute/CloudSigma2SanJoseComputeServiceLiveTest.java b/cloudsigma2-sjc/src/test/java/org/jclouds/cloudsigma2/compute/CloudSigma2SanJoseComputeServiceLiveTest.java
new file mode 100644
index 0000000..7f1ce77
--- /dev/null
+++ b/cloudsigma2-sjc/src/test/java/org/jclouds/cloudsigma2/compute/CloudSigma2SanJoseComputeServiceLiveTest.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.cloudsigma2.compute;
+
+import org.testng.annotations.Test;
+
+@Test(groups = "live", testName = "CloudSigma2SanJoseComputeServiceLiveTest")
+public class CloudSigma2SanJoseComputeServiceLiveTest extends CloudSigma2ComputeServiceLiveTest {
+
+ public CloudSigma2SanJoseComputeServiceLiveTest() {
+ provider = "cloudsigma2-sjc";
+ group = "cloudsigma2";
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/a7dd1933/cloudsigma2-wdc/pom.xml
----------------------------------------------------------------------
diff --git a/cloudsigma2-wdc/pom.xml b/cloudsigma2-wdc/pom.xml
index ff5ba30..220080a 100644
--- a/cloudsigma2-wdc/pom.xml
+++ b/cloudsigma2-wdc/pom.xml
@@ -39,7 +39,8 @@
<test.cloudsigma2-wdc.build-version />
<test.cloudsigma2-wdc.identity>FIXME</test.cloudsigma2-wdc.identity>
<test.cloudsigma2-wdc.credential>FIXME</test.cloudsigma2-wdc.credential>
- <test.cloudsigma2-wdc.template />
+ <!-- Ubuntu 14.04 Cloud Image -->
+ <test.cloudsigma2-wdc.template>imageId=677f3f9a-840a-4f6e-8a21-987dcb59c81a,loginUser=ubuntu</test.cloudsigma2-wdc.template>
<jclouds.osgi.export>org.jclouds.cloudsigma2*;version="${project.version}"</jclouds.osgi.export>
<jclouds.osgi.import>
org.jclouds.compute.internal;version="${project.version}",
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/a7dd1933/cloudsigma2-wdc/src/test/java/org/jclouds/cloudsigma2/CloudSigma2WashingtonLiveTest.java
----------------------------------------------------------------------
diff --git a/cloudsigma2-wdc/src/test/java/org/jclouds/cloudsigma2/CloudSigma2WashingtonLiveTest.java b/cloudsigma2-wdc/src/test/java/org/jclouds/cloudsigma2/CloudSigma2WashingtonLiveTest.java
index 2fe5f2b..cb80b1e 100644
--- a/cloudsigma2-wdc/src/test/java/org/jclouds/cloudsigma2/CloudSigma2WashingtonLiveTest.java
+++ b/cloudsigma2-wdc/src/test/java/org/jclouds/cloudsigma2/CloudSigma2WashingtonLiveTest.java
@@ -18,9 +18,10 @@ package org.jclouds.cloudsigma2;
import org.testng.annotations.Test;
-@Test(groups = {"live"})
+@Test(groups = "live", testName = "CloudSigma2WashingtonLiveTest")
public class CloudSigma2WashingtonLiveTest extends CloudSigma2ApiLiveTest {
- public CloudSigma2WashingtonLiveTest() {
- provider = "cloudsigma2-wdc";
- }
+
+ public CloudSigma2WashingtonLiveTest() {
+ provider = "cloudsigma2-wdc";
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/a7dd1933/cloudsigma2-wdc/src/test/java/org/jclouds/cloudsigma2/compute/CloudSigma2WashingtonComputeServiceLiveTest.java
----------------------------------------------------------------------
diff --git a/cloudsigma2-wdc/src/test/java/org/jclouds/cloudsigma2/compute/CloudSigma2WashingtonComputeServiceLiveTest.java b/cloudsigma2-wdc/src/test/java/org/jclouds/cloudsigma2/compute/CloudSigma2WashingtonComputeServiceLiveTest.java
new file mode 100644
index 0000000..cd3976d
--- /dev/null
+++ b/cloudsigma2-wdc/src/test/java/org/jclouds/cloudsigma2/compute/CloudSigma2WashingtonComputeServiceLiveTest.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.cloudsigma2.compute;
+
+import org.testng.annotations.Test;
+
+@Test(groups = "live", testName = "CloudSigma2WashingtonComputeServiceLiveTest")
+public class CloudSigma2WashingtonComputeServiceLiveTest extends CloudSigma2ComputeServiceLiveTest {
+
+ public CloudSigma2WashingtonComputeServiceLiveTest() {
+ provider = "cloudsigma2-wdc";
+ group = "cloudsigma2";
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/a7dd1933/cloudsigma2-zrh/pom.xml
----------------------------------------------------------------------
diff --git a/cloudsigma2-zrh/pom.xml b/cloudsigma2-zrh/pom.xml
index 0dbba31..e6ffa2d 100644
--- a/cloudsigma2-zrh/pom.xml
+++ b/cloudsigma2-zrh/pom.xml
@@ -39,7 +39,8 @@
<test.cloudsigma2-zrh.build-version />
<test.cloudsigma2-zrh.identity>FIXME</test.cloudsigma2-zrh.identity>
<test.cloudsigma2-zrh.credential>FIXME</test.cloudsigma2-zrh.credential>
- <test.cloudsigma2-zrh.template />
+ <!-- Ubuntu 14.04 Cloud Image -->
+ <test.cloudsigma2-zrh.template>imageId=473adb38-3b64-43b2-93bd-f1a3443c19ea,loginUser=ubuntu</test.cloudsigma2-zrh.template>
<jclouds.osgi.export>org.jclouds.cloudsigma2*;version="${project.version}"</jclouds.osgi.export>
<jclouds.osgi.import>
org.jclouds.compute.internal;version="${project.version}",
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/a7dd1933/cloudsigma2-zrh/src/test/java/org/jclouds/cloudsigma2/CloudSigma2ZurichLiveTest.java
----------------------------------------------------------------------
diff --git a/cloudsigma2-zrh/src/test/java/org/jclouds/cloudsigma2/CloudSigma2ZurichLiveTest.java b/cloudsigma2-zrh/src/test/java/org/jclouds/cloudsigma2/CloudSigma2ZurichLiveTest.java
index d84899a..e090a88 100644
--- a/cloudsigma2-zrh/src/test/java/org/jclouds/cloudsigma2/CloudSigma2ZurichLiveTest.java
+++ b/cloudsigma2-zrh/src/test/java/org/jclouds/cloudsigma2/CloudSigma2ZurichLiveTest.java
@@ -18,9 +18,10 @@ package org.jclouds.cloudsigma2;
import org.testng.annotations.Test;
-@Test(groups = {"live"})
-public class CloudSigma2ZurichLiveTest extends CloudSigma2ApiLiveTest{
- public CloudSigma2ZurichLiveTest() {
- provider = "cloudsigma2-zrh";
- }
+@Test(groups = "live", testName = "CloudSigma2ZurichLiveTest")
+public class CloudSigma2ZurichLiveTest extends CloudSigma2ApiLiveTest {
+
+ public CloudSigma2ZurichLiveTest() {
+ provider = "cloudsigma2-zrh";
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/a7dd1933/cloudsigma2-zrh/src/test/java/org/jclouds/cloudsigma2/compute/CloudSigma2ZurichComputeServiceLiveTest.java
----------------------------------------------------------------------
diff --git a/cloudsigma2-zrh/src/test/java/org/jclouds/cloudsigma2/compute/CloudSigma2ZurichComputeServiceLiveTest.java b/cloudsigma2-zrh/src/test/java/org/jclouds/cloudsigma2/compute/CloudSigma2ZurichComputeServiceLiveTest.java
new file mode 100644
index 0000000..b85cb57
--- /dev/null
+++ b/cloudsigma2-zrh/src/test/java/org/jclouds/cloudsigma2/compute/CloudSigma2ZurichComputeServiceLiveTest.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.cloudsigma2.compute;
+
+import org.testng.annotations.Test;
+
+@Test(groups = "live", testName = "CloudSigma2ZurichComputeServiceLiveTest")
+public class CloudSigma2ZurichComputeServiceLiveTest extends CloudSigma2ComputeServiceLiveTest {
+
+ public CloudSigma2ZurichComputeServiceLiveTest() {
+ provider = "cloudsigma2-zrh";
+ group = "cloudsigma2";
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/a7dd1933/cloudsigma2/pom.xml
----------------------------------------------------------------------
diff --git a/cloudsigma2/pom.xml b/cloudsigma2/pom.xml
index 902cfe4..a77745c 100644
--- a/cloudsigma2/pom.xml
+++ b/cloudsigma2/pom.xml
@@ -39,7 +39,7 @@
<test.cloudsigma2.api-version>2.0</test.cloudsigma2.api-version>
<test.cloudsigma2.identity>FIXME</test.cloudsigma2.identity>
<test.cloudsigma2.credential>FIXME</test.cloudsigma2.credential>
- <test.cloudsigma2.template>imageId=f3c7c665-cd54-4a78-8fd2-7ec2f028cf29</test.cloudsigma2.template>
+ <test.cloudsigma2.template>imageId=f3c7c665-cd54-4a78-8fd2-7ec2f028cf29,loginUser=ubuntu</test.cloudsigma2.template>
<jclouds.osgi.export>org.jclouds.cloudsigma2*;version="${project.version}"</jclouds.osgi.export>
<jclouds.osgi.import>
org.jclouds.compute.internal;version="${project.version}",
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/a7dd1933/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/CloudSigma2Api.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/CloudSigma2Api.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/CloudSigma2Api.java
index ef06286..4b0590b 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/CloudSigma2Api.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/CloudSigma2Api.java
@@ -174,7 +174,7 @@ public interface CloudSigma2Api extends Closeable {
* @param uuid drive uuid to get
* @return null, if not found
*/
- @Named("drive:getDriveInfo/{uuid}")
+ @Named("drive:getDriveInfo")
@GET
@Path("/drives/{uuid}/")
@Fallback(Fallbacks.NullOnNotFoundOr404.class)
@@ -212,7 +212,7 @@ public interface CloudSigma2Api extends Closeable {
*
* @param uuid what to delete
*/
- @Named("drive:deleteDrive/{uuid}")
+ @Named("drive:deleteDrive")
@DELETE
@Path("/drives/{uuid}/")
@Fallback(Fallbacks.VoidOnNotFoundOr404.class)
@@ -236,7 +236,7 @@ public interface CloudSigma2Api extends Closeable {
* @param driveInfo drive parameters to change
* @return changed drive
*/
- @Named("drive:editDrive/{uuid}")
+ @Named("drive:editDrive")
@PUT
@Path("/drives/{uuid}/")
@Fallback(Fallbacks.VoidOnNotFoundOr404.class)
@@ -250,10 +250,12 @@ public interface CloudSigma2Api extends Closeable {
* @param driveInfo drive parameters to change
* @return new drive
*/
- @Named("drive:cloneDrive/{uuid}")
+ @Named("drive:cloneDrive")
@POST
@Path("/drives/{uuid}/action/?do=clone")
@Fallback(Fallbacks.VoidOnNotFoundOr404.class)
+ @SelectJson("objects")
+ @OnlyElement
DriveInfo cloneDrive(@PathParam("uuid") String sourceUuid,
@Nullable @BinderParam(BindDriveToJson.class) DriveInfo driveInfo);
@@ -286,7 +288,7 @@ public interface CloudSigma2Api extends Closeable {
* @param uuid uuid of library drive to be listed
* @return drive information or null if not found
*/
- @Named("libdrive:getLibraryDrive/{uuid}")
+ @Named("libdrive:getLibraryDrive")
@GET
@Path("/libdrives/{uuid}/")
@Fallback(Fallbacks.NullOnNotFoundOr404.class)
@@ -299,10 +301,12 @@ public interface CloudSigma2Api extends Closeable {
* @param libraryDrive cloned drive
* @return cloned drive information or null if not found
*/
- @Named("libdrive:cloneLibraryDrive/{uuid}")
+ @Named("libdrive:cloneLibraryDrive")
@POST
@Path("/libdrives/{uuid}/action/?do=clone")
@Fallback(Fallbacks.VoidOnNotFoundOr404.class)
+ @SelectJson("objects")
+ @OnlyElement
LibraryDrive cloneLibraryDrive(@PathParam("uuid") String uuid
, @Nullable @BinderParam(BindLibraryDriveToJson.class) LibraryDrive libraryDrive);
@@ -389,7 +393,7 @@ public interface CloudSigma2Api extends Closeable {
* @param server data to change
* @return modified server
*/
- @Named("server:editServer/{uuid}")
+ @Named("server:editServer")
@PUT
@Path("/servers/{uuid}/")
@Fallback(Fallbacks.VoidOnNotFoundOr404.class)
@@ -401,7 +405,7 @@ public interface CloudSigma2Api extends Closeable {
*
* @param uuid uuid of server to delete
*/
- @Named("server:deleteServer/{uuid}")
+ @Named("server:deleteServer")
@DELETE
@Path("/servers/{uuid}/")
@Fallback(Fallbacks.VoidOnNotFoundOr404.class)
@@ -427,7 +431,7 @@ public interface CloudSigma2Api extends Closeable {
* @param uuid server what to clone
* @return cloned server
*/
- @Named("server:cloneServer/{uuid}")
+ @Named("server:cloneServer")
@POST
@Path("/servers/{uuid}/action/?do=clone")
@Fallback(Fallbacks.VoidOnNotFoundOr404.class)
@@ -439,7 +443,7 @@ public interface CloudSigma2Api extends Closeable {
* @param uuid server uuid
* @return server info or null, if not found
*/
- @Named("server:getServerInfo/{uuid}")
+ @Named("server:getServerInfo")
@GET
@Path("/servers/{uuid}/")
@Fallback(Fallbacks.NullOnNotFoundOr404.class)
@@ -450,10 +454,10 @@ public interface CloudSigma2Api extends Closeable {
*
* @param uuid uuid of server to start
*/
- @Named("server:startServer/{uuid}")
+ @Named("server:startServer")
@POST
@Path("/servers/{uuid}/action/?do=start")
- @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ @Fallback(Fallbacks.VoidOnNotFoundOr404.class)
void startServer(@PathParam("uuid") String uuid);
/**
@@ -461,10 +465,10 @@ public interface CloudSigma2Api extends Closeable {
*
* @param uuid uuid of server to stop
*/
- @Named("server:stopServer/{uuid}")
+ @Named("server:stopServer")
@POST
@Path("/servers/{uuid}/action/?do=stop")
- @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ @Fallback(Fallbacks.VoidOnNotFoundOr404.class)
void stopServer(@PathParam("uuid") String uuid);
/**
@@ -478,10 +482,10 @@ public interface CloudSigma2Api extends Closeable {
* @param uuid uuid of server to start
* @param uuidGroup availability group to avoid
*/
- @Named("server:startServerInSeparateAvailabilityGroup/{uuid}")
+ @Named("server:startServerInSeparateAvailabilityGroup")
@POST
@Path("/servers/{uuid}/action/?do=start")
- @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ @Fallback(Fallbacks.VoidOnNotFoundOr404.class)
void startServerInSeparateAvailabilityGroup(@PathParam("uuid") String uuid,
@QueryParam("avoid") List<String> uuidGroup);
@@ -490,10 +494,10 @@ public interface CloudSigma2Api extends Closeable {
*
* @param uuid uuid of server to open VNC tunnel
*/
- @Named("server:openServerVNCTunnel/{uuid}")
+ @Named("server:openServerVNCTunnel")
@POST
@Path("/servers/{uuid}/action/?do=open_vnc")
- @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ @Fallback(Fallbacks.VoidOnNotFoundOr404.class)
void openServerVNCTunnel(@PathParam("uuid") String uuid);
/**
@@ -501,10 +505,10 @@ public interface CloudSigma2Api extends Closeable {
*
* @param uuid uuid of server to close VNC tunnel
*/
- @Named("server:closeServerVCNTunnel/{uuid}")
+ @Named("server:closeServerVCNTunnel")
@POST
@Path("/servers/{uuid}/action/?do=close_vnc")
- @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ @Fallback(Fallbacks.VoidOnNotFoundOr404.class)
void closeServerVCNTunnel(@PathParam("uuid") String uuid);
/**
@@ -521,7 +525,7 @@ public interface CloudSigma2Api extends Closeable {
* @param uuid Uuid of server to find availability group
* @return an array holding server UUIDs. The response includes also the UUID of the queried server.
*/
- @Named("server:getServerAvailabilityGroup/{uuid}")
+ @Named("server:getServerAvailabilityGroup")
@GET
@PathParam("/servers/availability_groups/{uuid}/")
@Fallback(Fallbacks.NullOnNotFoundOr404.class)
@@ -574,6 +578,17 @@ public interface CloudSigma2Api extends Closeable {
PaginatedCollection<FirewallPolicy> listFirewallPoliciesInfo(PaginationOptions options);
/**
+ * Gets firewall policy.
+ *
+ * @return firewall policy
+ */
+ @Named("fwpolicy:getFirewallPolicy")
+ @GET
+ @Path("/fwpolicies/{uuid}/")
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ FirewallPolicy getFirewallPolicy(@PathParam("uuid") String uuid);
+
+ /**
* Creates firewall policies.
*
* @param firewallPolicies firewall policies to create
@@ -607,19 +622,30 @@ public interface CloudSigma2Api extends Closeable {
* @param firewallPolicy firewall policy data to update
* @return updated firewall policy
*/
- @Named("fwpolicy:editFirewallPolicy/{uuid}")
+ @Named("fwpolicy:editFirewallPolicy")
@PUT
@Path("/fwpolicies/{uuid}/")
FirewallPolicy editFirewallPolicy(@PathParam("uuid") String uuid
, @BinderParam(BindFirewallPolicyToJsonRequest.class) FirewallPolicy firewallPolicy);
/**
+ * Deletes a single firewall policy.
+ *
+ * @param uuid uuid of firewall policy to delete
+ */
+ @Named("tag:deleteFirewallPolicy")
+ @DELETE
+ @Path("/fwpolicies/{uuid}/")
+ @Fallback(Fallbacks.VoidOnNotFoundOr404.class)
+ void deleteFirewallPolicy(@PathParam("uuid") String uuid);
+
+ /**
* Gets detailed information for VLAN identified by VLAN uuid.
*
* @param uuid uuid of VLAN to get
* @return null, if not found
*/
- @Named("vlan:getVLANInfo/{uuid}")
+ @Named("vlan:getVLANInfo")
@GET
@Path("/vlans/{uuid}/")
@Fallback(Fallbacks.NullOnNotFoundOr404.class)
@@ -678,7 +704,7 @@ public interface CloudSigma2Api extends Closeable {
* @param vlanInfo data to change
* @return changed VLAN
*/
- @Named("vlan:listVLANInfo/{uuid}")
+ @Named("vlan:listVLANInfo")
@PUT
@Path("/vlans/{uuid}/")
@Fallback(Fallbacks.NullOnNotFoundOr404.class)
@@ -737,7 +763,7 @@ public interface CloudSigma2Api extends Closeable {
* @param uuid uuid of IP to get
* @return null, if not found
*/
- @Named("ip:getIPInfo/{uuid}")
+ @Named("ip:getIPInfo")
@GET
@Path("/ips/{uuid}/")
@Fallback(Fallbacks.NullOnNotFoundOr404.class)
@@ -750,7 +776,7 @@ public interface CloudSigma2Api extends Closeable {
* @param ipInfo data to change
* @return changed IP
*/
- @Named("ip:editIP/{uuid}")
+ @Named("ip:editIP")
@PUT
@Path("/ips/{uuid}/")
@Fallback(Fallbacks.NullOnNotFoundOr404.class)
@@ -781,37 +807,12 @@ public interface CloudSigma2Api extends Closeable {
PaginatedCollection<Tag> listTags(PaginationOptions options);
/**
- * Gets the detailed list of tags with additional information to which the authenticated user has access,
- * like the tagged resource
- *
- * @return detailed listings of your tags
- */
- @Named("tag:listTagsInfo")
- @GET
- @Path("/tags/detail/")
- @ResponseParser(ParseTags.class)
- @Transform(ParseTags.ToPagedIterableInfo.class)
- PagedIterable<Tag> listTagsInfo();
-
- /**
- * Gets the detailed list of tags with additional information to which the authenticated user has access,
- * like the tagged resource
- *
- * @return PaginatedCollection of detailed tags
- */
- @Named("tag:listTagsInfo")
- @GET
- @Path("/tags/detail/")
- @ResponseParser(ParseTags.class)
- PaginatedCollection<Tag> listTagsInfo(PaginationOptions options);
-
- /**
* Gets detailed information for tag identified by tag uuid.
*
* @param uuid tag uuid
* @return detailed info of tag
*/
- @Named("tag:getTagInfo/{uuid}")
+ @Named("tag:getTagInfo")
@GET
@Path("/tags/{uuid}/")
@Fallback(Fallbacks.NullOnNotFoundOr404.class)
@@ -825,7 +826,7 @@ public interface CloudSigma2Api extends Closeable {
* @param tag info to change
* @return detailed info of tag
*/
- @Named("tag:editTag/{uuid}")
+ @Named("tag:editTag")
@PUT
@Path("/tags/{uuid}/")
@Fallback(Fallbacks.NullOnNotFoundOr404.class)
@@ -849,10 +850,10 @@ public interface CloudSigma2Api extends Closeable {
*
* @param uuid uuid of tag to delete
*/
- @Named("tag:deleteTag/{uuid}")
+ @Named("tag:deleteTag")
@DELETE
@Path("/tags/{uuid}/")
- @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ @Fallback(Fallbacks.VoidOnNotFoundOr404.class)
void deleteTag(@PathParam("uuid") String uuid);
/**
@@ -1002,10 +1003,10 @@ public interface CloudSigma2Api extends Closeable {
*
* @param id id of subscription to extend
*/
- @Named("subscription:extendSubscription/{id}")
+ @Named("subscription:extendSubscription")
@POST
@Path("/subscriptions/{id}/action/?do=extend")
- @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ @Fallback(Fallbacks.VoidOnNotFoundOr404.class)
void extendSubscription(@PathParam("id") String id);
/**
@@ -1013,10 +1014,10 @@ public interface CloudSigma2Api extends Closeable {
*
* @param id id of subscription to enable autorenew
*/
- @Named("subscription:enableSubscriptionAutorenew/{id}")
+ @Named("subscription:enableSubscriptionAutorenew")
@POST
@Path("/subscriptions/{id}/action/?do=auto_renew")
- @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ @Fallback(Fallbacks.VoidOnNotFoundOr404.class)
void enableSubscriptionAutorenew(@PathParam("id") String id);
/**
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/a7dd1933/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/CloudSigma2ApiMetadata.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/CloudSigma2ApiMetadata.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/CloudSigma2ApiMetadata.java
index ea0ff7d..b1dec88 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/CloudSigma2ApiMetadata.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/CloudSigma2ApiMetadata.java
@@ -16,15 +16,19 @@
*/
package org.jclouds.cloudsigma2;
+import static org.jclouds.cloudsigma2.config.CloudSigma2Properties.PROPERTY_DELETE_DRIVES;
+import static org.jclouds.cloudsigma2.config.CloudSigma2Properties.PROPERTY_VNC_PASSWORD;
+import static org.jclouds.cloudsigma2.config.CloudSigma2Properties.TIMEOUT_DRIVE_CLONED;
import static org.jclouds.compute.config.ComputeServiceProperties.TEMPLATE;
import java.net.URI;
import java.util.Properties;
import org.jclouds.apis.ApiMetadata;
+import org.jclouds.cloudsigma2.compute.config.CloudSigma2ComputeServiceContextModule;
import org.jclouds.cloudsigma2.config.CloudSigma2HttpApiModule;
import org.jclouds.cloudsigma2.config.CloudSigma2ParserModule;
-import org.jclouds.cloudsigma2.config.CloudSigma2Properties;
+import org.jclouds.compute.ComputeServiceContext;
import org.jclouds.rest.internal.BaseHttpApiMetadata;
import com.google.common.collect.ImmutableSet;
@@ -50,12 +54,10 @@ public class CloudSigma2ApiMetadata extends BaseHttpApiMetadata<CloudSigma2Api>
public static Properties defaultProperties() {
Properties properties = BaseHttpApiMetadata.defaultProperties();
- properties.setProperty(CloudSigma2Properties.PROPERTY_VNC_PASSWORD, "IL9vs34d");
- // passwords are set post-boot, so auth failures are possible
- // from a race condition applying the password set script
- properties.setProperty("jclouds.ssh.max-retries", "7");
- properties.setProperty("jclouds.ssh.retry-auth", "true");
- properties.setProperty(TEMPLATE, "osFamily=UBUNTU,imageNameMatches=.*[Aa]utomated SSH Access.*,os64Bit=true");
+ properties.setProperty(PROPERTY_VNC_PASSWORD, "IL9vs34d");
+ properties.setProperty(TIMEOUT_DRIVE_CLONED, "60000");
+ properties.setProperty(PROPERTY_DELETE_DRIVES, "true");
+ properties.setProperty(TEMPLATE, "imageNameMatches=Ubuntu.*[Cc]loud [Ii]mage.*,loginUser=ubuntu");
return properties;
}
@@ -65,19 +67,17 @@ public class CloudSigma2ApiMetadata extends BaseHttpApiMetadata<CloudSigma2Api>
super(CloudSigma2Api.class);
id("cloudsigma2")
.name("CloudSigma API")
- .defaultIdentity("email")
.identityName("Email")
- .defaultCredential("Password")
.credentialName("Password")
.documentation(URI.create("http://cloudsigma.com/en/platform-details/the-api"))
.version("2.0")
.defaultEndpoint("https://zrh.cloudsigma.com/api/2.0")
.defaultProperties(CloudSigma2ApiMetadata.defaultProperties())
- // Uncomment once the ComputeService is implemented
- //.view(typeToken(ComputeServiceContext.class))
+ .view(ComputeServiceContext.class)
.defaultModules(ImmutableSet.<Class<? extends Module>>of(
CloudSigma2HttpApiModule.class,
- CloudSigma2ParserModule.class));
+ CloudSigma2ParserModule.class,
+ CloudSigma2ComputeServiceContextModule.class));
}
@Override
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/a7dd1933/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindCreateSubscriptionRequestList.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindCreateSubscriptionRequestList.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindCreateSubscriptionRequestList.java
index 1787478..da47e8e 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindCreateSubscriptionRequestList.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindCreateSubscriptionRequestList.java
@@ -18,6 +18,7 @@ package org.jclouds.cloudsigma2.binders;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
+
import org.jclouds.cloudsigma2.domain.CreateSubscriptionRequest;
import org.jclouds.cloudsigma2.functions.CreateSubscriptionRequestToJson;
import org.jclouds.http.HttpRequest;
@@ -26,6 +27,7 @@ import org.jclouds.rest.Binder;
import javax.inject.Inject;
import javax.inject.Singleton;
import javax.ws.rs.core.MediaType;
+
import java.util.List;
import static com.google.common.base.Preconditions.checkArgument;
@@ -40,6 +42,7 @@ public class BindCreateSubscriptionRequestList implements Binder {
this.subscriptionRequestJsonObjectFunction = subscriptionRequestJsonObjectFunction;
}
+ @SuppressWarnings("unchecked")
@Override
public <R extends HttpRequest> R bindToRequest(R request, Object input) {
checkArgument(input instanceof List, "this binder is only valid for List<CreateSubscriptionRequest>!");
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/a7dd1933/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindDrivesToJson.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindDrivesToJson.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindDrivesToJson.java
index 1040da4..5900734 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindDrivesToJson.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindDrivesToJson.java
@@ -18,6 +18,7 @@ package org.jclouds.cloudsigma2.binders;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
+
import org.jclouds.cloudsigma2.domain.DriveInfo;
import org.jclouds.cloudsigma2.functions.DriveToJson;
import org.jclouds.http.HttpRequest;
@@ -26,6 +27,7 @@ import org.jclouds.rest.Binder;
import javax.inject.Inject;
import javax.inject.Singleton;
import javax.ws.rs.core.MediaType;
+
import java.util.List;
import static com.google.common.base.Preconditions.checkArgument;
@@ -39,6 +41,7 @@ public class BindDrivesToJson implements Binder {
this.createDriveRequestJson = createDriveRequestToMap;
}
+ @SuppressWarnings("unchecked")
@Override
public <R extends HttpRequest> R bindToRequest(R request, Object payload) {
checkArgument(payload instanceof List, "this binder is only valid for List<DriveInfo>!");
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/a7dd1933/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindFirewallPoliciesListToJsonRequest.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindFirewallPoliciesListToJsonRequest.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindFirewallPoliciesListToJsonRequest.java
index 4dd9b3c..5c2b22e 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindFirewallPoliciesListToJsonRequest.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindFirewallPoliciesListToJsonRequest.java
@@ -18,6 +18,7 @@ package org.jclouds.cloudsigma2.binders;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
+
import org.jclouds.cloudsigma2.domain.FirewallPolicy;
import org.jclouds.cloudsigma2.functions.FirewallPolicyToJson;
import org.jclouds.http.HttpRequest;
@@ -25,6 +26,7 @@ import org.jclouds.rest.Binder;
import javax.inject.Inject;
import javax.ws.rs.core.MediaType;
+
import java.util.List;
import static com.google.common.base.Preconditions.checkArgument;
@@ -38,6 +40,7 @@ public class BindFirewallPoliciesListToJsonRequest implements Binder {
this.policyJsonObjectFunction = policyJsonObjectFunction;
}
+ @SuppressWarnings("unchecked")
@Override
public <R extends HttpRequest> R bindToRequest(R request, Object input) {
checkArgument(input instanceof List, "this binder is only valid for List<FirewallPolicy>!");
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/a7dd1933/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindServerInfoListToJsonRequest.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindServerInfoListToJsonRequest.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindServerInfoListToJsonRequest.java
index 9764a11..8cb35d4 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindServerInfoListToJsonRequest.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindServerInfoListToJsonRequest.java
@@ -18,6 +18,7 @@ package org.jclouds.cloudsigma2.binders;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
+
import org.jclouds.cloudsigma2.domain.ServerInfo;
import org.jclouds.cloudsigma2.functions.ServerInfoToJson;
import org.jclouds.http.HttpRequest;
@@ -26,6 +27,7 @@ import org.jclouds.rest.Binder;
import javax.inject.Inject;
import javax.inject.Singleton;
import javax.ws.rs.core.MediaType;
+
import java.util.List;
import static com.google.common.base.Preconditions.checkArgument;
@@ -39,6 +41,7 @@ public class BindServerInfoListToJsonRequest implements Binder {
this.createServerInfoRequestToJson = createServerInfoRequestToJson;
}
+ @SuppressWarnings("unchecked")
@Override
public <R extends HttpRequest> R bindToRequest(R request, Object payload) {
checkArgument(payload instanceof List, "this binder is only valid for List<ServerInfo>!");
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/a7dd1933/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindTagListToJsonRequest.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindTagListToJsonRequest.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindTagListToJsonRequest.java
index 36d8bee..162851b 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindTagListToJsonRequest.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindTagListToJsonRequest.java
@@ -18,6 +18,7 @@ package org.jclouds.cloudsigma2.binders;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
+
import org.jclouds.cloudsigma2.domain.Tag;
import org.jclouds.cloudsigma2.functions.TagToJson;
import org.jclouds.http.HttpRequest;
@@ -26,6 +27,7 @@ import org.jclouds.rest.Binder;
import javax.inject.Inject;
import javax.inject.Singleton;
import javax.ws.rs.core.MediaType;
+
import java.util.List;
import static com.google.common.base.Preconditions.checkArgument;
@@ -39,6 +41,7 @@ public class BindTagListToJsonRequest implements Binder {
this.tagJsonObjectFunction = tagJsonObjectFunction;
}
+ @SuppressWarnings("unchecked")
@Override
public <R extends HttpRequest> R bindToRequest(R request, Object payload) {
checkArgument(payload instanceof List, "this binder is only valid for List<Tag>!");
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/a7dd1933/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindUuidStringsToJsonArray.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindUuidStringsToJsonArray.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindUuidStringsToJsonArray.java
index 80ba1ae..44a36ea 100644
--- a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindUuidStringsToJsonArray.java
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindUuidStringsToJsonArray.java
@@ -18,17 +18,20 @@ package org.jclouds.cloudsigma2.binders;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
+
import org.jclouds.http.HttpRequest;
import org.jclouds.rest.Binder;
import javax.inject.Singleton;
import javax.ws.rs.core.MediaType;
+
import java.util.List;
import static com.google.common.base.Preconditions.checkArgument;
@Singleton
public class BindUuidStringsToJsonArray implements Binder {
+ @SuppressWarnings("unchecked")
@Override
public <R extends HttpRequest> R bindToRequest(R request, Object payload) {
checkArgument(payload instanceof List, "this binder is only valid for List<String>!");
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/a7dd1933/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/compute/config/CloudSigma2ComputeServiceContextModule.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/compute/config/CloudSigma2ComputeServiceContextModule.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/compute/config/CloudSigma2ComputeServiceContextModule.java
new file mode 100644
index 0000000..84497e4
--- /dev/null
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/compute/config/CloudSigma2ComputeServiceContextModule.java
@@ -0,0 +1,177 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.cloudsigma2.compute.config;
+
+import com.google.common.annotations.VisibleForTesting;
+import com.google.common.base.Function;
+import com.google.common.base.Predicate;
+import com.google.common.collect.ImmutableMap;
+import com.google.inject.Provides;
+import com.google.inject.TypeLiteral;
+import org.jclouds.cloudsigma2.CloudSigma2Api;
+import org.jclouds.cloudsigma2.compute.functions.LibraryDriveToImage;
+import org.jclouds.cloudsigma2.compute.functions.NICToAddress;
+import org.jclouds.cloudsigma2.compute.functions.ServerDriveToVolume;
+import org.jclouds.cloudsigma2.compute.functions.ServerInfoToNodeMetadata;
+import org.jclouds.cloudsigma2.compute.functions.TemplateOptionsToStatementWithoutPublicKey;
+import org.jclouds.cloudsigma2.compute.options.CloudSigma2TemplateOptions;
+import org.jclouds.cloudsigma2.compute.strategy.CloudSigma2ComputeServiceAdapter;
+import org.jclouds.cloudsigma2.domain.DriveInfo;
+import org.jclouds.cloudsigma2.domain.DriveStatus;
+import org.jclouds.cloudsigma2.domain.LibraryDrive;
+import org.jclouds.cloudsigma2.domain.NIC;
+import org.jclouds.cloudsigma2.domain.ServerDrive;
+import org.jclouds.cloudsigma2.domain.ServerInfo;
+import org.jclouds.cloudsigma2.domain.ServerStatus;
+import org.jclouds.compute.ComputeServiceAdapter;
+import org.jclouds.compute.config.ComputeServiceAdapterContextModule;
+import org.jclouds.compute.domain.Hardware;
+import org.jclouds.compute.domain.Image;
+import org.jclouds.compute.domain.NodeMetadata;
+import org.jclouds.compute.domain.Volume;
+import org.jclouds.compute.functions.TemplateOptionsToStatement;
+import org.jclouds.compute.options.TemplateOptions;
+import org.jclouds.compute.reference.ComputeServiceConstants.PollPeriod;
+import org.jclouds.compute.reference.ComputeServiceConstants.Timeouts;
+import org.jclouds.domain.Location;
+import org.jclouds.functions.IdentityFunction;
+
+import javax.inject.Named;
+import javax.inject.Singleton;
+import java.util.Map;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import static org.jclouds.cloudsigma2.config.CloudSigma2Properties.TIMEOUT_DRIVE_CLONED;
+import static org.jclouds.compute.config.ComputeServiceProperties.TIMEOUT_NODE_SUSPENDED;
+import static org.jclouds.util.Predicates2.retry;
+
+public class CloudSigma2ComputeServiceContextModule extends
+ ComputeServiceAdapterContextModule<ServerInfo, Hardware, LibraryDrive, Location> {
+
+ @SuppressWarnings("unchecked")
+ @Override
+ protected void configure() {
+ super.configure();
+
+ bind(new TypeLiteral<ComputeServiceAdapter<ServerInfo, Hardware, LibraryDrive, Location>>() {
+ }).to(CloudSigma2ComputeServiceAdapter.class);
+
+ bind(new TypeLiteral<Function<ServerInfo, NodeMetadata>>() {
+ }).to(ServerInfoToNodeMetadata.class);
+ bind(new TypeLiteral<Function<LibraryDrive, Image>>() {
+ }).to(LibraryDriveToImage.class);
+ bind(new TypeLiteral<Function<ServerDrive, Volume>>() {
+ }).to(ServerDriveToVolume.class);
+ bind(new TypeLiteral<Function<Hardware, Hardware>>() {
+ }).to(Class.class.cast(IdentityFunction.class));
+ bind(new TypeLiteral<Function<Location, Location>>() {
+ }).to(Class.class.cast(IdentityFunction.class));
+ bind(new TypeLiteral<Function<NIC, String>>() {
+ }).to(NICToAddress.class);
+
+ bind(TemplateOptions.class).to(CloudSigma2TemplateOptions.class);
+ bind(TemplateOptionsToStatement.class).to(TemplateOptionsToStatementWithoutPublicKey.class);
+ }
+
+ @VisibleForTesting
+ public static final Map<ServerStatus, NodeMetadata.Status> serverStatusToNodeStatus = ImmutableMap
+ .<ServerStatus, NodeMetadata.Status>builder().put(ServerStatus.RUNNING, NodeMetadata.Status.RUNNING)
+ .put(ServerStatus.STARTING, NodeMetadata.Status.PENDING)
+ .put(ServerStatus.STOPPING, NodeMetadata.Status.PENDING)
+ .put(ServerStatus.STOPPED, NodeMetadata.Status.SUSPENDED)
+ .put(ServerStatus.PAUSED, NodeMetadata.Status.SUSPENDED)
+ .put(ServerStatus.UNAVAILABLE, NodeMetadata.Status.SUSPENDED)
+ .put(ServerStatus.UNRECOGNIZED, NodeMetadata.Status.UNRECOGNIZED).build();
+
+ @Provides
+ @Singleton
+ protected Map<ServerStatus, NodeMetadata.Status> provideStatusMap() {
+ return serverStatusToNodeStatus;
+ }
+
+ @VisibleForTesting
+ public static final Map<DriveStatus, Image.Status> driveStatusToImageStatus = ImmutableMap
+ .<DriveStatus, Image.Status>builder().put(DriveStatus.MOUNTED, Image.Status.AVAILABLE)
+ .put(DriveStatus.UNMOUNTED, Image.Status.UNRECOGNIZED).put(DriveStatus.COPYING, Image.Status.PENDING)
+ .put(DriveStatus.UNAVAILABLE, Image.Status.ERROR).build();
+
+ @Provides
+ @Singleton
+ protected Map<DriveStatus, Image.Status> provideImageStatusMap() {
+ return driveStatusToImageStatus;
+ }
+
+ @Provides
+ @Singleton
+ @Named(TIMEOUT_DRIVE_CLONED)
+ protected Predicate<DriveInfo> provideDriveClonedPredicate(final CloudSigma2Api api,
+ @Named(TIMEOUT_DRIVE_CLONED) long driveClonedTimeout) {
+ return retry(new DriveClonedPredicate(api), driveClonedTimeout);
+ }
+
+ @Provides
+ @Singleton
+ @Named(TIMEOUT_NODE_SUSPENDED)
+ protected Predicate<String> provideServerStoppedPredicate(final CloudSigma2Api api, Timeouts timeouts,
+ PollPeriod pollPeriod) {
+ return retry(new ServerStatusPredicate(api, ServerStatus.STOPPED), timeouts.nodeSuspended,
+ pollPeriod.pollInitialPeriod, pollPeriod.pollMaxPeriod);
+ }
+
+ @VisibleForTesting
+ static class DriveClonedPredicate implements Predicate<DriveInfo> {
+
+ private final CloudSigma2Api api;
+
+ public DriveClonedPredicate(CloudSigma2Api api) {
+ this.api = checkNotNull(api, "api");
+ }
+
+ @Override
+ public boolean apply(DriveInfo input) {
+ DriveInfo drive = api.getDriveInfo(input.getUuid());
+ switch (drive.getStatus()) {
+ case COPYING:
+ case UNAVAILABLE:
+ return false;
+ case MOUNTED:
+ case UNMOUNTED:
+ return true;
+ default:
+ throw new IllegalStateException("Resource is in invalid status: " + drive.getStatus());
+ }
+ }
+ }
+
+ @VisibleForTesting
+ static class ServerStatusPredicate implements Predicate<String> {
+
+ private final CloudSigma2Api api;
+ private final ServerStatus status;
+
+ public ServerStatusPredicate(CloudSigma2Api api, ServerStatus status) {
+ this.api = checkNotNull(api, "api");
+ this.status = checkNotNull(status, "status");
+ }
+
+ @Override
+ public boolean apply(String input) {
+ ServerInfo serverInfo = api.getServerInfo(input);
+ return status.equals(serverInfo.getStatus());
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/a7dd1933/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/compute/functions/LibraryDriveToImage.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/compute/functions/LibraryDriveToImage.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/compute/functions/LibraryDriveToImage.java
new file mode 100644
index 0000000..d829861
--- /dev/null
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/compute/functions/LibraryDriveToImage.java
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.cloudsigma2.compute.functions;
+
+import com.google.common.base.Function;
+import org.jclouds.cloudsigma2.domain.DriveStatus;
+import org.jclouds.cloudsigma2.domain.LibraryDrive;
+import org.jclouds.compute.domain.Image;
+import org.jclouds.compute.domain.ImageBuilder;
+import org.jclouds.compute.domain.OperatingSystem;
+import org.jclouds.compute.domain.OsFamily;
+
+import javax.inject.Inject;
+import javax.inject.Singleton;
+import java.util.Map;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+@Singleton
+public class LibraryDriveToImage implements Function<LibraryDrive, Image> {
+
+ private final Map<DriveStatus, Image.Status> driveStatusToNodeStatus;
+
+ @Inject
+ public LibraryDriveToImage(Map<DriveStatus, Image.Status> driveStatusToNodeStatus) {
+ this.driveStatusToNodeStatus = checkNotNull(driveStatusToNodeStatus, "driveStatusToNodeStatus");
+ }
+
+ @Override
+ public Image apply(LibraryDrive libraryDrive) {
+ return new ImageBuilder()
+ .ids(libraryDrive.getUuid())
+ .userMetadata(libraryDrive.getMeta())
+ .name(libraryDrive.getName())
+ .description(libraryDrive.getDescription())
+ .operatingSystem(OperatingSystem.builder()
+ .name(libraryDrive.getName())
+ .arch(libraryDrive.getArch())
+ .is64Bit(libraryDrive.getArch() != null && libraryDrive.getArch().equals("64"))
+ .family(libraryDrive.getOs() == null ? null : OsFamily.fromValue(libraryDrive.getOs()))
+ .version(libraryDrive.getVersion())
+ .description(libraryDrive.getDescription())
+ .build())
+ .status(driveStatusToNodeStatus.get(libraryDrive.getStatus()))
+ .build();
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/a7dd1933/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/compute/functions/NICToAddress.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/compute/functions/NICToAddress.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/compute/functions/NICToAddress.java
new file mode 100644
index 0000000..3b0d03f
--- /dev/null
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/compute/functions/NICToAddress.java
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.cloudsigma2.compute.functions;
+
+import com.google.common.base.Function;
+import org.jclouds.cloudsigma2.domain.IPConfiguration;
+import org.jclouds.cloudsigma2.domain.IPConfigurationType;
+import org.jclouds.cloudsigma2.domain.NIC;
+import org.jclouds.cloudsigma2.domain.NICStats;
+
+import javax.inject.Singleton;
+
+@Singleton
+public final class NICToAddress implements Function<NIC, String> {
+
+ @Override
+ public String apply(NIC nic) {
+ IPConfiguration ipV4Configuration = nic.getIpV4Configuration();
+ IPConfiguration ipV6Configuration = nic.getIpV6Configuration();
+ if (ipV4Configuration != null) {
+ if (ipV4Configuration.getIp() != null) {
+ return ipV4Configuration.getIp().getUuid();
+ } else if (ipV4Configuration.getConfigurationType().equals(IPConfigurationType.DHCP)) {
+ NICStats runtime = nic.getRuntime();
+ if (runtime != null && runtime.getIpV4() != null) {
+ return runtime.getIpV4().getUuid();
+ }
+ }
+ } else if (ipV6Configuration != null) {
+ if (ipV6Configuration.getIp() != null) {
+ return ipV6Configuration.getIp().getUuid();
+ } else if (ipV6Configuration.getConfigurationType().equals(IPConfigurationType.DHCP)) {
+ NICStats runtime = nic.getRuntime();
+ if (runtime != null && runtime.getIpV6() != null) {
+ return runtime.getIpV6().getUuid();
+ }
+ }
+ }
+ return null;
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/a7dd1933/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/compute/functions/ServerDriveToVolume.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/compute/functions/ServerDriveToVolume.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/compute/functions/ServerDriveToVolume.java
new file mode 100644
index 0000000..ed5c78f
--- /dev/null
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/compute/functions/ServerDriveToVolume.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.cloudsigma2.compute.functions;
+
+import com.google.common.base.Function;
+import org.jclouds.cloudsigma2.CloudSigma2Api;
+import org.jclouds.cloudsigma2.domain.DriveInfo;
+import org.jclouds.cloudsigma2.domain.ServerDrive;
+import org.jclouds.compute.domain.Volume;
+import org.jclouds.compute.domain.VolumeBuilder;
+
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+@Singleton
+public final class ServerDriveToVolume implements Function<ServerDrive, Volume> {
+
+ private final CloudSigma2Api api;
+
+ @Inject
+ public ServerDriveToVolume(CloudSigma2Api api) {
+ this.api = checkNotNull(api, "api");
+ }
+
+ @Override
+ public Volume apply(ServerDrive serverDrive) {
+ VolumeBuilder builder = new VolumeBuilder();
+ DriveInfo driveInfo = api.getDriveInfo(serverDrive.getDriveUuid());
+ builder.id(driveInfo.getUuid());
+ builder.size(driveInfo.getSize().floatValue());
+ builder.durable(true);
+ builder.type(Volume.Type.NAS);
+ builder.bootDevice(serverDrive.getBootOrder() != null);
+ return builder.build();
+ }
+}