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,7 +18,22 @@
|
|||
*/
|
||||
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;
|
||||
|
||||
/**
|
||||
|
@ -44,7 +59,8 @@ public interface CloudStackAsyncClient {
|
|||
TemplateAsyncClient getTemplateClient();
|
||||
|
||||
/**
|
||||
* Provides asynchronous access to Service, Disk, and Network Offering features.
|
||||
* Provides asynchronous access to Service, Disk, and Network Offering
|
||||
* features.
|
||||
*/
|
||||
@Delegate
|
||||
OfferingAsyncClient getOfferingClient();
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -118,9 +118,9 @@ public class AsyncJob<T> {
|
|||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -346,8 +347,8 @@ public class AsyncJob<T> {
|
|||
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 + "]";
|
||||
+ ", 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;
|
||||
|
|
|
@ -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,
|
||||
|
||||
|
|
|
@ -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 + "]";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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 + "]";
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -29,7 +29,6 @@ public class SSHKeyPair implements Comparable<SSHKeyPair> {
|
|||
return this;
|
||||
}
|
||||
|
||||
|
||||
public SSHKeyPair build() {
|
||||
return new SSHKeyPair(fingerprint, name, privateKey);
|
||||
}
|
||||
|
@ -112,5 +111,4 @@ public class SSHKeyPair implements Comparable<SSHKeyPair> {
|
|||
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,
|
||||
|
||||
|
|
|
@ -329,8 +329,8 @@ public class User implements Comparable<User> {
|
|||
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);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -395,8 +394,8 @@ public class VirtualMachine implements Comparable<VirtualMachine> {
|
|||
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) {
|
||||
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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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,16 +60,18 @@ 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,
|
||||
|
@ -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
|
||||
* @see org.jclouds.cloudstack.features.SSHKeyPairClient#listSSHKeyPairs
|
||||
*/
|
||||
@GET
|
||||
@QueryParams(keys = "command", values = "listSSHKeyPairs")
|
||||
// @SelectJson("")
|
||||
// @Consumes(MediaType.APPLICATION_JSON)
|
||||
// @ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
|
||||
// ListenableFuture<Set<SSHKeyPair>> listSSHKeyPairs();
|
||||
ListenableFuture<String> 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);
|
||||
@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);
|
||||
}
|
|
@ -107,10 +107,8 @@ 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,
|
||||
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);
|
||||
|
@ -134,10 +132,8 @@ 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,
|
||||
ListenableFuture<Long> authorizeIngressICMPToSecurityGroups(@QueryParam("securitygroupid") long securityGroupId,
|
||||
@QueryParam("icmpcode") int ICMPCode, @QueryParam("icmptype") int ICMPType,
|
||||
@BinderParam(BindAccountSecurityGroupPairsToIndexedQueryParams.class) Multimap<String, String> accountToGroup,
|
||||
AccountInDomainOptions... options);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
@ -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,7 +111,8 @@ 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,
|
||||
|
@ -118,8 +121,10 @@ public interface SecurityGroupClient {
|
|||
/**
|
||||
* 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,8 +81,8 @@ 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,
|
||||
ListenableFuture<AsyncCreateResponse> deployVirtualMachineInZone(@QueryParam("zoneid") long zoneId,
|
||||
@QueryParam("serviceofferingid") long serviceOfferingId, @QueryParam("templateid") long templateId,
|
||||
DeployVirtualMachineOptions... options);
|
||||
|
||||
/**
|
||||
|
|
|
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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,8 +60,8 @@ 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("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;
|
||||
|
||||
|
@ -83,8 +83,7 @@ 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(
|
||||
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());
|
||||
|
@ -96,12 +95,12 @@ public class ParseTypedAsyncJob implements Function<AsyncJob<Map<String, JsonBal
|
|||
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,8 +76,8 @@ 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,
|
||||
|
|
|
@ -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 {
|
||||
|
@ -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,15 +18,17 @@
|
|||
*/
|
||||
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();
|
||||
|
||||
/**
|
||||
* @param name the SSHKeyPair name
|
||||
* @param name
|
||||
* the SSHKeyPair name
|
||||
*/
|
||||
public ListSSHKeyPairsOptions name(String name) {
|
||||
this.queryParameters.replaceValues("name", ImmutableSet.of(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 {
|
||||
|
@ -53,8 +55,9 @@ public class ListZonesOptions extends BaseHttpRequestOptions {
|
|||
|
||||
/**
|
||||
* @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
|
||||
*/
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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