mirror of https://github.com/apache/jclouds.git
Fix comments and add keyName field in Server class
This commit is contained in:
parent
03a5a55fcc
commit
6c47f43a98
|
@ -323,7 +323,7 @@ public interface NovaAsyncClient {
|
|||
@Consumes
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
@Payload("%7B\"addFloatingIp\":%7B\"address\":\"{address}\"%7D%7D")
|
||||
ListenableFuture<Void> addFloatingIp(@PathParam("id") int serverId, @PayloadParam("address") String ip);
|
||||
ListenableFuture<Void> addFloatingIP(@PathParam("id") int serverId, @PayloadParam("address") String ip);
|
||||
|
||||
@GET
|
||||
@Unwrap
|
||||
|
|
|
@ -288,21 +288,27 @@ public interface NovaClient {
|
|||
* directly add the floating IP just after creating the server but have to
|
||||
* poll if the server has an IP.
|
||||
*
|
||||
* @see <a href="http://wiki.openstack.org/os_api_floating_ip">http://wiki.openstack.org/os_api_floating_ip</a>
|
||||
* @since 2011.3 "Diablo" release, OpenStack API 1.1
|
||||
* @param serverId
|
||||
* @param ip
|
||||
*/
|
||||
void addFloatingIp(int serverId, String ip);
|
||||
void addFloatingIP(int serverId, String ip);
|
||||
|
||||
/**
|
||||
* Get all the defined floating IPs
|
||||
* Get all the defined floating IPs in nova
|
||||
*
|
||||
* @return
|
||||
* @see <a href="http://wiki.openstack.org/os_api_floating_ip">http://wiki.openstack.org/os_api_floating_ip</a>
|
||||
* @since 2011.3 "Diablo" release, OpenStack API 1.1
|
||||
* @return all the available floating IP for the current tenant
|
||||
*/
|
||||
Set<FloatingIP> listFloatingIPs();
|
||||
|
||||
/**
|
||||
* Get floating IP details from its ID
|
||||
*
|
||||
* @see <a href="http://wiki.openstack.org/os_api_floating_ip">http://wiki.openstack.org/os_api_floating_ip</a>
|
||||
* @since 2011.3 "Diablo" release, OpenStack API 1.1
|
||||
* @param id the floating IP id
|
||||
* @return the floating IP or null if not found
|
||||
*/
|
||||
|
|
|
@ -21,10 +21,11 @@ package org.jclouds.openstack.nova.domain;
|
|||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
/**
|
||||
* Check <a href="http://wiki.openstack.org/os_api_floating_ip">Floating IP Wiki page</a>
|
||||
* Check <a href="http://wiki.openstack.org/os_api_floating_ip">Floating IP Wiki
|
||||
* page</a>. Available since OpenStack Diablo release and API 1.1.
|
||||
*
|
||||
* @author chamerling
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class FloatingIP extends Resource {
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
package org.jclouds.openstack.nova.domain;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
@ -45,6 +46,9 @@ public class Server extends Resource {
|
|||
private Flavor flavor;
|
||||
private Image image;
|
||||
|
||||
@SerializedName(value="key_name")
|
||||
private String keyName;
|
||||
|
||||
private Date created;
|
||||
private Date updated;
|
||||
|
||||
|
@ -191,6 +195,14 @@ public class Server extends Resource {
|
|||
public void setImage(Image image) {
|
||||
this.image = image;
|
||||
}
|
||||
|
||||
public String getKeyName() {
|
||||
return keyName;
|
||||
}
|
||||
|
||||
public void setKeyName(String keyName) {
|
||||
this.keyName = keyName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
|
@ -204,6 +216,7 @@ public class Server extends Resource {
|
|||
result = prime * result + ((imageRef == null) ? 0 : imageRef.hashCode());
|
||||
result = prime * result + ((metadata == null) ? 0 : metadata.hashCode());
|
||||
result = prime * result + ((uuid == null) ? 0 : uuid.hashCode());
|
||||
result = prime * result + ((keyName == null) ? 0 : keyName.hashCode());
|
||||
result = prime * result + ((name == null) ? 0 : name.hashCode());
|
||||
result = prime * result + ((flavor == null) ? 0 : flavor.hashCode());
|
||||
result = prime * result + ((image == null) ? 0 : image.hashCode());
|
||||
|
@ -256,6 +269,11 @@ public class Server extends Resource {
|
|||
return false;
|
||||
} else if (!uuid.equals(other.uuid))
|
||||
return false;
|
||||
if (keyName == null) {
|
||||
if (other.keyName != null)
|
||||
return false;
|
||||
} else if (!keyName.equals(other.keyName))
|
||||
return false;
|
||||
if (name == null) {
|
||||
if (other.name != null)
|
||||
return false;
|
||||
|
@ -282,7 +300,7 @@ public class Server extends Resource {
|
|||
public String toString() {
|
||||
return "Server [addresses=" + addresses + ", adminPass=" + adminPass + ", flavorRef="
|
||||
+ flavorRef + ", hostId=" + hostId + ", id=" + id + ", imageRef=" + imageRef
|
||||
+ ", metadata=" + metadata + ", uuid=" + uuid + ", name=" + name + "]";
|
||||
+ ", metadata=" + metadata + ", uuid=" + uuid + ", name=" + name + ", keyName=" + keyName + "]";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -147,7 +147,14 @@ public class CreateServerOptions implements MapBinder {
|
|||
this.metadata = metadata;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* A keypair name can be defined when creating a server. This key will be
|
||||
* linked to the server and used to SSH connect to the machine
|
||||
*
|
||||
* @param keyName
|
||||
* @return
|
||||
*/
|
||||
public CreateServerOptions withKeyName(String keyName) {
|
||||
checkNotNull(keyName, "keyName");
|
||||
this.keyName = keyName;
|
||||
|
@ -173,7 +180,7 @@ public class CreateServerOptions implements MapBinder {
|
|||
}
|
||||
|
||||
/**
|
||||
* @see CreateServerOptions#withKeyPair(String)
|
||||
* @see CreateServerOptions#withKeyName(String)
|
||||
*/
|
||||
public static CreateServerOptions withKeyName(String keyName) {
|
||||
CreateServerOptions options = new CreateServerOptions();
|
||||
|
|
Loading…
Reference in New Issue