From 9378c4ed6b2f95b4e1dc0f754440b48718dd0d70 Mon Sep 17 00:00:00 2001 From: valinformatique Date: Mon, 23 Jun 2014 15:19:01 +0200 Subject: [PATCH 01/11] add support for cinder --- cinder-client/pom.xml | 24 ++ .../com/woorea/openstack/cinder/Cinder.java | 45 ++++ .../openstack/cinder/api/BackupsResource.java | 81 ++++++ .../cinder/api/SnapshotsResource.java | 67 +++++ .../openstack/cinder/api/VolumesResource.java | 68 +++++ cinder-model/pom.xml | 11 + .../openstack/cinder/model/Attachment.java | 71 +++++ .../woorea/openstack/cinder/model/Backup.java | 128 +++++++++ .../cinder/model/BackupForCreate.java | 51 ++++ .../cinder/model/BackupForRestore.java | 24 ++ .../openstack/cinder/model/Backups.java | 35 +++ .../woorea/openstack/cinder/model/Link.java | 40 +++ .../openstack/cinder/model/Snapshot.java | 113 ++++++++ .../cinder/model/SnapshotForCreate.java | 52 ++++ .../openstack/cinder/model/Snapshots.java | 35 +++ .../woorea/openstack/cinder/model/Volume.java | 159 ++++++++++++ .../openstack/cinder/model/Volumes.java | 35 +++ pom.xml | 245 +++++++++--------- 18 files changed, 1162 insertions(+), 122 deletions(-) create mode 100644 cinder-client/pom.xml create mode 100644 cinder-client/src/main/java/com/woorea/openstack/cinder/Cinder.java create mode 100644 cinder-client/src/main/java/com/woorea/openstack/cinder/api/BackupsResource.java create mode 100644 cinder-client/src/main/java/com/woorea/openstack/cinder/api/SnapshotsResource.java create mode 100644 cinder-client/src/main/java/com/woorea/openstack/cinder/api/VolumesResource.java create mode 100644 cinder-model/pom.xml create mode 100644 cinder-model/src/main/java/com/woorea/openstack/cinder/model/Attachment.java create mode 100644 cinder-model/src/main/java/com/woorea/openstack/cinder/model/Backup.java create mode 100644 cinder-model/src/main/java/com/woorea/openstack/cinder/model/BackupForCreate.java create mode 100644 cinder-model/src/main/java/com/woorea/openstack/cinder/model/BackupForRestore.java create mode 100644 cinder-model/src/main/java/com/woorea/openstack/cinder/model/Backups.java create mode 100644 cinder-model/src/main/java/com/woorea/openstack/cinder/model/Link.java create mode 100644 cinder-model/src/main/java/com/woorea/openstack/cinder/model/Snapshot.java create mode 100644 cinder-model/src/main/java/com/woorea/openstack/cinder/model/SnapshotForCreate.java create mode 100644 cinder-model/src/main/java/com/woorea/openstack/cinder/model/Snapshots.java create mode 100644 cinder-model/src/main/java/com/woorea/openstack/cinder/model/Volume.java create mode 100644 cinder-model/src/main/java/com/woorea/openstack/cinder/model/Volumes.java diff --git a/cinder-client/pom.xml b/cinder-client/pom.xml new file mode 100644 index 000000000..b85a04b89 --- /dev/null +++ b/cinder-client/pom.xml @@ -0,0 +1,24 @@ + + 4.0.0 + + com.woorea + openstack-java-sdk + 3.2.2-SNAPSHOT + + cinder-client + OpenStack Cinder Client + OpenStack Cinder Client + + + com.woorea + openstack-client + 3.2.2-SNAPSHOT + + + + com.woorea + cinder-model + 3.2.2-SNAPSHOT + + + \ No newline at end of file diff --git a/cinder-client/src/main/java/com/woorea/openstack/cinder/Cinder.java b/cinder-client/src/main/java/com/woorea/openstack/cinder/Cinder.java new file mode 100644 index 000000000..2d873d466 --- /dev/null +++ b/cinder-client/src/main/java/com/woorea/openstack/cinder/Cinder.java @@ -0,0 +1,45 @@ +package com.woorea.openstack.cinder; + +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.base.client.OpenStackClientConnector; +import com.woorea.openstack.cinder.api.BackupsResource; +import com.woorea.openstack.cinder.api.SnapshotsResource; +import com.woorea.openstack.cinder.api.VolumesResource; + +/** + * OpenStack Cinder Client + * + * Reference: + * http://api.openstack.org/api-ref-blockstorage.html + * + * @author VAL Informatique + */ +public class Cinder extends OpenStackClient { + + private final VolumesResource volumes; + private final SnapshotsResource snapshots; + private final BackupsResource backups; + + public Cinder(String endpoint, OpenStackClientConnector connector) { + super(endpoint, connector); + volumes = new VolumesResource(this); + snapshots = new SnapshotsResource(this); + backups = new BackupsResource(this); + } + + public Cinder(String endpoint) { + this(endpoint, null); + } + + public VolumesResource volumes() { + return volumes; + } + + public SnapshotsResource snapshots() { + return snapshots; + } + + public BackupsResource backups() { + return backups; + } +} diff --git a/cinder-client/src/main/java/com/woorea/openstack/cinder/api/BackupsResource.java b/cinder-client/src/main/java/com/woorea/openstack/cinder/api/BackupsResource.java new file mode 100644 index 000000000..d07aa641b --- /dev/null +++ b/cinder-client/src/main/java/com/woorea/openstack/cinder/api/BackupsResource.java @@ -0,0 +1,81 @@ +package com.woorea.openstack.cinder.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.cinder.model.Backup; +import com.woorea.openstack.cinder.model.BackupForCreate; +import com.woorea.openstack.cinder.model.BackupForRestore; +import com.woorea.openstack.cinder.model.Backups; + +/** + * Cinder Backups Management + * + * @author VAL Informatique + */ +public class BackupsResource { + + private final OpenStackClient CLIENT; + + public BackupsResource(OpenStackClient client) { + this.CLIENT = client; + } + + public List list(boolean detail) { + return new List(detail); + } + + public Create create(BackupForCreate backupForCreate) { + return new Create(backupForCreate); + } + + public Delete delete(String backupId) { + return new Delete(backupId); + } + + public Show show(String backupId) { + return new Show(backupId); + } + + public Restore restore(String backupId, String volumeId) { + BackupForRestore lBFR = new BackupForRestore(); + lBFR.setVolumeId(volumeId); + return new Restore(lBFR, backupId); + } + + public class List extends OpenStackRequest { + + public List(boolean detail) { + super(CLIENT, HttpMethod.GET, detail ? "/backups/detail" : "backups", null, Backups.class); + } + } + + public class Create extends OpenStackRequest { + + public Create(BackupForCreate backupForCreate) { + super(CLIENT, HttpMethod.POST, "backups", Entity.json(backupForCreate), Backup.class); + } + } + + public class Show extends OpenStackRequest { + + public Show(String id) { + super(CLIENT, HttpMethod.GET, buildPath("backups/", id), null, Backup.class); + } + } + + public class Delete extends OpenStackRequest { + + public Delete(String id) { + super(CLIENT, HttpMethod.DELETE, buildPath("backups/", id), null, Void.class); + } + } + + public class Restore extends OpenStackRequest { + + public Restore(BackupForRestore backupForRestore, String id) { + super(CLIENT, HttpMethod.POST, buildPath("backups/", id).concat("/restore"), Entity.json(backupForRestore), Void.class); + } + } +} diff --git a/cinder-client/src/main/java/com/woorea/openstack/cinder/api/SnapshotsResource.java b/cinder-client/src/main/java/com/woorea/openstack/cinder/api/SnapshotsResource.java new file mode 100644 index 000000000..dd6240043 --- /dev/null +++ b/cinder-client/src/main/java/com/woorea/openstack/cinder/api/SnapshotsResource.java @@ -0,0 +1,67 @@ +package com.woorea.openstack.cinder.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.cinder.model.Snapshot; +import com.woorea.openstack.cinder.model.SnapshotForCreate; +import com.woorea.openstack.cinder.model.Snapshots; + +/** + * Cinder Snapshots Management + * + * @author VAL Informatique + */ +public class SnapshotsResource { + + private final OpenStackClient CLIENT; + + public SnapshotsResource(OpenStackClient client) { + this.CLIENT = client; + } + + public List list(boolean detail) { + return new List(detail); + } + + public Create create(SnapshotForCreate snapshotForCreate) { + return new Create(snapshotForCreate); + } + + public Delete delete(String snapshotId) { + return new Delete(snapshotId); + } + + public Show show(String snapshotId) { + return new Show(snapshotId); + } + + public class List extends OpenStackRequest { + + public List(boolean detail) { + super(CLIENT, HttpMethod.GET, detail ? "/snapshots/detail" : "snapshots", null, Snapshots.class); + } + } + + public class Create extends OpenStackRequest { + + public Create(SnapshotForCreate snapshotForCreate) { + super(CLIENT, HttpMethod.POST, "snapshots", Entity.json(snapshotForCreate), Snapshot.class); + } + } + + public class Show extends OpenStackRequest { + + public Show(String id) { + super(CLIENT, HttpMethod.GET, buildPath("snapshots/", id), null, Snapshot.class); + } + } + + public class Delete extends OpenStackRequest { + + public Delete(String id) { + super(CLIENT, HttpMethod.DELETE, buildPath("snapshots/", id), null, Void.class); + } + } +} diff --git a/cinder-client/src/main/java/com/woorea/openstack/cinder/api/VolumesResource.java b/cinder-client/src/main/java/com/woorea/openstack/cinder/api/VolumesResource.java new file mode 100644 index 000000000..054faee10 --- /dev/null +++ b/cinder-client/src/main/java/com/woorea/openstack/cinder/api/VolumesResource.java @@ -0,0 +1,68 @@ +package com.woorea.openstack.cinder.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.cinder.model.Volume; +import com.woorea.openstack.cinder.model.Volumes; + +/** + * Cinder Volumes Management + * + * @author VAL Informatique + */ +public class VolumesResource { + + private final OpenStackClient CLIENT; + + public VolumesResource(OpenStackClient client) { + this.CLIENT = client; + } + + public List list(boolean detail) { + return new List(detail); + } + + public Create create(Volume volume) { + return new Create(volume); + } + + public Delete delete(String volumeId) { + return new Delete(volumeId); + } + + public Show show(String volumeId) { + return new Show(volumeId); + } + + public class List extends OpenStackRequest { + + public List(boolean detail) { + super(CLIENT, HttpMethod.GET, detail ? "/volumes/detail" : "volumes", null, Volumes.class); + } + } + + public class Create extends OpenStackRequest { + + public Create(Volume volume) { + super(CLIENT, HttpMethod.POST, "volumes", Entity.json(volume), Volume.class); + } + } + + public class Show extends OpenStackRequest { + + public Show(String id) { + super(CLIENT, HttpMethod.GET, buildPath("volumes/", id), null, Volume.class); + } + } + + public class Delete extends OpenStackRequest { + + public Delete(String id) { + super(CLIENT, HttpMethod.DELETE, buildPath("volumes/", id), null, Void.class); + } + } + + +} diff --git a/cinder-model/pom.xml b/cinder-model/pom.xml new file mode 100644 index 000000000..c30b9cb70 --- /dev/null +++ b/cinder-model/pom.xml @@ -0,0 +1,11 @@ + + 4.0.0 + + com.woorea + openstack-java-sdk + 3.2.2-SNAPSHOT + + cinder-model + OpenStack Cinder Model + OpenStack Cinder Model + \ No newline at end of file diff --git a/cinder-model/src/main/java/com/woorea/openstack/cinder/model/Attachment.java b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/Attachment.java new file mode 100644 index 000000000..f4346811f --- /dev/null +++ b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/Attachment.java @@ -0,0 +1,71 @@ +package com.woorea.openstack.cinder.model; + +import org.codehaus.jackson.annotate.JsonProperty; + +/** + * Model for Volume Attachment + * + * @author VAL Informatique + */ +public class Attachment { + + @JsonProperty("host_name") + private String hostName; + private String device; + @JsonProperty("server_id") + private String serverId; + private String id; + @JsonProperty("volume_id") + private String volumeId; + + public String getHostName() { + return hostName; + } + + public void setHostName(String hostName) { + this.hostName = hostName; + } + + public String getDevice() { + return device; + } + + public void setDevice(String device) { + this.device = device; + } + + public String getServerId() { + return serverId; + } + + public void setServerId(String serverId) { + this.serverId = serverId; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getVolumeId() { + return volumeId; + } + + public void setVolumeId(String volumeId) { + this.volumeId = volumeId; + } + + @Override + public String toString() { + return "Attachment {" + + "host_name='" + hostName + '\'' + + ", device='" + device + '\'' + + ", server_id='" + serverId + '\'' + + ", id='" + id + '\'' + + ", volume_id='" + volumeId + '\'' + + '}'; + } +} diff --git a/cinder-model/src/main/java/com/woorea/openstack/cinder/model/Backup.java b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/Backup.java new file mode 100644 index 000000000..d4a91e24a --- /dev/null +++ b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/Backup.java @@ -0,0 +1,128 @@ +package com.woorea.openstack.cinder.model; + +import java.util.Calendar; +import java.util.List; +import org.codehaus.jackson.annotate.JsonProperty; + +/** + * Model for Backup + * + * @author VAL Informatique + */ +public class Backup { + + @JsonProperty("availability_zone") + private String availabilityZone; + private String container; + @JsonProperty("created_at") + private Calendar createdAt; + private String description; + @JsonProperty("fail_reason") + private String failReason; + private String id; + private List links; + private String name; + @JsonProperty("object_count") + private Integer objectCount; + private Integer size; + private String status; + @JsonProperty("volume_id") + private String volumeId; + + public String getAvailabilityZone() { + return availabilityZone; + } + + public void setAvailabilityZone(String availabilityZone) { + this.availabilityZone = availabilityZone; + } + + public String getContainer() { + return container; + } + + public void setContainer(String container) { + this.container = container; + } + + public Calendar getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(Calendar createdAt) { + this.createdAt = createdAt; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getFailReason() { + return failReason; + } + + public void setFailReason(String failReason) { + this.failReason = failReason; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public List getLinks() { + return links; + } + + public void setLinks(List links) { + this.links = links; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Integer getObjectCount() { + return objectCount; + } + + public void setObjectCount(Integer objectCount) { + this.objectCount = objectCount; + } + + public Integer getSize() { + return size; + } + + public void setSize(Integer size) { + this.size = size; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getVolumeId() { + return volumeId; + } + + public void setVolumeId(String volumeId) { + this.volumeId = volumeId; + } + +} diff --git a/cinder-model/src/main/java/com/woorea/openstack/cinder/model/BackupForCreate.java b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/BackupForCreate.java new file mode 100644 index 000000000..c20f6b528 --- /dev/null +++ b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/BackupForCreate.java @@ -0,0 +1,51 @@ +package com.woorea.openstack.cinder.model; + +import org.codehaus.jackson.annotate.JsonProperty; +import org.codehaus.jackson.map.annotate.JsonRootName; + +/** + * Model for Creation of backup + * + * @author VAL Informatique + */ +@JsonRootName("backup") +public class BackupForCreate { + + private String name; + private String description; + private String container; + @JsonProperty("volume_id") + private String volumeId; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getContainer() { + return container; + } + + public void setContainer(String container) { + this.container = container; + } + + public String getVolumeId() { + return volumeId; + } + + public void setVolumeId(String volumeId) { + this.volumeId = volumeId; + } +} diff --git a/cinder-model/src/main/java/com/woorea/openstack/cinder/model/BackupForRestore.java b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/BackupForRestore.java new file mode 100644 index 000000000..145a3cc74 --- /dev/null +++ b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/BackupForRestore.java @@ -0,0 +1,24 @@ +package com.woorea.openstack.cinder.model; + +import org.codehaus.jackson.annotate.JsonProperty; +import org.codehaus.jackson.map.annotate.JsonRootName; + +/** + * Model for Restoration of backup + * + * @author VAL Informatique + */ +@JsonRootName("restore") +public class BackupForRestore { + + @JsonProperty("volume_id") + private String volumeId; + + public String getVolumeId() { + return volumeId; + } + + public void setVolumeId(String volumeId) { + this.volumeId = volumeId; + } +} \ No newline at end of file diff --git a/cinder-model/src/main/java/com/woorea/openstack/cinder/model/Backups.java b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/Backups.java new file mode 100644 index 000000000..8663e82d8 --- /dev/null +++ b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/Backups.java @@ -0,0 +1,35 @@ +package com.woorea.openstack.cinder.model; + +import java.io.Serializable; +import java.util.Iterator; +import java.util.List; +import org.codehaus.jackson.annotate.JsonProperty; + +/** + * Model for List of backups + * + * @author VAL Informatique + */ +public class Backups implements Iterable, Serializable { + + @JsonProperty("backups") + private List list; + + public List getList() { + return list; + } + + public void setList(List list) { + this.list = list; + } + + @Override + public Iterator iterator() { + return list.iterator(); + } + + @Override + public String toString() { + return "Backups [list=" + list + "]"; + } +} diff --git a/cinder-model/src/main/java/com/woorea/openstack/cinder/model/Link.java b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/Link.java new file mode 100644 index 000000000..053d2c187 --- /dev/null +++ b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/Link.java @@ -0,0 +1,40 @@ +package com.woorea.openstack.cinder.model; + +import org.codehaus.jackson.annotate.JsonProperty; + +/** + * Model for Link + * + * @author VAL Informatique + */ +public class Link { + + @JsonProperty("href") + private String href; + @JsonProperty("rel") + private String rel; + + public String getHref() { + return href; + } + + public void setHref(String href) { + this.href = href; + } + + public String getRel() { + return rel; + } + + public void setRel(String rel) { + this.rel = rel; + } + + @Override + public String toString() { + return "Link{" + + "href='" + href + '\'' + + ", rel='" + rel + '\'' + + '}'; + } +} diff --git a/cinder-model/src/main/java/com/woorea/openstack/cinder/model/Snapshot.java b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/Snapshot.java new file mode 100644 index 000000000..96ac6c2ec --- /dev/null +++ b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/Snapshot.java @@ -0,0 +1,113 @@ +package com.woorea.openstack.cinder.model; + +import java.util.Calendar; +import java.util.Map; +import org.codehaus.jackson.annotate.JsonProperty; +import org.codehaus.jackson.map.annotate.JsonRootName; + +/** + * Model for Snapshot + * + * @author VAL Informatique + */ +@JsonRootName("snapshot") +public class Snapshot { + + private String status; + @JsonProperty("os-extended-snapshot-attributes:progress") + private String progress; + private String description; + @JsonProperty("created_at") + private Calendar createdAt; + private Map metadata; + @JsonProperty("volume_id") + private String volumeId; + @JsonProperty("os-extended-snapshot-attributes:project_id") + private String projectId; + private Integer size; + private String id; + private String name; + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getProgress() { + return progress; + } + + public void setProgress(String progress) { + this.progress = progress; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public Calendar getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(Calendar createdAt) { + this.createdAt = createdAt; + } + + public Map getMetadata() { + return metadata; + } + + public void setMetadata(Map metadata) { + this.metadata = metadata; + } + + public String getVolumeId() { + return volumeId; + } + + public void setVolumeId(String volumeId) { + this.volumeId = volumeId; + } + + public String getProjectId() { + return projectId; + } + + public void setProjectId(String projectId) { + this.projectId = projectId; + } + + public Integer getSize() { + return size; + } + + public void setSize(Integer size) { + this.size = size; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + + +} diff --git a/cinder-model/src/main/java/com/woorea/openstack/cinder/model/SnapshotForCreate.java b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/SnapshotForCreate.java new file mode 100644 index 000000000..8b3d78f08 --- /dev/null +++ b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/SnapshotForCreate.java @@ -0,0 +1,52 @@ +package com.woorea.openstack.cinder.model; + +import java.io.Serializable; +import org.codehaus.jackson.annotate.JsonProperty; +import org.codehaus.jackson.map.annotate.JsonRootName; + +/** + * Model for Creation of a Snapshot + * + * @author VAL Informatique + */ +@JsonRootName("snapshot") +public class SnapshotForCreate implements Serializable { + + private String name; + private String description; + @JsonProperty("volume_id") + private String volumeId; + private boolean force; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getVolumeId() { + return volumeId; + } + + public void setVolumeId(String volumeId) { + this.volumeId = volumeId; + } + + public boolean isForce() { + return force; + } + + public void setForce(boolean force) { + this.force = force; + } +} diff --git a/cinder-model/src/main/java/com/woorea/openstack/cinder/model/Snapshots.java b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/Snapshots.java new file mode 100644 index 000000000..97fbb7114 --- /dev/null +++ b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/Snapshots.java @@ -0,0 +1,35 @@ +package com.woorea.openstack.cinder.model; + +import java.io.Serializable; +import java.util.Iterator; +import java.util.List; +import org.codehaus.jackson.annotate.JsonProperty; + +/** + * Model for List of snapshots + * + * @author VAL Informatique + */ +public class Snapshots implements Iterable, Serializable { + + @JsonProperty("snapshots") + private List list; + + public List getList() { + return list; + } + + public void setList(List list) { + this.list = list; + } + + @Override + public Iterator iterator() { + return list.iterator(); + } + + @Override + public String toString() { + return "Snapshots [list=" + list + "]"; + } +} diff --git a/cinder-model/src/main/java/com/woorea/openstack/cinder/model/Volume.java b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/Volume.java new file mode 100644 index 000000000..b98289211 --- /dev/null +++ b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/Volume.java @@ -0,0 +1,159 @@ +package com.woorea.openstack.cinder.model; + +import java.io.Serializable; +import java.util.List; +import java.util.Map; +import org.codehaus.jackson.annotate.JsonProperty; +import org.codehaus.jackson.map.annotate.JsonRootName; + +/** + * Model for Volume + * + * @author VAL Informatique + */ +@JsonRootName("volume") +public class Volume implements Serializable { + + private String status; + private List attachments; + private List links; + @JsonProperty("availability_zone") + private String availabilityZone; + @JsonProperty("os-vol-host-attr:host") + private String host; + @JsonProperty("source_volid") + private String sourceVolumeId; + @JsonProperty("snapshot_id") + private String snapshotId; + private String id; + private String description; + private String name; + @JsonProperty("created_at") + private String createdAt; + @JsonProperty("volume_type") + private String volumeType; + @JsonProperty("os-vol-tenant-attr:tenant_id") + private String tenantId; + private Integer size; + private Map metadata; + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public List getAttachments() { + return attachments; + } + + public void setAttachments(List attachments) { + this.attachments = attachments; + } + + public List getLinks() { + return links; + } + + public void setLinks(List links) { + this.links = links; + } + + public String getAvailabilityZone() { + return availabilityZone; + } + + public void setAvailabilityZone(String availabilityZone) { + this.availabilityZone = availabilityZone; + } + + public String getHost() { + return host; + } + + public void setHost(String host) { + this.host = host; + } + + public String getSourceVolumeId() { + return sourceVolumeId; + } + + public void setSourceVolumeId(String sourceVolumeId) { + this.sourceVolumeId = sourceVolumeId; + } + + public String getSnapshotId() { + return snapshotId; + } + + public void setSnapshotId(String snapshotId) { + this.snapshotId = snapshotId; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(String createdAt) { + this.createdAt = createdAt; + } + + public String getVolumeType() { + return volumeType; + } + + public void setVolumeType(String volumeType) { + this.volumeType = volumeType; + } + + public String getTenantId() { + return tenantId; + } + + public void setTenantId(String tenantId) { + this.tenantId = tenantId; + } + + public Integer getSize() { + return size; + } + + public void setSize(Integer size) { + this.size = size; + } + + public Map getMetadata() { + return metadata; + } + + public void setMetadata(Map metadata) { + this.metadata = metadata; + } +} diff --git a/cinder-model/src/main/java/com/woorea/openstack/cinder/model/Volumes.java b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/Volumes.java new file mode 100644 index 000000000..90d9f74c0 --- /dev/null +++ b/cinder-model/src/main/java/com/woorea/openstack/cinder/model/Volumes.java @@ -0,0 +1,35 @@ +package com.woorea.openstack.cinder.model; + +import java.io.Serializable; +import java.util.Iterator; +import java.util.List; +import org.codehaus.jackson.annotate.JsonProperty; + +/** + * Model for List of volumes + * + * @author VAL Informatique + */ +public class Volumes implements Iterable, Serializable { + + @JsonProperty("volumes") + private List list; + + public List getList() { + return list; + } + + public void setList(List list) { + this.list = list; + } + + @Override + public Iterator iterator() { + return list.iterator(); + } + + @Override + public String toString() { + return "Volumes [list=" + list + "]"; + } +} diff --git a/pom.xml b/pom.xml index 9e02cbe39..ff9ac2d04 100644 --- a/pom.xml +++ b/pom.xml @@ -1,136 +1,137 @@ - 4.0.0 - com.woorea - openstack-java-sdk - 3.2.2-SNAPSHOT - pom - OpenStack Java SDK - OpenStack Java SDK + 4.0.0 + com.woorea + openstack-java-sdk + 3.2.2-SNAPSHOT + pom + OpenStack Java SDK + OpenStack Java SDK - - false - + + false + - - org.sonatype.oss - oss-parent - 7 - + + org.sonatype.oss + oss-parent + 7 + - - - nova-client - glance-client - keystone-client - swift-client - quantum-client - openstack-client + + nova-client + glance-client + keystone-client + swift-client + quantum-client + openstack-client heat-client - nova-model - glance-model - keystone-model - swift-model - quantum-model - ceilometer-model - ceilometer-client - openstack-client-connectors + nova-model + glance-model + keystone-model + swift-model + quantum-model + ceilometer-model + ceilometer-client + openstack-client-connectors heat-model - + cinder-model + cinder-client + - - - console - - true - - - openstack-console - - - - examples - - true - - - openstack-examples - - - + + + console + + true + + + openstack-console + + + + examples + + true + + + openstack-examples + + + - - - Apache2 - http://www.apache.org/licenses/LICENSE-2.0.txt - - + + + Apache2 + http://www.apache.org/licenses/LICENSE-2.0.txt + + - 2012 + 2012 - - - woorea - Luis Gervaso - luis@woorea.es - +1 - - + + + woorea + Luis Gervaso + luis@woorea.es + +1 + + - - scm:git:https://github.com/woorea/openstack-java-sdk.git - scm:git:https://github.com/woorea/openstack-java-sdk.git - http://github.com/woorea/openstack-java-sdk.git - + + scm:git:https://github.com/woorea/openstack-java-sdk.git + scm:git:https://github.com/woorea/openstack-java-sdk.git + http://github.com/woorea/openstack-java-sdk.git + - - - org.codehaus.jackson - jackson-mapper-asl - 1.9.13 - - + + + org.codehaus.jackson + jackson-mapper-asl + 1.9.13 + + - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.1 - - 1.7 - 1.7 - UTF-8 - - - - org.apache.maven.plugins - maven-gpg-plugin - 1.4 - - ${skip.sign} - - - - sign-artifacts - verify - - sign - - - - - - org.apache.maven.plugins - maven-eclipse-plugin - 2.9 - - - org.apache.maven.plugins - maven-resources-plugin - 2.6 - - - org.apache.maven.plugins + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + 1.7 + 1.7 + UTF-8 + + + + org.apache.maven.plugins + maven-gpg-plugin + 1.4 + + ${skip.sign} + + + + sign-artifacts + verify + + sign + + + + + + org.apache.maven.plugins + maven-eclipse-plugin + 2.9 + + + org.apache.maven.plugins + maven-resources-plugin + 2.6 + + + org.apache.maven.plugins maven-source-plugin 2.2.1 @@ -143,6 +144,6 @@ - - + + \ No newline at end of file From 789aa6a6dcc7c33d225c3c47af425871dc95e1dc Mon Sep 17 00:00:00 2001 From: valinformatique Date: Mon, 23 Jun 2014 15:27:21 +0200 Subject: [PATCH 02/11] updated url ref for cinder api --- .../src/main/java/com/woorea/openstack/cinder/Cinder.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cinder-client/src/main/java/com/woorea/openstack/cinder/Cinder.java b/cinder-client/src/main/java/com/woorea/openstack/cinder/Cinder.java index 2d873d466..a3accd398 100644 --- a/cinder-client/src/main/java/com/woorea/openstack/cinder/Cinder.java +++ b/cinder-client/src/main/java/com/woorea/openstack/cinder/Cinder.java @@ -10,7 +10,7 @@ * OpenStack Cinder Client * * Reference: - * http://api.openstack.org/api-ref-blockstorage.html + * http://docs.openstack.org/api/openstack-block-storage/2.0/content/Preface.html * * @author VAL Informatique */ From 35dbb1e6ffe4e7f91c568a6115e2f7609d2e998e Mon Sep 17 00:00:00 2001 From: valinformatique Date: Mon, 23 Jun 2014 17:21:19 +0200 Subject: [PATCH 03/11] add basic support for ceilometer --- .../QueriableCeilometerCommand.java | 3 +- .../ceilometer/v2/api/MetersResource.java | 83 +++------ .../ceilometer/v2/api/ResourcesResource.java | 65 ++++--- .../openstack/ceilometer/v2/model/Alarm.java | 9 + .../openstack/ceilometer/v2/model/Link.java | 36 ++++ .../openstack/ceilometer/v2/model/Meter.java | 128 +++++++++----- .../openstack/ceilometer/v2/model/Meters.java | 35 ++++ .../ceilometer/v2/model/Resource.java | 121 ++++++++----- .../openstack/ceilometer/v2/model/Sample.java | 160 ++++++++---------- .../ceilometer/v2/model/Statistics.java | 155 ++++++++--------- 10 files changed, 443 insertions(+), 352 deletions(-) create mode 100644 ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Alarm.java create mode 100644 ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Link.java create mode 100644 ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Meters.java diff --git a/ceilometer-client/src/main/java/com/woorea/openstack/ceilometer/QueriableCeilometerCommand.java b/ceilometer-client/src/main/java/com/woorea/openstack/ceilometer/QueriableCeilometerCommand.java index 444c052cb..9b6318ae7 100644 --- a/ceilometer-client/src/main/java/com/woorea/openstack/ceilometer/QueriableCeilometerCommand.java +++ b/ceilometer-client/src/main/java/com/woorea/openstack/ceilometer/QueriableCeilometerCommand.java @@ -1,11 +1,10 @@ package com.woorea.openstack.ceilometer; +import com.woorea.openstack.base.client.OpenStackRequest; import java.io.Serializable; import java.util.ArrayList; import java.util.List; -import com.woorea.openstack.base.client.OpenStackRequest; - public abstract class QueriableCeilometerCommand extends OpenStackRequest { protected List fields = new ArrayList(); diff --git a/ceilometer-client/src/main/java/com/woorea/openstack/ceilometer/v2/api/MetersResource.java b/ceilometer-client/src/main/java/com/woorea/openstack/ceilometer/v2/api/MetersResource.java index e44dbe649..65e48d0ac 100644 --- a/ceilometer-client/src/main/java/com/woorea/openstack/ceilometer/v2/api/MetersResource.java +++ b/ceilometer-client/src/main/java/com/woorea/openstack/ceilometer/v2/api/MetersResource.java @@ -1,71 +1,38 @@ package com.woorea.openstack.ceilometer.v2.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.ceilometer.QueriableCeilometerCommand; +import com.woorea.openstack.ceilometer.v2.model.Meter; import com.woorea.openstack.ceilometer.v2.model.Sample; public class MetersResource { - - private final OpenStackClient CLIENT; - - public MetersResource(OpenStackClient client) { - CLIENT = client; - } - - public List list() { - return new List(); - } - - public Show show() { - return new Show(); - } - - public Statistics statistics() { - return new Statistics(); - } - - public class List extends QueriableCeilometerCommand> { - public List() { - //return query(target.path("meters")).request(MediaType.APPLICATION_JSON).get(new GenericType>() {}); - } - } - - public class Show extends QueriableCeilometerCommand> { - private String name; - - public Show name(String name) { - this.name = name; - return this; - } - - public Show() { -// if(name == null) { -// throw new UnsupportedOperationException("meter id is mandatory"); -// } -// return query(target.path("meters").path(name)).request(MediaType.APPLICATION_JSON).get(new GenericType>() {}); - } + private final OpenStackClient CLIENT; + + public MetersResource(OpenStackClient client) { + CLIENT = client; + } + + public List list() { + return new List(); + } - } + public Show show(String name) { + return new Show(name); + } - public class Statistics extends QueriableCeilometerCommand> { + public class List extends OpenStackRequest { - private String name; - - public Statistics name(String name) { - this.name = name; - return this; - } - - public Statistics() { -// if(name == null) { -// throw new UnsupportedOperationException("meter id is mandatory"); -// } -// return query(target.path("meters").path(name).path("statistics")).request(MediaType.APPLICATION_JSON).get(new GenericType>(){}); - } + public List() { + super(CLIENT, HttpMethod.GET, "/meters", null, Meter[].class); + } + } - } + public class Show extends OpenStackRequest { -} + public Show(String name) { + super(CLIENT, HttpMethod.GET, new StringBuilder("/meters/").append(name).toString(), null, Sample[].class); + } + } +} \ No newline at end of file diff --git a/ceilometer-client/src/main/java/com/woorea/openstack/ceilometer/v2/api/ResourcesResource.java b/ceilometer-client/src/main/java/com/woorea/openstack/ceilometer/v2/api/ResourcesResource.java index 900168719..626874f15 100644 --- a/ceilometer-client/src/main/java/com/woorea/openstack/ceilometer/v2/api/ResourcesResource.java +++ b/ceilometer-client/src/main/java/com/woorea/openstack/ceilometer/v2/api/ResourcesResource.java @@ -1,45 +1,38 @@ package com.woorea.openstack.ceilometer.v2.api; -import java.util.List; - +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.ceilometer.QueriableCeilometerCommand; import com.woorea.openstack.ceilometer.v2.model.Resource; public class ResourcesResource { - - private final OpenStackClient CLIENT; - - public ResourcesResource(OpenStackClient client) { - CLIENT = client; - } - - public class ResourceList extends QueriableCeilometerCommand> { - - public ResourceList() { - OpenStackRequest request = new OpenStackRequest(); - //return query(target.path("resources")).request(MediaType.APPLICATION_JSON).get(new GenericType>() {}); - } - - } - - public class ResourceShow extends OpenStackRequest { - - private String id; - - public ResourceShow id(String id) { - this.id = id; - return this; - } - - public ResourceShow(OpenStackClient client) { -// if(id == null) { -// throw new UnsupportedOperationException("resource id is mandatory"); -// } -// return target.path("resources").path(id).request(MediaType.APPLICATION_JSON).get(Resource.class); - } - - } + private final OpenStackClient CLIENT; + + public ResourcesResource(OpenStackClient client) { + CLIENT = client; + } + + public List list() { + return new List(); + } + + public Show show(String id) { + return new Show(id); + } + + public class List extends OpenStackRequest { + + public List() { + super(CLIENT, HttpMethod.GET, "/ressources", null, Resource[].class); + + } + } + + public class Show extends OpenStackRequest { + + public Show(String id) { + super(CLIENT, HttpMethod.GET, new StringBuilder("/ressources/").append(id).toString(), null, Resource.class); + } + } } diff --git a/ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Alarm.java b/ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Alarm.java new file mode 100644 index 000000000..c07a7d5ce --- /dev/null +++ b/ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Alarm.java @@ -0,0 +1,9 @@ +package com.woorea.openstack.ceilometer.v2.model; + +/** + * Model for Alarm + * + * @author VAL Informatique + */ +public class Alarm { +} diff --git a/ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Link.java b/ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Link.java new file mode 100644 index 000000000..1d1b3bbaf --- /dev/null +++ b/ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Link.java @@ -0,0 +1,36 @@ +package com.woorea.openstack.ceilometer.v2.model; + +import java.io.Serializable; + +/** + * Model for Link + * + * @author VAL Informatique + */ +public class Link implements Serializable { + + private String rel; + private String href; + + /** + * @return the rel + */ + public String getRel() { + return rel; + } + + /** + * @return the href + */ + public String getHref() { + return href; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Link [rel=" + rel + ", href=" + href + "]"; + } +} diff --git a/ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Meter.java b/ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Meter.java index df9182f9c..3f97f9a9e 100644 --- a/ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Meter.java +++ b/ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Meter.java @@ -4,51 +4,87 @@ public class Meter { - @JsonProperty("user_id") - private String user; - - - private String name; - - @JsonProperty("resource_id") - private String resource; - - @JsonProperty("project_id") - private String project; - - private String type; - - private String unit; - - public String getUser() { - return user; - } - - public String getName() { - return name; - } - - public String getResource() { - return resource; - } - - public String getProject() { - return project; - } - - public String getType() { - return type; - } - - public String getUnit() { - return unit; - } - - @Override - public String toString() { - return "Meter [user=" + user + ", name=" + name + ", resource=" - + resource + ", project=" + project + ", type=" + type - + ", unit=" + unit + "]"; - } + @JsonProperty("user_id") + private String user; + private String name; + @JsonProperty("resource_id") + private String resource; + private String source; + @JsonProperty("project_id") + private String project; + @JsonProperty("meter_id") + private String meter; + private String type; + private String unit; + public String getUser() { + return user; + } + + public String getName() { + return name; + } + + public String getResource() { + return resource; + } + + public String getProject() { + return project; + } + + public String getType() { + return type; + } + + public String getUnit() { + return unit; + } + + public String getMeter() { + return meter; + } + + public String getSource() { + return source; + } + + public void setUser(String user) { + this.user = user; + } + + public void setName(String name) { + this.name = name; + } + + public void setResource(String resource) { + this.resource = resource; + } + + public void setSource(String source) { + this.source = source; + } + + public void setProject(String project) { + this.project = project; + } + + public void setMeter(String meter) { + this.meter = meter; + } + + public void setType(String type) { + this.type = type; + } + + public void setUnit(String unit) { + this.unit = unit; + } + + @Override + public String toString() { + return "Meter [id=" + meter + "user=" + user + ", name=" + name + ", resource=" + + resource + ", project=" + project + ", type=" + type + + ", unit=" + unit + ", source=" + source + "]"; + } } diff --git a/ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Meters.java b/ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Meters.java new file mode 100644 index 000000000..ffa293c1a --- /dev/null +++ b/ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Meters.java @@ -0,0 +1,35 @@ +package com.woorea.openstack.ceilometer.v2.model; + +import java.io.Serializable; +import java.util.List; +import org.codehaus.jackson.map.annotate.JsonDeserialize; + +/** + * Model for List of Meters + * + * @author VAL Informatique + */ +public class Meters implements Serializable { + + private List list; + + /** + * @return the list + */ + public List getList() { + return list; + } + + /** + * @param list the list to set + */ + @JsonDeserialize(contentAs = Meter.class) + public void setList(List list) { + this.list = list; + } + + @Override + public String toString() { + return "Meters [list=" + list + "]"; + } +} diff --git a/ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Resource.java b/ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Resource.java index 24e14aa3d..0df1ff284 100644 --- a/ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Resource.java +++ b/ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Resource.java @@ -1,50 +1,85 @@ package com.woorea.openstack.ceilometer.v2.model; +import java.util.List; import java.util.Map; - import org.codehaus.jackson.annotate.JsonProperty; public class Resource { - //{"resource_id": "23b55841eedd41e99d5f3f32149ca086", "timestamp": "2013-03-03T15:19:00", "project_id": "23b55841eedd41e99d5f3f32149ca086", "user_id": null, "metadata": {}} - - @JsonProperty("resource_id") - private String resource; - - private String timestamp; - - @JsonProperty("project_id") - private String project; - - @JsonProperty("user_id") - private String user; - - private Map metadata; - - public String getResource() { - return resource; - } - - public String getTimestamp() { - return timestamp; - } - - public String getProject() { - return project; - } - - public String getUser() { - return user; - } - - public Map getMetadata() { - return metadata; - } - - @Override - public String toString() { - return "Resource [resource=" + resource + ", timestamp=" + timestamp - + ", project=" + project + ", user=" + user + ", metadata=" - + metadata + "]"; - } - + + @JsonProperty("first_sample_timestamp") + private String firstSampleTimestamp; + @JsonProperty("last_sample_timestamp") + private String lastSampleTimestamp; + private List links; + private Map metadata; + @JsonProperty("project_id") + private String project; + @JsonProperty("resource_id") + private String resource; + @JsonProperty("user_id") + private String user; + + public String getResource() { + return resource; + } + + public String getProject() { + return project; + } + + public String getUser() { + return user; + } + + public Map getMetadata() { + return metadata; + } + + public List getLinks() { + return links; + } + + public String getFirstSampleTimestamp() { + return firstSampleTimestamp; + } + + public String getLastSampleTimestamp() { + return lastSampleTimestamp; + } + + public void setFirstSampleTimestamp(String firstSampleTimestamp) { + this.firstSampleTimestamp = firstSampleTimestamp; + } + + public void setLastSampleTimestamp(String lastSampleTimestamp) { + this.lastSampleTimestamp = lastSampleTimestamp; + } + + public void setLinks(List links) { + this.links = links; + } + + public void setMetadata(Map metadata) { + this.metadata = metadata; + } + + public void setProject(String project) { + this.project = project; + } + + public void setResource(String resource) { + this.resource = resource; + } + + public void setUser(String user) { + this.user = user; + } + + @Override + public String toString() { + return "Resource [resource=" + resource + ", first_sample_timestamp=" + firstSampleTimestamp + + ", last_sample_timestamp=" + lastSampleTimestamp + + ", project=" + project + ", user=" + user + ", metadata=" + + metadata + ", links=" + links + "]"; + } } diff --git a/ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Sample.java b/ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Sample.java index 8827de466..2b9e7c218 100644 --- a/ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Sample.java +++ b/ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Sample.java @@ -1,94 +1,82 @@ package com.woorea.openstack.ceilometer.v2.model; import java.util.Map; - import org.codehaus.jackson.annotate.JsonProperty; public class Sample { - @JsonProperty("counter_type") - private String counterType; - - @JsonProperty("counter_name") - private String counterName; - - @JsonProperty("counter_unit") - private String counterUnit; - - @JsonProperty("counter_volume") - private String counterVolume; - - private String source; - - @JsonProperty("project_id") - private String project; - - @JsonProperty("user_id") - private String user; - - @JsonProperty("resource_id") - private String resource; - - private String timestamp; - - @JsonProperty("message_id") - private String message; - - @JsonProperty("resource_metadata") - private Map metadata; - - public String getCounterType() { - return counterType; - } - - public String getCounterName() { - return counterName; - } - - public String getCounterUnit() { - return counterUnit; - } - - public String getCounterVolume() { - return counterVolume; - } - - public String getSource() { - return source; - } - - public String getProject() { - return project; - } - - public String getUser() { - return user; - } - - public String getResource() { - return resource; - } - - public String getTimestamp() { - return timestamp; - } - - public String getMessage() { - return message; - } - - public Map getMetadata() { - return metadata; - } - - @Override - public String toString() { - return "Sample [counterType=" + counterType + ", counterName=" - + counterName + ", counterUnit=" + counterUnit - + ", counterVolume=" + counterVolume + ", source=" + source - + ", project=" + project + ", user=" + user + ", resource=" - + resource + ", timestamp=" + timestamp + ", message=" - + message + ", metadata=" + metadata + "]"; - } - + @JsonProperty("counter_type") + private String counterType; + @JsonProperty("counter_name") + private String counterName; + @JsonProperty("counter_unit") + private String counterUnit; + @JsonProperty("counter_volume") + private String counterVolume; + private String source; + @JsonProperty("project_id") + private String project; + @JsonProperty("user_id") + private String user; + @JsonProperty("resource_id") + private String resource; + private String timestamp; + @JsonProperty("message_id") + private String message; + @JsonProperty("resource_metadata") + private Map metadata; + + public String getCounterType() { + return counterType; + } + + public String getCounterName() { + return counterName; + } + + public String getCounterUnit() { + return counterUnit; + } + + public String getCounterVolume() { + return counterVolume; + } + + public String getSource() { + return source; + } + + public String getProject() { + return project; + } + + public String getUser() { + return user; + } + + public String getResource() { + return resource; + } + + public String getTimestamp() { + return timestamp; + } + + public String getMessage() { + return message; + } + + public Map getMetadata() { + return metadata; + } + + @Override + public String toString() { + return "Sample [counterType=" + counterType + ", counterName=" + + counterName + ", counterUnit=" + counterUnit + + ", counterVolume=" + counterVolume + ", source=" + source + + ", project=" + project + ", user=" + user + ", resource=" + + resource + ", timestamp=" + timestamp + ", message=" + + message + ", metadata=" + metadata + "]"; + } } diff --git a/ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Statistics.java b/ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Statistics.java index 5a34fe54b..d0275abd1 100644 --- a/ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Statistics.java +++ b/ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Statistics.java @@ -1,88 +1,81 @@ package com.woorea.openstack.ceilometer.v2.model; import java.math.BigDecimal; - import org.codehaus.jackson.annotate.JsonProperty; public class Statistics { - - private BigDecimal avg; - - private BigDecimal count; - - private BigDecimal duration; - - @JsonProperty("duration_start") - private String durationStart; - - @JsonProperty("duration_end") - private String durationEnd; - - private BigDecimal max; - - private BigDecimal min; - - private BigDecimal period; - - @JsonProperty("period_start") - private String periodStart; - - @JsonProperty("period_end") - private String periodEnd; - - private BigDecimal sum; - - public BigDecimal getAvg() { - return avg; - } - - public BigDecimal getCount() { - return count; - } - - public BigDecimal getDuration() { - return duration; - } - - public String getDurationStart() { - return durationStart; - } - - public String getDurationEnd() { - return durationEnd; - } - - public BigDecimal getMax() { - return max; - } - - public BigDecimal getMin() { - return min; - } - - public BigDecimal getPeriod() { - return period; - } - - public String getPeriodStart() { - return periodStart; - } - - public String getPeriodEnd() { - return periodEnd; - } - - public BigDecimal getSum() { - return sum; - } - - @Override - public String toString() { - return "Statistics [avg=" + avg + ", count=" + count + ", duration=" - + duration + ", durationStart=" + durationStart - + ", durationEnd=" + durationEnd + ", max=" + max + ", min=" - + min + ", period=" + period + ", periodStart=" + periodStart - + ", periodEnd=" + periodEnd + ", sum=" + sum + "]"; - } - + + private BigDecimal avg; + private BigDecimal count; + private BigDecimal duration; + @JsonProperty("duration_start") + private String durationStart; + @JsonProperty("duration_end") + private String durationEnd; + private BigDecimal max; + private BigDecimal min; + private BigDecimal period; + @JsonProperty("period_start") + private String periodStart; + @JsonProperty("period_end") + private String periodEnd; + private BigDecimal sum; + private String unit; + + public BigDecimal getAvg() { + return avg; + } + + public BigDecimal getCount() { + return count; + } + + public BigDecimal getDuration() { + return duration; + } + + public String getDurationStart() { + return durationStart; + } + + public String getDurationEnd() { + return durationEnd; + } + + public BigDecimal getMax() { + return max; + } + + public BigDecimal getMin() { + return min; + } + + public BigDecimal getPeriod() { + return period; + } + + public String getPeriodStart() { + return periodStart; + } + + public String getPeriodEnd() { + return periodEnd; + } + + public BigDecimal getSum() { + return sum; + } + + public String getUnit() { + return unit; + } + + @Override + public String toString() { + return "Statistics [avg=" + avg + ", count=" + count + ", duration=" + + duration + ", durationStart=" + durationStart + + ", durationEnd=" + durationEnd + ", max=" + max + ", min=" + + min + ", period=" + period + ", periodStart=" + periodStart + + ", periodEnd=" + periodEnd + ", sum=" + sum + "]"; + } } From e724f038fa8be311bed86d3cbf9710d758ef7dde Mon Sep 17 00:00:00 2001 From: valinformatique Date: Mon, 23 Jun 2014 17:21:49 +0200 Subject: [PATCH 04/11] add basic support for ceilometer From fd5a4d28d711bbb590b7bae5a8b5ff58c223a1fe Mon Sep 17 00:00:00 2001 From: valinformatique Date: Mon, 23 Jun 2014 17:22:21 +0200 Subject: [PATCH 05/11] add basic support for ceilometer --- .../openstack/ceilometer/Ceilometer.java | 47 +++++++++---------- 1 file changed, 22 insertions(+), 25 deletions(-) diff --git a/ceilometer-client/src/main/java/com/woorea/openstack/ceilometer/Ceilometer.java b/ceilometer-client/src/main/java/com/woorea/openstack/ceilometer/Ceilometer.java index 05cda3551..1119f856f 100644 --- a/ceilometer-client/src/main/java/com/woorea/openstack/ceilometer/Ceilometer.java +++ b/ceilometer-client/src/main/java/com/woorea/openstack/ceilometer/Ceilometer.java @@ -1,34 +1,31 @@ package com.woorea.openstack.ceilometer; - import com.woorea.openstack.base.client.OpenStackClient; import com.woorea.openstack.base.client.OpenStackClientConnector; import com.woorea.openstack.ceilometer.v2.api.MetersResource; import com.woorea.openstack.ceilometer.v2.api.ResourcesResource; public class Ceilometer extends OpenStackClient { - - private final MetersResource METERS; - - private final ResourcesResource RESOURCES; - - public Ceilometer(String endpoint, OpenStackClientConnector connector) { - super(endpoint, connector); - METERS = new MetersResource(this); - RESOURCES = new ResourcesResource(this); - } - - public Ceilometer(String endpoint) { - this(endpoint, null); - - } - - public ResourcesResource resources() { - return RESOURCES; - } - - public MetersResource meters() { - return METERS; - } - + + private final MetersResource METERS; + private final ResourcesResource RESOURCES; + + public Ceilometer(String endpoint, OpenStackClientConnector connector) { + super(endpoint, connector); + METERS = new MetersResource(this); + RESOURCES = new ResourcesResource(this); + } + + public Ceilometer(String endpoint) { + this(endpoint, null); + + } + + public ResourcesResource resources() { + return RESOURCES; + } + + public MetersResource meters() { + return METERS; + } } From 13538c28210d975786cb5de704b557a496952704 Mon Sep 17 00:00:00 2001 From: valinformatique Date: Mon, 23 Jun 2014 17:39:54 +0200 Subject: [PATCH 06/11] Add constructor for CreateImage --- .../openstack/nova/model/ServerAction.java | 1156 ++++++++--------- 1 file changed, 558 insertions(+), 598 deletions(-) diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/ServerAction.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/ServerAction.java index 26fa5a4a6..f5e0d17c7 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/ServerAction.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/ServerAction.java @@ -5,606 +5,566 @@ import java.util.HashMap; import java.util.List; import java.util.Map; - import org.codehaus.jackson.annotate.JsonProperty; import org.codehaus.jackson.map.annotate.JsonRootName; public interface ServerAction extends Serializable { - - @JsonRootName("changePassword") - public static final class ChangePassword implements ServerAction { - - private String adminPass; - - public ChangePassword() { - super(); - // TODO Auto-generated constructor stub - } - - public ChangePassword(String adminPass) { - this.adminPass = adminPass; - } - - /** - * @return the adminPass - */ - public String getAdminPass() { - return adminPass; - } - - /** - * @param adminPass the adminPass to set - */ - public void setAdminPass(String adminPass) { - this.adminPass = adminPass; - } - - } - - @JsonRootName("reboot") - public static final class Reboot implements ServerAction { - - private String type; - - /** - * @return the type - */ - public String getType() { - return type; - } - - /** - * @param type the type to set - */ - public void setType(String type) { - this.type = type; - } - - } - - @JsonRootName("rebuild") - public static final class Rebuild implements ServerAction { - - private String imageRef; - - private String name; - - private String adminPass; - - private String accessIPv4; - - private String accessIPv6; - - private Map metadata = new HashMap(); - - private List personality = new ArrayList(); - - @JsonProperty("OS-DCF:diskConfig") - private String diskConfig; - - /** - * @return the imageRef - */ - public String getImageRef() { - return imageRef; - } - - /** - * @param imageRef the imageRef to set - */ - public void setImageRef(String imageRef) { - this.imageRef = imageRef; - } - - /** - * @return the name - */ - public String getName() { - return name; - } - - /** - * @param name the name to set - */ - public void setName(String name) { - this.name = name; - } - - /** - * @return the adminPass - */ - public String getAdminPass() { - return adminPass; - } - - /** - * @param adminPass the adminPass to set - */ - public void setAdminPass(String adminPass) { - this.adminPass = adminPass; - } - - /** - * @return the accessIPv4 - */ - public String getAccessIPv4() { - return accessIPv4; - } - - /** - * @param accessIPv4 the accessIPv4 to set - */ - public void setAccessIPv4(String accessIPv4) { - this.accessIPv4 = accessIPv4; - } - - /** - * @return the accessIPv6 - */ - public String getAccessIPv6() { - return accessIPv6; - } - - /** - * @param accessIPv6 the accessIPv6 to set - */ - public void setAccessIPv6(String accessIPv6) { - this.accessIPv6 = accessIPv6; - } - - /** - * @return the metadata - */ - public Map getMetadata() { - return metadata; - } - - /** - * @param metadata the metadata to set - */ - public void setMetadata(Map metadata) { - this.metadata = metadata; - } - - /** - * @return the personality - */ - public List getPersonality() { - return personality; - } - - /** - * @param personality the personality to set - */ - public void setPersonality(List personality) { - this.personality = personality; - } - - /** - * @return the diskConfig - */ - public String getDiskConfig() { - return diskConfig; - } - - /** - * @param diskConfig the diskConfig to set - */ - public void setDiskConfig(String diskConfig) { - this.diskConfig = diskConfig; - } - - } - - @JsonRootName("resize") - public static final class Resize implements ServerAction { - - private String flavorRef; - - @JsonProperty("OS-DCF:diskConfig") - private String diskConfig; - - /** - * @return the flavorRef - */ - public String getFlavorRef() { - return flavorRef; - } - - /** - * @param flavorRef the flavorRef to set - */ - public void setFlavorRef(String flavorRef) { - this.flavorRef = flavorRef; - } - - /** - * @return the diskConfig - */ - public String getDiskConfig() { - return diskConfig; - } - - /** - * @param diskConfig the diskConfig to set - */ - public void setDiskConfig(String diskConfig) { - this.diskConfig = diskConfig; - } - - } - - @JsonRootName("confirmResize") - public static final class ConfirmResize implements ServerAction { - - } - - @JsonRootName("revertResize") - public static final class RevertResize implements ServerAction { - - } - - @JsonRootName("createImage") - public static final class CreateImage implements ServerAction { - - private String name; - - private Map metadata; - - /** - * @return the name - */ - public String getName() { - return name; - } - - /** - * @param name the name to set - */ - public void setName(String name) { - this.name = name; - } - - /** - * @return the metadata - */ - public Map getMetadata() { - return metadata; - } - - /** - * @param metadata the metadata to set - */ - public void setMetadata(Map metadata) { - this.metadata = metadata; - } - - } - - @JsonRootName("rescue") - public static final class Rescue implements ServerAction { - - private String adminPass; - - public Rescue() { - - } - - public Rescue(String adminPass) { - this.adminPass = adminPass; - } - - /** - * @return the adminPass - */ - public String getAdminPass() { - return adminPass; - } - - /** - * @param adminPass the adminPass to set - */ - public void setAdminPass(String adminPass) { - this.adminPass = adminPass; - } - - } - - public static final class RescueResponse implements ServerAction { - - private String adminPass; - - /** - * @return the adminPass - */ - public String getAdminPass() { - return adminPass; - } - - } - - @JsonRootName("unrescue") - public static final class Unrescue implements ServerAction { - - } - - @JsonRootName("unpause") - public static final class Unpause implements ServerAction { - - } - - @JsonRootName("pause") - public static final class Pause implements ServerAction { - - } - - @JsonRootName("suspend") - public static final class Suspend implements ServerAction { - - } - - @JsonRootName("resume") - public static final class Resume implements ServerAction { - - } - - @JsonRootName("lock") - public static final class Lock implements ServerAction { - - } - - @JsonRootName("unlock") - public static final class Unlock implements ServerAction { - - } - - @JsonRootName("os-getConsoleOutput") - public static final class GetConsoleOutput implements ServerAction { - - private Integer length; - - public GetConsoleOutput() { - - } - - public GetConsoleOutput(Integer length) { - this.length = length; - } - - /** - * @return the length - */ - public Integer getLength() { - return length; - } - - /** - * @param length the length to set - */ - public void setLength(Integer length) { - this.length = length; - } - - } - - public static final class ConsoleOutput implements ServerAction { - - private String output; - - /** - * @return the output - */ - public String getOutput() { - return output; - } - - } - - @JsonRootName("os-getVNCConsole") - public static final class GetVncConsole implements ServerAction { - - private String type; - - public GetVncConsole() { - super(); - // TODO Auto-generated constructor stub - } - - - public GetVncConsole(String type) { - super(); - this.type = type; - } - - /** - * @return the type - */ - public String getType() { - return type; - } - - /** - * @param type the type to set - */ - public void setType(String type) { - this.type = type; - } - - } - - @JsonRootName("console") - public static final class VncConsole implements ServerAction { - - private String type; - - private String url; - - /** - * @return the type - */ - public String getType() { - return type; - } - - /** - * @return the url - */ - public String getUrl() { - return url; - } - - } - - @JsonRootName("os-start") - public static final class Start implements ServerAction { - - } - - @JsonRootName("os-stop") - public static final class Stop implements ServerAction { - - } - - @JsonRootName("forceDelete") - public static final class ForceDelete implements ServerAction { - - } - - @JsonRootName("restore") - public static final class Restore implements ServerAction { - - } - - @JsonRootName("addFloatingIp") - public static final class AssociateFloatingIp implements ServerAction { - - private String address; - - public AssociateFloatingIp() { - super(); - // TODO Auto-generated constructor stub - } - - public AssociateFloatingIp(String address) { - super(); - this.address = address; - } - - /** - * @return the address - */ - public String getAddress() { - return address; - } - - /** - * @param address the address to set - */ - public void setAddress(String address) { - this.address = address; - } - - } - - @JsonRootName("removeFloatingIp") - public static final class DisassociateFloatingIp implements ServerAction { - - private String address; - - public DisassociateFloatingIp() { - super(); - // TODO Auto-generated constructor stub - } - - public DisassociateFloatingIp(String address) { - super(); - this.address = address; - } - - /** - * @return the address - */ - public String getAddress() { - return address; - } - - /** - * @param address the address to set - */ - public void setAddress(String address) { - this.address = address; - } - - } - - @JsonRootName("createBackup") - public static final class CreateBackup implements ServerAction { - - private String name; - - @JsonProperty("backup_type") - private String type; - - private String rotation; - - private Map metadata; - - /** - * @return the name - */ - public String getName() { - return name; - } - - /** - * @param name the name to set - */ - public void setName(String name) { - this.name = name; - } - - /** - * @return the type - */ - public String getType() { - return type; - } - - /** - * @param type the type to set - */ - public void setType(String type) { - this.type = type; - } - - /** - * @return the rotation - */ - public String getRotation() { - return rotation; - } - - /** - * @param rotation the rotation to set - */ - public void setRotation(String rotation) { - this.rotation = rotation; - } - - /** - * @return the metadata - */ - public Map getMetadata() { - return metadata; - } - - /** - * @param metadata the metadata to set - */ - public void setMetadata(Map metadata) { - this.metadata = metadata; - } - - } - + + @JsonRootName("changePassword") + public static final class ChangePassword implements ServerAction { + + private String adminPass; + + public ChangePassword() { + super(); + // TODO Auto-generated constructor stub + } + + public ChangePassword(String adminPass) { + this.adminPass = adminPass; + } + + /** + * @return the adminPass + */ + public String getAdminPass() { + return adminPass; + } + + /** + * @param adminPass the adminPass to set + */ + public void setAdminPass(String adminPass) { + this.adminPass = adminPass; + } + } + + @JsonRootName("reboot") + public static final class Reboot implements ServerAction { + + private String type; + + /** + * @return the type + */ + public String getType() { + return type; + } + + /** + * @param type the type to set + */ + public void setType(String type) { + this.type = type; + } + } + + @JsonRootName("rebuild") + public static final class Rebuild implements ServerAction { + + private String imageRef; + private String name; + private String adminPass; + private String accessIPv4; + private String accessIPv6; + private Map metadata = new HashMap(); + private List personality = new ArrayList(); + @JsonProperty("OS-DCF:diskConfig") + private String diskConfig; + + /** + * @return the imageRef + */ + public String getImageRef() { + return imageRef; + } + + /** + * @param imageRef the imageRef to set + */ + public void setImageRef(String imageRef) { + this.imageRef = imageRef; + } + + /** + * @return the name + */ + public String getName() { + return name; + } + + /** + * @param name the name to set + */ + public void setName(String name) { + this.name = name; + } + + /** + * @return the adminPass + */ + public String getAdminPass() { + return adminPass; + } + + /** + * @param adminPass the adminPass to set + */ + public void setAdminPass(String adminPass) { + this.adminPass = adminPass; + } + + /** + * @return the accessIPv4 + */ + public String getAccessIPv4() { + return accessIPv4; + } + + /** + * @param accessIPv4 the accessIPv4 to set + */ + public void setAccessIPv4(String accessIPv4) { + this.accessIPv4 = accessIPv4; + } + + /** + * @return the accessIPv6 + */ + public String getAccessIPv6() { + return accessIPv6; + } + + /** + * @param accessIPv6 the accessIPv6 to set + */ + public void setAccessIPv6(String accessIPv6) { + this.accessIPv6 = accessIPv6; + } + + /** + * @return the metadata + */ + public Map getMetadata() { + return metadata; + } + + /** + * @param metadata the metadata to set + */ + public void setMetadata(Map metadata) { + this.metadata = metadata; + } + + /** + * @return the personality + */ + public List getPersonality() { + return personality; + } + + /** + * @param personality the personality to set + */ + public void setPersonality(List personality) { + this.personality = personality; + } + + /** + * @return the diskConfig + */ + public String getDiskConfig() { + return diskConfig; + } + + /** + * @param diskConfig the diskConfig to set + */ + public void setDiskConfig(String diskConfig) { + this.diskConfig = diskConfig; + } + } + + @JsonRootName("resize") + public static final class Resize implements ServerAction { + + private String flavorRef; + @JsonProperty("OS-DCF:diskConfig") + private String diskConfig; + + /** + * @return the flavorRef + */ + public String getFlavorRef() { + return flavorRef; + } + + /** + * @param flavorRef the flavorRef to set + */ + public void setFlavorRef(String flavorRef) { + this.flavorRef = flavorRef; + } + + /** + * @return the diskConfig + */ + public String getDiskConfig() { + return diskConfig; + } + + /** + * @param diskConfig the diskConfig to set + */ + public void setDiskConfig(String diskConfig) { + this.diskConfig = diskConfig; + } + } + + @JsonRootName("confirmResize") + public static final class ConfirmResize implements ServerAction { + } + + @JsonRootName("revertResize") + public static final class RevertResize implements ServerAction { + } + + @JsonRootName("createImage") + public static final class CreateImage implements ServerAction { + + private String name; + private Map metadata; + + public CreateImage(String aName) { + super(); + this.name = aName; + } + + /** + * @return the name + */ + public String getName() { + return name; + } + + /** + * @param name the name to set + */ + public void setName(String name) { + this.name = name; + } + + /** + * @return the metadata + */ + public Map getMetadata() { + return metadata; + } + + /** + * @param metadata the metadata to set + */ + public void setMetadata(Map metadata) { + this.metadata = metadata; + } + } + + @JsonRootName("rescue") + public static final class Rescue implements ServerAction { + + private String adminPass; + + public Rescue() { + } + + public Rescue(String adminPass) { + this.adminPass = adminPass; + } + + /** + * @return the adminPass + */ + public String getAdminPass() { + return adminPass; + } + + /** + * @param adminPass the adminPass to set + */ + public void setAdminPass(String adminPass) { + this.adminPass = adminPass; + } + } + + public static final class RescueResponse implements ServerAction { + + private String adminPass; + + /** + * @return the adminPass + */ + public String getAdminPass() { + return adminPass; + } + } + + @JsonRootName("unrescue") + public static final class Unrescue implements ServerAction { + } + + @JsonRootName("unpause") + public static final class Unpause implements ServerAction { + } + + @JsonRootName("pause") + public static final class Pause implements ServerAction { + } + + @JsonRootName("suspend") + public static final class Suspend implements ServerAction { + } + + @JsonRootName("resume") + public static final class Resume implements ServerAction { + } + + @JsonRootName("lock") + public static final class Lock implements ServerAction { + } + + @JsonRootName("unlock") + public static final class Unlock implements ServerAction { + } + + @JsonRootName("os-getConsoleOutput") + public static final class GetConsoleOutput implements ServerAction { + + private Integer length; + + public GetConsoleOutput() { + } + + public GetConsoleOutput(Integer length) { + this.length = length; + } + + /** + * @return the length + */ + public Integer getLength() { + return length; + } + + /** + * @param length the length to set + */ + public void setLength(Integer length) { + this.length = length; + } + } + + public static final class ConsoleOutput implements ServerAction { + + private String output; + + /** + * @return the output + */ + public String getOutput() { + return output; + } + } + + @JsonRootName("os-getVNCConsole") + public static final class GetVncConsole implements ServerAction { + + private String type; + + public GetVncConsole() { + super(); + // TODO Auto-generated constructor stub + } + + public GetVncConsole(String type) { + super(); + this.type = type; + } + + /** + * @return the type + */ + public String getType() { + return type; + } + + /** + * @param type the type to set + */ + public void setType(String type) { + this.type = type; + } + } + + @JsonRootName("console") + public static final class VncConsole implements ServerAction { + + private String type; + private String url; + + /** + * @return the type + */ + public String getType() { + return type; + } + + /** + * @return the url + */ + public String getUrl() { + return url; + } + } + + @JsonRootName("os-start") + public static final class Start implements ServerAction { + } + + @JsonRootName("os-stop") + public static final class Stop implements ServerAction { + } + + @JsonRootName("forceDelete") + public static final class ForceDelete implements ServerAction { + } + + @JsonRootName("restore") + public static final class Restore implements ServerAction { + } + + @JsonRootName("addFloatingIp") + public static final class AssociateFloatingIp implements ServerAction { + + private String address; + + public AssociateFloatingIp() { + super(); + // TODO Auto-generated constructor stub + } + + public AssociateFloatingIp(String address) { + super(); + this.address = address; + } + + /** + * @return the address + */ + public String getAddress() { + return address; + } + + /** + * @param address the address to set + */ + public void setAddress(String address) { + this.address = address; + } + } + + @JsonRootName("removeFloatingIp") + public static final class DisassociateFloatingIp implements ServerAction { + + private String address; + + public DisassociateFloatingIp() { + super(); + // TODO Auto-generated constructor stub + } + + public DisassociateFloatingIp(String address) { + super(); + this.address = address; + } + + /** + * @return the address + */ + public String getAddress() { + return address; + } + + /** + * @param address the address to set + */ + public void setAddress(String address) { + this.address = address; + } + } + + @JsonRootName("createBackup") + public static final class CreateBackup implements ServerAction { + + private String name; + @JsonProperty("backup_type") + private String type; + private String rotation; + private Map metadata; + + /** + * @return the name + */ + public String getName() { + return name; + } + + /** + * @param name the name to set + */ + public void setName(String name) { + this.name = name; + } + + /** + * @return the type + */ + public String getType() { + return type; + } + + /** + * @param type the type to set + */ + public void setType(String type) { + this.type = type; + } + + /** + * @return the rotation + */ + public String getRotation() { + return rotation; + } + + /** + * @param rotation the rotation to set + */ + public void setRotation(String rotation) { + this.rotation = rotation; + } + + /** + * @return the metadata + */ + public Map getMetadata() { + return metadata; + } + + /** + * @param metadata the metadata to set + */ + public void setMetadata(Map metadata) { + this.metadata = metadata; + } + } } From 0ab3402baca0ece9f722c8be6764a2f20b5c8c83 Mon Sep 17 00:00:00 2001 From: valinformatique Date: Mon, 23 Jun 2014 17:43:14 +0200 Subject: [PATCH 07/11] change type of osExtendedVolumesAttached Changed to List> --- .../woorea/openstack/nova/model/Server.java | 893 +++++++++--------- 1 file changed, 423 insertions(+), 470 deletions(-) diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Server.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Server.java index 589ed540d..299ac066b 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/Server.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Server.java @@ -5,452 +5,406 @@ import java.util.HashMap; import java.util.List; import java.util.Map; - import org.codehaus.jackson.annotate.JsonAnySetter; -import org.codehaus.jackson.annotate.JsonIgnoreProperties; import org.codehaus.jackson.annotate.JsonProperty; import org.codehaus.jackson.map.annotate.JsonRootName; @JsonRootName("server") public class Server implements Serializable { - - public static final class Addresses implements Serializable { - - public static final class Address implements Serializable { - - @JsonProperty("OS-EXT-IPS-MAC:mac_addr") - private String macAddr; - - private String version; - - private String addr; - - @JsonProperty("OS-EXT-IPS:type") - private String type; - - /** - * @return the macAddr - */ - public String getMacAddr() { - return macAddr; - } - - /** - * @return the version - */ - public String getVersion() { - return version; - } - - /** - * @return the addr - */ - public String getAddr() { - return addr; - } - - - /** - * @return the type - */ - public String getType() { - return type; - } - - /** - * @param version the version to set - */ - public void setVersion(String version) { - this.version = version; - } - - /** - * @param addr the addr to set - */ - public void setAddr(String addr) { - this.addr = addr; - } - - /** - * @param type the type to set - */ - public void setType(String type) { - this.type = type; - } - - /** - * @param macAddr the mac addr to set - */ - public void setMacAddr(String macAddr) { - this.macAddr= macAddr; - } - } - - private Map> addresses = new HashMap>(); - - @JsonAnySetter - public void add(String key, List
value) { - addresses.put(key, value); - } - /** - * @return the ip address List Map - */ - public Map> getAddresses() { - return addresses; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Addresses List Map [" + addresses + "]"; - } - - } - - public static final class Fault { - - private Integer code; - - private String message; - - private String details; - - private Calendar created; - - /** - * @return the code - */ - public Integer getCode() { - return code; - } - - /** - * @return the message - */ - public String getMessage() { - return message; - } - - /** - * @return the details - */ - public String getDetails() { - return details; - } - - /** - * @return the created - */ - public Calendar getCreated() { - return created; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Fault [code=" + code + ", message=" + message - + ", details=" + details + ", created=" + created + "]"; - } - - - } - - - private String id; - - private String name; - - private Addresses addresses; - - private List links; - - private Image image; - - private Flavor flavor; - - private String accessIPv4; - - private String accessIPv6; - - @JsonProperty("config_drive") - private String configDrive; - - private String status; - - private Integer progress; - - private Fault fault; - - @JsonProperty("tenant_id") - private String tenantId; - - @JsonProperty("user_id") - private String userId; - - @JsonProperty("key_name") - private String keyName; - - private String hostId; - - private String updated; - - private String created; - - private Map metadata; - - @JsonProperty("security_groups") - private List securityGroups; - - @JsonProperty("OS-EXT-STS:task_state") - private String taskState; - - @JsonProperty("OS-EXT-STS:power_state") - private String powerState; - - @JsonProperty("OS-EXT-STS:vm_state") - private String vmState; - - @JsonProperty("OS-EXT-SRV-ATTR:host") - private String host; - - @JsonProperty("OS-EXT-SRV-ATTR:instance_name") - private String instanceName; - - @JsonProperty("OS-EXT-SRV-ATTR:hypervisor_hostname") - private String hypervisorHostname; - - @JsonProperty("OS-DCF:diskConfig") - private String diskConfig; - - @JsonProperty("OS-EXT-AZ:availability_zone") - private String availabilityZone; + public static final class Addresses implements Serializable { + + public static final class Address implements Serializable { + + @JsonProperty("OS-EXT-IPS-MAC:mac_addr") + private String macAddr; + private String version; + private String addr; + @JsonProperty("OS-EXT-IPS:type") + private String type; + + /** + * @return the macAddr + */ + public String getMacAddr() { + return macAddr; + } + + /** + * @return the version + */ + public String getVersion() { + return version; + } + + /** + * @return the addr + */ + public String getAddr() { + return addr; + } + + /** + * @return the type + */ + public String getType() { + return type; + } + + /** + * @param version the version to set + */ + public void setVersion(String version) { + this.version = version; + } + + /** + * @param addr the addr to set + */ + public void setAddr(String addr) { + this.addr = addr; + } + + /** + * @param type the type to set + */ + public void setType(String type) { + this.type = type; + } + + /** + * @param macAddr the mac addr to set + */ + public void setMacAddr(String macAddr) { + this.macAddr = macAddr; + } + } + private Map> addresses = new HashMap>(); + + @JsonAnySetter + public void add(String key, List
value) { + addresses.put(key, value); + } + + /** + * @return the ip address List Map + */ + public Map> getAddresses() { + return addresses; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Addresses List Map [" + addresses + "]"; + } + } + + public static final class Fault { + + private Integer code; + private String message; + private String details; + private Calendar created; + + /** + * @return the code + */ + public Integer getCode() { + return code; + } + + /** + * @return the message + */ + public String getMessage() { + return message; + } + + /** + * @return the details + */ + public String getDetails() { + return details; + } + + /** + * @return the created + */ + public Calendar getCreated() { + return created; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Fault [code=" + code + ", message=" + message + + ", details=" + details + ", created=" + created + "]"; + } + } + private String id; + private String name; + private Addresses addresses; + private List links; + private Image image; + private Flavor flavor; + private String accessIPv4; + private String accessIPv6; + @JsonProperty("config_drive") + private String configDrive; + private String status; + private Integer progress; + private Fault fault; + @JsonProperty("tenant_id") + private String tenantId; + @JsonProperty("user_id") + private String userId; + @JsonProperty("key_name") + private String keyName; + private String hostId; + private String updated; + private String created; + private Map metadata; + @JsonProperty("security_groups") + private List securityGroups; + @JsonProperty("OS-EXT-STS:task_state") + private String taskState; + @JsonProperty("OS-EXT-STS:power_state") + private String powerState; + @JsonProperty("OS-EXT-STS:vm_state") + private String vmState; + @JsonProperty("OS-EXT-SRV-ATTR:host") + private String host; + @JsonProperty("OS-EXT-SRV-ATTR:instance_name") + private String instanceName; + @JsonProperty("OS-EXT-SRV-ATTR:hypervisor_hostname") + private String hypervisorHostname; + @JsonProperty("OS-DCF:diskConfig") + private String diskConfig; + @JsonProperty("OS-EXT-AZ:availability_zone") + private String availabilityZone; @JsonProperty("OS-SRV-USG:launched_at") private String launchedAt; - @JsonProperty("OS-SRV-USG:terminated_at") private String terminatedAt; - @JsonProperty("os-extended-volumes:volumes_attached") - private List osExtendedVolumesAttached; - - private String uuid; - - private String adminPass; - - /** - * @return the id - */ - public String getId() { - return id; - } - - /** - * @return the name - */ - public String getName() { - return name; - } - - /** - * @return the addresses - */ - public Addresses getAddresses() { - return addresses; - } - - /** - * @return the links - */ - public List getLinks() { - return links; - } - - /** - * @return the image - */ - public Image getImage() { - return image; - } - - /** - * @param image the image to set - */ - public void setImage(Image image) { - this.image = image; - } - - /** - * @return the flavor - */ - public Flavor getFlavor() { - return flavor; - } - - /** - * @param flavor the flavor to set - */ - public void setFlavor(Flavor flavor) { - this.flavor = flavor; - } - - /** - * @return the accessIPv4 - */ - public String getAccessIPv4() { - return accessIPv4; - } - - /** - * @return the accessIPv6 - */ - public String getAccessIPv6() { - return accessIPv6; - } - - /** - * @return the configDrive - */ - public String getConfigDrive() { - return configDrive; - } - - /** - * @return the status - */ - public String getStatus() { - return status; - } - - /** - * @return the progress - */ - public Integer getProgress() { - return progress; - } - - /** - * @return the fault - */ - public Fault getFault() { - return fault; - } - - /** - * @return the tenantId - */ - public String getTenantId() { - return tenantId; - } - - /** - * @return the userId - */ - public String getUserId() { - return userId; - } - - /** - * @return the keyName - */ - public String getKeyName() { - return keyName; - } - - /** - * @return the hostId - */ - public String getHostId() { - return hostId; - } - - /** - * @return the updated - */ - public String getUpdated() { - return updated; - } - - /** - * @return the created - */ - public String getCreated() { - return created; - } - - /** - * @return the metadata - */ - public Map getMetadata() { - return metadata; - } - - /** - * @return the securityGroups - */ - public List getSecurityGroups() { - return securityGroups; - } - - /** - * @return the taskState - */ - public String getTaskState() { - return taskState; - } - - /** - * @return the powerState - */ - public String getPowerState() { - return powerState; - } - - /** - * @return the vmState - */ - public String getVmState() { - return vmState; - } - - /** - * @return the host - */ - public String getHost() { - return host; - } - - /** - * @return the instanceName - */ - public String getInstanceName() { - return instanceName; - } - - /** - * @return the hypervisorHostname - */ - public String getHypervisorHostname() { - return hypervisorHostname; - } - - /** - * @return the diskConfig - */ - public String getDiskConfig() { - return diskConfig; - } - - /** - * @return the availabilityZone - */ - public String getAvailabilityZone() { - return availabilityZone; - } + private List> osExtendedVolumesAttached; + private String uuid; + private String adminPass; + + /** + * @return the id + */ + public String getId() { + return id; + } + + /** + * @return the name + */ + public String getName() { + return name; + } + + /** + * @return the addresses + */ + public Addresses getAddresses() { + return addresses; + } + + /** + * @return the links + */ + public List getLinks() { + return links; + } + + /** + * @return the image + */ + public Image getImage() { + return image; + } + + /** + * @param image the image to set + */ + public void setImage(Image image) { + this.image = image; + } + + /** + * @return the flavor + */ + public Flavor getFlavor() { + return flavor; + } + + /** + * @param flavor the flavor to set + */ + public void setFlavor(Flavor flavor) { + this.flavor = flavor; + } + + /** + * @return the accessIPv4 + */ + public String getAccessIPv4() { + return accessIPv4; + } + + /** + * @return the accessIPv6 + */ + public String getAccessIPv6() { + return accessIPv6; + } + + /** + * @return the configDrive + */ + public String getConfigDrive() { + return configDrive; + } + + /** + * @return the status + */ + public String getStatus() { + return status; + } + + /** + * @return the progress + */ + public Integer getProgress() { + return progress; + } + + /** + * @return the fault + */ + public Fault getFault() { + return fault; + } + + /** + * @return the tenantId + */ + public String getTenantId() { + return tenantId; + } + + /** + * @return the userId + */ + public String getUserId() { + return userId; + } + + /** + * @return the keyName + */ + public String getKeyName() { + return keyName; + } + + /** + * @return the hostId + */ + public String getHostId() { + return hostId; + } + + /** + * @return the updated + */ + public String getUpdated() { + return updated; + } + + /** + * @return the created + */ + public String getCreated() { + return created; + } + + /** + * @return the metadata + */ + public Map getMetadata() { + return metadata; + } + + /** + * @return the securityGroups + */ + public List getSecurityGroups() { + return securityGroups; + } + + /** + * @return the taskState + */ + public String getTaskState() { + return taskState; + } + + /** + * @return the powerState + */ + public String getPowerState() { + return powerState; + } + + /** + * @return the vmState + */ + public String getVmState() { + return vmState; + } + + /** + * @return the host + */ + public String getHost() { + return host; + } + + /** + * @return the instanceName + */ + public String getInstanceName() { + return instanceName; + } + + /** + * @return the hypervisorHostname + */ + public String getHypervisorHostname() { + return hypervisorHostname; + } + + /** + * @return the diskConfig + */ + public String getDiskConfig() { + return diskConfig; + } + + /** + * @return the availabilityZone + */ + public String getAvailabilityZone() { + return availabilityZone; + } /** * @return the launchedAt @@ -469,46 +423,45 @@ public String getTerminatedAt() { /** * @return the osExtendedVolumesAttached */ - public List getOsExtendedVolumesAttached() { + public List> getOsExtendedVolumesAttached() { return osExtendedVolumesAttached; } /** - * @return the uuid - */ - public String getUuid() { - return uuid; - } - - /** - * @return the adminPass - */ - public String getAdminPass() { - return adminPass; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Server [id=" + id + ", name=" + name + ", addresses=" - + addresses + ", links=" + links + ", image=" + image - + ", flavor=" + flavor + ", accessIPv4=" + accessIPv4 - + ", accessIPv6=" + accessIPv6 + ", configDrive=" + configDrive - + ", status=" + status + ", progress=" + progress + ", fault=" - + fault + ", tenantId=" + tenantId + ", userId=" + userId - + ", keyName=" + keyName + ", hostId=" + hostId + ", updated=" - + updated + ", created=" + created + ", metadata=" + metadata - + ", securityGroups=" + securityGroups + ", taskState=" - + taskState + ", powerState=" + powerState + ", vmState=" - + vmState + ", host=" + host + ", instanceName=" + instanceName - + ", hypervisorHostname=" + hypervisorHostname - + ", diskConfig=" + diskConfig + ", availabilityZone=" - + availabilityZone + ", launchedAt=" + launchedAt + ", terminatedAt=" + * @return the uuid + */ + public String getUuid() { + return uuid; + } + + /** + * @return the adminPass + */ + public String getAdminPass() { + return adminPass; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Server [id=" + id + ", name=" + name + ", addresses=" + + addresses + ", links=" + links + ", image=" + image + + ", flavor=" + flavor + ", accessIPv4=" + accessIPv4 + + ", accessIPv6=" + accessIPv6 + ", configDrive=" + configDrive + + ", status=" + status + ", progress=" + progress + ", fault=" + + fault + ", tenantId=" + tenantId + ", userId=" + userId + + ", keyName=" + keyName + ", hostId=" + hostId + ", updated=" + + updated + ", created=" + created + ", metadata=" + metadata + + ", securityGroups=" + securityGroups + ", taskState=" + + taskState + ", powerState=" + powerState + ", vmState=" + + vmState + ", host=" + host + ", instanceName=" + instanceName + + ", hypervisorHostname=" + hypervisorHostname + + ", diskConfig=" + diskConfig + ", availabilityZone=" + + availabilityZone + ", launchedAt=" + launchedAt + ", terminatedAt=" + ", " + "osExtendedVolumesAttached=" + osExtendedVolumesAttached + ", uuid=" + uuid + ", adminPass=" - + adminPass + "]"; - } - + + adminPass + "]"; + } } From fc5e6b830f0699b8935f77d2192397af3ba00fd5 Mon Sep 17 00:00:00 2001 From: valinformatique Date: Mon, 23 Jun 2014 17:50:32 +0200 Subject: [PATCH 08/11] change type of disk and vcpus Changed to String --- .../woorea/openstack/nova/model/Flavor.java | 444 +++++++++--------- 1 file changed, 215 insertions(+), 229 deletions(-) diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Flavor.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Flavor.java index 107606250..b8276bb07 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/Flavor.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Flavor.java @@ -2,238 +2,224 @@ import java.io.Serializable; import java.util.List; - import org.codehaus.jackson.annotate.JsonProperty; import org.codehaus.jackson.map.annotate.JsonRootName; @JsonRootName("flavor") public class Flavor implements Serializable { - private String id; - - private String name; - - private Integer vcpus; - - private Integer ram; - - private Integer disk; - - @JsonProperty("OS-FLV-EXT-DATA:ephemeral") - private Integer ephemeral; - - private String swap; - - @JsonProperty("rxtx_factor") - private Float rxtxFactor; - - @JsonProperty("OS-FLV-DISABLED:disabled") - private Boolean disabled; - - @JsonProperty("rxtx_quota") - private Integer rxtxQuota; - - @JsonProperty("rxtx_cap") - private Integer rxtxCap; - - private List links; - - @JsonProperty("os-flavor-access:is_public") - private Boolean isPublic; - - /** - * @return the id - */ - public String getId() { - return id; - } - - /** - * @param id the id to set - */ - public void setId(String id) { - this.id = id; - } - - /** - * @return the name - */ - public String getName() { - return name; - } - - /** - * @param name the name to set - */ - public void setName(String name) { - this.name = name; - } - - /** - * @return the vcpus - */ - public Integer getVcpus() { - return vcpus; - } - - /** - * @param vcpus the vcpus to set - */ - public void setVcpus(Integer vcpus) { - this.vcpus = vcpus; - } - - /** - * @return the ram - */ - public Integer getRam() { - return ram; - } - - /** - * @param ram the ram to set - */ - public void setRam(Integer ram) { - this.ram = ram; - } - - /** - * @return the disk - */ - public Integer getDisk() { - return disk; - } - - /** - * @param disk the disk to set - */ - public void setDisk(Integer disk) { - this.disk = disk; - } - - /** - * @return the ephemeral - */ - public Integer getEphemeral() { - return ephemeral; - } - - /** - * @param ephemeral the ephemeral to set - */ - public void setEphemeral(Integer ephemeral) { - this.ephemeral = ephemeral; - } - - /** - * @return the swap - */ - public String getSwap() { - return swap; - } - - /** - * @param swap the swap to set - */ - public void setSwap(String swap) { - this.swap = swap; - } - - /** - * @return the rxtxFactor - */ - public Float getRxtxFactor() { - return rxtxFactor; - } - - /** - * @param rxtxFactor the rxtxFactor to set - */ - public void setRxtxFactor(Float rxtxFactor) { - this.rxtxFactor = rxtxFactor; - } - - /** - * @return the rxtxQuota - */ - public Integer getRxtxQuota() { - return rxtxQuota; - } - - /** - * @param rxtxQuota the rxtxQuota to set - */ - public void setRxtxQuota(Integer rxtxQuota) { - this.rxtxQuota = rxtxQuota; - } - - /** - * @return the rxtxCap - */ - public Integer getRxtxCap() { - return rxtxCap; - } - - /** - * @param rxtxCap the rxtxCap to set - */ - public void setRxtxCap(Integer rxtxCap) { - this.rxtxCap = rxtxCap; - } - - /** - * @return the disabled - */ - public Boolean getDisabled() { - return disabled; - } - - /** - * @param disabled the disabled to set - */ - public void setDisabled(Boolean disabled) { - this.disabled = disabled; - } - - /** - * @return the isPublic - */ - public Boolean isPublic() { - return isPublic; - } - - /** - * @param isPublic the isPublic to set - */ - public void setPublic(Boolean isPublic) { - this.isPublic = isPublic; - } - - /** - * @return the links - */ - public List getLinks() { - return links; - } - - /** - * @param links the links to set - */ - public void setLinks(List links) { - this.links = links; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Flavor [id=" + id + ", name=" + name + ", vcpus=" + vcpus - + ", ram=" + ram + ", disk=" + disk + ", ephemeral=" - + ephemeral + ", swap=" + swap + ", rxtxFactor=" + rxtxFactor - + ", disabled=" + disabled + ", rxtxQuota=" + rxtxQuota - + ", rxtxCap=" + rxtxCap + ", links=" + links + ", isPublic=" - + isPublic + "]"; - } - -} + private String id; + private String name; + private String vcpus; + private Integer ram; + private String disk; + @JsonProperty("OS-FLV-EXT-DATA:ephemeral") + private Integer ephemeral; + private String swap; + @JsonProperty("rxtx_factor") + private Float rxtxFactor; + @JsonProperty("OS-FLV-DISABLED:disabled") + private Boolean disabled; + @JsonProperty("rxtx_quota") + private Integer rxtxQuota; + @JsonProperty("rxtx_cap") + private Integer rxtxCap; + private List links; + @JsonProperty("os-flavor-access:is_public") + private Boolean isPublic; + + /** + * @return the id + */ + public String getId() { + return id; + } + + /** + * @param id the id to set + */ + public void setId(String id) { + this.id = id; + } + + /** + * @return the name + */ + public String getName() { + return name; + } + + /** + * @param name the name to set + */ + public void setName(String name) { + this.name = name; + } + + /** + * @return the vcpus + */ + public String getVcpus() { + return vcpus; + } + + /** + * @param vcpus the vcpus to set + */ + public void setVcpus(String vcpus) { + this.vcpus = vcpus; + } + + /** + * @return the ram + */ + public Integer getRam() { + return ram; + } + + /** + * @param ram the ram to set + */ + public void setRam(Integer ram) { + this.ram = ram; + } + + /** + * @return the disk + */ + public String getDisk() { + return disk; + } + + /** + * @param disk the disk to set + */ + public void setDisk(String disk) { + this.disk = disk; + } + + /** + * @return the ephemeral + */ + public Integer getEphemeral() { + return ephemeral; + } + + /** + * @param ephemeral the ephemeral to set + */ + public void setEphemeral(Integer ephemeral) { + this.ephemeral = ephemeral; + } + + /** + * @return the swap + */ + public String getSwap() { + return swap; + } + + /** + * @param swap the swap to set + */ + public void setSwap(String swap) { + this.swap = swap; + } + + /** + * @return the rxtxFactor + */ + public Float getRxtxFactor() { + return rxtxFactor; + } + + /** + * @param rxtxFactor the rxtxFactor to set + */ + public void setRxtxFactor(Float rxtxFactor) { + this.rxtxFactor = rxtxFactor; + } + + /** + * @return the rxtxQuota + */ + public Integer getRxtxQuota() { + return rxtxQuota; + } + + /** + * @param rxtxQuota the rxtxQuota to set + */ + public void setRxtxQuota(Integer rxtxQuota) { + this.rxtxQuota = rxtxQuota; + } + + /** + * @return the rxtxCap + */ + public Integer getRxtxCap() { + return rxtxCap; + } + + /** + * @param rxtxCap the rxtxCap to set + */ + public void setRxtxCap(Integer rxtxCap) { + this.rxtxCap = rxtxCap; + } + + /** + * @return the disabled + */ + public Boolean getDisabled() { + return disabled; + } + + /** + * @param disabled the disabled to set + */ + public void setDisabled(Boolean disabled) { + this.disabled = disabled; + } + + /** + * @return the isPublic + */ + public Boolean isPublic() { + return isPublic; + } + + /** + * @param isPublic the isPublic to set + */ + public void setPublic(Boolean isPublic) { + this.isPublic = isPublic; + } + + /** + * @return the links + */ + public List getLinks() { + return links; + } + + /** + * @param links the links to set + */ + public void setLinks(List links) { + this.links = links; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Flavor [id=" + id + ", name=" + name + ", vcpus=" + vcpus + + ", ram=" + ram + ", disk=" + disk + ", ephemeral=" + + ephemeral + ", swap=" + swap + ", rxtxFactor=" + rxtxFactor + + ", disabled=" + disabled + ", rxtxQuota=" + rxtxQuota + + ", rxtxCap=" + rxtxCap + ", links=" + links + ", isPublic=" + + isPublic + "]"; + } +} \ No newline at end of file From ca4799e4bb63a47f980fd45b899a590415399237 Mon Sep 17 00:00:00 2001 From: valinformatique Date: Mon, 23 Jun 2014 17:54:27 +0200 Subject: [PATCH 09/11] Revert "Add constructor for CreateImage" This reverts commit 13538c28210d975786cb5de704b557a496952704. --- .../openstack/nova/model/ServerAction.java | 1156 +++++++++-------- 1 file changed, 598 insertions(+), 558 deletions(-) diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/ServerAction.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/ServerAction.java index f5e0d17c7..26fa5a4a6 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/ServerAction.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/ServerAction.java @@ -5,566 +5,606 @@ import java.util.HashMap; import java.util.List; import java.util.Map; + import org.codehaus.jackson.annotate.JsonProperty; import org.codehaus.jackson.map.annotate.JsonRootName; public interface ServerAction extends Serializable { - - @JsonRootName("changePassword") - public static final class ChangePassword implements ServerAction { - - private String adminPass; - - public ChangePassword() { - super(); - // TODO Auto-generated constructor stub - } - - public ChangePassword(String adminPass) { - this.adminPass = adminPass; - } - - /** - * @return the adminPass - */ - public String getAdminPass() { - return adminPass; - } - - /** - * @param adminPass the adminPass to set - */ - public void setAdminPass(String adminPass) { - this.adminPass = adminPass; - } - } - - @JsonRootName("reboot") - public static final class Reboot implements ServerAction { - - private String type; - - /** - * @return the type - */ - public String getType() { - return type; - } - - /** - * @param type the type to set - */ - public void setType(String type) { - this.type = type; - } - } - - @JsonRootName("rebuild") - public static final class Rebuild implements ServerAction { - - private String imageRef; - private String name; - private String adminPass; - private String accessIPv4; - private String accessIPv6; - private Map metadata = new HashMap(); - private List personality = new ArrayList(); - @JsonProperty("OS-DCF:diskConfig") - private String diskConfig; - - /** - * @return the imageRef - */ - public String getImageRef() { - return imageRef; - } - - /** - * @param imageRef the imageRef to set - */ - public void setImageRef(String imageRef) { - this.imageRef = imageRef; - } - - /** - * @return the name - */ - public String getName() { - return name; - } - - /** - * @param name the name to set - */ - public void setName(String name) { - this.name = name; - } - - /** - * @return the adminPass - */ - public String getAdminPass() { - return adminPass; - } - - /** - * @param adminPass the adminPass to set - */ - public void setAdminPass(String adminPass) { - this.adminPass = adminPass; - } - - /** - * @return the accessIPv4 - */ - public String getAccessIPv4() { - return accessIPv4; - } - - /** - * @param accessIPv4 the accessIPv4 to set - */ - public void setAccessIPv4(String accessIPv4) { - this.accessIPv4 = accessIPv4; - } - - /** - * @return the accessIPv6 - */ - public String getAccessIPv6() { - return accessIPv6; - } - - /** - * @param accessIPv6 the accessIPv6 to set - */ - public void setAccessIPv6(String accessIPv6) { - this.accessIPv6 = accessIPv6; - } - - /** - * @return the metadata - */ - public Map getMetadata() { - return metadata; - } - - /** - * @param metadata the metadata to set - */ - public void setMetadata(Map metadata) { - this.metadata = metadata; - } - - /** - * @return the personality - */ - public List getPersonality() { - return personality; - } - - /** - * @param personality the personality to set - */ - public void setPersonality(List personality) { - this.personality = personality; - } - - /** - * @return the diskConfig - */ - public String getDiskConfig() { - return diskConfig; - } - - /** - * @param diskConfig the diskConfig to set - */ - public void setDiskConfig(String diskConfig) { - this.diskConfig = diskConfig; - } - } - - @JsonRootName("resize") - public static final class Resize implements ServerAction { - - private String flavorRef; - @JsonProperty("OS-DCF:diskConfig") - private String diskConfig; - - /** - * @return the flavorRef - */ - public String getFlavorRef() { - return flavorRef; - } - - /** - * @param flavorRef the flavorRef to set - */ - public void setFlavorRef(String flavorRef) { - this.flavorRef = flavorRef; - } - - /** - * @return the diskConfig - */ - public String getDiskConfig() { - return diskConfig; - } - - /** - * @param diskConfig the diskConfig to set - */ - public void setDiskConfig(String diskConfig) { - this.diskConfig = diskConfig; - } - } - - @JsonRootName("confirmResize") - public static final class ConfirmResize implements ServerAction { - } - - @JsonRootName("revertResize") - public static final class RevertResize implements ServerAction { - } - - @JsonRootName("createImage") - public static final class CreateImage implements ServerAction { - - private String name; - private Map metadata; - - public CreateImage(String aName) { - super(); - this.name = aName; - } - - /** - * @return the name - */ - public String getName() { - return name; - } - - /** - * @param name the name to set - */ - public void setName(String name) { - this.name = name; - } - - /** - * @return the metadata - */ - public Map getMetadata() { - return metadata; - } - - /** - * @param metadata the metadata to set - */ - public void setMetadata(Map metadata) { - this.metadata = metadata; - } - } - - @JsonRootName("rescue") - public static final class Rescue implements ServerAction { - - private String adminPass; - - public Rescue() { - } - - public Rescue(String adminPass) { - this.adminPass = adminPass; - } - - /** - * @return the adminPass - */ - public String getAdminPass() { - return adminPass; - } - - /** - * @param adminPass the adminPass to set - */ - public void setAdminPass(String adminPass) { - this.adminPass = adminPass; - } - } - - public static final class RescueResponse implements ServerAction { - - private String adminPass; - - /** - * @return the adminPass - */ - public String getAdminPass() { - return adminPass; - } - } - - @JsonRootName("unrescue") - public static final class Unrescue implements ServerAction { - } - - @JsonRootName("unpause") - public static final class Unpause implements ServerAction { - } - - @JsonRootName("pause") - public static final class Pause implements ServerAction { - } - - @JsonRootName("suspend") - public static final class Suspend implements ServerAction { - } - - @JsonRootName("resume") - public static final class Resume implements ServerAction { - } - - @JsonRootName("lock") - public static final class Lock implements ServerAction { - } - - @JsonRootName("unlock") - public static final class Unlock implements ServerAction { - } - - @JsonRootName("os-getConsoleOutput") - public static final class GetConsoleOutput implements ServerAction { - - private Integer length; - - public GetConsoleOutput() { - } - - public GetConsoleOutput(Integer length) { - this.length = length; - } - - /** - * @return the length - */ - public Integer getLength() { - return length; - } - - /** - * @param length the length to set - */ - public void setLength(Integer length) { - this.length = length; - } - } - - public static final class ConsoleOutput implements ServerAction { - - private String output; - - /** - * @return the output - */ - public String getOutput() { - return output; - } - } - - @JsonRootName("os-getVNCConsole") - public static final class GetVncConsole implements ServerAction { - - private String type; - - public GetVncConsole() { - super(); - // TODO Auto-generated constructor stub - } - - public GetVncConsole(String type) { - super(); - this.type = type; - } - - /** - * @return the type - */ - public String getType() { - return type; - } - - /** - * @param type the type to set - */ - public void setType(String type) { - this.type = type; - } - } - - @JsonRootName("console") - public static final class VncConsole implements ServerAction { - - private String type; - private String url; - - /** - * @return the type - */ - public String getType() { - return type; - } - - /** - * @return the url - */ - public String getUrl() { - return url; - } - } - - @JsonRootName("os-start") - public static final class Start implements ServerAction { - } - - @JsonRootName("os-stop") - public static final class Stop implements ServerAction { - } - - @JsonRootName("forceDelete") - public static final class ForceDelete implements ServerAction { - } - - @JsonRootName("restore") - public static final class Restore implements ServerAction { - } - - @JsonRootName("addFloatingIp") - public static final class AssociateFloatingIp implements ServerAction { - - private String address; - - public AssociateFloatingIp() { - super(); - // TODO Auto-generated constructor stub - } - - public AssociateFloatingIp(String address) { - super(); - this.address = address; - } - - /** - * @return the address - */ - public String getAddress() { - return address; - } - - /** - * @param address the address to set - */ - public void setAddress(String address) { - this.address = address; - } - } - - @JsonRootName("removeFloatingIp") - public static final class DisassociateFloatingIp implements ServerAction { - - private String address; - - public DisassociateFloatingIp() { - super(); - // TODO Auto-generated constructor stub - } - - public DisassociateFloatingIp(String address) { - super(); - this.address = address; - } - - /** - * @return the address - */ - public String getAddress() { - return address; - } - - /** - * @param address the address to set - */ - public void setAddress(String address) { - this.address = address; - } - } - - @JsonRootName("createBackup") - public static final class CreateBackup implements ServerAction { - - private String name; - @JsonProperty("backup_type") - private String type; - private String rotation; - private Map metadata; - - /** - * @return the name - */ - public String getName() { - return name; - } - - /** - * @param name the name to set - */ - public void setName(String name) { - this.name = name; - } - - /** - * @return the type - */ - public String getType() { - return type; - } - - /** - * @param type the type to set - */ - public void setType(String type) { - this.type = type; - } - - /** - * @return the rotation - */ - public String getRotation() { - return rotation; - } - - /** - * @param rotation the rotation to set - */ - public void setRotation(String rotation) { - this.rotation = rotation; - } - - /** - * @return the metadata - */ - public Map getMetadata() { - return metadata; - } - - /** - * @param metadata the metadata to set - */ - public void setMetadata(Map metadata) { - this.metadata = metadata; - } - } + + @JsonRootName("changePassword") + public static final class ChangePassword implements ServerAction { + + private String adminPass; + + public ChangePassword() { + super(); + // TODO Auto-generated constructor stub + } + + public ChangePassword(String adminPass) { + this.adminPass = adminPass; + } + + /** + * @return the adminPass + */ + public String getAdminPass() { + return adminPass; + } + + /** + * @param adminPass the adminPass to set + */ + public void setAdminPass(String adminPass) { + this.adminPass = adminPass; + } + + } + + @JsonRootName("reboot") + public static final class Reboot implements ServerAction { + + private String type; + + /** + * @return the type + */ + public String getType() { + return type; + } + + /** + * @param type the type to set + */ + public void setType(String type) { + this.type = type; + } + + } + + @JsonRootName("rebuild") + public static final class Rebuild implements ServerAction { + + private String imageRef; + + private String name; + + private String adminPass; + + private String accessIPv4; + + private String accessIPv6; + + private Map metadata = new HashMap(); + + private List personality = new ArrayList(); + + @JsonProperty("OS-DCF:diskConfig") + private String diskConfig; + + /** + * @return the imageRef + */ + public String getImageRef() { + return imageRef; + } + + /** + * @param imageRef the imageRef to set + */ + public void setImageRef(String imageRef) { + this.imageRef = imageRef; + } + + /** + * @return the name + */ + public String getName() { + return name; + } + + /** + * @param name the name to set + */ + public void setName(String name) { + this.name = name; + } + + /** + * @return the adminPass + */ + public String getAdminPass() { + return adminPass; + } + + /** + * @param adminPass the adminPass to set + */ + public void setAdminPass(String adminPass) { + this.adminPass = adminPass; + } + + /** + * @return the accessIPv4 + */ + public String getAccessIPv4() { + return accessIPv4; + } + + /** + * @param accessIPv4 the accessIPv4 to set + */ + public void setAccessIPv4(String accessIPv4) { + this.accessIPv4 = accessIPv4; + } + + /** + * @return the accessIPv6 + */ + public String getAccessIPv6() { + return accessIPv6; + } + + /** + * @param accessIPv6 the accessIPv6 to set + */ + public void setAccessIPv6(String accessIPv6) { + this.accessIPv6 = accessIPv6; + } + + /** + * @return the metadata + */ + public Map getMetadata() { + return metadata; + } + + /** + * @param metadata the metadata to set + */ + public void setMetadata(Map metadata) { + this.metadata = metadata; + } + + /** + * @return the personality + */ + public List getPersonality() { + return personality; + } + + /** + * @param personality the personality to set + */ + public void setPersonality(List personality) { + this.personality = personality; + } + + /** + * @return the diskConfig + */ + public String getDiskConfig() { + return diskConfig; + } + + /** + * @param diskConfig the diskConfig to set + */ + public void setDiskConfig(String diskConfig) { + this.diskConfig = diskConfig; + } + + } + + @JsonRootName("resize") + public static final class Resize implements ServerAction { + + private String flavorRef; + + @JsonProperty("OS-DCF:diskConfig") + private String diskConfig; + + /** + * @return the flavorRef + */ + public String getFlavorRef() { + return flavorRef; + } + + /** + * @param flavorRef the flavorRef to set + */ + public void setFlavorRef(String flavorRef) { + this.flavorRef = flavorRef; + } + + /** + * @return the diskConfig + */ + public String getDiskConfig() { + return diskConfig; + } + + /** + * @param diskConfig the diskConfig to set + */ + public void setDiskConfig(String diskConfig) { + this.diskConfig = diskConfig; + } + + } + + @JsonRootName("confirmResize") + public static final class ConfirmResize implements ServerAction { + + } + + @JsonRootName("revertResize") + public static final class RevertResize implements ServerAction { + + } + + @JsonRootName("createImage") + public static final class CreateImage implements ServerAction { + + private String name; + + private Map metadata; + + /** + * @return the name + */ + public String getName() { + return name; + } + + /** + * @param name the name to set + */ + public void setName(String name) { + this.name = name; + } + + /** + * @return the metadata + */ + public Map getMetadata() { + return metadata; + } + + /** + * @param metadata the metadata to set + */ + public void setMetadata(Map metadata) { + this.metadata = metadata; + } + + } + + @JsonRootName("rescue") + public static final class Rescue implements ServerAction { + + private String adminPass; + + public Rescue() { + + } + + public Rescue(String adminPass) { + this.adminPass = adminPass; + } + + /** + * @return the adminPass + */ + public String getAdminPass() { + return adminPass; + } + + /** + * @param adminPass the adminPass to set + */ + public void setAdminPass(String adminPass) { + this.adminPass = adminPass; + } + + } + + public static final class RescueResponse implements ServerAction { + + private String adminPass; + + /** + * @return the adminPass + */ + public String getAdminPass() { + return adminPass; + } + + } + + @JsonRootName("unrescue") + public static final class Unrescue implements ServerAction { + + } + + @JsonRootName("unpause") + public static final class Unpause implements ServerAction { + + } + + @JsonRootName("pause") + public static final class Pause implements ServerAction { + + } + + @JsonRootName("suspend") + public static final class Suspend implements ServerAction { + + } + + @JsonRootName("resume") + public static final class Resume implements ServerAction { + + } + + @JsonRootName("lock") + public static final class Lock implements ServerAction { + + } + + @JsonRootName("unlock") + public static final class Unlock implements ServerAction { + + } + + @JsonRootName("os-getConsoleOutput") + public static final class GetConsoleOutput implements ServerAction { + + private Integer length; + + public GetConsoleOutput() { + + } + + public GetConsoleOutput(Integer length) { + this.length = length; + } + + /** + * @return the length + */ + public Integer getLength() { + return length; + } + + /** + * @param length the length to set + */ + public void setLength(Integer length) { + this.length = length; + } + + } + + public static final class ConsoleOutput implements ServerAction { + + private String output; + + /** + * @return the output + */ + public String getOutput() { + return output; + } + + } + + @JsonRootName("os-getVNCConsole") + public static final class GetVncConsole implements ServerAction { + + private String type; + + public GetVncConsole() { + super(); + // TODO Auto-generated constructor stub + } + + + public GetVncConsole(String type) { + super(); + this.type = type; + } + + /** + * @return the type + */ + public String getType() { + return type; + } + + /** + * @param type the type to set + */ + public void setType(String type) { + this.type = type; + } + + } + + @JsonRootName("console") + public static final class VncConsole implements ServerAction { + + private String type; + + private String url; + + /** + * @return the type + */ + public String getType() { + return type; + } + + /** + * @return the url + */ + public String getUrl() { + return url; + } + + } + + @JsonRootName("os-start") + public static final class Start implements ServerAction { + + } + + @JsonRootName("os-stop") + public static final class Stop implements ServerAction { + + } + + @JsonRootName("forceDelete") + public static final class ForceDelete implements ServerAction { + + } + + @JsonRootName("restore") + public static final class Restore implements ServerAction { + + } + + @JsonRootName("addFloatingIp") + public static final class AssociateFloatingIp implements ServerAction { + + private String address; + + public AssociateFloatingIp() { + super(); + // TODO Auto-generated constructor stub + } + + public AssociateFloatingIp(String address) { + super(); + this.address = address; + } + + /** + * @return the address + */ + public String getAddress() { + return address; + } + + /** + * @param address the address to set + */ + public void setAddress(String address) { + this.address = address; + } + + } + + @JsonRootName("removeFloatingIp") + public static final class DisassociateFloatingIp implements ServerAction { + + private String address; + + public DisassociateFloatingIp() { + super(); + // TODO Auto-generated constructor stub + } + + public DisassociateFloatingIp(String address) { + super(); + this.address = address; + } + + /** + * @return the address + */ + public String getAddress() { + return address; + } + + /** + * @param address the address to set + */ + public void setAddress(String address) { + this.address = address; + } + + } + + @JsonRootName("createBackup") + public static final class CreateBackup implements ServerAction { + + private String name; + + @JsonProperty("backup_type") + private String type; + + private String rotation; + + private Map metadata; + + /** + * @return the name + */ + public String getName() { + return name; + } + + /** + * @param name the name to set + */ + public void setName(String name) { + this.name = name; + } + + /** + * @return the type + */ + public String getType() { + return type; + } + + /** + * @param type the type to set + */ + public void setType(String type) { + this.type = type; + } + + /** + * @return the rotation + */ + public String getRotation() { + return rotation; + } + + /** + * @param rotation the rotation to set + */ + public void setRotation(String rotation) { + this.rotation = rotation; + } + + /** + * @return the metadata + */ + public Map getMetadata() { + return metadata; + } + + /** + * @param metadata the metadata to set + */ + public void setMetadata(Map metadata) { + this.metadata = metadata; + } + + } + } From 6990a21428935c2aa7a5a26583c9b1aaeea06b66 Mon Sep 17 00:00:00 2001 From: valinformatique Date: Mon, 23 Jun 2014 17:54:31 +0200 Subject: [PATCH 10/11] Revert "change type of disk and vcpus" This reverts commit fc5e6b830f0699b8935f77d2192397af3ba00fd5. --- .../woorea/openstack/nova/model/Flavor.java | 444 +++++++++--------- 1 file changed, 229 insertions(+), 215 deletions(-) diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Flavor.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Flavor.java index b8276bb07..107606250 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/Flavor.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Flavor.java @@ -2,224 +2,238 @@ import java.io.Serializable; import java.util.List; + import org.codehaus.jackson.annotate.JsonProperty; import org.codehaus.jackson.map.annotate.JsonRootName; @JsonRootName("flavor") public class Flavor implements Serializable { - private String id; - private String name; - private String vcpus; - private Integer ram; - private String disk; - @JsonProperty("OS-FLV-EXT-DATA:ephemeral") - private Integer ephemeral; - private String swap; - @JsonProperty("rxtx_factor") - private Float rxtxFactor; - @JsonProperty("OS-FLV-DISABLED:disabled") - private Boolean disabled; - @JsonProperty("rxtx_quota") - private Integer rxtxQuota; - @JsonProperty("rxtx_cap") - private Integer rxtxCap; - private List links; - @JsonProperty("os-flavor-access:is_public") - private Boolean isPublic; - - /** - * @return the id - */ - public String getId() { - return id; - } - - /** - * @param id the id to set - */ - public void setId(String id) { - this.id = id; - } - - /** - * @return the name - */ - public String getName() { - return name; - } - - /** - * @param name the name to set - */ - public void setName(String name) { - this.name = name; - } - - /** - * @return the vcpus - */ - public String getVcpus() { - return vcpus; - } - - /** - * @param vcpus the vcpus to set - */ - public void setVcpus(String vcpus) { - this.vcpus = vcpus; - } - - /** - * @return the ram - */ - public Integer getRam() { - return ram; - } - - /** - * @param ram the ram to set - */ - public void setRam(Integer ram) { - this.ram = ram; - } - - /** - * @return the disk - */ - public String getDisk() { - return disk; - } - - /** - * @param disk the disk to set - */ - public void setDisk(String disk) { - this.disk = disk; - } - - /** - * @return the ephemeral - */ - public Integer getEphemeral() { - return ephemeral; - } - - /** - * @param ephemeral the ephemeral to set - */ - public void setEphemeral(Integer ephemeral) { - this.ephemeral = ephemeral; - } - - /** - * @return the swap - */ - public String getSwap() { - return swap; - } - - /** - * @param swap the swap to set - */ - public void setSwap(String swap) { - this.swap = swap; - } - - /** - * @return the rxtxFactor - */ - public Float getRxtxFactor() { - return rxtxFactor; - } - - /** - * @param rxtxFactor the rxtxFactor to set - */ - public void setRxtxFactor(Float rxtxFactor) { - this.rxtxFactor = rxtxFactor; - } - - /** - * @return the rxtxQuota - */ - public Integer getRxtxQuota() { - return rxtxQuota; - } - - /** - * @param rxtxQuota the rxtxQuota to set - */ - public void setRxtxQuota(Integer rxtxQuota) { - this.rxtxQuota = rxtxQuota; - } - - /** - * @return the rxtxCap - */ - public Integer getRxtxCap() { - return rxtxCap; - } - - /** - * @param rxtxCap the rxtxCap to set - */ - public void setRxtxCap(Integer rxtxCap) { - this.rxtxCap = rxtxCap; - } - - /** - * @return the disabled - */ - public Boolean getDisabled() { - return disabled; - } - - /** - * @param disabled the disabled to set - */ - public void setDisabled(Boolean disabled) { - this.disabled = disabled; - } - - /** - * @return the isPublic - */ - public Boolean isPublic() { - return isPublic; - } - - /** - * @param isPublic the isPublic to set - */ - public void setPublic(Boolean isPublic) { - this.isPublic = isPublic; - } - - /** - * @return the links - */ - public List getLinks() { - return links; - } - - /** - * @param links the links to set - */ - public void setLinks(List links) { - this.links = links; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Flavor [id=" + id + ", name=" + name + ", vcpus=" + vcpus - + ", ram=" + ram + ", disk=" + disk + ", ephemeral=" - + ephemeral + ", swap=" + swap + ", rxtxFactor=" + rxtxFactor - + ", disabled=" + disabled + ", rxtxQuota=" + rxtxQuota - + ", rxtxCap=" + rxtxCap + ", links=" + links + ", isPublic=" - + isPublic + "]"; - } -} \ No newline at end of file + private String id; + + private String name; + + private Integer vcpus; + + private Integer ram; + + private Integer disk; + + @JsonProperty("OS-FLV-EXT-DATA:ephemeral") + private Integer ephemeral; + + private String swap; + + @JsonProperty("rxtx_factor") + private Float rxtxFactor; + + @JsonProperty("OS-FLV-DISABLED:disabled") + private Boolean disabled; + + @JsonProperty("rxtx_quota") + private Integer rxtxQuota; + + @JsonProperty("rxtx_cap") + private Integer rxtxCap; + + private List links; + + @JsonProperty("os-flavor-access:is_public") + private Boolean isPublic; + + /** + * @return the id + */ + public String getId() { + return id; + } + + /** + * @param id the id to set + */ + public void setId(String id) { + this.id = id; + } + + /** + * @return the name + */ + public String getName() { + return name; + } + + /** + * @param name the name to set + */ + public void setName(String name) { + this.name = name; + } + + /** + * @return the vcpus + */ + public Integer getVcpus() { + return vcpus; + } + + /** + * @param vcpus the vcpus to set + */ + public void setVcpus(Integer vcpus) { + this.vcpus = vcpus; + } + + /** + * @return the ram + */ + public Integer getRam() { + return ram; + } + + /** + * @param ram the ram to set + */ + public void setRam(Integer ram) { + this.ram = ram; + } + + /** + * @return the disk + */ + public Integer getDisk() { + return disk; + } + + /** + * @param disk the disk to set + */ + public void setDisk(Integer disk) { + this.disk = disk; + } + + /** + * @return the ephemeral + */ + public Integer getEphemeral() { + return ephemeral; + } + + /** + * @param ephemeral the ephemeral to set + */ + public void setEphemeral(Integer ephemeral) { + this.ephemeral = ephemeral; + } + + /** + * @return the swap + */ + public String getSwap() { + return swap; + } + + /** + * @param swap the swap to set + */ + public void setSwap(String swap) { + this.swap = swap; + } + + /** + * @return the rxtxFactor + */ + public Float getRxtxFactor() { + return rxtxFactor; + } + + /** + * @param rxtxFactor the rxtxFactor to set + */ + public void setRxtxFactor(Float rxtxFactor) { + this.rxtxFactor = rxtxFactor; + } + + /** + * @return the rxtxQuota + */ + public Integer getRxtxQuota() { + return rxtxQuota; + } + + /** + * @param rxtxQuota the rxtxQuota to set + */ + public void setRxtxQuota(Integer rxtxQuota) { + this.rxtxQuota = rxtxQuota; + } + + /** + * @return the rxtxCap + */ + public Integer getRxtxCap() { + return rxtxCap; + } + + /** + * @param rxtxCap the rxtxCap to set + */ + public void setRxtxCap(Integer rxtxCap) { + this.rxtxCap = rxtxCap; + } + + /** + * @return the disabled + */ + public Boolean getDisabled() { + return disabled; + } + + /** + * @param disabled the disabled to set + */ + public void setDisabled(Boolean disabled) { + this.disabled = disabled; + } + + /** + * @return the isPublic + */ + public Boolean isPublic() { + return isPublic; + } + + /** + * @param isPublic the isPublic to set + */ + public void setPublic(Boolean isPublic) { + this.isPublic = isPublic; + } + + /** + * @return the links + */ + public List getLinks() { + return links; + } + + /** + * @param links the links to set + */ + public void setLinks(List links) { + this.links = links; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Flavor [id=" + id + ", name=" + name + ", vcpus=" + vcpus + + ", ram=" + ram + ", disk=" + disk + ", ephemeral=" + + ephemeral + ", swap=" + swap + ", rxtxFactor=" + rxtxFactor + + ", disabled=" + disabled + ", rxtxQuota=" + rxtxQuota + + ", rxtxCap=" + rxtxCap + ", links=" + links + ", isPublic=" + + isPublic + "]"; + } + +} From 852144ca6f0679f59144e22d0db857d7999e953c Mon Sep 17 00:00:00 2001 From: valinformatique Date: Mon, 23 Jun 2014 17:57:13 +0200 Subject: [PATCH 11/11] Revert "change type of osExtendedVolumesAttached" This reverts commit 0ab3402baca0ece9f722c8be6764a2f20b5c8c83. --- .../woorea/openstack/nova/model/Server.java | 893 +++++++++--------- 1 file changed, 470 insertions(+), 423 deletions(-) diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Server.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Server.java index 299ac066b..589ed540d 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/Server.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Server.java @@ -5,406 +5,452 @@ import java.util.HashMap; import java.util.List; import java.util.Map; + import org.codehaus.jackson.annotate.JsonAnySetter; +import org.codehaus.jackson.annotate.JsonIgnoreProperties; import org.codehaus.jackson.annotate.JsonProperty; import org.codehaus.jackson.map.annotate.JsonRootName; @JsonRootName("server") public class Server implements Serializable { + + public static final class Addresses implements Serializable { + + public static final class Address implements Serializable { + + @JsonProperty("OS-EXT-IPS-MAC:mac_addr") + private String macAddr; + + private String version; + + private String addr; + + @JsonProperty("OS-EXT-IPS:type") + private String type; + + /** + * @return the macAddr + */ + public String getMacAddr() { + return macAddr; + } + + /** + * @return the version + */ + public String getVersion() { + return version; + } + + /** + * @return the addr + */ + public String getAddr() { + return addr; + } + + + /** + * @return the type + */ + public String getType() { + return type; + } + + /** + * @param version the version to set + */ + public void setVersion(String version) { + this.version = version; + } + + /** + * @param addr the addr to set + */ + public void setAddr(String addr) { + this.addr = addr; + } + + /** + * @param type the type to set + */ + public void setType(String type) { + this.type = type; + } + + /** + * @param macAddr the mac addr to set + */ + public void setMacAddr(String macAddr) { + this.macAddr= macAddr; + } + } + + private Map> addresses = new HashMap>(); + + @JsonAnySetter + public void add(String key, List
value) { + addresses.put(key, value); + } + /** + * @return the ip address List Map + */ + public Map> getAddresses() { + return addresses; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Addresses List Map [" + addresses + "]"; + } + + } + + public static final class Fault { + + private Integer code; + + private String message; + + private String details; + + private Calendar created; + + /** + * @return the code + */ + public Integer getCode() { + return code; + } + + /** + * @return the message + */ + public String getMessage() { + return message; + } + + /** + * @return the details + */ + public String getDetails() { + return details; + } + + /** + * @return the created + */ + public Calendar getCreated() { + return created; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Fault [code=" + code + ", message=" + message + + ", details=" + details + ", created=" + created + "]"; + } + + + } + + + private String id; + + private String name; + + private Addresses addresses; + + private List links; + + private Image image; + + private Flavor flavor; + + private String accessIPv4; + + private String accessIPv6; + + @JsonProperty("config_drive") + private String configDrive; + + private String status; + + private Integer progress; + + private Fault fault; + + @JsonProperty("tenant_id") + private String tenantId; + + @JsonProperty("user_id") + private String userId; + + @JsonProperty("key_name") + private String keyName; + + private String hostId; + + private String updated; + + private String created; + + private Map metadata; + + @JsonProperty("security_groups") + private List securityGroups; + + @JsonProperty("OS-EXT-STS:task_state") + private String taskState; + + @JsonProperty("OS-EXT-STS:power_state") + private String powerState; + + @JsonProperty("OS-EXT-STS:vm_state") + private String vmState; + + @JsonProperty("OS-EXT-SRV-ATTR:host") + private String host; + + @JsonProperty("OS-EXT-SRV-ATTR:instance_name") + private String instanceName; + + @JsonProperty("OS-EXT-SRV-ATTR:hypervisor_hostname") + private String hypervisorHostname; + + @JsonProperty("OS-DCF:diskConfig") + private String diskConfig; + + @JsonProperty("OS-EXT-AZ:availability_zone") + private String availabilityZone; - public static final class Addresses implements Serializable { - - public static final class Address implements Serializable { - - @JsonProperty("OS-EXT-IPS-MAC:mac_addr") - private String macAddr; - private String version; - private String addr; - @JsonProperty("OS-EXT-IPS:type") - private String type; - - /** - * @return the macAddr - */ - public String getMacAddr() { - return macAddr; - } - - /** - * @return the version - */ - public String getVersion() { - return version; - } - - /** - * @return the addr - */ - public String getAddr() { - return addr; - } - - /** - * @return the type - */ - public String getType() { - return type; - } - - /** - * @param version the version to set - */ - public void setVersion(String version) { - this.version = version; - } - - /** - * @param addr the addr to set - */ - public void setAddr(String addr) { - this.addr = addr; - } - - /** - * @param type the type to set - */ - public void setType(String type) { - this.type = type; - } - - /** - * @param macAddr the mac addr to set - */ - public void setMacAddr(String macAddr) { - this.macAddr = macAddr; - } - } - private Map> addresses = new HashMap>(); - - @JsonAnySetter - public void add(String key, List
value) { - addresses.put(key, value); - } - - /** - * @return the ip address List Map - */ - public Map> getAddresses() { - return addresses; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Addresses List Map [" + addresses + "]"; - } - } - - public static final class Fault { - - private Integer code; - private String message; - private String details; - private Calendar created; - - /** - * @return the code - */ - public Integer getCode() { - return code; - } - - /** - * @return the message - */ - public String getMessage() { - return message; - } - - /** - * @return the details - */ - public String getDetails() { - return details; - } - - /** - * @return the created - */ - public Calendar getCreated() { - return created; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Fault [code=" + code + ", message=" + message - + ", details=" + details + ", created=" + created + "]"; - } - } - private String id; - private String name; - private Addresses addresses; - private List links; - private Image image; - private Flavor flavor; - private String accessIPv4; - private String accessIPv6; - @JsonProperty("config_drive") - private String configDrive; - private String status; - private Integer progress; - private Fault fault; - @JsonProperty("tenant_id") - private String tenantId; - @JsonProperty("user_id") - private String userId; - @JsonProperty("key_name") - private String keyName; - private String hostId; - private String updated; - private String created; - private Map metadata; - @JsonProperty("security_groups") - private List securityGroups; - @JsonProperty("OS-EXT-STS:task_state") - private String taskState; - @JsonProperty("OS-EXT-STS:power_state") - private String powerState; - @JsonProperty("OS-EXT-STS:vm_state") - private String vmState; - @JsonProperty("OS-EXT-SRV-ATTR:host") - private String host; - @JsonProperty("OS-EXT-SRV-ATTR:instance_name") - private String instanceName; - @JsonProperty("OS-EXT-SRV-ATTR:hypervisor_hostname") - private String hypervisorHostname; - @JsonProperty("OS-DCF:diskConfig") - private String diskConfig; - @JsonProperty("OS-EXT-AZ:availability_zone") - private String availabilityZone; @JsonProperty("OS-SRV-USG:launched_at") private String launchedAt; + @JsonProperty("OS-SRV-USG:terminated_at") private String terminatedAt; - @JsonProperty("os-extended-volumes:volumes_attached") - private List> osExtendedVolumesAttached; - private String uuid; - private String adminPass; - - /** - * @return the id - */ - public String getId() { - return id; - } - - /** - * @return the name - */ - public String getName() { - return name; - } - - /** - * @return the addresses - */ - public Addresses getAddresses() { - return addresses; - } - - /** - * @return the links - */ - public List getLinks() { - return links; - } - - /** - * @return the image - */ - public Image getImage() { - return image; - } - - /** - * @param image the image to set - */ - public void setImage(Image image) { - this.image = image; - } - - /** - * @return the flavor - */ - public Flavor getFlavor() { - return flavor; - } - - /** - * @param flavor the flavor to set - */ - public void setFlavor(Flavor flavor) { - this.flavor = flavor; - } - - /** - * @return the accessIPv4 - */ - public String getAccessIPv4() { - return accessIPv4; - } - - /** - * @return the accessIPv6 - */ - public String getAccessIPv6() { - return accessIPv6; - } - - /** - * @return the configDrive - */ - public String getConfigDrive() { - return configDrive; - } - - /** - * @return the status - */ - public String getStatus() { - return status; - } - - /** - * @return the progress - */ - public Integer getProgress() { - return progress; - } - - /** - * @return the fault - */ - public Fault getFault() { - return fault; - } - - /** - * @return the tenantId - */ - public String getTenantId() { - return tenantId; - } - - /** - * @return the userId - */ - public String getUserId() { - return userId; - } - - /** - * @return the keyName - */ - public String getKeyName() { - return keyName; - } - - /** - * @return the hostId - */ - public String getHostId() { - return hostId; - } - - /** - * @return the updated - */ - public String getUpdated() { - return updated; - } - - /** - * @return the created - */ - public String getCreated() { - return created; - } - - /** - * @return the metadata - */ - public Map getMetadata() { - return metadata; - } - - /** - * @return the securityGroups - */ - public List getSecurityGroups() { - return securityGroups; - } - - /** - * @return the taskState - */ - public String getTaskState() { - return taskState; - } - - /** - * @return the powerState - */ - public String getPowerState() { - return powerState; - } - /** - * @return the vmState - */ - public String getVmState() { - return vmState; - } - - /** - * @return the host - */ - public String getHost() { - return host; - } - - /** - * @return the instanceName - */ - public String getInstanceName() { - return instanceName; - } - - /** - * @return the hypervisorHostname - */ - public String getHypervisorHostname() { - return hypervisorHostname; - } - - /** - * @return the diskConfig - */ - public String getDiskConfig() { - return diskConfig; - } - - /** - * @return the availabilityZone - */ - public String getAvailabilityZone() { - return availabilityZone; - } + @JsonProperty("os-extended-volumes:volumes_attached") + private List osExtendedVolumesAttached; + + private String uuid; + + private String adminPass; + + /** + * @return the id + */ + public String getId() { + return id; + } + + /** + * @return the name + */ + public String getName() { + return name; + } + + /** + * @return the addresses + */ + public Addresses getAddresses() { + return addresses; + } + + /** + * @return the links + */ + public List getLinks() { + return links; + } + + /** + * @return the image + */ + public Image getImage() { + return image; + } + + /** + * @param image the image to set + */ + public void setImage(Image image) { + this.image = image; + } + + /** + * @return the flavor + */ + public Flavor getFlavor() { + return flavor; + } + + /** + * @param flavor the flavor to set + */ + public void setFlavor(Flavor flavor) { + this.flavor = flavor; + } + + /** + * @return the accessIPv4 + */ + public String getAccessIPv4() { + return accessIPv4; + } + + /** + * @return the accessIPv6 + */ + public String getAccessIPv6() { + return accessIPv6; + } + + /** + * @return the configDrive + */ + public String getConfigDrive() { + return configDrive; + } + + /** + * @return the status + */ + public String getStatus() { + return status; + } + + /** + * @return the progress + */ + public Integer getProgress() { + return progress; + } + + /** + * @return the fault + */ + public Fault getFault() { + return fault; + } + + /** + * @return the tenantId + */ + public String getTenantId() { + return tenantId; + } + + /** + * @return the userId + */ + public String getUserId() { + return userId; + } + + /** + * @return the keyName + */ + public String getKeyName() { + return keyName; + } + + /** + * @return the hostId + */ + public String getHostId() { + return hostId; + } + + /** + * @return the updated + */ + public String getUpdated() { + return updated; + } + + /** + * @return the created + */ + public String getCreated() { + return created; + } + + /** + * @return the metadata + */ + public Map getMetadata() { + return metadata; + } + + /** + * @return the securityGroups + */ + public List getSecurityGroups() { + return securityGroups; + } + + /** + * @return the taskState + */ + public String getTaskState() { + return taskState; + } + + /** + * @return the powerState + */ + public String getPowerState() { + return powerState; + } + + /** + * @return the vmState + */ + public String getVmState() { + return vmState; + } + + /** + * @return the host + */ + public String getHost() { + return host; + } + + /** + * @return the instanceName + */ + public String getInstanceName() { + return instanceName; + } + + /** + * @return the hypervisorHostname + */ + public String getHypervisorHostname() { + return hypervisorHostname; + } + + /** + * @return the diskConfig + */ + public String getDiskConfig() { + return diskConfig; + } + + /** + * @return the availabilityZone + */ + public String getAvailabilityZone() { + return availabilityZone; + } /** * @return the launchedAt @@ -423,45 +469,46 @@ public String getTerminatedAt() { /** * @return the osExtendedVolumesAttached */ - public List> getOsExtendedVolumesAttached() { + public List getOsExtendedVolumesAttached() { return osExtendedVolumesAttached; } /** - * @return the uuid - */ - public String getUuid() { - return uuid; - } - - /** - * @return the adminPass - */ - public String getAdminPass() { - return adminPass; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Server [id=" + id + ", name=" + name + ", addresses=" - + addresses + ", links=" + links + ", image=" + image - + ", flavor=" + flavor + ", accessIPv4=" + accessIPv4 - + ", accessIPv6=" + accessIPv6 + ", configDrive=" + configDrive - + ", status=" + status + ", progress=" + progress + ", fault=" - + fault + ", tenantId=" + tenantId + ", userId=" + userId - + ", keyName=" + keyName + ", hostId=" + hostId + ", updated=" - + updated + ", created=" + created + ", metadata=" + metadata - + ", securityGroups=" + securityGroups + ", taskState=" - + taskState + ", powerState=" + powerState + ", vmState=" - + vmState + ", host=" + host + ", instanceName=" + instanceName - + ", hypervisorHostname=" + hypervisorHostname - + ", diskConfig=" + diskConfig + ", availabilityZone=" - + availabilityZone + ", launchedAt=" + launchedAt + ", terminatedAt=" + * @return the uuid + */ + public String getUuid() { + return uuid; + } + + /** + * @return the adminPass + */ + public String getAdminPass() { + return adminPass; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Server [id=" + id + ", name=" + name + ", addresses=" + + addresses + ", links=" + links + ", image=" + image + + ", flavor=" + flavor + ", accessIPv4=" + accessIPv4 + + ", accessIPv6=" + accessIPv6 + ", configDrive=" + configDrive + + ", status=" + status + ", progress=" + progress + ", fault=" + + fault + ", tenantId=" + tenantId + ", userId=" + userId + + ", keyName=" + keyName + ", hostId=" + hostId + ", updated=" + + updated + ", created=" + created + ", metadata=" + metadata + + ", securityGroups=" + securityGroups + ", taskState=" + + taskState + ", powerState=" + powerState + ", vmState=" + + vmState + ", host=" + host + ", instanceName=" + instanceName + + ", hypervisorHostname=" + hypervisorHostname + + ", diskConfig=" + diskConfig + ", availabilityZone=" + + availabilityZone + ", launchedAt=" + launchedAt + ", terminatedAt=" + ", " + "osExtendedVolumesAttached=" + osExtendedVolumesAttached + ", uuid=" + uuid + ", adminPass=" - + adminPass + "]"; - } + + adminPass + "]"; + } + }