mirror of https://github.com/apache/jclouds.git
Updated @author.
git-svn-id: http://jclouds.googlecode.com/svn/trunk@2328 3d8758e0-26b5-11de-8745-db77d3ebf521
This commit is contained in:
parent
162059781d
commit
2070456c60
|
@ -34,6 +34,8 @@ import java.util.Map;
|
||||||
* Generic binder for RimuHosting POSTS/PUTS. In the form of
|
* Generic binder for RimuHosting POSTS/PUTS. In the form of
|
||||||
*
|
*
|
||||||
* {"request":{...}}
|
* {"request":{...}}
|
||||||
|
*
|
||||||
|
* @author Ivan Meredith
|
||||||
*/
|
*/
|
||||||
public class RimuHostingJsonBinder extends BindToJsonEntity {
|
public class RimuHostingJsonBinder extends BindToJsonEntity {
|
||||||
public void bindToRequest(HttpRequest request, Map<String, String> postParams) {
|
public void bindToRequest(HttpRequest request, Map<String, String> postParams) {
|
||||||
|
|
|
@ -30,6 +30,8 @@ import org.jclouds.http.HttpRequest;
|
||||||
* Need to PUT a static string
|
* Need to PUT a static string
|
||||||
*
|
*
|
||||||
* {"request":{"running_state":"RESTARTING"}
|
* {"request":{"running_state":"RESTARTING"}
|
||||||
|
*
|
||||||
|
* @author Ivan Meredith
|
||||||
*/
|
*/
|
||||||
public class RimuHostingRebootJsonBinder extends RimuHostingJsonBinder{
|
public class RimuHostingRebootJsonBinder extends RimuHostingJsonBinder{
|
||||||
public void bindToRequest(HttpRequest request, Object toBind) {
|
public void bindToRequest(HttpRequest request, Object toBind) {
|
||||||
|
|
|
@ -28,7 +28,7 @@ import com.google.gson.annotations.SerializedName;
|
||||||
/**
|
/**
|
||||||
* Options for a clone.
|
* Options for a clone.
|
||||||
* TODO: test and add contructors.
|
* TODO: test and add contructors.
|
||||||
* @author Ivan Meredith <ivan@ivan.net.nz>
|
* @author Ivan Meredith
|
||||||
*/
|
*/
|
||||||
public class CloneOptions implements PostData {
|
public class CloneOptions implements PostData {
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -29,7 +29,7 @@ import org.jclouds.rimuhosting.miro.domain.Image;
|
||||||
/**
|
/**
|
||||||
* Some options we need to create a new server/VPS.
|
* Some options we need to create a new server/VPS.
|
||||||
*
|
*
|
||||||
* @author Ivan Meredith <ivan@ivan.net.nz>
|
* @author Ivan Meredith
|
||||||
*/
|
*/
|
||||||
public class CreateOptions implements PostData{
|
public class CreateOptions implements PostData{
|
||||||
public CreateOptions(){}
|
public CreateOptions(){}
|
||||||
|
|
|
@ -29,7 +29,7 @@ import com.google.gson.annotations.SerializedName;
|
||||||
* Number of IPs VPS needs. In a separate data structure so that
|
* 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.
|
* at a later date we can add more IPs to a provisioned server.
|
||||||
*
|
*
|
||||||
* @author Ivan Meredith <ivan@ivan.net.nz>
|
* @author Ivan Meredith
|
||||||
*/
|
*/
|
||||||
public class IpRequest implements PostData {
|
public class IpRequest implements PostData {
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -25,6 +25,8 @@ package org.jclouds.rimuhosting.miro.data;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Do as much validation as possible to save http requests. No need to go overboard though.
|
* Do as much validation as possible to save http requests. No need to go overboard though.
|
||||||
|
*
|
||||||
|
* @author Ivan Meredith
|
||||||
*/
|
*/
|
||||||
public interface PostData {
|
public interface PostData {
|
||||||
public void validate();
|
public void validate();
|
||||||
|
|
|
@ -30,6 +30,8 @@ import java.sql.Timestamp;
|
||||||
/**
|
/**
|
||||||
* Billing data. Need to make it inteface with jclouds.
|
* Billing data. Need to make it inteface with jclouds.
|
||||||
* TODO: test
|
* TODO: test
|
||||||
|
*
|
||||||
|
* @author Ivan Meredith
|
||||||
*/
|
*/
|
||||||
public class BillingData {
|
public class BillingData {
|
||||||
@SerializedName("cancellation_date")
|
@SerializedName("cancellation_date")
|
||||||
|
|
|
@ -27,6 +27,8 @@ import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO: test
|
* TODO: test
|
||||||
|
*
|
||||||
|
* @author Ivan Meredith
|
||||||
*/
|
*/
|
||||||
public class DataCenter implements Comparable<DataCenter> {
|
public class DataCenter implements Comparable<DataCenter> {
|
||||||
@SerializedName("data_center_location_code")
|
@SerializedName("data_center_location_code")
|
||||||
|
|
|
@ -27,6 +27,8 @@ import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO: test
|
* TODO: test
|
||||||
|
*
|
||||||
|
* @author Ivan Meredith
|
||||||
*/
|
*/
|
||||||
public class DataTransferAllowance implements Comparable<DataTransferAllowance>{
|
public class DataTransferAllowance implements Comparable<DataTransferAllowance>{
|
||||||
@SerializedName("data_transfer_gb")
|
@SerializedName("data_transfer_gb")
|
||||||
|
|
|
@ -27,6 +27,8 @@ import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Image object.
|
* Image object.
|
||||||
|
*
|
||||||
|
* @author Ivan Meredith
|
||||||
*/
|
*/
|
||||||
public class Image implements Comparable<Image> {
|
public class Image implements Comparable<Image> {
|
||||||
@SerializedName("distro_code")
|
@SerializedName("distro_code")
|
||||||
|
|
|
@ -29,6 +29,8 @@ import org.jclouds.rimuhosting.miro.data.NewInstance;
|
||||||
/**
|
/**
|
||||||
* Instance Object.
|
* Instance Object.
|
||||||
* TODO: javadoc
|
* TODO: javadoc
|
||||||
|
*
|
||||||
|
* @author Ivan Meredith
|
||||||
*/
|
*/
|
||||||
public class Instance implements Comparable<Instance> {
|
public class Instance implements Comparable<Instance> {
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,9 @@ import com.google.gson.annotations.SerializedName;
|
||||||
import org.jclouds.rimuhosting.miro.domain.internal.RimuHostingTimestamp;
|
import org.jclouds.rimuhosting.miro.domain.internal.RimuHostingTimestamp;
|
||||||
import org.jclouds.rimuhosting.miro.domain.internal.RunningState;
|
import org.jclouds.rimuhosting.miro.domain.internal.RunningState;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Ivan Meredith
|
||||||
|
*/
|
||||||
public class InstanceInfo {
|
public class InstanceInfo {
|
||||||
/**
|
/**
|
||||||
* Whether the server pinged from the host server.
|
* Whether the server pinged from the host server.
|
||||||
|
|
|
@ -29,6 +29,8 @@ import java.util.SortedSet;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* IpAddresses assigned to an Interface. Not rimuhosting doesnt have private IPs.
|
* IpAddresses assigned to an Interface. Not rimuhosting doesnt have private IPs.
|
||||||
|
*
|
||||||
|
* @author Ivan Meredith
|
||||||
*/
|
*/
|
||||||
public class IpAddresses {
|
public class IpAddresses {
|
||||||
@SerializedName("primary_ip")
|
@SerializedName("primary_ip")
|
||||||
|
|
|
@ -29,6 +29,8 @@ import org.jclouds.rimuhosting.miro.data.NewInstance;
|
||||||
/**
|
/**
|
||||||
* Wrapper object to get back all data from a Instance create. The Password has been populated the NewInstance
|
* Wrapper object to get back all data from a Instance create. The Password has been populated the NewInstance
|
||||||
* object.
|
* object.
|
||||||
|
*
|
||||||
|
* @author Ivan Meredith
|
||||||
*/
|
*/
|
||||||
public class NewInstanceResponse implements Comparable<NewInstanceResponse> {
|
public class NewInstanceResponse implements Comparable<NewInstanceResponse> {
|
||||||
@SerializedName("about_order")
|
@SerializedName("about_order")
|
||||||
|
|
|
@ -26,6 +26,9 @@ package org.jclouds.rimuhosting.miro.domain;
|
||||||
import com.google.gson.annotations.SerializedName;
|
import com.google.gson.annotations.SerializedName;
|
||||||
import org.jclouds.rimuhosting.miro.domain.internal.ServerType;
|
import org.jclouds.rimuhosting.miro.domain.internal.ServerType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Ivan Meredith
|
||||||
|
*/
|
||||||
public class PricingPlan implements Comparable<PricingPlan>{
|
public class PricingPlan implements Comparable<PricingPlan>{
|
||||||
@SerializedName("minimum_data_transfer_allowance_gb")
|
@SerializedName("minimum_data_transfer_allowance_gb")
|
||||||
private Long dataTransfer;
|
private Long dataTransfer;
|
||||||
|
|
|
@ -27,6 +27,8 @@ import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Error Object from a response
|
* Error Object from a response
|
||||||
|
*
|
||||||
|
* @author Ivan Meredith
|
||||||
*/
|
*/
|
||||||
public class RimuHostingError {
|
public class RimuHostingError {
|
||||||
@SerializedName("error_class")
|
@SerializedName("error_class")
|
||||||
|
|
|
@ -25,6 +25,8 @@ package org.jclouds.rimuhosting.miro.domain.internal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Object that the payload on requests is wrapped in.
|
* Object that the payload on requests is wrapped in.
|
||||||
|
*
|
||||||
|
* @author Ivan Meredith
|
||||||
*/
|
*/
|
||||||
public class RimuHostingResponse {
|
public class RimuHostingResponse {
|
||||||
private String status_message;
|
private String status_message;
|
||||||
|
|
|
@ -27,6 +27,8 @@ import java.sql.Timestamp;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles a timestamp JSON object from rimuhosting
|
* Handles a timestamp JSON object from rimuhosting
|
||||||
|
*
|
||||||
|
* @author Ivan Meredith
|
||||||
*/
|
*/
|
||||||
public class RimuHostingTimestamp {
|
public class RimuHostingTimestamp {
|
||||||
private Long ms_since_epoch;
|
private Long ms_since_epoch;
|
||||||
|
|
|
@ -26,6 +26,8 @@ package org.jclouds.rimuhosting.miro.domain.internal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* States an instance can be in.
|
* States an instance can be in.
|
||||||
|
*
|
||||||
|
* @author Ivan Meredith
|
||||||
*/
|
*/
|
||||||
public enum RunningState {
|
public enum RunningState {
|
||||||
RUNNING, NOTRUNNING, RESTARTING, POWERCYCLING
|
RUNNING, NOTRUNNING, RESTARTING, POWERCYCLING
|
||||||
|
|
|
@ -26,6 +26,8 @@ package org.jclouds.rimuhosting.miro.domain.internal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Jclouds is only interested in VPS.
|
* Jclouds is only interested in VPS.
|
||||||
|
*
|
||||||
|
* @author Ivan Meredith
|
||||||
*/
|
*/
|
||||||
public enum ServerType {
|
public enum ServerType {
|
||||||
PHYSICAL, VPS
|
PHYSICAL, VPS
|
||||||
|
|
|
@ -37,6 +37,8 @@ import java.util.List;
|
||||||
* RimuHosting Authentication is a Authorization Header.
|
* RimuHosting Authentication is a Authorization Header.
|
||||||
*
|
*
|
||||||
* Authorization: rimuhosting apikey=<key>
|
* Authorization: rimuhosting apikey=<key>
|
||||||
|
*
|
||||||
|
* @author Ivan Meredith
|
||||||
*/
|
*/
|
||||||
@Singleton
|
@Singleton
|
||||||
public class RimuHostingAuthentication implements HttpRequestFilter {
|
public class RimuHostingAuthentication implements HttpRequestFilter {
|
||||||
|
|
|
@ -37,6 +37,9 @@ import java.lang.reflect.Type;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Ivan Meredith
|
||||||
|
*/
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class ParseDestroyResponseFromJsonResponse extends ParseJson<List<String>> {
|
public class ParseDestroyResponseFromJsonResponse extends ParseJson<List<String>> {
|
||||||
|
|
|
@ -38,6 +38,9 @@ import java.lang.reflect.Type;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.SortedSet;
|
import java.util.SortedSet;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Ivan Meredith
|
||||||
|
*/
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class ParseImagesFromJsonResponse extends ParseJson<SortedSet<Image>> {
|
public class ParseImagesFromJsonResponse extends ParseJson<SortedSet<Image>> {
|
||||||
|
|
|
@ -37,6 +37,9 @@ import java.io.UnsupportedEncodingException;
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Ivan Meredith
|
||||||
|
*/
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class ParseInstanceFromJsonResponse extends ParseJson<Instance> {
|
public class ParseInstanceFromJsonResponse extends ParseJson<Instance> {
|
||||||
|
|
|
@ -37,6 +37,9 @@ import java.io.UnsupportedEncodingException;
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Ivan Meredith
|
||||||
|
*/
|
||||||
@Singleton
|
@Singleton
|
||||||
public class ParseInstanceInfoFromJsonResponse extends ParseJson<InstanceInfo> {
|
public class ParseInstanceInfoFromJsonResponse extends ParseJson<InstanceInfo> {
|
||||||
@Inject
|
@Inject
|
||||||
|
|
|
@ -38,7 +38,9 @@ import java.lang.reflect.Type;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.SortedSet;
|
import java.util.SortedSet;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Ivan Meredith
|
||||||
|
*/
|
||||||
@Singleton
|
@Singleton
|
||||||
public class ParseInstancesFromJsonResponse extends ParseJson<SortedSet<Instance>> {
|
public class ParseInstancesFromJsonResponse extends ParseJson<SortedSet<Instance>> {
|
||||||
@Inject
|
@Inject
|
||||||
|
|
|
@ -37,6 +37,10 @@ import java.lang.reflect.Type;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Ivan Meredith
|
||||||
|
*/
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class ParseNewInstanceResponseFromJsonResponse extends ParseJson<NewInstanceResponse> {
|
public class ParseNewInstanceResponseFromJsonResponse extends ParseJson<NewInstanceResponse> {
|
||||||
@Inject
|
@Inject
|
||||||
|
|
|
@ -38,6 +38,9 @@ import java.lang.reflect.Type;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.SortedSet;
|
import java.util.SortedSet;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Ivan Meredith
|
||||||
|
*/
|
||||||
@Singleton
|
@Singleton
|
||||||
public class ParsePricingPlansFromJsonResponse extends ParseJson<SortedSet<PricingPlan>> {
|
public class ParsePricingPlansFromJsonResponse extends ParseJson<SortedSet<PricingPlan>> {
|
||||||
@Inject
|
@Inject
|
||||||
|
|
|
@ -36,7 +36,9 @@ import java.io.InputStreamReader;
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
/**
|
||||||
|
* @author Ivan Meredith
|
||||||
|
*/
|
||||||
@Singleton
|
@Singleton
|
||||||
public class ParseResizeResponseFromJsonResponse extends ParseJson<ParseResizeResponseFromJsonResponse.ResizeResponse> {
|
public class ParseResizeResponseFromJsonResponse extends ParseJson<ParseResizeResponseFromJsonResponse.ResizeResponse> {
|
||||||
@Inject
|
@Inject
|
||||||
|
|
|
@ -38,6 +38,8 @@ import java.util.Map;
|
||||||
* On non 2xx we have an error. RimuHosting using the same json base object.
|
* On non 2xx we have an error. RimuHosting using the same json base object.
|
||||||
*
|
*
|
||||||
* TODO: map exceptions out into something that suits jclouds.
|
* TODO: map exceptions out into something that suits jclouds.
|
||||||
|
*
|
||||||
|
* @author Ivan Meredith
|
||||||
*/
|
*/
|
||||||
@Singleton
|
@Singleton
|
||||||
public class ParseRimuHostingException implements Function<Exception, Object> {
|
public class ParseRimuHostingException implements Function<Exception, Object> {
|
||||||
|
|
|
@ -38,7 +38,7 @@ import java.util.SortedSet;
|
||||||
/**
|
/**
|
||||||
* Tests behavior of {@code RimuHostingClient}
|
* Tests behavior of {@code RimuHostingClient}
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Ivan Meredith
|
||||||
*/
|
*/
|
||||||
@Test(groups = "live", testName = "rimuhosting.RimuHostingClientLiveTest")
|
@Test(groups = "live", testName = "rimuhosting.RimuHostingClientLiveTest")
|
||||||
public class RimuHostingClientLiveTest {
|
public class RimuHostingClientLiveTest {
|
||||||
|
|
|
@ -35,7 +35,9 @@ import javax.annotation.Resource;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Ivan Meredith
|
||||||
|
*/
|
||||||
public class RimuHostingComputeClient {
|
public class RimuHostingComputeClient {
|
||||||
@Resource
|
@Resource
|
||||||
protected Logger logger = Logger.NULL;
|
protected Logger logger = Logger.NULL;
|
||||||
|
|
|
@ -1,50 +0,0 @@
|
||||||
/**
|
|
||||||
*
|
|
||||||
* Copyright (C) 2009 Cloud Conscious, LLC. <info@cloudconscious.com>
|
|
||||||
*
|
|
||||||
* ====================================================================
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
|
||||||
* or more contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. The ASF licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
* ====================================================================
|
|
||||||
*/
|
|
||||||
package org.jclouds.rimuhosting.miro.functions;
|
|
||||||
|
|
||||||
import com.google.inject.Guice;
|
|
||||||
import com.google.inject.Injector;
|
|
||||||
import org.jclouds.http.functions.config.ParserModule;
|
|
||||||
import org.jclouds.util.DateService;
|
|
||||||
import org.testng.annotations.Test;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Tests behavior of {@code ParseStatusesFromJsonResponse}
|
|
||||||
*
|
|
||||||
* @author Adrian Cole
|
|
||||||
*/
|
|
||||||
@Test(groups = "unit", testName = "twitter.ParseStatusesFromJsonResponseTest")
|
|
||||||
public class ParseStatusesFromJsonResponseTest {
|
|
||||||
|
|
||||||
Injector i = Guice.createInjector(new ParserModule() {
|
|
||||||
@Override
|
|
||||||
protected void configure() {
|
|
||||||
bind(DateTimeAdapter.class).to(CDateTimeAdapter.class);
|
|
||||||
super.configure();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
DateService dateService = new DateService();
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
Loading…
Reference in New Issue