mirror of https://github.com/apache/jclouds.git
Removed async from cloudsigma
This commit is contained in:
parent
a9cb3cf068
commit
1a6071ab92
|
@ -62,199 +62,269 @@ import org.jclouds.rest.annotations.PayloadParam;
|
|||
import org.jclouds.rest.annotations.RequestFilters;
|
||||
import org.jclouds.rest.annotations.ResponseParser;
|
||||
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
/**
|
||||
* Provides asynchronous access to CloudSigma via their REST API.
|
||||
* Provides synchronous access to CloudSigma via their REST API.
|
||||
* <p/>
|
||||
*
|
||||
* @see CloudSigmaClient
|
||||
*
|
||||
* @see <a href="http://cloudsigma.com/en/platform-details/the-api" />
|
||||
* @author Adrian Cole
|
||||
* @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(CloudSigmaClient.class)} as
|
||||
* {@link CloudSigmaAsyncClient} interface will be removed in jclouds 1.7.
|
||||
*/
|
||||
@Deprecated
|
||||
@RequestFilters(BasicAuthentication.class)
|
||||
@Consumes(MediaType.TEXT_PLAIN)
|
||||
public interface CloudSigmaAsyncClient extends Closeable {
|
||||
public interface CloudSigmaApi extends Closeable {
|
||||
|
||||
/**
|
||||
* @see CloudSigmaClient#listStandardDrives
|
||||
* list of drive uuids that are in the library
|
||||
*
|
||||
* @return or empty set if no drives are found
|
||||
*/
|
||||
@GET
|
||||
@Path("/drives/standard/list")
|
||||
@ResponseParser(SplitNewlines.class)
|
||||
ListenableFuture<Set<String>> listStandardDrives();
|
||||
Set<String> listStandardDrives();
|
||||
|
||||
/**
|
||||
* @see CloudSigmaClient#listStandardCds
|
||||
* list of cd uuids that are in the library
|
||||
*
|
||||
* @return or empty set if no cds are found
|
||||
*/
|
||||
@GET
|
||||
@Path("/drives/standard/cd/list")
|
||||
@ResponseParser(SplitNewlines.class)
|
||||
ListenableFuture<Set<String>> listStandardCds();
|
||||
Set<String> listStandardCds();
|
||||
|
||||
/**
|
||||
* @see CloudSigmaClient#listStandardImages
|
||||
* list of image uuids that are in the library
|
||||
*
|
||||
* @return or empty set if no images are found
|
||||
*/
|
||||
@GET
|
||||
@Path("/drives/standard/img/list")
|
||||
@ResponseParser(SplitNewlines.class)
|
||||
ListenableFuture<Set<String>> listStandardImages();
|
||||
Set<String> listStandardImages();
|
||||
|
||||
/**
|
||||
* @see CloudSigmaClient#cloneDrive
|
||||
* Clone an existing drive. By default, the size is the same as the source
|
||||
*
|
||||
* @param sourceUuid
|
||||
* source to clone
|
||||
* @param newName
|
||||
* name of the resulting drive
|
||||
* @param options
|
||||
* options to control size
|
||||
* @return new drive
|
||||
*/
|
||||
@POST
|
||||
@ResponseParser(KeyValuesDelimitedByBlankLinesToDriveInfo.class)
|
||||
@Path("/drives/{uuid}/clone")
|
||||
@MapBinder(BindCloneDriveOptionsToPlainTextString.class)
|
||||
ListenableFuture<DriveInfo> cloneDrive(@PathParam("uuid") String sourceUuid, @PayloadParam("name") String newName,
|
||||
CloneDriveOptions... options);
|
||||
DriveInfo cloneDrive(@PathParam("uuid") String sourceUuid, @PayloadParam("name") String newName,
|
||||
CloneDriveOptions... options);
|
||||
|
||||
/**
|
||||
* @see CloudSigmaClient#getProfileInfo
|
||||
* Get profile info
|
||||
*
|
||||
* @return info or null, if not found
|
||||
*/
|
||||
@GET
|
||||
@Path("/profile/info")
|
||||
@Fallback(NullOnNotFoundOr404.class)
|
||||
@ResponseParser(KeyValuesDelimitedByBlankLinesToProfileInfo.class)
|
||||
ListenableFuture<ProfileInfo> getProfileInfo();
|
||||
ProfileInfo getProfileInfo();
|
||||
|
||||
/**
|
||||
* @see CloudSigmaClient#listDriveInfo
|
||||
* Get all drives info
|
||||
*
|
||||
* @return or empty set if no drives are found
|
||||
*/
|
||||
@GET
|
||||
@Path("/drives/info")
|
||||
@ResponseParser(ListOfKeyValuesDelimitedByBlankLinesToDriveInfoSet.class)
|
||||
ListenableFuture<Set<DriveInfo>> listDriveInfo();
|
||||
Set<DriveInfo> listDriveInfo();
|
||||
|
||||
/**
|
||||
* @see CloudSigmaClient#getDriveInfo
|
||||
* @param uuid
|
||||
* what to get
|
||||
* @return null, if not found
|
||||
*/
|
||||
@GET
|
||||
@Fallback(NullOnNotFoundOr404.class)
|
||||
@ResponseParser(KeyValuesDelimitedByBlankLinesToDriveInfo.class)
|
||||
@Path("/drives/{uuid}/info")
|
||||
ListenableFuture<DriveInfo> getDriveInfo(@PathParam("uuid") String uuid);
|
||||
DriveInfo getDriveInfo(@PathParam("uuid") String uuid);
|
||||
|
||||
/**
|
||||
* @see CloudSigmaClient#createDrive
|
||||
* create a new drive
|
||||
*
|
||||
* @param createDrive
|
||||
* required parameters: name, size
|
||||
* @return newly created drive
|
||||
*/
|
||||
@POST
|
||||
@Fallback(NullOnNotFoundOr404.class)
|
||||
@ResponseParser(KeyValuesDelimitedByBlankLinesToDriveInfo.class)
|
||||
@Path("/drives/create")
|
||||
ListenableFuture<DriveInfo> createDrive(@BinderParam(BindDriveToPlainTextString.class) Drive createDrive);
|
||||
DriveInfo createDrive(@BinderParam(BindDriveToPlainTextString.class) Drive createDrive);
|
||||
|
||||
/**
|
||||
* @see CloudSigmaClient#setDriveData
|
||||
* set extra drive data
|
||||
*
|
||||
* @param uuid
|
||||
* what drive to change
|
||||
* @param createDrive
|
||||
* what values to change
|
||||
* @return new data
|
||||
*/
|
||||
@POST
|
||||
@ResponseParser(KeyValuesDelimitedByBlankLinesToDriveInfo.class)
|
||||
@Path("/drives/{uuid}/set")
|
||||
ListenableFuture<DriveInfo> setDriveData(@PathParam("uuid") String uuid,
|
||||
@BinderParam(BindDriveDataToPlainTextString.class) DriveData createDrive);
|
||||
DriveInfo setDriveData(@PathParam("uuid") String uuid,
|
||||
@BinderParam(BindDriveDataToPlainTextString.class) DriveData createDrive);
|
||||
|
||||
/**
|
||||
* @see CloudSigmaClient#createServer
|
||||
* create a new server
|
||||
*
|
||||
* @param createServer
|
||||
* @return newly created server
|
||||
*/
|
||||
@POST
|
||||
@Fallback(NullOnNotFoundOr404.class)
|
||||
@ResponseParser(KeyValuesDelimitedByBlankLinesToServerInfo.class)
|
||||
@Path("/servers/create")
|
||||
ListenableFuture<ServerInfo> createServer(@BinderParam(BindServerToPlainTextString.class) Server createServer);
|
||||
ServerInfo createServer(@BinderParam(BindServerToPlainTextString.class) Server createServer);
|
||||
|
||||
/**
|
||||
* @see CloudSigmaClient#listServerInfo
|
||||
* Get all servers info
|
||||
*
|
||||
* @return or empty set if no servers are found
|
||||
*/
|
||||
@GET
|
||||
@Path("/servers/info")
|
||||
@ResponseParser(ListOfKeyValuesDelimitedByBlankLinesToServerInfoSet.class)
|
||||
ListenableFuture<Set<ServerInfo>> listServerInfo();
|
||||
Set<ServerInfo> listServerInfo();
|
||||
|
||||
/**
|
||||
* @see CloudSigmaClient#getServerInfo
|
||||
* @param uuid
|
||||
* what to get
|
||||
* @return null, if not found
|
||||
*/
|
||||
@GET
|
||||
@Fallback(NullOnNotFoundOr404.class)
|
||||
@ResponseParser(KeyValuesDelimitedByBlankLinesToServerInfo.class)
|
||||
@Path("/servers/{uuid}/info")
|
||||
ListenableFuture<ServerInfo> getServerInfo(@PathParam("uuid") String uuid);
|
||||
ServerInfo getServerInfo(@PathParam("uuid") String uuid);
|
||||
|
||||
/**
|
||||
* @see CloudSigmaClient#setServerConfiguration
|
||||
* set server configuration
|
||||
*
|
||||
* @param uuid
|
||||
* what server to change
|
||||
* @param setServer
|
||||
* what values to change
|
||||
* @return new data
|
||||
*/
|
||||
@POST
|
||||
@Fallback(NullOnNotFoundOr404.class)
|
||||
@ResponseParser(KeyValuesDelimitedByBlankLinesToServerInfo.class)
|
||||
@Path("/servers/{uuid}/set")
|
||||
ListenableFuture<ServerInfo> setServerConfiguration(@PathParam("uuid") String uuid,
|
||||
@BinderParam(BindServerToPlainTextString.class) Server setServer);
|
||||
ServerInfo setServerConfiguration(@PathParam("uuid") String uuid,
|
||||
@BinderParam(BindServerToPlainTextString.class) Server setServer);
|
||||
|
||||
/**
|
||||
* @see CloudSigmaClient#listServers
|
||||
* list of server uuids in your account
|
||||
*
|
||||
* @return or empty set if no servers are found
|
||||
*/
|
||||
@GET
|
||||
@Path("/servers/list")
|
||||
@ResponseParser(SplitNewlines.class)
|
||||
ListenableFuture<Set<String>> listServers();
|
||||
Set<String> listServers();
|
||||
|
||||
/**
|
||||
* @see CloudSigmaClient#destroyServer
|
||||
* Destroy a server
|
||||
*
|
||||
* @param uuid
|
||||
* what to destroy
|
||||
*/
|
||||
@GET
|
||||
@Path("/servers/{uuid}/destroy")
|
||||
@Fallback(VoidOnNotFoundOr404.class)
|
||||
ListenableFuture<Void> destroyServer(@PathParam("uuid") String uuid);
|
||||
void destroyServer(@PathParam("uuid") String uuid);
|
||||
|
||||
/**
|
||||
* @see CloudSigmaClient#startServer
|
||||
* Start a server
|
||||
*
|
||||
* @param uuid
|
||||
* what to start
|
||||
*/
|
||||
@POST
|
||||
@Path("/servers/{uuid}/start")
|
||||
ListenableFuture<Void> startServer(@PathParam("uuid") String uuid);
|
||||
void startServer(@PathParam("uuid") String uuid);
|
||||
|
||||
/**
|
||||
* @see CloudSigmaClient#stopServer
|
||||
* Stop a server
|
||||
* <p/>
|
||||
* Kills the server immediately, equivalent to a power failure. Server reverts to a stopped
|
||||
* status if it is persistent and is automatically destroyed otherwise.
|
||||
*
|
||||
* @param uuid
|
||||
* what to stop
|
||||
*/
|
||||
@POST
|
||||
@Path("/servers/{uuid}/stop")
|
||||
ListenableFuture<Void> stopServer(@PathParam("uuid") String uuid);
|
||||
void stopServer(@PathParam("uuid") String uuid);
|
||||
|
||||
/**
|
||||
* @see CloudSigmaClient#shutdownServer
|
||||
* Shutdown a server
|
||||
* <p/>
|
||||
* Sends the server an ACPI power-down event. Server reverts to a stopped status if it is
|
||||
* persistent and is automatically destroyed otherwise.
|
||||
* <h4>note</h4> behaviour on shutdown depends on how your server OS is set up to respond to an
|
||||
* ACPI power button signal.
|
||||
*
|
||||
* @param uuid
|
||||
* what to shutdown
|
||||
*/
|
||||
@POST
|
||||
@Path("/servers/{uuid}/shutdown")
|
||||
ListenableFuture<Void> shutdownServer(@PathParam("uuid") String uuid);
|
||||
void shutdownServer(@PathParam("uuid") String uuid);
|
||||
|
||||
/**
|
||||
* @see CloudSigmaClient#resetServer
|
||||
* Reset a server
|
||||
*
|
||||
* @param uuid
|
||||
* what to reset
|
||||
*/
|
||||
@POST
|
||||
@Path("/servers/{uuid}/reset")
|
||||
ListenableFuture<Void> resetServer(@PathParam("uuid") String uuid);
|
||||
void resetServer(@PathParam("uuid") String uuid);
|
||||
|
||||
/**
|
||||
* @see CloudSigmaClient#listDrives
|
||||
* list of drive uuids in your account
|
||||
*
|
||||
* @return or empty set if no drives are found
|
||||
*/
|
||||
@GET
|
||||
@Path("/drives/list")
|
||||
@ResponseParser(SplitNewlines.class)
|
||||
ListenableFuture<Set<String>> listDrives();
|
||||
Set<String> listDrives();
|
||||
|
||||
/**
|
||||
* @see CloudSigmaClient#destroyDrive
|
||||
* Destroy a drive
|
||||
*
|
||||
* @param uuid
|
||||
* what to delete
|
||||
*/
|
||||
@GET
|
||||
@Path("/drives/{uuid}/destroy")
|
||||
@Fallback(VoidOnNotFoundOr404.class)
|
||||
ListenableFuture<Void> destroyDrive(@PathParam("uuid") String uuid);
|
||||
void destroyDrive(@PathParam("uuid") String uuid);
|
||||
|
||||
/**
|
||||
* @see CloudSigmaClient#createVLAN
|
||||
* create a new vlan
|
||||
*
|
||||
* @param name
|
||||
* @return newly created vlan
|
||||
*/
|
||||
@POST
|
||||
@Fallback(NullOnNotFoundOr404.class)
|
||||
|
@ -262,91 +332,117 @@ public interface CloudSigmaAsyncClient extends Closeable {
|
|||
@Path("/resources/vlan/create")
|
||||
@Payload("name {name}\n")
|
||||
@Produces(MediaType.TEXT_PLAIN)
|
||||
ListenableFuture<VLANInfo> createVLAN(@PayloadParam("name") String name);
|
||||
VLANInfo createVLAN(@PayloadParam("name") String name);
|
||||
|
||||
/**
|
||||
* @see CloudSigmaClient#listVLANInfo
|
||||
* Get all vlans info
|
||||
*
|
||||
* @return or empty set if no vlans are found
|
||||
*/
|
||||
@GET
|
||||
@Path("/resources/vlan/info")
|
||||
@ResponseParser(ListOfKeyValuesDelimitedByBlankLinesToVLANInfoSet.class)
|
||||
ListenableFuture<Set<VLANInfo>> listVLANInfo();
|
||||
Set<VLANInfo> listVLANInfo();
|
||||
|
||||
/**
|
||||
* @see CloudSigmaClient#getVLANInfo
|
||||
* @param uuid
|
||||
* what to get
|
||||
* @return null, if not found
|
||||
*/
|
||||
@GET
|
||||
@Fallback(NullOnNotFoundOr404.class)
|
||||
@ResponseParser(KeyValuesDelimitedByBlankLinesToVLANInfo.class)
|
||||
@Path("/resources/vlan/{uuid}/info")
|
||||
ListenableFuture<VLANInfo> getVLANInfo(@PathParam("uuid") String uuid);
|
||||
VLANInfo getVLANInfo(@PathParam("uuid") String uuid);
|
||||
|
||||
/**
|
||||
* @see CloudSigmaClient#setVLANConfiguration
|
||||
* set vlan configuration
|
||||
*
|
||||
* @param uuid
|
||||
* what vlan to change
|
||||
* @param name
|
||||
* what the new name is
|
||||
* @return new data
|
||||
*/
|
||||
@POST
|
||||
@ResponseParser(KeyValuesDelimitedByBlankLinesToVLANInfo.class)
|
||||
@Path("/resources/vlan/{uuid}/set")
|
||||
@Payload("name {name}\n")
|
||||
@Produces(MediaType.TEXT_PLAIN)
|
||||
ListenableFuture<VLANInfo> renameVLAN(@PathParam("uuid") String uuid, @PayloadParam("name") String name);
|
||||
VLANInfo renameVLAN(@PathParam("uuid") String uuid, @PayloadParam("name") String name);
|
||||
|
||||
/**
|
||||
* @see CloudSigmaClient#listVLANs
|
||||
* list of vlan uuids in your account
|
||||
*
|
||||
* @return or empty set if no vlans are found
|
||||
*/
|
||||
@GET
|
||||
@Path("/resources/vlan/list")
|
||||
@ResponseParser(SplitNewlinesAndReturnSecondField.class)
|
||||
ListenableFuture<Set<String>> listVLANs();
|
||||
Set<String> listVLANs();
|
||||
|
||||
/**
|
||||
* @see CloudSigmaClient#destroyVLAN
|
||||
* Destroy a vlan
|
||||
*
|
||||
* @param uuid
|
||||
* what to destroy
|
||||
*/
|
||||
@GET
|
||||
@Path("/resources/vlan/{uuid}/destroy")
|
||||
@Fallback(VoidOnNotFoundOr404.class)
|
||||
ListenableFuture<Void> destroyVLAN(@PathParam("uuid") String uuid);
|
||||
void destroyVLAN(@PathParam("uuid") String uuid);
|
||||
|
||||
/**
|
||||
* @see CloudSigmaClient#createStaticIP
|
||||
* create a new ip
|
||||
*
|
||||
* @return newly created ip
|
||||
*/
|
||||
@POST
|
||||
@Fallback(NullOnNotFoundOr404.class)
|
||||
@ResponseParser(KeyValuesDelimitedByBlankLinesToStaticIPInfo.class)
|
||||
@Path("/resources/ip/create")
|
||||
ListenableFuture<StaticIPInfo> createStaticIP();
|
||||
StaticIPInfo createStaticIP();
|
||||
|
||||
/**
|
||||
* @see CloudSigmaClient#listStaticIPInfo
|
||||
* Get all ips info
|
||||
*
|
||||
* @return or empty set if no ips are found
|
||||
*/
|
||||
@GET
|
||||
@Path("/resources/ip/info")
|
||||
@ResponseParser(ListOfKeyValuesDelimitedByBlankLinesToStaticIPInfoSet.class)
|
||||
ListenableFuture<Set<StaticIPInfo>> listStaticIPInfo();
|
||||
Set<StaticIPInfo> listStaticIPInfo();
|
||||
|
||||
/**
|
||||
* @see CloudSigmaClient#getStaticIPInfo
|
||||
* @param uuid
|
||||
* what to get
|
||||
* @return null, if not found
|
||||
*/
|
||||
@GET
|
||||
@Fallback(NullOnNotFoundOr404.class)
|
||||
@ResponseParser(KeyValuesDelimitedByBlankLinesToStaticIPInfo.class)
|
||||
@Path("/resources/ip/{uuid}/info")
|
||||
ListenableFuture<StaticIPInfo> getStaticIPInfo(@PathParam("uuid") String uuid);
|
||||
StaticIPInfo getStaticIPInfo(@PathParam("uuid") String uuid);
|
||||
|
||||
/**
|
||||
* @see CloudSigmaClient#listStaticIPs
|
||||
* list of ip uuids in your account
|
||||
*
|
||||
* @return or empty set if no ips are found
|
||||
*/
|
||||
@GET
|
||||
@Path("/resources/ip/list")
|
||||
@ResponseParser(SplitNewlinesAndReturnSecondField.class)
|
||||
ListenableFuture<Set<String>> listStaticIPs();
|
||||
Set<String> listStaticIPs();
|
||||
|
||||
/**
|
||||
* @see CloudSigmaClient#destroyStaticIP
|
||||
* Destroy a ip
|
||||
*
|
||||
* @param uuid
|
||||
* what to destroy
|
||||
*/
|
||||
@GET
|
||||
@Path("/resources/ip/{uuid}/destroy")
|
||||
@Fallback(VoidOnNotFoundOr404.class)
|
||||
ListenableFuture<Void> destroyStaticIP(@PathParam("uuid") String uuid);
|
||||
void destroyStaticIP(@PathParam("uuid") String uuid);
|
||||
|
||||
}
|
|
@ -26,10 +26,9 @@ import org.jclouds.apis.ApiMetadata;
|
|||
import org.jclouds.cloudsigma.compute.config.CloudSigmaComputeServiceContextModule;
|
||||
import org.jclouds.cloudsigma.config.CloudSigmaRestClientModule;
|
||||
import org.jclouds.compute.ComputeServiceContext;
|
||||
import org.jclouds.rest.internal.BaseRestApiMetadata;
|
||||
import org.jclouds.rest.internal.BaseHttpApiMetadata;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.reflect.TypeToken;
|
||||
import com.google.inject.Module;
|
||||
|
||||
/**
|
||||
|
@ -37,17 +36,9 @@ import com.google.inject.Module;
|
|||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
public class CloudSigmaApiMetadata extends BaseRestApiMetadata {
|
||||
public class CloudSigmaApiMetadata extends BaseHttpApiMetadata<CloudSigmaApi> {
|
||||
|
||||
|
||||
/**
|
||||
* @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(CloudSigmaClient.class)} as
|
||||
* {@link CloudSigmaAsyncClient} interface will be removed in jclouds 1.7.
|
||||
*/
|
||||
@Deprecated
|
||||
public static final TypeToken<org.jclouds.rest.RestContext<CloudSigmaClient, CloudSigmaAsyncClient>> CONTEXT_TOKEN = new TypeToken<org.jclouds.rest.RestContext<CloudSigmaClient, CloudSigmaAsyncClient>>() {
|
||||
private static final long serialVersionUID = 1L;
|
||||
};
|
||||
|
||||
@Override
|
||||
public Builder toBuilder() {
|
||||
return new Builder().fromApiMetadata(this);
|
||||
|
@ -62,7 +53,7 @@ public class CloudSigmaApiMetadata extends BaseRestApiMetadata {
|
|||
}
|
||||
|
||||
public static Properties defaultProperties() {
|
||||
Properties properties = BaseRestApiMetadata.defaultProperties();
|
||||
Properties properties = BaseHttpApiMetadata.defaultProperties();
|
||||
properties.setProperty(PROPERTY_VNC_PASSWORD, "IL9vs34d");
|
||||
// passwords are set post-boot, so auth failures are possible
|
||||
// from a race condition applying the password set script
|
||||
|
@ -72,11 +63,9 @@ public class CloudSigmaApiMetadata extends BaseRestApiMetadata {
|
|||
return properties;
|
||||
}
|
||||
|
||||
public static class Builder extends BaseRestApiMetadata.Builder<Builder> {
|
||||
public static class Builder extends BaseHttpApiMetadata.Builder<CloudSigmaApi, Builder> {
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
protected Builder() {
|
||||
super(CloudSigmaClient.class, CloudSigmaAsyncClient.class);
|
||||
id("cloudsigma")
|
||||
.name("CloudSigma API")
|
||||
.identityName("Email")
|
||||
|
|
|
@ -1,304 +0,0 @@
|
|||
/*
|
||||
* 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.cloudsigma;
|
||||
|
||||
import java.io.Closeable;
|
||||
import java.util.Set;
|
||||
|
||||
import org.jclouds.cloudsigma.domain.Drive;
|
||||
import org.jclouds.cloudsigma.domain.DriveData;
|
||||
import org.jclouds.cloudsigma.domain.DriveInfo;
|
||||
import org.jclouds.cloudsigma.domain.ProfileInfo;
|
||||
import org.jclouds.cloudsigma.domain.Server;
|
||||
import org.jclouds.cloudsigma.domain.ServerInfo;
|
||||
import org.jclouds.cloudsigma.domain.StaticIPInfo;
|
||||
import org.jclouds.cloudsigma.domain.VLANInfo;
|
||||
import org.jclouds.cloudsigma.options.CloneDriveOptions;
|
||||
|
||||
/**
|
||||
* Provides synchronous access to CloudSigma.
|
||||
* <p/>
|
||||
*
|
||||
* @see CloudSigmaAsyncClient
|
||||
* @see <a href="TODO: insert URL of cloudsigma documentation" />
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
public interface CloudSigmaClient extends Closeable {
|
||||
|
||||
/**
|
||||
* Get profile info
|
||||
*
|
||||
* @return info or null, if not found
|
||||
*/
|
||||
ProfileInfo getProfileInfo();
|
||||
|
||||
/**
|
||||
* list of server uuids in your account
|
||||
*
|
||||
* @return or empty set if no servers are found
|
||||
*/
|
||||
Set<String> listServers();
|
||||
|
||||
/**
|
||||
* Get all servers info
|
||||
*
|
||||
* @return or empty set if no servers are found
|
||||
*/
|
||||
Set<? extends ServerInfo> listServerInfo();
|
||||
|
||||
/**
|
||||
* @param uuid
|
||||
* what to get
|
||||
* @return null, if not found
|
||||
*/
|
||||
ServerInfo getServerInfo(String uuid);
|
||||
|
||||
/**
|
||||
* create a new server
|
||||
*
|
||||
* @param server
|
||||
* @return newly created server
|
||||
*/
|
||||
ServerInfo createServer(Server server);
|
||||
|
||||
/**
|
||||
* set server configuration
|
||||
*
|
||||
* @param uuid
|
||||
* what server to change
|
||||
* @param serverData
|
||||
* what values to change
|
||||
* @return new data
|
||||
*/
|
||||
ServerInfo setServerConfiguration(String uuid, Server server);
|
||||
|
||||
/**
|
||||
* Destroy a server
|
||||
*
|
||||
* @param uuid
|
||||
* what to destroy
|
||||
*/
|
||||
void destroyServer(String uuid);
|
||||
|
||||
/**
|
||||
* Start a server
|
||||
*
|
||||
* @param uuid
|
||||
* what to start
|
||||
*/
|
||||
void startServer(String uuid);
|
||||
|
||||
/**
|
||||
* Stop a server
|
||||
* <p/>
|
||||
* Kills the server immediately, equivalent to a power failure. Server reverts to a stopped
|
||||
* status if it is persistent and is automatically destroyed otherwise.
|
||||
*
|
||||
* @param uuid
|
||||
* what to stop
|
||||
*/
|
||||
void stopServer(String uuid);
|
||||
|
||||
/**
|
||||
* Shutdown a server
|
||||
* <p/>
|
||||
* Sends the server an ACPI power-down event. Server reverts to a stopped status if it is
|
||||
* persistent and is automatically destroyed otherwise.
|
||||
* <h4>note</h4> behaviour on shutdown depends on how your server OS is set up to respond to an
|
||||
* ACPI power button signal.
|
||||
*
|
||||
* @param uuid
|
||||
* what to shutdown
|
||||
*/
|
||||
void shutdownServer(String uuid);
|
||||
|
||||
/**
|
||||
* Reset a server
|
||||
*
|
||||
* @param uuid
|
||||
* what to reset
|
||||
*/
|
||||
void resetServer(String uuid);
|
||||
|
||||
/**
|
||||
* list of drive uuids in your account
|
||||
*
|
||||
* @return or empty set if no drives are found
|
||||
*/
|
||||
Set<String> listDrives();
|
||||
|
||||
/**
|
||||
* Get all drives info
|
||||
*
|
||||
* @return or empty set if no drives are found
|
||||
*/
|
||||
Set<? extends DriveInfo> listDriveInfo();
|
||||
|
||||
/**
|
||||
* @param uuid
|
||||
* what to get
|
||||
* @return null, if not found
|
||||
*/
|
||||
DriveInfo getDriveInfo(String uuid);
|
||||
|
||||
/**
|
||||
* create a new drive
|
||||
*
|
||||
* @param createDrive
|
||||
* required parameters: name, size
|
||||
* @return newly created drive
|
||||
*/
|
||||
DriveInfo createDrive(Drive createDrive);
|
||||
|
||||
/**
|
||||
* set extra drive data
|
||||
*
|
||||
* @param uuid
|
||||
* what drive to change
|
||||
* @param driveData
|
||||
* what values to change
|
||||
* @return new data
|
||||
*/
|
||||
DriveInfo setDriveData(String uuid, DriveData driveData);
|
||||
|
||||
/**
|
||||
* Destroy a drive
|
||||
*
|
||||
* @param uuid
|
||||
* what to delete
|
||||
*/
|
||||
void destroyDrive(String uuid);
|
||||
|
||||
/**
|
||||
* list of drive uuids that are in the library
|
||||
*
|
||||
* @return or empty set if no drives are found
|
||||
*/
|
||||
Set<String> listStandardDrives();
|
||||
|
||||
/**
|
||||
* list of cd uuids that are in the library
|
||||
*
|
||||
* @return or empty set if no cds are found
|
||||
*/
|
||||
Set<String> listStandardCds();
|
||||
|
||||
/**
|
||||
* list of image uuids that are in the library
|
||||
*
|
||||
* @return or empty set if no images are found
|
||||
*/
|
||||
Set<String> listStandardImages();
|
||||
|
||||
/**
|
||||
* Clone an existing drive. By default, the size is the same as the source
|
||||
*
|
||||
* @param sourceUuid
|
||||
* source to clone
|
||||
* @param newName
|
||||
* name of the resulting drive
|
||||
* @param options
|
||||
* options to control size
|
||||
* @return new drive
|
||||
*/
|
||||
DriveInfo cloneDrive(String sourceUuid, String newName, CloneDriveOptions... options);
|
||||
|
||||
/**
|
||||
* list of vlan uuids in your account
|
||||
*
|
||||
* @return or empty set if no vlans are found
|
||||
*/
|
||||
Set<String> listVLANs();
|
||||
|
||||
/**
|
||||
* Get all vlans info
|
||||
*
|
||||
* @return or empty set if no vlans are found
|
||||
*/
|
||||
Set<? extends VLANInfo> listVLANInfo();
|
||||
|
||||
/**
|
||||
* @param uuid
|
||||
* what to get
|
||||
* @return null, if not found
|
||||
*/
|
||||
VLANInfo getVLANInfo(String uuid);
|
||||
|
||||
/**
|
||||
* create a new vlan
|
||||
*
|
||||
* @param vlan
|
||||
* @return newly created vlan
|
||||
*/
|
||||
VLANInfo createVLAN(String name);
|
||||
|
||||
/**
|
||||
* set vlan configuration
|
||||
*
|
||||
* @param uuid
|
||||
* what vlan to change
|
||||
* @param newName
|
||||
* what the new name is
|
||||
* @return new data
|
||||
*/
|
||||
VLANInfo renameVLAN(String uuid, String newName);
|
||||
|
||||
/**
|
||||
* Destroy a vlan
|
||||
*
|
||||
* @param uuid
|
||||
* what to destroy
|
||||
*/
|
||||
void destroyVLAN(String uuid);
|
||||
|
||||
/**
|
||||
* list of ip uuids in your account
|
||||
*
|
||||
* @return or empty set if no ips are found
|
||||
*/
|
||||
Set<String> listStaticIPs();
|
||||
|
||||
/**
|
||||
* Get all ips info
|
||||
*
|
||||
* @return or empty set if no ips are found
|
||||
*/
|
||||
Set<? extends StaticIPInfo> listStaticIPInfo();
|
||||
|
||||
/**
|
||||
* @param uuid
|
||||
* what to get
|
||||
* @return null, if not found
|
||||
*/
|
||||
StaticIPInfo getStaticIPInfo(String uuid);
|
||||
|
||||
/**
|
||||
* create a new ip
|
||||
*
|
||||
* @return newly created ip
|
||||
*/
|
||||
StaticIPInfo createStaticIP();
|
||||
|
||||
/**
|
||||
* Destroy a ip
|
||||
*
|
||||
* @param uuid
|
||||
* what to destroy
|
||||
*/
|
||||
void destroyStaticIP(String uuid);
|
||||
|
||||
}
|
|
@ -28,7 +28,7 @@ import javax.inject.Named;
|
|||
import javax.inject.Singleton;
|
||||
|
||||
import org.jclouds.Constants;
|
||||
import org.jclouds.cloudsigma.CloudSigmaClient;
|
||||
import org.jclouds.cloudsigma.CloudSigmaApi;
|
||||
import org.jclouds.cloudsigma.compute.options.CloudSigmaTemplateOptions;
|
||||
import org.jclouds.cloudsigma.domain.AffinityType;
|
||||
import org.jclouds.cloudsigma.domain.Device;
|
||||
|
@ -62,14 +62,13 @@ import com.google.common.collect.FluentIterable;
|
|||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.ImmutableSet.Builder;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.util.concurrent.Futures;
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
import com.google.common.util.concurrent.ListeningExecutorService;
|
||||
import com.google.common.util.concurrent.UncheckedExecutionException;
|
||||
|
||||
/**
|
||||
* defines the connection between the {@link CloudSigmaClient} implementation
|
||||
* defines the connection between the {@link org.jclouds.cloudsigma.CloudSigmaApi} implementation
|
||||
* and the jclouds {@link ComputeService}
|
||||
*
|
||||
*/
|
||||
|
@ -85,7 +84,7 @@ public class CloudSigmaComputeServiceAdapter implements
|
|||
}
|
||||
|
||||
});
|
||||
private final CloudSigmaClient client;
|
||||
private final CloudSigmaApi client;
|
||||
private final Predicate<DriveInfo> driveNotClaimed;
|
||||
private final String defaultVncPassword;
|
||||
private final LoadingCache<String, DriveInfo> cache;
|
||||
|
@ -96,7 +95,7 @@ public class CloudSigmaComputeServiceAdapter implements
|
|||
protected Logger logger = Logger.NULL;
|
||||
|
||||
@Inject
|
||||
public CloudSigmaComputeServiceAdapter(CloudSigmaClient client, Predicate<DriveInfo> driveNotClaimed,
|
||||
public CloudSigmaComputeServiceAdapter(CloudSigmaApi client, Predicate<DriveInfo> driveNotClaimed,
|
||||
@Named(CloudSigmaConstants.PROPERTY_VNC_PASSWORD) String defaultVncPassword,
|
||||
LoadingCache<String, DriveInfo> cache, @Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor) {
|
||||
this.client = checkNotNull(client, "client");
|
||||
|
|
|
@ -22,7 +22,7 @@ import static org.jclouds.util.Predicates2.retry;
|
|||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import org.jclouds.cloudsigma.CloudSigmaClient;
|
||||
import org.jclouds.cloudsigma.CloudSigmaApi;
|
||||
import org.jclouds.cloudsigma.compute.CloudSigmaComputeServiceAdapter;
|
||||
import org.jclouds.cloudsigma.compute.CloudSigmaTemplateBuilderImpl;
|
||||
import org.jclouds.cloudsigma.compute.functions.ParseOsFamilyVersion64BitFromImageName;
|
||||
|
@ -97,10 +97,10 @@ public class CloudSigmaComputeServiceContextModule extends
|
|||
|
||||
@Singleton
|
||||
public static class GetDrive extends CacheLoader<String, DriveInfo> {
|
||||
private final CloudSigmaClient client;
|
||||
private final CloudSigmaApi client;
|
||||
|
||||
@Inject
|
||||
public GetDrive(CloudSigmaClient client) {
|
||||
public GetDrive(CloudSigmaApi client) {
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
|
|
|
@ -19,8 +19,7 @@ package org.jclouds.cloudsigma.config;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.jclouds.cloudsigma.CloudSigmaAsyncClient;
|
||||
import org.jclouds.cloudsigma.CloudSigmaClient;
|
||||
import org.jclouds.cloudsigma.CloudSigmaApi;
|
||||
import org.jclouds.cloudsigma.domain.Device;
|
||||
import org.jclouds.cloudsigma.domain.Drive;
|
||||
import org.jclouds.cloudsigma.domain.DriveData;
|
||||
|
@ -42,7 +41,7 @@ import org.jclouds.http.annotation.ClientError;
|
|||
import org.jclouds.http.annotation.Redirection;
|
||||
import org.jclouds.http.annotation.ServerError;
|
||||
import org.jclouds.rest.ConfiguresRestClient;
|
||||
import org.jclouds.rest.config.RestClientModule;
|
||||
import org.jclouds.rest.config.HttpApiModule;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.inject.TypeLiteral;
|
||||
|
@ -53,7 +52,7 @@ import com.google.inject.TypeLiteral;
|
|||
* @author Adrian Cole
|
||||
*/
|
||||
@ConfiguresRestClient
|
||||
public class CloudSigmaRestClientModule extends RestClientModule<CloudSigmaClient, CloudSigmaAsyncClient> {
|
||||
public class CloudSigmaRestClientModule extends HttpApiModule<CloudSigmaApi> {
|
||||
|
||||
@Override
|
||||
protected void bindErrorHandlers() {
|
||||
|
|
|
@ -22,7 +22,7 @@ import javax.annotation.Resource;
|
|||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import org.jclouds.cloudsigma.CloudSigmaClient;
|
||||
import org.jclouds.cloudsigma.CloudSigmaApi;
|
||||
import org.jclouds.cloudsigma.domain.DriveInfo;
|
||||
import org.jclouds.logging.Logger;
|
||||
|
||||
|
@ -35,13 +35,13 @@ import com.google.common.base.Predicate;
|
|||
@Singleton
|
||||
public class DriveClaimed implements Predicate<DriveInfo> {
|
||||
|
||||
private final CloudSigmaClient client;
|
||||
private final CloudSigmaApi client;
|
||||
|
||||
@Resource
|
||||
protected Logger logger = Logger.NULL;
|
||||
|
||||
@Inject
|
||||
public DriveClaimed(CloudSigmaClient client) {
|
||||
public DriveClaimed(CloudSigmaApi client) {
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
*/
|
||||
package org.jclouds.cloudsigma.util;
|
||||
|
||||
import org.jclouds.cloudsigma.CloudSigmaClient;
|
||||
import org.jclouds.cloudsigma.domain.IDEDevice;
|
||||
import org.jclouds.cloudsigma.domain.Model;
|
||||
import org.jclouds.cloudsigma.domain.NIC;
|
||||
|
@ -69,7 +68,7 @@ public class Servers {
|
|||
|
||||
/**
|
||||
* Takes the input server and changes its primary ip to a new address. To make this happen,
|
||||
* you'll need to invoke {@link CloudSigmaClient#setServerConfiguration}
|
||||
* you'll need to invoke {@link org.jclouds.cloudsigma.CloudSigmaApi#setServerConfiguration}
|
||||
*
|
||||
* @param in
|
||||
* server to change
|
||||
|
|
|
@ -53,16 +53,16 @@ import com.google.common.collect.ImmutableList;
|
|||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.reflect.Invokable;
|
||||
/**
|
||||
* Tests behavior of {@code CloudSigmaAsyncClient}
|
||||
* Tests behavior of {@code CloudSigmaApi}
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire
|
||||
@Test(groups = "unit", testName = "CloudSigmaAsyncClientTest")
|
||||
public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsyncClient> {
|
||||
@Test(groups = "unit", testName = "CloudSigmaApiTest")
|
||||
public class CloudSigmaApiTest extends BaseAsyncClientTest<CloudSigmaApi> {
|
||||
|
||||
public void testGetProfileInfo() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = method(CloudSigmaAsyncClient.class, "getProfileInfo");
|
||||
Invokable<?, ?> method = method(CloudSigmaApi.class, "getProfileInfo");
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.cloudsigma.com/profile/info HTTP/1.1");
|
||||
|
@ -78,7 +78,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
|
|||
}
|
||||
|
||||
public void testListStandardDrives() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = method(CloudSigmaAsyncClient.class, "listStandardDrives");
|
||||
Invokable<?, ?> method = method(CloudSigmaApi.class, "listStandardDrives");
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.cloudsigma.com/drives/standard/list HTTP/1.1");
|
||||
|
@ -93,7 +93,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
|
|||
}
|
||||
|
||||
public void testListStandardCds() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = method(CloudSigmaAsyncClient.class, "listStandardCds");
|
||||
Invokable<?, ?> method = method(CloudSigmaApi.class, "listStandardCds");
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.cloudsigma.com/drives/standard/cd/list HTTP/1.1");
|
||||
|
@ -108,7 +108,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
|
|||
}
|
||||
|
||||
public void testListStandardImages() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = method(CloudSigmaAsyncClient.class, "listStandardImages");
|
||||
Invokable<?, ?> method = method(CloudSigmaApi.class, "listStandardImages");
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.cloudsigma.com/drives/standard/img/list HTTP/1.1");
|
||||
|
@ -123,7 +123,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
|
|||
}
|
||||
|
||||
public void testListDriveInfo() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = method(CloudSigmaAsyncClient.class, "listDriveInfo");
|
||||
Invokable<?, ?> method = method(CloudSigmaApi.class, "listDriveInfo");
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.cloudsigma.com/drives/info HTTP/1.1");
|
||||
|
@ -138,7 +138,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
|
|||
}
|
||||
|
||||
public void testGetDriveInfo() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = method(CloudSigmaAsyncClient.class, "getDriveInfo", String.class);
|
||||
Invokable<?, ?> method = method(CloudSigmaApi.class, "getDriveInfo", String.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("uuid"));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.cloudsigma.com/drives/uuid/info HTTP/1.1");
|
||||
|
@ -154,7 +154,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
|
|||
}
|
||||
|
||||
public void testCreateDrive() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = method(CloudSigmaAsyncClient.class, "createDrive", Drive.class);
|
||||
Invokable<?, ?> method = method(CloudSigmaApi.class, "createDrive", Drive.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(
|
||||
new CreateDriveRequest.Builder().name("foo").use(ImmutableList.of("production", "candy")).size(10000l)
|
||||
.build()));
|
||||
|
@ -172,7 +172,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
|
|||
}
|
||||
|
||||
public void testCloneDrive() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = method(CloudSigmaAsyncClient.class, "cloneDrive", String.class, String.class,
|
||||
Invokable<?, ?> method = method(CloudSigmaApi.class, "cloneDrive", String.class, String.class,
|
||||
CloneDriveOptions[].class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("sourceid", "newname"));
|
||||
|
||||
|
@ -189,7 +189,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
|
|||
}
|
||||
|
||||
public void testCloneDriveOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = method(CloudSigmaAsyncClient.class, "cloneDrive", String.class, String.class,
|
||||
Invokable<?, ?> method = method(CloudSigmaApi.class, "cloneDrive", String.class, String.class,
|
||||
CloneDriveOptions[].class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("sourceid", "newname",
|
||||
new CloneDriveOptions().size(1024l)));
|
||||
|
@ -207,7 +207,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
|
|||
}
|
||||
|
||||
public void testSetDriveData() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = method(CloudSigmaAsyncClient.class, "setDriveData", String.class, DriveData.class);
|
||||
Invokable<?, ?> method = method(CloudSigmaApi.class, "setDriveData", String.class, DriveData.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("100", new DriveData.Builder().name("foo").size(10000l)
|
||||
.use(ImmutableList.of("production", "candy")).build()));
|
||||
|
||||
|
@ -224,7 +224,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
|
|||
}
|
||||
|
||||
public void testListServers() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = method(CloudSigmaAsyncClient.class, "listServers");
|
||||
Invokable<?, ?> method = method(CloudSigmaApi.class, "listServers");
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.cloudsigma.com/servers/list HTTP/1.1");
|
||||
|
@ -251,7 +251,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
|
|||
}
|
||||
|
||||
public void testListServerInfo() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = method(CloudSigmaAsyncClient.class, "listServerInfo");
|
||||
Invokable<?, ?> method = method(CloudSigmaApi.class, "listServerInfo");
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.cloudsigma.com/servers/info HTTP/1.1");
|
||||
|
@ -266,7 +266,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
|
|||
}
|
||||
|
||||
public void testGetServerInfo() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = method(CloudSigmaAsyncClient.class, "getServerInfo", String.class);
|
||||
Invokable<?, ?> method = method(CloudSigmaApi.class, "getServerInfo", String.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("uuid"));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.cloudsigma.com/servers/uuid/info HTTP/1.1");
|
||||
|
@ -282,7 +282,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
|
|||
}
|
||||
|
||||
public void testCreateServer() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = method(CloudSigmaAsyncClient.class, "createServer", Server.class);
|
||||
Invokable<?, ?> method = method(CloudSigmaApi.class, "createServer", Server.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(BindServerToPlainTextStringTest.SERVER));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "POST https://api.cloudsigma.com/servers/create HTTP/1.1");
|
||||
|
@ -298,7 +298,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
|
|||
}
|
||||
|
||||
public void testSetServerConfiguration() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = method(CloudSigmaAsyncClient.class, "setServerConfiguration", String.class, Server.class);
|
||||
Invokable<?, ?> method = method(CloudSigmaApi.class, "setServerConfiguration", String.class, Server.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("100", BindServerToPlainTextStringTest.SERVER));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "POST https://api.cloudsigma.com/servers/100/set HTTP/1.1");
|
||||
|
@ -314,7 +314,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
|
|||
}
|
||||
|
||||
public void testDestroyServer() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = method(CloudSigmaAsyncClient.class, "destroyServer", String.class);
|
||||
Invokable<?, ?> method = method(CloudSigmaApi.class, "destroyServer", String.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("uuid"));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.cloudsigma.com/servers/uuid/destroy HTTP/1.1");
|
||||
|
@ -330,7 +330,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
|
|||
}
|
||||
|
||||
public void testStartServer() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = method(CloudSigmaAsyncClient.class, "startServer", String.class);
|
||||
Invokable<?, ?> method = method(CloudSigmaApi.class, "startServer", String.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("uuid"));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "POST https://api.cloudsigma.com/servers/uuid/start HTTP/1.1");
|
||||
|
@ -346,7 +346,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
|
|||
}
|
||||
|
||||
public void testStopServer() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = method(CloudSigmaAsyncClient.class, "stopServer", String.class);
|
||||
Invokable<?, ?> method = method(CloudSigmaApi.class, "stopServer", String.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("uuid"));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "POST https://api.cloudsigma.com/servers/uuid/stop HTTP/1.1");
|
||||
|
@ -362,7 +362,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
|
|||
}
|
||||
|
||||
public void testShutdownServer() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = method(CloudSigmaAsyncClient.class, "shutdownServer", String.class);
|
||||
Invokable<?, ?> method = method(CloudSigmaApi.class, "shutdownServer", String.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("uuid"));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "POST https://api.cloudsigma.com/servers/uuid/shutdown HTTP/1.1");
|
||||
|
@ -378,7 +378,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
|
|||
}
|
||||
|
||||
public void testResetServer() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = method(CloudSigmaAsyncClient.class, "resetServer", String.class);
|
||||
Invokable<?, ?> method = method(CloudSigmaApi.class, "resetServer", String.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("uuid"));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "POST https://api.cloudsigma.com/servers/uuid/reset HTTP/1.1");
|
||||
|
@ -394,7 +394,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
|
|||
}
|
||||
|
||||
public void testListDrives() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = method(CloudSigmaAsyncClient.class, "listDrives");
|
||||
Invokable<?, ?> method = method(CloudSigmaApi.class, "listDrives");
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.cloudsigma.com/drives/list HTTP/1.1");
|
||||
|
@ -421,7 +421,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
|
|||
}
|
||||
|
||||
public void testDestroyDrive() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = method(CloudSigmaAsyncClient.class, "destroyDrive", String.class);
|
||||
Invokable<?, ?> method = method(CloudSigmaApi.class, "destroyDrive", String.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("uuid"));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.cloudsigma.com/drives/uuid/destroy HTTP/1.1");
|
||||
|
@ -437,7 +437,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
|
|||
}
|
||||
|
||||
public void testListVLANs() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = method(CloudSigmaAsyncClient.class, "listVLANs");
|
||||
Invokable<?, ?> method = method(CloudSigmaApi.class, "listVLANs");
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.cloudsigma.com/resources/vlan/list HTTP/1.1");
|
||||
|
@ -464,7 +464,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
|
|||
}
|
||||
|
||||
public void testListVLANInfo() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = method(CloudSigmaAsyncClient.class, "listVLANInfo");
|
||||
Invokable<?, ?> method = method(CloudSigmaApi.class, "listVLANInfo");
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.cloudsigma.com/resources/vlan/info HTTP/1.1");
|
||||
|
@ -479,7 +479,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
|
|||
}
|
||||
|
||||
public void testGetVLANInfo() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = method(CloudSigmaAsyncClient.class, "getVLANInfo", String.class);
|
||||
Invokable<?, ?> method = method(CloudSigmaApi.class, "getVLANInfo", String.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("uuid"));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.cloudsigma.com/resources/vlan/uuid/info HTTP/1.1");
|
||||
|
@ -495,7 +495,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
|
|||
}
|
||||
|
||||
public void testCreateVLAN() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = method(CloudSigmaAsyncClient.class, "createVLAN", String.class);
|
||||
Invokable<?, ?> method = method(CloudSigmaApi.class, "createVLAN", String.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("poohbear"));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "POST https://api.cloudsigma.com/resources/vlan/create HTTP/1.1");
|
||||
|
@ -511,7 +511,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
|
|||
}
|
||||
|
||||
public void testRenameVLAN() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = method(CloudSigmaAsyncClient.class, "renameVLAN", String.class, String.class);
|
||||
Invokable<?, ?> method = method(CloudSigmaApi.class, "renameVLAN", String.class, String.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("100", "poohbear"));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "POST https://api.cloudsigma.com/resources/vlan/100/set HTTP/1.1");
|
||||
|
@ -527,7 +527,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
|
|||
}
|
||||
|
||||
public void testDestroyVLAN() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = method(CloudSigmaAsyncClient.class, "destroyVLAN", String.class);
|
||||
Invokable<?, ?> method = method(CloudSigmaApi.class, "destroyVLAN", String.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("uuid"));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.cloudsigma.com/resources/vlan/uuid/destroy HTTP/1.1");
|
||||
|
@ -543,7 +543,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
|
|||
}
|
||||
|
||||
public void testListStaticIPs() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = method(CloudSigmaAsyncClient.class, "listStaticIPs");
|
||||
Invokable<?, ?> method = method(CloudSigmaApi.class, "listStaticIPs");
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.cloudsigma.com/resources/ip/list HTTP/1.1");
|
||||
|
@ -570,7 +570,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
|
|||
}
|
||||
|
||||
public void testListStaticIPInfo() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = method(CloudSigmaAsyncClient.class, "listStaticIPInfo");
|
||||
Invokable<?, ?> method = method(CloudSigmaApi.class, "listStaticIPInfo");
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.cloudsigma.com/resources/ip/info HTTP/1.1");
|
||||
|
@ -585,7 +585,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
|
|||
}
|
||||
|
||||
public void testGetStaticIPInfo() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = method(CloudSigmaAsyncClient.class, "getStaticIPInfo", String.class);
|
||||
Invokable<?, ?> method = method(CloudSigmaApi.class, "getStaticIPInfo", String.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("uuid"));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.cloudsigma.com/resources/ip/uuid/info HTTP/1.1");
|
||||
|
@ -601,7 +601,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
|
|||
}
|
||||
|
||||
public void testCreateStaticIP() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = method(CloudSigmaAsyncClient.class, "createStaticIP");
|
||||
Invokable<?, ?> method = method(CloudSigmaApi.class, "createStaticIP");
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest, "POST https://api.cloudsigma.com/resources/ip/create HTTP/1.1");
|
||||
|
@ -617,7 +617,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
|
|||
}
|
||||
|
||||
public void testDestroyStaticIP() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = method(CloudSigmaAsyncClient.class, "destroyStaticIP", String.class);
|
||||
Invokable<?, ?> method = method(CloudSigmaApi.class, "destroyStaticIP", String.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("uuid"));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.cloudsigma.com/resources/ip/uuid/destroy HTTP/1.1");
|
|
@ -60,7 +60,7 @@ import com.google.gson.Gson;
|
|||
import com.google.inject.Guice;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code CloudSigmaClient}
|
||||
* Tests behavior of {@code CloudSigmaApi}
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
|
@ -74,7 +74,7 @@ public class CloudSigmaClientLiveTest extends BaseComputeServiceContextLiveTest
|
|||
protected long driveSize = 8 * 1024 * 1024 * 1024l;
|
||||
protected int maxDriveImageTime = 300;
|
||||
protected String vncPassword = "Il0veVNC";
|
||||
protected CloudSigmaClient client;
|
||||
protected CloudSigmaApi client;
|
||||
protected Predicate<HostAndPort> socketTester;
|
||||
|
||||
protected Predicate<DriveInfo> driveNotClaimed;
|
||||
|
@ -85,7 +85,7 @@ public class CloudSigmaClientLiveTest extends BaseComputeServiceContextLiveTest
|
|||
public void setupContext() {
|
||||
super.setupContext();
|
||||
|
||||
client = view.utils().injector().getInstance(CloudSigmaClient.class);
|
||||
client = view.utils().injector().getInstance(CloudSigmaApi.class);
|
||||
driveNotClaimed = retry(Predicates.not(new DriveClaimed(client)), maxDriveImageTime, 1, SECONDS);
|
||||
SocketOpen socketOpten = context.utils().injector().getInstance(SocketOpen.class);
|
||||
socketTester = retry(socketOpten, maxDriveImageTime, 1, SECONDS);
|
||||
|
|
|
@ -24,8 +24,7 @@ import static org.testng.Assert.assertTrue;
|
|||
|
||||
import java.util.Set;
|
||||
|
||||
import org.jclouds.cloudsigma.CloudSigmaApiMetadata;
|
||||
import org.jclouds.cloudsigma.CloudSigmaClient;
|
||||
import org.jclouds.cloudsigma.CloudSigmaApi;
|
||||
import org.jclouds.cloudsigma.compute.options.CloudSigmaTemplateOptions;
|
||||
import org.jclouds.cloudsigma.domain.AffinityType;
|
||||
import org.jclouds.cloudsigma.domain.Device;
|
||||
|
@ -62,8 +61,7 @@ public class CloudSigmaZurichComputeServiceLiveTest extends CloudSigmaComputeSer
|
|||
Set<? extends NodeMetadata> nodes = client.createNodesInGroup(group, 1, template);
|
||||
NodeMetadata node = get(nodes, 0);
|
||||
|
||||
CloudSigmaClient api = CloudSigmaClient.class.cast(client.getContext().unwrap(
|
||||
CloudSigmaApiMetadata.CONTEXT_TOKEN).getApi());
|
||||
CloudSigmaApi api = CloudSigmaApi.class.cast(client.getContext());
|
||||
|
||||
// Note: I wanted to use node.getHardware().getVolumes() but there is no
|
||||
// way to go from a Volume to a DriveInfo
|
||||
|
|
Loading…
Reference in New Issue