summaryrefslogtreecommitdiffstats
path: root/nova-client/src/main/java/com/woorea/openstack/nova/api/ImagesResource.java
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/java/com/woorea/openstack/nova/api/ImagesResource.java
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/java/com/woorea/openstack/nova/api/ImagesResource.java')
-rw-r--r--nova-client/src/main/java/com/woorea/openstack/nova/api/ImagesResource.java141
1 files changed, 70 insertions, 71 deletions
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;
+ }
}