summaryrefslogtreecommitdiffstats
path: root/nova-client/src/main
diff options
context:
space:
mode:
authorBharat saraswal <bharat.saraswal@huawei.com>2017-09-22 20:10:31 +0530
committerBharat saraswal <bharat.saraswal@huawei.com>2017-09-22 20:11:15 +0530
commit231bc997e100c502080dfb903b3e507771aa7456 (patch)
tree8276bd131d1b3a2822caff5a61007629509ae991 /nova-client/src/main
parenta34455305b0c42a66017aa0e3935f00020351001 (diff)
Resolved below sonar issues.
uncessary use of string builder removed. removed redundant code. rename variable to follow camelCase. removed tab char and changed them with spaces. Issue-ID:SO-98 Change-Id: Idbeed60ebc843c91a89fdd9357330e5e093172c6 Signed-off-by: Bharat saraswal <bharat.saraswal@huawei.com>
Diffstat (limited to 'nova-client/src/main')
-rw-r--r--nova-client/src/main/java/com/woorea/openstack/nova/Nova.java185
-rw-r--r--nova-client/src/main/java/com/woorea/openstack/nova/api/ExtensionsResource.java36
-rw-r--r--nova-client/src/main/java/com/woorea/openstack/nova/api/FlavorsResource.java140
-rw-r--r--nova-client/src/main/java/com/woorea/openstack/nova/api/ImagesResource.java141
-rw-r--r--nova-client/src/main/java/com/woorea/openstack/nova/api/QuotaSetsResource.java97
-rw-r--r--nova-client/src/main/java/com/woorea/openstack/nova/api/ServersResource.java730
6 files changed, 661 insertions, 668 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 f81de7d..f51eda1 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
@@ -10,104 +10,103 @@ 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.HostsExtension;
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;
- }
+ private final ExtensionsResource extensions;
+
+ private final ServersResource servers;
+
+ private final ImagesResource images;
+
+ private final FlavorsResource flavors;
+
+ private final KeyPairsExtension keyPairs;
+
+ private final FloatingIpsExtension floatingIps;
+
+ private final SecurityGroupsExtension securityGroups;
+
+ private final SnapshotsExtension snapshots;
+
+ private final VolumesExtension volumes;
+
+ private final AggregatesExtension aggregates;
+
+ private final QuotaSetsResource quotaSets;
+
+ 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);
+ keyPairs = new KeyPairsExtension(this);
+ floatingIps = new FloatingIpsExtension(this);
+ securityGroups = new SecurityGroupsExtension(this);
+ snapshots = new SnapshotsExtension(this);
+ volumes = new VolumesExtension(this);
+ aggregates = new AggregatesExtension(this);
+ quotaSets = 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 keyPairs;
+ }
+
+ public FloatingIpsExtension floatingIps() {
+ return floatingIps;
+ }
+
+ public SecurityGroupsExtension securityGroups() {
+ return securityGroups;
+ }
+
+ public SnapshotsExtension snapshots() {
+ return snapshots;
+ }
+
+ public VolumesExtension volumes() {
+ return volumes;
+ }
+
+ public AggregatesExtension aggregates() {
+ return aggregates;
+ }
+
+ public QuotaSetsResource quotaSets() {
+ return quotaSets;
+ }
+
+ 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
index 46e16c4..29b396a 100644
--- 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
@@ -7,24 +7,22 @@ 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);
- }
-
- }
-
+
+ private final OpenStackClient client;
+
+ public ExtensionsResource(OpenStackClient client) {
+ this.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
index c3e2256..0c8621d 100644
--- 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
@@ -10,76 +10,74 @@ 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);
- }
-
- }
-
+
+ private final OpenStackClient client;
+
+ public FlavorsResource(OpenStackClient client) {
+ this.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, getFlavorsString(id), null, Flavor.class);
+ }
+ }
+
+ public class ShowMetadata extends OpenStackRequest<Metadata> {
+
+ public ShowMetadata(String id) {
+ super(client, HttpMethod.GET, "/flavors/" + id + "/metadata", null, Metadata.class);
+ }
+ }
+
+ public class Delete extends OpenStackRequest<Void> {
+
+ public Delete(String id) {
+ super(client, HttpMethod.DELETE, getFlavorsString(id), null, Void.class);
+ }
+ }
+
+ private String getFlavorsString(String id) {
+ return "/flavors/" + id;
+ }
}
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
index 780cb12..764a845 100644
--- 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
@@ -10,76 +10,75 @@ 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);
- }
-
- }
-
+
+ private final OpenStackClient client;
+
+ public ImagesResource(OpenStackClient client) {
+ this.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, getImagesString(id), null, Image.class);
+ }
+ }
+
+ public class ShowMetadata extends OpenStackRequest<Metadata> {
+
+ public ShowMetadata(String id) {
+ super(client, HttpMethod.GET, "/images/" + id + "/metadata", null,
+ Metadata.class);
+ }
+ }
+
+ public class Delete extends OpenStackRequest<Void> {
+
+ public Delete(String id) {
+ super(client, HttpMethod.DELETE, getImagesString(id), null, Void.class);
+ }
+ }
+
+ private String getImagesString(String id) {
+ return "/images/" + id;
+ }
}
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
index 166fb42..0670c4b 100644
--- 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
@@ -10,52 +10,55 @@ 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);
- }
- }
+
+ private final OpenStackClient client;
+
+ public QuotaSetsResource(OpenStackClient client) {
+ this.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, "/os-quota-sets/" + tenantId, null, QuotaSet.class);
+ }
+ }
+
+ public class UpdateQuota extends OpenStackRequest<QuotaSet> {
+
+ public UpdateQuota(String tenantId, QuotaSet quotaSet) {
+ super(client, HttpMethod.PUT, "/os-quota-sets/" + tenantId, Entity.json(quotaSet), QuotaSet.class);
+ }
+ }
+
+ public class ShowUsage extends OpenStackRequest<SimpleTenantUsage> {
+
+ public ShowUsage(String tenantId) {
+ super(client, HttpMethod.GET, "/os-simple-tenant-usage/" + tenantId, null, SimpleTenantUsage.class);
+ }
+ }
+
+ public class ShowUsedLimits extends OpenStackRequest<Limits> {
+
+ public ShowUsedLimits() {
+ super(client, HttpMethod.GET, "/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
index ca48b6f..253cd66 100644
--- 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
@@ -1,8 +1,6 @@
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;
@@ -36,506 +34,504 @@ 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;
+import java.util.Map;
public class ServersResource {
- private final OpenStackClient CLIENT;
-
- public ServersResource(OpenStackClient client) {
- CLIENT = client;
- }
-
- public List list(boolean detail) {
- return new List(detail);
- }
+ private final OpenStackClient client;
+ private static final String SERVERS = "/servers/";
+ private static final String ACTION = "/action";
- public Boot boot(ServerForCreate server) {
- return new Boot(server);
- }
-
- public Show show(String id) {
- return new Show(id);
- }
+ public ServersResource(OpenStackClient client) {
+ this.client = client;
+ }
- 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 List list(boolean detail) {
+ return new List(detail);
+ }
- public Delete delete(String id) {
- return new Delete(id);
- }
+ public Boot boot(ServerForCreate server) {
+ return new Boot(server);
+ }
- public class List extends OpenStackRequest<Servers> {
+ public Show show(String id) {
+ return new Show(id);
+ }
- public List(boolean detail) {
- super(CLIENT, HttpMethod.GET, detail ? "/servers/detail" : "/servers", null, Servers.class);
- }
+ public ShowMetadata showMetadata(String id) {
+ return new ShowMetadata(id);
+ }
- }
+ public CreateOrUpdateMetadata createOrUpdateMetadata(String id, Metadata metadata) {
+ return new CreateOrUpdateMetadata(id, metadata);
+ }
- public class Boot extends OpenStackRequest<Server> {
+ public ReplaceMetadata replaceMetadata(String id, Metadata metadata) {
+ return new ReplaceMetadata(id, metadata);
+ }
- private ServerForCreate server;
+ public DeleteMetadata deleteMetadata(String id, String key) {
+ return new DeleteMetadata(id, key);
+ }
- public Boot(ServerForCreate server) {
- super(CLIENT, HttpMethod.POST, "/servers", Entity.json(server), Server.class);
- this.server = server;
- }
+ public Delete delete(String id) {
+ return new Delete(id);
+ }
- }
+ public class List extends OpenStackRequest<Servers> {
- public class Show extends OpenStackRequest<Server> {
+ public List(boolean detail) {
+ super(client, HttpMethod.GET, detail ? "/servers/detail" : "/servers", null, Servers.class);
+ }
+ }
- public Show(String id) {
- super(CLIENT, HttpMethod.GET, new StringBuilder("/servers/").append(id), null, Server.class);
- }
+ public class Boot extends OpenStackRequest<Server> {
- }
+ private ServerForCreate server;
- public class ShowMetadata extends OpenStackRequest<Metadata> {
+ public Boot(ServerForCreate server) {
+ super(client, HttpMethod.POST, "/servers", Entity.json(server), Server.class);
+ this.server = server;
+ }
+ }
- public ShowMetadata(String id) {
- super(CLIENT, HttpMethod.GET, new StringBuilder("/servers/").append(id).append("/metadata"), null, Metadata.class);
- }
+ public class Show extends OpenStackRequest<Server> {
- }
-
- public class CreateOrUpdateMetadata extends OpenStackRequest<Metadata> {
+ public Show(String id) {
+ super(client, HttpMethod.GET, new StringBuilder(SERVERS).append(id), null, Server.class);
+ }
+ }
- public CreateOrUpdateMetadata(String id,Metadata metadata) {
- super(CLIENT, HttpMethod.POST, new StringBuilder("/servers/").append(id).append("/metadata"), Entity.json(metadata), Metadata.class);
- }
+ public class ShowMetadata extends OpenStackRequest<Metadata> {
- }
- public class ReplaceMetadata extends OpenStackRequest<Metadata> {
+ public ShowMetadata(String id) {
+ super(client, HttpMethod.GET, new StringBuilder(SERVERS).append(id).append("/metadata"), null,
+ Metadata.class);
+ }
+ }
- public ReplaceMetadata(String id,Metadata metadata) {
- super(CLIENT, HttpMethod.PUT, new StringBuilder("/servers/").append(id).append("/metadata"), Entity.json(metadata), Metadata.class);
- }
+ public class CreateOrUpdateMetadata extends OpenStackRequest<Metadata> {
- }
-
- public class DeleteMetadata extends OpenStackRequest<Void> {
+ public CreateOrUpdateMetadata(String id, Metadata metadata) {
+ super(client, HttpMethod.POST, new StringBuilder(SERVERS).append(id).append("/metadata"),
+ Entity.json(metadata), Metadata.class);
+ }
+ }
- public DeleteMetadata(String id,String key) {
- super(CLIENT, HttpMethod.DELETE, new StringBuilder("/servers/").append(id).append("/metadata/").append(key), null, Void.class);
- }
+ public class ReplaceMetadata extends OpenStackRequest<Metadata> {
- }
-
-
- public class Delete extends OpenStackRequest<Void> {
+ public ReplaceMetadata(String id, Metadata metadata) {
+ super(client, HttpMethod.PUT, new StringBuilder(SERVERS).append(id).append("/metadata"),
+ Entity.json(metadata), Metadata.class);
+ }
+ }
- public Delete(String id) {
- super(CLIENT, HttpMethod.DELETE, new StringBuilder("/servers/").append(id), null, Void.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 ShowServerAddresses extends OpenStackRequest<Addresses> {
- public ShowServerAddresses(String id) {
- super(CLIENT, HttpMethod.GET, new StringBuilder("/servers/").append(id).append("/ips"), null, Addresses.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 UpdateServer extends OpenStackRequest<Server> {
+ public class ShowServerAddresses extends OpenStackRequest<Addresses> {
- private Server server;
+ public ShowServerAddresses(String id) {
+ super(client, HttpMethod.GET, new StringBuilder(SERVERS).append(id).append("/ips"), null,
+ Addresses.class);
+ }
+ }
- public UpdateServer(String id, Server server) {
- super(CLIENT, HttpMethod.PUT, new StringBuilder("/servers/").append(id), Entity.json(server), Server.class);
- this.server = server;
- }
+ public class UpdateServer extends OpenStackRequest<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);
- }
+ private Server server;
- public abstract class Action<T> extends OpenStackRequest<T> {
+ public UpdateServer(String id, Server server) {
+ super(client, HttpMethod.PUT, new StringBuilder(SERVERS).append(id), Entity.json(server), Server.class);
+ this.server = server;
+ }
+ }
- public Action(String id, Entity<?> entity, Class<T> returnType) {
- super(CLIENT, HttpMethod.POST, new StringBuilder("/servers/").append(id).append("/action"), entity, returnType);
- }
+ 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 class ChangePasswordAction extends Action<Server> {
+ public Action(String id, Entity<?> entity, Class<T> returnType) {
+ super(client, HttpMethod.POST, new StringBuilder(SERVERS).append(id).append(ACTION), entity,
+ returnType);
+ }
+ }
- private ChangePassword action;
+ public class ChangePasswordAction extends Action<Server> {
- public ChangePasswordAction(String id, ChangePassword action) {
- super(id, Entity.json(action), Server.class);
- }
+ private ChangePassword action;
- }
-
- public ChangePasswordAction changePassword(String serverId, String adminPass) {
- ChangePassword changePassword = new ChangePassword();
- changePassword.setAdminPass(adminPass);
- return new ChangePasswordAction(serverId, changePassword);
- }
+ public ChangePasswordAction(String id, ChangePassword action) {
+ super(id, Entity.json(action), Server.class);
+ }
+ }
- public class RebootAction extends Action<Void> {
+ public ChangePasswordAction changePassword(String serverId, String adminPass) {
+ ChangePassword changePassword = new ChangePassword();
+ changePassword.setAdminPass(adminPass);
+ return new ChangePasswordAction(serverId, changePassword);
+ }
- private Reboot action;
+ public class RebootAction extends Action<Void> {
- public RebootAction(String id, Reboot action) {
- super(id, Entity.json(action), Void.class);
- }
+ 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 RebootAction reboot(String serverId, String rebootType) {
+ Reboot reboot = new Reboot();
+ reboot.setType(rebootType);
+ return new RebootAction(serverId, reboot);
+ }
- public class RebuildAction extends Action<Server> {
+ public class RebuildAction extends Action<Server> {
- private Rebuild action;
+ private Rebuild action;
- public RebuildAction(String id, Rebuild action) {
- super(id, Entity.json(action), Server.class);
- }
+ 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 RebuildAction rebuild(String serverId, Rebuild rebuild) {
+ return new RebuildAction(serverId, rebuild);
+ }
- public class ResizeAction extends Action<Server> {
+ public class ResizeAction extends Action<Server> {
- private Resize action;
+ private Resize action;
- public ResizeAction(String id, Resize action) {
- super(id, Entity.json(action), Server.class);
- }
+ 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 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 class ConfirmResizeAction extends Action<Server> {
- public ConfirmResizeAction(String id) {
- super(id, Entity.json(new ConfirmResize()), Server.class);
- }
+ public ConfirmResizeAction(String id) {
+ super(id, Entity.json(new ConfirmResize()), Server.class);
+ }
+ }
- }
-
- public ConfirmResizeAction confirmResize(String serverId) {
- return new ConfirmResizeAction(serverId);
- }
+ public ConfirmResizeAction confirmResize(String serverId) {
+ return new ConfirmResizeAction(serverId);
+ }
- public class RevertResizeAction extends Action<Server> {
+ public class RevertResizeAction extends Action<Server> {
- public RevertResizeAction(String id) {
- super(id, Entity.json(new RevertResize()), Server.class);
- }
+ public RevertResizeAction(String id) {
+ super(id, Entity.json(new RevertResize()), Server.class);
+ }
+ }
- }
-
- public RevertResizeAction revertResize(String serverId) {
- return new RevertResizeAction(serverId);
- }
+ 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);
+ 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 StartServer extends OpenStackRequest<Void> {
- public class PauseServer extends OpenStackRequest<Void> {
+ private Start action;
- public PauseServer(String id) {
- super(CLIENT, HttpMethod.POST, new StringBuilder("/servers/").append(id).append("/action"), Entity.json(new Pause()), Void.class);
- }
+ 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 UnpauseServer extends OpenStackRequest<Void> {
+ public class StopServer extends OpenStackRequest<Void> {
- public UnpauseServer(String id) {
- super(CLIENT, HttpMethod.POST, new StringBuilder("/servers/").append(id).append("/action"), Entity.json(new Unpause()), Void.class);
- }
+ 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 class LockServer extends OpenStackRequest<Void> {
+ public StartServer start(String id) {
+ return new StartServer(id);
+ }
- private Lock action;
+ public StopServer stop(String id) {
+ return new StopServer(id);
+ }
- private String id;
+ public class GetVncConsoleServer extends OpenStackRequest<VncConsole> {
- public LockServer(String id) {
- super(CLIENT, HttpMethod.POST, new StringBuilder("/servers/").append(id).append("/action"), Entity.json(new Lock()), Void.class);
- }
+ private GetVncConsole action;
- }
+ private String id;
- public class UnlockServer extends OpenStackRequest<Void> {
+ public GetVncConsoleServer(String id, GetVncConsole action) {
+ super(client, HttpMethod.POST, new StringBuilder(SERVERS).append(id).append(ACTION),
+ Entity.json(action), VncConsole.class);
+ }
+ }
- private Unlock action;
+ public GetVncConsoleServer getVncConsole(String id, String type) {
+ GetVncConsole action = new GetVncConsole(type);
+ return new GetVncConsoleServer(id, action);
+ }
- private String id;
+ public class GetConsoleOutputServer extends OpenStackRequest<ConsoleOutput> {
- public UnlockServer(String id) {
- super(CLIENT, HttpMethod.POST, new StringBuilder("/servers/").append(id).append("/action"), Entity.json(new Unlock()), Void.class);
- }
+ 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 SuspendServer extends OpenStackRequest<Void> {
+ public class PauseServer 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 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 class ResumeServer 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 ResumeServer(String id) {
- super(CLIENT, HttpMethod.POST, new StringBuilder("/servers/").append(id).append("/action"), Entity.json(new Resume()), Void.class);
- }
+ public class LockServer extends OpenStackRequest<Void> {
- }
+ private Lock action;
- public class CreateBackupServer extends OpenStackRequest<Void> {
+ private String id;
- public CreateBackupServer(String id, CreateBackup action) {
- super(CLIENT, HttpMethod.POST, new StringBuilder("/servers/").append(id).append("/action"), Entity.json(action), Void.class);
- }
+ 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> {
- public PauseServer pause(String serverId) {
- return new PauseServer(serverId);
- }
+ private Unlock action;
- public UnpauseServer unpause(String serverId) {
- return new UnpauseServer(serverId);
- }
+ private String id;
- public LockServer lock(String serverId) {
- return new LockServer(serverId);
- }
+ public UnlockServer(String id) {
+ super(client, HttpMethod.POST, new StringBuilder(SERVERS).append(id).append(ACTION),
+ Entity.json(new Unlock()), Void.class);
+ }
+ }
- public UnlockServer unlock(String serverId) {
- return new UnlockServer(serverId);
- }
+ public class SuspendServer extends OpenStackRequest<Void> {
- public SuspendServer suspend(String serverId) {
- return new SuspendServer(serverId);
- }
+ public SuspendServer(String id) {
+ super(client, HttpMethod.POST, new StringBuilder(SERVERS).append(id).append(ACTION),
+ Entity.json(new Suspend()), Void.class);
+ }
+ }
- public ResumeServer resume(String serverId) {
- return new ResumeServer(serverId);
- }
+ public class ResumeServer extends OpenStackRequest<Void> {
- public CreateBackupServer createBackup(String serverId, CreateBackup action) {
- return new CreateBackupServer(serverId, action);
- }
+ public ResumeServer(String id) {
+ super(client, HttpMethod.POST, new StringBuilder(SERVERS).append(id).append(ACTION),
+ Entity.json(new Resume()), Void.class);
+ }
+ }
- public class RescueServer extends OpenStackRequest<Void> {
+ public class CreateBackupServer 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 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 class UnrescueServer extends OpenStackRequest<Void> {
+ public UnpauseServer unpause(String serverId) {
+ return new UnpauseServer(serverId);
+ }
- public UnrescueServer(String id) {
- super(CLIENT, HttpMethod.POST, new StringBuilder("/servers/").append(id).append("/action"), Entity.json(new Unrescue()), Void.class);
- }
+ public LockServer lock(String serverId) {
+ return new LockServer(serverId);
+ }
- }
+ public UnlockServer unlock(String serverId) {
+ return new UnlockServer(serverId);
+ }
- public RescueServer rescue(String serverId, String adminPass) {
- Rescue action = new Rescue(adminPass);
- return new RescueServer(serverId, action);
- }
+ public SuspendServer suspend(String serverId) {
+ return new SuspendServer(serverId);
+ }
- public UnrescueServer unrescue(String serverId) {
- return new UnrescueServer(serverId);
- }
+ public ResumeServer resume(String serverId) {
+ return new ResumeServer(serverId);
+ }
- public class AssociateFloatingIp extends OpenStackRequest<Void> {
+ public CreateBackupServer createBackup(String serverId, CreateBackup action) {
+ return new CreateBackupServer(serverId, action);
+ }
- 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 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 DisassociateFloatingIp extends OpenStackRequest<Void> {
+ public class UnrescueServer 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 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 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 UnrescueServer unrescue(String serverId) {
+ return new UnrescueServer(serverId);
+ }
- 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 AssociateFloatingIp extends OpenStackRequest<Void> {
- public class AttachVolume 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 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 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 class DetachVolume extends OpenStackRequest<Void> {
+ 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 DetachVolume(String serverId, String volumeId) {
- super(CLIENT, HttpMethod.DELETE, new StringBuilder("/servers/").append(serverId).append("/os-volume_attachments/").append(volumeId), null, Void.class);
- }
+ 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 class ListVolumeAttachments extends OpenStackRequest<VolumeAttachments> {
+ 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 ListVolumeAttachments(String serverId) {
- super(CLIENT, HttpMethod.GET, new StringBuilder("/servers/").append(serverId).append("/os-volume_attachments"), null, VolumeAttachments.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 ShowVolumeAttachment extends OpenStackRequest<VolumeAttachment> {
+ public class ListVolumeAttachments extends OpenStackRequest<VolumeAttachments> {
- 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 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 AttachVolume attachVolume(String serverId, String volumeId, String device) {
- VolumeAttachment volumeAttachment = new VolumeAttachment();
- volumeAttachment.setVolumeId(volumeId);
- volumeAttachment.setDevice(device);
- return new AttachVolume(serverId, 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 DetachVolume detachVolume(String serverId, String volumeId) {
- return new DetachVolume(serverId, volumeId);
- }
+ 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 ListVolumeAttachments listVolumeAttachments(String serverId) {
- return new ListVolumeAttachments(serverId);
- }
+ public DetachVolume detachVolume(String serverId, String volumeId) {
+ return new DetachVolume(serverId, volumeId);
+ }
- public ShowVolumeAttachment showVolumeAttachment(String serverId, String volumeAttachmentId) {
- return new ShowVolumeAttachment(serverId, volumeAttachmentId);
- }
+ public ListVolumeAttachments listVolumeAttachments(String serverId) {
+ return new ListVolumeAttachments(serverId);
+ }
+ public ShowVolumeAttachment showVolumeAttachment(String serverId, String volumeAttachmentId) {
+ return new ShowVolumeAttachment(serverId, volumeAttachmentId);
+ }
}