mirror of https://github.com/apache/jclouds.git
issue #1098: remove rimuhosting
This commit is contained in:
parent
4ef95df0e0
commit
87cfd1f813
|
@ -50,11 +50,6 @@
|
||||||
<artifactId>aws-ec2</artifactId>
|
<artifactId>aws-ec2</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.jclouds.provider</groupId>
|
|
||||||
<artifactId>rimuhosting</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.jclouds.api</groupId>
|
<groupId>org.jclouds.api</groupId>
|
||||||
<artifactId>openstack-nova</artifactId>
|
<artifactId>openstack-nova</artifactId>
|
||||||
|
|
|
@ -55,7 +55,6 @@
|
||||||
<module>elastichosts-lon-b</module>
|
<module>elastichosts-lon-b</module>
|
||||||
<module>elastichosts-tor-p</module>
|
<module>elastichosts-tor-p</module>
|
||||||
<module>elastichosts-lax-p</module>
|
<module>elastichosts-lax-p</module>
|
||||||
<module>rimuhosting</module>
|
|
||||||
<module>openhosting-east1</module>
|
<module>openhosting-east1</module>
|
||||||
<module>serverlove-z1-man</module>
|
<module>serverlove-z1-man</module>
|
||||||
<module>skalicloud-sdg-my</module>
|
<module>skalicloud-sdg-my</module>
|
||||||
|
|
|
@ -1,25 +0,0 @@
|
||||||
====
|
|
||||||
Licensed to jclouds, Inc. (jclouds) under one or more
|
|
||||||
contributor license agreements. See the NOTICE file
|
|
||||||
distributed with this work for additional information
|
|
||||||
regarding copyright ownership. jclouds licenses this file
|
|
||||||
to you under the Apache License, Version 2.0 (the
|
|
||||||
"License"); you may not use this file except in compliance
|
|
||||||
with the License. You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing,
|
|
||||||
software distributed under the License is distributed on an
|
|
||||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
KIND, either express or implied. See the License for the
|
|
||||||
specific language governing permissions and limitations
|
|
||||||
under the License.
|
|
||||||
====
|
|
||||||
|
|
||||||
#
|
|
||||||
# The jclouds provider for RimuHosting (http://rimuhosting.com/).
|
|
||||||
#
|
|
||||||
# Note: This provider is currently unstable, as http errors are often returned
|
|
||||||
# during mvn install -Plive. When this runs cleanly, the provider can
|
|
||||||
# be promoted.
|
|
|
@ -1,126 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!--
|
|
||||||
|
|
||||||
Licensed to jclouds, Inc. (jclouds) under one or more
|
|
||||||
contributor license agreements. See the NOTICE file
|
|
||||||
distributed with this work for additional information
|
|
||||||
regarding copyright ownership. jclouds licenses this file
|
|
||||||
to you under the Apache License, Version 2.0 (the
|
|
||||||
"License"); you may not use this file except in compliance
|
|
||||||
with the License. You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing,
|
|
||||||
software distributed under the License is distributed on an
|
|
||||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
KIND, either express or implied. See the License for the
|
|
||||||
specific language governing permissions and limitations
|
|
||||||
under the License.
|
|
||||||
|
|
||||||
-->
|
|
||||||
<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.jclouds</groupId>
|
|
||||||
<artifactId>jclouds-project</artifactId>
|
|
||||||
<version>1.6.0-SNAPSHOT</version>
|
|
||||||
<relativePath>../../project/pom.xml</relativePath>
|
|
||||||
</parent>
|
|
||||||
<groupId>org.jclouds.provider</groupId>
|
|
||||||
<artifactId>rimuhosting</artifactId>
|
|
||||||
<name>jclouds RimuHosting provider</name>
|
|
||||||
<description>ComputeService implementation of RimuHosting datacenters </description>
|
|
||||||
<packaging>bundle</packaging>
|
|
||||||
|
|
||||||
<properties>
|
|
||||||
<test.rimuhosting.endpoint>https://api.rimuhosting.com/r</test.rimuhosting.endpoint>
|
|
||||||
<test.rimuhosting.api-version>1.0</test.rimuhosting.api-version>
|
|
||||||
<test.rimuhosting.build-version></test.rimuhosting.build-version>
|
|
||||||
<test.rimuhosting.identity>FIXME</test.rimuhosting.identity>
|
|
||||||
<test.rimuhosting.template></test.rimuhosting.template>
|
|
||||||
|
|
||||||
<jclouds.osgi.export>org.jclouds.rimuhosting.miro*;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.jclouds.driver</groupId>
|
|
||||||
<artifactId>jclouds-jsch</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.jcraft</groupId>
|
|
||||||
<artifactId>jsch</artifactId>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.jclouds</groupId>
|
|
||||||
<artifactId>jclouds-core</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
<type>test-jar</type>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.jclouds</groupId>
|
|
||||||
<artifactId>jclouds-compute</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.jclouds</groupId>
|
|
||||||
<artifactId>jclouds-compute</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
<type>test-jar</type>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>log4j</groupId>
|
|
||||||
<artifactId>log4j</artifactId>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.jclouds.driver</groupId>
|
|
||||||
<artifactId>jclouds-log4j</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
<profiles>
|
|
||||||
<profile>
|
|
||||||
<id>live</id>
|
|
||||||
<build>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-surefire-plugin</artifactId>
|
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<id>integration</id>
|
|
||||||
<phase>integration-test</phase>
|
|
||||||
<goals>
|
|
||||||
<goal>test</goal>
|
|
||||||
</goals>
|
|
||||||
<configuration>
|
|
||||||
<systemPropertyVariables>
|
|
||||||
<test.rimuhosting.endpoint>${test.rimuhosting.endpoint}</test.rimuhosting.endpoint>
|
|
||||||
<test.rimuhosting.api-version>${test.rimuhosting.api-version}</test.rimuhosting.api-version>
|
|
||||||
<test.rimuhosting.build-version>${test.rimuhosting.build-version}</test.rimuhosting.build-version>
|
|
||||||
<test.rimuhosting.identity>${test.rimuhosting.identity}</test.rimuhosting.identity>
|
|
||||||
<test.rimuhosting.template>${test.rimuhosting.template}</test.rimuhosting.template>
|
|
||||||
</systemPropertyVariables>
|
|
||||||
</configuration>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
</profile>
|
|
||||||
</profiles>
|
|
||||||
|
|
||||||
</project>
|
|
|
@ -1,104 +0,0 @@
|
||||||
/**
|
|
||||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
|
||||||
* contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. jclouds licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
package org.jclouds.rimuhosting.miro;
|
|
||||||
|
|
||||||
import static org.jclouds.Constants.PROPERTY_CONNECTION_TIMEOUT;
|
|
||||||
import static org.jclouds.Constants.PROPERTY_SO_TIMEOUT;
|
|
||||||
|
|
||||||
import java.net.URI;
|
|
||||||
import java.util.Properties;
|
|
||||||
|
|
||||||
import org.jclouds.apis.ApiMetadata;
|
|
||||||
import org.jclouds.compute.ComputeServiceContext;
|
|
||||||
import org.jclouds.compute.config.ComputeServiceProperties;
|
|
||||||
import org.jclouds.concurrent.Timeout;
|
|
||||||
import org.jclouds.rest.RestContext;
|
|
||||||
import org.jclouds.rest.internal.BaseRestApiMetadata;
|
|
||||||
import org.jclouds.rimuhosting.miro.compute.config.RimuHostingComputeServiceContextModule;
|
|
||||||
import org.jclouds.rimuhosting.miro.config.RimuHostingRestClientModule;
|
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableSet;
|
|
||||||
import com.google.common.reflect.TypeToken;
|
|
||||||
import com.google.inject.Module;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Implementation of {@link ApiMetadata} for RimuHosting API
|
|
||||||
*
|
|
||||||
* @author Adrian Cole
|
|
||||||
*/
|
|
||||||
public class RimuHostingApiMetadata extends BaseRestApiMetadata {
|
|
||||||
|
|
||||||
public static final TypeToken<RestContext<RimuHostingClient, RimuHostingAsyncClient>> CONTEXT_TOKEN = new TypeToken<RestContext<RimuHostingClient, RimuHostingAsyncClient>>() {
|
|
||||||
};
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Builder toBuilder() {
|
|
||||||
return new Builder().fromApiMetadata(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
public RimuHostingApiMetadata() {
|
|
||||||
this(new Builder());
|
|
||||||
}
|
|
||||||
|
|
||||||
protected RimuHostingApiMetadata(Builder builder) {
|
|
||||||
super(builder);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Properties defaultProperties() {
|
|
||||||
Properties properties = BaseRestApiMetadata.defaultProperties();
|
|
||||||
Timeout timeout = RimuHostingClient.class.getAnnotation(Timeout.class);
|
|
||||||
long timeoutMillis = timeout.timeUnit().toMillis(timeout.duration());
|
|
||||||
properties.setProperty(PROPERTY_SO_TIMEOUT, timeoutMillis + "");
|
|
||||||
properties.setProperty(PROPERTY_CONNECTION_TIMEOUT, timeoutMillis + "");
|
|
||||||
properties.setProperty(ComputeServiceProperties.TIMEOUT_NODE_TERMINATED, 60 * 1000 + "");
|
|
||||||
return properties;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class Builder
|
|
||||||
extends
|
|
||||||
BaseRestApiMetadata.Builder {
|
|
||||||
|
|
||||||
protected Builder() {
|
|
||||||
super(RimuHostingClient.class, RimuHostingAsyncClient.class);
|
|
||||||
id("rimuhosting")
|
|
||||||
.name("RimuHosting API")
|
|
||||||
.identityName("API Key")
|
|
||||||
.documentation(URI.create("http://apidocs.rimuhosting.com"))
|
|
||||||
.version("1")
|
|
||||||
.defaultEndpoint("https://api.rimuhosting.com/r")
|
|
||||||
.defaultProperties(RimuHostingApiMetadata.defaultProperties())
|
|
||||||
.view(TypeToken.of(ComputeServiceContext.class))
|
|
||||||
.defaultModules(ImmutableSet.<Class<? extends Module>>of(RimuHostingRestClientModule.class, RimuHostingComputeServiceContextModule.class));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public RimuHostingApiMetadata build() {
|
|
||||||
return new RimuHostingApiMetadata(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Builder fromApiMetadata(ApiMetadata in) {
|
|
||||||
super.fromApiMetadata(in);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,146 +0,0 @@
|
||||||
/**
|
|
||||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
|
||||||
* contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. jclouds licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
package org.jclouds.rimuhosting.miro;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import javax.ws.rs.Consumes;
|
|
||||||
import javax.ws.rs.DELETE;
|
|
||||||
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.Produces;
|
|
||||||
import javax.ws.rs.core.MediaType;
|
|
||||||
|
|
||||||
import org.jclouds.rest.annotations.Fallback;
|
|
||||||
import org.jclouds.rest.annotations.MapBinder;
|
|
||||||
import org.jclouds.rest.annotations.PayloadParam;
|
|
||||||
import org.jclouds.rest.annotations.RequestFilters;
|
|
||||||
import org.jclouds.rest.annotations.ResponseParser;
|
|
||||||
import org.jclouds.rest.annotations.Unwrap;
|
|
||||||
import org.jclouds.rest.annotations.VirtualHost;
|
|
||||||
import org.jclouds.rimuhosting.miro.binder.CreateServerOptions;
|
|
||||||
import org.jclouds.rimuhosting.miro.binder.RimuHostingRebootJsonBinder;
|
|
||||||
import org.jclouds.rimuhosting.miro.domain.Image;
|
|
||||||
import org.jclouds.rimuhosting.miro.domain.NewServerResponse;
|
|
||||||
import org.jclouds.rimuhosting.miro.domain.PricingPlan;
|
|
||||||
import org.jclouds.rimuhosting.miro.domain.Server;
|
|
||||||
import org.jclouds.rimuhosting.miro.domain.ServerInfo;
|
|
||||||
import org.jclouds.rimuhosting.miro.fallbacks.ParseRimuHostingException;
|
|
||||||
import org.jclouds.rimuhosting.miro.filters.RimuHostingAuthentication;
|
|
||||||
import org.jclouds.rimuhosting.miro.functions.ParseDestroyResponseFromJsonResponse;
|
|
||||||
import org.jclouds.rimuhosting.miro.functions.ParseImagesFromJsonResponse;
|
|
||||||
import org.jclouds.rimuhosting.miro.functions.ParsePricingPlansFromJsonResponse;
|
|
||||||
import org.jclouds.rimuhosting.miro.functions.ParseServerFromJsonResponse;
|
|
||||||
import org.jclouds.rimuhosting.miro.functions.ParseServerInfoFromJsonResponse;
|
|
||||||
import org.jclouds.rimuhosting.miro.functions.ParseServersFromJsonResponse;
|
|
||||||
|
|
||||||
import com.google.common.util.concurrent.ListenableFuture;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Provides asynchronous access to RimuHosting via their REST API.
|
|
||||||
* <p/>
|
|
||||||
*
|
|
||||||
* @author Ivan Meredith
|
|
||||||
* @see RimuHostingClient
|
|
||||||
* @see <a href="http://apidocs.rimuhosting.com" />
|
|
||||||
*/
|
|
||||||
@RequestFilters(RimuHostingAuthentication.class)
|
|
||||||
@VirtualHost
|
|
||||||
public interface RimuHostingAsyncClient {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see RimuHostingClient#getImageList
|
|
||||||
*/
|
|
||||||
@GET
|
|
||||||
@Path("/distributions")
|
|
||||||
@ResponseParser(ParseImagesFromJsonResponse.class)
|
|
||||||
@Consumes(MediaType.APPLICATION_JSON)
|
|
||||||
@Fallback(ParseRimuHostingException.class)
|
|
||||||
ListenableFuture<Set<Image>> getImageList();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see RimuHostingClient#getServerList
|
|
||||||
*/
|
|
||||||
@GET
|
|
||||||
@Path("/orders;include_inactive=N")
|
|
||||||
@ResponseParser(ParseServersFromJsonResponse.class)
|
|
||||||
@Consumes(MediaType.APPLICATION_JSON)
|
|
||||||
@Fallback(ParseRimuHostingException.class)
|
|
||||||
ListenableFuture<Set<Server>> getServerList();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see RimuHostingClient#getPricingPlanList
|
|
||||||
*/
|
|
||||||
@GET
|
|
||||||
@Path("/pricing-plans;server-type=VPS")
|
|
||||||
@Consumes(MediaType.APPLICATION_JSON)
|
|
||||||
@Fallback(ParseRimuHostingException.class)
|
|
||||||
@ResponseParser(ParsePricingPlansFromJsonResponse.class)
|
|
||||||
ListenableFuture<Set<PricingPlan>> getPricingPlanList();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see RimuHostingClient#createServer
|
|
||||||
*/
|
|
||||||
@POST
|
|
||||||
@Path("/orders/new-vps")
|
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
|
||||||
@Consumes(MediaType.APPLICATION_JSON)
|
|
||||||
@Fallback(ParseRimuHostingException.class)
|
|
||||||
@Unwrap
|
|
||||||
@MapBinder(CreateServerOptions.class)
|
|
||||||
ListenableFuture<NewServerResponse> createServer(@PayloadParam("name") String name,
|
|
||||||
@PayloadParam("imageId") String imageId, @PayloadParam("planId") String planId,
|
|
||||||
CreateServerOptions... options);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see RimuHostingClient#getServer
|
|
||||||
*/
|
|
||||||
@GET
|
|
||||||
@Path("/orders/order-{id}-blah")
|
|
||||||
@Consumes(MediaType.APPLICATION_JSON)
|
|
||||||
@ResponseParser(ParseServerFromJsonResponse.class)
|
|
||||||
@Fallback(ParseRimuHostingException.class)
|
|
||||||
ListenableFuture<Server> getServer(@PathParam("id") Long id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see RimuHostingClient#restartServer
|
|
||||||
*/
|
|
||||||
@PUT
|
|
||||||
@Path("/orders/order-{id}-blah/vps/running-state")
|
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
|
||||||
@Consumes(MediaType.APPLICATION_JSON)
|
|
||||||
@ResponseParser(ParseServerInfoFromJsonResponse.class)
|
|
||||||
@MapBinder(RimuHostingRebootJsonBinder.class)
|
|
||||||
@Fallback(ParseRimuHostingException.class)
|
|
||||||
ListenableFuture<ServerInfo> restartServer(@PathParam("id") Long id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see RimuHostingClient#destroyServer
|
|
||||||
*/
|
|
||||||
@DELETE
|
|
||||||
@Path("/orders/order-{id}-blah/vps")
|
|
||||||
@Consumes(MediaType.APPLICATION_JSON)
|
|
||||||
@ResponseParser(ParseDestroyResponseFromJsonResponse.class)
|
|
||||||
@Fallback(ParseRimuHostingException.class)
|
|
||||||
ListenableFuture<List<String>> destroyServer(@PathParam("id") Long id);
|
|
||||||
}
|
|
|
@ -1,104 +0,0 @@
|
||||||
/**
|
|
||||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
|
||||||
* contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. jclouds licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
package org.jclouds.rimuhosting.miro;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
|
|
||||||
import org.jclouds.concurrent.Timeout;
|
|
||||||
import org.jclouds.rimuhosting.miro.binder.CreateServerOptions;
|
|
||||||
import org.jclouds.rimuhosting.miro.domain.Image;
|
|
||||||
import org.jclouds.rimuhosting.miro.domain.NewServerResponse;
|
|
||||||
import org.jclouds.rimuhosting.miro.domain.PricingPlan;
|
|
||||||
import org.jclouds.rimuhosting.miro.domain.Server;
|
|
||||||
import org.jclouds.rimuhosting.miro.domain.ServerInfo;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Provides synchronous access to RimuHosting.
|
|
||||||
* <p/>
|
|
||||||
*
|
|
||||||
* @author Ivan Meredith
|
|
||||||
* @see RimuHostingAsyncClient
|
|
||||||
* @see <a href="TODO: insert URL of client documentation" />
|
|
||||||
*/
|
|
||||||
@Timeout(duration = 40, timeUnit = TimeUnit.MINUTES)
|
|
||||||
public interface RimuHostingClient {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This operation returns a list of images that can be used for server
|
|
||||||
* creation. c
|
|
||||||
*
|
|
||||||
* @see Image
|
|
||||||
*/
|
|
||||||
Set<? extends Image> getImageList();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a list of servers that belong to this identity.
|
|
||||||
*
|
|
||||||
* @return An empty set if there are no servers.
|
|
||||||
* @see Server
|
|
||||||
*/
|
|
||||||
Set<? extends Server> getServerList();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a list of pricing plans that can be used for server creation.
|
|
||||||
*
|
|
||||||
* @see PricingPlan
|
|
||||||
*/
|
|
||||||
Set<? extends PricingPlan> getPricingPlanList();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This operation creates a node based on its name, imageId and planId.
|
|
||||||
*
|
|
||||||
* A password can be specified with the option
|
|
||||||
* {@link CreateServerOptions#withPassword(String) | withPassword()}
|
|
||||||
*
|
|
||||||
* Key-Value @{link {@link MetaData | metadata} can be included with the
|
|
||||||
* option {@link CreateServerOptions#withMetaData(List) | withMetaData()}
|
|
||||||
*
|
|
||||||
* @see CreateServerOptions
|
|
||||||
*
|
|
||||||
* TODO: add more CreateServerOptions
|
|
||||||
*/
|
|
||||||
NewServerResponse createServer(String name, String imageId, String planId, CreateServerOptions... options);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets a server based on its id.
|
|
||||||
*
|
|
||||||
* @return null if server id is invalid.
|
|
||||||
* @see Server
|
|
||||||
*/
|
|
||||||
Server getServer(Long id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Restarts a server.
|
|
||||||
*
|
|
||||||
* @return State of the server.
|
|
||||||
*/
|
|
||||||
ServerInfo restartServer(Long id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Destroys a server. This an async operation.
|
|
||||||
*
|
|
||||||
* @return A list of messages that have something to do with the shutdown.
|
|
||||||
* Can ignore safely.
|
|
||||||
*/
|
|
||||||
List<String> destroyServer(Long id);
|
|
||||||
}
|
|
|
@ -1,91 +0,0 @@
|
||||||
/**
|
|
||||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
|
||||||
* contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. jclouds licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
package org.jclouds.rimuhosting.miro;
|
|
||||||
|
|
||||||
import static org.jclouds.compute.config.ComputeServiceProperties.TEMPLATE;
|
|
||||||
import static org.jclouds.location.reference.LocationConstants.ISO3166_CODES;
|
|
||||||
import static org.jclouds.location.reference.LocationConstants.PROPERTY_ZONE;
|
|
||||||
import static org.jclouds.location.reference.LocationConstants.PROPERTY_ZONES;
|
|
||||||
|
|
||||||
import java.net.URI;
|
|
||||||
import java.util.Properties;
|
|
||||||
|
|
||||||
import org.jclouds.providers.ProviderMetadata;
|
|
||||||
import org.jclouds.providers.internal.BaseProviderMetadata;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Implementation of {@link org.jclouds.types.ProviderMetadata} for RimuHosting.
|
|
||||||
* @author Adrian Cole
|
|
||||||
*/
|
|
||||||
public class RimuHostingProviderMetadata extends BaseProviderMetadata {
|
|
||||||
|
|
||||||
public static Builder builder() {
|
|
||||||
return new Builder();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Builder toBuilder() {
|
|
||||||
return builder().fromProviderMetadata(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
public RimuHostingProviderMetadata() {
|
|
||||||
super(builder());
|
|
||||||
}
|
|
||||||
|
|
||||||
public RimuHostingProviderMetadata(Builder builder) {
|
|
||||||
super(builder);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Properties defaultProperties() {
|
|
||||||
Properties properties = new Properties();
|
|
||||||
properties.setProperty(PROPERTY_ZONES, "DCAUCKLAND,DCLONDON,DCDALLAS,DCSYDNEY");
|
|
||||||
properties.setProperty(PROPERTY_ZONE + ".DCAUCKLAND." + ISO3166_CODES, "NZ-AUK");
|
|
||||||
properties.setProperty(PROPERTY_ZONE + ".DCLONDON." + ISO3166_CODES, "GB-LND");
|
|
||||||
properties.setProperty(PROPERTY_ZONE + ".DCDALLAS." + ISO3166_CODES, "US-TX");
|
|
||||||
properties.setProperty(PROPERTY_ZONE + ".DCSYDNEY." + ISO3166_CODES, "AU-NSW");
|
|
||||||
properties.setProperty(TEMPLATE, "osFamily=UBUNTU,osVersionMatches=1[012].[01][04],os64Bit=true,hardwareId=MIRO4B,locationId=DCDALLAS");
|
|
||||||
return properties;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class Builder extends BaseProviderMetadata.Builder {
|
|
||||||
|
|
||||||
protected Builder() {
|
|
||||||
id("rimuhosting")
|
|
||||||
.name("RimuHosting")
|
|
||||||
.apiMetadata(new RimuHostingApiMetadata())
|
|
||||||
.homepage(URI.create("http://www.rimuhosting.com"))
|
|
||||||
.console(URI.create("https://rimuhosting.com/cp"))
|
|
||||||
.iso3166Codes("NZ-AUK", "US-TX", "AU-NSW", "GB-LND")
|
|
||||||
.endpoint("https://api.rimuhosting.com/r")
|
|
||||||
.defaultProperties(RimuHostingProviderMetadata.defaultProperties());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public RimuHostingProviderMetadata build() {
|
|
||||||
return new RimuHostingProviderMetadata(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Builder fromProviderMetadata(ProviderMetadata in) {
|
|
||||||
super.fromProviderMetadata(in);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,69 +0,0 @@
|
||||||
/**
|
|
||||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
|
||||||
* contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. jclouds licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
package org.jclouds.rimuhosting.miro.binder;
|
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import javax.inject.Inject;
|
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
|
|
||||||
import org.jclouds.http.HttpRequest;
|
|
||||||
import org.jclouds.json.Json;
|
|
||||||
import org.jclouds.rimuhosting.miro.data.CreateOptions;
|
|
||||||
import org.jclouds.rimuhosting.miro.data.NewServerData;
|
|
||||||
import org.jclouds.rimuhosting.miro.domain.MetaData;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Ivan Meredith
|
|
||||||
*/
|
|
||||||
public class CreateServerOptions extends RimuHostingJsonBinder {
|
|
||||||
@Inject
|
|
||||||
public CreateServerOptions(Json jsonBinder) {
|
|
||||||
super(jsonBinder);
|
|
||||||
}
|
|
||||||
|
|
||||||
private String password;
|
|
||||||
private List<MetaData> metaData = Lists.newArrayList();
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
|
|
||||||
String name = checkNotNull(postParams.get("name")).toString();
|
|
||||||
String imageId = checkNotNull(postParams.get("imageId")).toString();
|
|
||||||
String planId = checkNotNull(postParams.get("planId")).toString();
|
|
||||||
// There will be cases when the password is null.
|
|
||||||
String password = this.password;
|
|
||||||
NewServerData newServerData = new NewServerData(new CreateOptions(name, password, imageId), planId);
|
|
||||||
newServerData.setMetaData(metaData);
|
|
||||||
return bindToRequest(request, newServerData);
|
|
||||||
}
|
|
||||||
|
|
||||||
public CreateServerOptions withPassword(String password) {
|
|
||||||
this.password = password;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public CreateServerOptions withMetaData(List<MetaData> metaData) {
|
|
||||||
this.metaData = metaData;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,53 +0,0 @@
|
||||||
/**
|
|
||||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
|
||||||
* contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. jclouds licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
package org.jclouds.rimuhosting.miro.binder;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import javax.inject.Inject;
|
|
||||||
|
|
||||||
import org.jclouds.http.HttpRequest;
|
|
||||||
import org.jclouds.json.Json;
|
|
||||||
import org.jclouds.rest.binders.BindToJsonPayload;
|
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableMap;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Generic binder for RimuHosting POSTS/PUTS. In the form of
|
|
||||||
*
|
|
||||||
* {"request":{...}}
|
|
||||||
*
|
|
||||||
* @author Ivan Meredith
|
|
||||||
*/
|
|
||||||
public class RimuHostingJsonBinder extends BindToJsonPayload {
|
|
||||||
@Inject
|
|
||||||
public RimuHostingJsonBinder(Json jsonBinder) {
|
|
||||||
super(jsonBinder);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
|
|
||||||
return bindToRequest(request, (Object) postParams);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public <R extends HttpRequest> R bindToRequest(R request, Object toBind) {
|
|
||||||
return super.bindToRequest(request, (Object) ImmutableMap.of("request", toBind));
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,47 +0,0 @@
|
||||||
/**
|
|
||||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
|
||||||
* contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. jclouds licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
package org.jclouds.rimuhosting.miro.binder;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import javax.inject.Inject;
|
|
||||||
|
|
||||||
import org.jclouds.http.HttpRequest;
|
|
||||||
import org.jclouds.json.Json;
|
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableMap;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Need to PUT a static string
|
|
||||||
*
|
|
||||||
* {"request":{"running_state":"RESTARTING"}
|
|
||||||
*
|
|
||||||
* @author Ivan Meredith
|
|
||||||
*/
|
|
||||||
public class RimuHostingRebootJsonBinder extends RimuHostingJsonBinder {
|
|
||||||
@Inject
|
|
||||||
public RimuHostingRebootJsonBinder(Json jsonBinder) {
|
|
||||||
super(jsonBinder);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
|
|
||||||
return super.bindToRequest(request, (Object) ImmutableMap.of("running_state", "RESTARTING"));
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,106 +0,0 @@
|
||||||
/**
|
|
||||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
|
||||||
* contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. jclouds licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
package org.jclouds.rimuhosting.miro.compute.config;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import javax.inject.Singleton;
|
|
||||||
|
|
||||||
import org.jclouds.compute.ComputeServiceAdapter;
|
|
||||||
import org.jclouds.compute.config.ComputeServiceAdapterContextModule;
|
|
||||||
import org.jclouds.compute.domain.Hardware;
|
|
||||||
import org.jclouds.compute.domain.Image;
|
|
||||||
import org.jclouds.compute.domain.NodeMetadata;
|
|
||||||
import org.jclouds.compute.domain.NodeMetadata.Status;
|
|
||||||
import org.jclouds.domain.Location;
|
|
||||||
import org.jclouds.functions.IdentityFunction;
|
|
||||||
import org.jclouds.rimuhosting.miro.compute.functions.RimuHostingImageToImage;
|
|
||||||
import org.jclouds.rimuhosting.miro.compute.functions.ServerToNodeMetadata;
|
|
||||||
import org.jclouds.rimuhosting.miro.compute.strategy.RimuHostingComputeServiceAdapter;
|
|
||||||
import org.jclouds.rimuhosting.miro.domain.Server;
|
|
||||||
import org.jclouds.rimuhosting.miro.domain.internal.RunningState;
|
|
||||||
|
|
||||||
import com.google.common.annotations.VisibleForTesting;
|
|
||||||
import com.google.common.base.Function;
|
|
||||||
import com.google.common.collect.ImmutableList;
|
|
||||||
import com.google.common.collect.ImmutableMap;
|
|
||||||
import com.google.common.collect.ImmutableSet;
|
|
||||||
import com.google.common.collect.Iterables;
|
|
||||||
import com.google.inject.Provides;
|
|
||||||
import com.google.inject.TypeLiteral;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Configures the {@link RimuHostingComputeServiceContext}; requires {@link BaseComputeService}
|
|
||||||
* bound.
|
|
||||||
*
|
|
||||||
* @author Adrian Cole
|
|
||||||
*/
|
|
||||||
public class RimuHostingComputeServiceContextModule extends
|
|
||||||
ComputeServiceAdapterContextModule<Server, Hardware, org.jclouds.rimuhosting.miro.domain.Image, Location> {
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
@Override
|
|
||||||
protected void configure() {
|
|
||||||
super.configure();
|
|
||||||
bind(
|
|
||||||
new TypeLiteral<ComputeServiceAdapter<Server, Hardware, org.jclouds.rimuhosting.miro.domain.Image, Location>>() {
|
|
||||||
}).to(RimuHostingComputeServiceAdapter.class);
|
|
||||||
|
|
||||||
bind(new TypeLiteral<Function<Server, NodeMetadata>>() {
|
|
||||||
}).to(ServerToNodeMetadata.class);
|
|
||||||
bind(new TypeLiteral<Function<Server, Iterable<String>>>() {
|
|
||||||
}).to(ServerToPublicAddresses.class);
|
|
||||||
|
|
||||||
bind(new TypeLiteral<Function<org.jclouds.rimuhosting.miro.domain.Image, Image>>() {
|
|
||||||
}).to(RimuHostingImageToImage.class);
|
|
||||||
|
|
||||||
bind(new TypeLiteral<Function<Hardware, Hardware>>() {
|
|
||||||
}).to(Class.class.cast(IdentityFunction.class));
|
|
||||||
|
|
||||||
// we aren't converting location from a provider-specific type
|
|
||||||
bind(new TypeLiteral<Function<Location, Location>>() {
|
|
||||||
}).to(Class.class.cast(IdentityFunction.class));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@VisibleForTesting
|
|
||||||
static final Map<RunningState, Status> runningStateToNodeStatus = ImmutableMap.<RunningState, Status> builder().put(
|
|
||||||
RunningState.RUNNING, Status.RUNNING)//
|
|
||||||
.put(RunningState.NOTRUNNING, Status.SUSPENDED)//
|
|
||||||
.put(RunningState.POWERCYCLING, Status.PENDING)//
|
|
||||||
.put(RunningState.RESTARTING, Status.PENDING)//
|
|
||||||
.put(RunningState.UNRECOGNIZED, Status.UNRECOGNIZED)//
|
|
||||||
.build();
|
|
||||||
|
|
||||||
@Singleton
|
|
||||||
@Provides
|
|
||||||
Map<RunningState, Status> provideServerToNodeStatus() {
|
|
||||||
return runningStateToNodeStatus;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Singleton
|
|
||||||
private static class ServerToPublicAddresses implements Function<Server, Iterable<String>> {
|
|
||||||
@Override
|
|
||||||
public Iterable<String> apply(Server server) {
|
|
||||||
return server.getIpAddresses() == null ? ImmutableSet.<String> of() : Iterables.concat(ImmutableList.of(server
|
|
||||||
.getIpAddresses().getPrimaryIp()), server.getIpAddresses().getSecondaryIps());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,79 +0,0 @@
|
||||||
/**
|
|
||||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
|
||||||
* contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. jclouds licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
package org.jclouds.rimuhosting.miro.compute.functions;
|
|
||||||
|
|
||||||
import java.util.regex.Matcher;
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
import javax.inject.Named;
|
|
||||||
import javax.inject.Singleton;
|
|
||||||
|
|
||||||
import org.jclouds.compute.domain.Image;
|
|
||||||
import org.jclouds.compute.domain.ImageBuilder;
|
|
||||||
import org.jclouds.compute.domain.OperatingSystem;
|
|
||||||
import org.jclouds.compute.domain.OsFamily;
|
|
||||||
import org.jclouds.compute.domain.Image.Status;
|
|
||||||
import org.jclouds.compute.reference.ComputeServiceConstants;
|
|
||||||
import org.jclouds.logging.Logger;
|
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Adrian Cole
|
|
||||||
*/
|
|
||||||
@Singleton
|
|
||||||
public class RimuHostingImageToImage implements Function<org.jclouds.rimuhosting.miro.domain.Image, Image> {
|
|
||||||
@Resource
|
|
||||||
@Named(ComputeServiceConstants.COMPUTE_LOGGER)
|
|
||||||
private Logger logger = Logger.NULL;
|
|
||||||
|
|
||||||
public Image apply(org.jclouds.rimuhosting.miro.domain.Image from) {
|
|
||||||
ImageBuilder builder = new ImageBuilder();
|
|
||||||
builder.ids(from.getId() + "");
|
|
||||||
builder.name(from.getDescription());
|
|
||||||
builder.description(from.getDescription());
|
|
||||||
builder.operatingSystem(parseOs(from));
|
|
||||||
builder.status(Status.AVAILABLE);
|
|
||||||
return builder.build();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final Pattern RIMU_PATTERN = Pattern.compile("([a-zA-Z]+) ?([0-9.]+) .*");
|
|
||||||
|
|
||||||
protected OperatingSystem parseOs(final org.jclouds.rimuhosting.miro.domain.Image from) {
|
|
||||||
OsFamily osFamily = null;
|
|
||||||
String osName = from.getId();
|
|
||||||
String osArch = null;
|
|
||||||
String osVersion = null;
|
|
||||||
String osDescription = from.getDescription();
|
|
||||||
boolean is64Bit = from.getId().indexOf("64") != -1;
|
|
||||||
|
|
||||||
Matcher matcher = RIMU_PATTERN.matcher(osDescription);
|
|
||||||
if (matcher.find()) {
|
|
||||||
try {
|
|
||||||
osFamily = OsFamily.fromValue(matcher.group(1).toLowerCase());
|
|
||||||
osVersion = matcher.group(2).toLowerCase();
|
|
||||||
} catch (IllegalArgumentException e) {
|
|
||||||
logger.debug("<< didn't match os(%s)", osDescription);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return new OperatingSystem(osFamily, osName, osVersion, osArch, osDescription, is64Bit);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,140 +0,0 @@
|
||||||
/**
|
|
||||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
|
||||||
* contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. jclouds licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
package org.jclouds.rimuhosting.miro.compute.functions;
|
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.NoSuchElementException;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
import javax.inject.Inject;
|
|
||||||
import javax.inject.Singleton;
|
|
||||||
|
|
||||||
import org.jclouds.collect.Memoized;
|
|
||||||
import org.jclouds.compute.domain.Image;
|
|
||||||
import org.jclouds.compute.domain.NodeMetadata;
|
|
||||||
import org.jclouds.compute.domain.NodeMetadataBuilder;
|
|
||||||
import org.jclouds.compute.domain.OperatingSystem;
|
|
||||||
import org.jclouds.compute.domain.NodeMetadata.Status;
|
|
||||||
import org.jclouds.compute.functions.GroupNamingConvention;
|
|
||||||
import org.jclouds.domain.Location;
|
|
||||||
import org.jclouds.logging.Logger;
|
|
||||||
import org.jclouds.rimuhosting.miro.domain.Server;
|
|
||||||
import org.jclouds.rimuhosting.miro.domain.internal.RunningState;
|
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
|
||||||
import com.google.common.base.Predicate;
|
|
||||||
import com.google.common.base.Supplier;
|
|
||||||
import com.google.common.collect.Iterables;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Adrian Cole
|
|
||||||
*/
|
|
||||||
@Singleton
|
|
||||||
public class ServerToNodeMetadata implements Function<Server, NodeMetadata> {
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
protected Logger logger = Logger.NULL;
|
|
||||||
|
|
||||||
protected final Supplier<Set<? extends Location>> locations;
|
|
||||||
protected final Function<Server, Iterable<String>> getPublicAddresses;
|
|
||||||
protected final Map<RunningState, Status> runningStateToNodeStatus;
|
|
||||||
protected final Supplier<Set<? extends Image>> images;
|
|
||||||
protected final GroupNamingConvention nodeNamingConvention;
|
|
||||||
|
|
||||||
private static class FindImageForServer implements Predicate<Image> {
|
|
||||||
private final Location location;
|
|
||||||
private final Server instance;
|
|
||||||
|
|
||||||
private FindImageForServer(Location location, Server instance) {
|
|
||||||
this.location = location;
|
|
||||||
this.instance = instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Image input) {
|
|
||||||
return input.getProviderId().equals(instance.getImageId())
|
|
||||||
&& (input.getLocation() == null || input.getLocation().equals(location) || input.getLocation().equals(
|
|
||||||
location.getParent()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
ServerToNodeMetadata(Function<Server, Iterable<String>> getPublicAddresses,
|
|
||||||
@Memoized Supplier<Set<? extends Location>> locations, Map<RunningState, Status> runningStateToNodeStatus,
|
|
||||||
@Memoized Supplier<Set<? extends Image>> images,
|
|
||||||
GroupNamingConvention.Factory namingConvention) {
|
|
||||||
this.nodeNamingConvention = checkNotNull(namingConvention, "namingConvention").createWithoutPrefix();
|
|
||||||
this.getPublicAddresses = checkNotNull(getPublicAddresses, "serverStateToNodeStatus");
|
|
||||||
this.locations = checkNotNull(locations, "locations");
|
|
||||||
this.runningStateToNodeStatus = checkNotNull(runningStateToNodeStatus, "serverStateToNodeStatus");
|
|
||||||
this.images = checkNotNull(images, "images");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public NodeMetadata apply(Server from) {
|
|
||||||
NodeMetadataBuilder builder = new NodeMetadataBuilder();
|
|
||||||
builder.ids(from.getId() + "");
|
|
||||||
builder.name(from.getName());
|
|
||||||
builder.hostname(from.getName());
|
|
||||||
Location location = findLocationWithId(from.getLocation().getId());
|
|
||||||
builder.location(location);
|
|
||||||
builder.group(nodeNamingConvention.groupInUniqueNameOrNull(from.getName()));
|
|
||||||
builder.imageId(from.getImageId() + "");
|
|
||||||
builder.operatingSystem(parseOperatingSystem(from, location));
|
|
||||||
builder.hardware(null);// TODO
|
|
||||||
if (from.getBillingData() != null && from.getBillingData().getDateCancelled() != null
|
|
||||||
&& RunningState.NOTRUNNING == from.getState())
|
|
||||||
builder.status(Status.TERMINATED);
|
|
||||||
else
|
|
||||||
builder.status(runningStateToNodeStatus.get(from.getState()));
|
|
||||||
builder.publicAddresses(getPublicAddresses.apply(from));
|
|
||||||
return builder.build();
|
|
||||||
}
|
|
||||||
|
|
||||||
private Location findLocationWithId(final String locationId) {
|
|
||||||
try {
|
|
||||||
Location location = Iterables.find(locations.get(), new Predicate<Location>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Location input) {
|
|
||||||
return input.getId().equals(locationId);
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
return location;
|
|
||||||
|
|
||||||
} catch (NoSuchElementException e) {
|
|
||||||
logger.debug("couldn't match instance location %s in: %s", locationId, locations.get());
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected OperatingSystem parseOperatingSystem(Server from, Location location) {
|
|
||||||
try {
|
|
||||||
return Iterables.find(images.get(), new FindImageForServer(location, from)).getOperatingSystem();
|
|
||||||
} catch (NoSuchElementException e) {
|
|
||||||
logger.debug("could not find a matching image for server %s in location %s", from, location);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,171 +0,0 @@
|
||||||
/**
|
|
||||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
|
||||||
* contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. jclouds licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
package org.jclouds.rimuhosting.miro.compute.strategy;
|
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
|
||||||
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
import javax.inject.Inject;
|
|
||||||
import javax.inject.Named;
|
|
||||||
import javax.inject.Singleton;
|
|
||||||
|
|
||||||
import org.jclouds.collect.Memoized;
|
|
||||||
import org.jclouds.compute.ComputeServiceAdapter;
|
|
||||||
import org.jclouds.compute.domain.Hardware;
|
|
||||||
import org.jclouds.compute.domain.HardwareBuilder;
|
|
||||||
import org.jclouds.compute.domain.Processor;
|
|
||||||
import org.jclouds.compute.domain.Template;
|
|
||||||
import org.jclouds.compute.domain.Volume;
|
|
||||||
import org.jclouds.compute.domain.internal.VolumeImpl;
|
|
||||||
import org.jclouds.compute.reference.ComputeServiceConstants;
|
|
||||||
import org.jclouds.domain.Location;
|
|
||||||
import org.jclouds.domain.LoginCredentials;
|
|
||||||
import org.jclouds.logging.Logger;
|
|
||||||
import org.jclouds.rimuhosting.miro.RimuHostingClient;
|
|
||||||
import org.jclouds.rimuhosting.miro.domain.Image;
|
|
||||||
import org.jclouds.rimuhosting.miro.domain.NewServerResponse;
|
|
||||||
import org.jclouds.rimuhosting.miro.domain.PricingPlan;
|
|
||||||
import org.jclouds.rimuhosting.miro.domain.Server;
|
|
||||||
import org.jclouds.util.Iterables2;
|
|
||||||
|
|
||||||
import com.google.common.base.Predicate;
|
|
||||||
import com.google.common.base.Supplier;
|
|
||||||
import com.google.common.collect.ImmutableList;
|
|
||||||
import com.google.common.collect.ImmutableSet;
|
|
||||||
import com.google.common.collect.Iterables;
|
|
||||||
import com.google.common.collect.Sets;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* defines the connection between the {@link RimuHostingClient} implementation and the jclouds
|
|
||||||
* {@link ComputeService}
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@Singleton
|
|
||||||
public class RimuHostingComputeServiceAdapter implements ComputeServiceAdapter<Server, Hardware, Image, Location> {
|
|
||||||
@Resource
|
|
||||||
@Named(ComputeServiceConstants.COMPUTE_LOGGER)
|
|
||||||
private Logger logger = Logger.NULL;
|
|
||||||
|
|
||||||
private final RimuHostingClient client;
|
|
||||||
private final Supplier<Set<? extends Location>> locations;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
protected RimuHostingComputeServiceAdapter(RimuHostingClient client,
|
|
||||||
@Memoized Supplier<Set<? extends Location>> locations) {
|
|
||||||
this.client = checkNotNull(client, "client");
|
|
||||||
this.locations = checkNotNull(locations, "locations");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public NodeAndInitialCredentials<Server> createNodeWithGroupEncodedIntoName(String group, String name,
|
|
||||||
Template template) {
|
|
||||||
NewServerResponse server = client.createServer(name,
|
|
||||||
checkNotNull(template.getImage().getProviderId(), "imageId"), checkNotNull(template.getHardware()
|
|
||||||
.getProviderId(), "hardwareId"));
|
|
||||||
|
|
||||||
return new NodeAndInitialCredentials<Server>(server.getServer(), server.getServer().getId() + "",
|
|
||||||
LoginCredentials.builder().password(server.getNewInstanceRequest().getCreateOptions().getPassword())
|
|
||||||
.build());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Iterable<Hardware> listHardwareProfiles() {
|
|
||||||
final Set<Hardware> sizes = Sets.newHashSet();
|
|
||||||
for (final PricingPlan from : client.getPricingPlanList()) {
|
|
||||||
try {
|
|
||||||
|
|
||||||
final Location location = Iterables.find(locations.get(), new Predicate<Location>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Location input) {
|
|
||||||
return input.getId().equals(from.getDataCenter().getId());
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
sizes.add(new HardwareBuilder().ids(from.getId()).location(location).processors(
|
|
||||||
ImmutableList.of(new Processor(1, 1.0))).ram(from.getRam()).volumes(
|
|
||||||
ImmutableList.<Volume> of(new VolumeImpl((float) from.getDiskSize(), true, true))).build());
|
|
||||||
} catch (NullPointerException e) {
|
|
||||||
logger.warn("datacenter not present in " + from.getId());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return sizes;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Iterable<Image> listImages() {
|
|
||||||
return Iterables2.concreteCopy(client.getImageList());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Iterable<Server> listNodes() {
|
|
||||||
return Iterables2.concreteCopy(client.getServerList());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Iterable<Location> listLocations() {
|
|
||||||
// Not using the adapter to determine locations
|
|
||||||
return ImmutableSet.<Location> of();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Server getNode(String id) {
|
|
||||||
long serverId = Long.parseLong(id);
|
|
||||||
return client.getServer(serverId);
|
|
||||||
}
|
|
||||||
|
|
||||||
// cheat until we have a getImage command
|
|
||||||
@Override
|
|
||||||
public Image getImage(final String id) {
|
|
||||||
return Iterables.find(listImages(), new Predicate<Image>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Image input) {
|
|
||||||
return input.getId().equals(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
}, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void destroyNode(String id) {
|
|
||||||
Long serverId = Long.parseLong(id);
|
|
||||||
client.destroyServer(serverId);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void rebootNode(String id) {
|
|
||||||
Long serverId = Long.parseLong(id);
|
|
||||||
// if false server wasn't around in the first place
|
|
||||||
client.restartServer(serverId).getState();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void resumeNode(String id) {
|
|
||||||
throw new UnsupportedOperationException("suspend not supported");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void suspendNode(String id) {
|
|
||||||
throw new UnsupportedOperationException("suspend not supported");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,87 +0,0 @@
|
||||||
/**
|
|
||||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
|
||||||
* contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. jclouds licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
package org.jclouds.rimuhosting.miro.config;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
import javax.inject.Inject;
|
|
||||||
import javax.inject.Singleton;
|
|
||||||
|
|
||||||
import org.jclouds.date.DateService;
|
|
||||||
import org.jclouds.json.config.GsonModule;
|
|
||||||
import org.jclouds.json.config.GsonModule.DateAdapter;
|
|
||||||
import org.jclouds.json.config.GsonModule.PropertiesAdapter;
|
|
||||||
import org.jclouds.location.suppliers.ImplicitLocationSupplier;
|
|
||||||
import org.jclouds.location.suppliers.LocationsSupplier;
|
|
||||||
import org.jclouds.rest.ConfiguresRestClient;
|
|
||||||
import org.jclouds.rest.config.RestClientModule;
|
|
||||||
import org.jclouds.rimuhosting.miro.RimuHostingAsyncClient;
|
|
||||||
import org.jclouds.rimuhosting.miro.RimuHostingClient;
|
|
||||||
import org.jclouds.rimuhosting.miro.location.RimuHostingDefaultLocationSupplier;
|
|
||||||
import org.jclouds.rimuhosting.miro.location.RimuHostingLocationSupplier;
|
|
||||||
|
|
||||||
import com.google.gson.stream.JsonReader;
|
|
||||||
import com.google.gson.stream.JsonWriter;
|
|
||||||
import com.google.inject.Scopes;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Adrian Cole
|
|
||||||
*/
|
|
||||||
@ConfiguresRestClient
|
|
||||||
public class RimuHostingRestClientModule extends RestClientModule<RimuHostingClient, RimuHostingAsyncClient> {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void configure() {
|
|
||||||
bind(DateAdapter.class).to(RimuIso8601DateAdapter.class);
|
|
||||||
super.configure();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Singleton
|
|
||||||
public static class RimuIso8601DateAdapter extends GsonModule.DateAdapter {
|
|
||||||
private final DateService dateService;
|
|
||||||
private final PropertiesAdapter propertiesAdapter;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
private RimuIso8601DateAdapter(DateService dateService, PropertiesAdapter propertiesAdapter) {
|
|
||||||
this.dateService = dateService;
|
|
||||||
this.propertiesAdapter = propertiesAdapter;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void write(JsonWriter writer, Date value) throws IOException {
|
|
||||||
throw new UnsupportedOperationException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Date read(JsonReader in) throws IOException {
|
|
||||||
String isoFormat = propertiesAdapter.read(in).getProperty("iso_format");
|
|
||||||
if (isoFormat != null)
|
|
||||||
return dateService.iso8601SecondsDateParse(isoFormat);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void installLocations() {
|
|
||||||
super.installLocations();
|
|
||||||
bind(ImplicitLocationSupplier.class).to(RimuHostingDefaultLocationSupplier.class).in(Scopes.SINGLETON);
|
|
||||||
bind(LocationsSupplier.class).to(RimuHostingLocationSupplier.class).in(Scopes.SINGLETON);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,64 +0,0 @@
|
||||||
/**
|
|
||||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
|
||||||
* contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. jclouds licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
package org.jclouds.rimuhosting.miro.data;
|
|
||||||
|
|
||||||
import com.google.gson.annotations.SerializedName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Options for a clone.
|
|
||||||
* TODO: test and add constructors.
|
|
||||||
* @author Ivan Meredith
|
|
||||||
*/
|
|
||||||
public class CloneOptions implements PostData {
|
|
||||||
/**
|
|
||||||
* Select this if you want the newly setup VPS to be a clone of
|
|
||||||
* another VPS you have with us. We will need to pause (but
|
|
||||||
* not restart) the clone source VPS for a few seconds to a few
|
|
||||||
* minutes to take the snapshot.
|
|
||||||
*/
|
|
||||||
@SerializedName("vps_order_oid_to_clone")
|
|
||||||
private Long instanceId;
|
|
||||||
/**
|
|
||||||
* The label you want to give the server. It will need to be a
|
|
||||||
* fully qualified domain name (FQDN). e.g. example.com. Will
|
|
||||||
* default to the domain name used on the order id provided.
|
|
||||||
*/
|
|
||||||
@SerializedName("domain_name")
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
public long getInstanceId() {
|
|
||||||
return instanceId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setInstanceId(long instanceId) {
|
|
||||||
this.instanceId = instanceId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void validate(){
|
|
||||||
assert instanceId == null || instanceId < 0;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,104 +0,0 @@
|
||||||
/**
|
|
||||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
|
||||||
* contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. jclouds licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
package org.jclouds.rimuhosting.miro.data;
|
|
||||||
|
|
||||||
import org.jclouds.rimuhosting.miro.domain.Image;
|
|
||||||
|
|
||||||
import com.google.gson.annotations.SerializedName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Some options we need to create a new server/VPS.
|
|
||||||
*
|
|
||||||
* @author Ivan Meredith
|
|
||||||
*/
|
|
||||||
public class CreateOptions implements PostData{
|
|
||||||
public CreateOptions(){}
|
|
||||||
|
|
||||||
public CreateOptions(String name, String password, Image image){
|
|
||||||
this.name = name;
|
|
||||||
this.password = password;
|
|
||||||
if(image != null){
|
|
||||||
this.imageId = image.getId();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public CreateOptions(String name, String password, String imageId){
|
|
||||||
this.name = name;
|
|
||||||
this.password = password;
|
|
||||||
this.imageId = imageId;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* The control panel to install on the VPS. Currently only webmin is installable manually.
|
|
||||||
* Currently null/empty string works. For none. Or webmin.
|
|
||||||
* TODO: Control panels need a rest @GET interface. Or enum
|
|
||||||
*/
|
|
||||||
@SerializedName("control_panel")
|
|
||||||
private String controlPanel;
|
|
||||||
/**
|
|
||||||
* Must be a valid Image id.
|
|
||||||
*/
|
|
||||||
@SerializedName("distro")
|
|
||||||
private String imageId;
|
|
||||||
/**
|
|
||||||
* Must be FQDN.
|
|
||||||
*/
|
|
||||||
@SerializedName("domain_name")
|
|
||||||
private String name;
|
|
||||||
/**
|
|
||||||
* The password to use when setting up the server. If not provided we will set a random one.
|
|
||||||
*/
|
|
||||||
private String password;
|
|
||||||
|
|
||||||
public String getControlPanel() {
|
|
||||||
return controlPanel;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setControlPanel(String controlPanel) {
|
|
||||||
this.controlPanel = controlPanel;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getImageId() {
|
|
||||||
return imageId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setImageId(String imageId) {
|
|
||||||
this.imageId = imageId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPassword() {
|
|
||||||
return password;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPassword(String password) {
|
|
||||||
this.password = password;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void validate() {
|
|
||||||
assert imageId != null && imageId.length() != 0;
|
|
||||||
//TODO validation of FQDN
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,67 +0,0 @@
|
||||||
/**
|
|
||||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
|
||||||
* contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. jclouds licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
package org.jclouds.rimuhosting.miro.data;
|
|
||||||
|
|
||||||
import com.google.gson.annotations.SerializedName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Number of IPs VPS needs. In a separate data structure so that
|
|
||||||
* at a later date we can add more IPs to a provisioned server.
|
|
||||||
*
|
|
||||||
* @author Ivan Meredith
|
|
||||||
*/
|
|
||||||
public class IpRequestData implements PostData {
|
|
||||||
/**
|
|
||||||
* How many IPs you need. Typically 1. Typically you
|
|
||||||
* only need more than one IP if your server has SSL certs for more
|
|
||||||
* than one domains.
|
|
||||||
*/
|
|
||||||
@SerializedName("num_ips")
|
|
||||||
private int numberOfIps = 1;
|
|
||||||
/**
|
|
||||||
* The reason for requiring more than one IP address. The
|
|
||||||
* number of IP addresses will be limited. If you hit that
|
|
||||||
* limit, then contact support to manually allocate the IPs (and in
|
|
||||||
* the mean time just use fewer IPs).
|
|
||||||
*/
|
|
||||||
@SerializedName("extra_ip_reason")
|
|
||||||
private String extraIpReason = "";
|
|
||||||
|
|
||||||
public int getNumberOfIps() {
|
|
||||||
return numberOfIps;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setNumberOfIps(int numberOfIps) {
|
|
||||||
this.numberOfIps = numberOfIps;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getExtraIpReason() {
|
|
||||||
return extraIpReason;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setExtraIpReason(String extraIpReason) {
|
|
||||||
this.extraIpReason = extraIpReason;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void validate() {
|
|
||||||
assert numberOfIps < 1 && numberOfIps > 5;
|
|
||||||
assert numberOfIps > 1 && extraIpReason == null || extraIpReason.length() == 0;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,207 +0,0 @@
|
||||||
/**
|
|
||||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
|
||||||
* contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. jclouds licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
package org.jclouds.rimuhosting.miro.data;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.jclouds.rimuhosting.miro.domain.MetaData;
|
|
||||||
import org.jclouds.rimuhosting.miro.domain.PricingPlan;
|
|
||||||
import org.jclouds.rimuhosting.miro.domain.ServerParameters;
|
|
||||||
|
|
||||||
import com.google.gson.annotations.SerializedName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This structure defines the VPS to be setup.
|
|
||||||
*
|
|
||||||
* @author Ivan Meredith
|
|
||||||
*/
|
|
||||||
public class NewServerData implements PostData {
|
|
||||||
public NewServerData() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public NewServerData(CreateOptions createOptions, PricingPlan pricingPlan) {
|
|
||||||
this.createOptions = createOptions;
|
|
||||||
if (pricingPlan != null) {
|
|
||||||
this.planId = pricingPlan.getId();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public NewServerData(CreateOptions createOptions, String pricingPlanId) {
|
|
||||||
this.createOptions = createOptions;
|
|
||||||
this.planId = pricingPlanId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public NewServerData(CloneOptions cloneOptions) {
|
|
||||||
this.cloneOptions = cloneOptions;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the billing id if you want to control how it is billed. Else we will, for example,
|
|
||||||
* try to use, say, the credit card you used on your last order that had a credit card. Or
|
|
||||||
* use a wire transfer method if you are using that on other orders. See the billing
|
|
||||||
* methods resource for how to find what billing methods/ids you have setup on your identity.
|
|
||||||
*/
|
|
||||||
@SerializedName("billing_oid")
|
|
||||||
private Long billingId;
|
|
||||||
/**
|
|
||||||
* The host server on which to setup the server. Typically you will want to leave this
|
|
||||||
* blank and let the API decide what is best/available. And exception may be if you are a
|
|
||||||
* customer with a dedicated server that is a VPS host with us. And in that case you may
|
|
||||||
* want to force a VPS to be setup on a particular server of yours.
|
|
||||||
*/
|
|
||||||
@SerializedName("host_server_oid")
|
|
||||||
private String hostServerId;
|
|
||||||
/**
|
|
||||||
* These are the instantiation options. e.g. domain name, password, etc. Only provide
|
|
||||||
* these if you are not cloning a VPS (the vps_order_oid_to_clone setting). i.e. mutually
|
|
||||||
* exclusive to instantiation_via_clone_options
|
|
||||||
*/
|
|
||||||
@SerializedName("instantiation_options")
|
|
||||||
private CreateOptions createOptions;
|
|
||||||
/**
|
|
||||||
* These are the instantiation options if you are creating a new VPS as a clone of an existing
|
|
||||||
* VPS. Mutually exclusive to instantiation_options.
|
|
||||||
*/
|
|
||||||
@SerializedName("instantiation_via_clone_options")
|
|
||||||
private CloneOptions cloneOptions;
|
|
||||||
/**
|
|
||||||
* The number of IPs you need on the VPS and a justification for having more than one. Just
|
|
||||||
* leave blank for a single IP (which is all most servers need).
|
|
||||||
*/
|
|
||||||
@SerializedName("ip_request")
|
|
||||||
private IpRequestData ipRequest;
|
|
||||||
/**
|
|
||||||
* The pricing plan code you want to use. Per the pricing plans resource.
|
|
||||||
*/
|
|
||||||
@SerializedName("pricing_plan_code")
|
|
||||||
private String planId;
|
|
||||||
/**
|
|
||||||
* To whom will the order belong? Leave this blank and we will assign it to you. If you set
|
|
||||||
* it and you do not have permissions on that user's identity you will get an error.
|
|
||||||
*/
|
|
||||||
@SerializedName("user_oid")
|
|
||||||
private Long userId;
|
|
||||||
/**
|
|
||||||
* Any particular memory/disk size overrides you want to make. If they are compatible with
|
|
||||||
* the pricing plan you selected we will use them. We will calculate the cost based on the
|
|
||||||
* resources we setup you up with. We can provision VPSs in most sizes, provided that the
|
|
||||||
* host has space for them. The low contention plans are an exception. You will
|
|
||||||
* likely need to use the provided memory and disk sizes. Since those plans are designed so
|
|
||||||
* there is a specific (small) number of VPSs per host. And having VPSs with 'odd' sizes
|
|
||||||
* stops them all fitting in 'neatly' (that's not a problem on the bigger-, non-low
|
|
||||||
* contention-plans.
|
|
||||||
*/
|
|
||||||
@SerializedName("vps_parameters")
|
|
||||||
private ServerParameters serverParameters;
|
|
||||||
|
|
||||||
@SerializedName("meta_data")
|
|
||||||
private List<MetaData> metaData;
|
|
||||||
|
|
||||||
public Long getBillingId() {
|
|
||||||
return billingId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBillingId(Long billingId) {
|
|
||||||
this.billingId = billingId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getHostServerId() {
|
|
||||||
return hostServerId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setHostServerId(String hostServerId) {
|
|
||||||
this.hostServerId = hostServerId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public CreateOptions getCreateOptions() {
|
|
||||||
return createOptions;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCreateOptions(CreateOptions createOptions) {
|
|
||||||
this.createOptions = createOptions;
|
|
||||||
}
|
|
||||||
|
|
||||||
public CloneOptions getCloneOptions() {
|
|
||||||
return cloneOptions;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCloneOptions(CloneOptions cloneOptions) {
|
|
||||||
this.cloneOptions = cloneOptions;
|
|
||||||
}
|
|
||||||
|
|
||||||
public IpRequestData getIpRequest() {
|
|
||||||
return ipRequest;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setIpRequest(IpRequestData ipRequest) {
|
|
||||||
this.ipRequest = ipRequest;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPlanId() {
|
|
||||||
return planId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPlanId(String planId) {
|
|
||||||
this.planId = planId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getUserId() {
|
|
||||||
return userId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUserId(Long userId) {
|
|
||||||
this.userId = userId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ServerParameters getInstanceParameters() {
|
|
||||||
return serverParameters;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setInstanceParameters(ServerParameters serverParameters) {
|
|
||||||
this.serverParameters = serverParameters;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void validate() {
|
|
||||||
// bitwise XOR, works with boolean :)
|
|
||||||
assert this.cloneOptions == null ^ this.createOptions == null;
|
|
||||||
if (this.cloneOptions != null) {
|
|
||||||
this.cloneOptions.validate();
|
|
||||||
}
|
|
||||||
if (this.createOptions != null) {
|
|
||||||
this.createOptions.validate();
|
|
||||||
assert this.planId != null && this.planId.length() == 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.ipRequest != null) {
|
|
||||||
this.ipRequest.validate();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.serverParameters != null) {
|
|
||||||
this.serverParameters.validate();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMetaData(List<MetaData> metaData) {
|
|
||||||
this.metaData = metaData;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<MetaData> getMetaData() {
|
|
||||||
return metaData;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,28 +0,0 @@
|
||||||
/**
|
|
||||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
|
||||||
* contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. jclouds licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
package org.jclouds.rimuhosting.miro.data;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Do as much validation as possible to save http requests. No need to go overboard though.
|
|
||||||
*
|
|
||||||
* @author Ivan Meredith
|
|
||||||
*/
|
|
||||||
public interface PostData {
|
|
||||||
public void validate();
|
|
||||||
}
|
|
|
@ -1,82 +0,0 @@
|
||||||
/**
|
|
||||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
|
||||||
* contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. jclouds licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
package org.jclouds.rimuhosting.miro.domain;
|
|
||||||
|
|
||||||
import java.sql.Timestamp;
|
|
||||||
|
|
||||||
import com.google.gson.annotations.SerializedName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Billing data. Need to make it interface with jclouds.
|
|
||||||
* TODO: test
|
|
||||||
*
|
|
||||||
* @author Ivan Meredith
|
|
||||||
*/
|
|
||||||
public class BillingData {
|
|
||||||
@SerializedName("cancellation_date")
|
|
||||||
private Timestamp dateCancelled;
|
|
||||||
@SerializedName("monthly_recurring_fee")
|
|
||||||
private Double monthlyCharge;
|
|
||||||
@SerializedName("order_date")
|
|
||||||
private Timestamp dateOrdered;
|
|
||||||
@SerializedName("prepaid_until")
|
|
||||||
private Timestamp dataPrepaidUntil;
|
|
||||||
@SerializedName("suspended_date")
|
|
||||||
private Timestamp dateSuspended;
|
|
||||||
|
|
||||||
public Timestamp getDateCancelled() {
|
|
||||||
return dateCancelled;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDateCancelled(Timestamp dateCancelled) {
|
|
||||||
this.dateCancelled = dateCancelled;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Double getMonthlyCharge() {
|
|
||||||
return monthlyCharge;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMonthlyCharge(Double monthlyCharge) {
|
|
||||||
this.monthlyCharge = monthlyCharge;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Timestamp getDateOrdered() {
|
|
||||||
return dateOrdered;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDateOrdered(Timestamp dateOrdered) {
|
|
||||||
this.dateOrdered = dateOrdered;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Timestamp getDataPrepaidUntil() {
|
|
||||||
return dataPrepaidUntil;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDataPrepaidUntil(Timestamp dataPrepaidUntil) {
|
|
||||||
this.dataPrepaidUntil = dataPrepaidUntil;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Timestamp getDateSuspended() {
|
|
||||||
return dateSuspended;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDateSuspended(Timestamp dateSuspended) {
|
|
||||||
this.dateSuspended = dateSuspended;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,64 +0,0 @@
|
||||||
/**
|
|
||||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
|
||||||
* contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. jclouds licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
package org.jclouds.rimuhosting.miro.domain;
|
|
||||||
|
|
||||||
import com.google.gson.annotations.SerializedName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* TODO: test
|
|
||||||
*
|
|
||||||
* @author Ivan Meredith
|
|
||||||
*/
|
|
||||||
public class DataCenter implements Comparable<DataCenter> {
|
|
||||||
@SerializedName("data_center_location_code")
|
|
||||||
private String id;
|
|
||||||
@SerializedName("data_center_location_name")
|
|
||||||
private String name;
|
|
||||||
@SerializedName("data_center_location_country_2ltr")
|
|
||||||
private String code;
|
|
||||||
|
|
||||||
public String getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(String id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int compareTo(DataCenter dataCenter) {
|
|
||||||
return id.compareTo(dataCenter.getId());
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCode(String code) {
|
|
||||||
this.code = code;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCode() {
|
|
||||||
return code;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,44 +0,0 @@
|
||||||
/**
|
|
||||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
|
||||||
* contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. jclouds licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
package org.jclouds.rimuhosting.miro.domain;
|
|
||||||
|
|
||||||
import com.google.gson.annotations.SerializedName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* TODO: test
|
|
||||||
*
|
|
||||||
* @author Ivan Meredith
|
|
||||||
*/
|
|
||||||
public class DataTransferAllowance implements Comparable<DataTransferAllowance>{
|
|
||||||
@SerializedName("data_transfer_gb")
|
|
||||||
private Integer dataTransferGb;
|
|
||||||
|
|
||||||
public Integer getDataTransferGb() {
|
|
||||||
return dataTransferGb;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDataTransferGb(Integer dataTransferGb) {
|
|
||||||
this.dataTransferGb = dataTransferGb;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int compareTo(DataTransferAllowance dataTransferAllowance) {
|
|
||||||
return dataTransferGb - dataTransferAllowance.getDataTransferGb();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,54 +0,0 @@
|
||||||
/**
|
|
||||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
|
||||||
* contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. jclouds licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
package org.jclouds.rimuhosting.miro.domain;
|
|
||||||
|
|
||||||
import com.google.gson.annotations.SerializedName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Image object.
|
|
||||||
*
|
|
||||||
* @author Ivan Meredith
|
|
||||||
*/
|
|
||||||
public class Image implements Comparable<Image> {
|
|
||||||
@SerializedName("distro_code")
|
|
||||||
private String id;
|
|
||||||
@SerializedName("distro_description")
|
|
||||||
private String description;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int compareTo(Image image) {
|
|
||||||
return id.compareTo(image.getId());
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(String id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDescription() {
|
|
||||||
return description;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDescription(String description) {
|
|
||||||
this.description = description;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,51 +0,0 @@
|
||||||
/**
|
|
||||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
|
||||||
* contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. jclouds licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
package org.jclouds.rimuhosting.miro.domain;
|
|
||||||
|
|
||||||
import java.util.SortedSet;
|
|
||||||
|
|
||||||
import com.google.gson.annotations.SerializedName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* IpAddresses assigned to an Interface. Not rimuhosting doesnt have private IPs.
|
|
||||||
*
|
|
||||||
* @author Ivan Meredith
|
|
||||||
*/
|
|
||||||
public class IpAddresses {
|
|
||||||
@SerializedName("primary_ip")
|
|
||||||
private String primaryIp;
|
|
||||||
@SerializedName("secondary_ips")
|
|
||||||
private SortedSet<String> secondaryIps;
|
|
||||||
|
|
||||||
public String getPrimaryIp() {
|
|
||||||
return primaryIp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPrimaryIp(String primaryIp) {
|
|
||||||
this.primaryIp = primaryIp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public SortedSet<String> getSecondaryIps() {
|
|
||||||
return secondaryIps;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSecondaryIps(SortedSet<String> secondaryIps) {
|
|
||||||
this.secondaryIps = secondaryIps;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,44 +0,0 @@
|
||||||
/**
|
|
||||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
|
||||||
* contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. jclouds licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
package org.jclouds.rimuhosting.miro.domain;
|
|
||||||
|
|
||||||
import com.google.gson.annotations.SerializedName;
|
|
||||||
|
|
||||||
public class MetaData {
|
|
||||||
@SerializedName("key_name")
|
|
||||||
private String key;
|
|
||||||
|
|
||||||
private String value;
|
|
||||||
|
|
||||||
public void setKey(String key) {
|
|
||||||
this.key = key;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getKey() {
|
|
||||||
return key;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setValue(String value) {
|
|
||||||
this.value = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getValue() {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,69 +0,0 @@
|
||||||
/**
|
|
||||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
|
||||||
* contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. jclouds licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
package org.jclouds.rimuhosting.miro.domain;
|
|
||||||
|
|
||||||
import org.jclouds.rimuhosting.miro.data.NewServerData;
|
|
||||||
|
|
||||||
import com.google.gson.annotations.SerializedName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* View object to get back all data from a Instance create. The Password has been populated the NewInstance
|
|
||||||
* object.
|
|
||||||
*
|
|
||||||
* @author Ivan Meredith
|
|
||||||
*/
|
|
||||||
public class NewServerResponse implements Comparable<NewServerResponse> {
|
|
||||||
@SerializedName("about_order")
|
|
||||||
private Server server;
|
|
||||||
|
|
||||||
@SerializedName("new_order_request")
|
|
||||||
private NewServerData newServerDataRequest;
|
|
||||||
|
|
||||||
@SerializedName("running_vps_info")
|
|
||||||
private ServerInfo serverInfo;
|
|
||||||
|
|
||||||
public Server getServer() {
|
|
||||||
return server;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setServer(Server server) {
|
|
||||||
this.server = server;
|
|
||||||
}
|
|
||||||
|
|
||||||
public NewServerData getNewInstanceRequest() {
|
|
||||||
return newServerDataRequest;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setNewInstanceRequest(NewServerData newServerDataRequest) {
|
|
||||||
this.newServerDataRequest = newServerDataRequest;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ServerInfo getServerInfo() {
|
|
||||||
return serverInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setServerInfo(ServerInfo serverInfo) {
|
|
||||||
this.serverInfo = serverInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int compareTo(NewServerResponse server) {
|
|
||||||
return this.server.getId().compareTo(server.getServer().getId());
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,124 +0,0 @@
|
||||||
/**
|
|
||||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
|
||||||
* contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. jclouds licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
package org.jclouds.rimuhosting.miro.domain;
|
|
||||||
|
|
||||||
import org.jclouds.rimuhosting.miro.domain.internal.ServerType;
|
|
||||||
|
|
||||||
import com.google.gson.annotations.SerializedName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Ivan Meredith
|
|
||||||
*/
|
|
||||||
public class PricingPlan implements Comparable<PricingPlan>{
|
|
||||||
@SerializedName("minimum_data_transfer_allowance_gb")
|
|
||||||
private Long dataTransfer;
|
|
||||||
@SerializedName("minimum_disk_gb")
|
|
||||||
private Integer diskSize;
|
|
||||||
@SerializedName("minimum_memory_mb")
|
|
||||||
private Integer ram;
|
|
||||||
@SerializedName("monthly_recurring_fee_usd")
|
|
||||||
private Double monthlyCharge;
|
|
||||||
@SerializedName("offered_at_data_center")
|
|
||||||
private DataCenter dataCenter;
|
|
||||||
@SerializedName("pricing_plan_code")
|
|
||||||
private String id;
|
|
||||||
@SerializedName("pricing_plan_description")
|
|
||||||
private String description;
|
|
||||||
@SerializedName("see_also_url")
|
|
||||||
private String see_also_url;
|
|
||||||
@SerializedName("server_type")
|
|
||||||
private ServerType serverType;
|
|
||||||
|
|
||||||
public Long getDataTransfer() {
|
|
||||||
return dataTransfer;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDataTransfer(Long dataTransfer) {
|
|
||||||
this.dataTransfer = dataTransfer;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getDiskSize() {
|
|
||||||
return diskSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDiskSize(Integer diskSize) {
|
|
||||||
this.diskSize = diskSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getRam() {
|
|
||||||
return ram;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRam(Integer ram) {
|
|
||||||
this.ram = ram;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Double getMonthlyCharge() {
|
|
||||||
return monthlyCharge;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMonthlyCharge(Double monthlyCharge) {
|
|
||||||
this.monthlyCharge = monthlyCharge;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DataCenter getDataCenter() {
|
|
||||||
return dataCenter;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDataCenter(DataCenter dataCenter) {
|
|
||||||
this.dataCenter = dataCenter;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(String id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDescription() {
|
|
||||||
return description;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDescription(String description) {
|
|
||||||
this.description = description;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSee_also_url() {
|
|
||||||
return see_also_url;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSee_also_url(String see_also_url) {
|
|
||||||
this.see_also_url = see_also_url;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ServerType getServerType() {
|
|
||||||
return serverType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setServerType(ServerType serverType) {
|
|
||||||
this.serverType = serverType;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int compareTo(PricingPlan pricingPlan) {
|
|
||||||
return id.compareTo(pricingPlan.getId());
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,45 +0,0 @@
|
||||||
/**
|
|
||||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
|
||||||
* contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. jclouds licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
package org.jclouds.rimuhosting.miro.domain;
|
|
||||||
|
|
||||||
import org.jclouds.rimuhosting.miro.domain.internal.RimuHostingResponse;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Ivan Meredith
|
|
||||||
*/
|
|
||||||
public class ResizeResponse extends RimuHostingResponse {
|
|
||||||
private Server about_order;
|
|
||||||
private ResizeResponse resource_change_result;
|
|
||||||
|
|
||||||
public ResizeResponse getResourceChangeResult() {
|
|
||||||
return resource_change_result;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setResourceChangeResult(ResizeResponse resource_change_result) {
|
|
||||||
this.resource_change_result = resource_change_result;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Server getAboutOrder() {
|
|
||||||
return about_order;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAboutOrder(Server about_orders) {
|
|
||||||
this.about_order = about_orders;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,93 +0,0 @@
|
||||||
/**
|
|
||||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
|
||||||
* contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. jclouds licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
package org.jclouds.rimuhosting.miro.domain;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.google.gson.annotations.SerializedName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Information about a resource change.
|
|
||||||
*/
|
|
||||||
public class ResizeResult {
|
|
||||||
/**
|
|
||||||
* Original monthly pricing, in USD.
|
|
||||||
*/
|
|
||||||
@SerializedName("original_pricing")
|
|
||||||
private Double originalPricing;
|
|
||||||
/**
|
|
||||||
* New monthly pricing, in USD, after the resource changes.
|
|
||||||
*/
|
|
||||||
@SerializedName("new_pricing")
|
|
||||||
private Double newPricing;
|
|
||||||
/**
|
|
||||||
* Information about the change. e.g. may include information
|
|
||||||
* about how we calculate pro-rated credits or fees. Or what
|
|
||||||
* paypal subscriptions need to get changed to. Or what
|
|
||||||
* prepayment date changes were made.
|
|
||||||
* <p/>
|
|
||||||
* You will need to check these messages in some cases. e.g.
|
|
||||||
* if you are decreasing pricing and you are paying via a paypal
|
|
||||||
* subscription. Since you would be overpaying your identity,
|
|
||||||
* unless you followed the directions to modify your paypal
|
|
||||||
* subscription.
|
|
||||||
*/
|
|
||||||
@SerializedName("resource_change_messages")
|
|
||||||
private List<String> messages;
|
|
||||||
/**
|
|
||||||
* true if we made the resource changes. False if we did not
|
|
||||||
* make them, e.g. if we hit a billing issue, or if the host server
|
|
||||||
* did not have the resources to accommodate the change.
|
|
||||||
*/
|
|
||||||
@SerializedName("were_resources_changed")
|
|
||||||
private Boolean success;
|
|
||||||
|
|
||||||
public double getNewPricing() {
|
|
||||||
return newPricing;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setNewPricing(double newPricing) {
|
|
||||||
this.newPricing = newPricing;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> getMessages() {
|
|
||||||
return messages;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMessages(List<String> messages) {
|
|
||||||
this.messages = messages;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isSuccess() {
|
|
||||||
return success;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSuccess(boolean success) {
|
|
||||||
this.success = success;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getOriginalPricing() {
|
|
||||||
|
|
||||||
return originalPricing;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOriginalPricing(double originalPricing) {
|
|
||||||
this.originalPricing = originalPricing;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,228 +0,0 @@
|
||||||
/**
|
|
||||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
|
||||||
* contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. jclouds licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
package org.jclouds.rimuhosting.miro.domain;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.jclouds.rimuhosting.miro.data.NewServerData;
|
|
||||||
import org.jclouds.rimuhosting.miro.domain.internal.RunningState;
|
|
||||||
|
|
||||||
import com.google.gson.annotations.SerializedName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Instance Object.
|
|
||||||
* TODO: javadoc
|
|
||||||
*
|
|
||||||
* @author Ivan Meredith
|
|
||||||
*/
|
|
||||||
public class Server implements Comparable<Server> {
|
|
||||||
|
|
||||||
@SerializedName("allocated_ips")
|
|
||||||
private IpAddresses ipAddresses;
|
|
||||||
@SerializedName("billing_oid")
|
|
||||||
private Long billingId;
|
|
||||||
@SerializedName("data_transfer_allowance")
|
|
||||||
private DataTransferAllowance allowance;
|
|
||||||
@SerializedName("distro")
|
|
||||||
private String imageId;
|
|
||||||
@SerializedName("domain_name")
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
@SerializedName("host_server_oid")
|
|
||||||
private String hostServerId;
|
|
||||||
@SerializedName("is_on_customers_own_physical_server")
|
|
||||||
private Boolean onDedicatedHardware;
|
|
||||||
@SerializedName("order_oid")
|
|
||||||
private Long id;
|
|
||||||
@SerializedName("running_state")
|
|
||||||
private RunningState state;
|
|
||||||
@SerializedName("server_type")
|
|
||||||
private String type;
|
|
||||||
private String slug;
|
|
||||||
@SerializedName("vps_parameters")
|
|
||||||
private ServerParameters serverParameters;
|
|
||||||
@SerializedName("billing_info")
|
|
||||||
private BillingData billingData;
|
|
||||||
|
|
||||||
private DataCenter location;
|
|
||||||
|
|
||||||
@SerializedName("meta_data")
|
|
||||||
private List<MetaData> metaData;
|
|
||||||
//Object returned back with
|
|
||||||
private transient NewServerData serverDataRequest;
|
|
||||||
|
|
||||||
|
|
||||||
public IpAddresses getIpAddresses() {
|
|
||||||
return ipAddresses;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setIpAddresses(IpAddresses ipAddresses) {
|
|
||||||
this.ipAddresses = ipAddresses;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getBillingId() {
|
|
||||||
return billingId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBillingId(Long billingId) {
|
|
||||||
this.billingId = billingId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DataTransferAllowance getAllowance() {
|
|
||||||
return allowance;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAllowance(DataTransferAllowance allowance) {
|
|
||||||
this.allowance = allowance;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getImageId() {
|
|
||||||
return imageId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setImageId(String imageId) {
|
|
||||||
this.imageId = imageId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getHostServerId() {
|
|
||||||
return hostServerId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setHostServerId(String hostServerId) {
|
|
||||||
this.hostServerId = hostServerId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Boolean isOnDedicatedHardware() {
|
|
||||||
return onDedicatedHardware;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOnDedicatedHardware(Boolean onDedicatedHardware) {
|
|
||||||
this.onDedicatedHardware = onDedicatedHardware;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(Long id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public RunningState getState() {
|
|
||||||
return state;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setState(RunningState state) {
|
|
||||||
this.state = state;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getType() {
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setType(String type) {
|
|
||||||
this.type = type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSlug() {
|
|
||||||
return slug;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSlug(String slug) {
|
|
||||||
this.slug = slug;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ServerParameters getInstanceParameters() {
|
|
||||||
return serverParameters;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setInstanceParameters(ServerParameters serverParameters) {
|
|
||||||
this.serverParameters = serverParameters;
|
|
||||||
}
|
|
||||||
|
|
||||||
public NewServerData getInstanceRequest() {
|
|
||||||
return serverDataRequest;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setInstanceRequest(NewServerData serverDataRequest) {
|
|
||||||
this.serverDataRequest = serverDataRequest;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int compareTo(Server server) {
|
|
||||||
return name.compareTo(server.getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLocation(DataCenter location) {
|
|
||||||
this.location = location;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DataCenter getLocation() {
|
|
||||||
return location;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMetaData(List<MetaData> metaData) {
|
|
||||||
this.metaData = metaData;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<MetaData> getMetaData() {
|
|
||||||
return metaData;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Boolean getOnDedicatedHardware() {
|
|
||||||
return onDedicatedHardware;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BillingData getBillingData() {
|
|
||||||
return billingData;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
final int prime = 31;
|
|
||||||
int result = 1;
|
|
||||||
result = prime * result + ((id == null) ? 0 : id.hashCode());
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object obj) {
|
|
||||||
if (this == obj)
|
|
||||||
return true;
|
|
||||||
if (obj == null)
|
|
||||||
return false;
|
|
||||||
if (getClass() != obj.getClass())
|
|
||||||
return false;
|
|
||||||
Server other = (Server) obj;
|
|
||||||
if (id == null) {
|
|
||||||
if (other.id != null)
|
|
||||||
return false;
|
|
||||||
} else if (!id.equals(other.id))
|
|
||||||
return false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,228 +0,0 @@
|
||||||
/**
|
|
||||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
|
||||||
* contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. jclouds licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
package org.jclouds.rimuhosting.miro.domain;
|
|
||||||
|
|
||||||
import org.jclouds.rimuhosting.miro.domain.internal.RimuHostingTimestamp;
|
|
||||||
import org.jclouds.rimuhosting.miro.domain.internal.RunningState;
|
|
||||||
|
|
||||||
import com.google.gson.annotations.SerializedName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Ivan Meredith
|
|
||||||
*/
|
|
||||||
public class ServerInfo {
|
|
||||||
/**
|
|
||||||
* Whether the server pinged from the host server.
|
|
||||||
*/
|
|
||||||
@SerializedName("pings_ok")
|
|
||||||
private boolean instancePings;
|
|
||||||
/**
|
|
||||||
* The current kernel label. e.g. default is the recommended
|
|
||||||
* one.
|
|
||||||
*/
|
|
||||||
@SerializedName("current_kernel")
|
|
||||||
private String kernel;
|
|
||||||
/**
|
|
||||||
* Some current_kernel labels are symlinks to different
|
|
||||||
* kernel. e.g. 'default' is a symlink to kernel that we think
|
|
||||||
* will work best for the host server and its VPSs. Over time
|
|
||||||
* we may change it (e.g. so it points to a newer server). In
|
|
||||||
* which case your server would get that new kernel the next time it
|
|
||||||
* is restarted. Note that to get the new kernel you need to
|
|
||||||
* restart the server from _outside_ the VPS (i.e. not with a reboot
|
|
||||||
* command).
|
|
||||||
*/
|
|
||||||
@SerializedName("current_kernel_canonical")
|
|
||||||
private String kernelCanonical;
|
|
||||||
/**
|
|
||||||
* The last backup message stored for the VPS.
|
|
||||||
*/
|
|
||||||
@SerializedName("last_backup_message")
|
|
||||||
private String backupMessage;
|
|
||||||
/**
|
|
||||||
* Whether the console-over-ssh login feature is enabled.
|
|
||||||
*/
|
|
||||||
@SerializedName("is_console_login_enabled")
|
|
||||||
private boolean isConsoleLoginEnabled;
|
|
||||||
/**
|
|
||||||
* The console-over-sshes authorized keys (if they are set).
|
|
||||||
* Else the console access would be controlled by a password.
|
|
||||||
*/
|
|
||||||
@SerializedName("console_public_authorized_keys")
|
|
||||||
private String consolePublicKeys;
|
|
||||||
/**
|
|
||||||
* true when the host server is running a backup of the VPS.
|
|
||||||
* On new hosts we use LVM file systems so backups can be performed
|
|
||||||
* by only pausing VPSs for a fraction of a second.
|
|
||||||
*/
|
|
||||||
@SerializedName("is_backup_running")
|
|
||||||
private boolean isBackupRunning;
|
|
||||||
/**
|
|
||||||
* true on almost all servers. false when the backups are
|
|
||||||
* enabled. e.g. if a customer had requested we disable them.
|
|
||||||
*/
|
|
||||||
@SerializedName("is_backups_enabled")
|
|
||||||
private boolean backupsEnabled;
|
|
||||||
//public boolean is_one_week_backup;
|
|
||||||
/**
|
|
||||||
* The time we next expect a backup to run. The actual time
|
|
||||||
* may be a bit later (e.g. if other VPSs are due to run at this
|
|
||||||
* time slot). We run VPS backups sequentially (one after the
|
|
||||||
* other). So if two VPSs were scheduled for a backup at the
|
|
||||||
* same time one may run a few minutes after the other.
|
|
||||||
*/
|
|
||||||
@SerializedName("next_backup_time")
|
|
||||||
private RimuHostingTimestamp nextBackup;
|
|
||||||
/**
|
|
||||||
* How long Xen reports the VPS has been up and running for.
|
|
||||||
* In seconds. Divide by your time unit of choice :)
|
|
||||||
*/
|
|
||||||
@SerializedName("vps_uptime_s")
|
|
||||||
private long instanceUptime;
|
|
||||||
/**
|
|
||||||
* The number of CPU seconds consumed by a VPS. Note that if a
|
|
||||||
* VPS is using more than one core or CPU then this number can be
|
|
||||||
* higher than the uptime number.
|
|
||||||
*/
|
|
||||||
@SerializedName("vps_cpu_time_s")
|
|
||||||
private long instanceCpuTime;
|
|
||||||
/**
|
|
||||||
* Whether the VPS is, for example, running or not. Typically
|
|
||||||
* VPSs will all be running. A VPS may be in a non-running
|
|
||||||
* state, for example, for a short time after its host server is
|
|
||||||
* restarted. Since we start VPSs sequentially (one after the
|
|
||||||
* other) to keep server load to a manageable level.
|
|
||||||
*/
|
|
||||||
@SerializedName("running_state")
|
|
||||||
private RunningState state;
|
|
||||||
/**
|
|
||||||
* Whether the VPS is marked to not run. e.g. some host server
|
|
||||||
* operations (like a disk resize) set the suspended state to
|
|
||||||
* prevent the VPS running or other actions being performed while
|
|
||||||
* that operation is being performed. Sometimes we may set
|
|
||||||
* this if the server is 'administratively down', e.g. as a
|
|
||||||
* consequence of the server breaching our terms of service.
|
|
||||||
*/
|
|
||||||
@SerializedName("is_suspended")
|
|
||||||
private boolean isSuspended;
|
|
||||||
|
|
||||||
public boolean isInstancePings() {
|
|
||||||
return instancePings;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setInstancePings(boolean instancePings) {
|
|
||||||
this.instancePings = instancePings;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getKernel() {
|
|
||||||
return kernel;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setKernel(String kernel) {
|
|
||||||
this.kernel = kernel;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getKernelCanonical() {
|
|
||||||
return kernelCanonical;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setKernelCanonical(String kernelCanonical) {
|
|
||||||
this.kernelCanonical = kernelCanonical;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getBackupMessage() {
|
|
||||||
return backupMessage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBackupMessage(String backupMessage) {
|
|
||||||
this.backupMessage = backupMessage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isConsoleLoginEnabled() {
|
|
||||||
return isConsoleLoginEnabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setConsoleLoginEnabled(boolean consoleLoginEnabled) {
|
|
||||||
isConsoleLoginEnabled = consoleLoginEnabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getConsolePublicKeys() {
|
|
||||||
return consolePublicKeys;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setConsolePublicKeys(String consolePublicKeys) {
|
|
||||||
this.consolePublicKeys = consolePublicKeys;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isBackupRunning() {
|
|
||||||
return isBackupRunning;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBackupRunning(boolean backupRunning) {
|
|
||||||
isBackupRunning = backupRunning;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isBackupsEnabled() {
|
|
||||||
return backupsEnabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBackupsEnabled(boolean backupsEnabled) {
|
|
||||||
this.backupsEnabled = backupsEnabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
public RimuHostingTimestamp getNextBackup() {
|
|
||||||
return nextBackup;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setNextBackup(RimuHostingTimestamp nextBackup) {
|
|
||||||
this.nextBackup = nextBackup;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getInstanceUptime() {
|
|
||||||
return instanceUptime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setInstanceUptime(long instanceUptime) {
|
|
||||||
this.instanceUptime = instanceUptime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getInstanceCpuTime() {
|
|
||||||
return instanceCpuTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setInstanceCpuTime(long instanceCpuTime) {
|
|
||||||
this.instanceCpuTime = instanceCpuTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public RunningState getState() {
|
|
||||||
return state;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setState(RunningState state) {
|
|
||||||
this.state = state;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isSuspended() {
|
|
||||||
return isSuspended;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSuspended(boolean suspended) {
|
|
||||||
isSuspended = suspended;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,78 +0,0 @@
|
||||||
/**
|
|
||||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
|
||||||
* contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. jclouds licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
package org.jclouds.rimuhosting.miro.domain;
|
|
||||||
|
|
||||||
import org.jclouds.rimuhosting.miro.data.PostData;
|
|
||||||
|
|
||||||
import com.google.gson.annotations.SerializedName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Attributes about a running VPS. Implicit with any changes to
|
|
||||||
* these attributes on a VPS is that we'd need to restart the VPS for
|
|
||||||
* the changes to happen. At least at this point in time.
|
|
||||||
*
|
|
||||||
* @author Ivan Meredith
|
|
||||||
*/
|
|
||||||
public class ServerParameters implements PostData {
|
|
||||||
/**
|
|
||||||
* File system image size.
|
|
||||||
*/
|
|
||||||
@SerializedName("disk_space_mb")
|
|
||||||
private Integer primaryDisk;
|
|
||||||
/**
|
|
||||||
* Some VPSs have a secondary partition. One that is not part
|
|
||||||
* of the regular backup setups. Mostly not used.
|
|
||||||
*/
|
|
||||||
@SerializedName("disk_space_2_mb")
|
|
||||||
private Integer secondaryDisk;
|
|
||||||
/**
|
|
||||||
* Memory size.
|
|
||||||
*/
|
|
||||||
@SerializedName("memory_mb")
|
|
||||||
private Integer ram;
|
|
||||||
|
|
||||||
public Integer getPrimaryDisk() {
|
|
||||||
return primaryDisk;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPrimaryDisk(Integer primaryDisk) {
|
|
||||||
this.primaryDisk = primaryDisk;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getSecondaryDisk() {
|
|
||||||
return secondaryDisk;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSecondaryDisk(Integer secondaryDisk) {
|
|
||||||
this.secondaryDisk = secondaryDisk;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getRam() {
|
|
||||||
return ram;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRam(Integer ram) {
|
|
||||||
this.ram = ram;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void validate() {
|
|
||||||
//XXX: do we need to do anything here?
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,61 +0,0 @@
|
||||||
/**
|
|
||||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
|
||||||
* contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. jclouds licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
package org.jclouds.rimuhosting.miro.domain.internal;
|
|
||||||
|
|
||||||
import com.google.gson.annotations.SerializedName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Error Object from a response
|
|
||||||
*
|
|
||||||
* @author Ivan Meredith
|
|
||||||
*/
|
|
||||||
public class RimuHostingError {
|
|
||||||
@SerializedName("error_class")
|
|
||||||
private String errorClass;
|
|
||||||
|
|
||||||
@SerializedName("full_error_message")
|
|
||||||
private String errorMessage;
|
|
||||||
|
|
||||||
@SerializedName("error_title")
|
|
||||||
private String error;
|
|
||||||
|
|
||||||
public String getErrorClass() {
|
|
||||||
return errorClass;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setErrorClass(String errorClass) {
|
|
||||||
this.errorClass = errorClass;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getErrorMessage() {
|
|
||||||
return errorMessage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setErrorMessage(String errorMessage) {
|
|
||||||
this.errorMessage = errorMessage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getError() {
|
|
||||||
return error;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setError(String error) {
|
|
||||||
this.error = error;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,54 +0,0 @@
|
||||||
/**
|
|
||||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
|
||||||
* contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. jclouds licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
package org.jclouds.rimuhosting.miro.domain.internal;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Object that the payload on requests is backend in.
|
|
||||||
*
|
|
||||||
* @author Ivan Meredith
|
|
||||||
*/
|
|
||||||
public class RimuHostingResponse {
|
|
||||||
private String status_message;
|
|
||||||
private Integer status_code;
|
|
||||||
private RimuHostingError error_info;
|
|
||||||
public String getStatusMessage() {
|
|
||||||
return status_message;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setStatusMessage(String status_message) {
|
|
||||||
this.status_message = status_message;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getStatusCode() {
|
|
||||||
return status_code;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setStatusCode(Integer status_code) {
|
|
||||||
this.status_code = status_code;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public RimuHostingError getErrorInfo() {
|
|
||||||
return error_info;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setErrorInfo(RimuHostingError error_info) {
|
|
||||||
this.error_info = error_info;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,42 +0,0 @@
|
||||||
/**
|
|
||||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
|
||||||
* contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. jclouds licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
package org.jclouds.rimuhosting.miro.domain.internal;
|
|
||||||
|
|
||||||
import java.sql.Timestamp;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handles a timestamp JSON object from rimuhosting
|
|
||||||
*
|
|
||||||
* @author Ivan Meredith
|
|
||||||
*/
|
|
||||||
public class RimuHostingTimestamp {
|
|
||||||
private Long ms_since_epoch;
|
|
||||||
|
|
||||||
public Long getMs() {
|
|
||||||
return ms_since_epoch;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMs(Long ms_since_epoch) {
|
|
||||||
this.ms_since_epoch = ms_since_epoch;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Timestamp getTimestamp(){
|
|
||||||
return new Timestamp(ms_since_epoch);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,38 +0,0 @@
|
||||||
/**
|
|
||||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
|
||||||
* contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. jclouds licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
package org.jclouds.rimuhosting.miro.domain.internal;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* States an instance can be in.
|
|
||||||
*
|
|
||||||
* @author Ivan Meredith
|
|
||||||
*/
|
|
||||||
public enum RunningState {
|
|
||||||
RUNNING, NOTRUNNING, RESTARTING, POWERCYCLING, UNRECOGNIZED;
|
|
||||||
|
|
||||||
public static RunningState fromValue(String v) {
|
|
||||||
try {
|
|
||||||
return valueOf(v);
|
|
||||||
} catch (IllegalArgumentException e) {
|
|
||||||
return UNRECOGNIZED;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,29 +0,0 @@
|
||||||
/**
|
|
||||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
|
||||||
* contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. jclouds licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
package org.jclouds.rimuhosting.miro.domain.internal;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Jclouds is only interested in VPS.
|
|
||||||
*
|
|
||||||
* @author Ivan Meredith
|
|
||||||
*/
|
|
||||||
public enum ServerType {
|
|
||||||
PHYSICAL, VPS
|
|
||||||
}
|
|
|
@ -1,74 +0,0 @@
|
||||||
/**
|
|
||||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
|
||||||
* contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. jclouds licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
package org.jclouds.rimuhosting.miro.fallbacks;
|
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
|
||||||
|
|
||||||
import java.lang.reflect.Type;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import javax.inject.Inject;
|
|
||||||
import javax.inject.Singleton;
|
|
||||||
|
|
||||||
import org.jclouds.http.HttpResponseException;
|
|
||||||
import org.jclouds.json.Json;
|
|
||||||
import org.jclouds.rest.AuthorizationException;
|
|
||||||
import org.jclouds.rimuhosting.miro.domain.internal.RimuHostingResponse;
|
|
||||||
|
|
||||||
import com.google.common.base.Throwables;
|
|
||||||
import com.google.common.collect.Iterables;
|
|
||||||
import com.google.common.util.concurrent.FutureFallback;
|
|
||||||
import com.google.common.util.concurrent.ListenableFuture;
|
|
||||||
import com.google.gson.reflect.TypeToken;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* On non 2xx we have an error. RimuHosting using the same json base object.
|
|
||||||
*
|
|
||||||
* TODO: map exceptions out into something that suits jclouds.
|
|
||||||
*
|
|
||||||
* @author Ivan Meredith
|
|
||||||
*/
|
|
||||||
@Singleton
|
|
||||||
public class ParseRimuHostingException implements FutureFallback<Object> {
|
|
||||||
private Json json;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
public ParseRimuHostingException(Json json) {
|
|
||||||
this.json = json;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ListenableFuture<Object> create(Throwable t) {
|
|
||||||
if (checkNotNull(t, "throwable") instanceof HttpResponseException) {
|
|
||||||
HttpResponseException responseException = HttpResponseException.class.cast(t);
|
|
||||||
if (responseException.getContent() != null) {
|
|
||||||
Type setType = new TypeToken<Map<String, RimuHostingResponse>>() {
|
|
||||||
}.getType();
|
|
||||||
String test = responseException.getContent();
|
|
||||||
Map<String, RimuHostingResponse> responseMap = json.fromJson(test, setType);
|
|
||||||
RimuHostingResponse firstResponse = Iterables.get(responseMap.values(), 0);
|
|
||||||
String errorClass = firstResponse.getErrorInfo().getErrorClass();
|
|
||||||
if (errorClass.equals("PermissionException"))
|
|
||||||
throw new AuthorizationException(firstResponse.getErrorInfo().getErrorMessage(), responseException);
|
|
||||||
throw new RuntimeException(firstResponse.getErrorInfo().getErrorMessage(), t);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
throw Throwables.propagate(t);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,52 +0,0 @@
|
||||||
/**
|
|
||||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
|
||||||
* contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. jclouds licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
package org.jclouds.rimuhosting.miro.filters;
|
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
|
||||||
|
|
||||||
import javax.inject.Inject;
|
|
||||||
import javax.inject.Singleton;
|
|
||||||
import javax.ws.rs.core.HttpHeaders;
|
|
||||||
|
|
||||||
import org.jclouds.http.HttpException;
|
|
||||||
import org.jclouds.http.HttpRequest;
|
|
||||||
import org.jclouds.http.HttpRequestFilter;
|
|
||||||
import org.jclouds.rest.annotations.Identity;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* RimuHosting Authentication is a Authorization Header.
|
|
||||||
*
|
|
||||||
* Authorization: rimuhosting apikey=<key>
|
|
||||||
*
|
|
||||||
* @author Ivan Meredith
|
|
||||||
*/
|
|
||||||
@Singleton
|
|
||||||
public class RimuHostingAuthentication implements HttpRequestFilter {
|
|
||||||
private final String header;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
public RimuHostingAuthentication(@Identity String apikey) {
|
|
||||||
this.header = String.format("rimuhosting apikey=%s", checkNotNull(apikey, "apikey"));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public HttpRequest filter(HttpRequest request) throws HttpException {
|
|
||||||
return request.toBuilder().replaceHeader(HttpHeaders.AUTHORIZATION, header).build();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,59 +0,0 @@
|
||||||
/**
|
|
||||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
|
||||||
* contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. jclouds licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
package org.jclouds.rimuhosting.miro.functions;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import javax.inject.Inject;
|
|
||||||
import javax.inject.Singleton;
|
|
||||||
|
|
||||||
import org.jclouds.http.HttpResponse;
|
|
||||||
import org.jclouds.http.functions.ParseJson;
|
|
||||||
import org.jclouds.rimuhosting.miro.domain.internal.RimuHostingResponse;
|
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
|
||||||
import com.google.common.collect.Iterables;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Ivan Meredith
|
|
||||||
* @author Adrian Cole
|
|
||||||
*/
|
|
||||||
@Singleton
|
|
||||||
public class ParseDestroyResponseFromJsonResponse implements
|
|
||||||
Function<HttpResponse, List<String>> {
|
|
||||||
|
|
||||||
private final ParseJson<Map<String, DestroyResponse>> json;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
ParseDestroyResponseFromJsonResponse(
|
|
||||||
ParseJson<Map<String, DestroyResponse>> json) {
|
|
||||||
this.json = json;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<String> apply(HttpResponse arg0) {
|
|
||||||
return Iterables.get(json.apply(arg0).values(), 0).cancel_messages;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static class DestroyResponse extends RimuHostingResponse {
|
|
||||||
private List<String> cancel_messages;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,60 +0,0 @@
|
||||||
/**
|
|
||||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
|
||||||
* contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. jclouds licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
package org.jclouds.rimuhosting.miro.functions;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.SortedSet;
|
|
||||||
|
|
||||||
import javax.inject.Inject;
|
|
||||||
import javax.inject.Singleton;
|
|
||||||
|
|
||||||
import org.jclouds.http.HttpResponse;
|
|
||||||
import org.jclouds.http.functions.ParseJson;
|
|
||||||
import org.jclouds.rimuhosting.miro.domain.Image;
|
|
||||||
import org.jclouds.rimuhosting.miro.domain.internal.RimuHostingResponse;
|
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
|
||||||
import com.google.common.collect.Iterables;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Ivan Meredith
|
|
||||||
* @author Adrian Cole
|
|
||||||
*/
|
|
||||||
@Singleton
|
|
||||||
public class ParseImagesFromJsonResponse implements
|
|
||||||
Function<HttpResponse, SortedSet<Image>> {
|
|
||||||
|
|
||||||
private final ParseJson<Map<String, DistroResponse>> json;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
ParseImagesFromJsonResponse(ParseJson<Map<String, DistroResponse>> json) {
|
|
||||||
this.json = json;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public SortedSet<Image> apply(HttpResponse arg0) {
|
|
||||||
return Iterables.get(json.apply(arg0).values(), 0).distro_infos;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static class DistroResponse extends RimuHostingResponse {
|
|
||||||
private SortedSet<Image> distro_infos;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,58 +0,0 @@
|
||||||
/**
|
|
||||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
|
||||||
* contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. jclouds licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
package org.jclouds.rimuhosting.miro.functions;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.SortedSet;
|
|
||||||
|
|
||||||
import javax.inject.Inject;
|
|
||||||
import javax.inject.Singleton;
|
|
||||||
|
|
||||||
import org.jclouds.http.HttpResponse;
|
|
||||||
import org.jclouds.http.functions.ParseJson;
|
|
||||||
import org.jclouds.rimuhosting.miro.domain.PricingPlan;
|
|
||||||
import org.jclouds.rimuhosting.miro.domain.internal.RimuHostingResponse;
|
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
|
||||||
import com.google.common.collect.Iterables;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Ivan Meredith
|
|
||||||
*/
|
|
||||||
@Singleton
|
|
||||||
public class ParsePricingPlansFromJsonResponse implements
|
|
||||||
Function<HttpResponse, SortedSet<PricingPlan>> {
|
|
||||||
|
|
||||||
private final ParseJson<Map<String, PlansResponse>> json;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
ParsePricingPlansFromJsonResponse(ParseJson<Map<String, PlansResponse>> json) {
|
|
||||||
this.json = json;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public SortedSet<PricingPlan> apply(HttpResponse arg0) {
|
|
||||||
return Iterables.get(json.apply(arg0).values(), 0).pricing_plan_infos;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static class PlansResponse extends RimuHostingResponse {
|
|
||||||
private SortedSet<PricingPlan> pricing_plan_infos;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,58 +0,0 @@
|
||||||
/**
|
|
||||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
|
||||||
* contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. jclouds licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
package org.jclouds.rimuhosting.miro.functions;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import javax.inject.Inject;
|
|
||||||
import javax.inject.Singleton;
|
|
||||||
|
|
||||||
import org.jclouds.http.HttpResponse;
|
|
||||||
import org.jclouds.http.functions.ParseJson;
|
|
||||||
import org.jclouds.rimuhosting.miro.domain.Server;
|
|
||||||
import org.jclouds.rimuhosting.miro.domain.internal.RimuHostingResponse;
|
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
|
||||||
import com.google.common.collect.Iterables;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Ivan Meredith
|
|
||||||
* @author Adrian Cole
|
|
||||||
*/
|
|
||||||
@Singleton
|
|
||||||
public class ParseServerFromJsonResponse implements
|
|
||||||
Function<HttpResponse, Server> {
|
|
||||||
|
|
||||||
private final ParseJson<Map<String, OrderResponse>> json;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
ParseServerFromJsonResponse(ParseJson<Map<String, OrderResponse>> json) {
|
|
||||||
this.json = json;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Server apply(HttpResponse arg0) {
|
|
||||||
return Iterables.get(json.apply(arg0).values(), 0).about_order;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static class OrderResponse extends RimuHostingResponse {
|
|
||||||
private Server about_order;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,58 +0,0 @@
|
||||||
/**
|
|
||||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
|
||||||
* contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. jclouds licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
package org.jclouds.rimuhosting.miro.functions;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import javax.inject.Inject;
|
|
||||||
import javax.inject.Singleton;
|
|
||||||
|
|
||||||
import org.jclouds.http.HttpResponse;
|
|
||||||
import org.jclouds.http.functions.ParseJson;
|
|
||||||
import org.jclouds.rimuhosting.miro.domain.ServerInfo;
|
|
||||||
import org.jclouds.rimuhosting.miro.domain.internal.RimuHostingResponse;
|
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
|
||||||
import com.google.common.collect.Iterables;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Ivan Meredith
|
|
||||||
* @author Adrian Cole
|
|
||||||
*/
|
|
||||||
@Singleton
|
|
||||||
public class ParseServerInfoFromJsonResponse implements
|
|
||||||
Function<HttpResponse, ServerInfo> {
|
|
||||||
|
|
||||||
private final ParseJson<Map<String, OrderResponse>> json;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
ParseServerInfoFromJsonResponse(ParseJson<Map<String, OrderResponse>> json) {
|
|
||||||
this.json = json;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ServerInfo apply(HttpResponse arg0) {
|
|
||||||
return Iterables.get(json.apply(arg0).values(), 0).running_vps_info;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static class OrderResponse extends RimuHostingResponse {
|
|
||||||
private ServerInfo running_vps_info;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,60 +0,0 @@
|
||||||
/**
|
|
||||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
|
||||||
* contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. jclouds licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
package org.jclouds.rimuhosting.miro.functions;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.SortedSet;
|
|
||||||
|
|
||||||
import javax.inject.Inject;
|
|
||||||
import javax.inject.Singleton;
|
|
||||||
|
|
||||||
import org.jclouds.http.HttpResponse;
|
|
||||||
import org.jclouds.http.functions.ParseJson;
|
|
||||||
import org.jclouds.rimuhosting.miro.domain.Server;
|
|
||||||
import org.jclouds.rimuhosting.miro.domain.internal.RimuHostingResponse;
|
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
|
||||||
import com.google.common.collect.Iterables;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Ivan Meredith
|
|
||||||
* @author Adrian Cole
|
|
||||||
*/
|
|
||||||
@Singleton
|
|
||||||
public class ParseServersFromJsonResponse implements
|
|
||||||
Function<HttpResponse, SortedSet<Server>> {
|
|
||||||
|
|
||||||
private final ParseJson<Map<String, OrderResponse>> json;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
ParseServersFromJsonResponse(ParseJson<Map<String, OrderResponse>> json) {
|
|
||||||
this.json = json;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public SortedSet<Server> apply(HttpResponse arg0) {
|
|
||||||
return Iterables.get(json.apply(arg0).values(), 0).about_orders;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static class OrderResponse extends RimuHostingResponse {
|
|
||||||
private SortedSet<Server> about_orders;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,69 +0,0 @@
|
||||||
/**
|
|
||||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
|
||||||
* contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. jclouds licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
package org.jclouds.rimuhosting.miro.location;
|
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
|
||||||
import static org.jclouds.compute.config.ComputeServiceProperties.TEMPLATE;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import javax.inject.Inject;
|
|
||||||
import javax.inject.Named;
|
|
||||||
import javax.inject.Singleton;
|
|
||||||
|
|
||||||
import org.jclouds.collect.Memoized;
|
|
||||||
import org.jclouds.domain.Location;
|
|
||||||
import org.jclouds.location.suppliers.ImplicitLocationSupplier;
|
|
||||||
|
|
||||||
import com.google.common.base.Predicate;
|
|
||||||
import com.google.common.base.Splitter;
|
|
||||||
import com.google.common.base.Supplier;
|
|
||||||
import com.google.common.collect.Iterables;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Adrian Cole
|
|
||||||
*/
|
|
||||||
@Singleton
|
|
||||||
public class RimuHostingDefaultLocationSupplier implements ImplicitLocationSupplier {
|
|
||||||
private final Supplier<Set<? extends Location>> locations;
|
|
||||||
private final String defaultDC;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
RimuHostingDefaultLocationSupplier(@Memoized Supplier<Set<? extends Location>> locations,
|
|
||||||
@Named(TEMPLATE) String template) {
|
|
||||||
this.locations = locations;
|
|
||||||
Map<String, String> map = Splitter.on(',').trimResults().withKeyValueSeparator("=").split(template);
|
|
||||||
// TODO: move to real ImplicitLocationSupplier
|
|
||||||
this.defaultDC = checkNotNull(map.get("locationId"), "locationId not in % value: %s", TEMPLATE, template);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Location get() {
|
|
||||||
return Iterables.find(locations.get(), new Predicate<Location>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Location input) {
|
|
||||||
return input.getId().equals(defaultDC);
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,93 +0,0 @@
|
||||||
/**
|
|
||||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
|
||||||
* contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. jclouds licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
package org.jclouds.rimuhosting.miro.location;
|
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
|
||||||
|
|
||||||
import java.net.URI;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import javax.inject.Inject;
|
|
||||||
import javax.inject.Singleton;
|
|
||||||
|
|
||||||
import org.jclouds.domain.Location;
|
|
||||||
import org.jclouds.domain.LocationBuilder;
|
|
||||||
import org.jclouds.domain.LocationScope;
|
|
||||||
import org.jclouds.location.Iso3166;
|
|
||||||
import org.jclouds.location.Provider;
|
|
||||||
import org.jclouds.location.suppliers.LocationsSupplier;
|
|
||||||
import org.jclouds.location.suppliers.all.JustProvider;
|
|
||||||
import org.jclouds.rimuhosting.miro.RimuHostingClient;
|
|
||||||
import org.jclouds.rimuhosting.miro.domain.DataCenter;
|
|
||||||
import org.jclouds.rimuhosting.miro.domain.PricingPlan;
|
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
|
||||||
import com.google.common.base.Predicates;
|
|
||||||
import com.google.common.base.Supplier;
|
|
||||||
import com.google.common.collect.ImmutableSet;
|
|
||||||
import com.google.common.collect.Iterables;
|
|
||||||
import com.google.common.collect.ImmutableSet.Builder;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Adrian Cole
|
|
||||||
*/
|
|
||||||
@Singleton
|
|
||||||
public class RimuHostingLocationSupplier extends JustProvider implements LocationsSupplier {
|
|
||||||
|
|
||||||
private final RimuHostingClient sync;
|
|
||||||
private final Supplier<Map<String, Supplier<Set<String>>>> isoCodesByIdSupplier;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
RimuHostingLocationSupplier(@Iso3166 Set<String> isoCodes, @Provider String providerName, @Provider Supplier<URI> endpoint,
|
|
||||||
RimuHostingClient sync, @Iso3166 Supplier<Map<String, Supplier<Set<String>>>> isoCodesByIdSupplier) {
|
|
||||||
super(providerName, endpoint, isoCodes);
|
|
||||||
this.sync = checkNotNull(sync, "sync");
|
|
||||||
this.isoCodesByIdSupplier = checkNotNull(isoCodesByIdSupplier, "isoCodesByIdSupplier");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Set<? extends Location> get() {
|
|
||||||
Builder<Location> locations = ImmutableSet.builder();
|
|
||||||
Iterable<DataCenter> list = Iterables.filter(Iterables.transform(sync.getPricingPlanList(),
|
|
||||||
new Function<PricingPlan, DataCenter>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public DataCenter apply(PricingPlan arg0) {
|
|
||||||
return arg0.getDataCenter();
|
|
||||||
}
|
|
||||||
|
|
||||||
}), Predicates.<DataCenter>notNull());
|
|
||||||
Location provider = Iterables.getOnlyElement(super.get());
|
|
||||||
if (Iterables.size(list) == 0)
|
|
||||||
locations.add(provider);
|
|
||||||
else{
|
|
||||||
Map<String, Supplier<Set<String>>> isoCodesById = isoCodesByIdSupplier.get();
|
|
||||||
for (DataCenter from : list) {
|
|
||||||
LocationBuilder builder = new LocationBuilder().scope(LocationScope.ZONE).id(from.getId()).description(
|
|
||||||
from.getName()).parent(provider);
|
|
||||||
if (isoCodesById.containsKey(from.getId()))
|
|
||||||
builder.iso3166Codes(isoCodesById.get(from.getId()).get());
|
|
||||||
locations.add(builder.build());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return locations.build();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,60 +0,0 @@
|
||||||
/**
|
|
||||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
|
||||||
* contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. jclouds licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
package org.jclouds.rimuhosting.miro.predicates;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
import javax.inject.Singleton;
|
|
||||||
|
|
||||||
import org.jclouds.logging.Logger;
|
|
||||||
import org.jclouds.rimuhosting.miro.RimuHostingClient;
|
|
||||||
import org.jclouds.rimuhosting.miro.domain.Server;
|
|
||||||
|
|
||||||
import com.google.common.base.Predicate;
|
|
||||||
import com.google.inject.Inject;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* Tests to see if a task succeeds.
|
|
||||||
*
|
|
||||||
* @author Adrian Cole
|
|
||||||
*/
|
|
||||||
@Singleton
|
|
||||||
public class ServerDestroyed implements Predicate<Server> {
|
|
||||||
|
|
||||||
private final RimuHostingClient client;
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
protected Logger logger = Logger.NULL;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
public ServerDestroyed(RimuHostingClient client) {
|
|
||||||
this.client = client;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean apply(Server server) {
|
|
||||||
server = refresh(server);
|
|
||||||
if (server == null)
|
|
||||||
return true;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Server refresh(Server server) {
|
|
||||||
return client.getServer(server.getId());
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,67 +0,0 @@
|
||||||
/**
|
|
||||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
|
||||||
* contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. jclouds licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
package org.jclouds.rimuhosting.miro.predicates;
|
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
import javax.inject.Singleton;
|
|
||||||
|
|
||||||
import org.jclouds.logging.Logger;
|
|
||||||
import org.jclouds.rimuhosting.miro.RimuHostingClient;
|
|
||||||
import org.jclouds.rimuhosting.miro.domain.Server;
|
|
||||||
import org.jclouds.rimuhosting.miro.domain.internal.RunningState;
|
|
||||||
|
|
||||||
import com.google.common.base.Predicate;
|
|
||||||
import com.google.inject.Inject;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* Tests to see if a task succeeds.
|
|
||||||
*
|
|
||||||
* @author Adrian Cole
|
|
||||||
*/
|
|
||||||
@Singleton
|
|
||||||
public class ServerRunning implements Predicate<Server> {
|
|
||||||
|
|
||||||
private final RimuHostingClient client;
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
protected Logger logger = Logger.NULL;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
public ServerRunning(RimuHostingClient client) {
|
|
||||||
this.client = client;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean apply(Server server) {
|
|
||||||
logger.trace("looking for state on server %s", checkNotNull(server,
|
|
||||||
"server"));
|
|
||||||
server = refresh(server);
|
|
||||||
if (server == null)
|
|
||||||
return false;
|
|
||||||
logger.trace("%s: looking for server state %s: currently: %s", server
|
|
||||||
.getId(), RunningState.RUNNING, server.getState());
|
|
||||||
return server.getState() == RunningState.RUNNING;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Server refresh(Server server) {
|
|
||||||
return client.getServer(server.getId());
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1 +0,0 @@
|
||||||
org.jclouds.rimuhosting.miro.RimuHostingProviderMetadata
|
|
|
@ -1,100 +0,0 @@
|
||||||
/**
|
|
||||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
|
||||||
* contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. jclouds licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
package org.jclouds.rimuhosting.miro;
|
|
||||||
|
|
||||||
import static org.testng.Assert.assertEquals;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.lang.reflect.Method;
|
|
||||||
|
|
||||||
import org.jclouds.http.HttpRequest;
|
|
||||||
import org.jclouds.http.functions.UnwrapOnlyJsonValue;
|
|
||||||
import org.jclouds.providers.ProviderMetadata;
|
|
||||||
import org.jclouds.rest.internal.BaseAsyncClientTest;
|
|
||||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
|
||||||
import org.jclouds.rest.internal.RestAnnotationProcessor;
|
|
||||||
import org.jclouds.rimuhosting.miro.binder.CreateServerOptions;
|
|
||||||
import org.jclouds.rimuhosting.miro.fallbacks.ParseRimuHostingException;
|
|
||||||
import org.jclouds.rimuhosting.miro.filters.RimuHostingAuthentication;
|
|
||||||
import org.jclouds.rimuhosting.miro.functions.ParseServersFromJsonResponse;
|
|
||||||
import org.testng.annotations.Test;
|
|
||||||
|
|
||||||
import com.google.inject.TypeLiteral;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Tests behavior of {@code RimuHostingAsyncClient}
|
|
||||||
*
|
|
||||||
* @author Adrian Cole
|
|
||||||
*/
|
|
||||||
// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire
|
|
||||||
@Test(groups = "unit", testName = "RimuHostingAsyncClientTest")
|
|
||||||
public class RimuHostingAsyncClientTest extends BaseAsyncClientTest<RimuHostingAsyncClient> {
|
|
||||||
|
|
||||||
public void testCreateServer() throws SecurityException, NoSuchMethodException, IOException {
|
|
||||||
Method method = RimuHostingAsyncClient.class.getMethod("createServer", String.class, String.class, String.class,
|
|
||||||
CreateServerOptions[].class);
|
|
||||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, "test.ivan.api.com",
|
|
||||||
"lenny", "MIRO4B");
|
|
||||||
|
|
||||||
assertRequestLineEquals(httpRequest, "POST https://api.rimuhosting.com/r/orders/new-vps HTTP/1.1");
|
|
||||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\nHost: api.rimuhosting.com\n");
|
|
||||||
assertPayloadEquals(
|
|
||||||
httpRequest,
|
|
||||||
"{\"request\":{\"instantiation_options\":{\"distro\":\"lenny\",\"domain_name\":\"test.ivan.api.com\"},\"pricing_plan_code\":\"MIRO4B\",\"meta_data\":[]}}",
|
|
||||||
"application/json", false);
|
|
||||||
assertResponseParserClassEquals(method, httpRequest, UnwrapOnlyJsonValue.class);
|
|
||||||
assertSaxResponseParserClassEquals(method, null);
|
|
||||||
assertFallbackClassEquals(method, ParseRimuHostingException.class);
|
|
||||||
|
|
||||||
checkFilters(httpRequest);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testGetServerList() throws SecurityException, NoSuchMethodException, IOException {
|
|
||||||
Method method = RimuHostingAsyncClient.class.getMethod("getServerList");
|
|
||||||
GeneratedHttpRequest httpRequest = processor.createRequest(method);
|
|
||||||
|
|
||||||
assertRequestLineEquals(httpRequest, "GET https://api.rimuhosting.com/r/orders;include_inactive=N HTTP/1.1");
|
|
||||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\nHost: api.rimuhosting.com\n");
|
|
||||||
assertPayloadEquals(httpRequest, null, null, false);
|
|
||||||
assertResponseParserClassEquals(method, httpRequest, ParseServersFromJsonResponse.class);
|
|
||||||
assertSaxResponseParserClassEquals(method, null);
|
|
||||||
assertFallbackClassEquals(method, ParseRimuHostingException.class);
|
|
||||||
|
|
||||||
checkFilters(httpRequest);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void checkFilters(HttpRequest request) {
|
|
||||||
assertEquals(request.getFilters().size(), 1);
|
|
||||||
assertEquals(request.getFilters().get(0).getClass(), RimuHostingAuthentication.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected TypeLiteral<RestAnnotationProcessor<RimuHostingAsyncClient>> createTypeLiteral() {
|
|
||||||
return new TypeLiteral<RestAnnotationProcessor<RimuHostingAsyncClient>>() {
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ProviderMetadata createProviderMetadata() {
|
|
||||||
return new RimuHostingProviderMetadata();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,101 +0,0 @@
|
||||||
/**
|
|
||||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
|
||||||
* contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. jclouds licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
package org.jclouds.rimuhosting.miro;
|
|
||||||
|
|
||||||
import static org.testng.Assert.assertEquals;
|
|
||||||
import static org.testng.Assert.assertNotNull;
|
|
||||||
import static org.testng.Assert.fail;
|
|
||||||
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import org.jclouds.compute.internal.BaseComputeServiceContextLiveTest;
|
|
||||||
import org.jclouds.rest.RestContext;
|
|
||||||
import org.jclouds.rimuhosting.miro.domain.Image;
|
|
||||||
import org.jclouds.rimuhosting.miro.domain.NewServerResponse;
|
|
||||||
import org.jclouds.rimuhosting.miro.domain.PricingPlan;
|
|
||||||
import org.jclouds.rimuhosting.miro.domain.Server;
|
|
||||||
import org.jclouds.rimuhosting.miro.domain.ServerInfo;
|
|
||||||
import org.jclouds.rimuhosting.miro.domain.internal.RunningState;
|
|
||||||
import org.testng.annotations.BeforeGroups;
|
|
||||||
import org.testng.annotations.Test;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Tests behavior of {@code RimuHostingClient}
|
|
||||||
*
|
|
||||||
* @author Ivan Meredith
|
|
||||||
*/
|
|
||||||
@Test(groups = "live", singleThreaded = true, testName = "RimuHostingClientLiveTest")
|
|
||||||
public class RimuHostingClientLiveTest
|
|
||||||
extends
|
|
||||||
BaseComputeServiceContextLiveTest {
|
|
||||||
|
|
||||||
public RimuHostingClientLiveTest() {
|
|
||||||
provider = "rimuhosting";
|
|
||||||
}
|
|
||||||
|
|
||||||
private RimuHostingClient connection;
|
|
||||||
private RestContext<RimuHostingClient, RimuHostingAsyncClient> restContext;
|
|
||||||
|
|
||||||
@BeforeGroups(groups = { "integration", "live" })
|
|
||||||
@Override
|
|
||||||
public void setupContext() {
|
|
||||||
super.setupContext();
|
|
||||||
restContext = view.unwrap();
|
|
||||||
this.connection = restContext.getApi();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testPricingPlans() {
|
|
||||||
Set<? extends PricingPlan> plans = connection.getPricingPlanList();
|
|
||||||
for (PricingPlan plan : plans) {
|
|
||||||
if (plan.getId().equalsIgnoreCase("MIRO4B")) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fail("MIRO4B not found");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testImages() {
|
|
||||||
Set<? extends Image> images = connection.getImageList();
|
|
||||||
for (Image image : images) {
|
|
||||||
if (image.getId().equalsIgnoreCase("lenny")) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fail("lenny not found");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testLifeCycle() {
|
|
||||||
// Get the first image, we dont really care what it is in this test.
|
|
||||||
NewServerResponse serverResponse = connection.createServer("test.ivan.api.com", "lenny", "MIRO4B");
|
|
||||||
Server server = serverResponse.getServer();
|
|
||||||
// Now we have the server, lets restart it
|
|
||||||
assertNotNull(server.getId());
|
|
||||||
ServerInfo serverInfo = connection.restartServer(server.getId());
|
|
||||||
|
|
||||||
// Should be running now.
|
|
||||||
assertEquals(serverInfo.getState(), RunningState.RUNNING);
|
|
||||||
assertEquals(server.getName(), "test.ivan.api.com");
|
|
||||||
assertEquals(server.getImageId(), "lenny");
|
|
||||||
connection.destroyServer(server.getId());
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,34 +0,0 @@
|
||||||
/**
|
|
||||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
|
||||||
* contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. jclouds licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
package org.jclouds.rimuhosting.miro;
|
|
||||||
|
|
||||||
import org.jclouds.providers.internal.BaseProviderMetadataTest;
|
|
||||||
import org.testng.annotations.Test;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Adrian Cole
|
|
||||||
*/
|
|
||||||
@Test(groups = "unit", testName = "RimuHostingProviderTest")
|
|
||||||
public class RimuHostingProviderTest extends BaseProviderMetadataTest {
|
|
||||||
|
|
||||||
public RimuHostingProviderTest() {
|
|
||||||
super(new RimuHostingProviderMetadata(), new RimuHostingApiMetadata());
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,61 +0,0 @@
|
||||||
/**
|
|
||||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
|
||||||
* contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. jclouds licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
package org.jclouds.rimuhosting.miro.compute;
|
|
||||||
|
|
||||||
import org.jclouds.compute.domain.NodeMetadata;
|
|
||||||
import org.jclouds.compute.internal.BaseComputeServiceLiveTest;
|
|
||||||
import org.jclouds.ssh.jsch.config.JschSshClientModule;
|
|
||||||
import org.testng.annotations.BeforeClass;
|
|
||||||
import org.testng.annotations.Test;
|
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableMap;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Ivan Meredith
|
|
||||||
*/
|
|
||||||
@Test(groups = "live", sequential = true)
|
|
||||||
public class RimuHostingComputeServiceLiveTest extends BaseComputeServiceLiveTest {
|
|
||||||
|
|
||||||
public RimuHostingComputeServiceLiveTest() {
|
|
||||||
provider = "rimuhosting";
|
|
||||||
}
|
|
||||||
|
|
||||||
@BeforeClass
|
|
||||||
@Override
|
|
||||||
public void setServiceDefaults() {
|
|
||||||
group = "rimuhosting.jclouds";
|
|
||||||
}
|
|
||||||
|
|
||||||
// rimuhosting does not support metadata
|
|
||||||
@Override
|
|
||||||
protected void checkUserMetadataInNodeEquals(NodeMetadata node, ImmutableMap<String, String> userMetadata) {
|
|
||||||
assert node.getUserMetadata().equals(ImmutableMap.<String, String> of()) : String.format(
|
|
||||||
"node userMetadata did not match %s %s", userMetadata, node);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected JschSshClientModule getSshModule() {
|
|
||||||
return new JschSshClientModule();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void testOptionToNotBlock() {
|
|
||||||
// start call is blocking anyway.
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,83 +0,0 @@
|
||||||
/**
|
|
||||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
|
||||||
* contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. jclouds licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
package org.jclouds.rimuhosting.miro.compute;
|
|
||||||
|
|
||||||
import static org.jclouds.compute.util.ComputeServiceUtils.getCores;
|
|
||||||
import static org.testng.Assert.assertEquals;
|
|
||||||
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import org.jclouds.compute.domain.OsFamily;
|
|
||||||
import org.jclouds.compute.domain.OsFamilyVersion64Bit;
|
|
||||||
import org.jclouds.compute.domain.Template;
|
|
||||||
import org.jclouds.compute.internal.BaseTemplateBuilderLiveTest;
|
|
||||||
import org.testng.annotations.Test;
|
|
||||||
|
|
||||||
import com.google.common.base.Predicate;
|
|
||||||
import com.google.common.collect.ImmutableSet;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Adrian Cole
|
|
||||||
*/
|
|
||||||
@Test(groups = "live")
|
|
||||||
public class RimuHostingTemplateBuilderLiveTest extends BaseTemplateBuilderLiveTest {
|
|
||||||
|
|
||||||
public RimuHostingTemplateBuilderLiveTest() {
|
|
||||||
provider = "rimuhosting";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Predicate<OsFamilyVersion64Bit> defineUnsupportedOperatingSystems() {
|
|
||||||
return new Predicate<OsFamilyVersion64Bit>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(OsFamilyVersion64Bit input) {
|
|
||||||
switch (input.family) {
|
|
||||||
case UBUNTU:
|
|
||||||
return input.version.matches("^[89].*") || input.version.equals("11.10")
|
|
||||||
|| input.version.equals("12.04");
|
|
||||||
case DEBIAN:
|
|
||||||
return false;
|
|
||||||
case CENTOS:
|
|
||||||
return !input.version.equals("");
|
|
||||||
default:
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testTemplateBuilder() {
|
|
||||||
Template defaultTemplate = view.getComputeService().templateBuilder().build();
|
|
||||||
assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), true);
|
|
||||||
assertEquals(defaultTemplate.getImage().getOperatingSystem().getVersion(), "11.04");
|
|
||||||
assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU);
|
|
||||||
assertEquals(defaultTemplate.getLocation().getId(), "DCDALLAS");
|
|
||||||
assertEquals(defaultTemplate.getHardware().getProviderId(), "MIRO4B");
|
|
||||||
assertEquals(getCores(defaultTemplate.getHardware()), 1.0d);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Set<String> getIso3166Codes() {
|
|
||||||
return ImmutableSet.<String> of("NZ-AUK", "US-TX", "AU-NSW", "GB-LND");
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,63 +0,0 @@
|
||||||
/**
|
|
||||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
|
||||||
* contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. jclouds licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
package org.jclouds.rimuhosting.miro.functions;
|
|
||||||
|
|
||||||
import static org.testng.Assert.assertEquals;
|
|
||||||
|
|
||||||
import java.io.InputStream;
|
|
||||||
|
|
||||||
import org.jclouds.date.internal.SimpleDateFormatDateService;
|
|
||||||
import org.jclouds.http.HttpResponse;
|
|
||||||
import org.jclouds.json.config.GsonModule;
|
|
||||||
import org.jclouds.rimuhosting.miro.config.RimuHostingRestClientModule.RimuIso8601DateAdapter;
|
|
||||||
import org.jclouds.rimuhosting.miro.domain.Server;
|
|
||||||
import org.testng.annotations.Test;
|
|
||||||
|
|
||||||
import com.google.inject.Guice;
|
|
||||||
import com.google.inject.Injector;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Adrian Cole
|
|
||||||
*/
|
|
||||||
@Test(groups = "unit")
|
|
||||||
public class ParseServerFromJsonResponseTest {
|
|
||||||
Injector i = Guice.createInjector(new GsonModule() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void configure() {
|
|
||||||
bind(DateAdapter.class).to(RimuIso8601DateAdapter.class);
|
|
||||||
super.configure();
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
public void testCancelled() {
|
|
||||||
InputStream is = getClass().getResourceAsStream("/cancelled.json");
|
|
||||||
|
|
||||||
ParseServerFromJsonResponse parser = i.getInstance(ParseServerFromJsonResponse.class);
|
|
||||||
|
|
||||||
Server response = parser.apply(HttpResponse.builder().statusCode(200).message("ok").payload(is).build());
|
|
||||||
|
|
||||||
assertEquals(response.getBillingData().getDateSuspended(), null);
|
|
||||||
assertEquals(response.getBillingData().getDateCancelled(), new SimpleDateFormatDateService()
|
|
||||||
.iso8601SecondsDateParse("2011-04-02T03:30:28Z"));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,38 +0,0 @@
|
||||||
{ "get_order_response" : { "status_message" : null
|
|
||||||
, "status_code" : 200
|
|
||||||
, "response_created_time" : { "ms_since_epoch": 1301716709422, "iso_format" : "2011-04-02T03:58:29Z", "users_tz_offset_ms" : 46800000}
|
|
||||||
, "response_created_time_epoch_ms" : 1301716709422
|
|
||||||
, "error_info" : null
|
|
||||||
, "extended_error_infos" : null
|
|
||||||
, "response_type" : "OK"
|
|
||||||
, "human_readable_message" : "Information about rimuhosting.jcloudsr-eed"
|
|
||||||
, "redirect_uri" : null
|
|
||||||
, "response_display_duration_type" : "REGULAR"
|
|
||||||
, "about_order" : { "order_oid" : 721950181
|
|
||||||
, "domain_name" : "rimuhosting.jcloudsr-eed"
|
|
||||||
, "slug" : "order-721950181-rimuhosting-jcloudsr-e"
|
|
||||||
, "billing_oid" : 50081656
|
|
||||||
, "is_on_customers_own_physical_server" : false
|
|
||||||
, "vps_parameters" : { "memory_mb" : 1150
|
|
||||||
, "disk_space_mb" : 4096
|
|
||||||
, "disk_space_2_mb" : 0}
|
|
||||||
, "host_server_oid" : "324"
|
|
||||||
, "server_type" : "VPS"
|
|
||||||
, "data_transfer_allowance" : { "data_transfer_gb" : 75
|
|
||||||
, "data_transfer" : ""}
|
|
||||||
, "billing_info" : { "monthly_recurring_fee" : 44.95
|
|
||||||
, "monthly_recurring_amt" : { "amt" : 44.95
|
|
||||||
, "currency" : "CUR_USD"
|
|
||||||
, "amt_usd" : 44.95}
|
|
||||||
, "suspended_date" : null
|
|
||||||
, "prepaid_until" : null
|
|
||||||
, "order_date" : { "ms_since_epoch": 1301710569000, "iso_format" : "2011-04-02T02:16:09Z", "users_tz_offset_ms" : 46800000}
|
|
||||||
, "cancellation_date" : { "ms_since_epoch": 1301715028000, "iso_format" : "2011-04-02T03:30:28Z", "users_tz_offset_ms" : 46800000}}
|
|
||||||
, "location" : { "data_center_location_code" : "DCDALLAS"
|
|
||||||
, "data_center_location_name" : "Dallas"
|
|
||||||
, "data_center_location_country_2ltr" : "US"}
|
|
||||||
, "allocated_ips" : { "primary_ip" : "206.123.115.150"
|
|
||||||
, "secondary_ips" : []}
|
|
||||||
, "running_state" : "NOTRUNNING"
|
|
||||||
, "distro" : "ubuntu1004.64"
|
|
||||||
, "meta_data" : []}}}
|
|
|
@ -1,151 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
|
|
||||||
|
|
||||||
<!--
|
|
||||||
For more configuration infromation and examples see the Apache
|
|
||||||
Log4j website: http://logging.apache.org/log4j/
|
|
||||||
-->
|
|
||||||
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"
|
|
||||||
debug="false">
|
|
||||||
|
|
||||||
<!-- A time/date based rolling appender -->
|
|
||||||
<appender name="WIREFILE" class="org.apache.log4j.DailyRollingFileAppender">
|
|
||||||
<param name="File" value="target/test-data/jclouds-wire.log" />
|
|
||||||
<param name="Append" value="true" />
|
|
||||||
|
|
||||||
<!-- Rollover at midnight each day -->
|
|
||||||
<param name="DatePattern" value="'.'yyyy-MM-dd" />
|
|
||||||
|
|
||||||
<param name="Threshold" value="TRACE" />
|
|
||||||
|
|
||||||
<layout class="org.apache.log4j.PatternLayout">
|
|
||||||
<!-- The default pattern: Date Priority [Category] Message\n -->
|
|
||||||
<param name="ConversionPattern" value="%d %-5p [%c] (%t) %m%n" />
|
|
||||||
|
|
||||||
<!--
|
|
||||||
The full pattern: Date MS Priority [Category]
|
|
||||||
(Thread:NDC) Message\n <param name="ConversionPattern"
|
|
||||||
value="%d %-5r %-5p [%c] (%t:%x) %m%n"/>
|
|
||||||
-->
|
|
||||||
</layout>
|
|
||||||
</appender>
|
|
||||||
|
|
||||||
<!-- A time/date based rolling appender -->
|
|
||||||
<appender name="FILE" class="org.apache.log4j.DailyRollingFileAppender">
|
|
||||||
<param name="File" value="target/test-data/jclouds.log" />
|
|
||||||
<param name="Append" value="true" />
|
|
||||||
|
|
||||||
<!-- Rollover at midnight each day -->
|
|
||||||
<param name="DatePattern" value="'.'yyyy-MM-dd" />
|
|
||||||
|
|
||||||
<param name="Threshold" value="TRACE" />
|
|
||||||
|
|
||||||
<layout class="org.apache.log4j.PatternLayout">
|
|
||||||
<!-- The default pattern: Date Priority [Category] Message\n -->
|
|
||||||
<param name="ConversionPattern" value="%d %-5p [%c] (%t) %m%n" />
|
|
||||||
|
|
||||||
<!--
|
|
||||||
The full pattern: Date MS Priority [Category]
|
|
||||||
(Thread:NDC) Message\n <param name="ConversionPattern"
|
|
||||||
value="%d %-5r %-5p [%c] (%t:%x) %m%n"/>
|
|
||||||
-->
|
|
||||||
</layout>
|
|
||||||
</appender>
|
|
||||||
|
|
||||||
<!-- A time/date based rolling appender -->
|
|
||||||
<appender name="COMPUTEFILE" class="org.apache.log4j.DailyRollingFileAppender">
|
|
||||||
<param name="File" value="target/test-data/jclouds-compute.log" />
|
|
||||||
<param name="Append" value="true" />
|
|
||||||
|
|
||||||
<!-- Rollover at midnight each day -->
|
|
||||||
<param name="DatePattern" value="'.'yyyy-MM-dd" />
|
|
||||||
|
|
||||||
<param name="Threshold" value="TRACE" />
|
|
||||||
|
|
||||||
<layout class="org.apache.log4j.PatternLayout">
|
|
||||||
<!-- The default pattern: Date Priority [Category] Message\n -->
|
|
||||||
<param name="ConversionPattern" value="%d %-5p [%c] (%t) %m%n" />
|
|
||||||
|
|
||||||
<!--
|
|
||||||
The full pattern: Date MS Priority [Category]
|
|
||||||
(Thread:NDC) Message\n <param name="ConversionPattern"
|
|
||||||
value="%d %-5r %-5p [%c] (%t:%x) %m%n"/>
|
|
||||||
-->
|
|
||||||
</layout>
|
|
||||||
</appender>
|
|
||||||
|
|
||||||
<!-- A time/date based rolling appender -->
|
|
||||||
<appender name="SSHFILE" class="org.apache.log4j.DailyRollingFileAppender">
|
|
||||||
<param name="File" value="target/test-data/jclouds-ssh.log" />
|
|
||||||
<param name="Append" value="true" />
|
|
||||||
|
|
||||||
<!-- Rollover at midnight each day -->
|
|
||||||
<param name="DatePattern" value="'.'yyyy-MM-dd" />
|
|
||||||
|
|
||||||
<param name="Threshold" value="TRACE" />
|
|
||||||
|
|
||||||
<layout class="org.apache.log4j.PatternLayout">
|
|
||||||
<!-- The default pattern: Date Priority [Category] Message\n -->
|
|
||||||
<param name="ConversionPattern" value="%d %-5p [%c] (%t) %m%n" />
|
|
||||||
|
|
||||||
<!--
|
|
||||||
The full pattern: Date MS Priority [Category]
|
|
||||||
(Thread:NDC) Message\n <param name="ConversionPattern"
|
|
||||||
value="%d %-5r %-5p [%c] (%t:%x) %m%n"/>
|
|
||||||
-->
|
|
||||||
</layout>
|
|
||||||
</appender>
|
|
||||||
|
|
||||||
<appender name="ASYNCCOMPUTE" class="org.apache.log4j.AsyncAppender">
|
|
||||||
<appender-ref ref="COMPUTEFILE" />
|
|
||||||
</appender>
|
|
||||||
|
|
||||||
<appender name="ASYNCSSH" class="org.apache.log4j.AsyncAppender">
|
|
||||||
<appender-ref ref="SSHFILE" />
|
|
||||||
</appender>
|
|
||||||
|
|
||||||
<appender name="ASYNC" class="org.apache.log4j.AsyncAppender">
|
|
||||||
<appender-ref ref="FILE" />
|
|
||||||
</appender>
|
|
||||||
|
|
||||||
<appender name="ASYNCWIRE" class="org.apache.log4j.AsyncAppender">
|
|
||||||
<appender-ref ref="WIREFILE" />
|
|
||||||
</appender>
|
|
||||||
|
|
||||||
<!-- ================ -->
|
|
||||||
<!-- Limit categories -->
|
|
||||||
<!-- ================ -->
|
|
||||||
|
|
||||||
<category name="org.jclouds">
|
|
||||||
<priority value="DEBUG" />
|
|
||||||
<appender-ref ref="ASYNC" />
|
|
||||||
</category>
|
|
||||||
|
|
||||||
<category name="jclouds.headers">
|
|
||||||
<priority value="DEBUG" />
|
|
||||||
<appender-ref ref="ASYNCWIRE" />
|
|
||||||
</category>
|
|
||||||
|
|
||||||
<category name="jclouds.ssh">
|
|
||||||
<priority value="DEBUG" />
|
|
||||||
<appender-ref ref="ASYNCSSH" />
|
|
||||||
</category>
|
|
||||||
|
|
||||||
<category name="jclouds.wire">
|
|
||||||
<priority value="DEBUG" />
|
|
||||||
<appender-ref ref="ASYNCWIRE" />
|
|
||||||
</category>
|
|
||||||
|
|
||||||
<category name="jclouds.compute">
|
|
||||||
<priority value="TRACE" />
|
|
||||||
<appender-ref ref="ASYNCCOMPUTE" />
|
|
||||||
</category>
|
|
||||||
<!-- ======================= -->
|
|
||||||
<!-- Setup the Root category -->
|
|
||||||
<!-- ======================= -->
|
|
||||||
|
|
||||||
<root>
|
|
||||||
<priority value="WARN" />
|
|
||||||
</root>
|
|
||||||
|
|
||||||
</log4j:configuration>
|
|
Loading…
Reference in New Issue