diff options
Diffstat (limited to 'nova-client/src/main/java')
-rw-r--r-- | nova-client/src/main/java/com/woorea/openstack/nova/Nova.java | 8 | ||||
-rw-r--r-- | nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/HypervisorsExtension.java | 44 |
2 files changed, 51 insertions, 1 deletions
diff --git a/nova-client/src/main/java/com/woorea/openstack/nova/Nova.java b/nova-client/src/main/java/com/woorea/openstack/nova/Nova.java index 0125179..908e1e9 100644 --- a/nova-client/src/main/java/com/woorea/openstack/nova/Nova.java +++ b/nova-client/src/main/java/com/woorea/openstack/nova/Nova.java @@ -27,6 +27,7 @@ import com.woorea.openstack.nova.api.ServersResource; import com.woorea.openstack.nova.api.extensions.AggregatesExtension; import com.woorea.openstack.nova.api.extensions.FloatingIpsExtension; import com.woorea.openstack.nova.api.extensions.HostsExtension; +import com.woorea.openstack.nova.api.extensions.HypervisorsExtension; import com.woorea.openstack.nova.api.extensions.KeyPairsExtension; import com.woorea.openstack.nova.api.extensions.SecurityGroupsExtension; import com.woorea.openstack.nova.api.extensions.SnapshotsExtension; @@ -58,6 +59,8 @@ public class Nova extends OpenStackClient { private final HostsExtension hosts; + private final HypervisorsExtension hypervisor; + public Nova(String endpoint, OpenStackClientConnector connector) { super(endpoint, connector); extensions = new ExtensionsResource(this); @@ -72,6 +75,7 @@ public class Nova extends OpenStackClient { aggregates = new AggregatesExtension(this); quotaSets = new QuotaSetsResource(this); hosts = new HostsExtension(this); + hypervisor = new HypervisorsExtension(this); } public Nova(String endpoint) { @@ -125,4 +129,8 @@ public class Nova extends OpenStackClient { public HostsExtension hosts() { return hosts; } + + public HypervisorsExtension hypervisors() { + return hypervisor; + } } diff --git a/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/HypervisorsExtension.java b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/HypervisorsExtension.java index b092b0c..a785971 100644 --- a/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/HypervisorsExtension.java +++ b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/HypervisorsExtension.java @@ -16,6 +16,48 @@ package com.woorea.openstack.nova.api.extensions; -public interface HypervisorsExtension { +import com.woorea.openstack.base.client.HttpMethod; +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.base.client.OpenStackRequest; +import com.woorea.openstack.nova.model.Hypervisor; +import com.woorea.openstack.nova.model.Hypervisors; +public class HypervisorsExtension { + + private final OpenStackClient client; + + public HypervisorsExtension(OpenStackClient client) { + this.client = client; + } + + public List list() { + return new List(); + } + + public ListDetail listDetail() { + return new ListDetail(); + } + + public Show show(String id) { + return new Show(id); + } + + public class List extends OpenStackRequest<Hypervisors> { + public List() { + super(client, HttpMethod.GET, "/os-hypervisors", null, Hypervisors.class); + } + } + + public class ListDetail extends OpenStackRequest<Hypervisors> { + public ListDetail() { + super(client, HttpMethod.GET, "/os-hypervisors/detail", null, Hypervisors.class); + } + } + + public class Show extends OpenStackRequest<Hypervisor> { + public Show(String id) { + super(client, HttpMethod.GET, new StringBuffer("/hypervisors").append(id).toString(), null, + Hypervisor.class); + } + } } |