summaryrefslogtreecommitdiffstats
path: root/nova-client/src/main/java
diff options
context:
space:
mode:
authorChrisC <cc697w@intl.att.com>2017-01-31 13:57:24 +0100
committerChrisC <cc697w@intl.att.com>2017-01-31 14:55:11 +0100
commit2e984294ac28c6f2ede290c38164c5d536ccaf4a (patch)
tree5eba5a929b7a961c98749fa69e03cfea58e1a724 /nova-client/src/main/java
parent86c0f28c8ed469486b64d6422dc53e3a7bcc8adb (diff)
Initial OpenECOMP MSO OpenStack SDK lib commit
Change-Id: Ieaacb2b2c0dcc469669880e73f0cda9fa59a6c5a Signed-off-by: ChrisC <cc697w@intl.att.com>
Diffstat (limited to 'nova-client/src/main/java')
-rw-r--r--nova-client/src/main/java/com/woorea/openstack/nova/Nova.java113
-rw-r--r--nova-client/src/main/java/com/woorea/openstack/nova/api/ExtensionsResource.java30
-rw-r--r--nova-client/src/main/java/com/woorea/openstack/nova/api/FlavorsResource.java85
-rw-r--r--nova-client/src/main/java/com/woorea/openstack/nova/api/ImagesResource.java85
-rw-r--r--nova-client/src/main/java/com/woorea/openstack/nova/api/QuotaSetsResource.java61
-rw-r--r--nova-client/src/main/java/com/woorea/openstack/nova/api/ServersResource.java541
-rw-r--r--nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/AggregatesExtension.java163
-rw-r--r--nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/CloudpipesExtension.java49
-rw-r--r--nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/CredentialsExtension.java43
-rw-r--r--nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/FloatingIpDnsExtension.java89
-rw-r--r--nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/FloatingIpPoolsExtension.java31
-rw-r--r--nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/FloatingIpsExtension.java67
-rw-r--r--nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/HostsExtension.java44
-rw-r--r--nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/HypervisorsExtension.java5
-rw-r--r--nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/KeyPairsExtension.java65
-rw-r--r--nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/NetworksExtension.java82
-rw-r--r--nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/SecurityGroupsExtension.java184
-rw-r--r--nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/SnapshotsExtension.java86
-rw-r--r--nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/VolumesExtension.java106
19 files changed, 1929 insertions, 0 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
new file mode 100644
index 0000000..f81de7d
--- /dev/null
+++ b/nova-client/src/main/java/com/woorea/openstack/nova/Nova.java
@@ -0,0 +1,113 @@
+package com.woorea.openstack.nova;
+
+
+import com.woorea.openstack.base.client.OpenStackClient;
+import com.woorea.openstack.base.client.OpenStackClientConnector;
+import com.woorea.openstack.nova.api.ExtensionsResource;
+import com.woorea.openstack.nova.api.FlavorsResource;
+import com.woorea.openstack.nova.api.ImagesResource;
+import com.woorea.openstack.nova.api.QuotaSetsResource;
+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.KeyPairsExtension;
+import com.woorea.openstack.nova.api.extensions.SecurityGroupsExtension;
+import com.woorea.openstack.nova.api.extensions.SnapshotsExtension;
+import com.woorea.openstack.nova.api.extensions.VolumesExtension;
+import com.woorea.openstack.nova.api.extensions.HostsExtension;
+
+public class Nova extends OpenStackClient {
+
+ private final ExtensionsResource EXTENSIONS;
+
+ private final ServersResource SERVERS;
+
+ private final ImagesResource IMAGES;
+
+ private final FlavorsResource FLAVORS;
+
+ private final KeyPairsExtension KEY_PAIRS;
+
+ private final FloatingIpsExtension FLOATING_IPS;
+
+ private final SecurityGroupsExtension SECURITY_GROUPS;
+
+ private final SnapshotsExtension SNAPSHOTS;
+
+ private final VolumesExtension VOLUMES;
+
+ private final AggregatesExtension AGGREGATES;
+
+ private final QuotaSetsResource QUOTA_SETS;
+
+ private final HostsExtension HOSTS;
+
+ public Nova(String endpoint, OpenStackClientConnector connector) {
+ super(endpoint, connector);
+ EXTENSIONS = new ExtensionsResource(this);
+ SERVERS = new ServersResource(this);
+ IMAGES = new ImagesResource(this);
+ FLAVORS = new FlavorsResource(this);
+ KEY_PAIRS = new KeyPairsExtension(this);
+ FLOATING_IPS = new FloatingIpsExtension(this);
+ SECURITY_GROUPS = new SecurityGroupsExtension(this);
+ SNAPSHOTS = new SnapshotsExtension(this);
+ VOLUMES = new VolumesExtension(this);
+ AGGREGATES = new AggregatesExtension(this);
+ QUOTA_SETS = new QuotaSetsResource(this);
+ HOSTS = new HostsExtension(this);
+ }
+
+ public Nova(String endpoint) {
+ this(endpoint, null);
+ }
+
+ public ExtensionsResource extensions() {
+ return EXTENSIONS;
+ }
+
+ public ServersResource servers() {
+ return SERVERS;
+ }
+
+ public ImagesResource images() {
+ return IMAGES;
+ }
+
+ public FlavorsResource flavors() {
+ return FLAVORS;
+ }
+
+ public KeyPairsExtension keyPairs() {
+ return KEY_PAIRS;
+ }
+
+ public FloatingIpsExtension floatingIps() {
+ return FLOATING_IPS;
+ }
+
+ public SecurityGroupsExtension securityGroups() {
+ return SECURITY_GROUPS;
+ }
+
+ public SnapshotsExtension snapshots() {
+ return SNAPSHOTS;
+ }
+
+ public VolumesExtension volumes() {
+ return VOLUMES;
+ }
+
+ public AggregatesExtension aggregates() {
+ return AGGREGATES;
+ }
+
+ public QuotaSetsResource quotaSets() {
+ return QUOTA_SETS;
+ }
+
+ public HostsExtension hosts() {
+ return HOSTS;
+ }
+
+}
diff --git a/nova-client/src/main/java/com/woorea/openstack/nova/api/ExtensionsResource.java b/nova-client/src/main/java/com/woorea/openstack/nova/api/ExtensionsResource.java
new file mode 100644
index 0000000..46e16c4
--- /dev/null
+++ b/nova-client/src/main/java/com/woorea/openstack/nova/api/ExtensionsResource.java
@@ -0,0 +1,30 @@
+package com.woorea.openstack.nova.api;
+
+
+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.Extensions;
+
+public class ExtensionsResource {
+
+ private final OpenStackClient CLIENT;
+
+ public ExtensionsResource(OpenStackClient client) {
+ CLIENT = client;
+ }
+
+ public List list(boolean detail) {
+ return new List(detail);
+ }
+
+ public class List extends OpenStackRequest<Extensions> {
+
+ public List(boolean detail) {
+ super(CLIENT, HttpMethod.GET, detail ? "extensions/detail" : "extensions", null, Extensions.class);
+ }
+
+ }
+
+}
+
diff --git a/nova-client/src/main/java/com/woorea/openstack/nova/api/FlavorsResource.java b/nova-client/src/main/java/com/woorea/openstack/nova/api/FlavorsResource.java
new file mode 100644
index 0000000..c3e2256
--- /dev/null
+++ b/nova-client/src/main/java/com/woorea/openstack/nova/api/FlavorsResource.java
@@ -0,0 +1,85 @@
+package com.woorea.openstack.nova.api;
+
+
+import com.woorea.openstack.base.client.Entity;
+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.Flavor;
+import com.woorea.openstack.nova.model.Flavors;
+import com.woorea.openstack.nova.model.Metadata;
+
+public class FlavorsResource {
+
+ private final OpenStackClient CLIENT;
+
+ public FlavorsResource(OpenStackClient client) {
+ CLIENT = client;
+ }
+
+ public List list(boolean detail) {
+ return new List(detail);
+ }
+
+ public Create create(Flavor flavor) {
+ return new Create(flavor);
+ }
+
+ public Show show(String id) {
+ return new Show(id);
+ }
+
+ public ShowMetadata showMetadata(String id) {
+ return new ShowMetadata(id);
+ }
+
+
+ public Delete delete(String id) {
+ return new Delete(id);
+ }
+
+ public class List extends OpenStackRequest<Flavors> {
+
+ public List(boolean detail) {
+ super(CLIENT, HttpMethod.GET, detail ? "/flavors/detail" : "/flavors", null, Flavors.class);
+ }
+
+ }
+
+ public class Create extends OpenStackRequest<Flavor> {
+
+ private Flavor flavor;
+
+ public Create(Flavor flavor) {
+ super(CLIENT, HttpMethod.POST, "/flavors", Entity.json(flavor), Flavor.class);
+ this.flavor = flavor;
+ }
+
+ }
+
+ public class Show extends OpenStackRequest<Flavor> {
+
+ public Show(String id) {
+ super(CLIENT, HttpMethod.GET, new StringBuilder("/flavors/").append(id).toString(), null, Flavor.class);
+ }
+
+ }
+
+ public class ShowMetadata extends OpenStackRequest<Metadata> {
+
+ public ShowMetadata(String id) {
+ super(CLIENT, HttpMethod.GET, new StringBuilder("/flavors/").append(id).append("/metadata").toString(), null, Metadata.class);
+ }
+
+ }
+
+ public class Delete extends OpenStackRequest<Void> {
+
+ public Delete(String id) {
+ super(CLIENT, HttpMethod.DELETE, new StringBuilder("/flavors/").append(id).toString(), null, Void.class);
+ }
+
+ }
+
+}
+
diff --git a/nova-client/src/main/java/com/woorea/openstack/nova/api/ImagesResource.java b/nova-client/src/main/java/com/woorea/openstack/nova/api/ImagesResource.java
new file mode 100644
index 0000000..780cb12
--- /dev/null
+++ b/nova-client/src/main/java/com/woorea/openstack/nova/api/ImagesResource.java
@@ -0,0 +1,85 @@
+package com.woorea.openstack.nova.api;
+
+
+import com.woorea.openstack.base.client.Entity;
+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.Image;
+import com.woorea.openstack.nova.model.Images;
+import com.woorea.openstack.nova.model.Metadata;
+
+public class ImagesResource {
+
+ private final OpenStackClient CLIENT;
+
+ public ImagesResource(OpenStackClient client) {
+ CLIENT = client;
+ }
+
+ public List list(boolean detail) {
+ return new List(detail);
+ }
+
+ public Create create(Image image) {
+ return new Create(image);
+ }
+
+ public Show show(String id) {
+ return new Show(id);
+ }
+
+ public ShowMetadata showMetadata(String id) {
+ return new ShowMetadata(id);
+ }
+
+
+ public Delete delete(String id) {
+ return new Delete(id);
+ }
+
+ public class List extends OpenStackRequest<Images> {
+
+ public List(boolean detail) {
+ super(CLIENT, HttpMethod.GET, detail ? "/images/detail" : "/images", null, Images.class);
+ }
+
+ }
+
+ public class Create extends OpenStackRequest<Image> {
+
+ private Image image;
+
+ public Create(Image image) {
+ super(CLIENT, HttpMethod.POST, "/images", Entity.json(image), Image.class);
+ this.image = image;
+ }
+
+ }
+
+ public class Show extends OpenStackRequest<Image> {
+
+ public Show(String id) {
+ super(CLIENT, HttpMethod.GET, new StringBuilder("/images/").append(id).toString(), null, Image.class);
+ }
+
+ }
+
+ public class ShowMetadata extends OpenStackRequest<Metadata> {
+
+ public ShowMetadata(String id) {
+ super(CLIENT, HttpMethod.GET, new StringBuilder("/images/").append(id).append("/metadata").toString(), null, Metadata.class);
+ }
+
+ }
+
+ public class Delete extends OpenStackRequest<Void> {
+
+ public Delete(String id) {
+ super(CLIENT, HttpMethod.DELETE, new StringBuilder("/images/").append(id).toString(), null, Void.class);
+ }
+
+ }
+
+}
+
diff --git a/nova-client/src/main/java/com/woorea/openstack/nova/api/QuotaSetsResource.java b/nova-client/src/main/java/com/woorea/openstack/nova/api/QuotaSetsResource.java
new file mode 100644
index 0000000..166fb42
--- /dev/null
+++ b/nova-client/src/main/java/com/woorea/openstack/nova/api/QuotaSetsResource.java
@@ -0,0 +1,61 @@
+package com.woorea.openstack.nova.api;
+
+
+import com.woorea.openstack.base.client.Entity;
+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.Limits;
+import com.woorea.openstack.nova.model.QuotaSet;
+import com.woorea.openstack.nova.model.SimpleTenantUsage;
+
+public class QuotaSetsResource {
+
+ private final OpenStackClient CLIENT;
+
+ public QuotaSetsResource(OpenStackClient client) {
+ CLIENT = client;
+ }
+
+ public ShowQuota showQuota(String tenantId) {
+ return new ShowQuota(tenantId);
+ }
+
+ public UpdateQuota updateQuota(String tenantId, QuotaSet quotaSet) {
+ return new UpdateQuota(tenantId, quotaSet);
+ }
+
+ public ShowUsage showUsage(String tenantId) {
+ return new ShowUsage(tenantId);
+ }
+
+ public ShowUsedLimits showUsedLimits() {
+ return new ShowUsedLimits();
+ }
+
+ public class ShowQuota extends OpenStackRequest<QuotaSet> {
+ public ShowQuota(String tenantId) {
+ super(CLIENT, HttpMethod.GET, new StringBuilder("/os-quota-sets/").append(tenantId), null, QuotaSet.class);
+ }
+
+ }
+
+ public class UpdateQuota extends OpenStackRequest<QuotaSet> {
+ public UpdateQuota(String tenantId, QuotaSet quotaSet) {
+ super(CLIENT, HttpMethod.PUT, new StringBuilder("/os-quota-sets/").append(tenantId), Entity.json(quotaSet), QuotaSet.class);
+ }
+ }
+
+ public class ShowUsage extends OpenStackRequest<SimpleTenantUsage> {
+ public ShowUsage(String tenantId) {
+ super(CLIENT, HttpMethod.GET, new StringBuilder("/os-simple-tenant-usage/").append(tenantId), null, SimpleTenantUsage.class);
+ }
+ }
+
+ public class ShowUsedLimits extends OpenStackRequest<Limits> {
+ public ShowUsedLimits() {
+ super(CLIENT, HttpMethod.GET, new StringBuilder("/limits"), null, Limits.class);
+ }
+ }
+}
+
diff --git a/nova-client/src/main/java/com/woorea/openstack/nova/api/ServersResource.java b/nova-client/src/main/java/com/woorea/openstack/nova/api/ServersResource.java
new file mode 100644
index 0000000..ca48b6f
--- /dev/null
+++ b/nova-client/src/main/java/com/woorea/openstack/nova/api/ServersResource.java
@@ -0,0 +1,541 @@
+package com.woorea.openstack.nova.api;
+
+
+import java.util.Map;
+
+import com.woorea.openstack.base.client.Entity;
+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.Metadata;
+import com.woorea.openstack.nova.model.Server;
+import com.woorea.openstack.nova.model.Server.Addresses;
+import com.woorea.openstack.nova.model.ServerAction.ChangePassword;
+import com.woorea.openstack.nova.model.ServerAction.ConfirmResize;
+import com.woorea.openstack.nova.model.ServerAction.ConsoleOutput;
+import com.woorea.openstack.nova.model.ServerAction.CreateBackup;
+import com.woorea.openstack.nova.model.ServerAction.CreateImage;
+import com.woorea.openstack.nova.model.ServerAction.GetConsoleOutput;
+import com.woorea.openstack.nova.model.ServerAction.GetVncConsole;
+import com.woorea.openstack.nova.model.ServerAction.Lock;
+import com.woorea.openstack.nova.model.ServerAction.Pause;
+import com.woorea.openstack.nova.model.ServerAction.Reboot;
+import com.woorea.openstack.nova.model.ServerAction.Rebuild;
+import com.woorea.openstack.nova.model.ServerAction.Rescue;
+import com.woorea.openstack.nova.model.ServerAction.Resize;
+import com.woorea.openstack.nova.model.ServerAction.Resume;
+import com.woorea.openstack.nova.model.ServerAction.RevertResize;
+import com.woorea.openstack.nova.model.ServerAction.Start;
+import com.woorea.openstack.nova.model.ServerAction.Stop;
+import com.woorea.openstack.nova.model.ServerAction.Suspend;
+import com.woorea.openstack.nova.model.ServerAction.Unlock;
+import com.woorea.openstack.nova.model.ServerAction.Unpause;
+import com.woorea.openstack.nova.model.ServerAction.Unrescue;
+import com.woorea.openstack.nova.model.ServerAction.VncConsole;
+import com.woorea.openstack.nova.model.ServerForCreate;
+import com.woorea.openstack.nova.model.Servers;
+import com.woorea.openstack.nova.model.VolumeAttachment;
+import com.woorea.openstack.nova.model.VolumeAttachments;
+
+public class ServersResource {
+
+ private final OpenStackClient CLIENT;
+
+ public ServersResource(OpenStackClient client) {
+ CLIENT = client;
+ }
+
+ public List list(boolean detail) {
+ return new List(detail);
+ }
+
+ public Boot boot(ServerForCreate server) {
+ return new Boot(server);
+ }
+
+ public Show show(String id) {
+ return new Show(id);
+ }
+
+ public ShowMetadata showMetadata(String id) {
+ return new ShowMetadata(id);
+ }
+
+ public CreateOrUpdateMetadata createOrUpdateMetadata(String id,Metadata metadata) {
+ return new CreateOrUpdateMetadata(id,metadata);
+ }
+
+ public ReplaceMetadata replaceMetadata(String id,Metadata metadata) {
+ return new ReplaceMetadata(id,metadata);
+ }
+ public DeleteMetadata deleteMetadata(String id, String key) {
+ return new DeleteMetadata(id,key);
+ }
+
+ public Delete delete(String id) {
+ return new Delete(id);
+ }
+
+ public class List extends OpenStackRequest<Servers> {
+
+ public List(boolean detail) {
+ super(CLIENT, HttpMethod.GET, detail ? "/servers/detail" : "/servers", null, Servers.class);
+ }
+
+ }
+
+ public class Boot extends OpenStackRequest<Server> {
+
+ private ServerForCreate server;
+
+ public Boot(ServerForCreate server) {
+ super(CLIENT, HttpMethod.POST, "/servers", Entity.json(server), Server.class);
+ this.server = server;
+ }
+
+ }
+
+ public class Show extends OpenStackRequest<Server> {
+
+ public Show(String id) {
+ super(CLIENT, HttpMethod.GET, new StringBuilder("/servers/").append(id), null, Server.class);
+ }
+
+ }
+
+ public class ShowMetadata extends OpenStackRequest<Metadata> {
+
+ public ShowMetadata(String id) {
+ super(CLIENT, HttpMethod.GET, new StringBuilder("/servers/").append(id).append("/metadata"), null, Metadata.class);
+ }
+
+ }
+
+ public class CreateOrUpdateMetadata extends OpenStackRequest<Metadata> {
+
+ public CreateOrUpdateMetadata(String id,Metadata metadata) {
+ super(CLIENT, HttpMethod.POST, new StringBuilder("/servers/").append(id).append("/metadata"), Entity.json(metadata), Metadata.class);
+ }
+
+ }
+ public class ReplaceMetadata extends OpenStackRequest<Metadata> {
+
+ public ReplaceMetadata(String id,Metadata metadata) {
+ super(CLIENT, HttpMethod.PUT, new StringBuilder("/servers/").append(id).append("/metadata"), Entity.json(metadata), Metadata.class);
+ }
+
+ }
+
+ public class DeleteMetadata extends OpenStackRequest<Void> {
+
+ public DeleteMetadata(String id,String key) {
+ super(CLIENT, HttpMethod.DELETE, new StringBuilder("/servers/").append(id).append("/metadata/").append(key), null, Void.class);
+ }
+
+ }
+
+
+ public class Delete extends OpenStackRequest<Void> {
+
+ public Delete(String id) {
+ super(CLIENT, HttpMethod.DELETE, new StringBuilder("/servers/").append(id), null, Void.class);
+ }
+
+ }
+
+ public class ShowServerAddresses extends OpenStackRequest<Addresses> {
+
+ public ShowServerAddresses(String id) {
+ super(CLIENT, HttpMethod.GET, new StringBuilder("/servers/").append(id).append("/ips"), null, Addresses.class);
+ }
+
+ }
+
+ public class UpdateServer extends OpenStackRequest<Server> {
+
+ private Server server;
+
+ public UpdateServer(String id, Server server) {
+ super(CLIENT, HttpMethod.PUT, new StringBuilder("/servers/").append(id), Entity.json(server), Server.class);
+ this.server = server;
+ }
+
+ }
+
+ public UpdateServer update(String serverId, String name, String accessIPv4, String accessIPv6) {
+ Server server = new Server();
+ //server.setName(name);
+ //server.setAccessIPv4(accessIPv4);
+ //server.setAccessIPv6(accessIPv6);
+ return new UpdateServer(serverId, server);
+ }
+
+ public abstract class Action<T> extends OpenStackRequest<T> {
+
+ public Action(String id, Entity<?> entity, Class<T> returnType) {
+ super(CLIENT, HttpMethod.POST, new StringBuilder("/servers/").append(id).append("/action"), entity, returnType);
+ }
+
+ }
+
+ public class ChangePasswordAction extends Action<Server> {
+
+ private ChangePassword action;
+
+ public ChangePasswordAction(String id, ChangePassword action) {
+ super(id, Entity.json(action), Server.class);
+ }
+
+ }
+
+ public ChangePasswordAction changePassword(String serverId, String adminPass) {
+ ChangePassword changePassword = new ChangePassword();
+ changePassword.setAdminPass(adminPass);
+ return new ChangePasswordAction(serverId, changePassword);
+ }
+
+ public class RebootAction extends Action<Void> {
+
+ private Reboot action;
+
+ public RebootAction(String id, Reboot action) {
+ super(id, Entity.json(action), Void.class);
+ }
+
+ }
+
+ public RebootAction reboot(String serverId, String rebootType) {
+ Reboot reboot = new Reboot();
+ reboot.setType(rebootType);
+ return new RebootAction(serverId, reboot);
+ }
+
+ public class RebuildAction extends Action<Server> {
+
+ private Rebuild action;
+
+ public RebuildAction(String id, Rebuild action) {
+ super(id, Entity.json(action), Server.class);
+ }
+
+ }
+
+ public RebuildAction rebuild(String serverId, Rebuild rebuild) {
+ return new RebuildAction(serverId, rebuild);
+ }
+
+ public class ResizeAction extends Action<Server> {
+
+ private Resize action;
+
+ public ResizeAction(String id, Resize action) {
+ super(id, Entity.json(action), Server.class);
+ }
+
+ }
+
+ public ResizeAction resize(String serverId, String flavorId, String diskConfig) {
+ Resize resize = new Resize();
+ resize.setFlavorRef(flavorId);
+ resize.setDiskConfig(diskConfig);
+ return new ResizeAction(serverId, resize);
+ }
+
+ public class ConfirmResizeAction extends Action<Server> {
+
+ public ConfirmResizeAction(String id) {
+ super(id, Entity.json(new ConfirmResize()), Server.class);
+ }
+
+ }
+
+ public ConfirmResizeAction confirmResize(String serverId) {
+ return new ConfirmResizeAction(serverId);
+ }
+
+ public class RevertResizeAction extends Action<Server> {
+
+ public RevertResizeAction(String id) {
+ super(id, Entity.json(new RevertResize()), Server.class);
+ }
+
+ }
+
+ public RevertResizeAction revertResize(String serverId) {
+ return new RevertResizeAction(serverId);
+ }
+
+ public class CreateImageAction extends Action<Void> {
+
+ public CreateImageAction(String id, CreateImage createImage) {
+ super(id, Entity.json(createImage), Void.class);
+ }
+
+ }
+
+ public CreateImageAction createImage(String serverId, String name, Map<String, String> metadata) {
+ CreateImage createImage = new CreateImage();
+ createImage.setName(name);
+ createImage.setMetadata(metadata);
+ return new CreateImageAction(serverId, createImage);
+ }
+
+ public class StartServer extends OpenStackRequest<Void> {
+
+ private Start action;
+
+ private String id;
+
+ public StartServer(String id) {
+ super(CLIENT, HttpMethod.POST, new StringBuilder("/servers/").append(id).append("/action"), Entity.json(new Start()), Void.class);
+ }
+
+ }
+
+ public class StopServer extends OpenStackRequest<Void> {
+
+ private Stop action;
+
+ private String id;
+
+ public StopServer(String id) {
+ super(CLIENT, HttpMethod.POST, new StringBuilder("/servers/").append(id).append("/action"), Entity.json(new Stop()), Void.class);
+ }
+
+ }
+
+ public StartServer start(String id) {
+ return new StartServer(id);
+ }
+
+ public StopServer stop(String id) {
+ return new StopServer(id);
+ }
+
+ public class GetVncConsoleServer extends OpenStackRequest<VncConsole> {
+
+ private GetVncConsole action;
+
+ private String id;
+
+ public GetVncConsoleServer(String id, GetVncConsole action) {
+ super(CLIENT, HttpMethod.POST, new StringBuilder("/servers/").append(id).append("/action"), Entity.json(action), VncConsole.class);
+ }
+
+ }
+
+ public GetVncConsoleServer getVncConsole(String id, String type) {
+ GetVncConsole action = new GetVncConsole(type);
+ return new GetVncConsoleServer(id, action);
+ }
+
+ public class GetConsoleOutputServer extends OpenStackRequest<ConsoleOutput> {
+
+ public GetConsoleOutputServer(String id, GetConsoleOutput action) {
+ super(CLIENT, HttpMethod.POST, new StringBuilder("/servers/").append(id).append("/action"), Entity.json(action), ConsoleOutput.class);
+ }
+
+ }
+
+ public GetConsoleOutputServer getConsoleOutput(String id, int length) {
+ GetConsoleOutput action = new GetConsoleOutput(length);
+ return new GetConsoleOutputServer(id, action);
+ }
+
+ public class PauseServer extends OpenStackRequest<Void> {
+
+ public PauseServer(String id) {
+ super(CLIENT, HttpMethod.POST, new StringBuilder("/servers/").append(id).append("/action"), Entity.json(new Pause()), Void.class);
+ }
+
+ }
+
+ public class UnpauseServer extends OpenStackRequest<Void> {
+
+ public UnpauseServer(String id) {
+ super(CLIENT, HttpMethod.POST, new StringBuilder("/servers/").append(id).append("/action"), Entity.json(new Unpause()), Void.class);
+ }
+
+
+ }
+
+ public class LockServer extends OpenStackRequest<Void> {
+
+ private Lock action;
+
+ private String id;
+
+ public LockServer(String id) {
+ super(CLIENT, HttpMethod.POST, new StringBuilder("/servers/").append(id).append("/action"), Entity.json(new Lock()), Void.class);
+ }
+
+ }
+
+ public class UnlockServer extends OpenStackRequest<Void> {
+
+ private Unlock action;
+
+ private String id;
+
+ public UnlockServer(String id) {
+ super(CLIENT, HttpMethod.POST, new StringBuilder("/servers/").append(id).append("/action"), Entity.json(new Unlock()), Void.class);
+ }
+
+ }
+
+ public class SuspendServer extends OpenStackRequest<Void> {
+
+ public SuspendServer(String id) {
+ super(CLIENT, HttpMethod.POST, new StringBuilder("/servers/").append(id).append("/action"), Entity.json(new Suspend()), Void.class);
+ }
+
+ }
+
+ public class ResumeServer extends OpenStackRequest<Void> {
+
+ public ResumeServer(String id) {
+ super(CLIENT, HttpMethod.POST, new StringBuilder("/servers/").append(id).append("/action"), Entity.json(new Resume()), Void.class);
+ }
+
+ }
+
+ public class CreateBackupServer extends OpenStackRequest<Void> {
+
+ public CreateBackupServer(String id, CreateBackup action) {
+ super(CLIENT, HttpMethod.POST, new StringBuilder("/servers/").append(id).append("/action"), Entity.json(action), Void.class);
+ }
+
+ }
+
+ public PauseServer pause(String serverId) {
+ return new PauseServer(serverId);
+ }
+
+ public UnpauseServer unpause(String serverId) {
+ return new UnpauseServer(serverId);
+ }
+
+ public LockServer lock(String serverId) {
+ return new LockServer(serverId);
+ }
+
+ public UnlockServer unlock(String serverId) {
+ return new UnlockServer(serverId);
+ }
+
+ public SuspendServer suspend(String serverId) {
+ return new SuspendServer(serverId);
+ }
+
+ public ResumeServer resume(String serverId) {
+ return new ResumeServer(serverId);
+ }
+
+ public CreateBackupServer createBackup(String serverId, CreateBackup action) {
+ return new CreateBackupServer(serverId, action);
+ }
+
+ public class RescueServer extends OpenStackRequest<Void> {
+
+ public RescueServer(String id, Rescue action) {
+ super(CLIENT, HttpMethod.POST, new StringBuilder("/servers/").append(id).append("/action"), Entity.json(action), Void.class);
+ }
+
+ }
+
+ public class UnrescueServer extends OpenStackRequest<Void> {
+
+ public UnrescueServer(String id) {
+ super(CLIENT, HttpMethod.POST, new StringBuilder("/servers/").append(id).append("/action"), Entity.json(new Unrescue()), Void.class);
+ }
+
+ }
+
+ public RescueServer rescue(String serverId, String adminPass) {
+ Rescue action = new Rescue(adminPass);
+ return new RescueServer(serverId, action);
+ }
+
+ public UnrescueServer unrescue(String serverId) {
+ return new UnrescueServer(serverId);
+ }
+
+ public class AssociateFloatingIp extends OpenStackRequest<Void> {
+
+ public AssociateFloatingIp(String id, com.woorea.openstack.nova.model.ServerAction.AssociateFloatingIp action) {
+ super(CLIENT, HttpMethod.POST, new StringBuilder("/servers/").append(id).append("/action"), Entity.json(action), Void.class);
+ }
+
+ }
+
+ public class DisassociateFloatingIp extends OpenStackRequest<Void> {
+
+ public DisassociateFloatingIp(String id, com.woorea.openstack.nova.model.ServerAction.DisassociateFloatingIp action) {
+ super(CLIENT, HttpMethod.POST, new StringBuilder("/servers/").append(id).append("/action"), Entity.json(action), Void.class);
+ }
+
+ }
+
+ public AssociateFloatingIp associateFloatingIp(String serverId, String floatingIpAddress) {
+ com.woorea.openstack.nova.model.ServerAction.AssociateFloatingIp action = new com.woorea.openstack.nova.model.ServerAction.AssociateFloatingIp(floatingIpAddress);
+ return new AssociateFloatingIp(serverId, action);
+ }
+
+ public DisassociateFloatingIp disassociateFloatingIp(String serverId, String floatingIpAddress) {
+ com.woorea.openstack.nova.model.ServerAction.DisassociateFloatingIp action = new com.woorea.openstack.nova.model.ServerAction.DisassociateFloatingIp(floatingIpAddress);
+ return new DisassociateFloatingIp(serverId, action);
+ }
+
+ public class AttachVolume extends OpenStackRequest<Void> {
+
+ public AttachVolume(String serverId, final VolumeAttachment volumeAttachment) {
+ super(CLIENT, HttpMethod.POST, new StringBuilder("/servers/").append(serverId).append("/os-volume_attachments"), Entity.json(volumeAttachment), Void.class);
+ }
+
+ }
+
+ public class DetachVolume extends OpenStackRequest<Void> {
+
+ public DetachVolume(String serverId, String volumeId) {
+ super(CLIENT, HttpMethod.DELETE, new StringBuilder("/servers/").append(serverId).append("/os-volume_attachments/").append(volumeId), null, Void.class);
+ }
+
+ }
+
+ public class ListVolumeAttachments extends OpenStackRequest<VolumeAttachments> {
+
+ public ListVolumeAttachments(String serverId) {
+ super(CLIENT, HttpMethod.GET, new StringBuilder("/servers/").append(serverId).append("/os-volume_attachments"), null, VolumeAttachments.class);
+ }
+
+ }
+
+ public class ShowVolumeAttachment extends OpenStackRequest<VolumeAttachment> {
+
+ public ShowVolumeAttachment(String serverId, String volumeAttachmentId) {
+ super(CLIENT, HttpMethod.GET, new StringBuilder("/servers/").append(serverId).append("/os-volume_attachments/").append(volumeAttachmentId), null, VolumeAttachment.class);
+ }
+
+ }
+
+ public AttachVolume attachVolume(String serverId, String volumeId, String device) {
+ VolumeAttachment volumeAttachment = new VolumeAttachment();
+ volumeAttachment.setVolumeId(volumeId);
+ volumeAttachment.setDevice(device);
+ return new AttachVolume(serverId, volumeAttachment);
+ }
+
+ public DetachVolume detachVolume(String serverId, String volumeId) {
+ return new DetachVolume(serverId, volumeId);
+ }
+
+ public ListVolumeAttachments listVolumeAttachments(String serverId) {
+ return new ListVolumeAttachments(serverId);
+ }
+
+ public ShowVolumeAttachment showVolumeAttachment(String serverId, String volumeAttachmentId) {
+ return new ShowVolumeAttachment(serverId, volumeAttachmentId);
+ }
+
+}
+
diff --git a/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/AggregatesExtension.java b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/AggregatesExtension.java
new file mode 100644
index 0000000..fa757af
--- /dev/null
+++ b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/AggregatesExtension.java
@@ -0,0 +1,163 @@
+package com.woorea.openstack.nova.api.extensions;
+
+import java.util.Map;
+
+
+import com.woorea.openstack.base.client.Entity;
+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.HostAggregate;
+import com.woorea.openstack.nova.model.HostAggregates;
+
+public class AggregatesExtension {
+
+ private final OpenStackClient CLIENT;
+
+ public AggregatesExtension(OpenStackClient client) {
+ CLIENT = client;
+ }
+
+ public List list() {
+ return new List();
+ }
+
+ public ShowAggregate showAggregate(String id) {
+ return new ShowAggregate(id);
+ }
+
+ public UpdateAggregateMetadata updateAggregateMetadata(String id,
+ String name, String availabilityZone) {
+ return new UpdateAggregateMetadata(id, name, availabilityZone);
+ }
+
+ public CreateAggregate createAggregate(String aggregateName,
+ String availabilityZoneName) {
+ return new CreateAggregate(aggregateName, availabilityZoneName);
+ }
+
+ public DeleteAggregate deleteAggregate(String id) {
+ return new DeleteAggregate(id);
+ }
+
+ public AddHost addHost(String aggregateId, String hostId) {
+ return new AddHost(aggregateId, hostId);
+ }
+
+ public RemoveHost removeHost(String aggregateId, String hostId) {
+ return new RemoveHost(hostId, aggregateId);
+ }
+
+ public SetMetadata setMetadata(String aggregateId,
+ String key, String value) {
+ return new SetMetadata(aggregateId, key, value);
+ }
+
+ public class List extends OpenStackRequest<HostAggregates> {
+
+ public List() {
+ super(CLIENT, HttpMethod.GET, "/os-aggregates",
+ null,
+ HostAggregates.class);
+ }
+
+ }
+
+ public class ShowAggregate extends OpenStackRequest<HostAggregate> {
+
+ public ShowAggregate(String id) {
+ super(CLIENT, HttpMethod.GET,
+ new StringBuffer("/os-aggregates/").append(id),
+ null,
+ HostAggregate.class);
+ }
+
+ }
+
+ public class UpdateAggregateMetadata extends OpenStackRequest<HostAggregate> {
+ public UpdateAggregateMetadata(String id,
+ String name, String availabilityZone) {
+ super(CLIENT, HttpMethod.PUT,
+ new StringBuffer("/os-aggregates/").append(id),
+ availabilityZone == null ?
+ Entity.json("{\"aggregate\": {\"name\": \"" + name + "\" }}")
+ :
+ Entity.json("{\"aggregate\": {\"name\": \"" +
+ name +
+ "\", \"availability_zone\": \"" +
+ availabilityZone +
+ "\" }}"),
+ HostAggregate.class);
+ }
+
+ }
+
+ public class CreateAggregate extends OpenStackRequest<HostAggregate> {
+
+ public CreateAggregate(String name, String availabilityZone) {
+ super(CLIENT, HttpMethod.POST,
+ new StringBuffer("/os-aggregates"),
+ availabilityZone == null ?
+ Entity.json("{\"aggregate\": {\"name\": \"" +
+ name +
+ "\", \"availability_zone\": null }}")
+ :
+ Entity.json("{\"aggregate\": {\"name\": \"" +
+ name +
+ "\", \"availability_zone\": \"" +
+ availabilityZone +
+ "\" }}"),
+ HostAggregate.class);
+ }
+
+ }
+
+ public class DeleteAggregate extends OpenStackRequest<Void> {
+
+ public DeleteAggregate(String id) {
+ super(CLIENT, HttpMethod.DELETE,
+ new StringBuffer("/os-aggregates/").append(id),
+ null,
+ null);
+ }
+ }
+
+ public class AddHost extends OpenStackRequest<HostAggregate> {
+
+ public AddHost(String aggregateId, String hostId) {
+ super(CLIENT, HttpMethod.POST,
+ new StringBuffer("/os-aggregates/")
+ .append(aggregateId).append("/action"),
+ Entity.json("{\"add_host\": {\"host\": \"" +
+ hostId + "\" }}"),
+ HostAggregate.class);
+ }
+
+ }
+
+ public class RemoveHost extends OpenStackRequest<HostAggregate> {
+
+ public RemoveHost(String hostId, String aggregateId) {
+ super(CLIENT, HttpMethod.POST,
+ new StringBuffer("/os-aggregates/")
+ .append(aggregateId).append("/action"),
+ Entity.json("{\"remove_host\": {\"host\": \"" +
+ hostId + "\" }}"),
+ HostAggregate.class);
+ }
+
+ }
+
+ public class SetMetadata extends OpenStackRequest<HostAggregate> {
+
+ public SetMetadata(String aggregateId, String key, String value) {
+ super(CLIENT, HttpMethod.POST,
+ new StringBuffer("/os-aggregates/")
+ .append(aggregateId).append("/action"),
+ Entity.json("{\"set_metadata\": {\"metadata\": { \"" +
+ key + "\": \"" + value + "\" }}}"),
+ HostAggregate.class);
+ }
+ }
+}
+
diff --git a/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/CloudpipesExtension.java b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/CloudpipesExtension.java
new file mode 100644
index 0000000..90450c8
--- /dev/null
+++ b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/CloudpipesExtension.java
@@ -0,0 +1,49 @@
+package com.woorea.openstack.nova.api.extensions;
+
+
+import com.woorea.openstack.base.client.Entity;
+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.Cloudpipe;
+import com.woorea.openstack.nova.model.Cloudpipes;
+
+public class CloudpipesExtension {
+
+ private final OpenStackClient CLIENT;
+
+ public CloudpipesExtension(OpenStackClient client) {
+ CLIENT = client;
+ }
+
+ public List list() {
+ return new List();
+ }
+
+ public Create create(Cloudpipe cloudpipe) {
+ return new Create(cloudpipe);
+ }
+
+ public class List extends OpenStackRequest<Cloudpipes> {
+
+
+ public List() {
+ super(CLIENT, HttpMethod.GET, "/os-cloudpipes", null, Cloudpipes.class);
+ }
+
+ }
+
+ public class Create extends OpenStackRequest<Cloudpipe> {
+
+ private Cloudpipe cloudpipe;
+
+ public Create(Cloudpipe cloudpipe) {
+ super(CLIENT, HttpMethod.POST, "/os-cloudpipes", Entity.json(cloudpipe), Cloudpipe.class);
+ this.cloudpipe = cloudpipe;
+ }
+
+ }
+
+
+
+}
diff --git a/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/CredentialsExtension.java b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/CredentialsExtension.java
new file mode 100644
index 0000000..b689fd6
--- /dev/null
+++ b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/CredentialsExtension.java
@@ -0,0 +1,43 @@
+package com.woorea.openstack.nova.api.extensions;
+
+
+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.Certificate;
+
+public class CredentialsExtension {
+
+ private final OpenStackClient CLIENT;
+
+ public CredentialsExtension(OpenStackClient client) {
+ CLIENT = client;
+ }
+
+ public Create createCertificate(String id) {
+ return new Create(id);
+ }
+
+ public Show showCertificate(String id) {
+ return new Show();
+ }
+
+ public class Create extends OpenStackRequest<Certificate> {
+
+ public Create(String id) {
+ super(CLIENT, HttpMethod.GET, new StringBuffer("/os-certificates").append(id).toString(), null, Certificate.class);
+ }
+
+ }
+
+ public class Show extends OpenStackRequest<Certificate> {
+
+ public Show() {
+ super(CLIENT, HttpMethod.GET, "/os-certificates", null, Certificate.class);
+ }
+
+ }
+
+
+
+}
diff --git a/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/FloatingIpDnsExtension.java b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/FloatingIpDnsExtension.java
new file mode 100644
index 0000000..e2a399a
--- /dev/null
+++ b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/FloatingIpDnsExtension.java
@@ -0,0 +1,89 @@
+package com.woorea.openstack.nova.api.extensions;
+
+
+import com.woorea.openstack.base.client.Entity;
+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.FloatingIpDomain;
+import com.woorea.openstack.nova.model.FloatingIpDomains;
+
+public class FloatingIpDnsExtension {
+
+ private final OpenStackClient CLIENT;
+
+ public FloatingIpDnsExtension(OpenStackClient client) {
+ CLIENT = client;
+ }
+
+ public ListDomains listFloatingIpDomains() {
+ return new ListDomains();
+ }
+
+ public CreateDomain create(FloatingIpDomain floatingIpDomain) {
+ return new CreateDomain(floatingIpDomain);
+ }
+
+ public ShowDomain show(String id) {
+ return new ShowDomain(id);
+ }
+
+ public UpdateDomain update(FloatingIpDomain floatingIpDomain) {
+ return new UpdateDomain(floatingIpDomain);
+ }
+
+ public DeleteDomain delete(String id) {
+ return new DeleteDomain(id);
+ }
+
+ public class ListDomains extends OpenStackRequest<FloatingIpDomains> {
+
+ public ListDomains() {
+ super(CLIENT, HttpMethod.GET, "/os-floating-ip-dns", null, FloatingIpDomains.class);
+ }
+
+ }
+
+ public class CreateDomain extends OpenStackRequest<FloatingIpDomain> {
+
+ private FloatingIpDomain floatingIpDomain;
+
+ public CreateDomain(FloatingIpDomain floatingIpDomain) {
+ super(CLIENT, HttpMethod.POST, "/os-floating-ip-dns", Entity.json(floatingIpDomain), FloatingIpDomain.class);
+ this.floatingIpDomain = floatingIpDomain;
+ }
+
+ }
+
+ public class ShowDomain extends OpenStackRequest<FloatingIpDomain> {
+
+ public ShowDomain(String id) {
+ super(CLIENT, HttpMethod.GET, new StringBuffer("/os-floating-ip-dns/").append(id).toString(), null, FloatingIpDomain.class);
+ }
+
+ }
+
+
+ public static class UpdateDomain extends OpenStackRequest<FloatingIpDomain> {
+
+ private FloatingIpDomain floatingIpDomain;
+
+ public UpdateDomain(FloatingIpDomain floatingIpDomain) {
+ //super(CLIENT, HttpMethod.PUT, new StringBuffer("/os-floating-ip-dns/").append(id).toString(), Entity.json(floatingIpDomain), FloatingIpDomain.class);
+ this.floatingIpDomain = floatingIpDomain;
+ }
+
+ }
+
+
+ public class DeleteDomain extends OpenStackRequest<Void> {
+
+ public DeleteDomain(String id) {
+ super(CLIENT, HttpMethod.DELETE, new StringBuffer("/os-floating-ip-dns/").append(id).toString(), null, Void.class);
+ }
+
+ }
+
+
+
+}
diff --git a/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/FloatingIpPoolsExtension.java b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/FloatingIpPoolsExtension.java
new file mode 100644
index 0000000..cfcba23
--- /dev/null
+++ b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/FloatingIpPoolsExtension.java
@@ -0,0 +1,31 @@
+package com.woorea.openstack.nova.api.extensions;
+
+
+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.FloatingIpPools;
+
+public class FloatingIpPoolsExtension {
+
+ private final OpenStackClient CLIENT;
+
+ public FloatingIpPoolsExtension(OpenStackClient client) {
+ CLIENT = client;
+ }
+
+ public List list() {
+ return new List();
+ }
+
+ public class List extends OpenStackRequest<FloatingIpPools> {
+
+ public List() {
+ super(CLIENT, HttpMethod.GET, "/os-floating-ip-pools", null, FloatingIpPools.class);
+ }
+
+ }
+
+
+
+}
diff --git a/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/FloatingIpsExtension.java b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/FloatingIpsExtension.java
new file mode 100644
index 0000000..0923b7e
--- /dev/null
+++ b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/FloatingIpsExtension.java
@@ -0,0 +1,67 @@
+package com.woorea.openstack.nova.api.extensions;
+
+import java.util.HashMap;
+import java.util.Map;
+
+
+import com.woorea.openstack.base.client.Entity;
+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.FloatingIp;
+import com.woorea.openstack.nova.model.FloatingIps;
+
+public class FloatingIpsExtension {
+
+ private final OpenStackClient CLIENT;
+
+ public FloatingIpsExtension(OpenStackClient client) {
+ CLIENT = client;
+ }
+
+ public class List extends OpenStackRequest<FloatingIps> {
+
+ public List() {
+ super(CLIENT, HttpMethod.GET, "/os-floating-ips", null, FloatingIps.class);
+ }
+
+ }
+
+ public class Allocate extends OpenStackRequest<FloatingIp> {
+
+ public Allocate(Entity<?> entity) {
+ super(CLIENT, HttpMethod.POST, "/os-floating-ips", entity, FloatingIp.class);
+ }
+
+ }
+
+ public class Deallocate extends OpenStackRequest<Void> {
+
+ public Deallocate(String id) {
+ super(CLIENT, HttpMethod.DELETE, new StringBuffer("/os-floating-ips/").append(id).toString(), null, Void.class);
+ }
+
+ }
+
+ public List list() {
+ return new List();
+ }
+
+ public Allocate allocate(String pool) {
+ Entity<?> entity=null;
+ if(pool!=null) {
+ Map<String, String> body = new HashMap<String, String>();
+ body.put("pool", pool);
+ entity=Entity.json(body);
+ }
+ return new Allocate(entity);
+ }
+
+ public Deallocate deallocate(String id) {
+ return new Deallocate(id);
+ }
+
+
+
+}
+
diff --git a/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/HostsExtension.java b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/HostsExtension.java
new file mode 100644
index 0000000..9a4814d
--- /dev/null
+++ b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/HostsExtension.java
@@ -0,0 +1,44 @@
+package com.woorea.openstack.nova.api.extensions;
+
+
+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.Host;
+import com.woorea.openstack.nova.model.Hosts;
+
+public class HostsExtension {
+
+ private final OpenStackClient CLIENT;
+
+ public HostsExtension(OpenStackClient client) {
+ CLIENT = client;
+ }
+
+ public List list() {
+ return new List();
+ }
+
+ public Show show(String id) {
+ return new Show(id);
+ }
+
+ public class List extends OpenStackRequest<Hosts> {
+
+ public List() {
+ super(CLIENT, HttpMethod.GET, "/os-hosts", null, Hosts.class);
+ }
+
+ }
+
+ public class Show extends OpenStackRequest<Host> {
+
+ public Show(String id) {
+ super(CLIENT, HttpMethod.GET, new StringBuffer("/os-hosts/").append(id).toString(), null, Host.class);
+ }
+
+ }
+
+
+
+}
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
new file mode 100644
index 0000000..ed1ad10
--- /dev/null
+++ b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/HypervisorsExtension.java
@@ -0,0 +1,5 @@
+package com.woorea.openstack.nova.api.extensions;
+
+public class HypervisorsExtension {
+
+}
diff --git a/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/KeyPairsExtension.java b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/KeyPairsExtension.java
new file mode 100644
index 0000000..5e2c555
--- /dev/null
+++ b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/KeyPairsExtension.java
@@ -0,0 +1,65 @@
+package com.woorea.openstack.nova.api.extensions;
+
+
+import com.woorea.openstack.base.client.Entity;
+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.KeyPair;
+import com.woorea.openstack.nova.model.KeyPairs;
+
+public class KeyPairsExtension {
+
+ private final OpenStackClient CLIENT;
+
+ public KeyPairsExtension(OpenStackClient client) {
+ CLIENT = client;
+ }
+
+ public List list() {
+ return new List();
+ }
+
+ public Create create(String name, String publicKey) {
+ KeyPair keyPairForCreate = new KeyPair(name, publicKey);
+ return new Create(keyPairForCreate);
+ }
+
+ public Create create(String name) {
+ return create(name, null);
+ }
+
+ public Delete delete(String name) {
+ return new Delete(name);
+ }
+
+ public class Create extends OpenStackRequest<KeyPair> {
+
+ private KeyPair keyPairForCreate;
+
+ public Create(KeyPair keyPairForCreate) {
+ super(CLIENT, HttpMethod.POST, "/os-keypairs", Entity.json(keyPairForCreate), KeyPair.class);
+ this.keyPairForCreate = keyPairForCreate;
+ }
+
+ }
+
+ public class Delete extends OpenStackRequest<Void> {
+
+ private String name;
+
+ public Delete(String name) {
+ super(CLIENT, HttpMethod.DELETE, new StringBuilder("/os-keypairs/").append(name).toString(), null, Void.class);
+ }
+
+ }
+
+ public class List extends OpenStackRequest<KeyPairs> {
+
+ public List() {
+ super(CLIENT, HttpMethod.GET, "/os-keypairs", null, KeyPairs.class);
+ }
+
+ }
+
+}
diff --git a/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/NetworksExtension.java b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/NetworksExtension.java
new file mode 100644
index 0000000..ad316e0
--- /dev/null
+++ b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/NetworksExtension.java
@@ -0,0 +1,82 @@
+package com.woorea.openstack.nova.api.extensions;
+
+
+import com.woorea.openstack.base.client.Entity;
+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.Network;
+import com.woorea.openstack.nova.model.Networks;
+
+public class NetworksExtension {
+
+ private final OpenStackClient CLIENT;
+
+ public NetworksExtension(OpenStackClient client) {
+ CLIENT = client;
+ }
+
+ public List list() {
+ return new List();
+ }
+
+ public Show show(String id) {
+ return new Show(id);
+ }
+
+ public Delete delete(String id) {
+ return new Delete(id);
+ }
+
+ public Disassociate disassociate(String id) {
+ return new Disassociate(id);
+ }
+
+ public class List extends OpenStackRequest<Networks> {
+
+
+ public List() {
+ super(CLIENT, HttpMethod.GET, "/os-networks", null, Networks.class);
+ }
+
+ }
+
+ public class Create extends OpenStackRequest<Network> {
+
+ private Network network;
+
+ public Create(Network network) {
+ super(CLIENT, HttpMethod.POST, "/os-networks", Entity.json(network), Network.class);
+ this.network = network;
+ }
+
+ }
+
+ public class Show extends OpenStackRequest<Network> {
+
+ public Show(String id) {
+ super(CLIENT, HttpMethod.GET, new StringBuilder("/os-networks/").append(id).toString(), null, Network.class);
+ }
+
+ }
+
+ public class Disassociate extends OpenStackRequest<Void> {
+
+ public Disassociate(String id) {
+ super(CLIENT, HttpMethod.POST, new StringBuilder("/os-networks/").append(id).toString(), Entity.json("{\"action\":\"disassociate\"}"), Void.class);
+ ;
+ }
+
+ }
+
+ public class Delete extends OpenStackRequest<Void> {
+
+ public Delete(String id) {
+ super(CLIENT, HttpMethod.DELETE, new StringBuilder("/os-networks/").append(id).toString(), null, Void.class);
+ }
+
+ }
+
+
+
+}
diff --git a/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/SecurityGroupsExtension.java b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/SecurityGroupsExtension.java
new file mode 100644
index 0000000..5a80a10
--- /dev/null
+++ b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/SecurityGroupsExtension.java
@@ -0,0 +1,184 @@
+package com.woorea.openstack.nova.api.extensions;
+
+
+import com.woorea.openstack.base.client.Entity;
+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.SecurityGroup;
+import com.woorea.openstack.nova.model.SecurityGroupForCreate;
+import com.woorea.openstack.nova.model.SecurityGroupRuleForCreate;
+import com.woorea.openstack.nova.model.SecurityGroups;
+
+public class SecurityGroupsExtension {
+
+ private final OpenStackClient CLIENT;
+
+ public SecurityGroupsExtension(OpenStackClient client) {
+ CLIENT = client;
+ }
+
+ public class List extends OpenStackRequest<SecurityGroups> {
+
+ public List() {
+ super(CLIENT, HttpMethod.GET, "/os-security-groups", null, SecurityGroups.class);
+ }
+
+ }
+
+ public class Create extends OpenStackRequest<SecurityGroup> {
+
+ private SecurityGroupForCreate securityGroupForCreate;
+
+ public Create(SecurityGroupForCreate securityGroupForCreate) {
+ super(CLIENT, HttpMethod.POST, "/os-security-groups", Entity.json(securityGroupForCreate), SecurityGroup.class);
+ this.securityGroupForCreate = securityGroupForCreate;
+ }
+
+ }
+
+ public class Show extends OpenStackRequest<SecurityGroup> {
+
+ /**
+ * @deprecated
+ * @param id
+ */
+ public Show(Integer id) {
+ super(CLIENT, HttpMethod.GET, new StringBuilder("/os-security-groups/").append(id).toString(), null, SecurityGroup.class);
+ }
+ public Show(String id) {
+ super(CLIENT, HttpMethod.GET, new StringBuilder("/os-security-groups/").append(id).toString(), null, SecurityGroup.class);
+ }
+
+ }
+
+ public class Delete extends OpenStackRequest<Void> {
+
+ /**
+ *
+ * @param id
+ * @deprecated
+ */
+ public Delete(Integer id) {
+ super(CLIENT, HttpMethod.DELETE, new StringBuilder("/os-security-groups/").append(String.valueOf(id)).toString(), null, Void.class);
+ }
+ public Delete(String id) {
+ super(CLIENT, HttpMethod.DELETE, new StringBuilder("/os-security-groups/").append(id).toString(), null, Void.class);
+ }
+
+ }
+
+ public class CreateRule extends OpenStackRequest<SecurityGroup.Rule> {
+
+ private SecurityGroupRuleForCreate securityGroupRuleForCreate;
+
+ public CreateRule(SecurityGroupRuleForCreate securityGroupRuleForCreate) {
+ super(CLIENT, HttpMethod.POST, "/os-security-group-rules", Entity.json(securityGroupRuleForCreate), SecurityGroup.Rule.class);
+ this.securityGroupRuleForCreate = securityGroupRuleForCreate;
+ }
+ }
+
+ public class DeleteRule extends OpenStackRequest<Void> {
+
+ /**
+ *
+ * @param id
+ * @deprecated
+ */
+ public DeleteRule(Integer id) {
+ super(CLIENT, HttpMethod.DELETE, new StringBuilder("/os-security-group-rules/").append(String.valueOf(id)).toString(), null, Void.class);
+ }
+
+ public DeleteRule(String id) {
+ super(CLIENT, HttpMethod.DELETE, new StringBuilder("/os-security-group-rules/").append(String.valueOf(id)).toString(), null, Void.class);
+ }
+ }
+
+ public List listSecurityGroups() {
+ return new List();
+ }
+
+ public Create createSecurityGroup(String name,
+ String description) {
+ return new Create(new SecurityGroupForCreate(name, description));
+ }
+
+ public Create createSecurityGroup(String name) {
+ return createSecurityGroup(name, null);
+ }
+
+ public Show showSecurityGroup(Integer id) {
+ return new Show(String.valueOf(id));
+ }
+
+ public Show showSecurityGroup(String id) {
+ return new Show(id);
+ }
+ public Delete deleteSecurityGroup(Integer id) {
+ return new Delete(String.valueOf(id));
+ }
+
+ public Delete deleteSecurityGroup(String id) {
+ return new Delete(id);
+ }
+
+ /**
+ *
+ * @param parentSecurityGroupId
+ * @param ipProtocol
+ * @param fromPort
+ * @param toPort
+ * @param cidr
+ * @return
+ * @deprecated Use {@link #createSecurityGroupRule(String, String, Integer, Integer, String)}
+ */
+ public CreateRule createSecurityGroupRule(
+ Integer parentSecurityGroupId, String ipProtocol, Integer fromPort,
+ Integer toPort, String cidr) {
+ SecurityGroupRuleForCreate securityGroupRuleForCreate = new SecurityGroupRuleForCreate(
+ parentSecurityGroupId, ipProtocol, fromPort, toPort, cidr);
+ return new CreateRule(securityGroupRuleForCreate);
+ }
+ /**
+ *
+ * @param parentSecurityGroupId
+ * @param ipProtocol
+ * @param fromPort
+ * @param toPort
+ * @param cidr
+ * @return
+ * @deprecated Use {@link #createSecurityGroupRule(String, String, String, Integer, Integer)}
+ */
+ public CreateRule createSecurityGroupRule(
+ Integer parentSecurityGroupId, String ipProtocol, Integer fromPort,
+ Integer toPort, Integer sourceGroupId) {
+ SecurityGroupRuleForCreate securityGroupRuleForCreate = new SecurityGroupRuleForCreate(
+ parentSecurityGroupId, ipProtocol, fromPort, toPort,
+ sourceGroupId);
+ return new CreateRule(securityGroupRuleForCreate);
+ }
+
+ public CreateRule createSecurityGroupRule(
+ String parentSecurityGroupId, String ipProtocol, Integer fromPort,
+ Integer toPort, String cidr) {
+ SecurityGroupRuleForCreate securityGroupRuleForCreate = new SecurityGroupRuleForCreate(
+ parentSecurityGroupId, ipProtocol, fromPort, toPort, cidr);
+ return new CreateRule(securityGroupRuleForCreate);
+ }
+
+ public CreateRule createSecurityGroupRule(
+ String parentSecurityGroupId,String sourceGroupId,String ipProtocol, Integer fromPort,
+ Integer toPort) {
+ SecurityGroupRuleForCreate securityGroupRuleForCreate = new SecurityGroupRuleForCreate(
+ parentSecurityGroupId, sourceGroupId,ipProtocol, fromPort, toPort
+ );
+ return new CreateRule(securityGroupRuleForCreate);
+ }
+ public DeleteRule deleteSecurityGroupRule(String id) {
+ return new DeleteRule(id);
+ }
+ public DeleteRule deleteSecurityGroupRule(Integer id) {
+ return new DeleteRule(String.valueOf(id));
+ }
+
+}
diff --git a/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/SnapshotsExtension.java b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/SnapshotsExtension.java
new file mode 100644
index 0000000..62c2542
--- /dev/null
+++ b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/SnapshotsExtension.java
@@ -0,0 +1,86 @@
+package com.woorea.openstack.nova.api.extensions;
+
+
+import com.woorea.openstack.base.client.Entity;
+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.Metadata;
+import com.woorea.openstack.nova.model.Snapshot;
+import com.woorea.openstack.nova.model.SnapshotForCreate;
+import com.woorea.openstack.nova.model.Snapshots;
+
+public class SnapshotsExtension {
+
+ private final OpenStackClient CLIENT;
+
+ public SnapshotsExtension(OpenStackClient client) {
+ CLIENT = client;
+ }
+
+ public List list(boolean detail) {
+ return new List(detail);
+ }
+
+ public Create create(SnapshotForCreate snapshotForCreate) {
+ return new Create(snapshotForCreate);
+ }
+
+ public Show show(String id) {
+ return new Show(id);
+ }
+
+ public ShowMetadata showMetadata(String id) {
+ return new ShowMetadata(id);
+ }
+
+
+ public Delete delete(String id) {
+ return new Delete(id);
+ }
+
+ public class List extends OpenStackRequest<Snapshots> {
+
+ public List(boolean detail) {
+ super(CLIENT, HttpMethod.GET, detail ? "/os-snapshots/detail" : "/os-snapshots", null, Snapshots.class);
+ }
+
+ }
+
+ public class Create extends OpenStackRequest<SnapshotForCreate> {
+
+ private SnapshotForCreate snapshotForCreate;
+
+ public Create(SnapshotForCreate snapshotForCreate) {
+ super(CLIENT, HttpMethod.POST, "/os-snapshots", Entity.json(snapshotForCreate), SnapshotForCreate.class);
+ this.snapshotForCreate = snapshotForCreate;
+ }
+
+ }
+
+ public class Show extends OpenStackRequest<Snapshot> {
+
+ public Show(String id) {
+ super(CLIENT, HttpMethod.GET, new StringBuilder("/os-snapshots/").append(id).toString(), null, Snapshot.class);
+ }
+
+ }
+
+ public class ShowMetadata extends OpenStackRequest<Metadata> {
+
+ public ShowMetadata(String id) {
+ super(CLIENT, HttpMethod.GET, new StringBuilder("/os-snapshots/").append(id).append("/metadata").toString(), null, Metadata.class);
+ }
+
+ }
+
+ public class Delete extends OpenStackRequest<Void> {
+
+ public Delete(String id) {
+ super(CLIENT, HttpMethod.DELETE, new StringBuilder("/os-snapshots/").append(id).toString(), null, Void.class);
+ }
+
+ }
+
+}
+
diff --git a/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/VolumesExtension.java b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/VolumesExtension.java
new file mode 100644
index 0000000..de35577
--- /dev/null
+++ b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/VolumesExtension.java
@@ -0,0 +1,106 @@
+package com.woorea.openstack.nova.api.extensions;
+
+import com.woorea.openstack.base.client.Entity;
+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.Metadata;
+import com.woorea.openstack.nova.model.Volume;
+import com.woorea.openstack.nova.model.VolumeForCreate;
+import com.woorea.openstack.nova.model.VolumeForImageCreate;
+import com.woorea.openstack.nova.model.Volumes;
+
+public class VolumesExtension {
+
+ private final OpenStackClient CLIENT;
+
+ public VolumesExtension(OpenStackClient client) {
+ CLIENT = client;
+ }
+
+ public List list(boolean detail) {
+ return new List(detail);
+ }
+
+ public Create create(VolumeForCreate volume) {
+ return new Create(volume);
+ }
+
+ public UploadToImage uploadToImage(VolumeForImageCreate volumeForImage) {
+ return new UploadToImage(volumeForImage);
+ }
+
+ public Show show(String id) {
+ return new Show(id);
+ }
+
+ public ShowMetadata showMetadata(String id) {
+ return new ShowMetadata(id);
+ }
+
+ public Delete delete(String id) {
+ return new Delete(id);
+ }
+
+ public class List extends OpenStackRequest<Volumes> {
+
+ public List(boolean detail) {
+ super(CLIENT, HttpMethod.GET, detail ? "/os-volumes/detail"
+ : "/os-volumes", null, Volumes.class);
+ }
+
+ }
+
+ public class Create extends OpenStackRequest<Volume> {
+
+ // private Volume volume;
+
+ public Create(VolumeForCreate volume) {
+ super(CLIENT, HttpMethod.POST, "/os-volumes", Entity.json(volume),
+ Volume.class);
+ // this.volume = volume;
+ }
+
+ }
+
+ // Upload volume to image service as image
+
+ public class UploadToImage extends OpenStackRequest<Void> {
+
+ public UploadToImage(VolumeForImageCreate volumeForImageCreate) {
+ super(CLIENT, HttpMethod.POST, new StringBuilder("/volumes/")
+ .append(volumeForImageCreate.getVolumeId() + "/action"),
+ Entity.json(volumeForImageCreate), Void.class);
+ }
+
+ }
+
+ public class Show extends OpenStackRequest<Volume> {
+
+ public Show(String id) {
+ super(CLIENT, HttpMethod.GET, new StringBuilder("/os-volumes/")
+ .append(id).toString(), null, Volume.class);
+ }
+
+ }
+
+ public class ShowMetadata extends OpenStackRequest<Metadata> {
+
+ public ShowMetadata(String id) {
+ super(CLIENT, HttpMethod.GET, new StringBuilder("/os-volumes/")
+ .append(id).append("/metadata").toString(), null,
+ Metadata.class);
+ }
+
+ }
+
+ public class Delete extends OpenStackRequest<Void> {
+
+ public Delete(String id) {
+ super(CLIENT, HttpMethod.DELETE, new StringBuilder("/os-volumes/")
+ .append(id).toString(), null, Void.class);
+ }
+
+ }
+
+}