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 2016/07/12 06:34:18 UTC
[3/3] jclouds-labs git commit: JCLOUDS-1124 oneandone-server-api
JCLOUDS-1124 oneandone-server-api
Project: http://git-wip-us.apache.org/repos/asf/jclouds-labs/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds-labs/commit/7df28d25
Tree: http://git-wip-us.apache.org/repos/asf/jclouds-labs/tree/7df28d25
Diff: http://git-wip-us.apache.org/repos/asf/jclouds-labs/diff/7df28d25
Branch: refs/heads/master
Commit: 7df28d259999b2267484cfc82c7ae486697f0ec6
Parents: 2b36a75
Author: Ali Bazlamit <al...@hotmail.com>
Authored: Tue Jul 12 01:58:32 2016 +0200
Committer: Ignasi Barrera <na...@apache.org>
Committed: Tue Jul 12 08:29:07 2016 +0200
----------------------------------------------------------------------
oneandone/pom.xml | 142 ++++
.../jclouds/oneandone/rest/OneAndOneApi.java | 27 +
.../oneandone/rest/OneAndOneApiMetadata.java | 72 ++
.../rest/OneAndOneProviderMetadata.java | 85 ++
.../rest/config/OneAndOneConstants.java | 52 ++
.../rest/config/OneAndOneHttpApiModule.java | 111 +++
.../rest/config/OneAndOneProperties.java | 27 +
.../oneandone/rest/domain/DataCenter.java | 35 +
.../jclouds/oneandone/rest/domain/Dvd.java | 33 +
.../rest/domain/FixedInstanceHardware.java | 31 +
.../jclouds/oneandone/rest/domain/Hardware.java | 71 ++
.../oneandone/rest/domain/HardwareFlavour.java | 72 ++
.../jclouds/oneandone/rest/domain/Hdd.java | 60 ++
.../jclouds/oneandone/rest/domain/Image.java | 86 ++
.../jclouds/oneandone/rest/domain/Licenses.java | 31 +
.../oneandone/rest/domain/PrivateNetwork.java | 61 ++
.../jclouds/oneandone/rest/domain/Server.java | 388 +++++++++
.../rest/domain/ServerFirewallPolicy.java | 33 +
.../jclouds/oneandone/rest/domain/ServerIp.java | 48 ++
.../rest/domain/ServerLoadBalancer.java | 33 +
.../rest/domain/ServerMonitoringPolicy.java | 33 +
.../rest/domain/ServerPrivateNetwork.java | 33 +
.../jclouds/oneandone/rest/domain/Snapshot.java | 35 +
.../jclouds/oneandone/rest/domain/Status.java | 34 +
.../jclouds/oneandone/rest/domain/Types.java | 141 ++++
.../oneandone/rest/domain/WarningAlert.java | 36 +
.../domain/options/GenericQueryOptions.java | 49 ++
.../oneandone/rest/features/ServerApi.java | 386 +++++++++
.../rest/filters/AuthenticateRequest.java | 46 ++
.../handlers/OneAndOneHttpErrorHandler.java | 72 ++
.../rest/ids/ServerPrivateNetworkRef.java | 31 +
.../oneandone/rest/refrence/AuthHeaders.java | 26 +
.../rest/util/ServerFirewallPolicyAdapter.java | 79 ++
.../oneandone/rest/util/SnapshotAdapter.java | 76 ++
.../rest/OneAndOneProviderMetadataTest.java | 28 +
.../rest/features/ServerApiLiveTest.java | 272 +++++++
.../rest/features/ServerApiMockTest.java | 816 +++++++++++++++++++
.../rest/features/ServerNetworkApiLiveTest.java | 141 ++++
.../features/ServerOperationsApiLiveTest.java | 173 ++++
.../rest/internal/BaseOneAndOneApiMockTest.java | 112 +++
.../rest/internal/BaseOneAndOneLiveTest.java | 120 +++
.../src/test/resources/server/add.hdds.json | 54 ++
oneandone/src/test/resources/server/delete.json | 51 ++
.../src/test/resources/server/get.dvd.json | 4 +
.../src/test/resources/server/get.flavour.json | 15 +
.../src/test/resources/server/get.hardware.json | 13 +
.../src/test/resources/server/get.hdd.json | 5 +
.../src/test/resources/server/get.image.json | 4 +
oneandone/src/test/resources/server/get.ip.json | 8 +
oneandone/src/test/resources/server/get.json | 48 ++
.../resources/server/get.privatenetwork.json | 20 +
.../src/test/resources/server/get.status.json | 4 +
.../test/resources/server/list.flavours.json | 113 +++
.../resources/server/list.hardware.hdds.json | 7 +
.../server/list.ip.firewallPolicies.json | 8 +
.../src/test/resources/server/list.ip.json | 10 +
.../resources/server/list.ip.loadBalancers.json | 6 +
oneandone/src/test/resources/server/list.json | 341 ++++++++
.../server/list.options-query-test.json | 309 +++++++
.../resources/server/list.privatenetwork.json | 6 +
.../test/resources/server/list.snapshot.json | 7 +
.../src/test/resources/server/update.image.json | 73 ++
oneandone/src/test/resources/server/update.json | 51 ++
pom.xml | 7 +-
64 files changed, 5397 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/7df28d25/oneandone/pom.xml
----------------------------------------------------------------------
diff --git a/oneandone/pom.xml b/oneandone/pom.xml
new file mode 100644
index 0000000..faa579c
--- /dev/null
+++ b/oneandone/pom.xml
@@ -0,0 +1,142 @@
+<?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/xsd/maven-4.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.api -->
+ <artifactId>oneandone</artifactId>
+ <name>jclouds OneAndOne REST api</name>
+ <description>jclouds components to access an implementation of OneAndOne</description>
+ <packaging>bundle</packaging>
+
+ <properties>
+ <test.oneandone.endpoint>https://cloudpanel-api.1and1.com/v1/</test.oneandone.endpoint>
+ <test.oneandone.identity>FIXME</test.oneandone.identity>
+ <test.oneandone.api-version>1.0</test.oneandone.api-version>
+ <jclouds.osgi.export>org.jclouds.oneandone*;version="${project.version}"</jclouds.osgi.export>
+ <jclouds.osgi.import>
+ org.jclouds.labs*;version="${project.version}",
+ org.jclouds*;version="${jclouds.version}",
+ *
+ </jclouds.osgi.import>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.jclouds</groupId>
+ <artifactId>jclouds-core</artifactId>
+ <version>${jclouds.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.google.auto.service</groupId>
+ <artifactId>auto-service</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.google.auto.value</groupId>
+ <artifactId>auto-value</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.jclouds.driver</groupId>
+ <artifactId>jclouds-okhttp</artifactId>
+ <version>${jclouds.version}</version>
+ </dependency>
+ <!-- Test dependencies -->
+ <dependency>
+ <groupId>org.apache.jclouds</groupId>
+ <artifactId>jclouds-core</artifactId>
+ <version>${jclouds.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.jclouds.driver</groupId>
+ <artifactId>jclouds-sshj</artifactId>
+ <version>${jclouds.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.squareup.okhttp</groupId>
+ <artifactId>mockwebserver</artifactId>
+ <exclusions>
+ <!-- Already provided by jclouds-sshj -->
+ <exclusion>
+ <groupId>org.bouncycastle</groupId>
+ <artifactId>bcprov-jdk15on</artifactId>
+ </exclusion>
+ </exclusions>
+ <type>jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.jclouds.driver</groupId>
+ <artifactId>jclouds-slf4j</artifactId>
+ <version>${jclouds.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>ch.qos.logback</groupId>
+ <artifactId>logback-core</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>ch.qos.logback</groupId>
+ <artifactId>logback-classic</artifactId>
+ <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>
+ <threadCount>1</threadCount>
+ <systemPropertyVariables>
+ <test.oneandone.endpoint>${test.oneandone.endpoint}</test.oneandone.endpoint>
+ <test.oneandone.identity>${test.oneandone.identity}</test.oneandone.identity>
+ <test.oneandone.api-version>${test.oneandone.api-version}</test.oneandone.api-version>
+ </systemPropertyVariables>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+</project>
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/7df28d25/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/OneAndOneApi.java
----------------------------------------------------------------------
diff --git a/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/OneAndOneApi.java b/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/OneAndOneApi.java
new file mode 100644
index 0000000..577afcb
--- /dev/null
+++ b/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/OneAndOneApi.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.apache.jclouds.oneandone.rest;
+
+import java.io.Closeable;
+import org.apache.jclouds.oneandone.rest.features.ServerApi;
+import org.jclouds.rest.annotations.Delegate;
+
+public interface OneAndOneApi extends Closeable {
+
+ @Delegate
+ ServerApi serverApi();
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/7df28d25/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/OneAndOneApiMetadata.java
----------------------------------------------------------------------
diff --git a/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/OneAndOneApiMetadata.java b/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/OneAndOneApiMetadata.java
new file mode 100644
index 0000000..4fa0416
--- /dev/null
+++ b/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/OneAndOneApiMetadata.java
@@ -0,0 +1,72 @@
+/*
+ * 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.apache.jclouds.oneandone.rest;
+
+import com.google.common.collect.ImmutableSet;
+import com.google.inject.Module;
+import java.net.URI;
+import java.util.Properties;
+import org.apache.jclouds.oneandone.rest.config.OneAndOneHttpApiModule;
+import org.jclouds.http.okhttp.config.OkHttpCommandExecutorServiceModule;
+import org.jclouds.rest.internal.BaseHttpApiMetadata;
+
+public class OneAndOneApiMetadata extends BaseHttpApiMetadata<OneAndOneApi> {
+
+ @Override
+ public Builder toBuilder() {
+ return new Builder().fromApiMetadata(this);
+ }
+
+ public OneAndOneApiMetadata() {
+ this(new Builder());
+ }
+
+ protected OneAndOneApiMetadata(Builder builder) {
+ super(builder);
+ }
+
+ public static Properties defaultProperties() {
+ Properties properties = BaseHttpApiMetadata.defaultProperties();
+ return properties;
+ }
+
+ public static class Builder extends BaseHttpApiMetadata.Builder<OneAndOneApi, Builder> {
+
+ protected Builder() {
+ id("oneandone")
+ .name("OneAndOne REST API")
+ .identityName("API Username")
+ .documentation(URI.create("https://cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html"))
+ .defaultEndpoint("https://cloudpanel-api.1and1.com/v1")
+ .defaultProperties(OneAndOneApiMetadata.defaultProperties())
+ .defaultModules(ImmutableSet.<Class<? extends Module>>builder()
+ .add(OkHttpCommandExecutorServiceModule.class)
+ .add(OneAndOneHttpApiModule.class)
+ .build());
+ }
+
+ @Override
+ public OneAndOneApiMetadata build() {
+ return new OneAndOneApiMetadata(this);
+ }
+
+ @Override
+ protected Builder self() {
+ return this;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/7df28d25/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/OneAndOneProviderMetadata.java
----------------------------------------------------------------------
diff --git a/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/OneAndOneProviderMetadata.java b/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/OneAndOneProviderMetadata.java
new file mode 100644
index 0000000..d60a142
--- /dev/null
+++ b/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/OneAndOneProviderMetadata.java
@@ -0,0 +1,85 @@
+/*
+ * 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.apache.jclouds.oneandone.rest;
+
+import com.google.auto.service.AutoService;
+import java.net.URI;
+import java.util.Properties;
+import static org.apache.jclouds.oneandone.rest.config.OneAndOneProperties.POLL_MAX_PERIOD;
+import static org.apache.jclouds.oneandone.rest.config.OneAndOneProperties.POLL_PERIOD;
+import static org.apache.jclouds.oneandone.rest.config.OneAndOneProperties.POLL_TIMEOUT;
+import static org.jclouds.Constants.PROPERTY_CONNECTION_TIMEOUT;
+import static org.jclouds.Constants.PROPERTY_SO_TIMEOUT;
+import org.jclouds.providers.ProviderMetadata;
+import org.jclouds.providers.internal.BaseProviderMetadata;
+
+@AutoService(ProviderMetadata.class)
+public class OneAndOneProviderMetadata extends BaseProviderMetadata {
+
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ @Override
+ public Builder toBuilder() {
+ return builder().fromProviderMetadata(this);
+ }
+
+ public OneAndOneProviderMetadata() {
+ super(builder());
+ }
+
+ public OneAndOneProviderMetadata(Builder builder) {
+ super(builder);
+ }
+
+ public static Properties defaultProperties() {
+ Properties properties = OneAndOneApiMetadata.defaultProperties();
+ long defaultTimeout = 60l * 60l; // 1 hour
+ properties.put(POLL_TIMEOUT, defaultTimeout);
+ properties.put(POLL_PERIOD, 1l);
+ properties.put(POLL_MAX_PERIOD, 1l * 9l);
+ properties.put(PROPERTY_SO_TIMEOUT, 60000 * 5);
+ properties.put(PROPERTY_CONNECTION_TIMEOUT, 60000 * 5);
+
+ return properties;
+ }
+
+ public static class Builder extends BaseProviderMetadata.Builder {
+
+ protected Builder() {
+ id("oneandone")
+ .name("OneAndOne REST Compute")
+ .apiMetadata(new OneAndOneApiMetadata())
+ .homepage(URI.create("https://cloudpanel-api.1and1.com"))
+ .console(URI.create("https://account.1and1.com"))
+ .endpoint("https://cloudpanel-api.1and1.com/v1")
+ .defaultProperties(OneAndOneProviderMetadata.defaultProperties());
+ }
+
+ @Override
+ public OneAndOneProviderMetadata build() {
+ return new OneAndOneProviderMetadata(this);
+ }
+
+ @Override
+ public Builder fromProviderMetadata(ProviderMetadata in) {
+ super.fromProviderMetadata(in);
+ return this;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/7df28d25/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/config/OneAndOneConstants.java
----------------------------------------------------------------------
diff --git a/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/config/OneAndOneConstants.java b/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/config/OneAndOneConstants.java
new file mode 100644
index 0000000..9dde8b8
--- /dev/null
+++ b/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/config/OneAndOneConstants.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.apache.jclouds.oneandone.rest.config;
+
+import com.google.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Singleton;
+import static org.apache.jclouds.oneandone.rest.config.OneAndOneProperties.POLL_MAX_PERIOD;
+import static org.apache.jclouds.oneandone.rest.config.OneAndOneProperties.POLL_PERIOD;
+import static org.apache.jclouds.oneandone.rest.config.OneAndOneProperties.POLL_TIMEOUT;
+
+@Singleton
+public class OneAndOneConstants {
+
+ @Inject
+ @Named(POLL_TIMEOUT)
+ private String pollTimeout;
+
+ @Inject
+ @Named(POLL_PERIOD)
+ private String pollPeriod;
+
+ @Inject
+ @Named(POLL_MAX_PERIOD)
+ private String pollMaxPeriod;
+
+ public long pollTimeout() {
+ return Long.parseLong(pollTimeout);
+ }
+
+ public long pollPeriod() {
+ return Long.parseLong(pollPeriod);
+ }
+
+ public long pollMaxPeriod() {
+ return Long.parseLong(pollMaxPeriod);
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/7df28d25/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/config/OneAndOneHttpApiModule.java
----------------------------------------------------------------------
diff --git a/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/config/OneAndOneHttpApiModule.java b/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/config/OneAndOneHttpApiModule.java
new file mode 100644
index 0000000..ce20590
--- /dev/null
+++ b/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/config/OneAndOneHttpApiModule.java
@@ -0,0 +1,111 @@
+/*
+ * 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.apache.jclouds.oneandone.rest.config;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import com.google.common.base.Predicate;
+import com.google.inject.Provides;
+import java.util.concurrent.TimeUnit;
+import javax.inject.Named;
+import org.apache.jclouds.oneandone.rest.OneAndOneApi;
+import static org.apache.jclouds.oneandone.rest.config.OneAndOneProperties.POLL_PREDICATE_PRIVATE_NETWORK;
+import static org.apache.jclouds.oneandone.rest.config.OneAndOneProperties.POLL_PREDICATE_SERVER;
+import org.apache.jclouds.oneandone.rest.domain.PrivateNetwork;
+import org.apache.jclouds.oneandone.rest.domain.Server;
+import org.apache.jclouds.oneandone.rest.domain.Types;
+import org.apache.jclouds.oneandone.rest.handlers.OneAndOneHttpErrorHandler;
+import org.apache.jclouds.oneandone.rest.ids.ServerPrivateNetworkRef;
+import org.jclouds.http.HttpErrorHandler;
+import org.jclouds.http.annotation.ClientError;
+import org.jclouds.http.annotation.Redirection;
+import org.jclouds.http.annotation.ServerError;
+import org.jclouds.json.config.GsonModule.DateAdapter;
+import org.jclouds.json.config.GsonModule.Iso8601DateAdapter;
+import org.jclouds.rest.ConfiguresHttpApi;
+import org.jclouds.rest.config.HttpApiModule;
+import static org.jclouds.util.Predicates2.retry;
+
+@ConfiguresHttpApi
+public class OneAndOneHttpApiModule extends HttpApiModule<OneAndOneApi> {
+
+ @Override
+ protected void bindErrorHandlers() {
+ bind(HttpErrorHandler.class).annotatedWith(Redirection.class).to(OneAndOneHttpErrorHandler.class);
+ bind(HttpErrorHandler.class).annotatedWith(ClientError.class).to(OneAndOneHttpErrorHandler.class);
+ bind(HttpErrorHandler.class).annotatedWith(ServerError.class).to(OneAndOneHttpErrorHandler.class);
+ }
+
+ @Override
+ protected void configure() {
+ super.configure();
+ bind(DateAdapter.class).to(Iso8601DateAdapter.class);
+ }
+
+ @Provides
+ @Named(POLL_PREDICATE_PRIVATE_NETWORK)
+ Predicate<ServerPrivateNetworkRef> providePrivateNetworkReadyPredicate(final OneAndOneApi api, OneAndOneConstants constants) {
+ return retry(new PrivateNetworkReadyPredicate(
+ api),
+ constants.pollTimeout(), constants.pollPeriod(), constants.pollMaxPeriod(), TimeUnit.SECONDS);
+ }
+
+ @Provides
+ @Named(POLL_PREDICATE_SERVER)
+ Predicate<Server> provideServerReadyPredicate(final OneAndOneApi api, OneAndOneConstants constants) {
+ return retry(new ServerReadyPredicate(
+ api),
+ constants.pollTimeout(), constants.pollPeriod(), constants.pollMaxPeriod(), TimeUnit.SECONDS);
+ }
+
+ static class ServerReadyPredicate implements Predicate<Server> {
+
+ private final OneAndOneApi api;
+
+ public ServerReadyPredicate(OneAndOneApi api) {
+ this.api = checkNotNull(api, "api must not be null");
+ }
+
+ @Override
+ public boolean apply(Server server) {
+ checkNotNull(server, "Server");
+ server = api.serverApi().get(server.id());
+ if ((server.status().state() != Types.ServerState.POWERED_OFF
+ && server.status().state() != Types.ServerState.POWERED_ON)
+ || server.status().percent() != 0) {
+ return false;
+ } else {
+ return true;
+ }
+ }
+ }
+
+ static class PrivateNetworkReadyPredicate implements Predicate<ServerPrivateNetworkRef> {
+
+ private final OneAndOneApi api;
+
+ public PrivateNetworkReadyPredicate(OneAndOneApi api) {
+ this.api = checkNotNull(api, "api must not be null");
+ }
+
+ @Override
+ public boolean apply(ServerPrivateNetworkRef networkRef) {
+ checkNotNull(networkRef, "ServerPrivateNetworkRef");
+ PrivateNetwork server = api.serverApi().getPrivateNetwork(networkRef.serverId(), networkRef.privateNetworkId());
+ return server.state() != Types.GenericState.ACTIVE;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/7df28d25/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/config/OneAndOneProperties.java
----------------------------------------------------------------------
diff --git a/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/config/OneAndOneProperties.java b/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/config/OneAndOneProperties.java
new file mode 100644
index 0000000..469a230
--- /dev/null
+++ b/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/config/OneAndOneProperties.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.apache.jclouds.oneandone.rest.config;
+
+public final class OneAndOneProperties {
+
+ public static final String POLL_PREDICATE_SERVER = "jclouds.oneandone.rest.predicate.server";
+ public static final String POLL_PREDICATE_PRIVATE_NETWORK = "jclouds.oneandone.rest.predicate.privatenetwork";
+ public static final String AUTH_TOKEN = "oneandone.identity";
+ public static final String POLL_TIMEOUT = "jclouds.oneandone.rest.poll.timeout";
+ public static final String POLL_PERIOD = "jclouds.oneandone.rest.operation.poll.initial-period";
+ public static final String POLL_MAX_PERIOD = "jclouds.oneandone.rest.operation.poll.max-period";
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/7df28d25/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/domain/DataCenter.java
----------------------------------------------------------------------
diff --git a/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/domain/DataCenter.java b/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/domain/DataCenter.java
new file mode 100644
index 0000000..c2d129f
--- /dev/null
+++ b/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/domain/DataCenter.java
@@ -0,0 +1,35 @@
+/*
+ * 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.apache.jclouds.oneandone.rest.domain;
+
+import com.google.auto.value.AutoValue;
+import org.jclouds.json.SerializedNames;
+
+@AutoValue
+public abstract class DataCenter {
+
+ public abstract String id();
+
+ public abstract String countryCode();
+
+ public abstract String location();
+
+ @SerializedNames({"id", "country_code", "location"})
+ public static DataCenter create(String id, String countryCode, String location) {
+ return new AutoValue_DataCenter(id, countryCode, location);
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/7df28d25/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/domain/Dvd.java
----------------------------------------------------------------------
diff --git a/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/domain/Dvd.java b/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/domain/Dvd.java
new file mode 100644
index 0000000..865eb48
--- /dev/null
+++ b/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/domain/Dvd.java
@@ -0,0 +1,33 @@
+/*
+ * 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.apache.jclouds.oneandone.rest.domain;
+
+import com.google.auto.value.AutoValue;
+import org.jclouds.json.SerializedNames;
+
+@AutoValue
+public abstract class Dvd {
+
+ public abstract String id();
+
+ public abstract String name();
+
+ @SerializedNames({"id", "name"})
+ public static Dvd create(String id, String name) {
+ return new AutoValue_Dvd(id, name);
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/7df28d25/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/domain/FixedInstanceHardware.java
----------------------------------------------------------------------
diff --git a/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/domain/FixedInstanceHardware.java b/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/domain/FixedInstanceHardware.java
new file mode 100644
index 0000000..6d2e198
--- /dev/null
+++ b/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/domain/FixedInstanceHardware.java
@@ -0,0 +1,31 @@
+/*
+ * 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.apache.jclouds.oneandone.rest.domain;
+
+import com.google.auto.value.AutoValue;
+import org.jclouds.json.SerializedNames;
+
+@AutoValue
+public abstract class FixedInstanceHardware {
+
+ public abstract String fixedInstanceSizeId();
+
+ @SerializedNames({"fixed_instance_size_id"})
+ public static FixedInstanceHardware create(String fixedInstanceSizeId) {
+ return new AutoValue_FixedInstanceHardware(fixedInstanceSizeId);
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/7df28d25/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/domain/Hardware.java
----------------------------------------------------------------------
diff --git a/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/domain/Hardware.java b/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/domain/Hardware.java
new file mode 100644
index 0000000..4eda12f
--- /dev/null
+++ b/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/domain/Hardware.java
@@ -0,0 +1,71 @@
+/*
+ * 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.apache.jclouds.oneandone.rest.domain;
+
+import com.google.auto.value.AutoValue;
+import java.util.List;
+import org.apache.jclouds.oneandone.rest.domain.Hdd.CreateHdd;
+import org.jclouds.json.SerializedNames;
+
+@AutoValue
+public abstract class Hardware {
+
+ public abstract double vcore();
+
+ public abstract double coresPerProcessor();
+
+ public abstract double ram();
+
+ public abstract List<Hdd> hdds();
+
+ @SerializedNames({"vcore", "cores_per_processor", "ram", "hdds"})
+ public static Hardware create(double vcore, double coresPerProcessor, double ram, List<Hdd> hdds) {
+ return new AutoValue_Hardware(vcore, coresPerProcessor, ram, hdds);
+ }
+
+ @AutoValue
+ public abstract static class CreateHardware {
+
+ public abstract double vcore();
+
+ public abstract double coresPerProcessor();
+
+ public abstract double ram();
+
+ public abstract List<CreateHdd> hdds();
+
+ @SerializedNames({"vcore", "cores_per_processor", "ram", "hdds"})
+ public static CreateHardware create(double vcore, double coresPerProcessor, double ram, List<CreateHdd> hdds) {
+ return new AutoValue_Hardware_CreateHardware(vcore, coresPerProcessor, ram, hdds);
+ }
+ }
+
+ @AutoValue
+ public abstract static class UpdateHardware {
+
+ public abstract double ram();
+
+ public abstract double coresPerProcessor();
+
+ public abstract double vcore();
+
+ @SerializedNames({"ram", "cores_per_processor", "vcore"})
+ public static UpdateHardware create(double vcore, double coresPerProcessor, double ram) {
+ return new AutoValue_Hardware_UpdateHardware(vcore, coresPerProcessor, ram);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/7df28d25/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/domain/HardwareFlavour.java
----------------------------------------------------------------------
diff --git a/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/domain/HardwareFlavour.java b/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/domain/HardwareFlavour.java
new file mode 100644
index 0000000..b5098c9
--- /dev/null
+++ b/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/domain/HardwareFlavour.java
@@ -0,0 +1,72 @@
+/*
+ * 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.apache.jclouds.oneandone.rest.domain;
+
+import com.google.auto.value.AutoValue;
+import java.util.List;
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.json.SerializedNames;
+
+@AutoValue
+public abstract class HardwareFlavour {
+
+ public abstract String id();
+
+ public abstract String name();
+
+ public abstract Hardware hardware();
+
+ @SerializedNames({"id", "name", "hardware"})
+ public static HardwareFlavour create(String id, String name, Hardware hardware) {
+ return new AutoValue_HardwareFlavour(id, name, hardware);
+ }
+
+ @AutoValue
+ public abstract static class Hardware {
+
+ @Nullable
+ public abstract String fixedInstanceSizeId();
+
+ public abstract double vcore();
+
+ public abstract double coresPerProcessor();
+
+ public abstract double ram();
+
+ public abstract List<Hdd> hdds();
+
+ @SerializedNames({"fixed_instance_size_id", "vcore", "cores_per_processor", "ram", "hdds"})
+ public static Hardware create(String fixedInstanceSizeId, double vcore, double coresPerProcessor, double ram, List<Hdd> hdds) {
+ return new AutoValue_HardwareFlavour_Hardware(fixedInstanceSizeId, vcore, coresPerProcessor, ram, hdds);
+ }
+
+ @AutoValue
+ public abstract static class Hdd {
+
+ public abstract String unit();
+
+ public abstract int size();
+
+ public abstract boolean isMain();
+
+ @SerializedNames({"unit", "size", "is_main"})
+ public static Hdd create(String unit, int size, boolean isMain) {
+ return new AutoValue_HardwareFlavour_Hardware_Hdd(unit, size, isMain);
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/7df28d25/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/domain/Hdd.java
----------------------------------------------------------------------
diff --git a/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/domain/Hdd.java b/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/domain/Hdd.java
new file mode 100644
index 0000000..d0a480c
--- /dev/null
+++ b/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/domain/Hdd.java
@@ -0,0 +1,60 @@
+/*
+ * 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.apache.jclouds.oneandone.rest.domain;
+
+import com.google.auto.value.AutoValue;
+import java.util.List;
+import org.jclouds.json.SerializedNames;
+
+@AutoValue
+public abstract class Hdd {
+
+ public abstract String id();
+
+ public abstract double size();
+
+ public abstract boolean isMain();
+
+ @SerializedNames({"id", "size", "is_main"})
+ public static Hdd create(String id, double size, boolean isMain) {
+ return new AutoValue_Hdd(id, size, isMain);
+ }
+
+ @AutoValue
+ public abstract static class CreateHddList {
+
+ public abstract List<CreateHdd> hdds();
+
+ @SerializedNames({"hdds"})
+ public static CreateHddList create(List<CreateHdd> hdds) {
+ return new AutoValue_Hdd_CreateHddList(hdds);
+ }
+ }
+
+ @AutoValue
+ public abstract static class CreateHdd {
+
+ public abstract double size();
+
+ public abstract boolean isMain();
+
+ @SerializedNames({"size", "is_main"})
+ public static CreateHdd create(double size, boolean isMain) {
+ return new AutoValue_Hdd_CreateHdd(size, isMain);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/7df28d25/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/domain/Image.java
----------------------------------------------------------------------
diff --git a/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/domain/Image.java b/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/domain/Image.java
new file mode 100644
index 0000000..80bbead
--- /dev/null
+++ b/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/domain/Image.java
@@ -0,0 +1,86 @@
+/*
+ * 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.apache.jclouds.oneandone.rest.domain;
+
+import com.google.auto.value.AutoValue;
+import com.google.common.collect.ImmutableList;
+import java.util.List;
+import org.apache.jclouds.oneandone.rest.domain.Types.ImageFrequency;
+import org.apache.jclouds.oneandone.rest.domain.Types.ImageType;
+import org.apache.jclouds.oneandone.rest.domain.Types.OSFamliyType;
+import org.apache.jclouds.oneandone.rest.domain.Types.OSType;
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.json.SerializedNames;
+
+@AutoValue
+public abstract class Image {
+
+ public abstract String id();
+
+ public abstract String name();
+
+ @Nullable
+ public abstract OSFamliyType osFamily();
+
+ @Nullable
+ public abstract OSType os();
+
+ @Nullable
+ public abstract String osVersion();
+
+ public abstract List<String> availableSites();
+
+ public abstract int architecture();
+
+ @Nullable
+ public abstract String osImageType();
+
+ @Nullable
+ public abstract ImageType type();
+
+ public abstract int minHddSize();
+
+ public abstract List<Licenses> licenses();
+
+ @Nullable
+ public abstract String state();
+
+ @Nullable
+ public abstract String description();
+
+ @Nullable
+ public abstract List<Hdd> hdds();
+
+ @Nullable
+ public abstract String serverId();
+
+ @Nullable
+ public abstract ImageFrequency frequency();
+
+ public abstract int numImages();
+
+ @Nullable
+
+ public abstract String creationDate();
+
+ @SerializedNames({"id", "name", "os_family", "os", "os_version", "availableSites", "architecture", "os_image_type", "type", "min_hdd_size", "licenses", "state", "description", "hdds", "server_id", "frequency", "numImages", "creation_date"})
+ public static Image create(String id, String name, OSFamliyType osFamily, OSType os, String osVersion, List<String> availableSites, int architecture, String osImageType, ImageType type, int minHddSize, List<Licenses> licenses, String state, String description, List<Hdd> hdds, String serverId, ImageFrequency frequency, int numImages, String creationDate) {
+ return new AutoValue_Image(id, name, osFamily, os, osVersion, availableSites == null ? ImmutableList.<String>of() : availableSites,
+ architecture, osImageType, type, minHddSize, licenses == null ? ImmutableList.<Licenses>of() : licenses, state,
+ description, hdds == null ? ImmutableList.<Hdd>of() : hdds, serverId, frequency, numImages, creationDate);
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/7df28d25/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/domain/Licenses.java
----------------------------------------------------------------------
diff --git a/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/domain/Licenses.java b/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/domain/Licenses.java
new file mode 100644
index 0000000..1c1e9a3
--- /dev/null
+++ b/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/domain/Licenses.java
@@ -0,0 +1,31 @@
+/*
+ * 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.apache.jclouds.oneandone.rest.domain;
+
+import com.google.auto.value.AutoValue;
+import org.jclouds.json.SerializedNames;
+
+@AutoValue
+public abstract class Licenses {
+
+ public abstract String name();
+
+ @SerializedNames({"name"})
+ public static Licenses create(String name) {
+ return new AutoValue_Licenses(name);
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/7df28d25/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/domain/PrivateNetwork.java
----------------------------------------------------------------------
diff --git a/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/domain/PrivateNetwork.java b/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/domain/PrivateNetwork.java
new file mode 100644
index 0000000..5a01fc7
--- /dev/null
+++ b/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/domain/PrivateNetwork.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.apache.jclouds.oneandone.rest.domain;
+
+import com.google.auto.value.AutoValue;
+import com.google.common.collect.ImmutableList;
+import java.util.List;
+import org.apache.jclouds.oneandone.rest.domain.Types.GenericState;
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.json.SerializedNames;
+
+@AutoValue
+public abstract class PrivateNetwork {
+
+ public abstract String id();
+
+ public abstract String name();
+
+ @Nullable
+ public abstract String description();
+
+ @Nullable
+ public abstract String networkAddress();
+
+ @Nullable
+ public abstract String subnetMask();
+
+ @Nullable
+ public abstract GenericState state();
+
+ @Nullable
+ public abstract String creationDate();
+
+ @Nullable
+ public abstract List<Server> servers();
+
+ @Nullable
+ public abstract String cloudpanelId();
+
+ @Nullable
+ public abstract DataCenter datacenter();
+
+ @SerializedNames({"id", "name", "description", "network_address", "subnet_mask", "state", "creation_date", "servers", "cloudpanel_id", "datacenter"})
+ public static PrivateNetwork create(String id, String name, String description, String networkAddress, String subnetMask, GenericState state, String creationDate, List<Server> servers, String cloudpanelId, DataCenter datacenter) {
+ return new AutoValue_PrivateNetwork(id, name, description, networkAddress, subnetMask, state, creationDate, servers == null ? ImmutableList.<Server>of() : servers, cloudpanelId, datacenter);
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/7df28d25/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/domain/Server.java
----------------------------------------------------------------------
diff --git a/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/domain/Server.java b/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/domain/Server.java
new file mode 100644
index 0000000..f83c4de
--- /dev/null
+++ b/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/domain/Server.java
@@ -0,0 +1,388 @@
+/*
+ * 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.apache.jclouds.oneandone.rest.domain;
+
+import com.google.auto.value.AutoValue;
+import com.google.common.collect.ImmutableList;
+import java.util.Date;
+import java.util.List;
+import org.apache.jclouds.oneandone.rest.domain.Types.ServerAction;
+import org.apache.jclouds.oneandone.rest.domain.Types.ServerActionMethod;
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.json.SerializedNames;
+
+@AutoValue
+public abstract class Server {
+
+ public abstract String id();
+
+ public abstract String name();
+
+ @Nullable
+ public abstract Date creationDate();
+
+ @Nullable
+ public abstract String firstPassword();
+
+ @Nullable
+ public abstract String description();
+
+ @Nullable
+
+ public abstract Status status();
+
+ @Nullable
+
+ public abstract Hardware hardware();
+
+ @Nullable
+ public abstract Image image();
+
+ @Nullable
+ public abstract Dvd dvd();
+
+ @Nullable
+ public abstract Snapshot Snapshot();
+
+ @Nullable
+ public abstract DataCenter datacenter();
+
+ public abstract List<ServerIp> ips();
+
+ public abstract List<Alert> alerts();
+
+ @Nullable
+ public abstract ServerMonitoringPolicy monitoringPolicy();
+
+ public abstract List<ServerPrivateNetwork> privateNetworks();
+
+ @SerializedNames({"id", "name", "creation_date", "first_password", "description", "status", "hardware", "image", "dvd", "snapshot", "datacenter", "ips", "alerts", "monitoring_policy", "private_networks"})
+ public static Server create(String id, String name, Date creationDate, String firstPassword, String description, Status status, Hardware hardware, Image image, Dvd dvd, Snapshot snapshot, DataCenter datacenter, List<ServerIp> ips, List<Alert> alerts, ServerMonitoringPolicy policy, List<ServerPrivateNetwork> privateNetworks) {
+ return new AutoValue_Server(id, name, creationDate, firstPassword, description, status, hardware, image, dvd, snapshot, datacenter,
+ ips == null ? ImmutableList.<ServerIp>of() : ips, alerts == null ? ImmutableList.<Alert>of() : alerts, policy,
+ privateNetworks == null ? ImmutableList.<ServerPrivateNetwork>of() : privateNetworks);
+ }
+
+ @AutoValue
+ public abstract static class Alert {
+
+ public abstract List<WarningAlert> warning();
+
+ public abstract List<CriticalAlert> critical();
+
+ @SerializedNames({"warning", "critical"})
+ public static Alert create(List<WarningAlert> warning, List<CriticalAlert> critical) {
+ return new AutoValue_Server_Alert(warning == null ? ImmutableList.<WarningAlert>of() : warning,
+ critical == null ? ImmutableList.<CriticalAlert>of() : critical);
+ }
+ }
+
+ @AutoValue
+ public abstract static class CriticalAlert {
+
+ public abstract String type();
+
+ public abstract String description();
+
+ public abstract String date();
+
+ @SerializedNames({"type", "description", "date"})
+ public static CriticalAlert create(String type, String description, String date) {
+ return new AutoValue_Server_CriticalAlert(type, description, date);
+ }
+ }
+
+ @AutoValue
+ public abstract static class UpdateServerResponse {
+
+ public abstract String id();
+
+ public abstract String name();
+
+ @Nullable
+ public abstract Date creationDate();
+
+ @Nullable
+ public abstract String firstPassword();
+
+ public abstract String description();
+
+ @Nullable
+ public abstract Status status();
+
+ @Nullable
+ public abstract Hardware hardware();
+
+ @Nullable
+ public abstract Image image();
+
+ @Nullable
+ public abstract Dvd dvd();
+
+ @Nullable
+ public abstract Snapshot Snapshot();
+
+ @Nullable
+ public abstract DataCenter datacenter();
+
+ public abstract List<String> ips();
+
+ public abstract List<Alert> alerts();
+
+ public abstract List<ServerMonitoringPolicy> monitoringPolicy();
+
+ public abstract List<ServerPrivateNetwork> privateNetworks();
+
+ @SerializedNames({"id", "name", "creation_date", "first_password", "description", "status", "hardware", "image", "dvd", "snapshot", "datacenter", "ips", "alerts", "monitoring_policy", "private_networks"})
+ public static UpdateServerResponse create(String id, String name, Date creationDate, String firstPassword, String description, Status status, Hardware hardware, Image image, Dvd dvd, Snapshot snapshot, DataCenter datacenter, List<String> ips, List<Alert> alerts, List<ServerMonitoringPolicy> policy, List<ServerPrivateNetwork> privateNetworks) {
+ return new AutoValue_Server_UpdateServerResponse(id, name, creationDate, firstPassword, description, status, hardware, image, dvd,
+ snapshot, datacenter, ips == null ? ImmutableList.<String>of() : ips, alerts == null ? ImmutableList.<Alert>of() : alerts,
+ policy == null ? ImmutableList.<ServerMonitoringPolicy>of() : policy, privateNetworks == null ? ImmutableList.<ServerPrivateNetwork>of() : privateNetworks);
+ }
+ }
+
+ @AutoValue
+ public abstract static class CreateServer {
+
+ public abstract String name();
+
+ public abstract String description();
+
+ public abstract Hardware.CreateHardware hardware();
+
+ public abstract String applianceId();
+
+ @Nullable
+ public abstract String dataCenterId();
+
+ @Nullable
+ public abstract String password();
+
+ @Nullable
+ public abstract String regionId();
+
+ @Nullable
+ public abstract Boolean powerOn();
+
+ @Nullable
+ public abstract String firewallPolicyId();
+
+ @Nullable
+ public abstract String ipId();
+
+ @Nullable
+ public abstract String loadrBalancerId();
+
+ @Nullable
+ public abstract String monitoringPolicyId();
+
+ @SerializedNames({"name", "description", "hardware", "appliance_id", "datacenter_id", "password", "region_id", "power_on", "firewall_policy_id", "ip_id", "loadr_balancer_id", "monitoring_policy_id"})
+ public static CreateServer create(final String name, final String description, final Hardware.CreateHardware hardware, final String applianceId,
+ final String dataCenterId, final String password, final String regionId, final Boolean powerOn, final String firewallPolicyId,
+ final String ipId, final String loadrBalancerId, final String monitoringPolicyId) {
+ return builder()
+ .name(name)
+ .description(description)
+ .hardware(hardware)
+ .applianceId(applianceId)
+ .dataCenterId(dataCenterId)
+ .password(password)
+ .regionId(regionId)
+ .powerOn(powerOn)
+ .firewallPolicyId(firewallPolicyId)
+ .ipId(ipId)
+ .loadrBalancerId(loadrBalancerId)
+ .monitoringPolicyId(monitoringPolicyId)
+ .build();
+ }
+
+ public static Builder builder() {
+ return new AutoValue_Server_CreateServer.Builder();
+ }
+
+ @AutoValue.Builder
+ public abstract static class Builder {
+
+ public abstract Builder name(String name);
+
+ public abstract Builder description(String description);
+
+ public abstract Builder hardware(Hardware.CreateHardware hardware);
+
+ public abstract Builder applianceId(String applianceId);
+
+ public abstract Builder dataCenterId(String dataCenterId);
+
+ public abstract Builder password(String password);
+
+ public abstract Builder regionId(String regionId);
+
+ public abstract Builder powerOn(Boolean powerOn);
+
+ public abstract Builder firewallPolicyId(String firewallPolicyId);
+
+ public abstract Builder ipId(String ipId);
+
+ public abstract Builder loadrBalancerId(String loadrBalancerId);
+
+ public abstract Builder monitoringPolicyId(String monitoringPolicyId);
+
+ public abstract CreateServer build();
+ }
+ }
+
+ @AutoValue
+ public abstract static class CreateFixedInstanceServer {
+
+ public abstract String name();
+
+ public abstract String description();
+
+ public abstract FixedInstanceHardware hardware();
+
+ public abstract String applianceId();
+
+ @Nullable
+ public abstract String dataCenterId();
+
+ @Nullable
+ public abstract String password();
+
+ @Nullable
+ public abstract String regionId();
+
+ @Nullable
+ public abstract Boolean powerOn();
+
+ @Nullable
+ public abstract String firewallPolicyId();
+
+ @Nullable
+ public abstract String ipId();
+
+ @Nullable
+ public abstract String loadrBalancerId();
+
+ @Nullable
+ public abstract String monitoringPolicyId();
+
+ @SerializedNames({"name", "description", "hardware", "appliance_id", "datacenter_id", "password", "region_id", "power_on", "firewall_policy_id", "ip_id", "loadr_balancer_id", "monitoring_policy_id"})
+ public static CreateFixedInstanceServer create(String name, String description, FixedInstanceHardware hardware, String applianceId, String dataCenterId, String password,
+ String regionId, Boolean powerOn, String firewallPolicyId, String ipId, String loadrBalancerId, String monitoringPolicyId) {
+ return builder()
+ .name(name)
+ .description(description)
+ .hardware(hardware)
+ .applianceId(applianceId)
+ .dataCenterId(dataCenterId)
+ .password(password)
+ .regionId(regionId)
+ .powerOn(powerOn)
+ .firewallPolicyId(firewallPolicyId)
+ .ipId(ipId)
+ .loadrBalancerId(loadrBalancerId)
+ .monitoringPolicyId(monitoringPolicyId)
+ .build();
+ }
+
+ public static Builder builder() {
+ return new AutoValue_Server_CreateFixedInstanceServer.Builder();
+ }
+
+ @AutoValue.Builder
+ public abstract static class Builder {
+
+ public abstract Builder name(String name);
+
+ public abstract Builder description(String description);
+
+ public abstract Builder hardware(FixedInstanceHardware hardware);
+
+ public abstract Builder applianceId(String applianceId);
+
+ public abstract Builder dataCenterId(String dataCenterId);
+
+ public abstract Builder password(String password);
+
+ public abstract Builder regionId(String regionId);
+
+ public abstract Builder powerOn(Boolean powerOn);
+
+ public abstract Builder firewallPolicyId(String firewallPolicyId);
+
+ public abstract Builder ipId(String ipId);
+
+ public abstract Builder loadrBalancerId(String loadrBalancerId);
+
+ public abstract Builder monitoringPolicyId(String monitoringPolicyId);
+
+ public abstract CreateFixedInstanceServer build();
+ }
+ }
+
+ @AutoValue
+ public abstract static class UpdateImage {
+
+ public abstract String id();
+
+ public abstract String password();
+
+ @SerializedNames({"id", "password"})
+ public static UpdateImage create(String id, String password) {
+ return new AutoValue_Server_UpdateImage(id, password);
+ }
+ }
+
+ @AutoValue
+ public abstract static class Clone {
+
+ public abstract String datacenterId();
+
+ public abstract String name();
+
+ @SerializedNames({"datacenter_id", "name"})
+ public static Clone create(String datacenterId, String name) {
+ return new AutoValue_Server_Clone(datacenterId, name);
+ }
+ }
+
+ @AutoValue
+ public abstract static class UpdateServer {
+
+ public abstract String name();
+
+ public abstract String description();
+
+ @SerializedNames({"name", "description"})
+ public static UpdateServer create(String name, String description) {
+ return new AutoValue_Server_UpdateServer(name, description);
+ }
+ }
+
+ @AutoValue
+ public abstract static class UpdateStatus {
+
+ public abstract ServerAction action();
+
+ public abstract ServerActionMethod method();
+
+ @SerializedNames({"action", "method"})
+ public static UpdateStatus create(ServerAction action, ServerActionMethod method) {
+ return new AutoValue_Server_UpdateStatus(action, method);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/7df28d25/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/domain/ServerFirewallPolicy.java
----------------------------------------------------------------------
diff --git a/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/domain/ServerFirewallPolicy.java b/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/domain/ServerFirewallPolicy.java
new file mode 100644
index 0000000..b57294a
--- /dev/null
+++ b/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/domain/ServerFirewallPolicy.java
@@ -0,0 +1,33 @@
+/*
+ * 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.apache.jclouds.oneandone.rest.domain;
+
+import com.google.auto.value.AutoValue;
+import org.jclouds.json.SerializedNames;
+
+@AutoValue
+public abstract class ServerFirewallPolicy {
+
+ public abstract String id();
+
+ public abstract String name();
+
+ @SerializedNames({"id", "name"})
+ public static ServerFirewallPolicy create(String id, String name) {
+ return new AutoValue_ServerFirewallPolicy(id, name);
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/7df28d25/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/domain/ServerIp.java
----------------------------------------------------------------------
diff --git a/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/domain/ServerIp.java b/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/domain/ServerIp.java
new file mode 100644
index 0000000..0774334
--- /dev/null
+++ b/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/domain/ServerIp.java
@@ -0,0 +1,48 @@
+/*
+ * 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.apache.jclouds.oneandone.rest.domain;
+
+import com.google.auto.value.AutoValue;
+import com.google.common.collect.ImmutableList;
+import java.util.List;
+import org.apache.jclouds.oneandone.rest.domain.Types.IPType;
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.json.SerializedNames;
+
+@AutoValue
+public abstract class ServerIp {
+
+ public abstract String id();
+
+ public abstract String ip();
+
+ public abstract List<ServerLoadBalancer> loadBalancers();
+
+ public abstract List<ServerFirewallPolicy> firewallPolicy();
+
+ @Nullable
+ public abstract String reverseDns();
+
+ @Nullable
+ public abstract IPType type();
+
+ @SerializedNames({"id", "ip", "loadBalancers", "firewallPolicy", "reverseDns", "type"})
+ public static ServerIp create(String id, String ip, List<ServerLoadBalancer> loadBalancers, List<ServerFirewallPolicy> firewallPolicy, String reverseDns, IPType type) {
+ return new AutoValue_ServerIp(id, ip, loadBalancers == null ? ImmutableList.<ServerLoadBalancer>of() : loadBalancers,
+ firewallPolicy == null ? ImmutableList.<ServerFirewallPolicy>of() : firewallPolicy, reverseDns, type);
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/7df28d25/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/domain/ServerLoadBalancer.java
----------------------------------------------------------------------
diff --git a/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/domain/ServerLoadBalancer.java b/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/domain/ServerLoadBalancer.java
new file mode 100644
index 0000000..0d7c6a7
--- /dev/null
+++ b/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/domain/ServerLoadBalancer.java
@@ -0,0 +1,33 @@
+/*
+ * 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.apache.jclouds.oneandone.rest.domain;
+
+import com.google.auto.value.AutoValue;
+import org.jclouds.json.SerializedNames;
+
+@AutoValue
+public abstract class ServerLoadBalancer {
+
+ public abstract String id();
+
+ public abstract String name();
+
+ @SerializedNames({"id", "name"})
+ public static ServerLoadBalancer create(String id, String name) {
+ return new AutoValue_ServerLoadBalancer(id, name);
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/7df28d25/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/domain/ServerMonitoringPolicy.java
----------------------------------------------------------------------
diff --git a/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/domain/ServerMonitoringPolicy.java b/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/domain/ServerMonitoringPolicy.java
new file mode 100644
index 0000000..0df5466
--- /dev/null
+++ b/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/domain/ServerMonitoringPolicy.java
@@ -0,0 +1,33 @@
+/*
+ * 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.apache.jclouds.oneandone.rest.domain;
+
+import com.google.auto.value.AutoValue;
+import org.jclouds.json.SerializedNames;
+
+@AutoValue
+public abstract class ServerMonitoringPolicy {
+
+ public abstract String id();
+
+ public abstract String name();
+
+ @SerializedNames({"id", "name"})
+ public static ServerMonitoringPolicy create(String id, String name) {
+ return new AutoValue_ServerMonitoringPolicy(id, name);
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/7df28d25/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/domain/ServerPrivateNetwork.java
----------------------------------------------------------------------
diff --git a/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/domain/ServerPrivateNetwork.java b/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/domain/ServerPrivateNetwork.java
new file mode 100644
index 0000000..111551a
--- /dev/null
+++ b/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/domain/ServerPrivateNetwork.java
@@ -0,0 +1,33 @@
+/*
+ * 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.apache.jclouds.oneandone.rest.domain;
+
+import com.google.auto.value.AutoValue;
+import org.jclouds.json.SerializedNames;
+
+@AutoValue
+public abstract class ServerPrivateNetwork {
+
+ public abstract String id();
+
+ public abstract String name();
+
+ @SerializedNames({"id", "name"})
+ public static ServerPrivateNetwork create(String id, String name) {
+ return new AutoValue_ServerPrivateNetwork(id, name);
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/7df28d25/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/domain/Snapshot.java
----------------------------------------------------------------------
diff --git a/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/domain/Snapshot.java b/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/domain/Snapshot.java
new file mode 100644
index 0000000..a4f54ee
--- /dev/null
+++ b/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/domain/Snapshot.java
@@ -0,0 +1,35 @@
+/*
+ * 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.apache.jclouds.oneandone.rest.domain;
+
+import com.google.auto.value.AutoValue;
+import org.jclouds.json.SerializedNames;
+
+@AutoValue
+public abstract class Snapshot {
+
+ public abstract String id();
+
+ public abstract String creationDate();
+
+ public abstract String deletionDate();
+
+ @SerializedNames({"id", "creation_date", "deletion_date"})
+ public static Snapshot create(String id, String creationDate, String deletionDate) {
+ return new AutoValue_Snapshot(id, creationDate, deletionDate);
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/7df28d25/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/domain/Status.java
----------------------------------------------------------------------
diff --git a/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/domain/Status.java b/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/domain/Status.java
new file mode 100644
index 0000000..308ce4d
--- /dev/null
+++ b/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/domain/Status.java
@@ -0,0 +1,34 @@
+/*
+ * 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.apache.jclouds.oneandone.rest.domain;
+
+import com.google.auto.value.AutoValue;
+import org.apache.jclouds.oneandone.rest.domain.Types.ServerState;
+import org.jclouds.json.SerializedNames;
+
+@AutoValue
+public abstract class Status {
+
+ public abstract ServerState state();
+
+ public abstract int percent();
+
+ @SerializedNames({"state", "percent"})
+ public static Status create(ServerState state, int percent) {
+ return new AutoValue_Status(state, percent);
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/7df28d25/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/domain/Types.java
----------------------------------------------------------------------
diff --git a/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/domain/Types.java b/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/domain/Types.java
new file mode 100644
index 0000000..1587803
--- /dev/null
+++ b/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/domain/Types.java
@@ -0,0 +1,141 @@
+/*
+ * 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.apache.jclouds.oneandone.rest.domain;
+
+import com.google.common.base.Enums;
+
+public class Types {
+
+ public enum OSFamliyType {
+
+ Windows, Linux, Others, Null, UNRECOGNIZED;
+
+ public static OSFamliyType fromValue(String v) {
+ return Enums.getIfPresent(OSFamliyType.class, v).or(UNRECOGNIZED);
+ }
+
+ }
+
+ public enum ImageType {
+ IMAGES("IMAGES"), MYIMAGE("MY_IMAGE"), PERSONAL("PERSONAL"), UNRECOGNIZED("");
+
+ public static ImageType fromValue(String v) {
+ return Enums.getIfPresent(ImageType.class, v).or(UNRECOGNIZED);
+ }
+ // the value which is used for matching
+ // the json node value with this enum
+ private final String value;
+
+ ImageType(final String type) {
+ value = type;
+ }
+
+ @Override
+ public String toString() {
+ return value;
+ }
+ }
+
+ public enum OSType {
+ CentOS("CentOS"),
+ Debian("Debian"),
+ Ubuntu("Ubuntu"),
+ RedHat("Red Hat"),
+ Windows2008("Windows 2008"),
+ Windows2012("Windows 2012"),
+ WindowsDatacenter("WindowsDatacenter"),
+ UNRECOGNIZED("");
+
+ public static OSType fromValue(String v) {
+ return Enums.getIfPresent(OSType.class, v).or(UNRECOGNIZED);
+ }
+
+ // the value which is used for matching
+ // the json node value with this enum
+ private final String value;
+
+ OSType(final String type) {
+ value = type;
+ }
+
+ @Override
+ public String toString() {
+ return value;
+ }
+ }
+
+ public enum ImageFrequency {
+ ONCE,
+ DAILY,
+ WEEKLY,
+ UNRECOGNIZED;
+
+ public static ImageFrequency fromValue(String v) {
+ return Enums.getIfPresent(ImageFrequency.class, v).or(UNRECOGNIZED);
+ }
+ }
+
+ public enum ServerState {
+ POWERING_ON,
+ POWERING_OFF,
+ POWERED_ON,
+ POWERED_OFF,
+ DEPLOYING,
+ REBOOTING,
+ REMOVING,
+ CONFIGURING, UNRECOGNIZED;
+
+ public static ServerState fromValue(String v) {
+ return Enums.getIfPresent(ServerState.class, v).or(UNRECOGNIZED);
+ }
+ }
+
+ public enum GenericState {
+ ACTIVE, REMOVING,
+ CONFIGURING, UNRECOGNIZED;
+
+ public static GenericState fromValue(String v) {
+ return Enums.getIfPresent(GenericState.class, v).or(UNRECOGNIZED);
+ }
+ }
+
+ public enum ServerAction {
+ POWER_ON, POWER_OFF, REBOOT, UNRECOGNIZED;
+
+ public static ServerAction fromValue(String v) {
+ return Enums.getIfPresent(ServerAction.class, v).or(UNRECOGNIZED);
+ }
+
+ }
+
+ public enum ServerActionMethod {
+ SOFTWARE, HARDWARE, UNRECOGNIZED;
+
+ public static ServerActionMethod fromValue(String v) {
+ return Enums.getIfPresent(ServerActionMethod.class, v).or(UNRECOGNIZED);
+ }
+ }
+
+ public enum IPType {
+ IPV4, IPV6, UNRECOGNIZED;
+
+ public static IPType fromValue(String v) {
+ return Enums.getIfPresent(IPType.class, v).or(UNRECOGNIZED);
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/7df28d25/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/domain/WarningAlert.java
----------------------------------------------------------------------
diff --git a/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/domain/WarningAlert.java b/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/domain/WarningAlert.java
new file mode 100644
index 0000000..05303dd
--- /dev/null
+++ b/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/domain/WarningAlert.java
@@ -0,0 +1,36 @@
+/*
+ * 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.apache.jclouds.oneandone.rest.domain;
+
+import com.google.auto.value.AutoValue;
+import java.util.Date;
+import org.jclouds.json.SerializedNames;
+
+@AutoValue
+public abstract class WarningAlert {
+
+ public abstract String type();
+
+ public abstract String description();
+
+ public abstract Date date();
+
+ @SerializedNames({"type", "description", "date"})
+ public static WarningAlert create(String type, String description, Date date) {
+ return new AutoValue_WarningAlert(type, description, date);
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/7df28d25/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/domain/options/GenericQueryOptions.java
----------------------------------------------------------------------
diff --git a/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/domain/options/GenericQueryOptions.java b/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/domain/options/GenericQueryOptions.java
new file mode 100644
index 0000000..9527308
--- /dev/null
+++ b/oneandone/src/main/java/org/apache/jclouds/oneandone/rest/domain/options/GenericQueryOptions.java
@@ -0,0 +1,49 @@
+/*
+ * 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.apache.jclouds.oneandone.rest.domain.options;
+
+import org.jclouds.http.options.BaseHttpRequestOptions;
+
+public class GenericQueryOptions extends BaseHttpRequestOptions {
+
+ public static final String PAGE = "page";
+ public static final String PERPAGE = "per_page";
+ public static final String SORT = "sort";
+ public static final String QUERY = "q";
+ public static final String FIELDS = "fields";
+
+ public GenericQueryOptions options(int page, int perPage, String sort, String query, String fields) {
+
+ if (page != 0) {
+ queryParameters.put(PAGE, String.valueOf(page));
+ }
+ if (perPage != 0) {
+ queryParameters.put(PERPAGE, String.valueOf(perPage));
+ }
+ if (sort != null && !sort.isEmpty()) {
+ queryParameters.put(SORT, sort);
+ }
+ if (query != null && !query.isEmpty()) {
+ queryParameters.put(QUERY, query);
+ }
+ if (fields != null && !fields.isEmpty()) {
+ queryParameters.put(FIELDS, fields);
+ }
+ return this;
+ }
+
+}