diff --git a/allcompute/pom.xml b/allcompute/pom.xml index 80ed52c40f..679a26f9fb 100644 --- a/allcompute/pom.xml +++ b/allcompute/pom.xml @@ -40,11 +40,6 @@ aws-ec2 ${project.version} - - org.jclouds.provider - rimuhosting - ${project.version} - org.jclouds.api openstack-nova diff --git a/providers/pom.xml b/providers/pom.xml index f1fa7b554e..221c5e3db1 100644 --- a/providers/pom.xml +++ b/providers/pom.xml @@ -52,7 +52,6 @@ elastichosts-lon-b elastichosts-tor-p elastichosts-lax-p - rimuhosting openhosting-east1 serverlove-z1-man skalicloud-sdg-my diff --git a/providers/rimuhosting/README.txt b/providers/rimuhosting/README.txt deleted file mode 100644 index e3e65c0e87..0000000000 --- a/providers/rimuhosting/README.txt +++ /dev/null @@ -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. diff --git a/providers/rimuhosting/pom.xml b/providers/rimuhosting/pom.xml deleted file mode 100644 index 349d485434..0000000000 --- a/providers/rimuhosting/pom.xml +++ /dev/null @@ -1,126 +0,0 @@ - - - - 4.0.0 - - org.jclouds - jclouds-project - 1.6.0-SNAPSHOT - ../../project/pom.xml - - org.jclouds.provider - rimuhosting - jclouds RimuHosting provider - ComputeService implementation of RimuHosting datacenters - bundle - - - https://api.rimuhosting.com/r - 1.0 - - FIXME - - - org.jclouds.rimuhosting.miro*;version="${project.version}" - - org.jclouds.compute.internal;version="${project.version}", - org.jclouds.rest.internal;version="${project.version}", - org.jclouds*;version="${project.version}", - * - - - - - org.jclouds.driver - jclouds-jsch - ${project.version} - test - - - com.jcraft - jsch - test - - - org.jclouds - jclouds-core - ${project.version} - test-jar - test - - - org.jclouds - jclouds-compute - ${project.version} - - - org.jclouds - jclouds-compute - ${project.version} - test-jar - test - - - log4j - log4j - test - - - org.jclouds.driver - jclouds-log4j - ${project.version} - test - - - - - live - - - - org.apache.maven.plugins - maven-surefire-plugin - - - integration - integration-test - - test - - - - ${test.rimuhosting.endpoint} - ${test.rimuhosting.api-version} - ${test.rimuhosting.build-version} - ${test.rimuhosting.identity} - ${test.rimuhosting.template} - - - - - - - - - - - diff --git a/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/RimuHostingApiMetadata.java b/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/RimuHostingApiMetadata.java deleted file mode 100644 index 613ad43778..0000000000 --- a/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/RimuHostingApiMetadata.java +++ /dev/null @@ -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> CONTEXT_TOKEN = new TypeToken>() { - }; - - @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.>of(RimuHostingRestClientModule.class, RimuHostingComputeServiceContextModule.class)); - - } - - @Override - public RimuHostingApiMetadata build() { - return new RimuHostingApiMetadata(this); - } - - @Override - public Builder fromApiMetadata(ApiMetadata in) { - super.fromApiMetadata(in); - return this; - } - - } - -} diff --git a/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/RimuHostingAsyncClient.java b/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/RimuHostingAsyncClient.java deleted file mode 100644 index 03a2af5677..0000000000 --- a/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/RimuHostingAsyncClient.java +++ /dev/null @@ -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. - *

- * - * @author Ivan Meredith - * @see RimuHostingClient - * @see - */ -@RequestFilters(RimuHostingAuthentication.class) -@VirtualHost -public interface RimuHostingAsyncClient { - - /** - * @see RimuHostingClient#getImageList - */ - @GET - @Path("/distributions") - @ResponseParser(ParseImagesFromJsonResponse.class) - @Consumes(MediaType.APPLICATION_JSON) - @Fallback(ParseRimuHostingException.class) - ListenableFuture> getImageList(); - - /** - * @see RimuHostingClient#getServerList - */ - @GET - @Path("/orders;include_inactive=N") - @ResponseParser(ParseServersFromJsonResponse.class) - @Consumes(MediaType.APPLICATION_JSON) - @Fallback(ParseRimuHostingException.class) - ListenableFuture> getServerList(); - - /** - * @see RimuHostingClient#getPricingPlanList - */ - @GET - @Path("/pricing-plans;server-type=VPS") - @Consumes(MediaType.APPLICATION_JSON) - @Fallback(ParseRimuHostingException.class) - @ResponseParser(ParsePricingPlansFromJsonResponse.class) - ListenableFuture> 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 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 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 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> destroyServer(@PathParam("id") Long id); -} diff --git a/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/RimuHostingClient.java b/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/RimuHostingClient.java deleted file mode 100644 index 49dbefd102..0000000000 --- a/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/RimuHostingClient.java +++ /dev/null @@ -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. - *

