SSHKeyPair API implementation

- Updated tests with correct domain model object.
- Unit tests for ListSSHKeyPairs
This commit is contained in:
vijaykiran 2011-10-29 16:57:54 +02:00
parent 6d4ce41d15
commit 1151cbc241
77 changed files with 796 additions and 578 deletions

View File

@ -18,112 +18,128 @@
*/ */
package org.jclouds.cloudstack; package org.jclouds.cloudstack;
import org.jclouds.cloudstack.features.*; import org.jclouds.cloudstack.features.AccountAsyncClient;
import org.jclouds.cloudstack.features.AddressAsyncClient;
import org.jclouds.cloudstack.features.AsyncJobAsyncClient;
import org.jclouds.cloudstack.features.ConfigurationAsyncClient;
import org.jclouds.cloudstack.features.FirewallAsyncClient;
import org.jclouds.cloudstack.features.GuestOSAsyncClient;
import org.jclouds.cloudstack.features.HypervisorAsyncClient;
import org.jclouds.cloudstack.features.LoadBalancerAsyncClient;
import org.jclouds.cloudstack.features.NATAsyncClient;
import org.jclouds.cloudstack.features.NetworkAsyncClient;
import org.jclouds.cloudstack.features.OfferingAsyncClient;
import org.jclouds.cloudstack.features.SSHKeyPairAsyncClient;
import org.jclouds.cloudstack.features.SecurityGroupAsyncClient;
import org.jclouds.cloudstack.features.TemplateAsyncClient;
import org.jclouds.cloudstack.features.VirtualMachineAsyncClient;
import org.jclouds.cloudstack.features.ZoneAsyncClient;
import org.jclouds.rest.annotations.Delegate; import org.jclouds.rest.annotations.Delegate;
/** /**
* Provides asynchronous access to CloudStack via their REST API. * Provides asynchronous access to CloudStack via their REST API.
* <p/> * <p/>
* *
* @author Adrian Cole * @author Adrian Cole
* @see CloudStackClient * @see CloudStackClient
* @see <a href="http://download.cloud.com/releases/2.2.0/api/TOC_User.html" /> * @see <a href="http://download.cloud.com/releases/2.2.0/api/TOC_User.html" />
*/ */
public interface CloudStackAsyncClient { public interface CloudStackAsyncClient {
/** /**
* Provides asynchronous access to Zone features. * Provides asynchronous access to Zone features.
*/ */
@Delegate @Delegate
ZoneAsyncClient getZoneClient(); ZoneAsyncClient getZoneClient();
/** /**
* Provides asynchronous access to Template features. * Provides asynchronous access to Template features.
*/ */
@Delegate @Delegate
TemplateAsyncClient getTemplateClient(); TemplateAsyncClient getTemplateClient();
/** /**
* Provides asynchronous access to Service, Disk, and Network Offering features. * Provides asynchronous access to Service, Disk, and Network Offering
*/ * features.
@Delegate */
OfferingAsyncClient getOfferingClient(); @Delegate
OfferingAsyncClient getOfferingClient();
/** /**
* Provides asynchronous access to Network features. * Provides asynchronous access to Network features.
*/ */
@Delegate @Delegate
NetworkAsyncClient getNetworkClient(); NetworkAsyncClient getNetworkClient();
/** /**
* Provides asynchronous access to VirtualMachine features. * Provides asynchronous access to VirtualMachine features.
*/ */
@Delegate @Delegate
VirtualMachineAsyncClient getVirtualMachineClient(); VirtualMachineAsyncClient getVirtualMachineClient();
/** /**
* Provides asynchronous access to SecurityGroup features. * Provides asynchronous access to SecurityGroup features.
*/ */
@Delegate @Delegate
SecurityGroupAsyncClient getSecurityGroupClient(); SecurityGroupAsyncClient getSecurityGroupClient();
/** /**
* Provides asynchronous access to AsyncJob features. * Provides asynchronous access to AsyncJob features.
*/ */
@Delegate @Delegate
AsyncJobAsyncClient getAsyncJobClient(); AsyncJobAsyncClient getAsyncJobClient();
/** /**
* Provides asynchronous access to Address features. * Provides asynchronous access to Address features.
*/ */
@Delegate @Delegate
AddressAsyncClient getAddressClient(); AddressAsyncClient getAddressClient();
/** /**
* Provides asynchronous access to NAT features. * Provides asynchronous access to NAT features.
*/ */
@Delegate @Delegate
NATAsyncClient getNATClient(); NATAsyncClient getNATClient();
/** /**
* Provides asynchronous access to Firewall features. * Provides asynchronous access to Firewall features.
*/ */
@Delegate @Delegate
FirewallAsyncClient getFirewallClient(); FirewallAsyncClient getFirewallClient();
/** /**
* Provides asynchronous access to LoadBalancer features. * Provides asynchronous access to LoadBalancer features.
*/ */
@Delegate @Delegate
LoadBalancerAsyncClient getLoadBalancerClient(); LoadBalancerAsyncClient getLoadBalancerClient();
/** /**
* Provides asynchronous access to GuestOS features. * Provides asynchronous access to GuestOS features.
*/ */
@Delegate @Delegate
GuestOSAsyncClient getGuestOSClient(); GuestOSAsyncClient getGuestOSClient();
/** /**
* Provides asynchronous access to Hypervisor features. * Provides asynchronous access to Hypervisor features.
*/ */
@Delegate @Delegate
HypervisorAsyncClient getHypervisorClient(); HypervisorAsyncClient getHypervisorClient();
/** /**
* Provides asynchronous access to Configuration features. * Provides asynchronous access to Configuration features.
*/ */
@Delegate @Delegate
ConfigurationAsyncClient getConfigurationClient(); ConfigurationAsyncClient getConfigurationClient();
/** /**
* Provides asynchronous access to Account features. * Provides asynchronous access to Account features.
*/ */
@Delegate @Delegate
AccountAsyncClient getAccountClient(); AccountAsyncClient getAccountClient();
/** /**
* Provides asynchronous access to SSH Keypairs * Provides asynchronous access to SSH Keypairs
*/ */
@Delegate @Delegate
SSHKeyPairAsyncClient getSSHKeyPairClient(); SSHKeyPairAsyncClient getSSHKeyPairClient();
} }

View File

@ -18,12 +18,27 @@
*/ */
package org.jclouds.cloudstack; package org.jclouds.cloudstack;
import org.jclouds.cloudstack.features.*; import java.util.concurrent.TimeUnit;
import org.jclouds.cloudstack.features.AccountClient;
import org.jclouds.cloudstack.features.AddressClient;
import org.jclouds.cloudstack.features.AsyncJobClient;
import org.jclouds.cloudstack.features.ConfigurationClient;
import org.jclouds.cloudstack.features.FirewallClient;
import org.jclouds.cloudstack.features.GuestOSClient;
import org.jclouds.cloudstack.features.HypervisorClient;
import org.jclouds.cloudstack.features.LoadBalancerClient;
import org.jclouds.cloudstack.features.NATClient;
import org.jclouds.cloudstack.features.NetworkClient;
import org.jclouds.cloudstack.features.OfferingClient;
import org.jclouds.cloudstack.features.SSHKeyPairClient;
import org.jclouds.cloudstack.features.SecurityGroupClient;
import org.jclouds.cloudstack.features.TemplateClient;
import org.jclouds.cloudstack.features.VirtualMachineClient;
import org.jclouds.cloudstack.features.ZoneClient;
import org.jclouds.concurrent.Timeout; import org.jclouds.concurrent.Timeout;
import org.jclouds.rest.annotations.Delegate; import org.jclouds.rest.annotations.Delegate;
import java.util.concurrent.TimeUnit;
/** /**
* Provides synchronous access to CloudStack. * Provides synchronous access to CloudStack.
* <p/> * <p/>
@ -47,7 +62,8 @@ public interface CloudStackClient {
TemplateClient getTemplateClient(); TemplateClient getTemplateClient();
/** /**
* Provides synchronous access to Service, Disk, and Network Offering features. * Provides synchronous access to Service, Disk, and Network Offering
* features.
*/ */
@Delegate @Delegate
OfferingClient getOfferingClient(); OfferingClient getOfferingClient();
@ -124,10 +140,10 @@ public interface CloudStackClient {
@Delegate @Delegate
AccountClient getAccountClient(); AccountClient getAccountClient();
/** /**
* Provides synchronous access to SSH Keypairs * Provides synchronous access to SSH Keypairs
*/ */
@Delegate @Delegate
SSHKeyPairClient getSSHKeyPairClient(); SSHKeyPairClient getSSHKeyPairClient();
} }

View File

@ -30,8 +30,7 @@ import com.google.inject.Module;
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
public class CloudStackContextBuilder extends public class CloudStackContextBuilder extends RestContextBuilder<CloudStackClient, CloudStackAsyncClient> {
RestContextBuilder<CloudStackClient, CloudStackAsyncClient> {
public CloudStackContextBuilder(Properties props) { public CloudStackContextBuilder(Properties props) {
super(CloudStackClient.class, CloudStackAsyncClient.class, props); super(CloudStackClient.class, CloudStackAsyncClient.class, props);

View File

@ -33,8 +33,8 @@ import org.jclouds.http.utils.ModifyRequest;
import org.jclouds.rest.Binder; import org.jclouds.rest.Binder;
import com.google.common.collect.ImmutableMultimap; import com.google.common.collect.ImmutableMultimap;
import com.google.common.collect.Multimap;
import com.google.common.collect.ImmutableMultimap.Builder; import com.google.common.collect.ImmutableMultimap.Builder;
import com.google.common.collect.Multimap;
/** /**
* *
@ -58,11 +58,11 @@ public class BindAccountSecurityGroupPairsToIndexedQueryParams implements Binder
UriBuilder builder = uriBuilderProvider.get(); UriBuilder builder = uriBuilderProvider.get();
builder.uri(request.getEndpoint()); builder.uri(request.getEndpoint());
Builder<String, String> map = ImmutableMultimap.<String, String> builder().putAll( Builder<String, String> map = ImmutableMultimap.<String, String> builder().putAll(
ModifyRequest.parseQueryToMap(request.getEndpoint().getQuery())); ModifyRequest.parseQueryToMap(request.getEndpoint().getQuery()));
int i = 0; int i = 0;
for (Entry<String, String> entry : pairs.entries()) for (Entry<String, String> entry : pairs.entries())
map.put(String.format("usersecuritygrouplist[%d].account", i), entry.getKey()).put( map.put(String.format("usersecuritygrouplist[%d].account", i), entry.getKey()).put(
String.format("usersecuritygrouplist[%d].group", i++), entry.getValue()); String.format("usersecuritygrouplist[%d].group", i++), entry.getValue());
builder.replaceQuery(ModifyRequest.makeQueryLine(map.build(), null)); builder.replaceQuery(ModifyRequest.makeQueryLine(map.build(), null));
return (R) request.toBuilder().endpoint(builder.build()).build(); return (R) request.toBuilder().endpoint(builder.build()).build();
} }

View File

@ -18,10 +18,42 @@
*/ */
package org.jclouds.cloudstack.config; package org.jclouds.cloudstack.config;
import com.google.common.collect.ImmutableMap; import java.util.Map;
import org.jclouds.cloudstack.CloudStackAsyncClient; import org.jclouds.cloudstack.CloudStackAsyncClient;
import org.jclouds.cloudstack.CloudStackClient; import org.jclouds.cloudstack.CloudStackClient;
import org.jclouds.cloudstack.features.*; import org.jclouds.cloudstack.features.AccountAsyncClient;
import org.jclouds.cloudstack.features.AccountClient;
import org.jclouds.cloudstack.features.AddressAsyncClient;
import org.jclouds.cloudstack.features.AddressClient;
import org.jclouds.cloudstack.features.AsyncJobAsyncClient;
import org.jclouds.cloudstack.features.AsyncJobClient;
import org.jclouds.cloudstack.features.ConfigurationAsyncClient;
import org.jclouds.cloudstack.features.ConfigurationClient;
import org.jclouds.cloudstack.features.FirewallAsyncClient;
import org.jclouds.cloudstack.features.FirewallClient;
import org.jclouds.cloudstack.features.GuestOSAsyncClient;
import org.jclouds.cloudstack.features.GuestOSClient;
import org.jclouds.cloudstack.features.HypervisorAsyncClient;
import org.jclouds.cloudstack.features.HypervisorClient;
import org.jclouds.cloudstack.features.LoadBalancerAsyncClient;
import org.jclouds.cloudstack.features.LoadBalancerClient;
import org.jclouds.cloudstack.features.NATAsyncClient;
import org.jclouds.cloudstack.features.NATClient;
import org.jclouds.cloudstack.features.NetworkAsyncClient;
import org.jclouds.cloudstack.features.NetworkClient;
import org.jclouds.cloudstack.features.OfferingAsyncClient;
import org.jclouds.cloudstack.features.OfferingClient;
import org.jclouds.cloudstack.features.SSHKeyPairAsyncClient;
import org.jclouds.cloudstack.features.SSHKeyPairClient;
import org.jclouds.cloudstack.features.SecurityGroupAsyncClient;
import org.jclouds.cloudstack.features.SecurityGroupClient;
import org.jclouds.cloudstack.features.TemplateAsyncClient;
import org.jclouds.cloudstack.features.TemplateClient;
import org.jclouds.cloudstack.features.VirtualMachineAsyncClient;
import org.jclouds.cloudstack.features.VirtualMachineClient;
import org.jclouds.cloudstack.features.ZoneAsyncClient;
import org.jclouds.cloudstack.features.ZoneClient;
import org.jclouds.cloudstack.handlers.CloudStackErrorHandler; import org.jclouds.cloudstack.handlers.CloudStackErrorHandler;
import org.jclouds.http.HttpErrorHandler; import org.jclouds.http.HttpErrorHandler;
import org.jclouds.http.RequiresHttp; import org.jclouds.http.RequiresHttp;
@ -35,7 +67,7 @@ import org.jclouds.predicates.SocketOpen;
import org.jclouds.rest.ConfiguresRestClient; import org.jclouds.rest.ConfiguresRestClient;
import org.jclouds.rest.config.RestClientModule; import org.jclouds.rest.config.RestClientModule;
import java.util.Map; import com.google.common.collect.ImmutableMap;
/** /**
* Configures the cloudstack connection. * Configures the cloudstack connection.

View File

@ -114,13 +114,13 @@ public class AsyncJob<T> {
public AsyncJob<T> build() { public AsyncJob<T> build() {
return new AsyncJob<T>(accountId, cmd, created, id, instanceId, instanceType, progress, result, resultCode, return new AsyncJob<T>(accountId, cmd, created, id, instanceId, instanceType, progress, result, resultCode,
resultType, status, userId, error); resultType, status, userId, error);
} }
public static <T> Builder<T> fromAsyncJobUntyped(AsyncJob<T> in) { public static <T> Builder<T> fromAsyncJobUntyped(AsyncJob<T> in) {
return new Builder<T>().accountId(in.accountId).cmd(in.cmd).created(in.created).id(in.id).instanceId( return new Builder<T>().accountId(in.accountId).cmd(in.cmd).created(in.created).id(in.id)
in.instanceId).instanceType(in.instanceType).progress(in.progress).result(in.result).resultCode( .instanceId(in.instanceId).instanceType(in.instanceType).progress(in.progress).result(in.result)
in.resultCode).resultType(in.resultType).status(in.status).userId(in.userId).error(in.error); .resultCode(in.resultCode).resultType(in.resultType).status(in.status).userId(in.userId).error(in.error);
} }
} }
@ -149,7 +149,7 @@ public class AsyncJob<T> {
private AsyncJobError error; private AsyncJobError error;
public AsyncJob(long accountId, String cmd, Date created, long id, long instanceId, String instanceType, public AsyncJob(long accountId, String cmd, Date created, long id, long instanceId, String instanceType,
int progress, T result, int resultCode, String resultType, int status, int userId, AsyncJobError error) { int progress, T result, int resultCode, String resultType, int status, int userId, AsyncJobError error) {
this.accountId = accountId; this.accountId = accountId;
this.cmd = cmd; this.cmd = cmd;
this.created = created; this.created = created;
@ -260,7 +260,8 @@ public class AsyncJob<T> {
/** /**
* *
* *
* @return the error related to this command, or null if no error or error not yet encountered. * @return the error related to this command, or null if no error or error
* not yet encountered.
*/ */
public AsyncJobError getError() { public AsyncJobError getError() {
return error; return error;
@ -345,9 +346,9 @@ public class AsyncJob<T> {
@Override @Override
public String toString() { public String toString() {
return "[accountId=" + accountId + ", cmd=" + cmd + ", created=" + created + ", id=" + id + ", instanceId=" return "[accountId=" + accountId + ", cmd=" + cmd + ", created=" + created + ", id=" + id + ", instanceId="
+ instanceId + ", instanceType=" + instanceType + ", error=" + error + ", progress=" + progress + instanceId + ", instanceType=" + instanceType + ", error=" + error + ", progress=" + progress
+ ", result=" + result + ", resultCode=" + resultCode + ", resultType=" + resultType + ", status=" + ", result=" + result + ", resultCode=" + resultCode + ", resultType=" + resultType + ", status=" + status
+ status + ", userId=" + userId + "]"; + ", userId=" + userId + "]";
} }
} }

View File

@ -94,7 +94,8 @@ public class Capabilities {
/** /**
* *
* @return true if user and domain admins can set templates to be shared, false otherwise * @return true if user and domain admins can set templates to be shared,
* false otherwise
*/ */
public boolean isSharedTemplatesEnabled() { public boolean isSharedTemplatesEnabled() {
return canShareTemplates; return canShareTemplates;
@ -134,6 +135,6 @@ public class Capabilities {
@Override @Override
public String toString() { public String toString() {
return "[cloudStackVersion=" + cloudStackVersion + ", canShareTemplates=" + canShareTemplates return "[cloudStackVersion=" + cloudStackVersion + ", canShareTemplates=" + canShareTemplates
+ ", securityGroupsEnabled=" + securityGroupsEnabled + "]"; + ", securityGroupsEnabled=" + securityGroupsEnabled + "]";
} }
} }

View File

@ -30,13 +30,13 @@ import com.google.common.base.CaseFormat;
public enum GuestIPType { public enum GuestIPType {
/** /**
* guest IP address will be issued by Dhcp server in the guest virtual network. Dhcp role is * guest IP address will be issued by Dhcp server in the guest virtual
* played by domain router. * network. Dhcp role is played by domain router.
*/ */
VIRTUAL, VIRTUAL,
/** /**
* traffic directly to the network and VMs created here are assigned an IP directly from the * traffic directly to the network and VMs created here are assigned an IP
* network as configured * directly from the network as configured
*/ */
DIRECT, DIRECT,

View File

@ -93,7 +93,7 @@ public class IPForwardingRule implements Comparable<IPForwardingRule> {
public IPForwardingRule build() { public IPForwardingRule build() {
return new IPForwardingRule(id, IPAddress, IPAddressId, startPort, protocol, endPort, state, return new IPForwardingRule(id, IPAddress, IPAddressId, startPort, protocol, endPort, state,
virtualMachineDisplayName, virtualMachineId, virtualMachineName); virtualMachineDisplayName, virtualMachineId, virtualMachineName);
} }
} }
@ -121,7 +121,7 @@ public class IPForwardingRule implements Comparable<IPForwardingRule> {
} }
public IPForwardingRule(long id, String iPAddress, long iPAddressId, int startPort, String protocol, int endPort, public IPForwardingRule(long id, String iPAddress, long iPAddressId, int startPort, String protocol, int endPort,
String state, String virtualMachineDisplayName, long virtualMachineId, String virtualMachineName) { String state, String virtualMachineDisplayName, long virtualMachineId, String virtualMachineName) {
this.id = id; this.id = id;
this.IPAddress = iPAddress; this.IPAddress = iPAddress;
this.IPAddressId = iPAddressId; this.IPAddressId = iPAddressId;
@ -286,9 +286,9 @@ public class IPForwardingRule implements Comparable<IPForwardingRule> {
@Override @Override
public String toString() { public String toString() {
return "[IPAddress=" + IPAddress + ", IPAddressId=" + IPAddressId + ", id=" + id + ", startPort=" + startPort return "[IPAddress=" + IPAddress + ", IPAddressId=" + IPAddressId + ", id=" + id + ", startPort=" + startPort
+ ", protocol=" + protocol + ", endPort=" + endPort + ", state=" + state + ", protocol=" + protocol + ", endPort=" + endPort + ", state=" + state + ", virtualMachineDisplayName="
+ ", virtualMachineDisplayName=" + virtualMachineDisplayName + ", virtualMachineId=" + virtualMachineId + virtualMachineDisplayName + ", virtualMachineId=" + virtualMachineId + ", virtualMachineName="
+ ", virtualMachineName=" + virtualMachineName + "]"; + virtualMachineName + "]";
} }
} }

View File

@ -115,13 +115,13 @@ public class IngressRule implements Comparable<IngressRule> {
} }
public IngressRule(String account, String CIDR, int endPort, int iCMPCode, int iCMPType, String protocol, long id, public IngressRule(String account, String CIDR, int endPort, int iCMPCode, int iCMPType, String protocol, long id,
String securityGroupName, int startPort) { String securityGroupName, int startPort) {
if (account == null) if (account == null)
checkArgument(securityGroupName == null && CIDR != null, checkArgument(securityGroupName == null && CIDR != null,
"if you do not specify an account and security group, you must specify a CIDR range"); "if you do not specify an account and security group, you must specify a CIDR range");
if (CIDR == null) if (CIDR == null)
checkArgument(account != null && securityGroupName != null, checkArgument(account != null && securityGroupName != null,
"if you do not specify an account and security group, you must specify a CIDR range"); "if you do not specify an account and security group, you must specify a CIDR range");
this.account = account; this.account = account;
this.CIDR = CIDR; this.CIDR = CIDR;
this.endPort = endPort; this.endPort = endPort;
@ -257,8 +257,8 @@ public class IngressRule implements Comparable<IngressRule> {
@Override @Override
public String toString() { public String toString() {
return "[id=" + id + ", securityGroupName=" + securityGroupName + ", account=" + account + ", startPort=" return "[id=" + id + ", securityGroupName=" + securityGroupName + ", account=" + account + ", startPort="
+ startPort + ", endPort=" + endPort + ", protocol=" + protocol + ", CIDR=" + CIDR + ", ICMPCode=" + startPort + ", endPort=" + endPort + ", protocol=" + protocol + ", CIDR=" + CIDR + ", ICMPCode="
+ ICMPCode + ", ICMPType=" + ICMPType + "]"; + ICMPCode + ", ICMPType=" + ICMPType + "]";
} }
@Override @Override

View File

@ -142,7 +142,7 @@ public class LoadBalancerRule implements Comparable<LoadBalancerRule> {
public LoadBalancerRule build() { public LoadBalancerRule build() {
return new LoadBalancerRule(id, account, algorithm, description, domain, domainId, name, privatePort, return new LoadBalancerRule(id, account, algorithm, description, domain, domainId, name, privatePort,
publicIP, publicIPId, publicPort, state); publicIP, publicIPId, publicPort, state);
} }
} }
@ -170,7 +170,7 @@ public class LoadBalancerRule implements Comparable<LoadBalancerRule> {
} }
public LoadBalancerRule(long id, String account, Algorithm algorithm, String description, String domain, public LoadBalancerRule(long id, String account, Algorithm algorithm, String description, String domain,
long domainId, String name, int privatePort, String publicIP, long publicIPId, int publicPort, State state) { long domainId, String name, int privatePort, String publicIP, long publicIPId, int publicPort, State state) {
this.id = id; this.id = id;
this.account = account; this.account = account;
this.algorithm = algorithm; this.algorithm = algorithm;
@ -353,9 +353,9 @@ public class LoadBalancerRule implements Comparable<LoadBalancerRule> {
@Override @Override
public String toString() { public String toString() {
return "[account=" + account + ", algorithm=" + algorithm + ", description=" + description + ", domain=" + domain return "[account=" + account + ", algorithm=" + algorithm + ", description=" + description + ", domain=" + domain
+ ", domainId=" + domainId + ", id=" + id + ", name=" + name + ", privatePort=" + privatePort + ", domainId=" + domainId + ", id=" + id + ", name=" + name + ", privatePort=" + privatePort
+ ", publicIP=" + publicIP + ", publicIPId=" + publicIPId + ", publicPort=" + publicPort + ", state=" + ", publicIP=" + publicIP + ", publicIPId=" + publicIPId + ", publicPort=" + publicPort + ", state="
+ state + "]"; + state + "]";
} }
} }

View File

@ -18,21 +18,21 @@
*/ */
package org.jclouds.cloudstack.domain; package org.jclouds.cloudstack.domain;
import com.google.common.collect.ImmutableList; import static com.google.common.base.Preconditions.checkNotNull;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.ImmutableSortedSet;
import com.google.gson.annotations.SerializedName;
import javax.annotation.Nullable;
import java.net.URI; import java.net.URI;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.SortedSet; import java.util.SortedSet;
import static com.google.common.base.Preconditions.checkNotNull; import javax.annotation.Nullable;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.ImmutableSortedSet;
import com.google.gson.annotations.SerializedName;
/** /**
*
* @author Adrian Cole * @author Adrian Cole
*/ */
public class Network implements Comparable<Network> { public class Network implements Comparable<Network> {
@ -244,7 +244,8 @@ public class Network implements Comparable<Network> {
@SerializedName("issystem") @SerializedName("issystem")
private boolean isSystem; private boolean isSystem;
private String netmask; private String netmask;
@SerializedName("domain") @Nullable
@SerializedName("networkdomain")
private String networkDomain; private String networkDomain;
@SerializedName("networkofferingavailability") @SerializedName("networkofferingavailability")
private String networkOfferingAvailability; private String networkOfferingAvailability;
@ -273,7 +274,6 @@ public class Network implements Comparable<Network> {
/** /**
* present only for serializer * present only for serializer
*
*/ */
Network() { Network() {
@ -317,7 +317,6 @@ public class Network implements Comparable<Network> {
} }
/** /**
*
* @return network id * @return network id
*/ */
public long getId() { public long getId() {
@ -325,7 +324,6 @@ public class Network implements Comparable<Network> {
} }
/** /**
*
* @return the name of the account to which the template beLongs * @return the name of the account to which the template beLongs
*/ */
public String getAccount() { public String getAccount() {
@ -333,7 +331,6 @@ public class Network implements Comparable<Network> {
} }
/** /**
*
* @return Broadcast domain type of the network * @return Broadcast domain type of the network
*/ */
public String getBroadcastDomainType() { public String getBroadcastDomainType() {
@ -341,7 +338,6 @@ public class Network implements Comparable<Network> {
} }
/** /**
*
* @return broadcast uri of the network * @return broadcast uri of the network
*/ */
public URI getBroadcastURI() { public URI getBroadcastURI() {
@ -349,7 +345,6 @@ public class Network implements Comparable<Network> {
} }
/** /**
*
* @return the display text of the zone * @return the display text of the zone
*/ */
public String getDisplayText() { public String getDisplayText() {
@ -357,7 +352,6 @@ public class Network implements Comparable<Network> {
} }
/** /**
*
* @return the external DNS for the network * @return the external DNS for the network
*/ */
public List<String> getDNS() { public List<String> getDNS() {
@ -370,7 +364,6 @@ public class Network implements Comparable<Network> {
} }
/** /**
*
* @return Domain name for the Vms in the zone * @return Domain name for the Vms in the zone
*/ */
public String getDomain() { public String getDomain() {
@ -378,7 +371,6 @@ public class Network implements Comparable<Network> {
} }
/** /**
*
* @return the ID of the containing domain, null for public zones * @return the ID of the containing domain, null for public zones
*/ */
@Nullable @Nullable
@ -387,7 +379,6 @@ public class Network implements Comparable<Network> {
} }
/** /**
*
* @return the end ip of the network * @return the end ip of the network
*/ */
public String getEndIP() { public String getEndIP() {
@ -395,7 +386,6 @@ public class Network implements Comparable<Network> {
} }
/** /**
*
* @return the network's gateway * @return the network's gateway
*/ */
public String getGateway() { public String getGateway() {
@ -403,7 +393,6 @@ public class Network implements Comparable<Network> {
} }
/** /**
*
* @return true if network offering is default, false otherwise * @return true if network offering is default, false otherwise
*/ */
public boolean isDefault() { public boolean isDefault() {
@ -411,7 +400,6 @@ public class Network implements Comparable<Network> {
} }
/** /**
*
* @return true if network offering is shared, false otherwise * @return true if network offering is shared, false otherwise
*/ */
public boolean isShared() { public boolean isShared() {
@ -419,7 +407,6 @@ public class Network implements Comparable<Network> {
} }
/** /**
*
* @return true if network offering is system, false otherwise * @return true if network offering is system, false otherwise
*/ */
public boolean isSystem() { public boolean isSystem() {
@ -427,7 +414,6 @@ public class Network implements Comparable<Network> {
} }
/** /**
*
* @return network name * @return network name
*/ */
public String getName() { public String getName() {
@ -435,7 +421,6 @@ public class Network implements Comparable<Network> {
} }
/** /**
*
* @return the GuestIPType of the network * @return the GuestIPType of the network
*/ */
public GuestIPType getGuestIPType() { public GuestIPType getGuestIPType() {
@ -443,7 +428,6 @@ public class Network implements Comparable<Network> {
} }
/** /**
*
* @return state of the network * @return state of the network
*/ */
public String getState() { public String getState() {
@ -451,7 +435,6 @@ public class Network implements Comparable<Network> {
} }
/** /**
*
* @return the vlan range of the zone * @return the vlan range of the zone
*/ */
public String getVLAN() { public String getVLAN() {
@ -459,7 +442,6 @@ public class Network implements Comparable<Network> {
} }
/** /**
*
* @return the traffic type for this network offering * @return the traffic type for this network offering
*/ */
public TrafficType getTrafficType() { public TrafficType getTrafficType() {
@ -467,7 +449,6 @@ public class Network implements Comparable<Network> {
} }
/** /**
*
* @return the network's netmask * @return the network's netmask
*/ */
public String getNetmask() { public String getNetmask() {
@ -475,7 +456,6 @@ public class Network implements Comparable<Network> {
} }
/** /**
*
* @return the network domain * @return the network domain
*/ */
public String getNetworkDomain() { public String getNetworkDomain() {
@ -483,7 +463,6 @@ public class Network implements Comparable<Network> {
} }
/** /**
*
* @return availability of the network offering the network is created from * @return availability of the network offering the network is created from
*/ */
public String getNetworkOfferingAvailability() { public String getNetworkOfferingAvailability() {
@ -491,7 +470,6 @@ public class Network implements Comparable<Network> {
} }
/** /**
*
* @return display text of the network offering the network is created from * @return display text of the network offering the network is created from
*/ */
public String getNetworkOfferingDisplayText() { public String getNetworkOfferingDisplayText() {
@ -499,7 +477,6 @@ public class Network implements Comparable<Network> {
} }
/** /**
*
* @return network offering id the network is created from * @return network offering id the network is created from
*/ */
public long getNetworkOfferingId() { public long getNetworkOfferingId() {
@ -507,7 +484,6 @@ public class Network implements Comparable<Network> {
} }
/** /**
*
* @return name of the network offering the network is created from * @return name of the network offering the network is created from
*/ */
public String getNetworkOfferingName() { public String getNetworkOfferingName() {
@ -515,7 +491,6 @@ public class Network implements Comparable<Network> {
} }
/** /**
*
* @return related to what other network configuration * @return related to what other network configuration
*/ */
public long getRelated() { public long getRelated() {
@ -523,7 +498,6 @@ public class Network implements Comparable<Network> {
} }
/** /**
*
* @return the start ip of the network * @return the start ip of the network
*/ */
public String getStartIP() { public String getStartIP() {
@ -531,7 +505,6 @@ public class Network implements Comparable<Network> {
} }
/** /**
*
* @return zone id of the network * @return zone id of the network
*/ */
public long getZoneId() { public long getZoneId() {
@ -539,7 +512,6 @@ public class Network implements Comparable<Network> {
} }
/** /**
*
* @return the list of services * @return the list of services
*/ */
public Set<? extends NetworkService> getServices() { public Set<? extends NetworkService> getServices() {
@ -716,7 +688,7 @@ public class Network implements Comparable<Network> {
+ account + ", startIP=" + startIP + ", endIP=" + endIP + ", netmask=" + netmask + ", gateway=" + gateway + account + ", startIP=" + startIP + ", endIP=" + endIP + ", netmask=" + netmask + ", gateway=" + gateway
+ ", broadcastDomainType=" + broadcastDomainType + ", broadcastURI=" + broadcastURI + ", services=" + ", broadcastDomainType=" + broadcastDomainType + ", broadcastURI=" + broadcastURI + ", services="
+ services + ", domain=" + domain + ", domainId=" + domainId + ", isDefault=" + isDefault + ", isShared=" + services + ", domain=" + domain + ", domainId=" + domainId + ", isDefault=" + isDefault + ", isShared="
+ isShared + ", isSystem=" + isSystem + ", related=" + related + ", zoneId=" + zoneId + ", networkDomain=" + isShared + ", isSystem=" + isSystem + ", related=" + related + ", zoneId=" + zoneId + ", domain="
+ networkDomain + ", networkOfferingAvailability=" + networkOfferingAvailability + networkDomain + ", networkOfferingAvailability=" + networkOfferingAvailability
+ ", networkOfferingDisplayText=" + networkOfferingDisplayText + ", networkOfferingId=" + networkOfferingId + ", networkOfferingDisplayText=" + networkOfferingDisplayText + ", networkOfferingId=" + networkOfferingId
+ ", networkOfferingName=" + networkOfferingName + "]"; + ", networkOfferingName=" + networkOfferingName + "]";

View File

@ -93,7 +93,7 @@ public class PortForwardingRule implements Comparable<PortForwardingRule> {
public PortForwardingRule build() { public PortForwardingRule build() {
return new PortForwardingRule(id, IPAddress, IPAddressId, privatePort, protocol, publicPort, state, return new PortForwardingRule(id, IPAddress, IPAddressId, privatePort, protocol, publicPort, state,
virtualMachineDisplayName, virtualMachineId, virtualMachineName); virtualMachineDisplayName, virtualMachineId, virtualMachineName);
} }
} }
@ -121,14 +121,14 @@ public class PortForwardingRule implements Comparable<PortForwardingRule> {
} }
public PortForwardingRule(long id, String iPAddress, long iPAddressId, int privatePort, String protocol, public PortForwardingRule(long id, String iPAddress, long iPAddressId, int privatePort, String protocol,
int publicPort, String state, String virtualMachineDisplayName, long virtualMachineId, int publicPort, String state, String virtualMachineDisplayName, long virtualMachineId,
String virtualMachineName) { String virtualMachineName) {
this.id = id; this.id = id;
this.IPAddress = iPAddress; this.IPAddress = iPAddress;
this.IPAddressId = iPAddressId; this.IPAddressId = iPAddressId;
this.privatePort = privatePort; this.privatePort = privatePort;
this.protocol = protocol; this.protocol = protocol;
this.publicPort = publicPort+""; this.publicPort = publicPort + "";
this.state = state; this.state = state;
this.virtualMachineDisplayName = virtualMachineDisplayName; this.virtualMachineDisplayName = virtualMachineDisplayName;
this.virtualMachineId = virtualMachineId; this.virtualMachineId = virtualMachineId;
@ -290,9 +290,9 @@ public class PortForwardingRule implements Comparable<PortForwardingRule> {
@Override @Override
public String toString() { public String toString() {
return "[IPAddress=" + IPAddress + ", IPAddressId=" + IPAddressId + ", id=" + id + ", privatePort=" + privatePort return "[IPAddress=" + IPAddress + ", IPAddressId=" + IPAddressId + ", id=" + id + ", privatePort=" + privatePort
+ ", protocol=" + protocol + ", publicPort=" + publicPort + ", state=" + state + ", protocol=" + protocol + ", publicPort=" + publicPort + ", state=" + state
+ ", virtualMachineDisplayName=" + virtualMachineDisplayName + ", virtualMachineId=" + virtualMachineId + ", virtualMachineDisplayName=" + virtualMachineDisplayName + ", virtualMachineId=" + virtualMachineId
+ ", virtualMachineName=" + virtualMachineName + "]"; + ", virtualMachineName=" + virtualMachineName + "]";
} }
} }

View File

@ -153,8 +153,8 @@ public class PublicIPAddress implements Comparable<PublicIPAddress> {
public PublicIPAddress build() { public PublicIPAddress build() {
return new PublicIPAddress(id, account, allocated, associatedNetworkId, domain, domainId, usesVirtualNetwork, return new PublicIPAddress(id, account, allocated, associatedNetworkId, domain, domainId, usesVirtualNetwork,
IPAddress, isSourceNAT, isStaticNAT, networkId, state, virtualMachineDisplayName, virtualMachineId, IPAddress, isSourceNAT, isStaticNAT, networkId, state, virtualMachineDisplayName, virtualMachineId,
virtualMachineName, VLANId, VLANName, zoneId, zoneName); virtualMachineName, VLANId, VLANName, zoneId, zoneName);
} }
} }
@ -215,9 +215,9 @@ public class PublicIPAddress implements Comparable<PublicIPAddress> {
} }
public PublicIPAddress(long id, String account, Date allocated, long associatedNetworkId, String domain, public PublicIPAddress(long id, String account, Date allocated, long associatedNetworkId, String domain,
long domainId, boolean usesVirtualNetwork, String iPAddress, boolean isSourceNAT, boolean isStaticNAT, long domainId, boolean usesVirtualNetwork, String iPAddress, boolean isSourceNAT, boolean isStaticNAT,
long networkId, State state, String virtualMachineDisplayName, long virtualMachineId, long networkId, State state, String virtualMachineDisplayName, long virtualMachineId,
String virtualMachineName, long VLANId, String VLANName, long zoneId, String zoneName) { String virtualMachineName, long VLANId, String VLANName, long zoneId, String zoneName) {
this.id = id; this.id = id;
this.account = account; this.account = account;
this.allocated = allocated; this.allocated = allocated;
@ -333,7 +333,8 @@ public class PublicIPAddress implements Comparable<PublicIPAddress> {
/** /**
* *
* @return State of the ip address. Can be: Allocating, Allocated and Releasing * @return State of the ip address. Can be: Allocating, Allocated and
* Releasing
*/ */
public State getState() { public State getState() {
return state; return state;
@ -341,8 +342,8 @@ public class PublicIPAddress implements Comparable<PublicIPAddress> {
/** /**
* *
* @return virtual machine display name the ip address is assigned to (not null only for static * @return virtual machine display name the ip address is assigned to (not
* nat Ip) * null only for static nat Ip)
*/ */
public String getVirtualMachineDisplayName() { public String getVirtualMachineDisplayName() {
return virtualMachineDisplayName; return virtualMachineDisplayName;
@ -350,7 +351,8 @@ public class PublicIPAddress implements Comparable<PublicIPAddress> {
/** /**
* *
* @return virtual machine id the ip address is assigned to (not null only for static nat Ip) * @return virtual machine id the ip address is assigned to (not null only
* for static nat Ip)
*/ */
public long getVirtualMachineId() { public long getVirtualMachineId() {
return virtualMachineId; return virtualMachineId;
@ -358,7 +360,8 @@ public class PublicIPAddress implements Comparable<PublicIPAddress> {
/** /**
* *
* @return virtual machine name the ip address is assigned to (not null only for static nat Ip) * @return virtual machine name the ip address is assigned to (not null only
* for static nat Ip)
*/ */
public String getVirtualMachineName() { public String getVirtualMachineName() {
return virtualMachineName; return virtualMachineName;
@ -502,11 +505,11 @@ public class PublicIPAddress implements Comparable<PublicIPAddress> {
@Override @Override
public String toString() { public String toString() {
return "[id=" + id + ", IPAddress=" + IPAddress + ", VLANId=" + VLANId + ", VLANName=" + VLANName + ", account=" return "[id=" + id + ", IPAddress=" + IPAddress + ", VLANId=" + VLANId + ", VLANName=" + VLANName + ", account="
+ account + ", allocated=" + allocated + ", associatedNetworkId=" + associatedNetworkId + ", domain=" + account + ", allocated=" + allocated + ", associatedNetworkId=" + associatedNetworkId + ", domain="
+ domain + ", domainId=" + domainId + ", usesVirtualNetwork=" + usesVirtualNetwork + ", isSourceNAT=" + domain + ", domainId=" + domainId + ", usesVirtualNetwork=" + usesVirtualNetwork + ", isSourceNAT="
+ isSourceNAT + ", isStaticNAT=" + isStaticNAT + ", networkId=" + networkId + ", state=" + state + isSourceNAT + ", isStaticNAT=" + isStaticNAT + ", networkId=" + networkId + ", state=" + state
+ ", virtualMachineDisplayName=" + virtualMachineDisplayName + ", virtualMachineId=" + virtualMachineId + ", virtualMachineDisplayName=" + virtualMachineDisplayName + ", virtualMachineId=" + virtualMachineId
+ ", virtualMachineName=" + virtualMachineName + ", zoneId=" + zoneId + ", zoneName=" + zoneName + "]"; + ", virtualMachineName=" + virtualMachineName + ", zoneId=" + zoneId + ", zoneName=" + zoneName + "]";
} }
} }

View File

@ -4,113 +4,111 @@ import com.google.gson.annotations.SerializedName;
public class SSHKeyPair implements Comparable<SSHKeyPair> { public class SSHKeyPair implements Comparable<SSHKeyPair> {
public static Builder builder() { public static Builder builder() {
return new Builder(); return new Builder();
} }
public static class Builder { public static class Builder {
private String fingerprint; private String fingerprint;
private String name; private String name;
private String privateKey; private String privateKey;
public Builder fingerprint(String fingerprint) { public Builder fingerprint(String fingerprint) {
this.fingerprint = fingerprint; this.fingerprint = fingerprint;
return this; return this;
} }
public Builder name(String name) { public Builder name(String name) {
this.name = name; this.name = name;
return this; return this;
} }
public Builder privateKey(String privateKey) { public Builder privateKey(String privateKey) {
this.privateKey = privateKey; this.privateKey = privateKey;
return this; return this;
} }
public SSHKeyPair build() {
return new SSHKeyPair(fingerprint, name, privateKey);
}
}
public SSHKeyPair build() { // for deserialization
return new SSHKeyPair(fingerprint, name, privateKey); SSHKeyPair() {
}
}
// for deserialization }
SSHKeyPair() {
} private String fingerprint;
private String name;
@SerializedName("privatekey")
private String privateKey;
private String fingerprint; public SSHKeyPair(String fingerprint, String name, String privateKey) {
private String name; this.fingerprint = fingerprint;
@SerializedName("privatekey") this.name = name;
private String privateKey; this.privateKey = privateKey;
}
public SSHKeyPair(String fingerprint, String name, String privateKey) { public String getFingerprint() {
this.fingerprint = fingerprint; return fingerprint;
this.name = name; }
this.privateKey = privateKey;
}
public String getFingerprint() { public String getName() {
return fingerprint; return name;
} }
public String getName() { public String getPrivateKey() {
return name; return privateKey;
} }
public String getPrivateKey() { @Override
return privateKey; public int hashCode() {
} final int prime = 31;
int result = 1;
result = prime * result + ((fingerprint == null) ? 0 : fingerprint.hashCode());
result = prime * result + ((name == null) ? 0 : name.hashCode());
result = prime * result + ((privateKey == null) ? 0 : privateKey.hashCode());
@Override return result;
public int hashCode() { }
final int prime = 31;
int result = 1;
result = prime * result + ((fingerprint == null) ? 0 : fingerprint.hashCode());
result = prime * result + ((name == null) ? 0 : name.hashCode());
result = prime * result + ((privateKey == null) ? 0 : privateKey.hashCode());
return result; @Override
} public boolean equals(Object obj) {
if (this == obj)
@Override return true;
public boolean equals(Object obj) { if (obj == null)
if (this == obj) return false;
return true; if (getClass() != obj.getClass())
if (obj == null) return false;
SSHKeyPair other = (SSHKeyPair) obj;
if (fingerprint == null) {
if (other.fingerprint != null)
return false; return false;
if (getClass() != obj.getClass()) } else if (!fingerprint.equals(other.fingerprint))
return false;
if (name == null) {
if (other.name != null)
return false; return false;
SSHKeyPair other = (SSHKeyPair) obj; } else if (!name.equals(other.name))
if (fingerprint == null) { return false;
if (other.fingerprint != null) if (privateKey == null) {
return false; if (other.privateKey != null)
} else if (!fingerprint.equals(other.fingerprint))
return false;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.name))
return false;
if (privateKey == null) {
if (other.privateKey != null)
return false;
} else if (!privateKey.equals(other.privateKey))
return false; return false;
} else if (!privateKey.equals(other.privateKey))
return false;
return true; return true;
} }
@Override @Override
public String toString() { public String toString() {
return "[fingerprint=" + fingerprint + ", name=" + name + "]"; return "[fingerprint=" + fingerprint + ", name=" + name + "]";
} }
@Override
public int compareTo(SSHKeyPair arg0) {
return fingerprint.compareTo(arg0.getFingerprint());
}
@Override
public int compareTo(SSHKeyPair arg0) {
return fingerprint.compareTo(arg0.getFingerprint());
}
} }

View File

@ -523,8 +523,8 @@ public class Template implements Comparable<Template> {
/** /**
* *
* @return shows the current pending asynchronous job ID, or null if current pending jobs are * @return shows the current pending asynchronous job ID, or null if current
* acting on the template * pending jobs are acting on the template
*/ */
@Nullable @Nullable
public Long getJobId() { public Long getJobId() {

View File

@ -37,7 +37,8 @@ public enum TemplateFilter {
*/ */
SELF, SELF,
/** /**
* templates that have been registered/created by the owner that can be used to deploy a new VM * templates that have been registered/created by the owner that can be used
* to deploy a new VM
*/ */
SELF_EXECUTABLE, SELF_EXECUTABLE,
/** /**

View File

@ -38,15 +38,18 @@ public enum TrafficType {
*/ */
GUEST, GUEST,
/** /**
* System network that only Admin can view, and only when isSystem is specified. * System network that only Admin can view, and only when isSystem is
* specified.
*/ */
STORAGE, STORAGE,
/** /**
* System network that only Admin can view, and only when isSystem is specified. * System network that only Admin can view, and only when isSystem is
* specified.
*/ */
MANAGEMENT, MANAGEMENT,
/** /**
* System network that only Admin can view, and only when isSystem is specified. * System network that only Admin can view, and only when isSystem is
* specified.
*/ */
CONTROL, CONTROL,

View File

@ -122,7 +122,7 @@ public class User implements Comparable<User> {
public User build() { public User build() {
return new User(id, name, firstName, lastName, email, created, state, account, accountType, domain, domainId, return new User(id, name, firstName, lastName, email, created, state, account, accountType, domain, domainId,
timeZone, apiKey, secretKey); timeZone, apiKey, secretKey);
} }
} }
@ -158,8 +158,8 @@ public class User implements Comparable<User> {
private String secretKey; private String secretKey;
public User(long id, String name, String firstname, String lastname, String email, Date created, String state, public User(long id, String name, String firstname, String lastname, String email, Date created, String state,
String account, Type accountType, String domain, long domainId, String timeZone, String apiKey, String account, Type accountType, String domain, long domainId, String timeZone, String apiKey,
String secretKey) { String secretKey) {
this.id = id; this.id = id;
this.name = name; this.name = name;
this.firstName = firstname; this.firstName = firstname;
@ -327,10 +327,10 @@ public class User implements Comparable<User> {
@Override @Override
public String toString() { public String toString() {
return String return String
.format( .format(
"[id=%s, name=%s, state=%s, created=%s, account=%s, accountType=%s, domain=%s, domainId=%s, email=%s, firstName=%s, lastName=%s, apiKey=%s, secretKey=%s, timeZone=%s]", "[id=%s, name=%s, state=%s, created=%s, account=%s, accountType=%s, domain=%s, domainId=%s, email=%s, firstName=%s, lastName=%s, apiKey=%s, secretKey=%s, timeZone=%s]",
id, name, state, created, account, accountType, domain, domainId, email, firstName, lastName, id, name, state, created, account, accountType, domain, domainId, email, firstName, lastName, apiKey,
apiKey, secretKey, timeZone); secretKey, timeZone);
} }
} }

View File

@ -289,11 +289,10 @@ public class VirtualMachine implements Comparable<VirtualMachine> {
public VirtualMachine build() { public VirtualMachine build() {
return new VirtualMachine(id, account, cpuCount, cpuSpeed, cpuUsed, displayName, created, domain, domainId, return new VirtualMachine(id, account, cpuCount, cpuSpeed, cpuUsed, displayName, created, domain, domainId,
usesVirtualNetwork, group, groupId, guestOSId, HAEnabled, hostId, hostname, IPAddress, usesVirtualNetwork, group, groupId, guestOSId, HAEnabled, hostId, hostname, IPAddress, ISODisplayText,
ISODisplayText, ISOId, ISOName, jobId, jobStatus, memory, name, networkKbsRead, networkKbsWrite, ISOId, ISOName, jobId, jobStatus, memory, name, networkKbsRead, networkKbsWrite, password,
password, passwordEnabled, rootDeviceId, rootDeviceType, securityGroups, serviceOfferingId, passwordEnabled, rootDeviceId, rootDeviceType, securityGroups, serviceOfferingId, serviceOfferingName,
serviceOfferingName, state, templateDisplayText, templateId, templateName, zoneId, zoneName, nics, state, templateDisplayText, templateId, templateName, zoneId, zoneName, nics, hypervisor);
hypervisor);
} }
} }
@ -390,13 +389,13 @@ public class VirtualMachine implements Comparable<VirtualMachine> {
private Set<SecurityGroup> securityGroups = ImmutableSet.<SecurityGroup> of(); private Set<SecurityGroup> securityGroups = ImmutableSet.<SecurityGroup> of();
public VirtualMachine(long id, String account, long cpuCount, long cpuSpeed, Long cpuUsed, String displayName, public VirtualMachine(long id, String account, long cpuCount, long cpuSpeed, Long cpuUsed, String displayName,
Date created, String domain, long domainId, boolean usesVirtualNetwork, String group, long groupId, Date created, String domain, long domainId, boolean usesVirtualNetwork, String group, long groupId,
long guestOSId, boolean hAEnabled, long hostId, String hostname, String iPAddress, String iSODisplayText, long guestOSId, boolean hAEnabled, long hostId, String hostname, String iPAddress, String iSODisplayText,
long iSOId, String iSOName, Long jobId, Integer jobStatus, long memory, String name, Long networkKbsRead, long iSOId, String iSOName, Long jobId, Integer jobStatus, long memory, String name, Long networkKbsRead,
Long networkKbsWrite, String password, boolean passwordEnabled, long rootDeviceId, String rootDeviceType, Long networkKbsWrite, String password, boolean passwordEnabled, long rootDeviceId, String rootDeviceType,
Set<SecurityGroup> securityGroups, long serviceOfferingId, String serviceOfferingName, State state, Set<SecurityGroup> securityGroups, long serviceOfferingId, String serviceOfferingName, State state,
String templateDisplayText, long templateId, String templateName, long zoneId, String zoneName, String templateDisplayText, long templateId, String templateName, long zoneId, String zoneName, Set<NIC> nics,
Set<NIC> nics, String hypervisor) { String hypervisor) {
this.id = id; this.id = id;
this.account = account; this.account = account;
this.cpuCount = cpuCount; this.cpuCount = cpuCount;
@ -483,8 +482,8 @@ public class VirtualMachine implements Comparable<VirtualMachine> {
} }
/** /**
* @return user generated name. The name of the virtual machine is returned if no displayname * @return user generated name. The name of the virtual machine is returned
* exists. * if no displayname exists.
*/ */
public String getDisplayName() { public String getDisplayName() {
return displayName; return displayName;
@ -574,7 +573,8 @@ public class VirtualMachine implements Comparable<VirtualMachine> {
} }
/** /**
* @return an alternate display text of the ISO attached to the virtual machine * @return an alternate display text of the ISO attached to the virtual
* machine
*/ */
public String getISODisplayText() { public String getISODisplayText() {
return ISODisplayText; return ISODisplayText;
@ -595,8 +595,9 @@ public class VirtualMachine implements Comparable<VirtualMachine> {
} }
/** /**
* @return shows the current pending asynchronous job ID. This tag is not returned if no current * @return shows the current pending asynchronous job ID. This tag is not
* pending jobs are acting on the virtual machine * returned if no current pending jobs are acting on the virtual
* machine
*/ */
@Nullable @Nullable
public Long getJobId() { public Long getJobId() {
@ -704,8 +705,8 @@ public class VirtualMachine implements Comparable<VirtualMachine> {
} }
/** /**
* @return the ID of the template for the virtual machine. A -1 is returned if the virtual * @return the ID of the template for the virtual machine. A -1 is returned
* machine was created from an ISO file. * if the virtual machine was created from an ISO file.
*/ */
public long getTemplateId() { public long getTemplateId() {
return templateId; return templateId;
@ -955,18 +956,17 @@ public class VirtualMachine implements Comparable<VirtualMachine> {
@Override @Override
public String toString() { public String toString() {
return "[id=" + id + ", account=" + account + ", cpuCount=" + cpuCount + ", cpuSpeed=" + cpuSpeed + ", cpuUsed=" return "[id=" + id + ", account=" + account + ", cpuCount=" + cpuCount + ", cpuSpeed=" + cpuSpeed + ", cpuUsed="
+ cpuUsed + ", displayName=" + displayName + ", created=" + created + ", domain=" + domain + cpuUsed + ", displayName=" + displayName + ", created=" + created + ", domain=" + domain + ", domainId="
+ ", domainId=" + domainId + ", usesVirtualNetwork=" + usesVirtualNetwork + ", group=" + group + domainId + ", usesVirtualNetwork=" + usesVirtualNetwork + ", group=" + group + ", groupId=" + groupId
+ ", groupId=" + groupId + ", guestOSId=" + guestOSId + ", HAEnabled=" + HAEnabled + ", hostId=" + ", guestOSId=" + guestOSId + ", HAEnabled=" + HAEnabled + ", hostId=" + hostId + ", hostname=" + hostname
+ hostId + ", hostname=" + hostname + ", IPAddress=" + IPAddress + ", ISODisplayText=" + ISODisplayText + ", IPAddress=" + IPAddress + ", ISODisplayText=" + ISODisplayText + ", ISOId=" + ISOId + ", ISOName="
+ ", ISOId=" + ISOId + ", ISOName=" + ISOName + ", jobId=" + jobId + ", jobStatus=" + jobStatus + ISOName + ", jobId=" + jobId + ", jobStatus=" + jobStatus + ", memory=" + memory + ", name=" + name
+ ", memory=" + memory + ", name=" + name + ", networkKbsRead=" + networkKbsRead + ", networkKbsWrite=" + ", networkKbsRead=" + networkKbsRead + ", networkKbsWrite=" + networkKbsWrite + ", password=" + password
+ networkKbsWrite + ", password=" + password + ", passwordEnabled=" + passwordEnabled + ", passwordEnabled=" + passwordEnabled + ", rootDeviceId=" + rootDeviceId + ", rootDeviceType="
+ ", rootDeviceId=" + rootDeviceId + ", rootDeviceType=" + rootDeviceType + ", serviceOfferingId=" + rootDeviceType + ", serviceOfferingId=" + serviceOfferingId + ", serviceOfferingName="
+ serviceOfferingId + ", serviceOfferingName=" + serviceOfferingName + ", state=" + state + serviceOfferingName + ", state=" + state + ", templateDisplayText=" + templateDisplayText
+ ", templateDisplayText=" + templateDisplayText + ", templateId=" + templateId + ", templateName=" + ", templateId=" + templateId + ", templateName=" + templateName + ", zoneId=" + zoneId + ", zoneName="
+ templateName + ", zoneId=" + zoneId + ", zoneName=" + zoneName + ", nics=" + nics + ", hypervisor=" + zoneName + ", nics=" + nics + ", hypervisor=" + hypervisor + ", securityGroups=" + securityGroups + "]";
+ hypervisor + ", securityGroups=" + securityGroups + "]";
} }
@Override @Override

View File

@ -118,7 +118,7 @@ public class Zone implements Comparable<Zone> {
public Zone build() { public Zone build() {
return new Zone(id, description, displayText, DNS, domain, domainId, guestCIDRAddress, internalDNS, name, return new Zone(id, description, displayText, DNS, domain, domainId, guestCIDRAddress, internalDNS, name,
networkType, status, VLAN, securityGroupsEnabled); networkType, status, VLAN, securityGroupsEnabled);
} }
} }
@ -158,8 +158,8 @@ public class Zone implements Comparable<Zone> {
} }
public Zone(long id, String description, String displayText, List<String> DNS, String domain, long domainId, public Zone(long id, String description, String displayText, List<String> DNS, String domain, long domainId,
String guestCIDRAddress, List<String> internalDNS, String name, NetworkType networkType, String status, String guestCIDRAddress, List<String> internalDNS, String name, NetworkType networkType, String status,
String vLAN, boolean securityGroupsEnabled) { String vLAN, boolean securityGroupsEnabled) {
this.id = id; this.id = id;
this.description = description; this.description = description;
this.displayText = displayText; this.displayText = displayText;
@ -389,9 +389,9 @@ public class Zone implements Comparable<Zone> {
@Override @Override
public String toString() { public String toString() {
return "[id=" + id + ", status=" + status + ", name=" + name + ", description=" + description + ", displayText=" return "[id=" + id + ", status=" + status + ", name=" + name + ", description=" + description + ", displayText="
+ displayText + ", domain=" + domain + ", domainId=" + domainId + ", networkType=" + networkType + displayText + ", domain=" + domain + ", domainId=" + domainId + ", networkType=" + networkType
+ ", guestCIDRAddress=" + guestCIDRAddress + ", VLAN=" + VLAN + ", DNS=" + getDNS() + ", guestCIDRAddress=" + guestCIDRAddress + ", VLAN=" + VLAN + ", DNS=" + getDNS()
+ ", securityGroupsEnabled=" + isSecurityGroupsEnabled() + ", internalDNS=" + getInternalDNS() + "]"; + ", securityGroupsEnabled=" + isSecurityGroupsEnabled() + ", internalDNS=" + getInternalDNS() + "]";
} }
@Override @Override

View File

@ -83,7 +83,7 @@ public interface AddressAsyncClient {
@Unwrap @Unwrap
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
ListenableFuture<AsyncCreateResponse> associateIPAddressInZone(@QueryParam("zoneid") long zoneId, ListenableFuture<AsyncCreateResponse> associateIPAddressInZone(@QueryParam("zoneid") long zoneId,
AssociateIPAddressOptions... options); AssociateIPAddressOptions... options);
/** /**
* @see AddressClient#disassociateIPAddress * @see AddressClient#disassociateIPAddress

View File

@ -42,7 +42,8 @@ public interface AddressClient {
* *
* @param options * @param options
* if present, how to constrain the list. * if present, how to constrain the list.
* @return IPAddresses matching query, or empty set, if no IPAddresses are found * @return IPAddresses matching query, or empty set, if no IPAddresses are
* found
*/ */
Set<PublicIPAddress> listPublicIPAddresses(ListPublicIPAddressesOptions... options); Set<PublicIPAddress> listPublicIPAddresses(ListPublicIPAddressesOptions... options);
@ -59,7 +60,8 @@ public interface AddressClient {
* Acquires and associates a public IP to an account. * Acquires and associates a public IP to an account.
* *
* @param zoneId * @param zoneId
* the ID of the availability zone you want to acquire an public IP address from * the ID of the availability zone you want to acquire an public IP
* address from
* @return IPAddress * @return IPAddress
*/ */
AsyncCreateResponse associateIPAddressInZone(long zoneId, AssociateIPAddressOptions... options); AsyncCreateResponse associateIPAddressInZone(long zoneId, AssociateIPAddressOptions... options);

View File

@ -69,9 +69,9 @@ public interface FirewallAsyncClient {
@Unwrap @Unwrap
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
ListenableFuture<AsyncCreateResponse> createPortForwardingRuleForVirtualMachine( ListenableFuture<AsyncCreateResponse> createPortForwardingRuleForVirtualMachine(
@QueryParam("virtualmachineid") long virtualMachineId, @QueryParam("ipaddressid") long IPAddressId, @QueryParam("virtualmachineid") long virtualMachineId, @QueryParam("ipaddressid") long IPAddressId,
@QueryParam("protocol") String protocol, @QueryParam("privateport") int privatePort, @QueryParam("protocol") String protocol, @QueryParam("privateport") int privatePort,
@QueryParam("publicport") int publicPort); @QueryParam("publicport") int publicPort);
/** /**
* @see FirewallClient#deletePortForwardingRule * @see FirewallClient#deletePortForwardingRule

View File

@ -41,8 +41,8 @@ public interface FirewallClient {
* *
* @param options * @param options
* if present, how to constrain the list. * if present, how to constrain the list.
* @return PortForwardingRules matching query, or empty set, if no PortForwardingRulees are * @return PortForwardingRules matching query, or empty set, if no
* found * PortForwardingRulees are found
*/ */
Set<PortForwardingRule> listPortForwardingRules(ListPortForwardingRulesOptions... options); Set<PortForwardingRule> listPortForwardingRules(ListPortForwardingRulesOptions... options);
@ -52,8 +52,8 @@ public interface FirewallClient {
* @param virtualMachineId * @param virtualMachineId
* the ID of the virtual machine for the port forwarding rule * the ID of the virtual machine for the port forwarding rule
* @param IPAddressId * @param IPAddressId
* the public IP address id of the forwarding rule, already associated via * the public IP address id of the forwarding rule, already
* associatePort * associated via associatePort
* @param protocol * @param protocol
* the protocol for the rule. Valid values are TCP or UDP. * the protocol for the rule. Valid values are TCP or UDP.
* @param privatePort * @param privatePort
@ -63,7 +63,7 @@ public interface FirewallClient {
* @return response used to track creation * @return response used to track creation
*/ */
AsyncCreateResponse createPortForwardingRuleForVirtualMachine(long virtualMachineId, long IPAddressId, AsyncCreateResponse createPortForwardingRuleForVirtualMachine(long virtualMachineId, long IPAddressId,
String protocol, int privatePort, int publicPort); String protocol, int privatePort, int publicPort);
/** /**
* Deletes an port forwarding rule * Deletes an port forwarding rule

View File

@ -57,7 +57,8 @@ public interface GuestOSClient {
/** /**
* Lists all supported OS categories for this cloud. * Lists all supported OS categories for this cloud.
* *
* @return os categories matching query, or empty set, if no categories are found * @return os categories matching query, or empty set, if no categories are
* found
*/ */
Map<Long, String> listOSCategories(); Map<Long, String> listOSCategories();

View File

@ -26,8 +26,8 @@ import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MediaType;
import org.jclouds.cloudstack.domain.LoadBalancerRule; import org.jclouds.cloudstack.domain.LoadBalancerRule;
import org.jclouds.cloudstack.domain.VirtualMachine;
import org.jclouds.cloudstack.domain.LoadBalancerRule.Algorithm; import org.jclouds.cloudstack.domain.LoadBalancerRule.Algorithm;
import org.jclouds.cloudstack.domain.VirtualMachine;
import org.jclouds.cloudstack.filters.QuerySigner; import org.jclouds.cloudstack.filters.QuerySigner;
import org.jclouds.cloudstack.options.ListLoadBalancerRulesOptions; import org.jclouds.cloudstack.options.ListLoadBalancerRulesOptions;
import org.jclouds.functions.JoinOnComma; import org.jclouds.functions.JoinOnComma;
@ -81,8 +81,8 @@ public interface LoadBalancerAsyncClient {
@Unwrap(depth = 2) @Unwrap(depth = 2)
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
ListenableFuture<LoadBalancerRule> createLoadBalancerRuleForPublicIP(@QueryParam("publicipid") long publicIPId, ListenableFuture<LoadBalancerRule> createLoadBalancerRuleForPublicIP(@QueryParam("publicipid") long publicIPId,
@QueryParam("algorithm") Algorithm algorithm, @QueryParam("name") String name, @QueryParam("algorithm") Algorithm algorithm, @QueryParam("name") String name,
@QueryParam("privateport") int privatePort, @QueryParam("publicport") int publicPort); @QueryParam("privateport") int privatePort, @QueryParam("publicport") int publicPort);
/** /**
* @see LoadBalancerClient#deleteLoadBalancerRule * @see LoadBalancerClient#deleteLoadBalancerRule
@ -103,7 +103,7 @@ public interface LoadBalancerAsyncClient {
@Unwrap(depth = 2) @Unwrap(depth = 2)
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
ListenableFuture<Long> assignVirtualMachinesToLoadBalancerRule(@QueryParam("id") long id, ListenableFuture<Long> assignVirtualMachinesToLoadBalancerRule(@QueryParam("id") long id,
@QueryParam("virtualmachineids") @ParamParser(JoinOnComma.class) Iterable<Long> virtualMachineIds); @QueryParam("virtualmachineids") @ParamParser(JoinOnComma.class) Iterable<Long> virtualMachineIds);
/** /**
* @see LoadBalancerClient#assignVirtualMachinesToLoadBalancerRule(long,long[]) * @see LoadBalancerClient#assignVirtualMachinesToLoadBalancerRule(long,long[])
@ -114,7 +114,7 @@ public interface LoadBalancerAsyncClient {
@Unwrap(depth = 2) @Unwrap(depth = 2)
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
ListenableFuture<Long> assignVirtualMachinesToLoadBalancerRule(@QueryParam("id") long id, ListenableFuture<Long> assignVirtualMachinesToLoadBalancerRule(@QueryParam("id") long id,
@QueryParam("virtualmachineids") @ParamParser(JoinOnComma.class) long... virtualMachineIds); @QueryParam("virtualmachineids") @ParamParser(JoinOnComma.class) long... virtualMachineIds);
/** /**
* @see LoadBalancerClient#removeVirtualMachinesFromLoadBalancerRule(long,Iterable) * @see LoadBalancerClient#removeVirtualMachinesFromLoadBalancerRule(long,Iterable)
@ -125,7 +125,7 @@ public interface LoadBalancerAsyncClient {
@Unwrap(depth = 2) @Unwrap(depth = 2)
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
ListenableFuture<Long> removeVirtualMachinesFromLoadBalancerRule(@QueryParam("id") long id, ListenableFuture<Long> removeVirtualMachinesFromLoadBalancerRule(@QueryParam("id") long id,
@QueryParam("virtualmachineids") @ParamParser(JoinOnComma.class) Iterable<Long> virtualMachineIds); @QueryParam("virtualmachineids") @ParamParser(JoinOnComma.class) Iterable<Long> virtualMachineIds);
/** /**
* @see LoadBalancerClient#removeVirtualMachinesFromLoadBalancerRule(long,long[]) * @see LoadBalancerClient#removeVirtualMachinesFromLoadBalancerRule(long,long[])
@ -136,7 +136,7 @@ public interface LoadBalancerAsyncClient {
@Unwrap(depth = 2) @Unwrap(depth = 2)
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
ListenableFuture<Long> removeVirtualMachinesFromLoadBalancerRule(@QueryParam("id") long id, ListenableFuture<Long> removeVirtualMachinesFromLoadBalancerRule(@QueryParam("id") long id,
@QueryParam("virtualmachineids") @ParamParser(JoinOnComma.class) long... virtualMachineIds); @QueryParam("virtualmachineids") @ParamParser(JoinOnComma.class) long... virtualMachineIds);
/** /**
* @see LoadBalancerClient#listVirtualMachinesAssignedToLoadBalancerRule * @see LoadBalancerClient#listVirtualMachinesAssignedToLoadBalancerRule

View File

@ -22,8 +22,8 @@ import java.util.Set;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import org.jclouds.cloudstack.domain.LoadBalancerRule; import org.jclouds.cloudstack.domain.LoadBalancerRule;
import org.jclouds.cloudstack.domain.VirtualMachine;
import org.jclouds.cloudstack.domain.LoadBalancerRule.Algorithm; import org.jclouds.cloudstack.domain.LoadBalancerRule.Algorithm;
import org.jclouds.cloudstack.domain.VirtualMachine;
import org.jclouds.cloudstack.options.ListLoadBalancerRulesOptions; import org.jclouds.cloudstack.options.ListLoadBalancerRulesOptions;
import org.jclouds.concurrent.Timeout; import org.jclouds.concurrent.Timeout;
@ -42,7 +42,8 @@ public interface LoadBalancerClient {
* *
* @param options * @param options
* if present, how to constrain the list. * if present, how to constrain the list.
* @return load balancer rules matching query, or empty set, if no load balancer rules are found * @return load balancer rules matching query, or empty set, if no load
* balancer rules are found
*/ */
Set<LoadBalancerRule> listLoadBalancerRules(ListLoadBalancerRulesOptions... options); Set<LoadBalancerRule> listLoadBalancerRules(ListLoadBalancerRulesOptions... options);
@ -59,20 +60,22 @@ public interface LoadBalancerClient {
* Creates a load balancer rule. * Creates a load balancer rule.
* *
* @param publicIPId * @param publicIPId
* the public port from where the network traffic will be load balanced from * the public port from where the network traffic will be load
* balanced from
* @param algorithm * @param algorithm
* load balancer algorithm (source, roundrobin, leastconn) * load balancer algorithm (source, roundrobin, leastconn)
* @param name * @param name
* name of the load balancer rule * name of the load balancer rule
* @param privatePort * @param privatePort
* the private port of the private ip address/virtual machine where the network traffic * the private port of the private ip address/virtual machine where
* will be load balanced to * the network traffic will be load balanced to
* @param publicPort * @param publicPort
* public ip address id from where the network traffic will be load balanced from * public ip address id from where the network traffic will be load
* balanced from
* @return newly created rule * @return newly created rule
*/ */
LoadBalancerRule createLoadBalancerRuleForPublicIP(long publicIPId, Algorithm algorithm, String name, LoadBalancerRule createLoadBalancerRuleForPublicIP(long publicIPId, Algorithm algorithm, String name,
int privatePort, int publicPort); int privatePort, int publicPort);
/** /**
* *
@ -80,63 +83,70 @@ public interface LoadBalancerClient {
* *
* @param id * @param id
* id of the rule to delete * id of the rule to delete
* @return async job id of the job completing or null, if the load balancer rule was not found. * @return async job id of the job completing or null, if the load balancer
* rule was not found.
*/ */
Long deleteLoadBalancerRule(long id); Long deleteLoadBalancerRule(long id);
/** /**
* List all virtual machine instances that are assigned to a load balancer rule. * List all virtual machine instances that are assigned to a load balancer
* rule.
* *
* @param id * @param id
* id of the rule * id of the rule
* @return VirtualMachines matching query, or empty set, if no VirtualMachines are assigned * @return VirtualMachines matching query, or empty set, if no
* VirtualMachines are assigned
*/ */
Set<VirtualMachine> listVirtualMachinesAssignedToLoadBalancerRule(long id); Set<VirtualMachine> listVirtualMachinesAssignedToLoadBalancerRule(long id);
/** /**
* Assigns virtual machine or a list of virtual machines to a load balancer rule. * Assigns virtual machine or a list of virtual machines to a load balancer
* rule.
* *
* @param id * @param id
* the ID of the load balancer rule * the ID of the load balancer rule
* @param virtualMachineIds * @param virtualMachineIds
* the list of IDs of the virtual machine that are being assigned to the load balancer * the list of IDs of the virtual machine that are being assigned
* rule * to the load balancer rule
* @return job id related to the operation * @return job id related to the operation
*/ */
long assignVirtualMachinesToLoadBalancerRule(long id, Iterable<Long> virtualMachineIds); long assignVirtualMachinesToLoadBalancerRule(long id, Iterable<Long> virtualMachineIds);
/** /**
* Assigns virtual machine or a list of virtual machines to a load balancer rule. * Assigns virtual machine or a list of virtual machines to a load balancer
* rule.
* *
* @param id * @param id
* the ID of the load balancer rule * the ID of the load balancer rule
* @param virtualMachineIds * @param virtualMachineIds
* the list of IDs of the virtual machine that are being assigned to the load balancer * the list of IDs of the virtual machine that are being assigned
* rule * to the load balancer rule
* @return job id related to the operation * @return job id related to the operation
*/ */
long assignVirtualMachinesToLoadBalancerRule(long id, long... virtualMachineIds); long assignVirtualMachinesToLoadBalancerRule(long id, long... virtualMachineIds);
/** /**
* Removes a virtual machine or a list of virtual machines from a load balancer rule. * Removes a virtual machine or a list of virtual machines from a load
* balancer rule.
* *
* @param id * @param id
* the ID of the load balancer rule * the ID of the load balancer rule
* @param virtualMachineIds * @param virtualMachineIds
* the list of IDs of the virtual machine that are being removed from the load balancer * the list of IDs of the virtual machine that are being removed
* rule * from the load balancer rule
* @return job id related to the operation * @return job id related to the operation
*/ */
long removeVirtualMachinesFromLoadBalancerRule(long id, Iterable<Long> virtualMachineIds); long removeVirtualMachinesFromLoadBalancerRule(long id, Iterable<Long> virtualMachineIds);
/** /**
* Removes a virtual machine or a list of virtual machines from a load balancer rule. * Removes a virtual machine or a list of virtual machines from a load
* balancer rule.
* *
* @param id * @param id
* the ID of the load balancer rule * the ID of the load balancer rule
* @param virtualMachineIds * @param virtualMachineIds
* the list of IDs of the virtual machine that are being removed from the load balancer * the list of IDs of the virtual machine that are being removed
* rule * from the load balancer rule
* @return job id related to the operation * @return job id related to the operation
*/ */
long removeVirtualMachinesFromLoadBalancerRule(long id, long... virtualMachineIds); long removeVirtualMachinesFromLoadBalancerRule(long id, long... virtualMachineIds);

View File

@ -42,7 +42,8 @@ public interface NATClient {
* *
* @param options * @param options
* if present, how to constrain the list. * if present, how to constrain the list.
* @return IPForwardingRulees matching query, or empty set, if no IPForwardingRulees are found * @return IPForwardingRulees matching query, or empty set, if no
* IPForwardingRulees are found
*/ */
Set<IPForwardingRule> listIPForwardingRules(ListIPForwardingRulesOptions... options); Set<IPForwardingRule> listIPForwardingRules(ListIPForwardingRulesOptions... options);
@ -59,7 +60,8 @@ public interface NATClient {
* Creates an ip forwarding rule * Creates an ip forwarding rule
* *
* @param IPAddressId * @param IPAddressId
* the public IP address id of the forwarding rule, already associated via associateIp * the public IP address id of the forwarding rule, already
* associated via associateIp
* @param protocol * @param protocol
* the protocol for the rule. Valid values are TCP or UDP. * the protocol for the rule. Valid values are TCP or UDP.
* @param startPort * @param startPort

View File

@ -77,8 +77,8 @@ public interface NetworkClient {
* *
* @param id * @param id
* the ID of the network * the ID of the network
* @return job id related to destroying the network, or null if resource was not * @return job id related to destroying the network, or null if resource was
* found * not found
*/ */
Long deleteNetwork(long id); Long deleteNetwork(long id);
} }

View File

@ -44,7 +44,8 @@ public interface OfferingClient {
* *
* @param options * @param options
* if present, how to constrain the list. * if present, how to constrain the list.
* @return service offerings matching query, or empty set, if no service offerings are found * @return service offerings matching query, or empty set, if no service
* offerings are found
*/ */
Set<ServiceOffering> listServiceOfferings(ListServiceOfferingsOptions... options); Set<ServiceOffering> listServiceOfferings(ListServiceOfferingsOptions... options);
@ -62,7 +63,8 @@ public interface OfferingClient {
* *
* @param options * @param options
* if present, how to constrain the list. * if present, how to constrain the list.
* @return disk offerings matching query, or empty set, if no disk offerings are found * @return disk offerings matching query, or empty set, if no disk offerings
* are found
*/ */
Set<DiskOffering> listDiskOfferings(ListDiskOfferingsOptions... options); Set<DiskOffering> listDiskOfferings(ListDiskOfferingsOptions... options);
@ -80,7 +82,8 @@ public interface OfferingClient {
* *
* @param options * @param options
* if present, how to constrain the list. * if present, how to constrain the list.
* @return service offerings matching query, or empty set, if no service offerings are found * @return service offerings matching query, or empty set, if no service
* offerings are found
*/ */
Set<NetworkOffering> listNetworkOfferings(ListNetworkOfferingsOptions... options); Set<NetworkOffering> listNetworkOfferings(ListNetworkOfferingsOptions... options);

View File

@ -18,30 +18,51 @@
*/ */
package org.jclouds.cloudstack.features; package org.jclouds.cloudstack.features;
import com.google.common.util.concurrent.ListenableFuture; import java.util.Set;
import org.jclouds.cloudstack.filters.QuerySigner;
import org.jclouds.rest.annotations.QueryParams;
import org.jclouds.rest.annotations.RequestFilters;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET; import javax.ws.rs.GET;
import javax.ws.rs.QueryParam; import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import org.jclouds.cloudstack.domain.SSHKeyPair;
import org.jclouds.cloudstack.filters.QuerySigner;
import org.jclouds.cloudstack.options.ListSSHKeyPairsOptions;
import org.jclouds.rest.annotations.ExceptionParser;
import org.jclouds.rest.annotations.OnlyElement;
import org.jclouds.rest.annotations.QueryParams;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.SelectJson;
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
import com.google.common.util.concurrent.ListenableFuture;
@RequestFilters(QuerySigner.class) @RequestFilters(QuerySigner.class)
@QueryParams(keys = "response", values = "json") @QueryParams(keys = "response", values = "json")
public interface SSHKeyPairAsyncClient { public interface SSHKeyPairAsyncClient {
/** /**
* @see AccountClient#listAccounts * @see org.jclouds.cloudstack.features.SSHKeyPairClient#listSSHKeyPairs
*/ */
@GET @GET
@QueryParams(keys = "command", values = "listSSHKeyPairs") @QueryParams(keys = "command", values = "listSSHKeyPairs")
// @SelectJson("") @SelectJson("keypair")
// @Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
// @ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) @ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
// ListenableFuture<Set<SSHKeyPair>> listSSHKeyPairs(); ListenableFuture<Set<SSHKeyPair>> listSSHKeyPairs(ListSSHKeyPairsOptions... options);
ListenableFuture<String> listSSHKeyPairs();
@GET @GET
@QueryParams(keys = "command", values="createSSHKeyPair") @QueryParams(keys = "command", values = "createSSHKeyPair")
ListenableFuture<String> createSSHKeyPair(@QueryParam("name") String name); @SelectJson("keypair")
@Consumes(MediaType.APPLICATION_JSON)
ListenableFuture<SSHKeyPair> createSSHKeyPair(@QueryParam("name") String name);
@GET
@QueryParams(keys = "command", values = "listSSHKeyPairs")
@SelectJson("keypair")
@OnlyElement()
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<SSHKeyPair> getSSHKeyPair(@QueryParam("name") String name);
} }

View File

@ -1,22 +1,27 @@
package org.jclouds.cloudstack.features; package org.jclouds.cloudstack.features;
import org.jclouds.concurrent.Timeout; import java.util.Set;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import org.jclouds.cloudstack.domain.SSHKeyPair;
import org.jclouds.cloudstack.options.ListSSHKeyPairsOptions;
import org.jclouds.concurrent.Timeout;
/** /**
* Provides synchronous access to CloudStack SSHKeyPair features. * Provides synchronous access to CloudStack SSHKeyPair features.
* <p/> * <p/>
* *
* @author Adrian Cole * @author Adrian Cole
* @see <a href="http://download.cloud.com/releases/2.2.0/api_2.2.8/user/listSSHKeyPairs.html" /> * @see <a href=
* "http://download.cloud.com/releases/2.2.0/api_2.2.8/user/listSSHKeyPairs.html"
* />
*/ */
@Timeout(duration = 60, timeUnit = TimeUnit.SECONDS) @Timeout(duration = 60, timeUnit = TimeUnit.SECONDS)
public interface SSHKeyPairClient { public interface SSHKeyPairClient {
String listSSHKeyPairs(); Set<SSHKeyPair> listSSHKeyPairs(ListSSHKeyPairsOptions... options);
String createSSHKeyPair(String name); SSHKeyPair createSSHKeyPair(String name);
} SSHKeyPair getSSHKeyPair(String name);
}

View File

@ -95,10 +95,10 @@ public interface SecurityGroupAsyncClient {
@Unwrap(depth = 2) @Unwrap(depth = 2)
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
ListenableFuture<Long> authorizeIngressPortsToCIDRs(@QueryParam("securitygroupid") long securityGroupId, ListenableFuture<Long> authorizeIngressPortsToCIDRs(@QueryParam("securitygroupid") long securityGroupId,
@QueryParam("protocol") String protocol, @QueryParam("startport") int startPort, @QueryParam("protocol") String protocol, @QueryParam("startport") int startPort,
@QueryParam("endport") int endPort, @QueryParam("endport") int endPort,
@BinderParam(BindCIDRsToCommaDelimitedQueryParam.class) Iterable<String> cidrList, @BinderParam(BindCIDRsToCommaDelimitedQueryParam.class) Iterable<String> cidrList,
AccountInDomainOptions... options); AccountInDomainOptions... options);
/** /**
* @see SecurityGroupClient#authorizeIngressPortsToSecurityGroups * @see SecurityGroupClient#authorizeIngressPortsToSecurityGroups
@ -107,13 +107,11 @@ public interface SecurityGroupAsyncClient {
@QueryParams(keys = "command", values = "authorizeSecurityGroupIngress") @QueryParams(keys = "command", values = "authorizeSecurityGroupIngress")
@Unwrap(depth = 2) @Unwrap(depth = 2)
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
ListenableFuture<Long> authorizeIngressPortsToSecurityGroups( ListenableFuture<Long> authorizeIngressPortsToSecurityGroups(@QueryParam("securitygroupid") long securityGroupId,
@QueryParam("securitygroupid") long securityGroupId, @QueryParam("protocol") String protocol, @QueryParam("startport") int startPort,
@QueryParam("protocol") String protocol, @QueryParam("endport") int endPort,
@QueryParam("startport") int startPort, @BinderParam(BindAccountSecurityGroupPairsToIndexedQueryParams.class) Multimap<String, String> accountToGroup,
@QueryParam("endport") int endPort, AccountInDomainOptions... options);
@BinderParam(BindAccountSecurityGroupPairsToIndexedQueryParams.class) Multimap<String, String> accountToGroup,
AccountInDomainOptions... options);
/** /**
* @see SecurityGroupClient#authorizeIngressICMPToCIDRs * @see SecurityGroupClient#authorizeIngressICMPToCIDRs
@ -123,9 +121,9 @@ public interface SecurityGroupAsyncClient {
@Unwrap(depth = 2) @Unwrap(depth = 2)
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
ListenableFuture<Long> authorizeIngressICMPToCIDRs(@QueryParam("securitygroupid") long securityGroupId, ListenableFuture<Long> authorizeIngressICMPToCIDRs(@QueryParam("securitygroupid") long securityGroupId,
@QueryParam("icmpcode") int ICMPCode, @QueryParam("icmptype") int ICMPType, @QueryParam("icmpcode") int ICMPCode, @QueryParam("icmptype") int ICMPType,
@BinderParam(BindCIDRsToCommaDelimitedQueryParam.class) Iterable<String> cidrList, @BinderParam(BindCIDRsToCommaDelimitedQueryParam.class) Iterable<String> cidrList,
AccountInDomainOptions... options); AccountInDomainOptions... options);
/** /**
* @see SecurityGroupClient#authorizeIngressICMPToSecurityGroups * @see SecurityGroupClient#authorizeIngressICMPToSecurityGroups
@ -134,12 +132,10 @@ public interface SecurityGroupAsyncClient {
@QueryParams(keys = { "command", "protocol" }, values = { "authorizeSecurityGroupIngress", "ICMP" }) @QueryParams(keys = { "command", "protocol" }, values = { "authorizeSecurityGroupIngress", "ICMP" })
@Unwrap(depth = 2) @Unwrap(depth = 2)
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
ListenableFuture<Long> authorizeIngressICMPToSecurityGroups( ListenableFuture<Long> authorizeIngressICMPToSecurityGroups(@QueryParam("securitygroupid") long securityGroupId,
@QueryParam("securitygroupid") long securityGroupId, @QueryParam("icmpcode") int ICMPCode, @QueryParam("icmptype") int ICMPType,
@QueryParam("icmpcode") int ICMPCode, @BinderParam(BindAccountSecurityGroupPairsToIndexedQueryParams.class) Multimap<String, String> accountToGroup,
@QueryParam("icmptype") int ICMPType, AccountInDomainOptions... options);
@BinderParam(BindAccountSecurityGroupPairsToIndexedQueryParams.class) Multimap<String, String> accountToGroup,
AccountInDomainOptions... options);
/** /**
* @see SecurityGroupClient#revokeIngressRule * @see SecurityGroupClient#revokeIngressRule

View File

@ -43,7 +43,8 @@ public interface SecurityGroupClient {
* *
* @param options * @param options
* if present, how to constrain the list. * if present, how to constrain the list.
* @return security groups matching query, or empty set, if no security groups are found * @return security groups matching query, or empty set, if no security
* groups are found
*/ */
Set<SecurityGroup> listSecurityGroups(ListSecurityGroupsOptions... options); Set<SecurityGroup> listSecurityGroups(ListSecurityGroupsOptions... options);
@ -63,7 +64,7 @@ public interface SecurityGroupClient {
* @return response relating to the creation of this ingress rule * @return response relating to the creation of this ingress rule
*/ */
long authorizeIngressPortsToCIDRs(long securityGroupId, String protocol, int startPort, int endPort, long authorizeIngressPortsToCIDRs(long securityGroupId, String protocol, int startPort, int endPort,
Iterable<String> cidrList, AccountInDomainOptions... options); Iterable<String> cidrList, AccountInDomainOptions... options);
/** /**
* Authorizes a particular TCP or UDP ingress rule for this security group * Authorizes a particular TCP or UDP ingress rule for this security group
@ -77,11 +78,12 @@ public interface SecurityGroupClient {
* @param endPort * @param endPort
* end port for this ingress rule * end port for this ingress rule
* @param accountToGroup * @param accountToGroup
* mapping of account names to security groups you wish to authorize * mapping of account names to security groups you wish to
* authorize
* @return response relating to the creation of this ingress rule * @return response relating to the creation of this ingress rule
*/ */
long authorizeIngressPortsToSecurityGroups(long securityGroupId, String protocol, int startPort, long authorizeIngressPortsToSecurityGroups(long securityGroupId, String protocol, int startPort, int endPort,
int endPort, Multimap<String, String> accountToGroup, AccountInDomainOptions... options); Multimap<String, String> accountToGroup, AccountInDomainOptions... options);
/** /**
* Authorizes a particular ICMP ingress rule for this security group * Authorizes a particular ICMP ingress rule for this security group
@ -96,8 +98,8 @@ public interface SecurityGroupClient {
* the cidr list associated * the cidr list associated
* @return response relating to the creation of this ingress rule * @return response relating to the creation of this ingress rule
*/ */
long authorizeIngressICMPToCIDRs(long securityGroupId, int ICMPCode, int ICMPType, long authorizeIngressICMPToCIDRs(long securityGroupId, int ICMPCode, int ICMPType, Iterable<String> cidrList,
Iterable<String> cidrList, AccountInDomainOptions... options); AccountInDomainOptions... options);
/** /**
* Authorizes a particular ICMP ingress rule for this security group * Authorizes a particular ICMP ingress rule for this security group
@ -109,17 +111,20 @@ public interface SecurityGroupClient {
* @param ICMPType * @param ICMPType
* error code for this icmp message * error code for this icmp message
* @param accountToGroup * @param accountToGroup
* mapping of account names to security groups you wish to authorize * mapping of account names to security groups you wish to
* authorize
* @return response relating to the creation of this ingress rule * @return response relating to the creation of this ingress rule
*/ */
long authorizeIngressICMPToSecurityGroups(long securityGroupId, int ICMPCode, int ICMPType, long authorizeIngressICMPToSecurityGroups(long securityGroupId, int ICMPCode, int ICMPType,
Multimap<String, String> accountToGroup, AccountInDomainOptions... options); Multimap<String, String> accountToGroup, AccountInDomainOptions... options);
/** /**
* Deletes a particular ingress rule from this security group * Deletes a particular ingress rule from this security group
* *
* @param id The ID of the ingress rule * @param id
* @param options scope of the rule. * The ID of the ingress rule
* @param options
* scope of the rule.
*/ */
long revokeIngressRule(long id, AccountInDomainOptions... options);; long revokeIngressRule(long id, AccountInDomainOptions... options);;

View File

@ -47,7 +47,8 @@ public interface TemplateClient {
* List all public, private, and privileged templates. * List all public, private, and privileged templates.
* *
* @param options * @param options
* if present, how to constrain the list, defaults to all executable templates * if present, how to constrain the list, defaults to all
* executable templates
* @return templates matching query, or empty set, if no templates are found * @return templates matching query, or empty set, if no templates are found
* @see TemplateFilter * @see TemplateFilter
*/ */

View File

@ -81,9 +81,9 @@ public interface VirtualMachineAsyncClient {
@QueryParams(keys = "command", values = "deployVirtualMachine") @QueryParams(keys = "command", values = "deployVirtualMachine")
@Unwrap @Unwrap
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
ListenableFuture<AsyncCreateResponse> deployVirtualMachineInZone( @QueryParam("zoneid") long zoneId, @QueryParam("serviceofferingid") long serviceOfferingId, ListenableFuture<AsyncCreateResponse> deployVirtualMachineInZone(@QueryParam("zoneid") long zoneId,
@QueryParam("templateid") long templateId, @QueryParam("serviceofferingid") long serviceOfferingId, @QueryParam("templateid") long templateId,
DeployVirtualMachineOptions... options); DeployVirtualMachineOptions... options);
/** /**
* @see VirtualMachineClient#rebootVirtualMachine * @see VirtualMachineClient#rebootVirtualMachine

View File

@ -42,7 +42,8 @@ public interface VirtualMachineClient {
* *
* @param options * @param options
* if present, how to constrain the list. * if present, how to constrain the list.
* @return VirtualMachines matching query, or empty set, if no VirtualMachines are found * @return VirtualMachines matching query, or empty set, if no
* VirtualMachines are found
*/ */
Set<VirtualMachine> listVirtualMachines(ListVirtualMachinesOptions... options); Set<VirtualMachine> listVirtualMachines(ListVirtualMachinesOptions... options);
@ -56,8 +57,8 @@ public interface VirtualMachineClient {
VirtualMachine getVirtualMachine(long id); VirtualMachine getVirtualMachine(long id);
/** /**
* Creates and automatically starts a virtual machine based on a service offering, disk offering, * Creates and automatically starts a virtual machine based on a service
* and template. * offering, disk offering, and template.
* *
* @param zoneId * @param zoneId
* availability zone for the virtual machine * availability zone for the virtual machine
@ -69,7 +70,7 @@ public interface VirtualMachineClient {
* @return virtual machine * @return virtual machine
*/ */
AsyncCreateResponse deployVirtualMachineInZone(long zoneId, long serviceOfferingId, long templateId, AsyncCreateResponse deployVirtualMachineInZone(long zoneId, long serviceOfferingId, long templateId,
DeployVirtualMachineOptions... options); DeployVirtualMachineOptions... options);
/** /**
* Reboots a virtual machine. * Reboots a virtual machine.
@ -99,8 +100,9 @@ public interface VirtualMachineClient {
Long stopVirtualMachine(long id); Long stopVirtualMachine(long id);
/** /**
* Resets the password for virtual machine. The virtual machine must be in a "Stopped" state and * Resets the password for virtual machine. The virtual machine must be in a
* the template must already support this feature for this command to take effect. * "Stopped" state and the template must already support this feature for
* this command to take effect.
* *
* @param id * @param id
* The ID of the virtual machine * The ID of the virtual machine
@ -109,8 +111,8 @@ public interface VirtualMachineClient {
Long resetPasswordForVirtualMachine(long id); Long resetPasswordForVirtualMachine(long id);
/** /**
* Changes the service offering for a virtual machine. The virtual machine must be in a "Stopped" * Changes the service offering for a virtual machine. The virtual machine
* state for this command to take effect. * must be in a "Stopped" state for this command to take effect.
* *
* @param id * @param id
* The ID of the virtual machine * The ID of the virtual machine
@ -128,11 +130,13 @@ public interface VirtualMachineClient {
Long updateVirtualMachine(long id); Long updateVirtualMachine(long id);
/** /**
* Destroys a virtual machine. Once destroyed, only the administrator can recover it. * Destroys a virtual machine. Once destroyed, only the administrator can
* recover it.
* *
* @param id * @param id
* vm to destroy * vm to destroy
* @return job id related to destroying the VM, or null if resource was not found * @return job id related to destroying the VM, or null if resource was not
* found
*/ */
Long destroyVirtualMachine(long id); Long destroyVirtualMachine(long id);
} }

View File

@ -126,7 +126,7 @@ public class QuerySigner implements HttpRequestFilter, RequestSigner {
ImmutableSortedSet.Builder<String> builder = ImmutableSortedSet.<String> naturalOrder(); ImmutableSortedSet.Builder<String> builder = ImmutableSortedSet.<String> naturalOrder();
for (Entry<String, String> entry : decodedParams.entries()) for (Entry<String, String> entry : decodedParams.entries())
builder.add(entry.getKey() + "=" + Strings2.urlEncode(entry.getValue())); builder.add(entry.getKey() + "=" + Strings2.urlEncode(entry.getValue()));
// then, lower case the entire query string // then, lower case the entire query string
String stringToSign = Joiner.on('&').join(builder.build()).toLowerCase(); String stringToSign = Joiner.on('&').join(builder.build()).toLowerCase();
if (signatureWire.enabled()) if (signatureWire.enabled())

View File

@ -42,7 +42,8 @@ public class ParseAsyncJobFromHttpResponse implements Function<HttpResponse, Asy
private final ParseTypedAsyncJob parseTyped; private final ParseTypedAsyncJob parseTyped;
@Inject @Inject
public ParseAsyncJobFromHttpResponse(ParseTypedAsyncJob parseTyped, UnwrapOnlyJsonValue<AsyncJob<Map<String, JsonBall>>> parser) { public ParseAsyncJobFromHttpResponse(ParseTypedAsyncJob parseTyped,
UnwrapOnlyJsonValue<AsyncJob<Map<String, JsonBall>>> parser) {
this.parseTyped = checkNotNull(parseTyped, "parseTyped"); this.parseTyped = checkNotNull(parseTyped, "parseTyped");
this.parser = checkNotNull(parser, "parser"); this.parser = checkNotNull(parser, "parser");
} }

View File

@ -74,8 +74,9 @@ public class ParseNamesFromHttpResponse implements Function<HttpResponse, Set<St
@Inject @Inject
public ParseNamesFromHttpResponse(GsonWrapper gsonWrapper) { public ParseNamesFromHttpResponse(GsonWrapper gsonWrapper) {
this.parser = new ParseFirstJsonValueNamed<Set<Name>>(checkNotNull(gsonWrapper, "gsonWrapper"), new TypeLiteral<Set<Name>>(){}, this.parser = new ParseFirstJsonValueNamed<Set<Name>>(checkNotNull(gsonWrapper, "gsonWrapper"),
"hypervisor"); new TypeLiteral<Set<Name>>() {
}, "hypervisor");
} }
public Set<String> apply(HttpResponse response) { public Set<String> apply(HttpResponse response) {

View File

@ -28,6 +28,7 @@ import javax.inject.Named;
import javax.inject.Singleton; import javax.inject.Singleton;
import org.jclouds.cloudstack.domain.AsyncJob; import org.jclouds.cloudstack.domain.AsyncJob;
import org.jclouds.cloudstack.domain.AsyncJob.Builder;
import org.jclouds.cloudstack.domain.AsyncJobError; import org.jclouds.cloudstack.domain.AsyncJobError;
import org.jclouds.cloudstack.domain.IPForwardingRule; import org.jclouds.cloudstack.domain.IPForwardingRule;
import org.jclouds.cloudstack.domain.Network; import org.jclouds.cloudstack.domain.Network;
@ -36,7 +37,6 @@ import org.jclouds.cloudstack.domain.PublicIPAddress;
import org.jclouds.cloudstack.domain.SecurityGroup; import org.jclouds.cloudstack.domain.SecurityGroup;
import org.jclouds.cloudstack.domain.Template; import org.jclouds.cloudstack.domain.Template;
import org.jclouds.cloudstack.domain.VirtualMachine; import org.jclouds.cloudstack.domain.VirtualMachine;
import org.jclouds.cloudstack.domain.AsyncJob.Builder;
import org.jclouds.domain.JsonBall; import org.jclouds.domain.JsonBall;
import org.jclouds.json.Json; import org.jclouds.json.Json;
import org.jclouds.logging.Logger; import org.jclouds.logging.Logger;
@ -60,9 +60,9 @@ public class ParseTypedAsyncJob implements Function<AsyncJob<Map<String, JsonBal
@VisibleForTesting @VisibleForTesting
@Named("jclouds.cloudstack.jobresult-type-map") @Named("jclouds.cloudstack.jobresult-type-map")
Map<String, Class<?>> typeMap = ImmutableMap.<String, Class<?>> builder().put("securitygroup", SecurityGroup.class) Map<String, Class<?>> typeMap = ImmutableMap.<String, Class<?>> builder().put("securitygroup", SecurityGroup.class)
.put("portforwardingrule", PortForwardingRule.class).put("ipforwardingrule", IPForwardingRule.class).put( .put("portforwardingrule", PortForwardingRule.class).put("ipforwardingrule", IPForwardingRule.class)
"template", Template.class).put("network", Network.class).put("ipaddress", PublicIPAddress.class) .put("template", Template.class).put("network", Network.class).put("ipaddress", PublicIPAddress.class)
.put("virtualmachine", VirtualMachine.class).build(); .put("virtualmachine", VirtualMachine.class).build();
private final Json json; private final Json json;
@Inject @Inject
@ -74,7 +74,7 @@ public class ParseTypedAsyncJob implements Function<AsyncJob<Map<String, JsonBal
AsyncJob<?> result = toParse; AsyncJob<?> result = toParse;
if (toParse.getResult() != null) { if (toParse.getResult() != null) {
if (toParse.getResult().size() == 1) { if (toParse.getResult().size() == 1) {
@SuppressWarnings( { "unchecked", "rawtypes" }) @SuppressWarnings({ "unchecked", "rawtypes" })
Builder<Object> builder = AsyncJob.Builder.fromAsyncJobUntyped((AsyncJob) toParse); Builder<Object> builder = AsyncJob.Builder.fromAsyncJobUntyped((AsyncJob) toParse);
if (toParse.getResult().containsKey("success")) { if (toParse.getResult().containsKey("success")) {
builder.result(null); builder.result(null);
@ -83,25 +83,24 @@ public class ParseTypedAsyncJob implements Function<AsyncJob<Map<String, JsonBal
if (typeMap.containsKey(entry.getKey())) { if (typeMap.containsKey(entry.getKey())) {
builder.result(json.fromJson(entry.getValue().toString(), typeMap.get(entry.getKey()))); builder.result(json.fromJson(entry.getValue().toString(), typeMap.get(entry.getKey())));
} else { } else {
logger logger.warn(
.warn( "type key %s not configured. please override default for Map<String, Class<?>> bound to name jclouds.cloudstack.jobresult-type-map",
"type key %s not configured. please override default for Map<String, Class<?>> bound to name jclouds.cloudstack.jobresult-type-map", entry.getKey());
entry.getKey());
builder.result(entry.getValue().toString()); builder.result(entry.getValue().toString());
} }
} }
result = builder.build(); result = builder.build();
} else if (toParse.getResult().containsKey("errorcode")) { } else if (toParse.getResult().containsKey("errorcode")) {
@SuppressWarnings( { "unchecked", "rawtypes" }) @SuppressWarnings({ "unchecked", "rawtypes" })
Builder<Object> builder = AsyncJob.Builder.fromAsyncJobUntyped((AsyncJob) toParse); Builder<Object> builder = AsyncJob.Builder.fromAsyncJobUntyped((AsyncJob) toParse);
builder.result(null);// avoid classcastexceptions builder.result(null);// avoid classcastexceptions
builder.error(new AsyncJobError(Integer.parseInt(toParse.getResult().get("errorcode").toString()), toParse builder.error(new AsyncJobError(Integer.parseInt(toParse.getResult().get("errorcode").toString()), toParse
.getResult().containsKey("errortext") ? toParse.getResult().get("errortext").toString().replace( .getResult().containsKey("errortext") ? toParse.getResult().get("errortext").toString()
"\"", "") : null)); .replace("\"", "") : null));
result = builder.build(); result = builder.build();
} else if (toParse.getResult().size() > 1) { } else if (toParse.getResult().size() > 1) {
logger.warn("unexpected size of async job result; expecting a map with a single element", toParse logger.warn("unexpected size of async job result; expecting a map with a single element",
.getResult()); toParse.getResult());
} }
} }
return result; return result;

View File

@ -29,9 +29,9 @@ import org.jclouds.util.Throwables2;
import com.google.common.base.Function; import com.google.common.base.Function;
/** /**
* CloudStack is currently sending 431 errors with the text "Unable to find account owner for ip ". * CloudStack is currently sending 431 errors with the text
* In this case, we have to ignore as there's no means for us to avoid the problem, or action to * "Unable to find account owner for ip ". In this case, we have to ignore as
* take. * there's no means for us to avoid the problem, or action to take.
* *
* @author Adrian Cole * @author Adrian Cole
*/ */

View File

@ -58,14 +58,14 @@ public class ReuseOrAssociateNewPublicIPAddress implements Function<Network, Pub
protected Logger logger = Logger.NULL; protected Logger logger = Logger.NULL;
@Inject @Inject
public public ReuseOrAssociateNewPublicIPAddress(CloudStackClient client, Predicate<Long> jobComplete) {
ReuseOrAssociateNewPublicIPAddress(CloudStackClient client, Predicate<Long> jobComplete) {
this.client = checkNotNull(client, "client"); this.client = checkNotNull(client, "client");
this.jobComplete = checkNotNull(jobComplete, "jobComplete"); this.jobComplete = checkNotNull(jobComplete, "jobComplete");
} }
/** /**
* Finds existing addresses who are ready for use and not assigned to a machine. * Finds existing addresses who are ready for use and not assigned to a
* machine.
* *
* @param networkId * @param networkId
* network id to search * network id to search
@ -76,14 +76,14 @@ public class ReuseOrAssociateNewPublicIPAddress implements Function<Network, Pub
* if there's no existing ip address that is free for use * if there's no existing ip address that is free for use
*/ */
public static PublicIPAddress findAvailableAndAssociatedWithNetwork(long networkId, AddressClient client) { public static PublicIPAddress findAvailableAndAssociatedWithNetwork(long networkId, AddressClient client) {
return find(client.listPublicIPAddresses(allocatedOnly(true).networkId(networkId)), and( return find(client.listPublicIPAddresses(allocatedOnly(true).networkId(networkId)),
associatedWithNetwork(networkId), available())); and(associatedWithNetwork(networkId), available()));
} }
public static PublicIPAddress associateIPAddressInNetwork(Network network, CloudStackClient client, public static PublicIPAddress associateIPAddressInNetwork(Network network, CloudStackClient client,
Predicate<Long> jobComplete) { Predicate<Long> jobComplete) {
AsyncCreateResponse job = client.getAddressClient().associateIPAddressInZone(network.getZoneId(), AsyncCreateResponse job = client.getAddressClient().associateIPAddressInZone(network.getZoneId(),
networkId(network.getId())); networkId(network.getId()));
checkState(jobComplete.apply(job.getJobId()), "job %d failed to complete", job.getJobId()); checkState(jobComplete.apply(job.getJobId()), "job %d failed to complete", job.getJobId());
PublicIPAddress ip = client.getAsyncJobClient().<PublicIPAddress> getAsyncJob(job.getJobId()).getResult(); PublicIPAddress ip = client.getAsyncJobClient().<PublicIPAddress> getAsyncJob(job.getJobId()).getResult();
assert ip.getZoneId() == network.getZoneId(); assert ip.getZoneId() == network.getZoneId();

View File

@ -23,7 +23,9 @@ import com.google.common.collect.ImmutableSet;
/** /**
* Options used to acquire and associate a public IP to an account. * Options used to acquire and associate a public IP to an account.
* *
* @see <a href="http://download.cloud.com/releases/2.2.0/api/user/associateIpAddress.html" /> * @see <a href=
* "http://download.cloud.com/releases/2.2.0/api/user/associateIpAddress.html"
* />
* @author Adrian Cole * @author Adrian Cole
*/ */
public class AssociateIPAddressOptions extends AccountInDomainOptions { public class AssociateIPAddressOptions extends AccountInDomainOptions {

View File

@ -25,7 +25,9 @@ import com.google.common.collect.ImmutableSet;
/** /**
* Options used to create an ip forwarding rule * Options used to create an ip forwarding rule
* *
* @see <a href="http://download.cloud.com/releases/2.2.0/api/user/createIpForwardingRule.html" /> * @see <a href=
* "http://download.cloud.com/releases/2.2.0/api/user/createIpForwardingRule.html"
* />
* @author Adrian Cole * @author Adrian Cole
*/ */
public class CreateIPForwardingRuleOptions extends BaseHttpRequestOptions { public class CreateIPForwardingRuleOptions extends BaseHttpRequestOptions {

View File

@ -23,7 +23,9 @@ import com.google.common.collect.ImmutableSet;
/** /**
* Options used to control what networks information is returned * Options used to control what networks information is returned
* *
* @see <a href="http://download.cloud.com/releases/2.2.0/api/user/listNetworks.html" /> * @see <a
* href="http://download.cloud.com/releases/2.2.0/api/user/listNetworks.html"
* />
* @author Adrian Cole * @author Adrian Cole
*/ */
public class CreateNetworkOptions extends AccountInDomainOptions { public class CreateNetworkOptions extends AccountInDomainOptions {

View File

@ -29,7 +29,9 @@ import com.google.common.collect.ImmutableSet;
/** /**
* Options used to control what disk offerings are returned * Options used to control what disk offerings are returned
* *
* @see <a href="http://download.cloud.com/releases/2.2.0/api/user/deployVirtualMachine.html" /> * @see <a href=
* "http://download.cloud.com/releases/2.2.0/api/user/deployVirtualMachine.html"
* />
* @author Adrian Cole * @author Adrian Cole
*/ */
public class DeployVirtualMachineOptions extends AccountInDomainOptions { public class DeployVirtualMachineOptions extends AccountInDomainOptions {
@ -37,11 +39,13 @@ public class DeployVirtualMachineOptions extends AccountInDomainOptions {
public static final DeployVirtualMachineOptions NONE = new DeployVirtualMachineOptions(); public static final DeployVirtualMachineOptions NONE = new DeployVirtualMachineOptions();
/** /**
* the ID of the disk offering for the virtual machine. If the template is of ISO format, the * the ID of the disk offering for the virtual machine. If the template is of
* diskOfferingId is for the root disk volume. Otherwise this parameter is used to dinidcate the * ISO format, the diskOfferingId is for the root disk volume. Otherwise this
* offering for the data disk volume. If the templateId parameter passed is from a Template * parameter is used to dinidcate the offering for the data disk volume. If
* object, the diskOfferingId refers to a DATA Disk Volume created. If the templateId parameter * the templateId parameter passed is from a Template object, the
* passed is from an ISO object, the diskOfferingId refers to a ROOT Disk Volume created. * diskOfferingId refers to a DATA Disk Volume created. If the templateId
* parameter passed is from an ISO object, the diskOfferingId refers to a
* ROOT Disk Volume created.
* *
* @param id * @param id
* the ID of the disk offering * the ID of the disk offering
@ -117,8 +121,8 @@ public class DeployVirtualMachineOptions extends AccountInDomainOptions {
/** /**
* @param securityGroupId * @param securityGroupId
* security group applied to the virtual machine. Should be passed only when vm is * security group applied to the virtual machine. Should be passed
* created from a zone with Basic Network support * only when vm is created from a zone with Basic Network support
*/ */
public DeployVirtualMachineOptions securityGroupId(long securityGroupId) { public DeployVirtualMachineOptions securityGroupId(long securityGroupId) {
this.queryParameters.replaceValues("securitygroupids", ImmutableSet.of(securityGroupId + "")); this.queryParameters.replaceValues("securitygroupids", ImmutableSet.of(securityGroupId + ""));
@ -127,8 +131,8 @@ public class DeployVirtualMachineOptions extends AccountInDomainOptions {
/** /**
* @param securityGroupIds * @param securityGroupIds
* security groups applied to the virtual machine. Should be passed only when vm is * security groups applied to the virtual machine. Should be passed
* created from a zone with Basic Network support * only when vm is created from a zone with Basic Network support
*/ */
public DeployVirtualMachineOptions securityGroupIds(Iterable<Long> securityGroupIds) { public DeployVirtualMachineOptions securityGroupIds(Iterable<Long> securityGroupIds) {
this.queryParameters.replaceValues("securitygroupids", ImmutableSet.of(Joiner.on(',').join(securityGroupIds))); this.queryParameters.replaceValues("securitygroupids", ImmutableSet.of(Joiner.on(',').join(securityGroupIds)));
@ -137,7 +141,8 @@ public class DeployVirtualMachineOptions extends AccountInDomainOptions {
/** /**
* @param dataDiskSize * @param dataDiskSize
* the arbitrary size for the DATADISK volume. Mutually exclusive with diskOfferingId * the arbitrary size for the DATADISK volume. Mutually exclusive
* with diskOfferingId
*/ */
public DeployVirtualMachineOptions dataDiskSize(long dataDiskSize) { public DeployVirtualMachineOptions dataDiskSize(long dataDiskSize) {
checkArgument(!queryParameters.containsKey("diskofferingid"), "Mutually exclusive with diskOfferingId"); checkArgument(!queryParameters.containsKey("diskofferingid"), "Mutually exclusive with diskOfferingId");
@ -147,10 +152,11 @@ public class DeployVirtualMachineOptions extends AccountInDomainOptions {
/** /**
* @param unencodedData * @param unencodedData
* an optional binary data that can be sent to the virtual machine upon a successful * an optional binary data that can be sent to the virtual machine
* deployment. This binary data must be base64 encoded before adding it to the request. * upon a successful deployment. This binary data must be base64
* Currently only HTTP GET is supported. Using HTTP GET (via querystring), you can send * encoded before adding it to the request. Currently only HTTP GET
* up to 2KB of data after base64 encoding. * is supported. Using HTTP GET (via querystring), you can send up
* to 2KB of data after base64 encoding.
*/ */
public DeployVirtualMachineOptions userData(byte[] unencodedData) { public DeployVirtualMachineOptions userData(byte[] unencodedData) {
int length = checkNotNull(unencodedData, "unencodedData").length; int length = checkNotNull(unencodedData, "unencodedData").length;

View File

@ -23,7 +23,9 @@ import com.google.common.collect.ImmutableSet;
/** /**
* Options used to control what account information is returned * Options used to control what account information is returned
* *
* @see <a href="http://download.cloud.com/releases/2.2.0/api/user/listAccounts.html" /> * @see <a
* href="http://download.cloud.com/releases/2.2.0/api/user/listAccounts.html"
* />
* @author Adrian Cole * @author Adrian Cole
*/ */
public class ListAccountsOptions extends AccountInDomainOptions { public class ListAccountsOptions extends AccountInDomainOptions {
@ -50,7 +52,8 @@ public class ListAccountsOptions extends AccountInDomainOptions {
/** /**
* @param state * @param state
* list accounts by state. Valid states are enabled, disabled, and locked. * list accounts by state. Valid states are enabled, disabled, and
* locked.
*/ */
public ListAccountsOptions state(String state) { public ListAccountsOptions state(String state) {
this.queryParameters.replaceValues("state", ImmutableSet.of(state)); this.queryParameters.replaceValues("state", ImmutableSet.of(state));
@ -68,8 +71,8 @@ public class ListAccountsOptions extends AccountInDomainOptions {
/** /**
* @param recursive * @param recursive
* defaults to false, but if true, lists all accounts from the parent specified by the * defaults to false, but if true, lists all accounts from the
* domain id till leaves. * parent specified by the domain id till leaves.
*/ */
public ListAccountsOptions recursive(boolean recursive) { public ListAccountsOptions recursive(boolean recursive) {
this.queryParameters.replaceValues("isrecursive", ImmutableSet.of(recursive + "")); this.queryParameters.replaceValues("isrecursive", ImmutableSet.of(recursive + ""));

View File

@ -30,7 +30,9 @@ import com.google.common.collect.ImmutableSet;
/** /**
* Options used to control what asyncJobs information is returned * Options used to control what asyncJobs information is returned
* *
* @see <a href="http://download.cloud.com/releases/2.2.0/api/user/listAsyncJobs.html" /> * @see <a
* href="http://download.cloud.com/releases/2.2.0/api/user/listAsyncJobs.html"
* />
* @author Adrian Cole * @author Adrian Cole
*/ */
public class ListAsyncJobsOptions extends AccountInDomainOptions { public class ListAsyncJobsOptions extends AccountInDomainOptions {
@ -43,8 +45,8 @@ public class ListAsyncJobsOptions extends AccountInDomainOptions {
* the start date of the async job * the start date of the async job
*/ */
public ListAsyncJobsOptions startDate(Date startDate) { public ListAsyncJobsOptions startDate(Date startDate) {
this.queryParameters.replaceValues("startdate", ImmutableSet.of(dateService this.queryParameters.replaceValues("startdate",
.iso8601SecondsDateFormat(checkNotNull(startDate, "startDate")))); ImmutableSet.of(dateService.iso8601SecondsDateFormat(checkNotNull(startDate, "startDate"))));
return this; return this;
} }

View File

@ -25,7 +25,9 @@ import com.google.common.collect.ImmutableSet;
/** /**
* Options used to control what disk offerings are returned * Options used to control what disk offerings are returned
* *
* @see <a href="http://download.cloud.com/releases/2.2.0/api/user/listDiskOfferings.html" /> * @see <a href=
* "http://download.cloud.com/releases/2.2.0/api/user/listDiskOfferings.html"
* />
* @author Adrian Cole * @author Adrian Cole
*/ */
public class ListDiskOfferingsOptions extends BaseHttpRequestOptions { public class ListDiskOfferingsOptions extends BaseHttpRequestOptions {

View File

@ -23,7 +23,9 @@ import com.google.common.collect.ImmutableSet;
/** /**
* Options used to control what ip forwarding rules are returned * Options used to control what ip forwarding rules are returned
* *
* @see <a href="http://download.cloud.com/releases/2.2.0/api/user/listIpForwardingRules.html" /> * @see <a href=
* "http://download.cloud.com/releases/2.2.0/api/user/listIpForwardingRules.html"
* />
* @author Adrian Cole * @author Adrian Cole
*/ */
public class ListIPForwardingRulesOptions extends AccountInDomainOptions { public class ListIPForwardingRulesOptions extends AccountInDomainOptions {

View File

@ -23,7 +23,9 @@ import com.google.common.collect.ImmutableSet;
/** /**
* Options used to control what load balancer rules are returned * Options used to control what load balancer rules are returned
* *
* @see <a href="http://download.cloud.com/releases/2.2.0/api/user/listLoadBalancerRules.html" /> * @see <a href=
* "http://download.cloud.com/releases/2.2.0/api/user/listLoadBalancerRules.html"
* />
* @author Adrian Cole * @author Adrian Cole
*/ */
public class ListLoadBalancerRulesOptions extends AccountInDomainOptions { public class ListLoadBalancerRulesOptions extends AccountInDomainOptions {

View File

@ -26,7 +26,9 @@ import com.google.common.collect.ImmutableSet;
/** /**
* Options used to control what network offerings are returned * Options used to control what network offerings are returned
* *
* @see <a href="http://download.cloud.com/releases/2.2.0/api/user/listNetworkOfferings.html" /> * @see <a href=
* "http://download.cloud.com/releases/2.2.0/api/user/listNetworkOfferings.html"
* />
* @author Adrian Cole * @author Adrian Cole
*/ */
public class ListNetworkOfferingsOptions extends BaseHttpRequestOptions { public class ListNetworkOfferingsOptions extends BaseHttpRequestOptions {
@ -38,7 +40,7 @@ public class ListNetworkOfferingsOptions extends BaseHttpRequestOptions {
* the ID of the network offering * the ID of the network offering
*/ */
public ListNetworkOfferingsOptions id(long id) { public ListNetworkOfferingsOptions id(long id) {
this.queryParameters.replaceValues("id", ImmutableSet.of(id+"")); this.queryParameters.replaceValues("id", ImmutableSet.of(id + ""));
return this; return this;
} }
@ -89,8 +91,8 @@ public class ListNetworkOfferingsOptions extends BaseHttpRequestOptions {
/** /**
* @param specifyVLAN * @param specifyVLAN
* True if we allow the network supports vlan, false otherwise. If you create network * True if we allow the network supports vlan, false otherwise. If
* using this offering, you must specify vlan. * you create network using this offering, you must specify vlan.
*/ */
public ListNetworkOfferingsOptions specifyVLAN(boolean specifyVLAN) { public ListNetworkOfferingsOptions specifyVLAN(boolean specifyVLAN) {
this.queryParameters.replaceValues("specifyvlan", ImmutableSet.of(specifyVLAN + "")); this.queryParameters.replaceValues("specifyvlan", ImmutableSet.of(specifyVLAN + ""));

View File

@ -27,7 +27,9 @@ import com.google.common.collect.ImmutableSet;
/** /**
* Options used to control what networks information is returned * Options used to control what networks information is returned
* *
* @see <a href="http://download.cloud.com/releases/2.2.0/api/user/listNetworks.html" /> * @see <a
* href="http://download.cloud.com/releases/2.2.0/api/user/listNetworks.html"
* />
* @author Adrian Cole * @author Adrian Cole
*/ */
public class ListNetworksOptions extends BaseHttpRequestOptions { public class ListNetworksOptions extends BaseHttpRequestOptions {
@ -82,8 +84,8 @@ public class ListNetworksOptions extends BaseHttpRequestOptions {
/** /**
* *
* @param account * @param account
* account who will own the VLAN. If VLAN is Zone wide, this parameter should be * account who will own the VLAN. If VLAN is Zone wide, this
* ommited * parameter should be ommited
*/ */
public ListNetworksOptions account(String account) { public ListNetworksOptions account(String account) {
this.queryParameters.replaceValues("account", ImmutableSet.of(account)); this.queryParameters.replaceValues("account", ImmutableSet.of(account));

View File

@ -25,19 +25,24 @@ import com.google.common.collect.ImmutableSet;
/** /**
* Options used to control what OSType information is returned * Options used to control what OSType information is returned
* *
* @see <a href="http://download.cloud.com/releases/2.2.0/api/user/listOsTypes.html" /> * @see <a
* href="http://download.cloud.com/releases/2.2.0/api/user/listOsTypes.html"
* />
* @author Adrian Cole * @author Adrian Cole
*/ */
public class ListOSTypesOptions extends BaseHttpRequestOptions { public class ListOSTypesOptions extends BaseHttpRequestOptions {
public static final ListOSTypesOptions NONE = new ListOSTypesOptions(); public static final ListOSTypesOptions NONE = new ListOSTypesOptions();
/** /**
* @param id list by Os type Id * @param id
* list by Os type Id
*/ */
public ListOSTypesOptions id(long id) { public ListOSTypesOptions id(long id) {
this.queryParameters.replaceValues("id", ImmutableSet.of(id + "")); this.queryParameters.replaceValues("id", ImmutableSet.of(id + ""));
return this; return this;
} }
/** /**
* @param OSCategoryId * @param OSCategoryId
* list by Os Category id * list by Os Category id
@ -47,7 +52,6 @@ public class ListOSTypesOptions extends BaseHttpRequestOptions {
return this; return this;
} }
public static class Builder { public static class Builder {
/** /**
* @see ListOSTypesOptions#id * @see ListOSTypesOptions#id
@ -57,7 +61,6 @@ public class ListOSTypesOptions extends BaseHttpRequestOptions {
return options.id(id); return options.id(id);
} }
/** /**
* @see ListOSTypesOptions#OSCategoryId * @see ListOSTypesOptions#OSCategoryId
*/ */

View File

@ -23,7 +23,9 @@ import com.google.common.collect.ImmutableSet;
/** /**
* Options used to control what port forwarding rules are returned * Options used to control what port forwarding rules are returned
* *
* @see <a href="http://download.cloud.com/releases/2.2.0/api/user/listIpForwardingRules.html" /> * @see <a href=
* "http://download.cloud.com/releases/2.2.0/api/user/listIpForwardingRules.html"
* />
* @author Adrian Cole * @author Adrian Cole
*/ */
public class ListPortForwardingRulesOptions extends AccountInDomainOptions { public class ListPortForwardingRulesOptions extends AccountInDomainOptions {

View File

@ -23,7 +23,9 @@ import com.google.common.collect.ImmutableSet;
/** /**
* Options used to control what ip addresss information is returned * Options used to control what ip addresss information is returned
* *
* @see <a href="http://download.cloud.com/releases/2.2.0/api/user/listIPAddresses.html" /> * @see <a href=
* "http://download.cloud.com/releases/2.2.0/api/user/listIPAddresses.html"
* />
* @author Adrian Cole * @author Adrian Cole
*/ */
public class ListPublicIPAddressesOptions extends AccountInDomainOptions { public class ListPublicIPAddressesOptions extends AccountInDomainOptions {

View File

@ -18,29 +18,31 @@
*/ */
package org.jclouds.cloudstack.options; package org.jclouds.cloudstack.options;
import com.google.common.collect.ImmutableSet;
import org.jclouds.http.options.BaseHttpRequestOptions; import org.jclouds.http.options.BaseHttpRequestOptions;
import com.google.common.collect.ImmutableSet;
public class ListSSHKeyPairsOptions extends BaseHttpRequestOptions { public class ListSSHKeyPairsOptions extends BaseHttpRequestOptions {
public static final ListSSHKeyPairsOptions NONE = new ListSSHKeyPairsOptions(); public static final ListSSHKeyPairsOptions NONE = new ListSSHKeyPairsOptions();
/** /**
* @param name the SSHKeyPair name * @param name
*/ * the SSHKeyPair name
public ListSSHKeyPairsOptions name(String name) { */
this.queryParameters.replaceValues("name", ImmutableSet.of(name)); public ListSSHKeyPairsOptions name(String name) {
return this; this.queryParameters.replaceValues("name", ImmutableSet.of(name));
} return this;
}
public static class Builder { public static class Builder {
/** /**
* @see ListSSHKeyPairsOptions#name * @see ListSSHKeyPairsOptions#name
*/ */
public static ListSSHKeyPairsOptions name(String name) { public static ListSSHKeyPairsOptions name(String name) {
ListSSHKeyPairsOptions options = new ListSSHKeyPairsOptions(); ListSSHKeyPairsOptions options = new ListSSHKeyPairsOptions();
return options.name(name); return options.name(name);
} }
} }
} }

View File

@ -23,7 +23,9 @@ import com.google.common.collect.ImmutableSet;
/** /**
* Options used to control what security groups are returned * Options used to control what security groups are returned
* *
* @see <a href="http://download.cloud.com/releases/2.2.0/api/user/listSecurityGroups.html" /> * @see <a href=
* "http://download.cloud.com/releases/2.2.0/api/user/listSecurityGroups.html"
* />
* @author Adrian Cole * @author Adrian Cole
*/ */
public class ListSecurityGroupsOptions extends AssociateIPAddressOptions { public class ListSecurityGroupsOptions extends AssociateIPAddressOptions {
@ -50,8 +52,9 @@ public class ListSecurityGroupsOptions extends AssociateIPAddressOptions {
/** /**
* @param virtualMachineId * @param virtualMachineId
* the ID of the virtual machine. Pass this in if you want to see the available service * the ID of the virtual machine. Pass this in if you want to see
* offering that a virtual machine can be changed to. * the available service offering that a virtual machine can be
* changed to.
*/ */
public ListSecurityGroupsOptions virtualMachineId(long virtualMachineId) { public ListSecurityGroupsOptions virtualMachineId(long virtualMachineId) {
this.queryParameters.replaceValues("virtualmachineid", ImmutableSet.of(virtualMachineId + "")); this.queryParameters.replaceValues("virtualmachineid", ImmutableSet.of(virtualMachineId + ""));

View File

@ -25,7 +25,9 @@ import com.google.common.collect.ImmutableSet;
/** /**
* Options used to control what service offerings are returned * Options used to control what service offerings are returned
* *
* @see <a href="http://download.cloud.com/releases/2.2.0/api/user/listServiceOfferings.html" /> * @see <a href=
* "http://download.cloud.com/releases/2.2.0/api/user/listServiceOfferings.html"
* />
* @author Adrian Cole * @author Adrian Cole
*/ */
public class ListServiceOfferingsOptions extends BaseHttpRequestOptions { public class ListServiceOfferingsOptions extends BaseHttpRequestOptions {
@ -62,8 +64,9 @@ public class ListServiceOfferingsOptions extends BaseHttpRequestOptions {
/** /**
* @param virtualMachineId * @param virtualMachineId
* the ID of the virtual machine. Pass this in if you want to see the available service * the ID of the virtual machine. Pass this in if you want to see
* offering that a virtual machine can be changed to. * the available service offering that a virtual machine can be
* changed to.
*/ */
public ListServiceOfferingsOptions virtualMachineId(long virtualMachineId) { public ListServiceOfferingsOptions virtualMachineId(long virtualMachineId) {
this.queryParameters.replaceValues("virtualmachineid", ImmutableSet.of(virtualMachineId + "")); this.queryParameters.replaceValues("virtualmachineid", ImmutableSet.of(virtualMachineId + ""));

View File

@ -25,7 +25,9 @@ import com.google.common.collect.ImmutableSet;
/** /**
* Options used to control what templates information is returned * Options used to control what templates information is returned
* *
* @see <a href="http://download.cloud.com/releases/2.2.0/api/user/listTemplates.html" /> * @see <a
* href="http://download.cloud.com/releases/2.2.0/api/user/listTemplates.html"
* />
* @author Adrian Cole * @author Adrian Cole
*/ */
public class ListTemplatesOptions extends AccountInDomainOptions { public class ListTemplatesOptions extends AccountInDomainOptions {

View File

@ -23,7 +23,9 @@ import com.google.common.collect.ImmutableSet;
/** /**
* Options used to control what virtual machines information is returned * Options used to control what virtual machines information is returned
* *
* @see <a href="http://download.cloud.com/releases/2.2.0/api/user/listVirtualMachines.html" /> * @see <a href=
* "http://download.cloud.com/releases/2.2.0/api/user/listVirtualMachines.html"
* />
* @author Adrian Cole * @author Adrian Cole
*/ */
public class ListVirtualMachinesOptions extends AccountInDomainOptions { public class ListVirtualMachinesOptions extends AccountInDomainOptions {
@ -109,8 +111,8 @@ public class ListVirtualMachinesOptions extends AccountInDomainOptions {
/** /**
* @param usesVirtualNetwork * @param usesVirtualNetwork
* list by network type; true if need to list vms using Virtual Network, false * list by network type; true if need to list vms using Virtual
* otherwise * Network, false otherwise
*/ */
public ListVirtualMachinesOptions usesVirtualNetwork(boolean usesVirtualNetwork) { public ListVirtualMachinesOptions usesVirtualNetwork(boolean usesVirtualNetwork) {
this.queryParameters.replaceValues("forvirtualnetwork", ImmutableSet.of(usesVirtualNetwork + "")); this.queryParameters.replaceValues("forvirtualnetwork", ImmutableSet.of(usesVirtualNetwork + ""));

View File

@ -25,7 +25,9 @@ import com.google.common.collect.ImmutableSet;
/** /**
* Options used to control what zones information is returned * Options used to control what zones information is returned
* *
* @see <a href="http://download.cloud.com/releases/2.2.0/api/user/listZones.html" /> * @see <a
* href="http://download.cloud.com/releases/2.2.0/api/user/listZones.html"
* />
* @author Adrian Cole * @author Adrian Cole
*/ */
public class ListZonesOptions extends BaseHttpRequestOptions { public class ListZonesOptions extends BaseHttpRequestOptions {
@ -37,7 +39,7 @@ public class ListZonesOptions extends BaseHttpRequestOptions {
* the ID of the zone * the ID of the zone
*/ */
public ListZonesOptions id(long id) { public ListZonesOptions id(long id) {
this.queryParameters.replaceValues("id", ImmutableSet.of(id+"")); this.queryParameters.replaceValues("id", ImmutableSet.of(id + ""));
return this; return this;
} }
@ -46,15 +48,16 @@ public class ListZonesOptions extends BaseHttpRequestOptions {
* the ID of the domain associated with the zone * the ID of the domain associated with the zone
*/ */
public ListZonesOptions domainId(long domainId) { public ListZonesOptions domainId(long domainId) {
this.queryParameters.replaceValues("domainid", ImmutableSet.of(domainId+"")); this.queryParameters.replaceValues("domainid", ImmutableSet.of(domainId + ""));
return this; return this;
} }
/** /**
* @param available * @param available
* true if you want to retrieve all available Zones. False if you only want to return * true if you want to retrieve all available Zones. False if you
* the Zones from which you have at least one VM. Default is false. * only want to return the Zones from which you have at least one
* VM. Default is false.
*/ */
public ListZonesOptions available(boolean available) { public ListZonesOptions available(boolean available) {
this.queryParameters.replaceValues("available", ImmutableSet.of(available + "")); this.queryParameters.replaceValues("available", ImmutableSet.of(available + ""));

View File

@ -39,8 +39,8 @@ import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableMap.Builder; import com.google.common.collect.ImmutableMap.Builder;
/** /**
* Templates can be present in a zone, and available, but not valid for launch as their hypervisor * Templates can be present in a zone, and available, but not valid for launch
* isn't installed. * as their hypervisor isn't installed.
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
@ -58,7 +58,7 @@ public class CorrectHypervisorForZone implements Function<Long, Predicate<Templa
} }
private static class CloudStackClientToZoneToHypervisors implements private static class CloudStackClientToZoneToHypervisors implements
Function<CloudStackClient, Map<Long, Set<String>>> { Function<CloudStackClient, Map<Long, Set<String>>> {
@Override @Override
public Map<Long, Set<String>> apply(CloudStackClient client) { public Map<Long, Set<String>> apply(CloudStackClient client) {

View File

@ -57,7 +57,7 @@ public class JobComplete implements Predicate<Long> {
logger.trace("%s: looking for job status %s: currently: %s", job.getId(), 1, job.getStatus()); logger.trace("%s: looking for job status %s: currently: %s", job.getId(), 1, job.getStatus());
if (job.getError() != null) if (job.getError() != null)
throw new IllegalStateException(String.format("job %s failed with exception %s", job.getId(), job.getError() throw new IllegalStateException(String.format("job %s failed with exception %s", job.getId(), job.getError()
.toString())); .toString()));
return job.getStatus() > 0; return job.getStatus() > 0;
} }

View File

@ -112,10 +112,10 @@ public class NetworkPredicates {
} }
public static Predicate<NetworkService> supportsStaticNAT = Predicates.and(new NetworkServiceNamed("Firewall"), public static Predicate<NetworkService> supportsStaticNAT = Predicates.and(new NetworkServiceNamed("Firewall"),
new CapabilitiesInclude("StaticNat")); new CapabilitiesInclude("StaticNat"));
public static Predicate<NetworkService> supportsPortForwarding = Predicates.and(new NetworkServiceNamed("Firewall"), public static Predicate<NetworkService> supportsPortForwarding = Predicates.and(new NetworkServiceNamed("Firewall"),
new CapabilitiesInclude("PortForwarding")); new CapabilitiesInclude("PortForwarding"));
public static Predicate<NetworkService> isLoadBalancerService = new NetworkServiceNamed("Lb"); public static Predicate<NetworkService> isLoadBalancerService = new NetworkServiceNamed("Lb");

View File

@ -49,8 +49,8 @@ public class OSCategoryIn implements Function<Set<String>, Predicate<Template>>
@Inject @Inject
public OSCategoryIn(CloudStackClient client) { public OSCategoryIn(CloudStackClient client) {
this(Suppliers.ofInstance(checkNotNull(client, "client").getGuestOSClient().listOSCategories()), Suppliers.ofInstance(client this(Suppliers.ofInstance(checkNotNull(client, "client").getGuestOSClient().listOSCategories()), Suppliers
.getGuestOSClient().listOSTypes())); .ofInstance(client.getGuestOSClient().listOSTypes()));
} }
public OSCategoryIn(Supplier<Map<Long, String>> categoriesSupplier, Supplier<Set<OSType>> osTypesSupplier) { public OSCategoryIn(Supplier<Map<Long, String>> categoriesSupplier, Supplier<Set<OSType>> osTypesSupplier) {
@ -62,21 +62,21 @@ public class OSCategoryIn implements Function<Set<String>, Predicate<Template>>
public Predicate<Template> apply(final Set<String> acceptableCategories) { public Predicate<Template> apply(final Set<String> acceptableCategories) {
final Map<Long, String> categories = categoriesSupplier.get(); final Map<Long, String> categories = categoriesSupplier.get();
final Set<Long> acceptableOSTypeIds = Maps.filterValues( final Set<Long> acceptableOSTypeIds = Maps.filterValues(
Maps.transformValues(Maps.uniqueIndex(osTypesSupplier.get(), new Function<OSType, Long>() { Maps.transformValues(Maps.uniqueIndex(osTypesSupplier.get(), new Function<OSType, Long>() {
@Override @Override
public Long apply(OSType input) { public Long apply(OSType input) {
return input.getId(); return input.getId();
} }
}), new Function<OSType, String>() { }), new Function<OSType, String>() {
@Override @Override
public String apply(OSType input) { public String apply(OSType input) {
return categories.get(input.getOSCategoryId()); return categories.get(input.getOSCategoryId());
} }
}), Predicates.in(acceptableCategories)).keySet(); }), Predicates.in(acceptableCategories)).keySet();
return new Predicate<Template>() { return new Predicate<Template>() {
@Override @Override

View File

@ -55,7 +55,7 @@ public class PublicIPAddressPredicates {
@Override @Override
public boolean apply(PublicIPAddress arg0) { public boolean apply(PublicIPAddress arg0) {
return !checkNotNull(arg0, "ipaddress").isSourceNAT() && !arg0.isStaticNAT() return !checkNotNull(arg0, "ipaddress").isSourceNAT() && !arg0.isStaticNAT()
&& arg0.getVirtualMachineId() <= 0 && arg0.getState() == PublicIPAddress.State.ALLOCATED; && arg0.getVirtualMachineId() <= 0 && arg0.getState() == PublicIPAddress.State.ALLOCATED;
} }
@Override @Override
@ -74,7 +74,8 @@ public class PublicIPAddressPredicates {
/** /**
* *
* @return true, if the public ip address is associated with the specified network * @return true, if the public ip address is associated with the specified
* network
*/ */
public static Predicate<PublicIPAddress> associatedWithNetwork(final long networkId) { public static Predicate<PublicIPAddress> associatedWithNetwork(final long networkId) {
return new AssociatedWithNetwork(networkId); return new AssociatedWithNetwork(networkId);

View File

@ -56,7 +56,7 @@ public class VirtualMachineDestroyed implements Predicate<VirtualMachine> {
if (virtualMachine == null) if (virtualMachine == null)
return true; return true;
logger.trace("%s: looking for virtualMachine state %s: currently: %s", virtualMachine.getId(), State.DESTROYED, logger.trace("%s: looking for virtualMachine state %s: currently: %s", virtualMachine.getId(), State.DESTROYED,
virtualMachine.getState()); virtualMachine.getState());
return virtualMachine.getState() == State.DESTROYED; return virtualMachine.getState() == State.DESTROYED;
} }

View File

@ -56,7 +56,7 @@ public class VirtualMachineRunning implements Predicate<VirtualMachine> {
if (virtualMachine == null) if (virtualMachine == null)
return false; return false;
logger.trace("%s: looking for virtualMachine state %s: currently: %s", virtualMachine.getId(), State.RUNNING, logger.trace("%s: looking for virtualMachine state %s: currently: %s", virtualMachine.getId(), State.RUNNING,
virtualMachine.getState()); virtualMachine.getState());
if (virtualMachine.getState() == State.ERROR) if (virtualMachine.getState() == State.ERROR)
throw new IllegalStateException("virtualMachine in error state: " + virtualMachine); throw new IllegalStateException("virtualMachine in error state: " + virtualMachine);
return virtualMachine.getState() == State.RUNNING; return virtualMachine.getState() == State.RUNNING;

View File

@ -109,7 +109,8 @@ public class NetworkClientLiveTest extends BaseCloudStackClientLiveTest {
assert network.getAccount() != null : network; assert network.getAccount() != null : network;
assert network.getBroadcastDomainType() != null : network; assert network.getBroadcastDomainType() != null : network;
assert network.getDisplayText() != null : network; assert network.getDisplayText() != null : network;
assert network.getNetworkDomain() != null : network; // Network domain can be null sometimes
// assert network.getNetworkDomain() != null : network;
assert network.getNetworkOfferingAvailability() != null : network; assert network.getNetworkOfferingAvailability() != null : network;
assert network.getNetworkOfferingDisplayText() != null : network; assert network.getNetworkOfferingDisplayText() != null : network;
assert network.getNetworkOfferingId() > 0 : network; assert network.getNetworkOfferingId() > 0 : network;

View File

@ -65,7 +65,7 @@ public class SSHKeyPairAsyncClientTest extends BaseCloudStackAsyncClientTest<SSH
HttpRequest httpRequest = processor.createRequest(method, ListSSHKeyPairsOptions.Builder.name("jclouds")); HttpRequest httpRequest = processor.createRequest(method, ListSSHKeyPairsOptions.Builder.name("jclouds"));
assertRequestLineEquals(httpRequest, assertRequestLineEquals(httpRequest,
"GET http://localhost:8080/client/api?response=json&command=listSSHKeyPairs&SSHKeyPair=jclouds&domainid=123 HTTP/1.1"); "GET http://localhost:8080/client/api?response=json&command=listSSHKeyPairs&name=jclouds HTTP/1.1");
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n"); assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
assertPayloadEquals(httpRequest, null, null, false); assertPayloadEquals(httpRequest, null, null, false);
@ -78,11 +78,11 @@ public class SSHKeyPairAsyncClientTest extends BaseCloudStackAsyncClientTest<SSH
} }
public void testGetSSHKeyPair() throws SecurityException, NoSuchMethodException, IOException { public void testGetSSHKeyPair() throws SecurityException, NoSuchMethodException, IOException {
Method method = SSHKeyPairAsyncClient.class.getMethod("getSSHKeyPair", long.class); Method method = SSHKeyPairAsyncClient.class.getMethod("getSSHKeyPair", String.class);
HttpRequest httpRequest = processor.createRequest(method, 3l); HttpRequest httpRequest = processor.createRequest(method, "jclouds-keypair");
assertRequestLineEquals(httpRequest, assertRequestLineEquals(httpRequest,
"GET http://localhost:8080/client/api?response=json&command=listSSHKeyPairs&id=3 HTTP/1.1"); "GET http://localhost:8080/client/api?response=json&command=listSSHKeyPairs&name=jclouds-keypair HTTP/1.1");
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n"); assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
assertPayloadEquals(httpRequest, null, null, false); assertPayloadEquals(httpRequest, null, null, false);

View File

@ -18,6 +18,10 @@
*/ */
package org.jclouds.cloudstack.features; package org.jclouds.cloudstack.features;
import static org.testng.Assert.assertEquals;
import java.util.Set;
import org.jclouds.cloudstack.domain.SSHKeyPair; import org.jclouds.cloudstack.domain.SSHKeyPair;
import org.testng.annotations.Test; import org.testng.annotations.Test;
@ -30,18 +34,20 @@ import org.testng.annotations.Test;
public class SSHKeyPairClientLiveTest extends BaseCloudStackClientLiveTest { public class SSHKeyPairClientLiveTest extends BaseCloudStackClientLiveTest {
public void testListSSHKeyPairs() { public void testListSSHKeyPairs() {
System.out.println(client.getSSHKeyPairClient().listSSHKeyPairs()); final Set<SSHKeyPair> sshKeyPairs = client.getSSHKeyPairClient().listSSHKeyPairs();
for (SSHKeyPair sshKeyPair : sshKeyPairs) {
checkSSHKeyPair(sshKeyPair);
}
} }
public void testCreateSSHKeyPair() { public void testCreateSSHKeyPair() {
final String sshKeyPair = client.getSSHKeyPairClient().createSSHKeyPair("vijay-test"); final SSHKeyPair sshKeyPair = client.getSSHKeyPairClient().createSSHKeyPair("jclouds-keypair");
System.out.println(sshKeyPair); System.out.println(sshKeyPair);
} }
protected void checkSSHKeyPair(SSHKeyPair pair) { protected void checkSSHKeyPair(SSHKeyPair pair) {
assert pair.getName() != null : pair; assert pair.getName() != null : pair;
// assertEquals(pair.toString(), assertEquals(pair.toString(), client.getSSHKeyPairClient().getSSHKeyPair(pair.getName()).toString());
// client.getSSHKeyPairClient().getSSHKeyPair(pair.getName()).toString());
} }
} }

View File

@ -0,0 +1,66 @@
/**
* 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.cloudstack.parse;
import java.util.Set;
import org.jclouds.cloudstack.config.CloudStackParserModule;
import org.jclouds.cloudstack.domain.SSHKeyPair;
import org.jclouds.json.BaseSetParserTest;
import org.jclouds.json.config.GsonModule;
import org.jclouds.rest.annotations.SelectJson;
import org.testng.annotations.Test;
import com.google.common.collect.ImmutableSet;
import com.google.inject.Guice;
import com.google.inject.Injector;
/**
* @author Adrian Cole
*/
@Test(groups = "unit")
public class ListSSHKeyPairsResponseTest extends BaseSetParserTest<SSHKeyPair> {
@Override
protected Injector injector() {
return Guice.createInjector(new CloudStackParserModule(), new GsonModule() {
@Override
protected void configure() {
bind(DateAdapter.class).to(Iso8601DateAdapter.class);
super.configure();
}
});
}
@Override
public String resource() {
return "/listsshkeypairsresponse.json";
}
@Override
@SelectJson("keypair")
public Set<SSHKeyPair> expected() {
return ImmutableSet.<SSHKeyPair> of(SSHKeyPair.builder().name("jclouds-keypair")
.fingerprint("43:6a:bd:46:e0:3d:3a:8d:ab:69:25:bb:b9:ca:9d:17").build());
}
}

View File

@ -0,0 +1 @@
{ "createkeypairresponse" : { "keypair" : {"name":"vijay2-test","fingerprint":"80:61:58:5b:92:4c:1f:5a:4f:fc:1d:39:ea:28:06:c7","privatekey":"-----BEGIN RSA PRIVATE KEY-----\nMIICXAIBAAKBgQDTMxvFfEC+SAq4JD1sYx/EAtvzdKt1XY3yBFZ4iRRDCM30fK76\nQ5um9H+PhxzeGj5PVKPF409nq17BiNjM64qnmoHFVn2J+NFaiyo/oo2wohDDWUyn\noh7ifGd+AUfhaISnuAmEfhlgHxBhrTXsKmGe/x7lgwiyg25t84XYR38QiQIDAQAB\nAoGAGk5cYC3I1qqcgzEoYW67TyvX/6wBiz3a51E5AAx69JqNJK2/EbcIFTSRCuyW\nYOe96R2uxIA6rLwAsnR8JJIWE+5DdlSjp+Vrgp3p10YXU6FHdmX0Uwq+Gi9Ofg2E\nX1qGBJTVmV0BRCJCZcufNk+XPSUp7QQpstqd0Nxnc6dcEnECQQDzZ7PnP+7EKmk4\nNT0kN2V56dartYOookA20V6YMa2mcOmDw0Mhh3B3GlOjwkfVLtGfdxdz4gtcGtzz\nEpwjrRA1AkEA3iDKxmSyWQSl80KfVQQK2QZ52jHIJbuT5UlvCSvgb2XXxJ+gxjSh\n/V805IIZ+WMzWNkRQ1g786dhI1BUCv2xhQJBAKngB3vub8pyuwqihXCARQ9H9y3R\nufh4fI6FoxpfGY2fIip2naSJ7SECu7r/vbh4O46qxDB5Y2o9yVTP+S8g+r0CQDKA\nWhnJAxNiDyjDWN5HUQAOjN2iu9J4VyOmEmyPYTNygB/f+vmVNc8ZOjlJqwYcG6xz\njY02HktDHr6coL7u9tECQE8hJ04UbS2O4ruafhDUHNJ9/4ERzFyn1GWhcipK6ACE\nF4MrwQImqtsUvGjtA3X0s+lEj3+iLJfJr02pfYpCyf8=\n-----END RSA PRIVATE KEY-----\n"} } }

View File

@ -0,0 +1 @@
{ "listsshkeypairsresponse" : { "count":1 ,"keypair" : [ {"name":"jclouds-keypair","fingerprint":"43:6a:bd:46:e0:3d:3a:8d:ab:69:25:bb:b9:ca:9d:17"} ] } }