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 2013/09/19 00:09:35 UTC
[8/8] git commit: JCLOUDS-236: Add CloudSigma v2 API and Providers
JCLOUDS-236: Add CloudSigma v2 API and Providers
Project: http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/commit/14619a17
Tree: http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/tree/14619a17
Diff: http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/diff/14619a17
Branch: refs/heads/master
Commit: 14619a17e7d0b7cc25329e5d22d62eec504a749e
Parents: 37b7b9c
Author: Ilya Kulakov <ku...@gmail.com>
Authored: Wed Sep 18 19:35:15 2013 +0700
Committer: Ignasi Barrera <na...@apache.org>
Committed: Thu Sep 19 00:05:32 2013 +0200
----------------------------------------------------------------------
cloudsigma2-lvs/pom.xml | 126 ++
.../CloudSigma2LasVegasProviderMetadata.java | 82 ++
.../org.jclouds.providers.ProviderMetadata | 1 +
.../CloudSigma2LasVegasLiveTest.java | 29 +
cloudsigma2-zrh/pom.xml | 126 ++
.../CloudSigma2ZurichProviderMetadata.java | 82 ++
.../org.jclouds.providers.ProviderMetadata | 1 +
.../cloudsigma2/CloudSigma2ZurichLiveTest.java | 29 +
cloudsigma2/README.txt | 6 +
cloudsigma2/pom.xml | 117 ++
.../org/jclouds/cloudsigma2/CloudSigma2Api.java | 883 ++++++++++++
.../cloudsigma2/CloudSigma2ApiMetadata.java | 100 ++
.../binders/BindCreateSubscriptionRequest.java | 54 +
.../BindCreateSubscriptionRequestList.java | 68 +
.../cloudsigma2/binders/BindDriveToJson.java | 54 +
.../cloudsigma2/binders/BindDrivesToJson.java | 66 +
.../BindFirewallPoliciesListToJsonRequest.java | 66 +
.../BindFirewallPolicyToJsonRequest.java | 54 +
.../binders/BindIPInfoToJsonRequest.java | 54 +
.../binders/BindLibraryDriveToJson.java | 53 +
.../binders/BindProfileInfoToJsonRequest.java | 53 +
.../BindServerInfoListToJsonRequest.java | 66 +
.../binders/BindServerInfoToJsonRequest.java | 53 +
.../binders/BindTagListToJsonRequest.java | 67 +
.../binders/BindTagToJsonRequest.java | 54 +
.../binders/BindUuidStringsToJsonArray.java | 58 +
.../binders/BindVLANToJsonRequest.java | 54 +
.../config/CloudSigma2HttpApiModule.java | 42 +
.../config/CloudSigma2ParserModule.java | 30 +
.../config/CloudSigma2Properties.java | 30 +
.../cloudsigma2/domain/AccountBalance.java | 81 ++
.../cloudsigma2/domain/AccountUsage.java | 235 ++++
.../jclouds/cloudsigma2/domain/BurstLevel.java | 232 +++
.../domain/CreateSubscriptionRequest.java | 100 ++
.../cloudsigma2/domain/CurrentUsage.java | 91 ++
.../cloudsigma2/domain/DeviceEmulationType.java | 43 +
.../jclouds/cloudsigma2/domain/Discount.java | 78 ++
.../org/jclouds/cloudsigma2/domain/Drive.java | 174 +++
.../jclouds/cloudsigma2/domain/DriveInfo.java | 329 +++++
.../cloudsigma2/domain/DriveLicense.java | 106 ++
.../jclouds/cloudsigma2/domain/DriveStatus.java | 45 +
.../domain/DrivesListRequestFieldsGroup.java | 51 +
.../cloudsigma2/domain/FirewallAction.java | 43 +
.../cloudsigma2/domain/FirewallDirection.java | 43 +
.../cloudsigma2/domain/FirewallIpProtocol.java | 43 +
.../cloudsigma2/domain/FirewallPolicy.java | 217 +++
.../cloudsigma2/domain/FirewallRule.java | 247 ++++
.../org/jclouds/cloudsigma2/domain/IOStats.java | 122 ++
.../java/org/jclouds/cloudsigma2/domain/IP.java | 251 ++++
.../cloudsigma2/domain/IPConfiguration.java | 102 ++
.../cloudsigma2/domain/IPConfigurationType.java | 43 +
.../org/jclouds/cloudsigma2/domain/IPInfo.java | 247 ++++
.../cloudsigma2/domain/InterfaceType.java | 43 +
.../org/jclouds/cloudsigma2/domain/Item.java | 175 +++
.../cloudsigma2/domain/LibraryDrive.java | 376 +++++
.../org/jclouds/cloudsigma2/domain/License.java | 174 +++
.../jclouds/cloudsigma2/domain/MediaType.java | 47 +
.../org/jclouds/cloudsigma2/domain/Model.java | 44 +
.../org/jclouds/cloudsigma2/domain/NIC.java | 226 +++
.../jclouds/cloudsigma2/domain/NICStats.java | 119 ++
.../org/jclouds/cloudsigma2/domain/Owner.java | 169 +++
.../org/jclouds/cloudsigma2/domain/Price.java | 220 +++
.../org/jclouds/cloudsigma2/domain/Pricing.java | 109 ++
.../jclouds/cloudsigma2/domain/ProfileInfo.java | 518 +++++++
.../org/jclouds/cloudsigma2/domain/Server.java | 164 +++
.../domain/ServerAvailabilityGroup.java | 70 +
.../jclouds/cloudsigma2/domain/ServerDrive.java | 171 +++
.../jclouds/cloudsigma2/domain/ServerInfo.java | 436 ++++++
.../cloudsigma2/domain/ServerRuntime.java | 96 ++
.../cloudsigma2/domain/ServerStatus.java | 44 +
.../cloudsigma2/domain/Subscription.java | 464 ++++++
.../domain/SubscriptionResource.java | 42 +
.../org/jclouds/cloudsigma2/domain/Tag.java | 148 ++
.../jclouds/cloudsigma2/domain/TagResource.java | 157 +++
.../cloudsigma2/domain/TagResourceType.java | 43 +
.../jclouds/cloudsigma2/domain/Transaction.java | 193 +++
.../org/jclouds/cloudsigma2/domain/Usage.java | 107 ++
.../jclouds/cloudsigma2/domain/VLANInfo.java | 248 ++++
.../CreateSubscriptionRequestToJson.java | 53 +
.../cloudsigma2/functions/DriveToJson.java | 63 +
.../functions/FirewallPolicyToJson.java | 92 ++
.../cloudsigma2/functions/IPInfoToJson.java | 47 +
.../functions/LibraryDriveToJson.java | 55 +
.../functions/ProfileInfoToJson.java | 99 ++
.../cloudsigma2/functions/ServerInfoToJson.java | 145 ++
.../cloudsigma2/functions/TagToJson.java | 60 +
.../cloudsigma2/functions/VLANInfoToJson.java | 47 +
.../handlers/CloudSigmaErrorHandler.java | 106 ++
.../services/org.jclouds.apis.ApiMetadata | 1 +
.../cloudsigma2/CloudSigma2ApiExpectTest.java | 1315 ++++++++++++++++++
.../cloudsigma2/CloudSigma2ApiLiveTest.java | 663 +++++++++
.../functions/CloudSigma2ParserTest.java | 42 +
.../CreateSubscriptionRequestToJsonTest.java | 57 +
.../cloudsigma2/functions/DriveToJsonTest.java | 99 ++
.../functions/FirewallPolicyToJsonTest.java | 150 ++
.../cloudsigma2/functions/IPInfoToJsonTest.java | 90 ++
.../functions/LibraryDriveToJsonTest.java | 87 ++
.../functions/ProfileInfoToJsonTest.java | 103 ++
.../functions/ServerInfoToJsonTest.java | 157 +++
.../cloudsigma2/functions/TagToJsonTest.java | 99 ++
.../functions/VLANInfoToJsonTest.java | 85 ++
cloudsigma2/src/test/resources/balance.json | 4 +
.../src/test/resources/currentusage.json | 63 +
cloudsigma2/src/test/resources/discount.json | 29 +
.../drives-create-multiple-request.json | 1 +
.../test/resources/drives-create-request.json | 1 +
.../test/resources/drives-delete-multiple.json | 1 +
.../src/test/resources/drives-detail.json | 110 ++
.../src/test/resources/drives-single.json | 27 +
cloudsigma2/src/test/resources/drives.json | 36 +
.../fwpolicies-create-multiple-request.json | 1 +
.../resources/fwpolicies-create-request.json | 1 +
.../src/test/resources/fwpolicies-detail.json | 104 ++
.../src/test/resources/fwpolicies-single.json | 74 +
.../src/test/resources/ips-edit-request.json | 1 +
cloudsigma2/src/test/resources/ips-single.json | 24 +
cloudsigma2/src/test/resources/ips.json | 52 +
cloudsigma2/src/test/resources/ledger.json | 47 +
.../resources/libdrives-create-request.json | 1 +
.../src/test/resources/libdrives-single.json | 27 +
cloudsigma2/src/test/resources/libdrives.json | 95 ++
cloudsigma2/src/test/resources/licences.json | 35 +
cloudsigma2/src/test/resources/pricing.json | 82 ++
.../test/resources/profile-edit-request.json | 1 +
cloudsigma2/src/test/resources/profile.json | 34 +
.../resources/server-availability-group.json | 4 +
.../src/test/resources/server-detail.json | 120 ++
.../resources/servers-availability-groups.json | 10 +
.../servers-create-multiple-request.json | 1 +
.../test/resources/servers-create-request.json | 1 +
.../servers-delete-multiple-request.json | 1 +
.../src/test/resources/servers-single.json | 66 +
cloudsigma2/src/test/resources/servers.json | 42 +
.../subscriptions-create-multiple-request.json | 1 +
.../resources/subscriptions-create-request.json | 1 +
.../resources/subscriptions-single-get.json | 19 +
.../test/resources/subscriptions-single.json | 22 +
.../src/test/resources/subscriptions.json | 68 +
.../resources/tags-create-multiple-request.json | 1 +
.../src/test/resources/tags-create-request.json | 1 +
.../src/test/resources/tags-create-single.json | 54 +
.../test/resources/tags-delete-multiple.json | 1 +
cloudsigma2/src/test/resources/tags-detail.json | 72 +
cloudsigma2/src/test/resources/tags-single.json | 50 +
cloudsigma2/src/test/resources/vlan-single.json | 26 +
.../src/test/resources/vlans-edit-request.json | 1 +
cloudsigma2/src/test/resources/vlans.json | 47 +
pom.xml | 3 +
148 files changed, 15262 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/14619a17/cloudsigma2-lvs/pom.xml
----------------------------------------------------------------------
diff --git a/cloudsigma2-lvs/pom.xml b/cloudsigma2-lvs/pom.xml
new file mode 100644
index 0000000..03e4ec3
--- /dev/null
+++ b/cloudsigma2-lvs/pom.xml
@@ -0,0 +1,126 @@
+<?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>1.7.0-SNAPSHOT</version>
+ </parent>
+
+ <!-- TODO: when out of labs, switch to org.jclouds.provider -->
+ <groupId>org.apache.jclouds.labs</groupId>
+ <artifactId>cloudsigma2-lvs</artifactId>
+ <version>1.7.0-SNAPSHOT</version>
+ <name>jclouds CloudSigma v2 Las Vegas Provider</name>
+ <description>ComputeService binding to the CloudSigma datacenter in SuperNAP Las Vegas</description>
+ <packaging>bundle</packaging>
+
+ <properties>
+ <test.cloudsigma2-lvs.endpoint>https://lvs.cloudsigma.com/api/2.0/</test.cloudsigma2-lvs.endpoint>
+ <test.cloudsigma2-lvs.api-version>2.0</test.cloudsigma2-lvs.api-version>
+ <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 />
+ <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.parent.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.jclouds</groupId>
+ <artifactId>jclouds-compute</artifactId>
+ <version>${project.parent.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.jclouds.driver</groupId>
+ <artifactId>jclouds-log4j</artifactId>
+ <version>${project.parent.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.jclouds.driver</groupId>
+ <artifactId>jclouds-sshj</artifactId>
+ <version>${project.parent.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-lvs.endpoint>${test.cloudsigma2-lvs.endpoint}</test.cloudsigma2-lvs.endpoint>
+ <test.cloudsigma2-lvs.api-version>${test.cloudsigma2-lvs.api-version}</test.cloudsigma2-lvs.api-version>
+ <test.cloudsigma2-lvs.build-version>${test.cloudsigma2-lvs.build-version}</test.cloudsigma2-lvs.build-version>
+ <test.cloudsigma2-lvs.identity>${test.cloudsigma2-lvs.identity}</test.cloudsigma2-lvs.identity>
+ <test.cloudsigma2-lvs.credential>${test.cloudsigma2-lvs.credential}</test.cloudsigma2-lvs.credential>
+ <test.cloudsigma2-lvs.template>${test.cloudsigma2-lvs.template}</test.cloudsigma2-lvs.template>
+ </systemPropertyVariables>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+</project>
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/14619a17/cloudsigma2-lvs/src/main/java/org/jclouds/cloudsigma2/CloudSigma2LasVegasProviderMetadata.java
----------------------------------------------------------------------
diff --git a/cloudsigma2-lvs/src/main/java/org/jclouds/cloudsigma2/CloudSigma2LasVegasProviderMetadata.java b/cloudsigma2-lvs/src/main/java/org/jclouds/cloudsigma2/CloudSigma2LasVegasProviderMetadata.java
new file mode 100644
index 0000000..896baeb
--- /dev/null
+++ b/cloudsigma2-lvs/src/main/java/org/jclouds/cloudsigma2/CloudSigma2LasVegasProviderMetadata.java
@@ -0,0 +1,82 @@
+/*
+ * 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 Las Vegas.
+ *
+ * @author Vladimir Shevchenko
+ */
+public class CloudSigma2LasVegasProviderMetadata extends BaseProviderMetadata {
+
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ @Override
+ public Builder toBuilder() {
+ return builder().fromProviderMetadata(this);
+ }
+
+ public CloudSigma2LasVegasProviderMetadata() {
+ super(builder());
+ }
+
+ public CloudSigma2LasVegasProviderMetadata(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-lvs")
+ .name("CloudSigma 2 Las Vegas")
+ .apiMetadata(new CloudSigma2ApiMetadata())
+ .homepage(URI.create("http://www.cloudsigma.com/en/our-cloud/features"))
+ .console(URI.create("https://gui.lvs.cloudsigma.com/"))
+ .iso3166Codes("US-NV")
+ .endpoint("https://lvs.cloudsigma.com/api/2.0/")
+ .defaultProperties(CloudSigma2LasVegasProviderMetadata.defaultProperties());
+ }
+
+ @Override
+ public CloudSigma2LasVegasProviderMetadata build() {
+ return new CloudSigma2LasVegasProviderMetadata(this);
+ }
+
+ @Override
+ public Builder fromProviderMetadata(
+ ProviderMetadata in) {
+ super.fromProviderMetadata(in);
+ return this;
+ }
+
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/14619a17/cloudsigma2-lvs/src/main/resources/META-INF/services/org.jclouds.providers.ProviderMetadata
----------------------------------------------------------------------
diff --git a/cloudsigma2-lvs/src/main/resources/META-INF/services/org.jclouds.providers.ProviderMetadata b/cloudsigma2-lvs/src/main/resources/META-INF/services/org.jclouds.providers.ProviderMetadata
new file mode 100644
index 0000000..3b66f7d
--- /dev/null
+++ b/cloudsigma2-lvs/src/main/resources/META-INF/services/org.jclouds.providers.ProviderMetadata
@@ -0,0 +1 @@
+org.jclouds.cloudsigma2.CloudSigma2LasVegasProviderMetadata
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/14619a17/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
new file mode 100644
index 0000000..52863f4
--- /dev/null
+++ b/cloudsigma2-lvs/src/test/java/org/jclouds/cloudsigma2/CloudSigma2LasVegasLiveTest.java
@@ -0,0 +1,29 @@
+/*
+ * 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;
+
+/**
+ * @author Vladimir Shevchenko
+ */
+@Test(groups = {"live"})
+public class CloudSigma2LasVegasLiveTest extends CloudSigma2ApiLiveTest{
+ public CloudSigma2LasVegasLiveTest() {
+ provider = "cloudsigma2-lvs";
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/14619a17/cloudsigma2-zrh/pom.xml
----------------------------------------------------------------------
diff --git a/cloudsigma2-zrh/pom.xml b/cloudsigma2-zrh/pom.xml
new file mode 100644
index 0000000..b172129
--- /dev/null
+++ b/cloudsigma2-zrh/pom.xml
@@ -0,0 +1,126 @@
+<?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>1.7.0-SNAPSHOT</version>
+ </parent>
+
+ <!-- TODO: when out of labs, switch to org.jclouds.provider -->
+ <groupId>org.apache.jclouds.labs</groupId>
+ <artifactId>cloudsigma2-zrh</artifactId>
+ <version>1.7.0-SNAPSHOT</version>
+ <name>jclouds CloudSigma v2 Zurich Provider</name>
+ <description>ComputeService binding to the CloudSigma datacenter in Zürich</description>
+ <packaging>bundle</packaging>
+
+ <properties>
+ <test.cloudsigma2-zrh.endpoint>https://zrh.cloudsigma.com/api/2.0/</test.cloudsigma2-zrh.endpoint>
+ <test.cloudsigma2-zrh.api-version>2.0</test.cloudsigma2-zrh.api-version>
+ <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 />
+ <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.parent.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.jclouds</groupId>
+ <artifactId>jclouds-compute</artifactId>
+ <version>${project.parent.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.jclouds.driver</groupId>
+ <artifactId>jclouds-log4j</artifactId>
+ <version>${project.parent.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.jclouds.driver</groupId>
+ <artifactId>jclouds-sshj</artifactId>
+ <version>${project.parent.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-zrh.endpoint>${test.cloudsigma2-zrh.endpoint}</test.cloudsigma2-zrh.endpoint>
+ <test.cloudsigma2-zrh.api-version>${test.cloudsigma2-zrh.api-version}</test.cloudsigma2-zrh.api-version>
+ <test.cloudsigma2-zrh.build-version>${test.cloudsigma2-zrh.build-version}</test.cloudsigma2-zrh.build-version>
+ <test.cloudsigma2-zrh.identity>${test.cloudsigma2-zrh.identity}</test.cloudsigma2-zrh.identity>
+ <test.cloudsigma2-zrh.credential>${test.cloudsigma2-zrh.credential}</test.cloudsigma2-zrh.credential>
+ <test.cloudsigma2-zrh.template>${test.cloudsigma2-zrh.template}</test.cloudsigma2-zrh.template>
+ </systemPropertyVariables>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+</project>
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/14619a17/cloudsigma2-zrh/src/main/java/org/jclouds/cloudsigma2/CloudSigma2ZurichProviderMetadata.java
----------------------------------------------------------------------
diff --git a/cloudsigma2-zrh/src/main/java/org/jclouds/cloudsigma2/CloudSigma2ZurichProviderMetadata.java b/cloudsigma2-zrh/src/main/java/org/jclouds/cloudsigma2/CloudSigma2ZurichProviderMetadata.java
new file mode 100644
index 0000000..dd4b9b4
--- /dev/null
+++ b/cloudsigma2-zrh/src/main/java/org/jclouds/cloudsigma2/CloudSigma2ZurichProviderMetadata.java
@@ -0,0 +1,82 @@
+/*
+ * 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.jclouds.providers.ProviderMetadata;
+import org.jclouds.providers.internal.BaseProviderMetadata;
+
+import java.net.URI;
+import java.util.Properties;
+
+/**
+ * Implementation of {@link org.jclouds.providers.internal.BaseProviderMetadata} for CloudSigma Zurich.
+ *
+ * @author Vladimir Shevchenko
+ */
+public class CloudSigma2ZurichProviderMetadata extends BaseProviderMetadata {
+
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ @Override
+ public Builder toBuilder() {
+ return builder().fromProviderMetadata(this);
+ }
+
+ public CloudSigma2ZurichProviderMetadata() {
+ super(builder());
+ }
+
+ public CloudSigma2ZurichProviderMetadata(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-zrh")
+ .name("CloudSigma 2 Zurich")
+ .apiMetadata(new CloudSigma2ApiMetadata())
+ .homepage(URI.create("http://www.cloudsigma.com/en/our-cloud/features"))
+ .console(URI.create("https://gui.zrh.cloudsigma.com/"))
+ .iso3166Codes("CH-ZH")
+ .endpoint("https://zrh.cloudsigma.com/api/2.0/")
+ .defaultProperties(CloudSigma2ZurichProviderMetadata.defaultProperties());
+ }
+
+ @Override
+ public CloudSigma2ZurichProviderMetadata build() {
+ return new CloudSigma2ZurichProviderMetadata(this);
+ }
+
+ @Override
+ public Builder fromProviderMetadata(
+ ProviderMetadata in) {
+ super.fromProviderMetadata(in);
+ return this;
+ }
+
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/14619a17/cloudsigma2-zrh/src/main/resources/META-INF/services/org.jclouds.providers.ProviderMetadata
----------------------------------------------------------------------
diff --git a/cloudsigma2-zrh/src/main/resources/META-INF/services/org.jclouds.providers.ProviderMetadata b/cloudsigma2-zrh/src/main/resources/META-INF/services/org.jclouds.providers.ProviderMetadata
new file mode 100644
index 0000000..d7f9791
--- /dev/null
+++ b/cloudsigma2-zrh/src/main/resources/META-INF/services/org.jclouds.providers.ProviderMetadata
@@ -0,0 +1 @@
+org.jclouds.cloudsigma2.CloudSigma2ZurichProviderMetadata
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/14619a17/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
new file mode 100644
index 0000000..af1f1f1
--- /dev/null
+++ b/cloudsigma2-zrh/src/test/java/org/jclouds/cloudsigma2/CloudSigma2ZurichLiveTest.java
@@ -0,0 +1,29 @@
+/*
+ * 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;
+
+/**
+ * @author Vladimir Shevchenko
+ */
+@Test(groups = {"live"})
+public class CloudSigma2ZurichLiveTest extends CloudSigma2ApiLiveTest{
+ public CloudSigma2ZurichLiveTest() {
+ provider = "cloudsigma2-zrh";
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/14619a17/cloudsigma2/README.txt
----------------------------------------------------------------------
diff --git a/cloudsigma2/README.txt b/cloudsigma2/README.txt
new file mode 100644
index 0000000..c144846
--- /dev/null
+++ b/cloudsigma2/README.txt
@@ -0,0 +1,6 @@
+#
+# The jclouds provider for CloudSigma2 (http://www.cloudsigma.com/).
+#
+# TODO: Implementation status.
+# TODO: Supported features.
+# TODO: Usage example.
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/14619a17/cloudsigma2/pom.xml
----------------------------------------------------------------------
diff --git a/cloudsigma2/pom.xml b/cloudsigma2/pom.xml
new file mode 100644
index 0000000..5b57f00
--- /dev/null
+++ b/cloudsigma2/pom.xml
@@ -0,0 +1,117 @@
+<?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>1.7.0-SNAPSHOT</version>
+ </parent>
+
+ <!-- TODO: when out of labs, switch to org.jclouds.provider -->
+ <groupId>org.apache.jclouds.labs</groupId>
+ <artifactId>cloudsigma2</artifactId>
+ <version>1.7.0-SNAPSHOT</version>
+ <name>jclouds CloudSigma v2 API</name>
+ <description>ComputeService binding to the CloudSigma v2 API</description>
+ <packaging>bundle</packaging>
+
+ <properties>
+ <test.cloudsigma2.endpoint>https://zrh.cloudsigma.com/api/2.0/</test.cloudsigma2.endpoint>
+ <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>
+ <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</groupId>
+ <artifactId>jclouds-compute</artifactId>
+ <version>${project.parent.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.jclouds.driver</groupId>
+ <artifactId>jclouds-sshj</artifactId>
+ <version>${project.parent.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.jclouds</groupId>
+ <artifactId>jclouds-core</artifactId>
+ <version>${project.parent.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.jclouds</groupId>
+ <artifactId>jclouds-compute</artifactId>
+ <version>${project.parent.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.jclouds.driver</groupId>
+ <artifactId>jclouds-log4j</artifactId>
+ <version>${project.parent.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.endpoint>${test.cloudsigma2.endpoint}</test.cloudsigma2.endpoint>
+ <test.cloudsigma2.api-version>${test.cloudsigma2.api-version}</test.cloudsigma2.api-version>
+ <test.cloudsigma2.build-version>${test.cloudsigma2.build-version}</test.cloudsigma2.build-version>
+ <test.cloudsigma2.credential>${test.cloudsigma2.credential}</test.cloudsigma2.credential>
+ <test.cloudsigma2.template>${test.cloudsigma2.template}</test.cloudsigma2.template>
+ </systemPropertyVariables>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+</project>
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/14619a17/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
new file mode 100644
index 0000000..31eafa2
--- /dev/null
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/CloudSigma2Api.java
@@ -0,0 +1,883 @@
+/*
+ * 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 com.google.inject.name.Named;
+import org.jclouds.Fallbacks;
+import org.jclouds.cloudsigma2.binders.BindCreateSubscriptionRequest;
+import org.jclouds.cloudsigma2.binders.BindCreateSubscriptionRequestList;
+import org.jclouds.cloudsigma2.binders.BindDriveToJson;
+import org.jclouds.cloudsigma2.binders.BindDrivesToJson;
+import org.jclouds.cloudsigma2.binders.BindFirewallPoliciesListToJsonRequest;
+import org.jclouds.cloudsigma2.binders.BindFirewallPolicyToJsonRequest;
+import org.jclouds.cloudsigma2.binders.BindIPInfoToJsonRequest;
+import org.jclouds.cloudsigma2.binders.BindLibraryDriveToJson;
+import org.jclouds.cloudsigma2.binders.BindProfileInfoToJsonRequest;
+import org.jclouds.cloudsigma2.binders.BindServerInfoListToJsonRequest;
+import org.jclouds.cloudsigma2.binders.BindServerInfoToJsonRequest;
+import org.jclouds.cloudsigma2.binders.BindTagListToJsonRequest;
+import org.jclouds.cloudsigma2.binders.BindTagToJsonRequest;
+import org.jclouds.cloudsigma2.binders.BindUuidStringsToJsonArray;
+import org.jclouds.cloudsigma2.binders.BindVLANToJsonRequest;
+import org.jclouds.cloudsigma2.domain.AccountBalance;
+import org.jclouds.cloudsigma2.domain.CreateSubscriptionRequest;
+import org.jclouds.cloudsigma2.domain.CurrentUsage;
+import org.jclouds.cloudsigma2.domain.Discount;
+import org.jclouds.cloudsigma2.domain.Drive;
+import org.jclouds.cloudsigma2.domain.DriveInfo;
+import org.jclouds.cloudsigma2.domain.DrivesListRequestFieldsGroup;
+import org.jclouds.cloudsigma2.domain.FirewallPolicy;
+import org.jclouds.cloudsigma2.domain.IP;
+import org.jclouds.cloudsigma2.domain.IPInfo;
+import org.jclouds.cloudsigma2.domain.LibraryDrive;
+import org.jclouds.cloudsigma2.domain.License;
+import org.jclouds.cloudsigma2.domain.Pricing;
+import org.jclouds.cloudsigma2.domain.ProfileInfo;
+import org.jclouds.cloudsigma2.domain.Server;
+import org.jclouds.cloudsigma2.domain.ServerAvailabilityGroup;
+import org.jclouds.cloudsigma2.domain.ServerInfo;
+import org.jclouds.cloudsigma2.domain.Subscription;
+import org.jclouds.cloudsigma2.domain.Tag;
+import org.jclouds.cloudsigma2.domain.Transaction;
+import org.jclouds.cloudsigma2.domain.VLANInfo;
+import org.jclouds.http.filters.BasicAuthentication;
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.rest.annotations.BinderParam;
+import org.jclouds.rest.annotations.Fallback;
+import org.jclouds.rest.annotations.OnlyElement;
+import org.jclouds.rest.annotations.RequestFilters;
+import org.jclouds.rest.annotations.SelectJson;
+import org.jclouds.rest.annotations.SkipEncoding;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.DefaultValue;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.QueryParam;
+import java.io.Closeable;
+import java.util.List;
+
+/**
+ * Provides synchronous access to CloudSigma v2 API.
+ *
+ * @author Vladimir Shevchenko
+ * @see <a href="https://zrh.cloudsigma.com/docs/" />
+ */
+@RequestFilters(BasicAuthentication.class)
+@Consumes(javax.ws.rs.core.MediaType.APPLICATION_JSON)
+@SkipEncoding({'?', '/', '='})
+public interface CloudSigma2Api extends Closeable {
+
+ /**
+ * Gets the list of drives to which the authenticated user has access.
+ *
+ * @return list of drives or empty list if no drives are found
+ */
+ @Named("drive:listDrives")
+ @GET
+ @Path("/drives/?limit=0")
+ @SelectJson("objects")
+ List<Drive> listDrives();
+
+ /**
+ * Gets the list of drives to which the authenticated user has access.
+ *
+ * @param fields A set of field names specifying the returned fields
+ * @param limit number of drives to show
+ * @return or empty set if no drives are found
+ */
+ @Named("drive:listDrives")
+ @GET
+ @Path("/drives/?limit=0")
+ @SelectJson("objects")
+ List<DriveInfo> listDrives(@QueryParam("fields") DrivesListRequestFieldsGroup fields
+ , @DefaultValue("0") @QueryParam("limit") int limit);
+
+ /**
+ * Gets the detailed list of drives with additional information to which the authenticated user has access.
+ *
+ * @return list of drives or empty list if no drives are found
+ */
+ @Named("drive:listDrivesInfo")
+ @GET
+ @Path("/drives/detail/?limit=0")
+ @SelectJson("objects")
+ List<DriveInfo> listDrivesInfo();
+
+ /**
+ * Gets detailed information for drive identified by drive uuid
+ *
+ * @param uuid drive uuid to get
+ * @return null, if not found
+ */
+ @Named("drive:getDriveInfo/{uuid}")
+ @GET
+ @Path("/drives/{uuid}/")
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ DriveInfo getDriveInfo(@PathParam("uuid") String uuid);
+
+ /**
+ * Creates a new drive
+ *
+ * @param createDrive required parameters: name, size, media
+ * @return newly created drive
+ */
+ @Named("drive:createDrive")
+ @POST
+ @Path("/drives/")
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ @SelectJson("objects")
+ @OnlyElement
+ DriveInfo createDrive(@BinderParam(BindDriveToJson.class) DriveInfo createDrive);
+
+ /**
+ * Creates multiple new drives
+ *
+ * @param createDrives required parameters: name, size, media
+ * @return newly created drives
+ */
+ @Named("drive:listDrives")
+ @POST
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ @SelectJson("objects")
+ @Path("/drives/")
+ List<DriveInfo> createDrives(@BinderParam(BindDrivesToJson.class) List<DriveInfo> createDrives);
+
+ /**
+ * Deletes a single mounted or unmounted drive.
+ *
+ * @param uuid what to delete
+ */
+ @Named("drive:deleteDrive/{uuid}")
+ @DELETE
+ @Path("/drives/{uuid}/")
+ @Fallback(Fallbacks.VoidOnNotFoundOr404.class)
+ void deleteDrive(@PathParam("uuid") String uuid);
+
+ /**
+ * Deletes multiple mounted or unmounted drives specified by their UUID’s.
+ *
+ * @param uuids what drives to delete
+ */
+ @Named("drive:deleteDrives")
+ @DELETE
+ @Path("/drives/")
+ @Fallback(Fallbacks.VoidOnNotFoundOr404.class)
+ void deleteDrives(@BinderParam(BindUuidStringsToJsonArray.class) Iterable<String> uuids);
+
+ /**
+ * Edits a mounted or unmounted drive. If mounted, the server mounted on should be stopped.
+ *
+ * @param sourceUuid source drive to edit
+ * @param driveInfo drive parameters to change
+ * @return changed drive
+ */
+ @Named("drive:editDrive/{uuid}")
+ @PUT
+ @Path("/drives/{uuid}/")
+ @Fallback(Fallbacks.VoidOnNotFoundOr404.class)
+ DriveInfo editDrive(@PathParam("uuid") String sourceUuid
+ , @BinderParam(BindDriveToJson.class) DriveInfo driveInfo);
+
+
+ /**
+ * Clones a drive. Request body is optional and any or all of the key/value pairs can be omitted.
+ *
+ * @param sourceUuid source drive to clone
+ * @param driveInfo drive parameters to change
+ * @return new drive
+ */
+ @Named("drive:cloneDrive/{uuid}")
+ @POST
+ @Path("/drives/{uuid}/action/?do=clone")
+ @Fallback(Fallbacks.VoidOnNotFoundOr404.class)
+ DriveInfo cloneDrive(@PathParam("uuid") String sourceUuid
+ , @Nullable @BinderParam(BindDriveToJson.class) DriveInfo driveInfo);
+
+ /**
+ * Gets the list of library drives to which the authenticated user has access.
+ *
+ * @return list of library drives to which the authenticated user has access
+ */
+ @Named("libdrive:listLibraryDrives")
+ @GET
+ @Path("/libdrives/?limit=0")
+ @SelectJson("objects")
+ List<LibraryDrive> listLibraryDrives();
+
+ /**
+ * Gets detailed information for library drive identified by uuid.
+ *
+ * @param uuid uuid of library drive to be listed
+ * @return drive information or null if not found
+ */
+ @Named("libdrive:getLibraryDrive/{uuid}")
+ @GET
+ @Path("/libdrives/{uuid}/")
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ LibraryDrive getLibraryDrive(@PathParam("uuid") String uuid);
+
+ /**
+ * If a library drive is not a CDROM, you have to clone it in your account in order to use it.
+ *
+ * @param uuid uuid of library drive to clone
+ * @param libraryDrive cloned drive
+ * @return cloned drive information or null if not found
+ */
+ @Named("libdrive:cloneLibraryDrive/{uuid}")
+ @POST
+ @Path("/libdrives/{uuid}/action/?do=clone")
+ @Fallback(Fallbacks.VoidOnNotFoundOr404.class)
+ LibraryDrive cloneLibraryDrive(@PathParam("uuid") String uuid
+ , @Nullable @BinderParam(BindLibraryDriveToJson.class) LibraryDrive libraryDrive);
+
+ /**
+ * Gets the list of servers to which the authenticated user has access.
+ *
+ * @return list of servers or empty list if no servers are found
+ */
+ @Named("server:listServers")
+ @GET
+ @Path("/servers/?limit=0")
+ @SelectJson("objects")
+ List<Server> listServers();
+
+ /**
+ * Gets the detailed list of servers to which the authenticated user has access.
+ *
+ * @return list of servers or empty list if no servers are found
+ */
+ @Named("server:listServersInfo")
+ @GET
+ @Path("/servers/detail/?limit=0")
+ @SelectJson("objects")
+ List<ServerInfo> listServersInfo();
+
+ /**
+ * Creates a new virtual server or multiple servers.
+ * The minimial amount of information you need to set is:
+ * cpu
+ * memory
+ * name
+ * vncPassword
+ *
+ * @param createServer required parameters: cpu, memory, name, vncPassword
+ * @return newly created server
+ */
+ @Named("server:createServer")
+ @POST
+ @Path("/servers/")
+ @SelectJson("objects")
+ @OnlyElement
+ ServerInfo createServer(@BinderParam(BindServerInfoToJsonRequest.class) ServerInfo createServer);
+
+ /**
+ * create a new servers
+ *
+ * @param servers servers to create. Required parameters: cpu, memory, name, vncPassword
+ * @return newly created servers
+ */
+ @Named("server:createServers")
+ @POST
+ @Path("/servers/")
+ @SelectJson("objects")
+ List<ServerInfo> createServers(@BinderParam(BindServerInfoListToJsonRequest.class) Iterable<ServerInfo> servers);
+
+ /**
+ * Edits a server. Used also for attaching NIC’s and drives to servers.
+ *
+ * @param uuid server uuid
+ * @param server data to change
+ * @return modified server
+ */
+ @Named("server:editServer/{uuid}")
+ @PUT
+ @Path("/servers/{uuid}/")
+ @Fallback(Fallbacks.VoidOnNotFoundOr404.class)
+ ServerInfo editServer(@PathParam("uuid") String uuid
+ , @BinderParam(BindServerInfoToJsonRequest.class) ServerInfo server);
+
+ /**
+ * Deletes a single server.
+ *
+ * @param uuid uuid of server to delete
+ */
+ @Named("server:deleteServer/{uuid}")
+ @DELETE
+ @Path("/servers/{uuid}/")
+ @Fallback(Fallbacks.VoidOnNotFoundOr404.class)
+ void deleteServer(@PathParam("uuid") String uuid);
+
+ /**
+ * Deletes multiple servers specified by their UUID’s.
+ *
+ * @param uuids server uuids to delete
+ */
+ @Named("server:deleteServers")
+ @DELETE
+ @Path("/servers/")
+ @Fallback(Fallbacks.VoidOnNotFoundOr404.class)
+ void deleteServers(@BinderParam(BindUuidStringsToJsonArray.class) Iterable<String> uuids);
+
+ /**
+ * Clones a server. Empty body.
+ * Does cascading clone of server drives.
+ * IPs of the cloned server are set to DHCP.
+ * All other properties of the clone are equal to the original.
+ *
+ * @param uuid server what to clone
+ *
+ * @return cloned server
+ */
+ @Named("server:cloneServer/{uuid}")
+ @POST
+ @Path("/servers/{uuid}/action/?do=clone")
+ @Fallback(Fallbacks.VoidOnNotFoundOr404.class)
+ ServerInfo cloneServer(@PathParam("uuid") String uuid);
+
+ /**
+ * Gets detailed information for server identified by server uuid.
+ *
+ * @param uuid server uuid
+ * @return server info or null, if not found
+ */
+ @Named("server:getServerInfo/{uuid}")
+ @GET
+ @Path("/servers/{uuid}/")
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ ServerInfo getServerInfo(@PathParam("uuid") String uuid);
+
+ /**
+ * Starts a server with specific UUID.
+ *
+ * @param uuid uuid of server to start
+ */
+ @Named("server:startServer/{uuid}")
+ @POST
+ @Path("/servers/{uuid}/action/?do=start")
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ void startServer(@PathParam("uuid") String uuid);
+
+ /**
+ * Stops a server with specific UUID.
+ *
+ * @param uuid uuid of server to stop
+ */
+ @Named("server:stopServer/{uuid}")
+ @POST
+ @Path("/servers/{uuid}/action/?do=stop")
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ void stopServer(@PathParam("uuid") String uuid);
+
+ /**
+ * Starts a server with specific UUID assuring that it is started on a different physical infrastructure host
+ * from the other servers specified in the avoid argument which is
+ * a single server UUID or a comma-separated list of server UUIDs.
+ * This way the server specified by uuid is run in a distinct availability group from the other listed servers.
+ * Note that it might not always be possible to run a server in a different availability group,
+ * therefore the order of the avoid list also signifies the priority of avoiding other servers.
+ *
+ * @param uuid uuid of server to start
+ * @param uuidGroup availability group to avoid
+ */
+ @Named("server:startServerInSeparateAvailabilityGroup/{uuid}")
+ @POST
+ @Path("/servers/{uuid}/action/?do=start")
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ void startServerInSeparateAvailabilityGroup(@PathParam("uuid") String uuid
+ , @QueryParam("avoid") List<String> uuidGroup);
+
+ /**
+ * Opens a VNC tunnel to a server with specific UUID.
+ *
+ * @param uuid uuid of server to open VNC tunnel
+ */
+ @Named("server:openServerVNCTunnel/{uuid}")
+ @POST
+ @Path("/servers/{uuid}/action/?do=open_vnc")
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ void openServerVNCTunnel(@PathParam("uuid") String uuid);
+
+ /**
+ * Closes a VNC tunnel to a server with specific UUID.
+ *
+ * @param uuid uuid of server to close VNC tunnel
+ */
+ @Named("server:closeServerVCNTunnel/{uuid}")
+ @POST
+ @Path("/servers/{uuid}/action/?do=close_vnc")
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ void closeServerVCNTunnel(@PathParam("uuid") String uuid);
+
+ /**
+ * @return which servers share same physical infrastructure host.
+ */
+ @Named("server:listServerAvailabilityGroup")
+ @GET
+ @Path("/servers/availability_groups/?limit=0")
+ List<List<String>> listServerAvailabilityGroup();
+
+ /**
+ * Queries which other servers share same physical host with the given one.
+ *
+ * @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}")
+ @GET
+ @PathParam("/servers/availability_groups/{uuid}/")
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ ServerAvailabilityGroup getServerAvailabilityGroup(@PathParam("uuid") String uuid);
+
+ /**
+ * Gets the list of firewall policies to which the authenticated user has access.
+ *
+ * @return list of firewall policies to which the authenticated user has access.
+ */
+ @Named("fwpolicy:listFirewallPolicies")
+ @GET
+ @Path("/fwpolicies/?limit=0")
+ @SelectJson("objects")
+ List<FirewallPolicy> listFirewallPolicies();
+
+ /**
+ * Gets a detailed list of firewall policies to which the authenticated user has access.
+ *
+ * @return list of firewall policies to which the authenticated user has access.
+ */
+ @Named("fwpolicy:listFirewallPoliciesInfo")
+ @GET
+ @Path("/fwpolicies/detail/?limit=0")
+ @SelectJson("objects")
+ List<FirewallPolicy> listFirewallPoliciesInfo();
+
+ /**
+ * Creates firewall policies.
+ *
+ * @param firewallPolicies firewall policies to create
+ * @return list of created firewall policies
+ */
+ @Named("fwpolicy:createFirewallPolicies")
+ @POST
+ @Path("/fwpolicies/")
+ @SelectJson("objects")
+ List<FirewallPolicy> createFirewallPolicies(
+ @BinderParam(BindFirewallPoliciesListToJsonRequest.class) List<FirewallPolicy> firewallPolicies);
+
+ /**
+ * Creates a firewall policy.
+ *
+ * @param firewallPolicy firewall policy to create
+ * @return created firewall policy
+ */
+ @Named("fwpolicy:createFirewallPolicy")
+ @POST
+ @Path("/fwpolicies/")
+ @SelectJson("objects")
+ @OnlyElement
+ FirewallPolicy createFirewallPolicy(
+ @BinderParam(BindFirewallPolicyToJsonRequest.class) FirewallPolicy firewallPolicy);
+
+ /**
+ * Update an existing firewall policy
+ *
+ * @param uuid uuid of policy to update
+ * @param firewallPolicy firewall policy data to update
+ * @return updated firewall policy
+ */
+ @Named("fwpolicy:editFirewallPolicy/{uuid}")
+ @PUT
+ @Path("/fwpolicies/{uuid}/")
+ FirewallPolicy editFirewallPolicy(@PathParam("uuid") String uuid
+ , @BinderParam(BindFirewallPolicyToJsonRequest.class) FirewallPolicy firewallPolicy);
+
+ /**
+ * 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}")
+ @GET
+ @Path("/vlans/{uuid}/")
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ VLANInfo getVLANInfo(@PathParam("uuid") String uuid);
+
+ /**
+ * Gets the list of VLANs to which the authenticated user has access.
+ *
+ * @return list of VLANs or empty list if no vlans are found
+ */
+ @Named("vlan:listVLANs")
+ @GET
+ @Path("/vlans/?limit=0")
+ @SelectJson("objects")
+ List<VLANInfo> listVLANs();
+
+ /**
+ * Gets the list of VLANs to which the authenticated user has access.
+ *
+ * @return list of VLANs or empty list if no vlans are found
+ */
+ @Named("vlan:listVLANInfo")
+ @GET
+ @Path("/vlans/detail/?limit=0")
+ @SelectJson("objects")
+ List<VLANInfo> listVLANInfo();
+
+ /**
+ * Currently only VLAN meta field can be edited.
+ *
+ * @param uuid uuid of VLAN to edit
+ * @param vlanInfo data to change
+ * @return changed VLAN
+ */
+ @Named("vlan:listVLANInfo/{uuid}")
+ @PUT
+ @Path("/vlans/{uuid}/")
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ VLANInfo editVLAN(@PathParam("uuid") String uuid
+ , @BinderParam(BindVLANToJsonRequest.class) VLANInfo vlanInfo);
+
+ /**
+ * Gets the list of IPs to which the authenticated user has access.
+ *
+ * @return list of IPs or empty list if no ips are found
+ */
+ @Named("ip:listIPs")
+ @GET
+ @Path("/ips/?limit=0")
+ @SelectJson("objects")
+ List<IP> listIPs();
+
+ /**
+ * Gets the detailed list of IPs with additional information to which the authenticated user has access.
+ *
+ * @return list of IPs or empty list if no ips are found
+ */
+ @Named("ip:listIPInfo")
+ @GET
+ @Path("/ips/detail/?limit=0")
+ @SelectJson("objects")
+ List<IPInfo> listIPInfo();
+
+ /**
+ * Gets detailed information for IP identified by IP uuid.
+ *
+ * @param uuid uuid of IP to get
+ * @return null, if not found
+ */
+ @Named("ip:getIPInfo/{uuid}")
+ @GET
+ @Path("/ips/{uuid}/")
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ IPInfo getIPInfo(@PathParam("uuid") String uuid);
+
+ /**
+ * Currently only IP meta field can be edited.
+ *
+ * @param uuid uuid of IP to edit
+ * @param ipInfo data to change
+ * @return changed IP
+ */
+ @Named("ip:editIP/{uuid}")
+ @PUT
+ @Path("/ips/{uuid}/")
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ IPInfo editIP(@PathParam("uuid") String uuid
+ , @BinderParam(BindIPInfoToJsonRequest.class) IPInfo ipInfo);
+
+ /**
+ * Gets the list of tags to which the authenticated user has access.
+ *
+ * @return list of tags to which the authenticated user has access
+ */
+ @Named("tag:listTags")
+ @GET
+ @Path("/tags/?limit=0")
+ @SelectJson("objects")
+ List<Tag> listTags();
+
+ /**
+ * 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/?limit=0")
+ @SelectJson("objects")
+ List<Tag> listTagsInfo();
+
+ /**
+ * Gets detailed information for tag identified by tag uuid.
+ *
+ * @param uuid tag uuid
+ * @return detailed info of tag
+ */
+ @Named("tag:getTagInfo/{uuid}")
+ @GET
+ @Path("/tags/{uuid}/")
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ Tag getTagInfo(@PathParam("uuid") String uuid);
+
+ /**
+ * Edits a tag.
+ * It is possible to add or remove resources to a tag by replacing the resources list with a new one
+ *
+ * @param uuid tag uuid
+ * @param tag info to change
+ * @return detailed info of tag
+ */
+ @Named("tag:editTag/{uuid}")
+ @PUT
+ @Path("/tags/{uuid}/")
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ Tag editTag(@PathParam("uuid") String uuid, @BinderParam(BindTagToJsonRequest.class) Tag tag);
+
+ /**
+ * Creates a new tag
+ *
+ * @param tag tag to create
+ * @return created tag
+ */
+ @Named("tag:createTag")
+ @POST
+ @Path("/tags/")
+ @SelectJson("objects")
+ @OnlyElement
+ Tag createTag(@BinderParam(BindTagToJsonRequest.class) Tag tag);
+
+ /**
+ * Deletes a single tag.
+ *
+ * @param uuid uuid of tag to delete
+ */
+ @Named("tag:deleteTag/{uuid}")
+ @DELETE
+ @Path("/tags/{uuid}/")
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ void deleteTag(@PathParam("uuid")String uuid);
+
+ /**
+ * Creates a multiple new tags
+ *
+ * @param tags tags to create
+ * @return created tags
+ */
+ @Named("tag:createTags")
+ @POST
+ @Path("/tags/")
+ @SelectJson("objects")
+ List<Tag> createTags(@BinderParam(BindTagListToJsonRequest.class) List<Tag> tags);
+
+ /**
+ * Gets the user profile.
+ *
+ * @return profile information
+ */
+ @Named("profile:getProfileInfo")
+ @GET
+ @Path("/profile/")
+ ProfileInfo getProfileInfo();
+
+ /**
+ * Edits a user profile.
+ *
+ * @param profile data to change
+ * @return info or null, if not found
+ */
+ @Named("profile:editProfileInfo")
+ @PUT
+ @Path("/profile/")
+ ProfileInfo editProfileInfo(@BinderParam(BindProfileInfoToJsonRequest.class) ProfileInfo profile);
+
+ /**
+ * Get the balance and currency of the current account.
+ *
+ * @return current account balance and currency
+ */
+ @Named("balance:getAccountBalance")
+ @GET
+ @Path("/balance/")
+ AccountBalance getAccountBalance();
+
+ /**
+ * Get the current usage of the user.
+ *
+ * @return current usage of the user
+ */
+ @Named("currentusage:getCurrentUsage")
+ @GET
+ @Path("/currentusage/")
+ CurrentUsage getCurrentUsage();
+
+ /**
+ * Gets the list of subscriptions of the user.
+ *
+ * @return list of subscriptions of the user.
+ */
+ @Named("subscription:listSubscriptions")
+ @GET
+ @Path("/subscriptions/?limit=0")
+ @SelectJson("objects")
+ List<Subscription> listSubscriptions();
+
+ /**
+ * Returns requested subscription
+ *
+ * @return requested subscription.
+ */
+ @Named("subscription:getSubscription")
+ @GET
+ @Path("/subscriptions/{id}/")
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ Subscription getSubscription(@PathParam("id") String id);
+
+ /**
+ * This is identical to the listSubscriptions(), except that subscriptions are not actually bought.
+ *
+ * @return list of subscriptions that are not actually bought.
+ */
+ @Named("subscription:listSubscriptionsCalculator")
+ @GET
+ @Path("/subscriptioncalculator/?limit=0")
+ @SelectJson("objects")
+ List<Subscription> listSubscriptionsCalculator();
+
+ /**
+ * Creates a new subscription.
+ * Subscription times are rounded to noon UTC, using the following rules:
+ * - End time is always rounded to the next noon.
+ * - Start time is rounded to the maximum between the current time an the previous noon.
+ * This means that subscriptions bought for now do start now, but subscriptions for the future start at the previous noon.
+ *
+ * @param subscriptionRequest subscription request object
+ * @return created subscription
+ */
+ @Named("subscription:listSubscriptionsCalculator")
+ @POST
+ @Path("/subscriptions/")
+ @SelectJson("objects")
+ @OnlyElement
+ Subscription createSubscription(
+ @BinderParam(BindCreateSubscriptionRequest.class) CreateSubscriptionRequest subscriptionRequest);
+
+ /**
+ * Creates a new subscription. There is a limit of 500 subscriptions that can be purchased in one request.
+ * Subscription times are rounded to noon UTC, using the following rules:
+ * - End time is always rounded to the next noon.
+ * - Start time is rounded to the maximum between the current time an the previous noon.
+ * This means that subscriptions bought for now do start now, but subscriptions for the future start at the previous noon.
+ *
+ * @param subscriptionRequest parameters for new subscriptions
+ * @return new subscriptions
+ */
+ @Named("subscription:createSubscriptions")
+ @POST
+ @Path("/subscriptions/")
+ @SelectJson("objects")
+ List<Subscription> createSubscriptions(
+ @BinderParam(BindCreateSubscriptionRequestList.class) List<CreateSubscriptionRequest> subscriptionRequest);
+
+ /**
+ * Extends the subscription. An extended subscription is actually just another subscription that is linked to the original
+ * If a period or and end_time are specified in the request,they are used. If neither are specified,
+ * the creation length of the subscription is used.
+ *
+ * A caveat to this is that a subscription created initially with an end_time, the exact interval is used.
+ * Subscriptions that are created with a period have the period parsed again in the context of the new start_time.
+ * An example would be a subscription created on the 1st of February with a period of ‘1 month’ will be extended for 31 days,
+ * but one that was created with an end date of 1st of March will be extended for 28 days.
+ *
+ * If the specified subscription has actually been extended, it traverses and extends the last subscription in the chain.
+ *
+ * @param id id of subscription to extend
+ */
+ @Named("subscription:extendSubscription/{id}")
+ @POST
+ @Path("/subscriptions/{id}/action/?do=extend")
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ void extendSubscription(@PathParam("id") String id);
+
+ /**
+ * Toggles the autorenew flag of the subscription.
+ *
+ * @param id id of subscription to enable autorenew
+ */
+ @Named("subscription:enableSubscriptionAutorenew/{id}")
+ @POST
+ @Path("/subscriptions/{id}/action/?do=auto_renew")
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ void enableSubscriptionAutorenew(@PathParam("id") String id);
+
+ /**
+ * Gets the pricing information that are applicable to the cloud. Subscription prices use a burst level of 0.
+ *
+ * @return pricing information that are applicable to the cloud.
+ */
+ @Named("pricing:getPricing")
+ @GET
+ @Path("/pricing/")
+ Pricing getPricing();
+
+ /**
+ * Get discount information.
+ *
+ * @return discount information.
+ */
+ @Named("discount:listDiscounts")
+ @GET
+ @Path("/discount/?limit=0")
+ @SelectJson("objects")
+ List<Discount> listDiscounts();
+
+ /**
+ * Get the transactions for the account.
+ *
+ * @return transactions for the account.
+ */
+ @Named("ledger:listTransactions")
+ @GET
+ @Path("/ledger/?limit=0")
+ @SelectJson("objects")
+ List<Transaction> listTransactions();
+
+ /**
+ * Get the licenses available on the cloud. The type of the license can be one of:
+ * install - These licenses are billed per installation, regardless of whether it is attached to a running guests or not.
+ * instance - These licenses are billed per running instance of a guest. A license attached to a guest that’s stopped is not billed.
+ * stub - These licenses are billed per a metric specified by the customer (i.e. per number of users license)
+ *
+ * The user metric field specifies what attribute on the instance of the guest is used for determining the number of licenses.
+ * For example, “smp” will count one license for each CPU/core in the virtual machine.
+ *
+ * @return licenses available on the cloud
+ */
+ @Named("license:listLicenses")
+ @GET
+ @Path("/licenses/?limit=0")
+ @SelectJson("objects")
+ List<License> listLicenses();
+}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/14619a17/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
new file mode 100644
index 0000000..c67f14c
--- /dev/null
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/CloudSigma2ApiMetadata.java
@@ -0,0 +1,100 @@
+/*
+ * 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 com.google.common.collect.ImmutableSet;
+import com.google.inject.Module;
+import org.jclouds.apis.ApiMetadata;
+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 java.net.URI;
+import java.util.Properties;
+
+import static org.jclouds.compute.config.ComputeServiceProperties.TEMPLATE;
+import static org.jclouds.reflect.Reflection2.typeToken;
+
+/**
+ * Implementation of {@link BaseHttpApiMetadata} for the Cloud Sigma API
+ *
+ * @author Vladimir Shevchenko
+ */
+public class CloudSigma2ApiMetadata extends BaseHttpApiMetadata<CloudSigma2Api> {
+
+ @Override
+ public Builder toBuilder() {
+ return new Builder().fromApiMetadata(this);
+ }
+
+ public CloudSigma2ApiMetadata() {
+ this(new Builder());
+ }
+
+ protected CloudSigma2ApiMetadata(Builder builder) {
+ super(builder);
+ }
+
+ 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");
+ return properties;
+ }
+
+ public static class Builder extends BaseHttpApiMetadata.Builder<CloudSigma2Api, Builder> {
+
+ protected Builder() {
+ 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())
+ .view(typeToken(ComputeServiceContext.class))
+ .defaultModules(ImmutableSet.<Class<? extends Module>>of(
+ CloudSigma2HttpApiModule.class,
+ CloudSigma2ParserModule.class));
+ }
+
+ @Override
+ public CloudSigma2ApiMetadata build() {
+ return new CloudSigma2ApiMetadata(this);
+ }
+
+ @Override
+ protected Builder self() {
+ return this;
+ }
+
+ @Override
+ public Builder fromApiMetadata(ApiMetadata in) {
+ return this;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/14619a17/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindCreateSubscriptionRequest.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindCreateSubscriptionRequest.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindCreateSubscriptionRequest.java
new file mode 100644
index 0000000..92c0eab
--- /dev/null
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindCreateSubscriptionRequest.java
@@ -0,0 +1,54 @@
+/*
+ * 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.binders;
+
+import com.google.gson.JsonObject;
+import org.jclouds.cloudsigma2.domain.CreateSubscriptionRequest;
+import org.jclouds.cloudsigma2.functions.CreateSubscriptionRequestToJson;
+import org.jclouds.http.HttpRequest;
+import org.jclouds.rest.Binder;
+
+import javax.inject.Inject;
+import javax.inject.Singleton;
+import javax.ws.rs.core.MediaType;
+
+import static com.google.common.base.Preconditions.checkArgument;
+
+/**
+ * @author Vladimir Shevchenko
+ */
+@Singleton
+public class BindCreateSubscriptionRequest implements Binder {
+
+ private final CreateSubscriptionRequestToJson subscriptionRequestJsonObjectFunction;
+
+ @Inject
+ public BindCreateSubscriptionRequest(CreateSubscriptionRequestToJson subscriptionRequestJsonObjectFunction) {
+ this.subscriptionRequestJsonObjectFunction = subscriptionRequestJsonObjectFunction;
+ }
+
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Object input) {
+ checkArgument(input instanceof CreateSubscriptionRequest, "this binder is only valid for CreateSubscriptionRequest!");
+ CreateSubscriptionRequest create = CreateSubscriptionRequest.class.cast(input);
+ JsonObject subscriptionObject = subscriptionRequestJsonObjectFunction.apply(create);
+
+ request.setPayload(subscriptionObject.toString());
+ request.getPayload().getContentMetadata().setContentType(MediaType.APPLICATION_JSON);
+ return request;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/14619a17/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
new file mode 100644
index 0000000..45fe4a2
--- /dev/null
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindCreateSubscriptionRequestList.java
@@ -0,0 +1,68 @@
+/*
+ * 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.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;
+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;
+
+/**
+ * @author Vladimir Shevchenko
+ */
+@Singleton
+public class BindCreateSubscriptionRequestList implements Binder {
+
+ private final CreateSubscriptionRequestToJson subscriptionRequestJsonObjectFunction;
+
+ @Inject
+ public BindCreateSubscriptionRequestList(CreateSubscriptionRequestToJson subscriptionRequestJsonObjectFunction) {
+ this.subscriptionRequestJsonObjectFunction = subscriptionRequestJsonObjectFunction;
+ }
+
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Object input) {
+ checkArgument(input instanceof List, "this binder is only valid for List<CreateSubscriptionRequest>!");
+ List list = List.class.cast(input);
+ for(Object o : list){
+ checkArgument(o instanceof CreateSubscriptionRequest, "this binder is only valid for List<CreateSubscriptionRequest>!");
+ }
+ List<CreateSubscriptionRequest> createSubscriptionRequests = (List<CreateSubscriptionRequest>) input;
+ JsonArray subscriptionsJsonArray = new JsonArray();
+
+ for(CreateSubscriptionRequest createSubscriptionRequest : createSubscriptionRequests){
+ JsonObject sunbscriptionRequestObject = subscriptionRequestJsonObjectFunction.apply(createSubscriptionRequest);
+ subscriptionsJsonArray.add(sunbscriptionRequestObject);
+ }
+
+ JsonObject json = new JsonObject();
+ json.add("objects", subscriptionsJsonArray);
+
+ request.setPayload(json.toString());
+ request.getPayload().getContentMetadata().setContentType(MediaType.APPLICATION_JSON);
+ return request;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/14619a17/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindDriveToJson.java
----------------------------------------------------------------------
diff --git a/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindDriveToJson.java b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindDriveToJson.java
new file mode 100644
index 0000000..73d72ce
--- /dev/null
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindDriveToJson.java
@@ -0,0 +1,54 @@
+/*
+ * 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.binders;
+
+import com.google.gson.JsonObject;
+import org.jclouds.cloudsigma2.domain.DriveInfo;
+import org.jclouds.cloudsigma2.functions.DriveToJson;
+import org.jclouds.http.HttpRequest;
+import org.jclouds.rest.Binder;
+
+import javax.inject.Inject;
+import javax.inject.Singleton;
+import javax.ws.rs.core.MediaType;
+
+import static com.google.common.base.Preconditions.checkArgument;
+
+/**
+ *
+ * @author Vladimir Shevchenko
+ */
+
+@Singleton
+public class BindDriveToJson implements Binder {
+ private final DriveToJson createDriveRequestToJson;
+
+ @Inject
+ public BindDriveToJson(DriveToJson createDriveRequestToJson) {
+ this.createDriveRequestToJson = createDriveRequestToJson;
+ }
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Object payload) {
+ checkArgument(payload instanceof DriveInfo, "this binder is only valid for DriveInfo!");
+ DriveInfo create = DriveInfo.class.cast(payload);
+ JsonObject driveJson = createDriveRequestToJson.apply(create);
+
+ request.setPayload(driveJson.toString());
+ request.getPayload().getContentMetadata().setContentType(MediaType.APPLICATION_JSON);
+ return request;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/14619a17/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
new file mode 100644
index 0000000..869168f
--- /dev/null
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindDrivesToJson.java
@@ -0,0 +1,66 @@
+/*
+ * 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.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;
+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;
+
+/**
+ * @author Vladimir Shevchenko
+ */
+@Singleton
+public class BindDrivesToJson implements Binder {
+ private final DriveToJson createDriveRequestJson;
+
+ @Inject
+ public BindDrivesToJson(DriveToJson createDriveRequestToMap) {
+ this.createDriveRequestJson = createDriveRequestToMap;
+ }
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Object payload) {
+ checkArgument(payload instanceof List, "this binder is only valid for List<DriveInfo>!");
+ List list = List.class.cast(payload);
+ for(Object o : list){
+ checkArgument(o instanceof DriveInfo, "this binder is only valid for List<DriveInfo>!");
+ }
+ List<DriveInfo> drivesList = (List<DriveInfo>) payload;
+ JsonArray drivesJsonArray = new JsonArray();
+
+ for(DriveInfo drive : drivesList){
+ JsonObject driveObject = createDriveRequestJson.apply(drive);
+ drivesJsonArray.add(driveObject);
+ }
+
+ JsonObject json = new JsonObject();
+ json.add("objects", drivesJsonArray);
+
+ request.setPayload(json.toString());
+ request.getPayload().getContentMetadata().setContentType(MediaType.APPLICATION_JSON);
+ return request;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/14619a17/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
new file mode 100644
index 0000000..2f7f45c
--- /dev/null
+++ b/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindFirewallPoliciesListToJsonRequest.java
@@ -0,0 +1,66 @@
+/*
+ * 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.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;
+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;
+
+/**
+ * @author Vladimir Shevchenko
+ */
+public class BindFirewallPoliciesListToJsonRequest implements Binder {
+
+ private final FirewallPolicyToJson policyJsonObjectFunction;
+
+ @Inject
+ public BindFirewallPoliciesListToJsonRequest(FirewallPolicyToJson policyJsonObjectFunction) {
+ this.policyJsonObjectFunction = policyJsonObjectFunction;
+ }
+
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Object input) {
+ checkArgument(input instanceof List, "this binder is only valid for List<FirewallPolicy>!");
+ List list = List.class.cast(input);
+ for(Object o : list){
+ checkArgument(o instanceof FirewallPolicy, "this binder is only valid for List<FirewallPolicy>!");
+ }
+ List<FirewallPolicy> firewallPolicies = (List<FirewallPolicy>) input;
+ JsonArray firewalsJsonArray = new JsonArray();
+
+ for(FirewallPolicy firewallPolicy : firewallPolicies){
+ JsonObject firewallObject = policyJsonObjectFunction.apply(firewallPolicy);
+ firewalsJsonArray.add(firewallObject);
+ }
+
+ JsonObject json = new JsonObject();
+ json.add("objects", firewalsJsonArray);
+
+ request.setPayload(json.toString());
+ request.getPayload().getContentMetadata().setContentType(MediaType.APPLICATION_JSON);
+ return request;
+ }
+}