- * - * @author Ivan Meredith - * @see RimuHostingAsyncClient - * @see - */ -@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 getImageList(); - - /** - * Returns a list of servers that belong to this identity. - * - * @return An empty set if there are no servers. - * @see Server - */ - Set getServerList(); - - /** - * Returns a list of pricing plans that can be used for server creation. - * - * @see PricingPlan - */ - Set 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 destroyServer(Long id); -} diff --git a/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/RimuHostingProviderMetadata.java b/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/RimuHostingProviderMetadata.java deleted file mode 100644 index 5a95586f6d..0000000000 --- a/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/RimuHostingProviderMetadata.java +++ /dev/null @@ -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; - } - - } -} diff --git a/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/binder/CreateServerOptions.java b/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/binder/CreateServerOptions.java deleted file mode 100644 index 699d961e06..0000000000 --- a/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/binder/CreateServerOptions.java +++ /dev/null @@ -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 = Lists.newArrayList(); - - @Override - public R bindToRequest(R request, Map 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) { - this.metaData = metaData; - return this; - } -} diff --git a/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/binder/RimuHostingJsonBinder.java b/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/binder/RimuHostingJsonBinder.java deleted file mode 100644 index f015dc4e5d..0000000000 --- a/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/binder/RimuHostingJsonBinder.java +++ /dev/null @@ -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 bindToRequest(R request, Map postParams) { - return bindToRequest(request, (Object) postParams); - } - - @Override - public R bindToRequest(R request, Object toBind) { - return super.bindToRequest(request, (Object) ImmutableMap.of("request", toBind)); - } -} diff --git a/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/binder/RimuHostingRebootJsonBinder.java b/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/binder/RimuHostingRebootJsonBinder.java deleted file mode 100644 index 84ff474891..0000000000 --- a/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/binder/RimuHostingRebootJsonBinder.java +++ /dev/null @@ -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 bindToRequest(R request, Map postParams) { - return super.bindToRequest(request, (Object) ImmutableMap.of("running_state", "RESTARTING")); - } -} diff --git a/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/compute/config/RimuHostingComputeServiceContextModule.java b/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/compute/config/RimuHostingComputeServiceContextModule.java deleted file mode 100755 index eded87876b..0000000000 --- a/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/compute/config/RimuHostingComputeServiceContextModule.java +++ /dev/null @@ -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 { - - @SuppressWarnings("unchecked") - @Override - protected void configure() { - super.configure(); - bind( - new TypeLiteral>() { - }).to(RimuHostingComputeServiceAdapter.class); - - bind(new TypeLiteral>() { - }).to(ServerToNodeMetadata.class); - bind(new TypeLiteral>>() { - }).to(ServerToPublicAddresses.class); - - bind(new TypeLiteral>() { - }).to(RimuHostingImageToImage.class); - - bind(new TypeLiteral>() { - }).to(Class.class.cast(IdentityFunction.class)); - - // we aren't converting location from a provider-specific type - bind(new TypeLiteral>() { - }).to(Class.class.cast(IdentityFunction.class)); - - } - - @VisibleForTesting - static final Map runningStateToNodeStatus = ImmutableMap. 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 provideServerToNodeStatus() { - return runningStateToNodeStatus; - } - - @Singleton - private static class ServerToPublicAddresses implements Function> { - @Override - public Iterable apply(Server server) { - return server.getIpAddresses() == null ? ImmutableSet. of() : Iterables.concat(ImmutableList.of(server - .getIpAddresses().getPrimaryIp()), server.getIpAddresses().getSecondaryIps()); - } - } - -} diff --git a/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/compute/functions/RimuHostingImageToImage.java b/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/compute/functions/RimuHostingImageToImage.java deleted file mode 100644 index f65bc5bed8..0000000000 --- a/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/compute/functions/RimuHostingImageToImage.java +++ /dev/null @@ -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 { - @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); - } -} diff --git a/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/compute/functions/ServerToNodeMetadata.java b/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/compute/functions/ServerToNodeMetadata.java deleted file mode 100644 index 3d5a4f8536..0000000000 --- a/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/compute/functions/ServerToNodeMetadata.java +++ /dev/null @@ -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 { - - @Resource - protected Logger logger = Logger.NULL; - - protected final Supplier> locations; - protected final Function> getPublicAddresses; - protected final Map runningStateToNodeStatus; - protected final Supplier> images; - protected final GroupNamingConvention nodeNamingConvention; - - private static class FindImageForServer implements Predicate { - 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> getPublicAddresses, - @Memoized Supplier> locations, Map runningStateToNodeStatus, - @Memoized Supplier> 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() { - - @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; - } -} diff --git a/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/compute/strategy/RimuHostingComputeServiceAdapter.java b/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/compute/strategy/RimuHostingComputeServiceAdapter.java deleted file mode 100644 index 03a1e54087..0000000000 --- a/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/compute/strategy/RimuHostingComputeServiceAdapter.java +++ /dev/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 { - @Resource - @Named(ComputeServiceConstants.COMPUTE_LOGGER) - private Logger logger = Logger.NULL; - - private final RimuHostingClient client; - private final Supplier> locations; - - @Inject - protected RimuHostingComputeServiceAdapter(RimuHostingClient client, - @Memoized Supplier> locations) { - this.client = checkNotNull(client, "client"); - this.locations = checkNotNull(locations, "locations"); - } - - @Override - public NodeAndInitialCredentials 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.getServer(), server.getServer().getId() + "", - LoginCredentials.builder().password(server.getNewInstanceRequest().getCreateOptions().getPassword()) - .build()); - } - - @Override - public Iterable listHardwareProfiles() { - final Set sizes = Sets.newHashSet(); - for (final PricingPlan from : client.getPricingPlanList()) { - try { - - final Location location = Iterables.find(locations.get(), new Predicate() { - - @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. 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 listImages() { - return Iterables2.concreteCopy(client.getImageList()); - } - - @Override - public Iterable listNodes() { - return Iterables2.concreteCopy(client.getServerList()); - } - - @Override - public Iterable listLocations() { - // Not using the adapter to determine locations - return ImmutableSet. 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() { - - @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"); - } - -} diff --git a/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/config/RimuHostingRestClientModule.java b/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/config/RimuHostingRestClientModule.java deleted file mode 100644 index aedde4e7a2..0000000000 --- a/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/config/RimuHostingRestClientModule.java +++ /dev/null @@ -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 { - - @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); - } -} diff --git a/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/data/CloneOptions.java b/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/data/CloneOptions.java deleted file mode 100644 index fc3278ba0e..0000000000 --- a/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/data/CloneOptions.java +++ /dev/null @@ -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; - } -} diff --git a/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/data/CreateOptions.java b/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/data/CreateOptions.java deleted file mode 100644 index b26d01aec0..0000000000 --- a/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/data/CreateOptions.java +++ /dev/null @@ -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 - } -} diff --git a/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/data/IpRequestData.java b/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/data/IpRequestData.java deleted file mode 100644 index 623f128172..0000000000 --- a/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/data/IpRequestData.java +++ /dev/null @@ -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; - } -} diff --git a/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/data/NewServerData.java b/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/data/NewServerData.java deleted file mode 100644 index fba5db4eaa..0000000000 --- a/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/data/NewServerData.java +++ /dev/null @@ -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; - - 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) { - this.metaData = metaData; - } - - public List getMetaData() { - return metaData; - } -} diff --git a/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/data/PostData.java b/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/data/PostData.java deleted file mode 100644 index 14df523133..0000000000 --- a/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/data/PostData.java +++ /dev/null @@ -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(); -} diff --git a/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/domain/BillingData.java b/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/domain/BillingData.java deleted file mode 100644 index 440284646f..0000000000 --- a/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/domain/BillingData.java +++ /dev/null @@ -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; - } -} diff --git a/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/domain/DataCenter.java b/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/domain/DataCenter.java deleted file mode 100644 index bb98408978..0000000000 --- a/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/domain/DataCenter.java +++ /dev/null @@ -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 { - @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; - } -} diff --git a/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/domain/DataTransferAllowance.java b/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/domain/DataTransferAllowance.java deleted file mode 100644 index 00edacbfcd..0000000000 --- a/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/domain/DataTransferAllowance.java +++ /dev/null @@ -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{ - @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(); - } -} diff --git a/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/domain/Image.java b/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/domain/Image.java deleted file mode 100644 index ccb77f99ed..0000000000 --- a/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/domain/Image.java +++ /dev/null @@ -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 { - @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; - } -} diff --git a/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/domain/IpAddresses.java b/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/domain/IpAddresses.java deleted file mode 100644 index a5c4cf16b8..0000000000 --- a/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/domain/IpAddresses.java +++ /dev/null @@ -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 secondaryIps; - - public String getPrimaryIp() { - return primaryIp; - } - - public void setPrimaryIp(String primaryIp) { - this.primaryIp = primaryIp; - } - - public SortedSet getSecondaryIps() { - return secondaryIps; - } - - public void setSecondaryIps(SortedSet secondaryIps) { - this.secondaryIps = secondaryIps; - } -} diff --git a/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/domain/MetaData.java b/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/domain/MetaData.java deleted file mode 100644 index 4e1ec6a8e3..0000000000 --- a/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/domain/MetaData.java +++ /dev/null @@ -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; - } -} diff --git a/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/domain/NewServerResponse.java b/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/domain/NewServerResponse.java deleted file mode 100644 index 9d7f034daa..0000000000 --- a/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/domain/NewServerResponse.java +++ /dev/null @@ -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 { - @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()); - } -} diff --git a/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/domain/PricingPlan.java b/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/domain/PricingPlan.java deleted file mode 100644 index 8cda738b90..0000000000 --- a/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/domain/PricingPlan.java +++ /dev/null @@ -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{ - @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()); - } -} diff --git a/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/domain/ResizeResponse.java b/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/domain/ResizeResponse.java deleted file mode 100644 index 5b5ffde687..0000000000 --- a/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/domain/ResizeResponse.java +++ /dev/null @@ -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; - } -} diff --git a/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/domain/ResizeResult.java b/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/domain/ResizeResult.java deleted file mode 100644 index 2a07abf991..0000000000 --- a/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/domain/ResizeResult.java +++ /dev/null @@ -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. - *

- * 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 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 getMessages() { - return messages; - } - - public void setMessages(List 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; - } -} diff --git a/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/domain/Server.java b/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/domain/Server.java deleted file mode 100644 index a5cf1f6b40..0000000000 --- a/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/domain/Server.java +++ /dev/null @@ -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 { - - @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; - //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) { - this.metaData = metaData; - } - - public List 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; - } -} diff --git a/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/domain/ServerInfo.java b/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/domain/ServerInfo.java deleted file mode 100644 index 95d4bcbfc7..0000000000 --- a/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/domain/ServerInfo.java +++ /dev/null @@ -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; - } -} diff --git a/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/domain/ServerParameters.java b/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/domain/ServerParameters.java deleted file mode 100644 index 3743856b26..0000000000 --- a/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/domain/ServerParameters.java +++ /dev/null @@ -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? - } -} diff --git a/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/domain/internal/RimuHostingError.java b/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/domain/internal/RimuHostingError.java deleted file mode 100644 index f238401bfa..0000000000 --- a/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/domain/internal/RimuHostingError.java +++ /dev/null @@ -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; - } -} diff --git a/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/domain/internal/RimuHostingResponse.java b/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/domain/internal/RimuHostingResponse.java deleted file mode 100644 index 8c05a8e2a9..0000000000 --- a/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/domain/internal/RimuHostingResponse.java +++ /dev/null @@ -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; - } -} diff --git a/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/domain/internal/RimuHostingTimestamp.java b/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/domain/internal/RimuHostingTimestamp.java deleted file mode 100644 index 59e24c3914..0000000000 --- a/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/domain/internal/RimuHostingTimestamp.java +++ /dev/null @@ -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); - } -} diff --git a/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/domain/internal/RunningState.java b/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/domain/internal/RunningState.java deleted file mode 100644 index 9a760fe8f5..0000000000 --- a/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/domain/internal/RunningState.java +++ /dev/null @@ -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; - } - } - -} diff --git a/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/domain/internal/ServerType.java b/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/domain/internal/ServerType.java deleted file mode 100644 index 8aeee5cbfd..0000000000 --- a/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/domain/internal/ServerType.java +++ /dev/null @@ -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 -} diff --git a/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/fallbacks/ParseRimuHostingException.java b/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/fallbacks/ParseRimuHostingException.java deleted file mode 100644 index 611a41346b..0000000000 --- a/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/fallbacks/ParseRimuHostingException.java +++ /dev/null @@ -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 { - private Json json; - - @Inject - public ParseRimuHostingException(Json json) { - this.json = json; - } - - @Override - public ListenableFuture create(Throwable t) { - if (checkNotNull(t, "throwable") instanceof HttpResponseException) { - HttpResponseException responseException = HttpResponseException.class.cast(t); - if (responseException.getContent() != null) { - Type setType = new TypeToken>() { - }.getType(); - String test = responseException.getContent(); - Map 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); - } -} diff --git a/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/filters/RimuHostingAuthentication.java b/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/filters/RimuHostingAuthentication.java deleted file mode 100644 index 16f703064b..0000000000 --- a/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/filters/RimuHostingAuthentication.java +++ /dev/null @@ -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(); - } -} diff --git a/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/functions/ParseDestroyResponseFromJsonResponse.java b/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/functions/ParseDestroyResponseFromJsonResponse.java deleted file mode 100644 index c159e436e5..0000000000 --- a/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/functions/ParseDestroyResponseFromJsonResponse.java +++ /dev/null @@ -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> { - - private final ParseJson> json; - - @Inject - ParseDestroyResponseFromJsonResponse( - ParseJson> json) { - this.json = json; - } - - @Override - public List apply(HttpResponse arg0) { - return Iterables.get(json.apply(arg0).values(), 0).cancel_messages; - } - - private static class DestroyResponse extends RimuHostingResponse { - private List cancel_messages; - } - -} diff --git a/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/functions/ParseImagesFromJsonResponse.java b/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/functions/ParseImagesFromJsonResponse.java deleted file mode 100644 index 6f18a080d2..0000000000 --- a/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/functions/ParseImagesFromJsonResponse.java +++ /dev/null @@ -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> { - - private final ParseJson> json; - - @Inject - ParseImagesFromJsonResponse(ParseJson> json) { - this.json = json; - } - - @Override - public SortedSet apply(HttpResponse arg0) { - return Iterables.get(json.apply(arg0).values(), 0).distro_infos; - } - - private static class DistroResponse extends RimuHostingResponse { - private SortedSet distro_infos; - - } - -} diff --git a/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/functions/ParsePricingPlansFromJsonResponse.java b/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/functions/ParsePricingPlansFromJsonResponse.java deleted file mode 100644 index 6a155f3a8a..0000000000 --- a/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/functions/ParsePricingPlansFromJsonResponse.java +++ /dev/null @@ -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> { - - private final ParseJson> json; - - @Inject - ParsePricingPlansFromJsonResponse(ParseJson> json) { - this.json = json; - } - - @Override - public SortedSet apply(HttpResponse arg0) { - return Iterables.get(json.apply(arg0).values(), 0).pricing_plan_infos; - } - - private static class PlansResponse extends RimuHostingResponse { - private SortedSet pricing_plan_infos; - } - -} diff --git a/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/functions/ParseServerFromJsonResponse.java b/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/functions/ParseServerFromJsonResponse.java deleted file mode 100644 index 4784cb6699..0000000000 --- a/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/functions/ParseServerFromJsonResponse.java +++ /dev/null @@ -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 { - - private final ParseJson> json; - - @Inject - ParseServerFromJsonResponse(ParseJson> 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; - } - -} diff --git a/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/functions/ParseServerInfoFromJsonResponse.java b/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/functions/ParseServerInfoFromJsonResponse.java deleted file mode 100644 index 3da698ea97..0000000000 --- a/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/functions/ParseServerInfoFromJsonResponse.java +++ /dev/null @@ -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 { - - private final ParseJson> json; - - @Inject - ParseServerInfoFromJsonResponse(ParseJson> 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; - - } -} diff --git a/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/functions/ParseServersFromJsonResponse.java b/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/functions/ParseServersFromJsonResponse.java deleted file mode 100644 index 4ac25d3a00..0000000000 --- a/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/functions/ParseServersFromJsonResponse.java +++ /dev/null @@ -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> { - - private final ParseJson> json; - - @Inject - ParseServersFromJsonResponse(ParseJson> json) { - this.json = json; - } - - @Override - public SortedSet apply(HttpResponse arg0) { - return Iterables.get(json.apply(arg0).values(), 0).about_orders; - } - - private static class OrderResponse extends RimuHostingResponse { - private SortedSet about_orders; - - } - -} diff --git a/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/location/RimuHostingDefaultLocationSupplier.java b/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/location/RimuHostingDefaultLocationSupplier.java deleted file mode 100644 index 4b4214bf00..0000000000 --- a/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/location/RimuHostingDefaultLocationSupplier.java +++ /dev/null @@ -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> locations; - private final String defaultDC; - - @Inject - RimuHostingDefaultLocationSupplier(@Memoized Supplier> locations, - @Named(TEMPLATE) String template) { - this.locations = locations; - Map 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() { - - @Override - public boolean apply(Location input) { - return input.getId().equals(defaultDC); - } - - }); - } -} diff --git a/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/location/RimuHostingLocationSupplier.java b/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/location/RimuHostingLocationSupplier.java deleted file mode 100644 index a84d0b81ef..0000000000 --- a/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/location/RimuHostingLocationSupplier.java +++ /dev/null @@ -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>>> isoCodesByIdSupplier; - - @Inject - RimuHostingLocationSupplier(@Iso3166 Set isoCodes, @Provider String providerName, @Provider Supplier endpoint, - RimuHostingClient sync, @Iso3166 Supplier>>> isoCodesByIdSupplier) { - super(providerName, endpoint, isoCodes); - this.sync = checkNotNull(sync, "sync"); - this.isoCodesByIdSupplier = checkNotNull(isoCodesByIdSupplier, "isoCodesByIdSupplier"); - } - - @Override - public Set get() { - Builder locations = ImmutableSet.builder(); - Iterable list = Iterables.filter(Iterables.transform(sync.getPricingPlanList(), - new Function() { - - @Override - public DataCenter apply(PricingPlan arg0) { - return arg0.getDataCenter(); - } - - }), Predicates.notNull()); - Location provider = Iterables.getOnlyElement(super.get()); - if (Iterables.size(list) == 0) - locations.add(provider); - else{ - Map>> 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(); - } -} diff --git a/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/predicates/ServerDestroyed.java b/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/predicates/ServerDestroyed.java deleted file mode 100644 index ffc82d8dc0..0000000000 --- a/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/predicates/ServerDestroyed.java +++ /dev/null @@ -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 { - - 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()); - } -} diff --git a/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/predicates/ServerRunning.java b/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/predicates/ServerRunning.java deleted file mode 100644 index 018ee90c5c..0000000000 --- a/providers/rimuhosting/src/main/java/org/jclouds/rimuhosting/miro/predicates/ServerRunning.java +++ /dev/null @@ -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 { - - 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()); - } -} diff --git a/providers/rimuhosting/src/main/resources/META-INF/services/org.jclouds.providers.ProviderMetadata b/providers/rimuhosting/src/main/resources/META-INF/services/org.jclouds.providers.ProviderMetadata deleted file mode 100644 index b3a6e93521..0000000000 --- a/providers/rimuhosting/src/main/resources/META-INF/services/org.jclouds.providers.ProviderMetadata +++ /dev/null @@ -1 +0,0 @@ -org.jclouds.rimuhosting.miro.RimuHostingProviderMetadata diff --git a/providers/rimuhosting/src/test/java/org/jclouds/rimuhosting/miro/RimuHostingAsyncClientTest.java b/providers/rimuhosting/src/test/java/org/jclouds/rimuhosting/miro/RimuHostingAsyncClientTest.java deleted file mode 100644 index dc1e1a64bd..0000000000 --- a/providers/rimuhosting/src/test/java/org/jclouds/rimuhosting/miro/RimuHostingAsyncClientTest.java +++ /dev/null @@ -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 { - - 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> createTypeLiteral() { - return new TypeLiteral>() { - }; - } - - @Override - public ProviderMetadata createProviderMetadata() { - return new RimuHostingProviderMetadata(); - } -} diff --git a/providers/rimuhosting/src/test/java/org/jclouds/rimuhosting/miro/RimuHostingClientLiveTest.java b/providers/rimuhosting/src/test/java/org/jclouds/rimuhosting/miro/RimuHostingClientLiveTest.java deleted file mode 100644 index f54d2acedf..0000000000 --- a/providers/rimuhosting/src/test/java/org/jclouds/rimuhosting/miro/RimuHostingClientLiveTest.java +++ /dev/null @@ -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 restContext; - - @BeforeGroups(groups = { "integration", "live" }) - @Override - public void setupContext() { - super.setupContext(); - restContext = view.unwrap(); - this.connection = restContext.getApi(); - - } - - @Test - public void testPricingPlans() { - Set plans = connection.getPricingPlanList(); - for (PricingPlan plan : plans) { - if (plan.getId().equalsIgnoreCase("MIRO4B")) { - return; - } - } - fail("MIRO4B not found"); - } - - @Test - public void testImages() { - Set 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()); - } -} diff --git a/providers/rimuhosting/src/test/java/org/jclouds/rimuhosting/miro/RimuHostingProviderTest.java b/providers/rimuhosting/src/test/java/org/jclouds/rimuhosting/miro/RimuHostingProviderTest.java deleted file mode 100644 index 2c43f53516..0000000000 --- a/providers/rimuhosting/src/test/java/org/jclouds/rimuhosting/miro/RimuHostingProviderTest.java +++ /dev/null @@ -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()); - } -} diff --git a/providers/rimuhosting/src/test/java/org/jclouds/rimuhosting/miro/compute/RimuHostingComputeServiceLiveTest.java b/providers/rimuhosting/src/test/java/org/jclouds/rimuhosting/miro/compute/RimuHostingComputeServiceLiveTest.java deleted file mode 100644 index 55fbaa3046..0000000000 --- a/providers/rimuhosting/src/test/java/org/jclouds/rimuhosting/miro/compute/RimuHostingComputeServiceLiveTest.java +++ /dev/null @@ -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 userMetadata) { - assert node.getUserMetadata().equals(ImmutableMap. 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. - } -} diff --git a/providers/rimuhosting/src/test/java/org/jclouds/rimuhosting/miro/compute/RimuHostingTemplateBuilderLiveTest.java b/providers/rimuhosting/src/test/java/org/jclouds/rimuhosting/miro/compute/RimuHostingTemplateBuilderLiveTest.java deleted file mode 100644 index 39a8323035..0000000000 --- a/providers/rimuhosting/src/test/java/org/jclouds/rimuhosting/miro/compute/RimuHostingTemplateBuilderLiveTest.java +++ /dev/null @@ -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 defineUnsupportedOperatingSystems() { - return new Predicate() { - - @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 getIso3166Codes() { - return ImmutableSet. of("NZ-AUK", "US-TX", "AU-NSW", "GB-LND"); - } -} diff --git a/providers/rimuhosting/src/test/java/org/jclouds/rimuhosting/miro/functions/ParseServerFromJsonResponseTest.java b/providers/rimuhosting/src/test/java/org/jclouds/rimuhosting/miro/functions/ParseServerFromJsonResponseTest.java deleted file mode 100644 index c9ac31c8c4..0000000000 --- a/providers/rimuhosting/src/test/java/org/jclouds/rimuhosting/miro/functions/ParseServerFromJsonResponseTest.java +++ /dev/null @@ -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")); - } - -} diff --git a/providers/rimuhosting/src/test/resources/cancelled.json b/providers/rimuhosting/src/test/resources/cancelled.json deleted file mode 100644 index f0f390bb31..0000000000 --- a/providers/rimuhosting/src/test/resources/cancelled.json +++ /dev/null @@ -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" : []}}} \ No newline at end of file diff --git a/providers/rimuhosting/src/test/resources/log4j.xml b/providers/rimuhosting/src/test/resources/log4j.xml deleted file mode 100644 index 63810d3ca0..0000000000 --- a/providers/rimuhosting/src/test/resources/log4j.xml +++ /dev/null @@ -1,151 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -