mirror of https://github.com/apache/jclouds.git
SSHKeyPair API implementation
- Updated tests with correct domain model object. - Unit tests for ListSSHKeyPairs
This commit is contained in:
parent
6d4ce41d15
commit
1151cbc241
|
@ -18,112 +18,128 @@
|
|||
*/
|
||||
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;
|
||||
|
||||
/**
|
||||
* Provides asynchronous access to CloudStack via their REST API.
|
||||
* <p/>
|
||||
*
|
||||
*
|
||||
* @author Adrian Cole
|
||||
* @see CloudStackClient
|
||||
* @see <a href="http://download.cloud.com/releases/2.2.0/api/TOC_User.html" />
|
||||
*/
|
||||
public interface CloudStackAsyncClient {
|
||||
|
||||
/**
|
||||
* Provides asynchronous access to Zone features.
|
||||
*/
|
||||
@Delegate
|
||||
ZoneAsyncClient getZoneClient();
|
||||
/**
|
||||
* Provides asynchronous access to Zone features.
|
||||
*/
|
||||
@Delegate
|
||||
ZoneAsyncClient getZoneClient();
|
||||
|
||||
/**
|
||||
* Provides asynchronous access to Template features.
|
||||
*/
|
||||
@Delegate
|
||||
TemplateAsyncClient getTemplateClient();
|
||||
/**
|
||||
* Provides asynchronous access to Template features.
|
||||
*/
|
||||
@Delegate
|
||||
TemplateAsyncClient getTemplateClient();
|
||||
|
||||
/**
|
||||
* Provides asynchronous access to Service, Disk, and Network Offering features.
|
||||
*/
|
||||
@Delegate
|
||||
OfferingAsyncClient getOfferingClient();
|
||||
/**
|
||||
* Provides asynchronous access to Service, Disk, and Network Offering
|
||||
* features.
|
||||
*/
|
||||
@Delegate
|
||||
OfferingAsyncClient getOfferingClient();
|
||||
|
||||
/**
|
||||
* Provides asynchronous access to Network features.
|
||||
*/
|
||||
@Delegate
|
||||
NetworkAsyncClient getNetworkClient();
|
||||
/**
|
||||
* Provides asynchronous access to Network features.
|
||||
*/
|
||||
@Delegate
|
||||
NetworkAsyncClient getNetworkClient();
|
||||
|
||||
/**
|
||||
* Provides asynchronous access to VirtualMachine features.
|
||||
*/
|
||||
@Delegate
|
||||
VirtualMachineAsyncClient getVirtualMachineClient();
|
||||
/**
|
||||
* Provides asynchronous access to VirtualMachine features.
|
||||
*/
|
||||
@Delegate
|
||||
VirtualMachineAsyncClient getVirtualMachineClient();
|
||||
|
||||
/**
|
||||
* Provides asynchronous access to SecurityGroup features.
|
||||
*/
|
||||
@Delegate
|
||||
SecurityGroupAsyncClient getSecurityGroupClient();
|
||||
/**
|
||||
* Provides asynchronous access to SecurityGroup features.
|
||||
*/
|
||||
@Delegate
|
||||
SecurityGroupAsyncClient getSecurityGroupClient();
|
||||
|
||||
/**
|
||||
* Provides asynchronous access to AsyncJob features.
|
||||
*/
|
||||
@Delegate
|
||||
AsyncJobAsyncClient getAsyncJobClient();
|
||||
/**
|
||||
* Provides asynchronous access to AsyncJob features.
|
||||
*/
|
||||
@Delegate
|
||||
AsyncJobAsyncClient getAsyncJobClient();
|
||||
|
||||
/**
|
||||
* Provides asynchronous access to Address features.
|
||||
*/
|
||||
@Delegate
|
||||
AddressAsyncClient getAddressClient();
|
||||
/**
|
||||
* Provides asynchronous access to Address features.
|
||||
*/
|
||||
@Delegate
|
||||
AddressAsyncClient getAddressClient();
|
||||
|
||||
/**
|
||||
* Provides asynchronous access to NAT features.
|
||||
*/
|
||||
@Delegate
|
||||
NATAsyncClient getNATClient();
|
||||
/**
|
||||
* Provides asynchronous access to NAT features.
|
||||
*/
|
||||
@Delegate
|
||||
NATAsyncClient getNATClient();
|
||||
|
||||
/**
|
||||
* Provides asynchronous access to Firewall features.
|
||||
*/
|
||||
@Delegate
|
||||
FirewallAsyncClient getFirewallClient();
|
||||
/**
|
||||
* Provides asynchronous access to Firewall features.
|
||||
*/
|
||||
@Delegate
|
||||
FirewallAsyncClient getFirewallClient();
|
||||
|
||||
/**
|
||||
* Provides asynchronous access to LoadBalancer features.
|
||||
*/
|
||||
@Delegate
|
||||
LoadBalancerAsyncClient getLoadBalancerClient();
|
||||
/**
|
||||
* Provides asynchronous access to LoadBalancer features.
|
||||
*/
|
||||
@Delegate
|
||||
LoadBalancerAsyncClient getLoadBalancerClient();
|
||||
|
||||
/**
|
||||
* Provides asynchronous access to GuestOS features.
|
||||
*/
|
||||
@Delegate
|
||||
GuestOSAsyncClient getGuestOSClient();
|
||||
/**
|
||||
* Provides asynchronous access to GuestOS features.
|
||||
*/
|
||||
@Delegate
|
||||
GuestOSAsyncClient getGuestOSClient();
|
||||
|
||||
/**
|
||||
* Provides asynchronous access to Hypervisor features.
|
||||
*/
|
||||
@Delegate
|
||||
HypervisorAsyncClient getHypervisorClient();
|
||||
/**
|
||||
* Provides asynchronous access to Hypervisor features.
|
||||
*/
|
||||
@Delegate
|
||||
HypervisorAsyncClient getHypervisorClient();
|
||||
|
||||
/**
|
||||
* Provides asynchronous access to Configuration features.
|
||||
*/
|
||||
@Delegate
|
||||
ConfigurationAsyncClient getConfigurationClient();
|
||||
/**
|
||||
* Provides asynchronous access to Configuration features.
|
||||
*/
|
||||
@Delegate
|
||||
ConfigurationAsyncClient getConfigurationClient();
|
||||
|
||||
/**
|
||||
* Provides asynchronous access to Account features.
|
||||
*/
|
||||
@Delegate
|
||||
AccountAsyncClient getAccountClient();
|
||||
/**
|
||||
* Provides asynchronous access to Account features.
|
||||
*/
|
||||
@Delegate
|
||||
AccountAsyncClient getAccountClient();
|
||||
|
||||
/**
|
||||
* Provides asynchronous access to SSH Keypairs
|
||||
*/
|
||||
@Delegate
|
||||
SSHKeyPairAsyncClient getSSHKeyPairClient();
|
||||
/**
|
||||
* Provides asynchronous access to SSH Keypairs
|
||||
*/
|
||||
@Delegate
|
||||
SSHKeyPairAsyncClient getSSHKeyPairClient();
|
||||
}
|
||||
|
|
|
@ -18,12 +18,27 @@
|
|||
*/
|
||||
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.rest.annotations.Delegate;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* Provides synchronous access to CloudStack.
|
||||
* <p/>
|
||||
|
@ -47,7 +62,8 @@ public interface CloudStackClient {
|
|||
TemplateClient getTemplateClient();
|
||||
|
||||
/**
|
||||
* Provides synchronous access to Service, Disk, and Network Offering features.
|
||||
* Provides synchronous access to Service, Disk, and Network Offering
|
||||
* features.
|
||||
*/
|
||||
@Delegate
|
||||
OfferingClient getOfferingClient();
|
||||
|
@ -124,10 +140,10 @@ public interface CloudStackClient {
|
|||
@Delegate
|
||||
AccountClient getAccountClient();
|
||||
|
||||
/**
|
||||
* Provides synchronous access to SSH Keypairs
|
||||
*/
|
||||
@Delegate
|
||||
SSHKeyPairClient getSSHKeyPairClient();
|
||||
/**
|
||||
* Provides synchronous access to SSH Keypairs
|
||||
*/
|
||||
@Delegate
|
||||
SSHKeyPairClient getSSHKeyPairClient();
|
||||
|
||||
}
|
||||
|
|
|
@ -30,8 +30,7 @@ import com.google.inject.Module;
|
|||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
public class CloudStackContextBuilder extends
|
||||
RestContextBuilder<CloudStackClient, CloudStackAsyncClient> {
|
||||
public class CloudStackContextBuilder extends RestContextBuilder<CloudStackClient, CloudStackAsyncClient> {
|
||||
|
||||
public CloudStackContextBuilder(Properties props) {
|
||||
super(CloudStackClient.class, CloudStackAsyncClient.class, props);
|
||||
|
|
|
@ -33,8 +33,8 @@ import org.jclouds.http.utils.ModifyRequest;
|
|||
import org.jclouds.rest.Binder;
|
||||
|
||||
import com.google.common.collect.ImmutableMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
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();
|
||||
builder.uri(request.getEndpoint());
|
||||
Builder<String, String> map = ImmutableMultimap.<String, String> builder().putAll(
|
||||
ModifyRequest.parseQueryToMap(request.getEndpoint().getQuery()));
|
||||
ModifyRequest.parseQueryToMap(request.getEndpoint().getQuery()));
|
||||
int i = 0;
|
||||
for (Entry<String, String> entry : pairs.entries())
|
||||
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));
|
||||
return (R) request.toBuilder().endpoint(builder.build()).build();
|
||||
}
|
||||
|
|
|
@ -18,10 +18,42 @@
|
|||
*/
|
||||
package org.jclouds.cloudstack.config;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.jclouds.cloudstack.CloudStackAsyncClient;
|
||||
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.http.HttpErrorHandler;
|
||||
import org.jclouds.http.RequiresHttp;
|
||||
|
@ -35,7 +67,7 @@ import org.jclouds.predicates.SocketOpen;
|
|||
import org.jclouds.rest.ConfiguresRestClient;
|
||||
import org.jclouds.rest.config.RestClientModule;
|
||||
|
||||
import java.util.Map;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
/**
|
||||
* Configures the cloudstack connection.
|
||||
|
|
|
@ -114,13 +114,13 @@ public class AsyncJob<T> {
|
|||
|
||||
public AsyncJob<T> build() {
|
||||
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) {
|
||||
return new Builder<T>().accountId(in.accountId).cmd(in.cmd).created(in.created).id(in.id).instanceId(
|
||||
in.instanceId).instanceType(in.instanceType).progress(in.progress).result(in.result).resultCode(
|
||||
in.resultCode).resultType(in.resultType).status(in.status).userId(in.userId).error(in.error);
|
||||
return new Builder<T>().accountId(in.accountId).cmd(in.cmd).created(in.created).id(in.id)
|
||||
.instanceId(in.instanceId).instanceType(in.instanceType).progress(in.progress).result(in.result)
|
||||
.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;
|
||||
|
||||
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.cmd = cmd;
|
||||
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() {
|
||||
return error;
|
||||
|
@ -345,9 +346,9 @@ public class AsyncJob<T> {
|
|||
@Override
|
||||
public String toString() {
|
||||
return "[accountId=" + accountId + ", cmd=" + cmd + ", created=" + created + ", id=" + id + ", instanceId="
|
||||
+ instanceId + ", instanceType=" + instanceType + ", error=" + error + ", progress=" + progress
|
||||
+ ", result=" + result + ", resultCode=" + resultCode + ", resultType=" + resultType + ", status="
|
||||
+ status + ", userId=" + userId + "]";
|
||||
+ instanceId + ", instanceType=" + instanceType + ", error=" + error + ", progress=" + progress
|
||||
+ ", result=" + result + ", resultCode=" + resultCode + ", resultType=" + resultType + ", status=" + status
|
||||
+ ", userId=" + userId + "]";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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() {
|
||||
return canShareTemplates;
|
||||
|
@ -134,6 +135,6 @@ public class Capabilities {
|
|||
@Override
|
||||
public String toString() {
|
||||
return "[cloudStackVersion=" + cloudStackVersion + ", canShareTemplates=" + canShareTemplates
|
||||
+ ", securityGroupsEnabled=" + securityGroupsEnabled + "]";
|
||||
+ ", securityGroupsEnabled=" + securityGroupsEnabled + "]";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,13 +30,13 @@ import com.google.common.base.CaseFormat;
|
|||
public enum GuestIPType {
|
||||
|
||||
/**
|
||||
* guest IP address will be issued by Dhcp server in the guest virtual network. Dhcp role is
|
||||
* played by domain router.
|
||||
* guest IP address will be issued by Dhcp server in the guest virtual
|
||||
* network. Dhcp role is played by domain router.
|
||||
*/
|
||||
VIRTUAL,
|
||||
/**
|
||||
* traffic directly to the network and VMs created here are assigned an IP directly from the
|
||||
* network as configured
|
||||
* traffic directly to the network and VMs created here are assigned an IP
|
||||
* directly from the network as configured
|
||||
*/
|
||||
DIRECT,
|
||||
|
||||
|
|
|
@ -93,7 +93,7 @@ public class IPForwardingRule implements Comparable<IPForwardingRule> {
|
|||
|
||||
public IPForwardingRule build() {
|
||||
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,
|
||||
String state, String virtualMachineDisplayName, long virtualMachineId, String virtualMachineName) {
|
||||
String state, String virtualMachineDisplayName, long virtualMachineId, String virtualMachineName) {
|
||||
this.id = id;
|
||||
this.IPAddress = iPAddress;
|
||||
this.IPAddressId = iPAddressId;
|
||||
|
@ -286,9 +286,9 @@ public class IPForwardingRule implements Comparable<IPForwardingRule> {
|
|||
@Override
|
||||
public String toString() {
|
||||
return "[IPAddress=" + IPAddress + ", IPAddressId=" + IPAddressId + ", id=" + id + ", startPort=" + startPort
|
||||
+ ", protocol=" + protocol + ", endPort=" + endPort + ", state=" + state
|
||||
+ ", virtualMachineDisplayName=" + virtualMachineDisplayName + ", virtualMachineId=" + virtualMachineId
|
||||
+ ", virtualMachineName=" + virtualMachineName + "]";
|
||||
+ ", protocol=" + protocol + ", endPort=" + endPort + ", state=" + state + ", virtualMachineDisplayName="
|
||||
+ virtualMachineDisplayName + ", virtualMachineId=" + virtualMachineId + ", virtualMachineName="
|
||||
+ virtualMachineName + "]";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
String securityGroupName, int startPort) {
|
||||
String securityGroupName, int startPort) {
|
||||
if (account == 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)
|
||||
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.CIDR = CIDR;
|
||||
this.endPort = endPort;
|
||||
|
@ -257,8 +257,8 @@ public class IngressRule implements Comparable<IngressRule> {
|
|||
@Override
|
||||
public String toString() {
|
||||
return "[id=" + id + ", securityGroupName=" + securityGroupName + ", account=" + account + ", startPort="
|
||||
+ startPort + ", endPort=" + endPort + ", protocol=" + protocol + ", CIDR=" + CIDR + ", ICMPCode="
|
||||
+ ICMPCode + ", ICMPType=" + ICMPType + "]";
|
||||
+ startPort + ", endPort=" + endPort + ", protocol=" + protocol + ", CIDR=" + CIDR + ", ICMPCode="
|
||||
+ ICMPCode + ", ICMPType=" + ICMPType + "]";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -142,7 +142,7 @@ public class LoadBalancerRule implements Comparable<LoadBalancerRule> {
|
|||
|
||||
public LoadBalancerRule build() {
|
||||
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,
|
||||
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.account = account;
|
||||
this.algorithm = algorithm;
|
||||
|
@ -353,9 +353,9 @@ public class LoadBalancerRule implements Comparable<LoadBalancerRule> {
|
|||
@Override
|
||||
public String toString() {
|
||||
return "[account=" + account + ", algorithm=" + algorithm + ", description=" + description + ", domain=" + domain
|
||||
+ ", domainId=" + domainId + ", id=" + id + ", name=" + name + ", privatePort=" + privatePort
|
||||
+ ", publicIP=" + publicIP + ", publicIPId=" + publicIPId + ", publicPort=" + publicPort + ", state="
|
||||
+ state + "]";
|
||||
+ ", domainId=" + domainId + ", id=" + id + ", name=" + name + ", privatePort=" + privatePort
|
||||
+ ", publicIP=" + publicIP + ", publicIPId=" + publicIPId + ", publicPort=" + publicPort + ", state="
|
||||
+ state + "]";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -18,21 +18,21 @@
|
|||
*/
|
||||
package org.jclouds.cloudstack.domain;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.ImmutableSortedSet;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.net.URI;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
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
|
||||
*/
|
||||
public class Network implements Comparable<Network> {
|
||||
|
@ -244,7 +244,8 @@ public class Network implements Comparable<Network> {
|
|||
@SerializedName("issystem")
|
||||
private boolean isSystem;
|
||||
private String netmask;
|
||||
@SerializedName("domain")
|
||||
@Nullable
|
||||
@SerializedName("networkdomain")
|
||||
private String networkDomain;
|
||||
@SerializedName("networkofferingavailability")
|
||||
private String networkOfferingAvailability;
|
||||
|
@ -273,7 +274,6 @@ public class Network implements Comparable<Network> {
|
|||
|
||||
/**
|
||||
* present only for serializer
|
||||
*
|
||||
*/
|
||||
Network() {
|
||||
|
||||
|
@ -317,7 +317,6 @@ public class Network implements Comparable<Network> {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return network id
|
||||
*/
|
||||
public long getId() {
|
||||
|
@ -325,7 +324,6 @@ public class Network implements Comparable<Network> {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return the name of the account to which the template beLongs
|
||||
*/
|
||||
public String getAccount() {
|
||||
|
@ -333,7 +331,6 @@ public class Network implements Comparable<Network> {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return Broadcast domain type of the network
|
||||
*/
|
||||
public String getBroadcastDomainType() {
|
||||
|
@ -341,7 +338,6 @@ public class Network implements Comparable<Network> {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return broadcast uri of the network
|
||||
*/
|
||||
public URI getBroadcastURI() {
|
||||
|
@ -349,7 +345,6 @@ public class Network implements Comparable<Network> {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return the display text of the zone
|
||||
*/
|
||||
public String getDisplayText() {
|
||||
|
@ -357,7 +352,6 @@ public class Network implements Comparable<Network> {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return the external DNS for the network
|
||||
*/
|
||||
public List<String> getDNS() {
|
||||
|
@ -370,7 +364,6 @@ public class Network implements Comparable<Network> {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return Domain name for the Vms in the zone
|
||||
*/
|
||||
public String getDomain() {
|
||||
|
@ -378,7 +371,6 @@ public class Network implements Comparable<Network> {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return the ID of the containing domain, null for public zones
|
||||
*/
|
||||
@Nullable
|
||||
|
@ -387,7 +379,6 @@ public class Network implements Comparable<Network> {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return the end ip of the network
|
||||
*/
|
||||
public String getEndIP() {
|
||||
|
@ -395,7 +386,6 @@ public class Network implements Comparable<Network> {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return the network's gateway
|
||||
*/
|
||||
public String getGateway() {
|
||||
|
@ -403,7 +393,6 @@ public class Network implements Comparable<Network> {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return true if network offering is default, false otherwise
|
||||
*/
|
||||
public boolean isDefault() {
|
||||
|
@ -411,7 +400,6 @@ public class Network implements Comparable<Network> {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return true if network offering is shared, false otherwise
|
||||
*/
|
||||
public boolean isShared() {
|
||||
|
@ -419,7 +407,6 @@ public class Network implements Comparable<Network> {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return true if network offering is system, false otherwise
|
||||
*/
|
||||
public boolean isSystem() {
|
||||
|
@ -427,7 +414,6 @@ public class Network implements Comparable<Network> {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return network name
|
||||
*/
|
||||
public String getName() {
|
||||
|
@ -435,7 +421,6 @@ public class Network implements Comparable<Network> {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return the GuestIPType of the network
|
||||
*/
|
||||
public GuestIPType getGuestIPType() {
|
||||
|
@ -443,7 +428,6 @@ public class Network implements Comparable<Network> {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return state of the network
|
||||
*/
|
||||
public String getState() {
|
||||
|
@ -451,7 +435,6 @@ public class Network implements Comparable<Network> {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return the vlan range of the zone
|
||||
*/
|
||||
public String getVLAN() {
|
||||
|
@ -459,7 +442,6 @@ public class Network implements Comparable<Network> {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return the traffic type for this network offering
|
||||
*/
|
||||
public TrafficType getTrafficType() {
|
||||
|
@ -467,7 +449,6 @@ public class Network implements Comparable<Network> {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return the network's netmask
|
||||
*/
|
||||
public String getNetmask() {
|
||||
|
@ -475,7 +456,6 @@ public class Network implements Comparable<Network> {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return the network domain
|
||||
*/
|
||||
public String getNetworkDomain() {
|
||||
|
@ -483,7 +463,6 @@ public class Network implements Comparable<Network> {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return availability of the network offering the network is created from
|
||||
*/
|
||||
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
|
||||
*/
|
||||
public String getNetworkOfferingDisplayText() {
|
||||
|
@ -499,7 +477,6 @@ public class Network implements Comparable<Network> {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return network offering id the network is created from
|
||||
*/
|
||||
public long getNetworkOfferingId() {
|
||||
|
@ -507,7 +484,6 @@ public class Network implements Comparable<Network> {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return name of the network offering the network is created from
|
||||
*/
|
||||
public String getNetworkOfferingName() {
|
||||
|
@ -515,7 +491,6 @@ public class Network implements Comparable<Network> {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return related to what other network configuration
|
||||
*/
|
||||
public long getRelated() {
|
||||
|
@ -523,7 +498,6 @@ public class Network implements Comparable<Network> {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return the start ip of the network
|
||||
*/
|
||||
public String getStartIP() {
|
||||
|
@ -531,7 +505,6 @@ public class Network implements Comparable<Network> {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return zone id of the network
|
||||
*/
|
||||
public long getZoneId() {
|
||||
|
@ -539,7 +512,6 @@ public class Network implements Comparable<Network> {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return the list of services
|
||||
*/
|
||||
public Set<? extends NetworkService> getServices() {
|
||||
|
@ -716,7 +688,7 @@ public class Network implements Comparable<Network> {
|
|||
+ account + ", startIP=" + startIP + ", endIP=" + endIP + ", netmask=" + netmask + ", gateway=" + gateway
|
||||
+ ", broadcastDomainType=" + broadcastDomainType + ", broadcastURI=" + broadcastURI + ", services="
|
||||
+ 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
|
||||
+ ", networkOfferingDisplayText=" + networkOfferingDisplayText + ", networkOfferingId=" + networkOfferingId
|
||||
+ ", networkOfferingName=" + networkOfferingName + "]";
|
||||
|
|
|
@ -93,7 +93,7 @@ public class PortForwardingRule implements Comparable<PortForwardingRule> {
|
|||
|
||||
public PortForwardingRule build() {
|
||||
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,
|
||||
int publicPort, String state, String virtualMachineDisplayName, long virtualMachineId,
|
||||
String virtualMachineName) {
|
||||
int publicPort, String state, String virtualMachineDisplayName, long virtualMachineId,
|
||||
String virtualMachineName) {
|
||||
this.id = id;
|
||||
this.IPAddress = iPAddress;
|
||||
this.IPAddressId = iPAddressId;
|
||||
this.privatePort = privatePort;
|
||||
this.protocol = protocol;
|
||||
this.publicPort = publicPort+"";
|
||||
this.publicPort = publicPort + "";
|
||||
this.state = state;
|
||||
this.virtualMachineDisplayName = virtualMachineDisplayName;
|
||||
this.virtualMachineId = virtualMachineId;
|
||||
|
@ -290,9 +290,9 @@ public class PortForwardingRule implements Comparable<PortForwardingRule> {
|
|||
@Override
|
||||
public String toString() {
|
||||
return "[IPAddress=" + IPAddress + ", IPAddressId=" + IPAddressId + ", id=" + id + ", privatePort=" + privatePort
|
||||
+ ", protocol=" + protocol + ", publicPort=" + publicPort + ", state=" + state
|
||||
+ ", virtualMachineDisplayName=" + virtualMachineDisplayName + ", virtualMachineId=" + virtualMachineId
|
||||
+ ", virtualMachineName=" + virtualMachineName + "]";
|
||||
+ ", protocol=" + protocol + ", publicPort=" + publicPort + ", state=" + state
|
||||
+ ", virtualMachineDisplayName=" + virtualMachineDisplayName + ", virtualMachineId=" + virtualMachineId
|
||||
+ ", virtualMachineName=" + virtualMachineName + "]";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -153,8 +153,8 @@ public class PublicIPAddress implements Comparable<PublicIPAddress> {
|
|||
|
||||
public PublicIPAddress build() {
|
||||
return new PublicIPAddress(id, account, allocated, associatedNetworkId, domain, domainId, usesVirtualNetwork,
|
||||
IPAddress, isSourceNAT, isStaticNAT, networkId, state, virtualMachineDisplayName, virtualMachineId,
|
||||
virtualMachineName, VLANId, VLANName, zoneId, zoneName);
|
||||
IPAddress, isSourceNAT, isStaticNAT, networkId, state, virtualMachineDisplayName, virtualMachineId,
|
||||
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,
|
||||
long domainId, boolean usesVirtualNetwork, String iPAddress, boolean isSourceNAT, boolean isStaticNAT,
|
||||
long networkId, State state, String virtualMachineDisplayName, long virtualMachineId,
|
||||
String virtualMachineName, long VLANId, String VLANName, long zoneId, String zoneName) {
|
||||
long domainId, boolean usesVirtualNetwork, String iPAddress, boolean isSourceNAT, boolean isStaticNAT,
|
||||
long networkId, State state, String virtualMachineDisplayName, long virtualMachineId,
|
||||
String virtualMachineName, long VLANId, String VLANName, long zoneId, String zoneName) {
|
||||
this.id = id;
|
||||
this.account = account;
|
||||
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() {
|
||||
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
|
||||
* nat Ip)
|
||||
* @return virtual machine display name the ip address is assigned to (not
|
||||
* null only for static nat Ip)
|
||||
*/
|
||||
public String getVirtualMachineDisplayName() {
|
||||
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() {
|
||||
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() {
|
||||
return virtualMachineName;
|
||||
|
@ -502,11 +505,11 @@ public class PublicIPAddress implements Comparable<PublicIPAddress> {
|
|||
@Override
|
||||
public String toString() {
|
||||
return "[id=" + id + ", IPAddress=" + IPAddress + ", VLANId=" + VLANId + ", VLANName=" + VLANName + ", account="
|
||||
+ account + ", allocated=" + allocated + ", associatedNetworkId=" + associatedNetworkId + ", domain="
|
||||
+ domain + ", domainId=" + domainId + ", usesVirtualNetwork=" + usesVirtualNetwork + ", isSourceNAT="
|
||||
+ isSourceNAT + ", isStaticNAT=" + isStaticNAT + ", networkId=" + networkId + ", state=" + state
|
||||
+ ", virtualMachineDisplayName=" + virtualMachineDisplayName + ", virtualMachineId=" + virtualMachineId
|
||||
+ ", virtualMachineName=" + virtualMachineName + ", zoneId=" + zoneId + ", zoneName=" + zoneName + "]";
|
||||
+ account + ", allocated=" + allocated + ", associatedNetworkId=" + associatedNetworkId + ", domain="
|
||||
+ domain + ", domainId=" + domainId + ", usesVirtualNetwork=" + usesVirtualNetwork + ", isSourceNAT="
|
||||
+ isSourceNAT + ", isStaticNAT=" + isStaticNAT + ", networkId=" + networkId + ", state=" + state
|
||||
+ ", virtualMachineDisplayName=" + virtualMachineDisplayName + ", virtualMachineId=" + virtualMachineId
|
||||
+ ", virtualMachineName=" + virtualMachineName + ", zoneId=" + zoneId + ", zoneName=" + zoneName + "]";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -4,113 +4,111 @@ import com.google.gson.annotations.SerializedName;
|
|||
|
||||
public class SSHKeyPair implements Comparable<SSHKeyPair> {
|
||||
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
public static class Builder {
|
||||
|
||||
private String fingerprint;
|
||||
private String name;
|
||||
private String privateKey;
|
||||
private String fingerprint;
|
||||
private String name;
|
||||
private String privateKey;
|
||||
|
||||
public Builder fingerprint(String fingerprint) {
|
||||
this.fingerprint = fingerprint;
|
||||
return this;
|
||||
}
|
||||
public Builder fingerprint(String fingerprint) {
|
||||
this.fingerprint = fingerprint;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder name(String name) {
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
public Builder name(String name) {
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder privateKey(String privateKey) {
|
||||
this.privateKey = privateKey;
|
||||
return this;
|
||||
}
|
||||
public Builder privateKey(String privateKey) {
|
||||
this.privateKey = privateKey;
|
||||
return this;
|
||||
}
|
||||
|
||||
public SSHKeyPair build() {
|
||||
return new SSHKeyPair(fingerprint, name, privateKey);
|
||||
}
|
||||
}
|
||||
|
||||
public SSHKeyPair build() {
|
||||
return new SSHKeyPair(fingerprint, name, privateKey);
|
||||
}
|
||||
}
|
||||
// for deserialization
|
||||
SSHKeyPair() {
|
||||
|
||||
// for deserialization
|
||||
SSHKeyPair() {
|
||||
}
|
||||
|
||||
}
|
||||
private String fingerprint;
|
||||
private String name;
|
||||
@SerializedName("privatekey")
|
||||
private String privateKey;
|
||||
|
||||
private String fingerprint;
|
||||
private String name;
|
||||
@SerializedName("privatekey")
|
||||
private String privateKey;
|
||||
public SSHKeyPair(String fingerprint, String name, String privateKey) {
|
||||
this.fingerprint = fingerprint;
|
||||
this.name = name;
|
||||
this.privateKey = privateKey;
|
||||
}
|
||||
|
||||
public SSHKeyPair(String fingerprint, String name, String privateKey) {
|
||||
this.fingerprint = fingerprint;
|
||||
this.name = name;
|
||||
this.privateKey = privateKey;
|
||||
}
|
||||
public String getFingerprint() {
|
||||
return fingerprint;
|
||||
}
|
||||
|
||||
public String getFingerprint() {
|
||||
return fingerprint;
|
||||
}
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
public String getPrivateKey() {
|
||||
return privateKey;
|
||||
}
|
||||
|
||||
public String getPrivateKey() {
|
||||
return privateKey;
|
||||
}
|
||||
@Override
|
||||
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
|
||||
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;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
SSHKeyPair other = (SSHKeyPair) obj;
|
||||
if (fingerprint == null) {
|
||||
if (other.fingerprint != null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
} else if (!fingerprint.equals(other.fingerprint))
|
||||
return false;
|
||||
if (name == null) {
|
||||
if (other.name != null)
|
||||
return false;
|
||||
SSHKeyPair other = (SSHKeyPair) obj;
|
||||
if (fingerprint == null) {
|
||||
if (other.fingerprint != null)
|
||||
return false;
|
||||
} 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))
|
||||
} 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 true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "[fingerprint=" + fingerprint + ", name=" + name + "]";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(SSHKeyPair arg0) {
|
||||
return fingerprint.compareTo(arg0.getFingerprint());
|
||||
}
|
||||
@Override
|
||||
public String toString() {
|
||||
return "[fingerprint=" + fingerprint + ", name=" + name + "]";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(SSHKeyPair arg0) {
|
||||
return fingerprint.compareTo(arg0.getFingerprint());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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
|
||||
* acting on the template
|
||||
* @return shows the current pending asynchronous job ID, or null if current
|
||||
* pending jobs are acting on the template
|
||||
*/
|
||||
@Nullable
|
||||
public Long getJobId() {
|
||||
|
|
|
@ -37,7 +37,8 @@ public enum TemplateFilter {
|
|||
*/
|
||||
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,
|
||||
/**
|
||||
|
|
|
@ -38,15 +38,18 @@ public enum TrafficType {
|
|||
*/
|
||||
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,
|
||||
/**
|
||||
* 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,
|
||||
/**
|
||||
* 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,
|
||||
|
||||
|
|
|
@ -122,7 +122,7 @@ public class User implements Comparable<User> {
|
|||
|
||||
public User build() {
|
||||
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;
|
||||
|
||||
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 secretKey) {
|
||||
String account, Type accountType, String domain, long domainId, String timeZone, String apiKey,
|
||||
String secretKey) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.firstName = firstname;
|
||||
|
@ -327,10 +327,10 @@ public class User implements Comparable<User> {
|
|||
@Override
|
||||
public String toString() {
|
||||
return String
|
||||
.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, name, state, created, account, accountType, domain, domainId, email, firstName, lastName,
|
||||
apiKey, secretKey, timeZone);
|
||||
.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, name, state, created, account, accountType, domain, domainId, email, firstName, lastName, apiKey,
|
||||
secretKey, timeZone);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -289,11 +289,10 @@ public class VirtualMachine implements Comparable<VirtualMachine> {
|
|||
|
||||
public VirtualMachine build() {
|
||||
return new VirtualMachine(id, account, cpuCount, cpuSpeed, cpuUsed, displayName, created, domain, domainId,
|
||||
usesVirtualNetwork, group, groupId, guestOSId, HAEnabled, hostId, hostname, IPAddress,
|
||||
ISODisplayText, ISOId, ISOName, jobId, jobStatus, memory, name, networkKbsRead, networkKbsWrite,
|
||||
password, passwordEnabled, rootDeviceId, rootDeviceType, securityGroups, serviceOfferingId,
|
||||
serviceOfferingName, state, templateDisplayText, templateId, templateName, zoneId, zoneName, nics,
|
||||
hypervisor);
|
||||
usesVirtualNetwork, group, groupId, guestOSId, HAEnabled, hostId, hostname, IPAddress, ISODisplayText,
|
||||
ISOId, ISOName, jobId, jobStatus, memory, name, networkKbsRead, networkKbsWrite, password,
|
||||
passwordEnabled, rootDeviceId, rootDeviceType, securityGroups, serviceOfferingId, serviceOfferingName,
|
||||
state, templateDisplayText, templateId, templateName, zoneId, zoneName, nics, hypervisor);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -390,13 +389,13 @@ public class VirtualMachine implements Comparable<VirtualMachine> {
|
|||
private Set<SecurityGroup> securityGroups = ImmutableSet.<SecurityGroup> of();
|
||||
|
||||
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,
|
||||
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 networkKbsWrite, String password, boolean passwordEnabled, long rootDeviceId, String rootDeviceType,
|
||||
Set<SecurityGroup> securityGroups, long serviceOfferingId, String serviceOfferingName, State state,
|
||||
String templateDisplayText, long templateId, String templateName, long zoneId, String zoneName,
|
||||
Set<NIC> nics, String hypervisor) {
|
||||
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 iSOId, String iSOName, Long jobId, Integer jobStatus, long memory, String name, Long networkKbsRead,
|
||||
Long networkKbsWrite, String password, boolean passwordEnabled, long rootDeviceId, String rootDeviceType,
|
||||
Set<SecurityGroup> securityGroups, long serviceOfferingId, String serviceOfferingName, State state,
|
||||
String templateDisplayText, long templateId, String templateName, long zoneId, String zoneName, Set<NIC> nics,
|
||||
String hypervisor) {
|
||||
this.id = id;
|
||||
this.account = account;
|
||||
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
|
||||
* exists.
|
||||
* @return user generated name. The name of the virtual machine is returned
|
||||
* if no displayname exists.
|
||||
*/
|
||||
public String getDisplayName() {
|
||||
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() {
|
||||
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
|
||||
* pending jobs are acting on the virtual machine
|
||||
* @return shows the current pending asynchronous job ID. This tag is not
|
||||
* returned if no current pending jobs are acting on the virtual
|
||||
* machine
|
||||
*/
|
||||
@Nullable
|
||||
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
|
||||
* machine was created from an ISO file.
|
||||
* @return the ID of the template for the virtual machine. A -1 is returned
|
||||
* if the virtual machine was created from an ISO file.
|
||||
*/
|
||||
public long getTemplateId() {
|
||||
return templateId;
|
||||
|
@ -955,18 +956,17 @@ public class VirtualMachine implements Comparable<VirtualMachine> {
|
|||
@Override
|
||||
public String toString() {
|
||||
return "[id=" + id + ", account=" + account + ", cpuCount=" + cpuCount + ", cpuSpeed=" + cpuSpeed + ", cpuUsed="
|
||||
+ cpuUsed + ", displayName=" + displayName + ", created=" + created + ", domain=" + domain
|
||||
+ ", domainId=" + domainId + ", usesVirtualNetwork=" + usesVirtualNetwork + ", group=" + group
|
||||
+ ", groupId=" + groupId + ", guestOSId=" + guestOSId + ", HAEnabled=" + HAEnabled + ", hostId="
|
||||
+ hostId + ", hostname=" + hostname + ", IPAddress=" + IPAddress + ", ISODisplayText=" + ISODisplayText
|
||||
+ ", ISOId=" + ISOId + ", ISOName=" + ISOName + ", jobId=" + jobId + ", jobStatus=" + jobStatus
|
||||
+ ", memory=" + memory + ", name=" + name + ", networkKbsRead=" + networkKbsRead + ", networkKbsWrite="
|
||||
+ networkKbsWrite + ", password=" + password + ", passwordEnabled=" + passwordEnabled
|
||||
+ ", rootDeviceId=" + rootDeviceId + ", rootDeviceType=" + rootDeviceType + ", serviceOfferingId="
|
||||
+ serviceOfferingId + ", serviceOfferingName=" + serviceOfferingName + ", state=" + state
|
||||
+ ", templateDisplayText=" + templateDisplayText + ", templateId=" + templateId + ", templateName="
|
||||
+ templateName + ", zoneId=" + zoneId + ", zoneName=" + zoneName + ", nics=" + nics + ", hypervisor="
|
||||
+ hypervisor + ", securityGroups=" + securityGroups + "]";
|
||||
+ cpuUsed + ", displayName=" + displayName + ", created=" + created + ", domain=" + domain + ", domainId="
|
||||
+ domainId + ", usesVirtualNetwork=" + usesVirtualNetwork + ", group=" + group + ", groupId=" + groupId
|
||||
+ ", guestOSId=" + guestOSId + ", HAEnabled=" + HAEnabled + ", hostId=" + hostId + ", hostname=" + hostname
|
||||
+ ", IPAddress=" + IPAddress + ", ISODisplayText=" + ISODisplayText + ", ISOId=" + ISOId + ", ISOName="
|
||||
+ ISOName + ", jobId=" + jobId + ", jobStatus=" + jobStatus + ", memory=" + memory + ", name=" + name
|
||||
+ ", networkKbsRead=" + networkKbsRead + ", networkKbsWrite=" + networkKbsWrite + ", password=" + password
|
||||
+ ", passwordEnabled=" + passwordEnabled + ", rootDeviceId=" + rootDeviceId + ", rootDeviceType="
|
||||
+ rootDeviceType + ", serviceOfferingId=" + serviceOfferingId + ", serviceOfferingName="
|
||||
+ serviceOfferingName + ", state=" + state + ", templateDisplayText=" + templateDisplayText
|
||||
+ ", templateId=" + templateId + ", templateName=" + templateName + ", zoneId=" + zoneId + ", zoneName="
|
||||
+ zoneName + ", nics=" + nics + ", hypervisor=" + hypervisor + ", securityGroups=" + securityGroups + "]";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -118,7 +118,7 @@ public class Zone implements Comparable<Zone> {
|
|||
|
||||
public Zone build() {
|
||||
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,
|
||||
String guestCIDRAddress, List<String> internalDNS, String name, NetworkType networkType, String status,
|
||||
String vLAN, boolean securityGroupsEnabled) {
|
||||
String guestCIDRAddress, List<String> internalDNS, String name, NetworkType networkType, String status,
|
||||
String vLAN, boolean securityGroupsEnabled) {
|
||||
this.id = id;
|
||||
this.description = description;
|
||||
this.displayText = displayText;
|
||||
|
@ -389,9 +389,9 @@ public class Zone implements Comparable<Zone> {
|
|||
@Override
|
||||
public String toString() {
|
||||
return "[id=" + id + ", status=" + status + ", name=" + name + ", description=" + description + ", displayText="
|
||||
+ displayText + ", domain=" + domain + ", domainId=" + domainId + ", networkType=" + networkType
|
||||
+ ", guestCIDRAddress=" + guestCIDRAddress + ", VLAN=" + VLAN + ", DNS=" + getDNS()
|
||||
+ ", securityGroupsEnabled=" + isSecurityGroupsEnabled() + ", internalDNS=" + getInternalDNS() + "]";
|
||||
+ displayText + ", domain=" + domain + ", domainId=" + domainId + ", networkType=" + networkType
|
||||
+ ", guestCIDRAddress=" + guestCIDRAddress + ", VLAN=" + VLAN + ", DNS=" + getDNS()
|
||||
+ ", securityGroupsEnabled=" + isSecurityGroupsEnabled() + ", internalDNS=" + getInternalDNS() + "]";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -83,7 +83,7 @@ public interface AddressAsyncClient {
|
|||
@Unwrap
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
ListenableFuture<AsyncCreateResponse> associateIPAddressInZone(@QueryParam("zoneid") long zoneId,
|
||||
AssociateIPAddressOptions... options);
|
||||
AssociateIPAddressOptions... options);
|
||||
|
||||
/**
|
||||
* @see AddressClient#disassociateIPAddress
|
||||
|
|
|
@ -42,7 +42,8 @@ public interface AddressClient {
|
|||
*
|
||||
* @param options
|
||||
* 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);
|
||||
|
||||
|
@ -59,7 +60,8 @@ public interface AddressClient {
|
|||
* Acquires and associates a public IP to an account.
|
||||
*
|
||||
* @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
|
||||
*/
|
||||
AsyncCreateResponse associateIPAddressInZone(long zoneId, AssociateIPAddressOptions... options);
|
||||
|
|
|
@ -69,9 +69,9 @@ public interface FirewallAsyncClient {
|
|||
@Unwrap
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
ListenableFuture<AsyncCreateResponse> createPortForwardingRuleForVirtualMachine(
|
||||
@QueryParam("virtualmachineid") long virtualMachineId, @QueryParam("ipaddressid") long IPAddressId,
|
||||
@QueryParam("protocol") String protocol, @QueryParam("privateport") int privatePort,
|
||||
@QueryParam("publicport") int publicPort);
|
||||
@QueryParam("virtualmachineid") long virtualMachineId, @QueryParam("ipaddressid") long IPAddressId,
|
||||
@QueryParam("protocol") String protocol, @QueryParam("privateport") int privatePort,
|
||||
@QueryParam("publicport") int publicPort);
|
||||
|
||||
/**
|
||||
* @see FirewallClient#deletePortForwardingRule
|
||||
|
|
|
@ -41,8 +41,8 @@ public interface FirewallClient {
|
|||
*
|
||||
* @param options
|
||||
* if present, how to constrain the list.
|
||||
* @return PortForwardingRules matching query, or empty set, if no PortForwardingRulees are
|
||||
* found
|
||||
* @return PortForwardingRules matching query, or empty set, if no
|
||||
* PortForwardingRulees are found
|
||||
*/
|
||||
Set<PortForwardingRule> listPortForwardingRules(ListPortForwardingRulesOptions... options);
|
||||
|
||||
|
@ -52,8 +52,8 @@ public interface FirewallClient {
|
|||
* @param virtualMachineId
|
||||
* the ID of the virtual machine for the port forwarding rule
|
||||
* @param IPAddressId
|
||||
* the public IP address id of the forwarding rule, already associated via
|
||||
* associatePort
|
||||
* the public IP address id of the forwarding rule, already
|
||||
* associated via associatePort
|
||||
* @param protocol
|
||||
* the protocol for the rule. Valid values are TCP or UDP.
|
||||
* @param privatePort
|
||||
|
@ -63,7 +63,7 @@ public interface FirewallClient {
|
|||
* @return response used to track creation
|
||||
*/
|
||||
AsyncCreateResponse createPortForwardingRuleForVirtualMachine(long virtualMachineId, long IPAddressId,
|
||||
String protocol, int privatePort, int publicPort);
|
||||
String protocol, int privatePort, int publicPort);
|
||||
|
||||
/**
|
||||
* Deletes an port forwarding rule
|
||||
|
|
|
@ -57,7 +57,8 @@ public interface GuestOSClient {
|
|||
/**
|
||||
* 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();
|
||||
|
||||
|
|
|
@ -26,8 +26,8 @@ import javax.ws.rs.QueryParam;
|
|||
import javax.ws.rs.core.MediaType;
|
||||
|
||||
import org.jclouds.cloudstack.domain.LoadBalancerRule;
|
||||
import org.jclouds.cloudstack.domain.VirtualMachine;
|
||||
import org.jclouds.cloudstack.domain.LoadBalancerRule.Algorithm;
|
||||
import org.jclouds.cloudstack.domain.VirtualMachine;
|
||||
import org.jclouds.cloudstack.filters.QuerySigner;
|
||||
import org.jclouds.cloudstack.options.ListLoadBalancerRulesOptions;
|
||||
import org.jclouds.functions.JoinOnComma;
|
||||
|
@ -81,8 +81,8 @@ public interface LoadBalancerAsyncClient {
|
|||
@Unwrap(depth = 2)
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
ListenableFuture<LoadBalancerRule> createLoadBalancerRuleForPublicIP(@QueryParam("publicipid") long publicIPId,
|
||||
@QueryParam("algorithm") Algorithm algorithm, @QueryParam("name") String name,
|
||||
@QueryParam("privateport") int privatePort, @QueryParam("publicport") int publicPort);
|
||||
@QueryParam("algorithm") Algorithm algorithm, @QueryParam("name") String name,
|
||||
@QueryParam("privateport") int privatePort, @QueryParam("publicport") int publicPort);
|
||||
|
||||
/**
|
||||
* @see LoadBalancerClient#deleteLoadBalancerRule
|
||||
|
@ -103,7 +103,7 @@ public interface LoadBalancerAsyncClient {
|
|||
@Unwrap(depth = 2)
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
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[])
|
||||
|
@ -114,7 +114,7 @@ public interface LoadBalancerAsyncClient {
|
|||
@Unwrap(depth = 2)
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
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)
|
||||
|
@ -125,7 +125,7 @@ public interface LoadBalancerAsyncClient {
|
|||
@Unwrap(depth = 2)
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
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[])
|
||||
|
@ -136,7 +136,7 @@ public interface LoadBalancerAsyncClient {
|
|||
@Unwrap(depth = 2)
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
ListenableFuture<Long> removeVirtualMachinesFromLoadBalancerRule(@QueryParam("id") long id,
|
||||
@QueryParam("virtualmachineids") @ParamParser(JoinOnComma.class) long... virtualMachineIds);
|
||||
@QueryParam("virtualmachineids") @ParamParser(JoinOnComma.class) long... virtualMachineIds);
|
||||
|
||||
/**
|
||||
* @see LoadBalancerClient#listVirtualMachinesAssignedToLoadBalancerRule
|
||||
|
|
|
@ -22,8 +22,8 @@ import java.util.Set;
|
|||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.jclouds.cloudstack.domain.LoadBalancerRule;
|
||||
import org.jclouds.cloudstack.domain.VirtualMachine;
|
||||
import org.jclouds.cloudstack.domain.LoadBalancerRule.Algorithm;
|
||||
import org.jclouds.cloudstack.domain.VirtualMachine;
|
||||
import org.jclouds.cloudstack.options.ListLoadBalancerRulesOptions;
|
||||
import org.jclouds.concurrent.Timeout;
|
||||
|
||||
|
@ -42,7 +42,8 @@ public interface LoadBalancerClient {
|
|||
*
|
||||
* @param options
|
||||
* 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);
|
||||
|
||||
|
@ -59,20 +60,22 @@ public interface LoadBalancerClient {
|
|||
* Creates a load balancer rule.
|
||||
*
|
||||
* @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
|
||||
* load balancer algorithm (source, roundrobin, leastconn)
|
||||
* @param name
|
||||
* name of the load balancer rule
|
||||
* @param privatePort
|
||||
* the private port of the private ip address/virtual machine where the network traffic
|
||||
* will be load balanced to
|
||||
* the private port of the private ip address/virtual machine where
|
||||
* the network traffic will be load balanced to
|
||||
* @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
|
||||
*/
|
||||
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
|
||||
* 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);
|
||||
|
||||
/**
|
||||
* 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
|
||||
* 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);
|
||||
|
||||
/**
|
||||
* 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
|
||||
* the ID of the load balancer rule
|
||||
* @param virtualMachineIds
|
||||
* the list of IDs of the virtual machine that are being assigned to the load balancer
|
||||
* rule
|
||||
* the list of IDs of the virtual machine that are being assigned
|
||||
* to the load balancer rule
|
||||
* @return job id related to the operation
|
||||
*/
|
||||
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
|
||||
* the ID of the load balancer rule
|
||||
* @param virtualMachineIds
|
||||
* the list of IDs of the virtual machine that are being assigned to the load balancer
|
||||
* rule
|
||||
* the list of IDs of the virtual machine that are being assigned
|
||||
* to the load balancer rule
|
||||
* @return job id related to the operation
|
||||
*/
|
||||
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
|
||||
* the ID of the load balancer rule
|
||||
* @param virtualMachineIds
|
||||
* the list of IDs of the virtual machine that are being removed from the load balancer
|
||||
* rule
|
||||
* the list of IDs of the virtual machine that are being removed
|
||||
* from the load balancer rule
|
||||
* @return job id related to the operation
|
||||
*/
|
||||
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
|
||||
* the ID of the load balancer rule
|
||||
* @param virtualMachineIds
|
||||
* the list of IDs of the virtual machine that are being removed from the load balancer
|
||||
* rule
|
||||
* the list of IDs of the virtual machine that are being removed
|
||||
* from the load balancer rule
|
||||
* @return job id related to the operation
|
||||
*/
|
||||
long removeVirtualMachinesFromLoadBalancerRule(long id, long... virtualMachineIds);
|
||||
|
|
|
@ -42,7 +42,8 @@ public interface NATClient {
|
|||
*
|
||||
* @param options
|
||||
* 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);
|
||||
|
||||
|
@ -59,7 +60,8 @@ public interface NATClient {
|
|||
* Creates an ip forwarding rule
|
||||
*
|
||||
* @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
|
||||
* the protocol for the rule. Valid values are TCP or UDP.
|
||||
* @param startPort
|
||||
|
|
|
@ -77,8 +77,8 @@ public interface NetworkClient {
|
|||
*
|
||||
* @param id
|
||||
* the ID of the network
|
||||
* @return job id related to destroying the network, or null if resource was not
|
||||
* found
|
||||
* @return job id related to destroying the network, or null if resource was
|
||||
* not found
|
||||
*/
|
||||
Long deleteNetwork(long id);
|
||||
}
|
||||
|
|
|
@ -44,7 +44,8 @@ public interface OfferingClient {
|
|||
*
|
||||
* @param options
|
||||
* 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);
|
||||
|
||||
|
@ -62,7 +63,8 @@ public interface OfferingClient {
|
|||
*
|
||||
* @param options
|
||||
* 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);
|
||||
|
||||
|
@ -80,7 +82,8 @@ public interface OfferingClient {
|
|||
*
|
||||
* @param options
|
||||
* 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);
|
||||
|
||||
|
|
|
@ -18,30 +18,51 @@
|
|||
*/
|
||||
package org.jclouds.cloudstack.features;
|
||||
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
import org.jclouds.cloudstack.filters.QuerySigner;
|
||||
import org.jclouds.rest.annotations.QueryParams;
|
||||
import org.jclouds.rest.annotations.RequestFilters;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.GET;
|
||||
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)
|
||||
@QueryParams(keys = "response", values = "json")
|
||||
public interface SSHKeyPairAsyncClient {
|
||||
/**
|
||||
* @see AccountClient#listAccounts
|
||||
*/
|
||||
@GET
|
||||
@QueryParams(keys = "command", values = "listSSHKeyPairs")
|
||||
// @SelectJson("")
|
||||
// @Consumes(MediaType.APPLICATION_JSON)
|
||||
// @ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
|
||||
// ListenableFuture<Set<SSHKeyPair>> listSSHKeyPairs();
|
||||
ListenableFuture<String> listSSHKeyPairs();
|
||||
/**
|
||||
* @see org.jclouds.cloudstack.features.SSHKeyPairClient#listSSHKeyPairs
|
||||
*/
|
||||
@GET
|
||||
@QueryParams(keys = "command", values = "listSSHKeyPairs")
|
||||
@SelectJson("keypair")
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
|
||||
ListenableFuture<Set<SSHKeyPair>> listSSHKeyPairs(ListSSHKeyPairsOptions... options);
|
||||
|
||||
@GET
|
||||
@QueryParams(keys = "command", values="createSSHKeyPair")
|
||||
ListenableFuture<String> createSSHKeyPair(@QueryParam("name") String name);
|
||||
@GET
|
||||
@QueryParams(keys = "command", values = "createSSHKeyPair")
|
||||
@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);
|
||||
|
||||
}
|
||||
|
|
|
@ -1,22 +1,27 @@
|
|||
package org.jclouds.cloudstack.features;
|
||||
|
||||
import org.jclouds.concurrent.Timeout;
|
||||
|
||||
import java.util.Set;
|
||||
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.
|
||||
* <p/>
|
||||
*
|
||||
*
|
||||
* @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)
|
||||
|
||||
public interface SSHKeyPairClient {
|
||||
|
||||
String listSSHKeyPairs();
|
||||
Set<SSHKeyPair> listSSHKeyPairs(ListSSHKeyPairsOptions... options);
|
||||
|
||||
String createSSHKeyPair(String name);
|
||||
SSHKeyPair createSSHKeyPair(String name);
|
||||
|
||||
}
|
||||
SSHKeyPair getSSHKeyPair(String name);
|
||||
}
|
|
@ -95,10 +95,10 @@ public interface SecurityGroupAsyncClient {
|
|||
@Unwrap(depth = 2)
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
ListenableFuture<Long> authorizeIngressPortsToCIDRs(@QueryParam("securitygroupid") long securityGroupId,
|
||||
@QueryParam("protocol") String protocol, @QueryParam("startport") int startPort,
|
||||
@QueryParam("endport") int endPort,
|
||||
@BinderParam(BindCIDRsToCommaDelimitedQueryParam.class) Iterable<String> cidrList,
|
||||
AccountInDomainOptions... options);
|
||||
@QueryParam("protocol") String protocol, @QueryParam("startport") int startPort,
|
||||
@QueryParam("endport") int endPort,
|
||||
@BinderParam(BindCIDRsToCommaDelimitedQueryParam.class) Iterable<String> cidrList,
|
||||
AccountInDomainOptions... options);
|
||||
|
||||
/**
|
||||
* @see SecurityGroupClient#authorizeIngressPortsToSecurityGroups
|
||||
|
@ -107,13 +107,11 @@ public interface SecurityGroupAsyncClient {
|
|||
@QueryParams(keys = "command", values = "authorizeSecurityGroupIngress")
|
||||
@Unwrap(depth = 2)
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
ListenableFuture<Long> authorizeIngressPortsToSecurityGroups(
|
||||
@QueryParam("securitygroupid") long securityGroupId,
|
||||
@QueryParam("protocol") String protocol,
|
||||
@QueryParam("startport") int startPort,
|
||||
@QueryParam("endport") int endPort,
|
||||
@BinderParam(BindAccountSecurityGroupPairsToIndexedQueryParams.class) Multimap<String, String> accountToGroup,
|
||||
AccountInDomainOptions... options);
|
||||
ListenableFuture<Long> authorizeIngressPortsToSecurityGroups(@QueryParam("securitygroupid") long securityGroupId,
|
||||
@QueryParam("protocol") String protocol, @QueryParam("startport") int startPort,
|
||||
@QueryParam("endport") int endPort,
|
||||
@BinderParam(BindAccountSecurityGroupPairsToIndexedQueryParams.class) Multimap<String, String> accountToGroup,
|
||||
AccountInDomainOptions... options);
|
||||
|
||||
/**
|
||||
* @see SecurityGroupClient#authorizeIngressICMPToCIDRs
|
||||
|
@ -123,9 +121,9 @@ public interface SecurityGroupAsyncClient {
|
|||
@Unwrap(depth = 2)
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
ListenableFuture<Long> authorizeIngressICMPToCIDRs(@QueryParam("securitygroupid") long securityGroupId,
|
||||
@QueryParam("icmpcode") int ICMPCode, @QueryParam("icmptype") int ICMPType,
|
||||
@BinderParam(BindCIDRsToCommaDelimitedQueryParam.class) Iterable<String> cidrList,
|
||||
AccountInDomainOptions... options);
|
||||
@QueryParam("icmpcode") int ICMPCode, @QueryParam("icmptype") int ICMPType,
|
||||
@BinderParam(BindCIDRsToCommaDelimitedQueryParam.class) Iterable<String> cidrList,
|
||||
AccountInDomainOptions... options);
|
||||
|
||||
/**
|
||||
* @see SecurityGroupClient#authorizeIngressICMPToSecurityGroups
|
||||
|
@ -134,12 +132,10 @@ public interface SecurityGroupAsyncClient {
|
|||
@QueryParams(keys = { "command", "protocol" }, values = { "authorizeSecurityGroupIngress", "ICMP" })
|
||||
@Unwrap(depth = 2)
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
ListenableFuture<Long> authorizeIngressICMPToSecurityGroups(
|
||||
@QueryParam("securitygroupid") long securityGroupId,
|
||||
@QueryParam("icmpcode") int ICMPCode,
|
||||
@QueryParam("icmptype") int ICMPType,
|
||||
@BinderParam(BindAccountSecurityGroupPairsToIndexedQueryParams.class) Multimap<String, String> accountToGroup,
|
||||
AccountInDomainOptions... options);
|
||||
ListenableFuture<Long> authorizeIngressICMPToSecurityGroups(@QueryParam("securitygroupid") long securityGroupId,
|
||||
@QueryParam("icmpcode") int ICMPCode, @QueryParam("icmptype") int ICMPType,
|
||||
@BinderParam(BindAccountSecurityGroupPairsToIndexedQueryParams.class) Multimap<String, String> accountToGroup,
|
||||
AccountInDomainOptions... options);
|
||||
|
||||
/**
|
||||
* @see SecurityGroupClient#revokeIngressRule
|
||||
|
|
|
@ -43,7 +43,8 @@ public interface SecurityGroupClient {
|
|||
*
|
||||
* @param options
|
||||
* 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);
|
||||
|
||||
|
@ -63,7 +64,7 @@ public interface SecurityGroupClient {
|
|||
* @return response relating to the creation of this ingress rule
|
||||
*/
|
||||
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
|
||||
|
@ -77,11 +78,12 @@ public interface SecurityGroupClient {
|
|||
* @param endPort
|
||||
* end port for this ingress rule
|
||||
* @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
|
||||
*/
|
||||
long authorizeIngressPortsToSecurityGroups(long securityGroupId, String protocol, int startPort,
|
||||
int endPort, Multimap<String, String> accountToGroup, AccountInDomainOptions... options);
|
||||
long authorizeIngressPortsToSecurityGroups(long securityGroupId, String protocol, int startPort, int endPort,
|
||||
Multimap<String, String> accountToGroup, AccountInDomainOptions... options);
|
||||
|
||||
/**
|
||||
* Authorizes a particular ICMP ingress rule for this security group
|
||||
|
@ -96,8 +98,8 @@ public interface SecurityGroupClient {
|
|||
* the cidr list associated
|
||||
* @return response relating to the creation of this ingress rule
|
||||
*/
|
||||
long authorizeIngressICMPToCIDRs(long securityGroupId, int ICMPCode, int ICMPType,
|
||||
Iterable<String> cidrList, AccountInDomainOptions... options);
|
||||
long authorizeIngressICMPToCIDRs(long securityGroupId, int ICMPCode, int ICMPType, Iterable<String> cidrList,
|
||||
AccountInDomainOptions... options);
|
||||
|
||||
/**
|
||||
* Authorizes a particular ICMP ingress rule for this security group
|
||||
|
@ -109,17 +111,20 @@ public interface SecurityGroupClient {
|
|||
* @param ICMPType
|
||||
* error code for this icmp message
|
||||
* @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
|
||||
*/
|
||||
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
|
||||
*
|
||||
* @param id The ID of the ingress rule
|
||||
* @param options scope of the rule.
|
||||
* @param id
|
||||
* The ID of the ingress rule
|
||||
* @param options
|
||||
* scope of the rule.
|
||||
*/
|
||||
long revokeIngressRule(long id, AccountInDomainOptions... options);;
|
||||
|
||||
|
|
|
@ -47,7 +47,8 @@ public interface TemplateClient {
|
|||
* List all public, private, and privileged templates.
|
||||
*
|
||||
* @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
|
||||
* @see TemplateFilter
|
||||
*/
|
||||
|
|
|
@ -81,9 +81,9 @@ public interface VirtualMachineAsyncClient {
|
|||
@QueryParams(keys = "command", values = "deployVirtualMachine")
|
||||
@Unwrap
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
ListenableFuture<AsyncCreateResponse> deployVirtualMachineInZone( @QueryParam("zoneid") long zoneId, @QueryParam("serviceofferingid") long serviceOfferingId,
|
||||
@QueryParam("templateid") long templateId,
|
||||
DeployVirtualMachineOptions... options);
|
||||
ListenableFuture<AsyncCreateResponse> deployVirtualMachineInZone(@QueryParam("zoneid") long zoneId,
|
||||
@QueryParam("serviceofferingid") long serviceOfferingId, @QueryParam("templateid") long templateId,
|
||||
DeployVirtualMachineOptions... options);
|
||||
|
||||
/**
|
||||
* @see VirtualMachineClient#rebootVirtualMachine
|
||||
|
|
|
@ -42,7 +42,8 @@ public interface VirtualMachineClient {
|
|||
*
|
||||
* @param options
|
||||
* 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);
|
||||
|
||||
|
@ -56,8 +57,8 @@ public interface VirtualMachineClient {
|
|||
VirtualMachine getVirtualMachine(long id);
|
||||
|
||||
/**
|
||||
* Creates and automatically starts a virtual machine based on a service offering, disk offering,
|
||||
* and template.
|
||||
* Creates and automatically starts a virtual machine based on a service
|
||||
* offering, disk offering, and template.
|
||||
*
|
||||
* @param zoneId
|
||||
* availability zone for the virtual machine
|
||||
|
@ -69,7 +70,7 @@ public interface VirtualMachineClient {
|
|||
* @return virtual machine
|
||||
*/
|
||||
AsyncCreateResponse deployVirtualMachineInZone(long zoneId, long serviceOfferingId, long templateId,
|
||||
DeployVirtualMachineOptions... options);
|
||||
DeployVirtualMachineOptions... options);
|
||||
|
||||
/**
|
||||
* Reboots a virtual machine.
|
||||
|
@ -99,8 +100,9 @@ public interface VirtualMachineClient {
|
|||
Long stopVirtualMachine(long id);
|
||||
|
||||
/**
|
||||
* Resets the password for virtual machine. The virtual machine must be in a "Stopped" state and
|
||||
* the template must already support this feature for this command to take effect.
|
||||
* Resets the password for virtual machine. The virtual machine must be in a
|
||||
* "Stopped" state and the template must already support this feature for
|
||||
* this command to take effect.
|
||||
*
|
||||
* @param id
|
||||
* The ID of the virtual machine
|
||||
|
@ -109,8 +111,8 @@ public interface VirtualMachineClient {
|
|||
Long resetPasswordForVirtualMachine(long id);
|
||||
|
||||
/**
|
||||
* Changes the service offering for a virtual machine. The virtual machine must be in a "Stopped"
|
||||
* state for this command to take effect.
|
||||
* Changes the service offering for a virtual machine. The virtual machine
|
||||
* must be in a "Stopped" state for this command to take effect.
|
||||
*
|
||||
* @param id
|
||||
* The ID of the virtual machine
|
||||
|
@ -128,11 +130,13 @@ public interface VirtualMachineClient {
|
|||
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
|
||||
* 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);
|
||||
}
|
||||
|
|
|
@ -126,7 +126,7 @@ public class QuerySigner implements HttpRequestFilter, RequestSigner {
|
|||
ImmutableSortedSet.Builder<String> builder = ImmutableSortedSet.<String> naturalOrder();
|
||||
for (Entry<String, String> entry : decodedParams.entries())
|
||||
builder.add(entry.getKey() + "=" + Strings2.urlEncode(entry.getValue()));
|
||||
|
||||
|
||||
// then, lower case the entire query string
|
||||
String stringToSign = Joiner.on('&').join(builder.build()).toLowerCase();
|
||||
if (signatureWire.enabled())
|
||||
|
|
|
@ -42,7 +42,8 @@ public class ParseAsyncJobFromHttpResponse implements Function<HttpResponse, Asy
|
|||
private final ParseTypedAsyncJob parseTyped;
|
||||
|
||||
@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.parser = checkNotNull(parser, "parser");
|
||||
}
|
||||
|
|
|
@ -74,8 +74,9 @@ public class ParseNamesFromHttpResponse implements Function<HttpResponse, Set<St
|
|||
|
||||
@Inject
|
||||
public ParseNamesFromHttpResponse(GsonWrapper gsonWrapper) {
|
||||
this.parser = new ParseFirstJsonValueNamed<Set<Name>>(checkNotNull(gsonWrapper, "gsonWrapper"), new TypeLiteral<Set<Name>>(){},
|
||||
"hypervisor");
|
||||
this.parser = new ParseFirstJsonValueNamed<Set<Name>>(checkNotNull(gsonWrapper, "gsonWrapper"),
|
||||
new TypeLiteral<Set<Name>>() {
|
||||
}, "hypervisor");
|
||||
}
|
||||
|
||||
public Set<String> apply(HttpResponse response) {
|
||||
|
|
|
@ -28,6 +28,7 @@ import javax.inject.Named;
|
|||
import javax.inject.Singleton;
|
||||
|
||||
import org.jclouds.cloudstack.domain.AsyncJob;
|
||||
import org.jclouds.cloudstack.domain.AsyncJob.Builder;
|
||||
import org.jclouds.cloudstack.domain.AsyncJobError;
|
||||
import org.jclouds.cloudstack.domain.IPForwardingRule;
|
||||
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.Template;
|
||||
import org.jclouds.cloudstack.domain.VirtualMachine;
|
||||
import org.jclouds.cloudstack.domain.AsyncJob.Builder;
|
||||
import org.jclouds.domain.JsonBall;
|
||||
import org.jclouds.json.Json;
|
||||
import org.jclouds.logging.Logger;
|
||||
|
@ -60,9 +60,9 @@ public class ParseTypedAsyncJob implements Function<AsyncJob<Map<String, JsonBal
|
|||
@VisibleForTesting
|
||||
@Named("jclouds.cloudstack.jobresult-type-map")
|
||||
Map<String, Class<?>> typeMap = ImmutableMap.<String, Class<?>> builder().put("securitygroup", SecurityGroup.class)
|
||||
.put("portforwardingrule", PortForwardingRule.class).put("ipforwardingrule", IPForwardingRule.class).put(
|
||||
"template", Template.class).put("network", Network.class).put("ipaddress", PublicIPAddress.class)
|
||||
.put("virtualmachine", VirtualMachine.class).build();
|
||||
.put("portforwardingrule", PortForwardingRule.class).put("ipforwardingrule", IPForwardingRule.class)
|
||||
.put("template", Template.class).put("network", Network.class).put("ipaddress", PublicIPAddress.class)
|
||||
.put("virtualmachine", VirtualMachine.class).build();
|
||||
private final Json json;
|
||||
|
||||
@Inject
|
||||
|
@ -74,7 +74,7 @@ public class ParseTypedAsyncJob implements Function<AsyncJob<Map<String, JsonBal
|
|||
AsyncJob<?> result = toParse;
|
||||
if (toParse.getResult() != null) {
|
||||
if (toParse.getResult().size() == 1) {
|
||||
@SuppressWarnings( { "unchecked", "rawtypes" })
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
Builder<Object> builder = AsyncJob.Builder.fromAsyncJobUntyped((AsyncJob) toParse);
|
||||
if (toParse.getResult().containsKey("success")) {
|
||||
builder.result(null);
|
||||
|
@ -83,25 +83,24 @@ public class ParseTypedAsyncJob implements Function<AsyncJob<Map<String, JsonBal
|
|||
if (typeMap.containsKey(entry.getKey())) {
|
||||
builder.result(json.fromJson(entry.getValue().toString(), typeMap.get(entry.getKey())));
|
||||
} else {
|
||||
logger
|
||||
.warn(
|
||||
"type key %s not configured. please override default for Map<String, Class<?>> bound to name jclouds.cloudstack.jobresult-type-map",
|
||||
entry.getKey());
|
||||
logger.warn(
|
||||
"type key %s not configured. please override default for Map<String, Class<?>> bound to name jclouds.cloudstack.jobresult-type-map",
|
||||
entry.getKey());
|
||||
builder.result(entry.getValue().toString());
|
||||
}
|
||||
}
|
||||
result = builder.build();
|
||||
} else if (toParse.getResult().containsKey("errorcode")) {
|
||||
@SuppressWarnings( { "unchecked", "rawtypes" })
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
Builder<Object> builder = AsyncJob.Builder.fromAsyncJobUntyped((AsyncJob) toParse);
|
||||
builder.result(null);// avoid classcastexceptions
|
||||
builder.error(new AsyncJobError(Integer.parseInt(toParse.getResult().get("errorcode").toString()), toParse
|
||||
.getResult().containsKey("errortext") ? toParse.getResult().get("errortext").toString().replace(
|
||||
"\"", "") : null));
|
||||
.getResult().containsKey("errortext") ? toParse.getResult().get("errortext").toString()
|
||||
.replace("\"", "") : null));
|
||||
result = builder.build();
|
||||
} else if (toParse.getResult().size() > 1) {
|
||||
logger.warn("unexpected size of async job result; expecting a map with a single element", toParse
|
||||
.getResult());
|
||||
logger.warn("unexpected size of async job result; expecting a map with a single element",
|
||||
toParse.getResult());
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
|
|
@ -29,9 +29,9 @@ import org.jclouds.util.Throwables2;
|
|||
import com.google.common.base.Function;
|
||||
|
||||
/**
|
||||
* CloudStack is currently sending 431 errors with the text "Unable to find account owner for ip ".
|
||||
* In this case, we have to ignore as there's no means for us to avoid the problem, or action to
|
||||
* take.
|
||||
* CloudStack is currently sending 431 errors with the text
|
||||
* "Unable to find account owner for ip ". In this case, we have to ignore as
|
||||
* there's no means for us to avoid the problem, or action to take.
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
|
|
|
@ -58,14 +58,14 @@ public class ReuseOrAssociateNewPublicIPAddress implements Function<Network, Pub
|
|||
protected Logger logger = Logger.NULL;
|
||||
|
||||
@Inject
|
||||
public
|
||||
ReuseOrAssociateNewPublicIPAddress(CloudStackClient client, Predicate<Long> jobComplete) {
|
||||
public ReuseOrAssociateNewPublicIPAddress(CloudStackClient client, Predicate<Long> jobComplete) {
|
||||
this.client = checkNotNull(client, "client");
|
||||
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
|
||||
* 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
|
||||
*/
|
||||
public static PublicIPAddress findAvailableAndAssociatedWithNetwork(long networkId, AddressClient client) {
|
||||
return find(client.listPublicIPAddresses(allocatedOnly(true).networkId(networkId)), and(
|
||||
associatedWithNetwork(networkId), available()));
|
||||
return find(client.listPublicIPAddresses(allocatedOnly(true).networkId(networkId)),
|
||||
and(associatedWithNetwork(networkId), available()));
|
||||
}
|
||||
|
||||
public static PublicIPAddress associateIPAddressInNetwork(Network network, CloudStackClient client,
|
||||
Predicate<Long> jobComplete) {
|
||||
Predicate<Long> jobComplete) {
|
||||
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());
|
||||
PublicIPAddress ip = client.getAsyncJobClient().<PublicIPAddress> getAsyncJob(job.getJobId()).getResult();
|
||||
assert ip.getZoneId() == network.getZoneId();
|
||||
|
|
|
@ -23,7 +23,9 @@ import com.google.common.collect.ImmutableSet;
|
|||
/**
|
||||
* 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
|
||||
*/
|
||||
public class AssociateIPAddressOptions extends AccountInDomainOptions {
|
||||
|
|
|
@ -25,7 +25,9 @@ import com.google.common.collect.ImmutableSet;
|
|||
/**
|
||||
* 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
|
||||
*/
|
||||
public class CreateIPForwardingRuleOptions extends BaseHttpRequestOptions {
|
||||
|
|
|
@ -23,7 +23,9 @@ import com.google.common.collect.ImmutableSet;
|
|||
/**
|
||||
* 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
|
||||
*/
|
||||
public class CreateNetworkOptions extends AccountInDomainOptions {
|
||||
|
|
|
@ -29,7 +29,9 @@ import com.google.common.collect.ImmutableSet;
|
|||
/**
|
||||
* 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
|
||||
*/
|
||||
public class DeployVirtualMachineOptions extends AccountInDomainOptions {
|
||||
|
@ -37,11 +39,13 @@ public class DeployVirtualMachineOptions extends AccountInDomainOptions {
|
|||
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
|
||||
* diskOfferingId is for the root disk volume. Otherwise this parameter is used to dinidcate the
|
||||
* offering for the data disk volume. If the templateId parameter passed is from a Template
|
||||
* object, the 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.
|
||||
* the ID of the disk offering for the virtual machine. If the template is of
|
||||
* ISO format, the diskOfferingId is for the root disk volume. Otherwise this
|
||||
* parameter is used to dinidcate the offering for the data disk volume. If
|
||||
* the templateId parameter passed is from a Template object, the
|
||||
* 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
|
||||
* the ID of the disk offering
|
||||
|
@ -117,8 +121,8 @@ public class DeployVirtualMachineOptions extends AccountInDomainOptions {
|
|||
|
||||
/**
|
||||
* @param securityGroupId
|
||||
* security group applied to the virtual machine. Should be passed only when vm is
|
||||
* created from a zone with Basic Network support
|
||||
* security group applied to the virtual machine. Should be passed
|
||||
* only when vm is created from a zone with Basic Network support
|
||||
*/
|
||||
public DeployVirtualMachineOptions securityGroupId(long securityGroupId) {
|
||||
this.queryParameters.replaceValues("securitygroupids", ImmutableSet.of(securityGroupId + ""));
|
||||
|
@ -127,8 +131,8 @@ public class DeployVirtualMachineOptions extends AccountInDomainOptions {
|
|||
|
||||
/**
|
||||
* @param securityGroupIds
|
||||
* security groups applied to the virtual machine. Should be passed only when vm is
|
||||
* created from a zone with Basic Network support
|
||||
* security groups applied to the virtual machine. Should be passed
|
||||
* only when vm is created from a zone with Basic Network support
|
||||
*/
|
||||
public DeployVirtualMachineOptions securityGroupIds(Iterable<Long> securityGroupIds) {
|
||||
this.queryParameters.replaceValues("securitygroupids", ImmutableSet.of(Joiner.on(',').join(securityGroupIds)));
|
||||
|
@ -137,7 +141,8 @@ public class DeployVirtualMachineOptions extends AccountInDomainOptions {
|
|||
|
||||
/**
|
||||
* @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) {
|
||||
checkArgument(!queryParameters.containsKey("diskofferingid"), "Mutually exclusive with diskOfferingId");
|
||||
|
@ -147,10 +152,11 @@ public class DeployVirtualMachineOptions extends AccountInDomainOptions {
|
|||
|
||||
/**
|
||||
* @param unencodedData
|
||||
* an optional binary data that can be sent to the virtual machine upon a successful
|
||||
* deployment. This binary data must be base64 encoded before adding it to the request.
|
||||
* Currently only HTTP GET is supported. Using HTTP GET (via querystring), you can send
|
||||
* up to 2KB of data after base64 encoding.
|
||||
* an optional binary data that can be sent to the virtual machine
|
||||
* upon a successful deployment. This binary data must be base64
|
||||
* encoded before adding it to the request. Currently only HTTP GET
|
||||
* is supported. Using HTTP GET (via querystring), you can send up
|
||||
* to 2KB of data after base64 encoding.
|
||||
*/
|
||||
public DeployVirtualMachineOptions userData(byte[] unencodedData) {
|
||||
int length = checkNotNull(unencodedData, "unencodedData").length;
|
||||
|
|
|
@ -23,7 +23,9 @@ import com.google.common.collect.ImmutableSet;
|
|||
/**
|
||||
* 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
|
||||
*/
|
||||
public class ListAccountsOptions extends AccountInDomainOptions {
|
||||
|
@ -50,7 +52,8 @@ public class ListAccountsOptions extends AccountInDomainOptions {
|
|||
|
||||
/**
|
||||
* @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) {
|
||||
this.queryParameters.replaceValues("state", ImmutableSet.of(state));
|
||||
|
@ -68,8 +71,8 @@ public class ListAccountsOptions extends AccountInDomainOptions {
|
|||
|
||||
/**
|
||||
* @param recursive
|
||||
* defaults to false, but if true, lists all accounts from the parent specified by the
|
||||
* domain id till leaves.
|
||||
* defaults to false, but if true, lists all accounts from the
|
||||
* parent specified by the domain id till leaves.
|
||||
*/
|
||||
public ListAccountsOptions recursive(boolean recursive) {
|
||||
this.queryParameters.replaceValues("isrecursive", ImmutableSet.of(recursive + ""));
|
||||
|
|
|
@ -30,7 +30,9 @@ import com.google.common.collect.ImmutableSet;
|
|||
/**
|
||||
* 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
|
||||
*/
|
||||
public class ListAsyncJobsOptions extends AccountInDomainOptions {
|
||||
|
@ -43,8 +45,8 @@ public class ListAsyncJobsOptions extends AccountInDomainOptions {
|
|||
* the start date of the async job
|
||||
*/
|
||||
public ListAsyncJobsOptions startDate(Date startDate) {
|
||||
this.queryParameters.replaceValues("startdate", ImmutableSet.of(dateService
|
||||
.iso8601SecondsDateFormat(checkNotNull(startDate, "startDate"))));
|
||||
this.queryParameters.replaceValues("startdate",
|
||||
ImmutableSet.of(dateService.iso8601SecondsDateFormat(checkNotNull(startDate, "startDate"))));
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,9 @@ import com.google.common.collect.ImmutableSet;
|
|||
/**
|
||||
* 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
|
||||
*/
|
||||
public class ListDiskOfferingsOptions extends BaseHttpRequestOptions {
|
||||
|
|
|
@ -23,7 +23,9 @@ import com.google.common.collect.ImmutableSet;
|
|||
/**
|
||||
* 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
|
||||
*/
|
||||
public class ListIPForwardingRulesOptions extends AccountInDomainOptions {
|
||||
|
|
|
@ -23,7 +23,9 @@ import com.google.common.collect.ImmutableSet;
|
|||
/**
|
||||
* 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
|
||||
*/
|
||||
public class ListLoadBalancerRulesOptions extends AccountInDomainOptions {
|
||||
|
|
|
@ -26,7 +26,9 @@ import com.google.common.collect.ImmutableSet;
|
|||
/**
|
||||
* 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
|
||||
*/
|
||||
public class ListNetworkOfferingsOptions extends BaseHttpRequestOptions {
|
||||
|
@ -38,7 +40,7 @@ public class ListNetworkOfferingsOptions extends BaseHttpRequestOptions {
|
|||
* the ID of the network offering
|
||||
*/
|
||||
public ListNetworkOfferingsOptions id(long id) {
|
||||
this.queryParameters.replaceValues("id", ImmutableSet.of(id+""));
|
||||
this.queryParameters.replaceValues("id", ImmutableSet.of(id + ""));
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -89,8 +91,8 @@ public class ListNetworkOfferingsOptions extends BaseHttpRequestOptions {
|
|||
|
||||
/**
|
||||
* @param specifyVLAN
|
||||
* True if we allow the network supports vlan, false otherwise. If you create network
|
||||
* using this offering, you must specify vlan.
|
||||
* True if we allow the network supports vlan, false otherwise. If
|
||||
* you create network using this offering, you must specify vlan.
|
||||
*/
|
||||
public ListNetworkOfferingsOptions specifyVLAN(boolean specifyVLAN) {
|
||||
this.queryParameters.replaceValues("specifyvlan", ImmutableSet.of(specifyVLAN + ""));
|
||||
|
|
|
@ -27,7 +27,9 @@ import com.google.common.collect.ImmutableSet;
|
|||
/**
|
||||
* 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
|
||||
*/
|
||||
public class ListNetworksOptions extends BaseHttpRequestOptions {
|
||||
|
@ -82,8 +84,8 @@ public class ListNetworksOptions extends BaseHttpRequestOptions {
|
|||
/**
|
||||
*
|
||||
* @param account
|
||||
* account who will own the VLAN. If VLAN is Zone wide, this parameter should be
|
||||
* ommited
|
||||
* account who will own the VLAN. If VLAN is Zone wide, this
|
||||
* parameter should be ommited
|
||||
*/
|
||||
public ListNetworksOptions account(String account) {
|
||||
this.queryParameters.replaceValues("account", ImmutableSet.of(account));
|
||||
|
|
|
@ -25,19 +25,24 @@ import com.google.common.collect.ImmutableSet;
|
|||
/**
|
||||
* 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
|
||||
*/
|
||||
public class ListOSTypesOptions extends BaseHttpRequestOptions {
|
||||
|
||||
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) {
|
||||
this.queryParameters.replaceValues("id", ImmutableSet.of(id + ""));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param OSCategoryId
|
||||
* list by Os Category id
|
||||
|
@ -47,7 +52,6 @@ public class ListOSTypesOptions extends BaseHttpRequestOptions {
|
|||
return this;
|
||||
}
|
||||
|
||||
|
||||
public static class Builder {
|
||||
/**
|
||||
* @see ListOSTypesOptions#id
|
||||
|
@ -57,7 +61,6 @@ public class ListOSTypesOptions extends BaseHttpRequestOptions {
|
|||
return options.id(id);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see ListOSTypesOptions#OSCategoryId
|
||||
*/
|
||||
|
|
|
@ -23,7 +23,9 @@ import com.google.common.collect.ImmutableSet;
|
|||
/**
|
||||
* 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
|
||||
*/
|
||||
public class ListPortForwardingRulesOptions extends AccountInDomainOptions {
|
||||
|
|
|
@ -23,7 +23,9 @@ import com.google.common.collect.ImmutableSet;
|
|||
/**
|
||||
* 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
|
||||
*/
|
||||
public class ListPublicIPAddressesOptions extends AccountInDomainOptions {
|
||||
|
|
|
@ -18,29 +18,31 @@
|
|||
*/
|
||||
package org.jclouds.cloudstack.options;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import org.jclouds.http.options.BaseHttpRequestOptions;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
public class ListSSHKeyPairsOptions extends BaseHttpRequestOptions {
|
||||
|
||||
public static final ListSSHKeyPairsOptions NONE = new ListSSHKeyPairsOptions();
|
||||
public static final ListSSHKeyPairsOptions NONE = new ListSSHKeyPairsOptions();
|
||||
|
||||
/**
|
||||
* @param name the SSHKeyPair name
|
||||
*/
|
||||
public ListSSHKeyPairsOptions name(String name) {
|
||||
this.queryParameters.replaceValues("name", ImmutableSet.of(name));
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* @param name
|
||||
* the SSHKeyPair name
|
||||
*/
|
||||
public ListSSHKeyPairsOptions name(String name) {
|
||||
this.queryParameters.replaceValues("name", ImmutableSet.of(name));
|
||||
return this;
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
/**
|
||||
* @see ListSSHKeyPairsOptions#name
|
||||
*/
|
||||
public static ListSSHKeyPairsOptions name(String name) {
|
||||
ListSSHKeyPairsOptions options = new ListSSHKeyPairsOptions();
|
||||
return options.name(name);
|
||||
}
|
||||
public static class Builder {
|
||||
/**
|
||||
* @see ListSSHKeyPairsOptions#name
|
||||
*/
|
||||
public static ListSSHKeyPairsOptions name(String name) {
|
||||
ListSSHKeyPairsOptions options = new ListSSHKeyPairsOptions();
|
||||
return options.name(name);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,9 @@ import com.google.common.collect.ImmutableSet;
|
|||
/**
|
||||
* 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
|
||||
*/
|
||||
public class ListSecurityGroupsOptions extends AssociateIPAddressOptions {
|
||||
|
@ -50,8 +52,9 @@ public class ListSecurityGroupsOptions extends AssociateIPAddressOptions {
|
|||
|
||||
/**
|
||||
* @param virtualMachineId
|
||||
* the ID of the virtual machine. Pass this in if you want to see the available service
|
||||
* offering that a virtual machine can be changed to.
|
||||
* the ID of the virtual machine. Pass this in if you want to see
|
||||
* the available service offering that a virtual machine can be
|
||||
* changed to.
|
||||
*/
|
||||
public ListSecurityGroupsOptions virtualMachineId(long virtualMachineId) {
|
||||
this.queryParameters.replaceValues("virtualmachineid", ImmutableSet.of(virtualMachineId + ""));
|
||||
|
|
|
@ -25,7 +25,9 @@ import com.google.common.collect.ImmutableSet;
|
|||
/**
|
||||
* 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
|
||||
*/
|
||||
public class ListServiceOfferingsOptions extends BaseHttpRequestOptions {
|
||||
|
@ -62,8 +64,9 @@ public class ListServiceOfferingsOptions extends BaseHttpRequestOptions {
|
|||
|
||||
/**
|
||||
* @param virtualMachineId
|
||||
* the ID of the virtual machine. Pass this in if you want to see the available service
|
||||
* offering that a virtual machine can be changed to.
|
||||
* the ID of the virtual machine. Pass this in if you want to see
|
||||
* the available service offering that a virtual machine can be
|
||||
* changed to.
|
||||
*/
|
||||
public ListServiceOfferingsOptions virtualMachineId(long virtualMachineId) {
|
||||
this.queryParameters.replaceValues("virtualmachineid", ImmutableSet.of(virtualMachineId + ""));
|
||||
|
|
|
@ -25,7 +25,9 @@ import com.google.common.collect.ImmutableSet;
|
|||
/**
|
||||
* 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
|
||||
*/
|
||||
public class ListTemplatesOptions extends AccountInDomainOptions {
|
||||
|
|
|
@ -23,7 +23,9 @@ import com.google.common.collect.ImmutableSet;
|
|||
/**
|
||||
* 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
|
||||
*/
|
||||
public class ListVirtualMachinesOptions extends AccountInDomainOptions {
|
||||
|
@ -109,8 +111,8 @@ public class ListVirtualMachinesOptions extends AccountInDomainOptions {
|
|||
|
||||
/**
|
||||
* @param usesVirtualNetwork
|
||||
* list by network type; true if need to list vms using Virtual Network, false
|
||||
* otherwise
|
||||
* list by network type; true if need to list vms using Virtual
|
||||
* Network, false otherwise
|
||||
*/
|
||||
public ListVirtualMachinesOptions usesVirtualNetwork(boolean usesVirtualNetwork) {
|
||||
this.queryParameters.replaceValues("forvirtualnetwork", ImmutableSet.of(usesVirtualNetwork + ""));
|
||||
|
|
|
@ -25,7 +25,9 @@ import com.google.common.collect.ImmutableSet;
|
|||
/**
|
||||
* 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
|
||||
*/
|
||||
public class ListZonesOptions extends BaseHttpRequestOptions {
|
||||
|
@ -37,7 +39,7 @@ public class ListZonesOptions extends BaseHttpRequestOptions {
|
|||
* the ID of the zone
|
||||
*/
|
||||
public ListZonesOptions id(long id) {
|
||||
this.queryParameters.replaceValues("id", ImmutableSet.of(id+""));
|
||||
this.queryParameters.replaceValues("id", ImmutableSet.of(id + ""));
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -46,15 +48,16 @@ public class ListZonesOptions extends BaseHttpRequestOptions {
|
|||
* the ID of the domain associated with the zone
|
||||
*/
|
||||
public ListZonesOptions domainId(long domainId) {
|
||||
this.queryParameters.replaceValues("domainid", ImmutableSet.of(domainId+""));
|
||||
this.queryParameters.replaceValues("domainid", ImmutableSet.of(domainId + ""));
|
||||
return this;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param available
|
||||
* true if you want to retrieve all available Zones. False if you only want to return
|
||||
* the Zones from which you have at least one VM. Default is false.
|
||||
* true if you want to retrieve all available Zones. False if you
|
||||
* only want to return the Zones from which you have at least one
|
||||
* VM. Default is false.
|
||||
*/
|
||||
public ListZonesOptions available(boolean available) {
|
||||
this.queryParameters.replaceValues("available", ImmutableSet.of(available + ""));
|
||||
|
|
|
@ -39,8 +39,8 @@ import com.google.common.collect.ImmutableMap;
|
|||
import com.google.common.collect.ImmutableMap.Builder;
|
||||
|
||||
/**
|
||||
* Templates can be present in a zone, and available, but not valid for launch as their hypervisor
|
||||
* isn't installed.
|
||||
* Templates can be present in a zone, and available, but not valid for launch
|
||||
* as their hypervisor isn't installed.
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
|
@ -58,7 +58,7 @@ public class CorrectHypervisorForZone implements Function<Long, Predicate<Templa
|
|||
}
|
||||
|
||||
private static class CloudStackClientToZoneToHypervisors implements
|
||||
Function<CloudStackClient, Map<Long, Set<String>>> {
|
||||
Function<CloudStackClient, Map<Long, Set<String>>> {
|
||||
|
||||
@Override
|
||||
public Map<Long, Set<String>> apply(CloudStackClient client) {
|
||||
|
|
|
@ -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());
|
||||
if (job.getError() != null)
|
||||
throw new IllegalStateException(String.format("job %s failed with exception %s", job.getId(), job.getError()
|
||||
.toString()));
|
||||
.toString()));
|
||||
return job.getStatus() > 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -112,10 +112,10 @@ public class NetworkPredicates {
|
|||
}
|
||||
|
||||
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"),
|
||||
new CapabilitiesInclude("PortForwarding"));
|
||||
new CapabilitiesInclude("PortForwarding"));
|
||||
|
||||
public static Predicate<NetworkService> isLoadBalancerService = new NetworkServiceNamed("Lb");
|
||||
|
||||
|
|
|
@ -49,8 +49,8 @@ public class OSCategoryIn implements Function<Set<String>, Predicate<Template>>
|
|||
|
||||
@Inject
|
||||
public OSCategoryIn(CloudStackClient client) {
|
||||
this(Suppliers.ofInstance(checkNotNull(client, "client").getGuestOSClient().listOSCategories()), Suppliers.ofInstance(client
|
||||
.getGuestOSClient().listOSTypes()));
|
||||
this(Suppliers.ofInstance(checkNotNull(client, "client").getGuestOSClient().listOSCategories()), Suppliers
|
||||
.ofInstance(client.getGuestOSClient().listOSTypes()));
|
||||
}
|
||||
|
||||
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) {
|
||||
final Map<Long, String> categories = categoriesSupplier.get();
|
||||
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
|
||||
public Long apply(OSType input) {
|
||||
return input.getId();
|
||||
}
|
||||
@Override
|
||||
public Long apply(OSType input) {
|
||||
return input.getId();
|
||||
}
|
||||
|
||||
}), new Function<OSType, String>() {
|
||||
}), new Function<OSType, String>() {
|
||||
|
||||
@Override
|
||||
public String apply(OSType input) {
|
||||
return categories.get(input.getOSCategoryId());
|
||||
}
|
||||
@Override
|
||||
public String apply(OSType input) {
|
||||
return categories.get(input.getOSCategoryId());
|
||||
}
|
||||
|
||||
}), Predicates.in(acceptableCategories)).keySet();
|
||||
}), Predicates.in(acceptableCategories)).keySet();
|
||||
return new Predicate<Template>() {
|
||||
|
||||
@Override
|
||||
|
|
|
@ -55,7 +55,7 @@ public class PublicIPAddressPredicates {
|
|||
@Override
|
||||
public boolean apply(PublicIPAddress arg0) {
|
||||
return !checkNotNull(arg0, "ipaddress").isSourceNAT() && !arg0.isStaticNAT()
|
||||
&& arg0.getVirtualMachineId() <= 0 && arg0.getState() == PublicIPAddress.State.ALLOCATED;
|
||||
&& arg0.getVirtualMachineId() <= 0 && arg0.getState() == PublicIPAddress.State.ALLOCATED;
|
||||
}
|
||||
|
||||
@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) {
|
||||
return new AssociatedWithNetwork(networkId);
|
||||
|
|
|
@ -56,7 +56,7 @@ public class VirtualMachineDestroyed implements Predicate<VirtualMachine> {
|
|||
if (virtualMachine == null)
|
||||
return true;
|
||||
logger.trace("%s: looking for virtualMachine state %s: currently: %s", virtualMachine.getId(), State.DESTROYED,
|
||||
virtualMachine.getState());
|
||||
virtualMachine.getState());
|
||||
return virtualMachine.getState() == State.DESTROYED;
|
||||
}
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ public class VirtualMachineRunning implements Predicate<VirtualMachine> {
|
|||
if (virtualMachine == null)
|
||||
return false;
|
||||
logger.trace("%s: looking for virtualMachine state %s: currently: %s", virtualMachine.getId(), State.RUNNING,
|
||||
virtualMachine.getState());
|
||||
virtualMachine.getState());
|
||||
if (virtualMachine.getState() == State.ERROR)
|
||||
throw new IllegalStateException("virtualMachine in error state: " + virtualMachine);
|
||||
return virtualMachine.getState() == State.RUNNING;
|
||||
|
|
|
@ -109,7 +109,8 @@ public class NetworkClientLiveTest extends BaseCloudStackClientLiveTest {
|
|||
assert network.getAccount() != null : network;
|
||||
assert network.getBroadcastDomainType() != 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.getNetworkOfferingDisplayText() != null : network;
|
||||
assert network.getNetworkOfferingId() > 0 : network;
|
||||
|
|
|
@ -65,7 +65,7 @@ public class SSHKeyPairAsyncClientTest extends BaseCloudStackAsyncClientTest<SSH
|
|||
HttpRequest httpRequest = processor.createRequest(method, ListSSHKeyPairsOptions.Builder.name("jclouds"));
|
||||
|
||||
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");
|
||||
assertPayloadEquals(httpRequest, null, null, false);
|
||||
|
||||
|
@ -78,11 +78,11 @@ public class SSHKeyPairAsyncClientTest extends BaseCloudStackAsyncClientTest<SSH
|
|||
}
|
||||
|
||||
public void testGetSSHKeyPair() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Method method = SSHKeyPairAsyncClient.class.getMethod("getSSHKeyPair", long.class);
|
||||
HttpRequest httpRequest = processor.createRequest(method, 3l);
|
||||
Method method = SSHKeyPairAsyncClient.class.getMethod("getSSHKeyPair", String.class);
|
||||
HttpRequest httpRequest = processor.createRequest(method, "jclouds-keypair");
|
||||
|
||||
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");
|
||||
assertPayloadEquals(httpRequest, null, null, false);
|
||||
|
||||
|
|
|
@ -18,6 +18,10 @@
|
|||
*/
|
||||
package org.jclouds.cloudstack.features;
|
||||
|
||||
import static org.testng.Assert.assertEquals;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import org.jclouds.cloudstack.domain.SSHKeyPair;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
|
@ -30,18 +34,20 @@ import org.testng.annotations.Test;
|
|||
public class SSHKeyPairClientLiveTest extends BaseCloudStackClientLiveTest {
|
||||
|
||||
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() {
|
||||
final String sshKeyPair = client.getSSHKeyPairClient().createSSHKeyPair("vijay-test");
|
||||
final SSHKeyPair sshKeyPair = client.getSSHKeyPairClient().createSSHKeyPair("jclouds-keypair");
|
||||
System.out.println(sshKeyPair);
|
||||
}
|
||||
|
||||
protected void checkSSHKeyPair(SSHKeyPair pair) {
|
||||
assert pair.getName() != null : pair;
|
||||
// assertEquals(pair.toString(),
|
||||
// client.getSSHKeyPairClient().getSSHKeyPair(pair.getName()).toString());
|
||||
assertEquals(pair.toString(), client.getSSHKeyPairClient().getSSHKeyPair(pair.getName()).toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
|
||||
}
|
|
@ -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"} } }
|
|
@ -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"} ] } }
|
Loading…
Reference in New Issue