diff options
236 files changed, 13000 insertions, 12998 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 a0b37e0..aa089df 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 @@ -23,28 +23,28 @@ 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; + } + } 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 7d3bcf3..83eecd4 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 @@ -23,52 +23,52 @@ import java.util.List; import com.woorea.openstack.base.client.OpenStackRequest; public abstract class QueriableCeilometerCommand<T,R> extends OpenStackRequest<R> { - - protected List<String> fields = new ArrayList<>(); - - protected List<String> ops = new ArrayList<>(); - - protected List<Serializable> values = new ArrayList<>(); - - private T filter(String field, String op, Serializable value) { - fields.add(field); - ops.add(op); - values.add(value); - return (T) this; - } - - public T lt(String field, Serializable value) { - return filter(field, "lt", value); - } - - public T le(String field, Serializable value) { - return filter(field, "le", value); - } - - public T eq(String field, Serializable value) { - return filter(field, "eq", value); - } - - public T ne(String field, Serializable value) { - return filter(field, "ne", value); - } - - public T ge(String field, Serializable value) { - return filter(field, "ge", value); - } - - public T gt(String field, Serializable value) { - return filter(field, "gt", value); - } + + protected List<String> fields = new ArrayList<>(); + + protected List<String> ops = new ArrayList<>(); + + protected List<Serializable> values = new ArrayList<>(); + + private T filter(String field, String op, Serializable value) { + fields.add(field); + ops.add(op); + values.add(value); + return (T) this; + } + + public T lt(String field, Serializable value) { + return filter(field, "lt", value); + } + + public T le(String field, Serializable value) { + return filter(field, "le", value); + } + + public T eq(String field, Serializable value) { + return filter(field, "eq", value); + } + + public T ne(String field, Serializable value) { + return filter(field, "ne", value); + } + + public T ge(String field, Serializable value) { + return filter(field, "ge", value); + } + + public T gt(String field, Serializable value) { + return filter(field, "gt", value); + } - /* - public WebTarget query(WebTarget target) { - if(fields.size() > 0) { - target = target.queryParam("q.field", fields.toArray()); - target = target.queryParam("q.op", ops.toArray()); - target = target.queryParam("q.value", values.toArray()); - } - return target; - } - */ + /* + public WebTarget query(WebTarget target) { + if(fields.size() > 0) { + target = target.queryParam("q.field", fields.toArray()); + target = target.queryParam("q.op", ops.toArray()); + target = target.queryParam("q.value", values.toArray()); + } + return target; + } + */ } 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 23979c7..8f35170 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 @@ -23,65 +23,65 @@ import com.woorea.openstack.ceilometer.QueriableCeilometerCommand; 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<List, java.util.List<Sample>> { - public List() { - //return query(target.path("meters")).request(MediaType.APPLICATION_JSON).get(new GenericType<List<Meter>>() {}); - } - } - - public class Show extends QueriableCeilometerCommand<Show, java.util.List<Sample>> { + + 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<List, java.util.List<Sample>> { + public List() { + //return query(target.path("meters")).request(MediaType.APPLICATION_JSON).get(new GenericType<List<Meter>>() {}); + } + } + + public class Show extends QueriableCeilometerCommand<Show, java.util.List<Sample>> { - 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<List<Sample>>() {}); - } + 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<List<Sample>>() {}); + } - } + } - public class Statistics extends QueriableCeilometerCommand<Statistics, java.util.List<Statistics>> { + public class Statistics extends QueriableCeilometerCommand<Statistics, java.util.List<Statistics>> { - 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<List<Statistics>>(){}); - } + 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<List<Statistics>>(){}); + } - } + } } 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 01c777d..4639ef4 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 @@ -24,38 +24,38 @@ 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<ResourceList, List<Resource>> { - - public ResourceList() { - OpenStackRequest request = new OpenStackRequest(); - //return query(target.path("resources")).request(MediaType.APPLICATION_JSON).get(new GenericType<List<Resource>>() {}); - } - - } - - public class ResourceShow extends OpenStackRequest<Void> { - - 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 class ResourceList extends QueriableCeilometerCommand<ResourceList, List<Resource>> { + + public ResourceList() { + OpenStackRequest request = new OpenStackRequest(); + //return query(target.path("resources")).request(MediaType.APPLICATION_JSON).get(new GenericType<List<Resource>>() {}); + } + + } + + public class ResourceShow extends OpenStackRequest<Void> { + + 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); + } + + } } 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 b0e26ff..e9ff2aa 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 @@ -20,51 +20,51 @@ import org.codehaus.jackson.annotate.JsonProperty; 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; + @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 getUser() { + return user; + } - public String getName() { - return name; - } + public String getName() { + return name; + } - public String getResource() { - return resource; - } + public String getResource() { + return resource; + } - public String getProject() { - return project; - } + public String getProject() { + return project; + } - public String getType() { - return type; - } + public String getType() { + return type; + } - public String getUnit() { - return unit; - } + public String getUnit() { + return unit; + } - @Override - public String toString() { - return "Meter [user=" + user + ", name=" + name + ", resource=" - + resource + ", project=" + project + ", type=" + type - + ", unit=" + unit + "]"; - } + @Override + public String toString() { + return "Meter [user=" + user + ", name=" + name + ", resource=" + + resource + ", project=" + project + ", type=" + type + + ", unit=" + unit + "]"; + } } 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 93e57e4..bb8e991 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 @@ -21,46 +21,46 @@ 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<String, Object> metadata; + //{"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<String, Object> metadata; - public String getResource() { - return resource; - } + public String getResource() { + return resource; + } - public String getTimestamp() { - return timestamp; - } + public String getTimestamp() { + return timestamp; + } - public String getProject() { - return project; - } + public String getProject() { + return project; + } - public String getUser() { - return user; - } + public String getUser() { + return user; + } - public Map<String, Object> getMetadata() { - return metadata; - } + public Map<String, Object> getMetadata() { + return metadata; + } - @Override - public String toString() { - return "Resource [resource=" + resource + ", timestamp=" + timestamp - + ", project=" + project + ", user=" + user + ", metadata=" - + metadata + "]"; - } - + @Override + public String toString() { + return "Resource [resource=" + resource + ", timestamp=" + timestamp + + ", project=" + project + ", user=" + user + ", metadata=" + + metadata + "]"; + } + } 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 4092495..722b1a9 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 @@ -22,89 +22,89 @@ 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<String, Object> 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<String, Object> 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<String, Object> 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<String, Object> 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 163b799..c741abc 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 @@ -21,84 +21,84 @@ 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; + + 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 + "]"; + } + } diff --git a/glance-model/src/main/java/com/woorea/openstack/glance/model/ImageDownload.java b/glance-model/src/main/java/com/woorea/openstack/glance/model/ImageDownload.java index 19d0833..eb286ff 100644 --- a/glance-model/src/main/java/com/woorea/openstack/glance/model/ImageDownload.java +++ b/glance-model/src/main/java/com/woorea/openstack/glance/model/ImageDownload.java @@ -19,37 +19,37 @@ package com.woorea.openstack.glance.model; import java.io.InputStream; public class ImageDownload { - - private Image image; - - private InputStream inputStream; - - /** - * @return the image - */ - public Image getImage() { - return image; - } - - /** - * @param image the image to set - */ - public void setImage(Image image) { - this.image = image; - } - - /** - * @return the inputStream - */ - public InputStream getInputStream() { - return inputStream; - } - - /** - * @param inputStream the inputStream to set - */ - public void setInputStream(InputStream inputStream) { - this.inputStream = inputStream; - } + + private Image image; + + private InputStream inputStream; + + /** + * @return the image + */ + public Image getImage() { + return image; + } + + /** + * @param image the image to set + */ + public void setImage(Image image) { + this.image = image; + } + + /** + * @return the inputStream + */ + public InputStream getInputStream() { + return inputStream; + } + + /** + * @param inputStream the inputStream to set + */ + public void setInputStream(InputStream inputStream) { + this.inputStream = inputStream; + } } diff --git a/glance-model/src/main/java/com/woorea/openstack/glance/model/ImageMember.java b/glance-model/src/main/java/com/woorea/openstack/glance/model/ImageMember.java index a25bb95..5378139 100644 --- a/glance-model/src/main/java/com/woorea/openstack/glance/model/ImageMember.java +++ b/glance-model/src/main/java/com/woorea/openstack/glance/model/ImageMember.java @@ -22,47 +22,47 @@ import org.codehaus.jackson.annotate.JsonProperty; public class ImageMember implements Serializable { - @JsonProperty("can_share") - private boolean canShare; - - @JsonProperty("member_id") - private String memberId; + @JsonProperty("can_share") + private boolean canShare; + + @JsonProperty("member_id") + private String memberId; - public ImageMember() { - - } + public ImageMember() { + + } - public ImageMember(boolean canShare, String memberId) { - this.canShare = canShare; - this.memberId = memberId; - } + public ImageMember(boolean canShare, String memberId) { + this.canShare = canShare; + this.memberId = memberId; + } - /** - * @return the canShare - */ - public boolean isCanShare() { - return canShare; - } + /** + * @return the canShare + */ + public boolean isCanShare() { + return canShare; + } - /** - * @param canShare the canShare to set - */ - public void setCanShare(boolean canShare) { - this.canShare = canShare; - } + /** + * @param canShare the canShare to set + */ + public void setCanShare(boolean canShare) { + this.canShare = canShare; + } - /** - * @return the memberId - */ - public String getMemberId() { - return memberId; - } + /** + * @return the memberId + */ + public String getMemberId() { + return memberId; + } - /** - * @param memberId the memberId to set - */ - public void setMemberId(String memberId) { - this.memberId = memberId; - } + /** + * @param memberId the memberId to set + */ + public void setMemberId(String memberId) { + this.memberId = memberId; + } } diff --git a/glance-model/src/main/java/com/woorea/openstack/glance/model/ImageMembers.java b/glance-model/src/main/java/com/woorea/openstack/glance/model/ImageMembers.java index c519d38..21d6d57 100644 --- a/glance-model/src/main/java/com/woorea/openstack/glance/model/ImageMembers.java +++ b/glance-model/src/main/java/com/woorea/openstack/glance/model/ImageMembers.java @@ -24,19 +24,19 @@ import org.codehaus.jackson.annotate.JsonProperty; public class ImageMembers implements Iterable<ImageMember>, Serializable { - @JsonProperty("members") - private List<ImageMember> list; + @JsonProperty("members") + private List<ImageMember> list; - /** - * @return the list - */ - public List<ImageMember> getList() { - return list; - } + /** + * @return the list + */ + public List<ImageMember> getList() { + return list; + } - @Override - public Iterator<ImageMember> iterator() { - return list.iterator(); - } - + @Override + public Iterator<ImageMember> iterator() { + return list.iterator(); + } + }
\ No newline at end of file diff --git a/glance-model/src/main/java/com/woorea/openstack/glance/model/ImageUpload.java b/glance-model/src/main/java/com/woorea/openstack/glance/model/ImageUpload.java index f68b2be..428a5d2 100644 --- a/glance-model/src/main/java/com/woorea/openstack/glance/model/ImageUpload.java +++ b/glance-model/src/main/java/com/woorea/openstack/glance/model/ImageUpload.java @@ -22,62 +22,62 @@ import java.util.Map; public class ImageUpload { - private Image image; - - private String store; - - private Map<String, Object> properties; - - private InputStream inputStream; - - public ImageUpload(Image image) { - setImage(image); - } - - public Image getImage() { - return image; - } - - public void setImage(Image image) { - this.image = image; - } - - /** - * @return the store - */ - public String getStore() { - return store; - } - - /** - * @param store the store to set - */ - public void setStore(String store) { - this.store = store; - } - - /** - * @return the properties - */ - public Map<String, Object> getProperties() { - if(properties == null) { - properties = new HashMap<>(); - } - return properties; - } - - /** - * @return the inputStream - */ - public InputStream getInputStream() { - return inputStream; - } - - /** - * @param inputStream the inputStream to set - */ - public void setInputStream(InputStream inputStream) { - this.inputStream = inputStream; - } + private Image image; + + private String store; + + private Map<String, Object> properties; + + private InputStream inputStream; + + public ImageUpload(Image image) { + setImage(image); + } + + public Image getImage() { + return image; + } + + public void setImage(Image image) { + this.image = image; + } + + /** + * @return the store + */ + public String getStore() { + return store; + } + + /** + * @param store the store to set + */ + public void setStore(String store) { + this.store = store; + } + + /** + * @return the properties + */ + public Map<String, Object> getProperties() { + if(properties == null) { + properties = new HashMap<>(); + } + return properties; + } + + /** + * @return the inputStream + */ + public InputStream getInputStream() { + return inputStream; + } + + /** + * @param inputStream the inputStream to set + */ + public void setInputStream(InputStream inputStream) { + this.inputStream = inputStream; + } } diff --git a/glance-model/src/main/java/com/woorea/openstack/glance/model/Images.java b/glance-model/src/main/java/com/woorea/openstack/glance/model/Images.java index 4b0999a..191c889 100644 --- a/glance-model/src/main/java/com/woorea/openstack/glance/model/Images.java +++ b/glance-model/src/main/java/com/woorea/openstack/glance/model/Images.java @@ -24,19 +24,19 @@ import org.codehaus.jackson.annotate.JsonProperty; public class Images implements Iterable<Image>, Serializable { - @JsonProperty("images") - private List<Image> list; + @JsonProperty("images") + private List<Image> list; - /** - * @return the list - */ - public List<Image> getList() { - return list; - } + /** + * @return the list + */ + public List<Image> getList() { + return list; + } - @Override - public Iterator<Image> iterator() { - return list.iterator(); - } - + @Override + public Iterator<Image> iterator() { + return list.iterator(); + } + } diff --git a/glance-model/src/main/java/com/woorea/openstack/glance/model/SharedImage.java b/glance-model/src/main/java/com/woorea/openstack/glance/model/SharedImage.java index cd09571..b16897c 100644 --- a/glance-model/src/main/java/com/woorea/openstack/glance/model/SharedImage.java +++ b/glance-model/src/main/java/com/woorea/openstack/glance/model/SharedImage.java @@ -17,5 +17,5 @@ package com.woorea.openstack.glance.model; public class SharedImage { - + }
\ No newline at end of file diff --git a/glance-model/src/main/java/com/woorea/openstack/glance/model/SharedImages.java b/glance-model/src/main/java/com/woorea/openstack/glance/model/SharedImages.java index b984595..412e724 100644 --- a/glance-model/src/main/java/com/woorea/openstack/glance/model/SharedImages.java +++ b/glance-model/src/main/java/com/woorea/openstack/glance/model/SharedImages.java @@ -24,19 +24,19 @@ import org.codehaus.jackson.annotate.JsonProperty; public class SharedImages implements Iterable<SharedImage>, Serializable { - @JsonProperty("shared_images") - private List<SharedImage> list; + @JsonProperty("shared_images") + private List<SharedImage> list; - /** - * @return the list - */ - public List<SharedImage> getList() { - return list; - } + /** + * @return the list + */ + public List<SharedImage> getList() { + return list; + } - @Override - public Iterator<SharedImage> iterator() { - return list.iterator(); - } - + @Override + public Iterator<SharedImage> iterator() { + return list.iterator(); + } + }
\ No newline at end of file diff --git a/heat-model/src/main/java/com/woorea/openstack/heat/model/Explanation.java b/heat-model/src/main/java/com/woorea/openstack/heat/model/Explanation.java index 18455e0..ed2395b 100644 --- a/heat-model/src/main/java/com/woorea/openstack/heat/model/Explanation.java +++ b/heat-model/src/main/java/com/woorea/openstack/heat/model/Explanation.java @@ -47,47 +47,47 @@ public class Explanation { private String type; public String getMessage() { - return message; + return message; } public String getTraceback() { - return traceback; + return traceback; } public String getType() { - return type; + return type; } } private Error error; public String getExplanation() { - return explanation; + return explanation; } public int getCode() { - return code; + return code; } public String getTitle() { - return title; + return title; } public Error getError() { - return error; + return error; } - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Explanation [ " + - "code='" + code + - "', title='" + title + - "', explanation='" + explanation + - "', Error [type='" + error.type + - "', message='" + error.message + "' ] ]"; - } + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Explanation [ " + + "code='" + code + + "', title='" + title + + "', explanation='" + explanation + + "', Error [type='" + error.type + + "', message='" + error.message + "' ] ]"; + } } diff --git a/heat-model/src/main/java/com/woorea/openstack/heat/model/Stack.java b/heat-model/src/main/java/com/woorea/openstack/heat/model/Stack.java index 724f6de..a07764b 100644 --- a/heat-model/src/main/java/com/woorea/openstack/heat/model/Stack.java +++ b/heat-model/src/main/java/com/woorea/openstack/heat/model/Stack.java @@ -65,7 +65,7 @@ public class Stack { // ObjectMapper instance to parse Json stack outputs @JsonIgnore - private static ObjectMapper mapper = new ObjectMapper(); + private static ObjectMapper mapper = new ObjectMapper(); public Date getUpdatedTime() { return updatedTime; @@ -133,10 +133,10 @@ public class Stack { } public Map<String, Object> getFiles() { - return this.files; + return this.files; } public void setFiles(Map<String, Object> files) { - this.files = files; + this.files = files; } @@ -157,103 +157,103 @@ public class Stack { '}'; } - @JsonIgnoreProperties(ignoreUnknown=true) - public static final class Output { - @JsonProperty("output_value") - private Object outputValue; - - private String description; - - @JsonProperty("output_key") - private String outputKey; - - public Object getOutputValue() { - return outputValue; - } - - public String getDescription() { - return description; - } - - public String getOutputKey() { - return outputKey; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Output [key=" + outputKey + ", value=" - + outputValue + "]"; - } - } - - private List<Output> outputs; - - public List<Output> getOutputs() { - return outputs; - } - - private Object _findOutputValue (String key) { - for (Output o : outputs) { - if (o.getOutputKey().equals(key)) { - return o.getOutputValue(); - } - } - return null; - } - - /* - * Return a stack output as a String. - * Generally speaking, most outputs will be Strings. - */ - public String getOutputValue (String key) - { - Object value = _findOutputValue(key); - if (value != null) - return value.toString(); - else - return null; - } - - /* - * Return a stack output as a Json-mapped Object of the provided type. - * This is useful for json-object stack outputs. - */ - public <T> T getOutputValue (String key, Class<T> type) - { - try { - String s = mapper.writeValueAsString(_findOutputValue(key)); - return mapper.readValue(s, type); - } - catch (IOException e) { - return null; - } - } - - @JsonProperty("parameters") - private Map<String,Object> parameters = new HashMap<>(); - - public void setParameters (Map<String,Object> params) - { - // Need to "fix" comma-delimited-list parameters for pre-Juno Heat - // (see https://bugs.launchpad.net/heat/+bug/1367393) - parameters = params; - - for (Entry<String,Object> param : parameters.entrySet()) - { - // CDL params are returned as a string with format: - // "[u'<value1>',u'<value2>',...]" - String value = param.getValue().toString(); - if (value.startsWith("[") && value.endsWith("]")) - { - param.setValue(value.substring(1,value.length()-1).replaceAll("u'([^\']+)'","$1")); - } - } - } - - public Map<String,Object> getParameters() { - return parameters; - } + @JsonIgnoreProperties(ignoreUnknown=true) + public static final class Output { + @JsonProperty("output_value") + private Object outputValue; + + private String description; + + @JsonProperty("output_key") + private String outputKey; + + public Object getOutputValue() { + return outputValue; + } + + public String getDescription() { + return description; + } + + public String getOutputKey() { + return outputKey; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Output [key=" + outputKey + ", value=" + + outputValue + "]"; + } + } + + private List<Output> outputs; + + public List<Output> getOutputs() { + return outputs; + } + + private Object _findOutputValue (String key) { + for (Output o : outputs) { + if (o.getOutputKey().equals(key)) { + return o.getOutputValue(); + } + } + return null; + } + + /* + * Return a stack output as a String. + * Generally speaking, most outputs will be Strings. + */ + public String getOutputValue (String key) + { + Object value = _findOutputValue(key); + if (value != null) + return value.toString(); + else + return null; + } + + /* + * Return a stack output as a Json-mapped Object of the provided type. + * This is useful for json-object stack outputs. + */ + public <T> T getOutputValue (String key, Class<T> type) + { + try { + String s = mapper.writeValueAsString(_findOutputValue(key)); + return mapper.readValue(s, type); + } + catch (IOException e) { + return null; + } + } + + @JsonProperty("parameters") + private Map<String,Object> parameters = new HashMap<>(); + + public void setParameters (Map<String,Object> params) + { + // Need to "fix" comma-delimited-list parameters for pre-Juno Heat + // (see https://bugs.launchpad.net/heat/+bug/1367393) + parameters = params; + + for (Entry<String,Object> param : parameters.entrySet()) + { + // CDL params are returned as a string with format: + // "[u'<value1>',u'<value2>',...]" + String value = param.getValue().toString(); + if (value.startsWith("[") && value.endsWith("]")) + { + param.setValue(value.substring(1,value.length()-1).replaceAll("u'([^\']+)'","$1")); + } + } + } + + public Map<String,Object> getParameters() { + return parameters; + } } diff --git a/heat-model/src/main/java/com/woorea/openstack/heat/model/UpdateStackParam.java b/heat-model/src/main/java/com/woorea/openstack/heat/model/UpdateStackParam.java index 69041dd..5274d16 100644 --- a/heat-model/src/main/java/com/woorea/openstack/heat/model/UpdateStackParam.java +++ b/heat-model/src/main/java/com/woorea/openstack/heat/model/UpdateStackParam.java @@ -112,10 +112,10 @@ public class UpdateStackParam { } public void setFiles(Map<String, Object> files) { - this.files = files; + this.files = files; } public Map<String, Object> getFiles() { - return this.files; + return this.files; } /** diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/api/EndpointsResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/api/EndpointsResource.java index 9b1580c..db970a5 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/api/EndpointsResource.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/api/EndpointsResource.java @@ -25,63 +25,63 @@ import com.woorea.openstack.keystone.model.Endpoint; import com.woorea.openstack.keystone.model.Endpoints; public class EndpointsResource { - - private OpenStackClient client; - - public EndpointsResource(OpenStackClient client) { - this.client = client; - } - - public List list() { - return new List(); - } - - public Create create(Endpoint endpoint) { - return new Create(endpoint); - } - - public Show show(String id) { - return new Show(id); - } + + private OpenStackClient client; + + public EndpointsResource(OpenStackClient client) { + this.client = client; + } + + public List list() { + return new List(); + } + + public Create create(Endpoint endpoint) { + return new Create(endpoint); + } + + public Show show(String id) { + return new Show(id); + } - - public Delete delete(String id) { - return new Delete(id); - } + + public Delete delete(String id) { + return new Delete(id); + } - public class List extends OpenStackRequest<Endpoints> { - - public List() { - super(client, HttpMethod.GET, "/endpoints", null, Endpoints.class); - } + public class List extends OpenStackRequest<Endpoints> { + + public List() { + super(client, HttpMethod.GET, "/endpoints", null, Endpoints.class); + } - } - - public class Create extends OpenStackRequest<Endpoint> { + } + + public class Create extends OpenStackRequest<Endpoint> { - private Endpoint endpoint; - - public Create(Endpoint endpoint) { - super(client, HttpMethod.POST, "/endpoints", Entity.json(endpoint), Endpoint.class); - this.endpoint = endpoint; - } - - } - - public class Show extends OpenStackRequest<Endpoint> { - - public Show(String id) { - super(client, HttpMethod.GET, new StringBuilder("/endpoints/").append(id).toString(), null, Endpoint.class); - } + private Endpoint endpoint; + + public Create(Endpoint endpoint) { + super(client, HttpMethod.POST, "/endpoints", Entity.json(endpoint), Endpoint.class); + this.endpoint = endpoint; + } + + } + + public class Show extends OpenStackRequest<Endpoint> { + + public Show(String id) { + super(client, HttpMethod.GET, new StringBuilder("/endpoints/").append(id).toString(), null, Endpoint.class); + } - } - - public class Delete extends OpenStackRequest<Void> { - - public Delete(String id) { - super(client, HttpMethod.DELETE, new StringBuilder("/endpoints/").append(id).toString(), null, Void.class); - } - - } - + } + + public class Delete extends OpenStackRequest<Void> { + + public Delete(String id) { + super(client, HttpMethod.DELETE, new StringBuilder("/endpoints/").append(id).toString(), null, Void.class); + } + + } + } diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/api/RolesResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/api/RolesResource.java index d4dd6d3..71641fb 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/api/RolesResource.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/api/RolesResource.java @@ -25,50 +25,50 @@ import com.woorea.openstack.keystone.model.Role; import com.woorea.openstack.keystone.model.Roles; public class RolesResource { - - private OpenStackClient client; - - public RolesResource(OpenStackClient client) { - this.client = client; - } - - public List list() { - return new List(); - } - - public Create create(Role role) { - return new Create(role); - } - - public Delete delete(String id) { - return new Delete(id); - } + + private OpenStackClient client; + + public RolesResource(OpenStackClient client) { + this.client = client; + } + + public List list() { + return new List(); + } + + public Create create(Role role) { + return new Create(role); + } + + public Delete delete(String id) { + return new Delete(id); + } - public class List extends OpenStackRequest<Roles> { - - public List() { - super(client, HttpMethod.GET, "/OS-KSADM/roles", null, Roles.class); - } + public class List extends OpenStackRequest<Roles> { + + public List() { + super(client, HttpMethod.GET, "/OS-KSADM/roles", null, Roles.class); + } - } - - public class Create extends OpenStackRequest<Role> { + } + + public class Create extends OpenStackRequest<Role> { - private Role role; - - public Create(Role role) { - super(client, HttpMethod.POST, "/OS-KSADM/roles", Entity.json(role), Role.class); - this.role = role; - } - - } - - public class Delete extends OpenStackRequest<Void> { - - public Delete(String id) { - super(client, HttpMethod.DELETE, new StringBuilder("/OS-KSADM/roles/").append(id).toString(), null, Void.class); - } - - } - + private Role role; + + public Create(Role role) { + super(client, HttpMethod.POST, "/OS-KSADM/roles", Entity.json(role), Role.class); + this.role = role; + } + + } + + public class Delete extends OpenStackRequest<Void> { + + public Delete(String id) { + super(client, HttpMethod.DELETE, new StringBuilder("/OS-KSADM/roles/").append(id).toString(), null, Void.class); + } + + } + } diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/api/ServicesResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/api/ServicesResource.java index bf0a439..315d2be 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/api/ServicesResource.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/api/ServicesResource.java @@ -25,62 +25,62 @@ import com.woorea.openstack.keystone.model.Service; import com.woorea.openstack.keystone.model.Services; public class ServicesResource { - - private OpenStackClient client; - - public ServicesResource(OpenStackClient client) { - this.client = client; - } - - public List list() { - return new List(); - } - - public Create create(Service service) { - return new Create(service); - } - - public Show show(String id) { - return new Show(id); - } - - public Delete delete(String id) { - return new Delete(id); - } + + private OpenStackClient client; + + public ServicesResource(OpenStackClient client) { + this.client = client; + } + + public List list() { + return new List(); + } + + public Create create(Service service) { + return new Create(service); + } + + public Show show(String id) { + return new Show(id); + } + + public Delete delete(String id) { + return new Delete(id); + } - public class List extends OpenStackRequest<Services> { - - public List() { - super(client, HttpMethod.GET, "/OS-KSADM/services", null, Services.class); - } + public class List extends OpenStackRequest<Services> { + + public List() { + super(client, HttpMethod.GET, "/OS-KSADM/services", null, Services.class); + } - } - - public class Create extends OpenStackRequest<Service> { + } + + public class Create extends OpenStackRequest<Service> { - private Service service; - - public Create(Service service) { - super(client, HttpMethod.POST, "/OS-KSADM/services", Entity.json(service), Service.class); - this.service = service; - } - - } - - public class Show extends OpenStackRequest<Service> { - - public Show(String id) { - super(client, HttpMethod.GET, new StringBuilder("/OS-KSADM/services/").append(id).toString(), null, Service.class); - } + private Service service; + + public Create(Service service) { + super(client, HttpMethod.POST, "/OS-KSADM/services", Entity.json(service), Service.class); + this.service = service; + } + + } + + public class Show extends OpenStackRequest<Service> { + + public Show(String id) { + super(client, HttpMethod.GET, new StringBuilder("/OS-KSADM/services/").append(id).toString(), null, Service.class); + } - } - - public class Delete extends OpenStackRequest<Void> { - - public Delete(String id) { - super(client, HttpMethod.DELETE, new StringBuilder("/OS-KSADM/services/").append(id).toString(), null, Void.class); - } - - } - + } + + public class Delete extends OpenStackRequest<Void> { + + public Delete(String id) { + super(client, HttpMethod.DELETE, new StringBuilder("/OS-KSADM/services/").append(id).toString(), null, Void.class); + } + + } + } diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/CredentialsResources.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/CredentialsResources.java index 19d9a10..4f67f6c 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/CredentialsResources.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/CredentialsResources.java @@ -22,8 +22,8 @@ import com.woorea.openstack.keystone.v3.model.Credentials; public class CredentialsResources extends GenericResource<Credential, Credentials> { - public CredentialsResources(OpenStackClient client) { - super(client, "/credentials", Credential.class, Credentials.class); - } + public CredentialsResources(OpenStackClient client) { + super(client, "/credentials", Credential.class, Credentials.class); + } } diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/DomainGroupRolesResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/DomainGroupRolesResource.java index bb3e0f8..506b911 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/DomainGroupRolesResource.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/DomainGroupRolesResource.java @@ -22,8 +22,8 @@ import com.woorea.openstack.keystone.v3.model.Roles; public class DomainGroupRolesResource extends GenericResource<Role, Roles> { - public DomainGroupRolesResource(OpenStackClient client, String path) { - super(client, path, Role.class, Roles.class); - } + public DomainGroupRolesResource(OpenStackClient client, String path) { + super(client, path, Role.class, Roles.class); + } } diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/DomainUserRolesResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/DomainUserRolesResource.java index af0f7e1..44ffb2d 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/DomainUserRolesResource.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/DomainUserRolesResource.java @@ -25,16 +25,16 @@ import com.woorea.openstack.keystone.model.Roles; public class DomainUserRolesResource extends GenericResource<Role, Roles> { - public DomainUserRolesResource(OpenStackClient client, String path) { - super(client, path, Role.class, Roles.class); - } + public DomainUserRolesResource(OpenStackClient client, String path) { + super(client, path, Role.class, Roles.class); + } - public OpenStackRequest<Void> add(String roleId) { - return new OpenStackRequest<>(CLIENT, HttpMethod.PUT, new StringBuilder(path).append("/").append(roleId).toString(), Entity.json(""), Void.class); - } - - public OpenStackRequest<Void> remove(String roleId) { - return new OpenStackRequest<>(CLIENT, HttpMethod.DELETE, new StringBuilder(path).append("/").append(roleId).toString(), null, Void.class); - } + public OpenStackRequest<Void> add(String roleId) { + return new OpenStackRequest<>(CLIENT, HttpMethod.PUT, new StringBuilder(path).append("/").append(roleId).toString(), Entity.json(""), Void.class); + } + + public OpenStackRequest<Void> remove(String roleId) { + return new OpenStackRequest<>(CLIENT, HttpMethod.DELETE, new StringBuilder(path).append("/").append(roleId).toString(), null, Void.class); + } } diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/DomainsResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/DomainsResource.java index 9aa01f3..c04aba0 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/DomainsResource.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/DomainsResource.java @@ -22,16 +22,16 @@ import com.woorea.openstack.keystone.v3.model.Domains; public class DomainsResource extends GenericResource<Domain, Domains> { - public DomainsResource(OpenStackClient client) { - super(client, "/domains", Domain.class, Domains.class); - } - - public DomainUserRolesResource userRoles(String domainId, String userId) { - return new DomainUserRolesResource(CLIENT, new StringBuilder(path).append("/").append(domainId).append("/users/").append(userId).append("/roles").toString()); - } - - public DomainUserRolesResource groupRoles(String domainId, String groupId) { - return new DomainUserRolesResource(CLIENT, new StringBuilder(path).append("/").append(domainId).append("/groups/").append(groupId).append("/roles").toString()); - } + public DomainsResource(OpenStackClient client) { + super(client, "/domains", Domain.class, Domains.class); + } + + public DomainUserRolesResource userRoles(String domainId, String userId) { + return new DomainUserRolesResource(CLIENT, new StringBuilder(path).append("/").append(domainId).append("/users/").append(userId).append("/roles").toString()); + } + + public DomainUserRolesResource groupRoles(String domainId, String groupId) { + return new DomainUserRolesResource(CLIENT, new StringBuilder(path).append("/").append(domainId).append("/groups/").append(groupId).append("/roles").toString()); + } } diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/EndpointsResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/EndpointsResource.java index 7a7b1bf..4d4d147 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/EndpointsResource.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/EndpointsResource.java @@ -22,8 +22,8 @@ import com.woorea.openstack.keystone.v3.model.Endpoints; public class EndpointsResource extends GenericResource<Endpoint, Endpoints> { - public EndpointsResource(OpenStackClient client) { - super(client, "/endpoints", Endpoint.class, Endpoints.class); - } + public EndpointsResource(OpenStackClient client) { + super(client, "/endpoints", Endpoint.class, Endpoints.class); + } } diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/GenericResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/GenericResource.java index 30c915c..c27ab8b 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/GenericResource.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/GenericResource.java @@ -23,38 +23,38 @@ import com.woorea.openstack.base.client.OpenStackRequest; public class GenericResource<One, Many> { - protected final OpenStackClient CLIENT; - - protected CharSequence path; - - protected Class<One> oneClass; - protected Class<Many> manyClass; - - public GenericResource(OpenStackClient client, CharSequence path, Class<One> oneClass, Class<Many> manyClass) { - CLIENT = client; - this.path = path; - this.oneClass = oneClass; - this.manyClass = manyClass; - } - - public OpenStackRequest<Many> list() { - return new OpenStackRequest<>(CLIENT, HttpMethod.GET, path, null, manyClass); - } - - public OpenStackRequest<One> create(One one) { - return new OpenStackRequest<>(CLIENT, HttpMethod.POST, path, Entity.json(one), oneClass); - } - - public OpenStackRequest<One> show(String id) { - return new OpenStackRequest<>(CLIENT, HttpMethod.GET, new StringBuilder(path).append("/").append(id).toString(), null, oneClass); - } - - public OpenStackRequest<One> update(String id, One one) { - return new OpenStackRequest<>(CLIENT, HttpMethod.PATCH, new StringBuilder(path).append("/").append(id).toString(), Entity.json(one), oneClass); - } - - public OpenStackRequest<One> delete(String id) { - return new OpenStackRequest<>(CLIENT, HttpMethod.DELETE, new StringBuilder(path).append("/").append(id).toString(), null, oneClass); - } - + protected final OpenStackClient CLIENT; + + protected CharSequence path; + + protected Class<One> oneClass; + protected Class<Many> manyClass; + + public GenericResource(OpenStackClient client, CharSequence path, Class<One> oneClass, Class<Many> manyClass) { + CLIENT = client; + this.path = path; + this.oneClass = oneClass; + this.manyClass = manyClass; + } + + public OpenStackRequest<Many> list() { + return new OpenStackRequest<>(CLIENT, HttpMethod.GET, path, null, manyClass); + } + + public OpenStackRequest<One> create(One one) { + return new OpenStackRequest<>(CLIENT, HttpMethod.POST, path, Entity.json(one), oneClass); + } + + public OpenStackRequest<One> show(String id) { + return new OpenStackRequest<>(CLIENT, HttpMethod.GET, new StringBuilder(path).append("/").append(id).toString(), null, oneClass); + } + + public OpenStackRequest<One> update(String id, One one) { + return new OpenStackRequest<>(CLIENT, HttpMethod.PATCH, new StringBuilder(path).append("/").append(id).toString(), Entity.json(one), oneClass); + } + + public OpenStackRequest<One> delete(String id) { + return new OpenStackRequest<>(CLIENT, HttpMethod.DELETE, new StringBuilder(path).append("/").append(id).toString(), null, oneClass); + } + } diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/GroupUsersResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/GroupUsersResource.java index 45da3a6..efcf7d0 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/GroupUsersResource.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/GroupUsersResource.java @@ -23,8 +23,8 @@ import com.woorea.openstack.keystone.v3.model.Users; public class GroupUsersResource extends GenericResource<User, Users> { - public GroupUsersResource(OpenStackClient client, String path) { - super(client, path, User.class, Users.class); - } + public GroupUsersResource(OpenStackClient client, String path) { + super(client, path, User.class, Users.class); + } } diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/GroupsResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/GroupsResource.java index 7c35825..c3b760f 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/GroupsResource.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/GroupsResource.java @@ -22,12 +22,12 @@ import com.woorea.openstack.keystone.v3.model.Groups; public class GroupsResource extends GenericResource<Group, Groups> { - public GroupsResource(OpenStackClient client) { - super(client, "/groups", Group.class, Groups.class); - } - - public DomainUserRolesResource userRoles(String domainId, String userId) { - return new DomainUserRolesResource(CLIENT, new StringBuilder(path).append("/").append(domainId).append("/users/").append(userId).append("/roles").toString()); - } + public GroupsResource(OpenStackClient client) { + super(client, "/groups", Group.class, Groups.class); + } + + public DomainUserRolesResource userRoles(String domainId, String userId) { + return new DomainUserRolesResource(CLIENT, new StringBuilder(path).append("/").append(domainId).append("/users/").append(userId).append("/roles").toString()); + } } diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/PoliciesResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/PoliciesResource.java index 97eb70d..594974d 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/PoliciesResource.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/PoliciesResource.java @@ -24,8 +24,8 @@ import com.woorea.openstack.keystone.v3.model.Policy; public class PoliciesResource extends GenericResource<Policy, Policies> { - public PoliciesResource(OpenStackClient client) { - super(client, "/policies", Policy.class, Policies.class); - } + public PoliciesResource(OpenStackClient client) { + super(client, "/policies", Policy.class, Policies.class); + } } diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/ProjectGroupRolesResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/ProjectGroupRolesResource.java index bcdedd8..94c7680 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/ProjectGroupRolesResource.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/ProjectGroupRolesResource.java @@ -23,28 +23,28 @@ import com.woorea.openstack.keystone.model.Roles; public class ProjectGroupRolesResource extends GenericResource<Role, Roles> { - public ProjectGroupRolesResource(OpenStackClient client, String path) { - super(client, path, Role.class, Roles.class); - } - - @Override - public OpenStackRequest<Role> create(Role one) { - throw new UnsupportedOperationException(); - } - - @Override - public OpenStackRequest<Role> show(String id) { - throw new UnsupportedOperationException(); - } - - @Override - public OpenStackRequest<Role> update(String id, Role one) { - throw new UnsupportedOperationException(); - } - - @Override - public OpenStackRequest<Role> delete(String id) { - throw new UnsupportedOperationException(); - } + public ProjectGroupRolesResource(OpenStackClient client, String path) { + super(client, path, Role.class, Roles.class); + } + + @Override + public OpenStackRequest<Role> create(Role one) { + throw new UnsupportedOperationException(); + } + + @Override + public OpenStackRequest<Role> show(String id) { + throw new UnsupportedOperationException(); + } + + @Override + public OpenStackRequest<Role> update(String id, Role one) { + throw new UnsupportedOperationException(); + } + + @Override + public OpenStackRequest<Role> delete(String id) { + throw new UnsupportedOperationException(); + } } diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/ProjectRolesResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/ProjectRolesResource.java index 9902826..a2cd01c 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/ProjectRolesResource.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/ProjectRolesResource.java @@ -22,22 +22,22 @@ import com.woorea.openstack.base.client.OpenStackClient; import com.woorea.openstack.base.client.OpenStackRequest; public class ProjectRolesResource { - - private final OpenStackClient CLIENT; - - private final String PATH; + + private final OpenStackClient CLIENT; + + private final String PATH; - public ProjectRolesResource(OpenStackClient client, String path) { - this.CLIENT = client; - this.PATH = path; - } - - public OpenStackRequest<Void> add(String roleId) { - return new OpenStackRequest<>(CLIENT, HttpMethod.PUT, new StringBuilder(PATH).append("/").append(roleId).toString(), Entity.json(""), Void.class); - } - - public OpenStackRequest<Void> remove(String roleId) { - return new OpenStackRequest<>(CLIENT, HttpMethod.DELETE, new StringBuilder(PATH).append("/").append(roleId).toString(), null, Void.class); - } + public ProjectRolesResource(OpenStackClient client, String path) { + this.CLIENT = client; + this.PATH = path; + } + + public OpenStackRequest<Void> add(String roleId) { + return new OpenStackRequest<>(CLIENT, HttpMethod.PUT, new StringBuilder(PATH).append("/").append(roleId).toString(), Entity.json(""), Void.class); + } + + public OpenStackRequest<Void> remove(String roleId) { + return new OpenStackRequest<>(CLIENT, HttpMethod.DELETE, new StringBuilder(PATH).append("/").append(roleId).toString(), null, Void.class); + } } diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/ProjectUserRolesResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/ProjectUserRolesResource.java index 255dfc1..95f5d0c 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/ProjectUserRolesResource.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/ProjectUserRolesResource.java @@ -25,16 +25,16 @@ import com.woorea.openstack.keystone.model.Roles; public class ProjectUserRolesResource extends GenericResource<Role, Roles> { - public ProjectUserRolesResource(OpenStackClient client, String path) { - super(client, path, Role.class, Roles.class); - } - - public OpenStackRequest<Void> add(String roleId) { - return new OpenStackRequest<>(CLIENT, HttpMethod.PUT, new StringBuilder(path).append("/").append(roleId).toString(), Entity.json(""), Void.class); - } - - public OpenStackRequest<Void> remove(String roleId) { - return new OpenStackRequest<>(CLIENT, HttpMethod.DELETE, new StringBuilder(path).append("/").append(roleId).toString(), null, Void.class); - } + public ProjectUserRolesResource(OpenStackClient client, String path) { + super(client, path, Role.class, Roles.class); + } + + public OpenStackRequest<Void> add(String roleId) { + return new OpenStackRequest<>(CLIENT, HttpMethod.PUT, new StringBuilder(path).append("/").append(roleId).toString(), Entity.json(""), Void.class); + } + + public OpenStackRequest<Void> remove(String roleId) { + return new OpenStackRequest<>(CLIENT, HttpMethod.DELETE, new StringBuilder(path).append("/").append(roleId).toString(), null, Void.class); + } } diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/ProjectsResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/ProjectsResource.java index b58f990..900ce20 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/ProjectsResource.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/ProjectsResource.java @@ -24,20 +24,20 @@ import com.woorea.openstack.keystone.v3.model.Projects; public class ProjectsResource extends GenericResource<Project, Projects> { - public ProjectsResource(OpenStackClient client) { - super(client, "/projects", Project.class, Projects.class); - } - - public OpenStackRequest<Users> users(String projectId) { - return CLIENT.get(new StringBuilder(path).append("/").append(projectId).append("/users/").toString(), Users.class); - } - - public ProjectUserRolesResource userRoles(String projectId, String userId) { - return new ProjectUserRolesResource(CLIENT, new StringBuilder(path).append("/").append(projectId).append("/users/").append(userId).append("/roles").toString()); - } - - public ProjectUserRolesResource groupRoles(String projectId, String groupId) { - return new ProjectUserRolesResource(CLIENT, new StringBuilder(path).append("/").append(projectId).append("/groups/").append(groupId).append("/roles").toString()); - } + public ProjectsResource(OpenStackClient client) { + super(client, "/projects", Project.class, Projects.class); + } + + public OpenStackRequest<Users> users(String projectId) { + return CLIENT.get(new StringBuilder(path).append("/").append(projectId).append("/users/").toString(), Users.class); + } + + public ProjectUserRolesResource userRoles(String projectId, String userId) { + return new ProjectUserRolesResource(CLIENT, new StringBuilder(path).append("/").append(projectId).append("/users/").append(userId).append("/roles").toString()); + } + + public ProjectUserRolesResource groupRoles(String projectId, String groupId) { + return new ProjectUserRolesResource(CLIENT, new StringBuilder(path).append("/").append(projectId).append("/groups/").append(groupId).append("/roles").toString()); + } } diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/RolesResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/RolesResource.java index addd004..ae8fc60 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/RolesResource.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/RolesResource.java @@ -24,12 +24,12 @@ import com.woorea.openstack.keystone.v3.model.Users; public class RolesResource extends GenericResource<Role, Roles> { - public RolesResource(OpenStackClient client) { - super(client, "/roles", Role.class, Roles.class); - } - - public OpenStackRequest<Users> users(String domainId, String userId) { - return CLIENT.get(new StringBuilder(path).append("/").append(domainId).append("/users/").append(userId).append("/roles").toString(), Users.class); - } + public RolesResource(OpenStackClient client) { + super(client, "/roles", Role.class, Roles.class); + } + + public OpenStackRequest<Users> users(String domainId, String userId) { + return CLIENT.get(new StringBuilder(path).append("/").append(domainId).append("/users/").append(userId).append("/roles").toString(), Users.class); + } } diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/ServicesResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/ServicesResource.java index 28603fa..c0e25e6 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/ServicesResource.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/ServicesResource.java @@ -22,8 +22,8 @@ import com.woorea.openstack.keystone.model.Services; public class ServicesResource extends GenericResource<Service, Services> { - public ServicesResource(OpenStackClient client) { - super(client, "/services", Service.class, Services.class); - } + public ServicesResource(OpenStackClient client) { + super(client, "/services", Service.class, Services.class); + } } diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/TokensResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/TokensResource.java index b564d7d..9d176d7 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/TokensResource.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/TokensResource.java @@ -24,35 +24,35 @@ import com.woorea.openstack.keystone.v3.model.Authentication; import com.woorea.openstack.keystone.v3.model.Token; public class TokensResource { - - private final OpenStackClient CLIENT; - - public TokensResource(OpenStackClient client) { - CLIENT = client; - } - - public Authenticate authenticate(Authentication authentication) { - return new Authenticate(authentication); - } - - public OpenStackRequest<Token> show() { - return CLIENT.get("/auth/tokens", Token.class); - } + + private final OpenStackClient CLIENT; + + public TokensResource(OpenStackClient client) { + CLIENT = client; + } + + public Authenticate authenticate(Authentication authentication) { + return new Authenticate(authentication); + } + + public OpenStackRequest<Token> show() { + return CLIENT.get("/auth/tokens", Token.class); + } - public class Authenticate extends OpenStackRequest<Token> { - - private Authentication authentication; - - public Authenticate() { - - } - - public Authenticate(Authentication authentication) { - super(CLIENT, HttpMethod.POST, "/auth/tokens", Entity.json(authentication), Token.class); - this.authentication = authentication; - } + public class Authenticate extends OpenStackRequest<Token> { + + private Authentication authentication; + + public Authenticate() { + + } + + public Authenticate(Authentication authentication) { + super(CLIENT, HttpMethod.POST, "/auth/tokens", Entity.json(authentication), Token.class); + this.authentication = authentication; + } - } - + } + } diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/UsersResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/UsersResource.java index 73cdb46..0e1e609 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/UsersResource.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/UsersResource.java @@ -24,20 +24,20 @@ import com.woorea.openstack.keystone.v3.model.Users; public class UsersResource extends GenericResource<User, Users> { - public UsersResource(OpenStackClient client) { - super(client, "/users", User.class, Users.class); - } - - public OpenStackRequest<Services> groups(String userId) { - return CLIENT.get(new StringBuilder(path).append("/").append(userId).append("/groups").toString(), Services.class); - } - - public OpenStackRequest<Services> projects(String userId) { - return CLIENT.get(new StringBuilder(path).append("/").append(userId).append("/projects").toString(), Services.class); - } - - public OpenStackRequest<Services> roles(String userId) { - return CLIENT.get(new StringBuilder(path).append("/").append(userId).append("/roles").toString(), Services.class); - } + public UsersResource(OpenStackClient client) { + super(client, "/users", User.class, Users.class); + } + + public OpenStackRequest<Services> groups(String userId) { + return CLIENT.get(new StringBuilder(path).append("/").append(userId).append("/groups").toString(), Services.class); + } + + public OpenStackRequest<Services> projects(String userId) { + return CLIENT.get(new StringBuilder(path).append("/").append(userId).append("/projects").toString(), Services.class); + } + + public OpenStackRequest<Services> roles(String userId) { + return CLIENT.get(new StringBuilder(path).append("/").append(userId).append("/roles").toString(), Services.class); + } } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Access.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Access.java index f9ed517..b55ef65 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Access.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Access.java @@ -27,242 +27,242 @@ import org.codehaus.jackson.map.annotate.JsonRootName; @JsonRootName("access") public class Access implements Serializable { - public static final class Service { - - @JsonIgnoreProperties(ignoreUnknown=true) - public static final class Endpoint { - - private String region; - - private String publicURL; - - private String internalURL; - - private String adminURL; + public static final class Service { + + @JsonIgnoreProperties(ignoreUnknown=true) + public static final class Endpoint { + + private String region; + + private String publicURL; + + private String internalURL; + + private String adminURL; - /** - * @return the region - */ - public String getRegion() { - return region; - } + /** + * @return the region + */ + public String getRegion() { + return region; + } - /** - * @return the publicURL - */ - public String getPublicURL() { - return publicURL; - } + /** + * @return the publicURL + */ + public String getPublicURL() { + return publicURL; + } - /** - * @return the internalURL - */ - public String getInternalURL() { - return internalURL; - } + /** + * @return the internalURL + */ + public String getInternalURL() { + return internalURL; + } - /** - * @return the adminURL - */ - public String getAdminURL() { - return adminURL; - } + /** + * @return the adminURL + */ + public String getAdminURL() { + return adminURL; + } - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Endpoint [region=" + region + ", publicURL=" - + publicURL + ", internalURL=" + internalURL - + ", adminURL=" + adminURL + "]"; - } - - } - - private String type; - - private String name; - - private List<Endpoint> endpoints; - - @JsonProperty("endpoints_links") - private List<Link> endpointsLinks; + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Endpoint [region=" + region + ", publicURL=" + + publicURL + ", internalURL=" + internalURL + + ", adminURL=" + adminURL + "]"; + } + + } + + private String type; + + private String name; + + private List<Endpoint> endpoints; + + @JsonProperty("endpoints_links") + private List<Link> endpointsLinks; - /** - * @return the type - */ - public String getType() { - return type; - } + /** + * @return the type + */ + public String getType() { + return type; + } - /** - * @return the name - */ - public String getName() { - return name; - } + /** + * @return the name + */ + public String getName() { + return name; + } - /** - * @return the endpoints - */ - public List<Endpoint> getEndpoints() { - return endpoints; - } + /** + * @return the endpoints + */ + public List<Endpoint> getEndpoints() { + return endpoints; + } - /** - * @return the endpointsLinks - */ - public List<Link> getEndpointsLinks() { - return endpointsLinks; - } + /** + * @return the endpointsLinks + */ + public List<Link> getEndpointsLinks() { + return endpointsLinks; + } - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Service [type=" + type + ", name=" + name + ", endpoints=" - + endpoints + ", endpointsLinks=" + endpointsLinks + "]"; - } - - } - - @JsonIgnoreProperties(ignoreUnknown=true) - public static final class User { - - @JsonIgnoreProperties(ignoreUnknown=true) - public static final class Role { - - private String id; - - private String name; + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Service [type=" + type + ", name=" + name + ", endpoints=" + + endpoints + ", endpointsLinks=" + endpointsLinks + "]"; + } + + } + + @JsonIgnoreProperties(ignoreUnknown=true) + public static final class User { + + @JsonIgnoreProperties(ignoreUnknown=true) + public static final class Role { + + private String id; + + private String name; - /** - * @return the id - */ - public String getId() { - return id; - } + /** + * @return the id + */ + public String getId() { + return id; + } - /** - * @return the name - */ - public String getName() { - return name; - } + /** + * @return the name + */ + public String getName() { + return name; + } - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Role [id=" + id + ", name=" + name + "]"; - } - - } - - private String id; - - private String name; - - private String username; - - private List<Role> roles; - - @JsonProperty("roles_links") - private List<Link> rolesLinks; + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Role [id=" + id + ", name=" + name + "]"; + } + + } + + private String id; + + private String name; + + private String username; + + private List<Role> roles; + + @JsonProperty("roles_links") + private List<Link> rolesLinks; - /** - * @return the id - */ - public String getId() { - return id; - } + /** + * @return the id + */ + public String getId() { + return id; + } - /** - * @return the name - */ - public String getName() { - return name; - } + /** + * @return the name + */ + public String getName() { + return name; + } - /** - * @return the username - */ - public String getUsername() { - return username; - } + /** + * @return the username + */ + public String getUsername() { + return username; + } - /** - * @return the roles - */ - public List<Role> getRoles() { - return roles; - } + /** + * @return the roles + */ + public List<Role> getRoles() { + return roles; + } - /** - * @return the rolesLinks - */ - public List<Link> getRolesLinks() { - return rolesLinks; - } + /** + * @return the rolesLinks + */ + public List<Link> getRolesLinks() { + return rolesLinks; + } - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "User [id=" + id + ", name=" + name + ", username=" - + username + ", roles=" + roles + ", rolesLinks=" - + rolesLinks + "]"; - } - - } - - private Token token; - - private List<Service> serviceCatalog; - - private User user; - - private Map<String, Object> metadata; + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "User [id=" + id + ", name=" + name + ", username=" + + username + ", roles=" + roles + ", rolesLinks=" + + rolesLinks + "]"; + } + + } + + private Token token; + + private List<Service> serviceCatalog; + + private User user; + + private Map<String, Object> metadata; - /** - * @return the token - */ - public Token getToken() { - return token; - } + /** + * @return the token + */ + public Token getToken() { + return token; + } - /** - * @return the serviceCatalog - */ - public List<Service> getServiceCatalog() { - return serviceCatalog; - } + /** + * @return the serviceCatalog + */ + public List<Service> getServiceCatalog() { + return serviceCatalog; + } - /** - * @return the user - */ - public User getUser() { - return user; - } + /** + * @return the user + */ + public User getUser() { + return user; + } - /** - * @return the metadata - */ - public Map<String, Object> getMetadata() { - return metadata; - } + /** + * @return the metadata + */ + public Map<String, Object> getMetadata() { + return metadata; + } - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Access [token=" + token + ", serviceCatalog=" + serviceCatalog - + ", user=" + user + ", metadata=" + metadata + "]"; - } - + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Access [token=" + token + ", serviceCatalog=" + serviceCatalog + + ", user=" + user + ", metadata=" + metadata + "]"; + } + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Authentication.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Authentication.java index 330eb01..1f1bf2f 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Authentication.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Authentication.java @@ -22,36 +22,36 @@ import org.codehaus.jackson.map.annotate.JsonRootName; public abstract class Authentication implements Serializable { - private String tenantId; - - private String tenantName; - - /** - * @return the tenantId - */ - public String getTenantId() { - return tenantId; - } - - /** - * @param tenantId the tenantId to set - */ - public void setTenantId(String tenantId) { - this.tenantId = tenantId; - } - - /** - * @return the tenantName - */ - public String getTenantName() { - return tenantName; - } - - /** - * @param tenantName the tenantName to set - */ - public void setTenantName(String tenantName) { - this.tenantName = tenantName; - } - + private String tenantId; + + private String tenantName; + + /** + * @return the tenantId + */ + public String getTenantId() { + return tenantId; + } + + /** + * @param tenantId the tenantId to set + */ + public void setTenantId(String tenantId) { + this.tenantId = tenantId; + } + + /** + * @return the tenantName + */ + public String getTenantName() { + return tenantName; + } + + /** + * @param tenantName the tenantName to set + */ + public void setTenantName(String tenantName) { + this.tenantName = tenantName; + } + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Endpoint.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Endpoint.java index 506f1f1..019b3df 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Endpoint.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Endpoint.java @@ -24,114 +24,114 @@ import org.codehaus.jackson.map.annotate.JsonRootName; @JsonRootName("endpoint") public class Endpoint implements Serializable { - private String id; - - @JsonProperty("service_id") - private String serviceId; - - private String region; - - @JsonProperty("publicurl") - private String publicURL; - - @JsonProperty("internalurl") - private String internalURL; - - @JsonProperty("adminurl") - private String adminURL; - - /** - * @return the id - */ - public String getId() { - return id; - } - - /** - * @param id the id to set - */ - public void setId(String id) { - this.id = id; - } - - /** - * @return the serviceId - */ - public String getServiceId() { - return serviceId; - } - - /** - * @param serviceId the serviceId to set - */ - public void setServiceId(String serviceId) { - this.serviceId = serviceId; - } - - /** - * @return the region - */ - public String getRegion() { - return region; - } - - /** - * @param region the region to set - */ - public void setRegion(String region) { - this.region = region; - } - - /** - * @return the publicURL - */ - public String getPublicURL() { - return publicURL; - } - - /** - * @param publicURL the publicURL to set - */ - public void setPublicURL(String publicURL) { - this.publicURL = publicURL; - } - - /** - * @return the internalURL - */ - public String getInternalURL() { - return internalURL; - } - - /** - * @param internalURL the internalURL to set - */ - public void setInternalURL(String internalURL) { - this.internalURL = internalURL; - } - - /** - * @return the adminURL - */ - public String getAdminURL() { - return adminURL; - } - - /** - * @param adminURL the adminURL to set - */ - public void setAdminURL(String adminURL) { - this.adminURL = adminURL; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Endpoint [id=" + id + ", serviceId=" + serviceId + ", region=" - + region + ", publicURL=" + publicURL + ", internalURL=" - + internalURL + ", adminURL=" + adminURL + "]"; - } - + private String id; + + @JsonProperty("service_id") + private String serviceId; + + private String region; + + @JsonProperty("publicurl") + private String publicURL; + + @JsonProperty("internalurl") + private String internalURL; + + @JsonProperty("adminurl") + private String adminURL; + + /** + * @return the id + */ + public String getId() { + return id; + } + + /** + * @param id the id to set + */ + public void setId(String id) { + this.id = id; + } + + /** + * @return the serviceId + */ + public String getServiceId() { + return serviceId; + } + + /** + * @param serviceId the serviceId to set + */ + public void setServiceId(String serviceId) { + this.serviceId = serviceId; + } + + /** + * @return the region + */ + public String getRegion() { + return region; + } + + /** + * @param region the region to set + */ + public void setRegion(String region) { + this.region = region; + } + + /** + * @return the publicURL + */ + public String getPublicURL() { + return publicURL; + } + + /** + * @param publicURL the publicURL to set + */ + public void setPublicURL(String publicURL) { + this.publicURL = publicURL; + } + + /** + * @return the internalURL + */ + public String getInternalURL() { + return internalURL; + } + + /** + * @param internalURL the internalURL to set + */ + public void setInternalURL(String internalURL) { + this.internalURL = internalURL; + } + + /** + * @return the adminURL + */ + public String getAdminURL() { + return adminURL; + } + + /** + * @param adminURL the adminURL to set + */ + public void setAdminURL(String adminURL) { + this.adminURL = adminURL; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Endpoint [id=" + id + ", serviceId=" + serviceId + ", region=" + + region + ", publicURL=" + publicURL + ", internalURL=" + + internalURL + ", adminURL=" + adminURL + "]"; + } + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Endpoints.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Endpoints.java index 7e77b12..b4e4a16 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Endpoints.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Endpoints.java @@ -24,27 +24,27 @@ import org.codehaus.jackson.annotate.JsonProperty; public class Endpoints implements Iterable<Endpoint>, Serializable { - @JsonProperty("endpoints") - private List<Endpoint> list; + @JsonProperty("endpoints") + private List<Endpoint> list; - /** - * @return the list - */ - public List<Endpoint> getList() { - return list; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Endpoints [list=" + list + "]"; - } + /** + * @return the list + */ + public List<Endpoint> getList() { + return list; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Endpoints [list=" + list + "]"; + } - @Override - public Iterator<Endpoint> iterator() { - return list.iterator(); - } - + @Override + public Iterator<Endpoint> iterator() { + return list.iterator(); + } + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Error.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Error.java index 3de01be..ba49b11 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Error.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Error.java @@ -23,40 +23,40 @@ import org.codehaus.jackson.map.annotate.JsonRootName; @JsonRootName("error") public class Error implements Serializable { - private Integer code; - - private String title; - - private String message; - - /** - * @return the code - */ - public Integer getCode() { - return code; - } - - /** - * @return the title - */ - public String getTitle() { - return title; - } - - /** - * @return the message - */ - public String getMessage() { - return message; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Error [code=" + code + ", title=" + title + ", message=" - + message + "]"; - } - + private Integer code; + + private String title; + + private String message; + + /** + * @return the code + */ + public Integer getCode() { + return code; + } + + /** + * @return the title + */ + public String getTitle() { + return title; + } + + /** + * @return the message + */ + public String getMessage() { + return message; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Error [code=" + code + ", title=" + title + ", message=" + + message + "]"; + } + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Link.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Link.java index 37dcc3d..4b94558 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Link.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Link.java @@ -20,39 +20,39 @@ import java.io.Serializable; public class Link implements Serializable { - private String rel; - - private String href; - - private String type; - - /** - * @return the rel - */ - public String getRel() { - return rel; - } - - /** - * @return the href - */ - public String getHref() { - return href; - } - - /** - * @return the type - */ - public String getType() { - return type; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Link [rel=" + rel + ", href=" + href + ", type=" + type + "]"; - } - + private String rel; + + private String href; + + private String type; + + /** + * @return the rel + */ + public String getRel() { + return rel; + } + + /** + * @return the href + */ + public String getHref() { + return href; + } + + /** + * @return the type + */ + public String getType() { + return type; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Link [rel=" + rel + ", href=" + href + ", type=" + type + "]"; + } + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Metadata.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Metadata.java index 97cf7f8..7afde63 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Metadata.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Metadata.java @@ -48,23 +48,23 @@ import java.util.Map; */ public class Metadata { - private Map<String, String> metadata; + private Map<String, String> metadata; - /** - * @return the metadata - */ - public Map<String, String> getMetadata() { - return metadata; - } + /** + * @return the metadata + */ + public Map<String, String> getMetadata() { + return metadata; + } - /** - * Set the metadata - * @param metadata - */ - public void setMetadata(Map<String, String> metadata) { - this.metadata = metadata; - } - + /** + * Set the metadata + * @param metadata + */ + public void setMetadata(Map<String, String> metadata) { + this.metadata = metadata; + } + - + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Role.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Role.java index c0d8f5d..7ae36de 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Role.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Role.java @@ -23,61 +23,61 @@ import org.codehaus.jackson.map.annotate.JsonRootName; @JsonRootName("role") public class Role implements Serializable { - private String id; - - private String name; - - private String description; - - private String enabled; + private String id; + + private String name; + + private String description; + + private String enabled; - /** - * @return the id - */ - public String getId() { - return id; - } + /** + * @return the id + */ + public String getId() { + return id; + } - /** - * @return the name - */ - public String getName() { - return name; - } + /** + * @return the name + */ + public String getName() { + return name; + } - /** - * @param name the name to set - */ - public void setName(String name) { - this.name = name; - } + /** + * @param name the name to set + */ + public void setName(String name) { + this.name = name; + } - /** - * @return the description - */ - public String getDescription() { - return description; - } + /** + * @return the description + */ + public String getDescription() { + return description; + } - /** - * @param description the description to set - */ - public void setDescription(String description) { - this.description = description; - } + /** + * @param description the description to set + */ + public void setDescription(String description) { + this.description = description; + } - /** - * @return the enabled - */ - public String getEnabled() { - return enabled; - } + /** + * @return the enabled + */ + public String getEnabled() { + return enabled; + } - /** - * @param enabled the enabled to set - */ - public void setEnabled(String enabled) { - this.enabled = enabled; - } + /** + * @param enabled the enabled to set + */ + public void setEnabled(String enabled) { + this.enabled = enabled; + } } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Roles.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Roles.java index bfdb788..79fe04c 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Roles.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Roles.java @@ -24,27 +24,27 @@ import org.codehaus.jackson.annotate.JsonProperty; public class Roles implements Iterable<Role>, Serializable { - @JsonProperty("roles") - private List<Role> list; + @JsonProperty("roles") + private List<Role> list; - /** - * @return the list - */ - public List<Role> getList() { - return list; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Roles [list=" + list + "]"; - } + /** + * @return the list + */ + public List<Role> getList() { + return list; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Roles [list=" + list + "]"; + } - @Override - public Iterator<Role> iterator() { - return list.iterator(); - } - + @Override + public Iterator<Role> iterator() { + return list.iterator(); + } + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Service.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Service.java index 9c40e24..c5a1650 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Service.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Service.java @@ -23,70 +23,70 @@ import org.codehaus.jackson.map.annotate.JsonRootName; @JsonRootName("OS-KSADM:service") public class Service implements Serializable { - private String id; - - private String type; - - private String name; - - private String description; + private String id; + + private String type; + + private String name; + + private String description; - /** - * @return the id - */ - public String getId() { - return id; - } + /** + * @return the id + */ + public String getId() { + return id; + } - /** - * @return the type - */ - public String getType() { - return type; - } + /** + * @return the type + */ + public String getType() { + return type; + } - /** - * @param type the type to set - */ - public void setType(String type) { - this.type = type; - } + /** + * @param type the type to set + */ + public void setType(String type) { + this.type = type; + } - /** - * @return the name - */ - public String getName() { - return name; - } + /** + * @return the name + */ + public String getName() { + return name; + } - /** - * @param name the name to set - */ - public void setName(String name) { - this.name = name; - } + /** + * @param name the name to set + */ + public void setName(String name) { + this.name = name; + } - /** - * @return the description - */ - public String getDescription() { - return description; - } + /** + * @return the description + */ + public String getDescription() { + return description; + } - /** - * @param description the description to set - */ - public void setDescription(String description) { - this.description = description; - } + /** + * @param description the description to set + */ + public void setDescription(String description) { + this.description = description; + } - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Service [id=" + id + ", type=" + type + ", name=" + name - + ", description=" + description + "]"; - } - + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Service [id=" + id + ", type=" + type + ", name=" + name + + ", description=" + description + "]"; + } + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Services.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Services.java index febb9bb..99be776 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Services.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Services.java @@ -24,27 +24,27 @@ import org.codehaus.jackson.annotate.JsonProperty; public class Services implements Iterable<Service>, Serializable { - @JsonProperty("OS-KSADM:services") - private List<Service> list; + @JsonProperty("OS-KSADM:services") + private List<Service> list; - /** - * @return the list - */ - public List<Service> getList() { - return list; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Services [list=" + list + "]"; - } + /** + * @return the list + */ + public List<Service> getList() { + return list; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Services [list=" + list + "]"; + } - @Override - public Iterator<Service> iterator() { - return list.iterator(); - } - + @Override + public Iterator<Service> iterator() { + return list.iterator(); + } + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Tenant.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Tenant.java index 88b04d5..840d507 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Tenant.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Tenant.java @@ -25,94 +25,94 @@ import org.codehaus.jackson.map.annotate.JsonRootName; @JsonIgnoreProperties(ignoreUnknown=true) public class Tenant implements Serializable { - private String id; - - private String name; - - private String description; - - private Boolean enabled; - - public Tenant(String name, String description, Boolean enabled) { - this.name = name; - this.description = description; - this.enabled = enabled; - } - - public Tenant(String name, String description) { - this(name, description, Boolean.TRUE); - } - - public Tenant(String name) { - this(name, null); - } - - public Tenant() { - } + private String id; + + private String name; + + private String description; + + private Boolean enabled; + + public Tenant(String name, String description, Boolean enabled) { + this.name = name; + this.description = description; + this.enabled = enabled; + } + + public Tenant(String name, String description) { + this(name, description, Boolean.TRUE); + } + + public Tenant(String name) { + this(name, null); + } + + public Tenant() { + } - /** - * @return the id - */ - public String getId() { - return id; - } + /** + * @return the id + */ + public String getId() { + return id; + } - /** - * @param id the id to set - */ - public void setId(String id) { - this.id = id; - } + /** + * @param id the id to set + */ + public void setId(String id) { + this.id = id; + } - /** - * @return the name - */ - public String getName() { - return name; - } + /** + * @return the name + */ + public String getName() { + return name; + } - /** - * @param name the name to set - */ - public void setName(String name) { - this.name = name; - } + /** + * @param name the name to set + */ + public void setName(String name) { + this.name = name; + } - /** - * @return the description - */ - public String getDescription() { - return description; - } + /** + * @return the description + */ + public String getDescription() { + return description; + } - /** - * @param description the description to set - */ - public void setDescription(String description) { - this.description = description; - } + /** + * @param description the description to set + */ + public void setDescription(String description) { + this.description = description; + } - /** - * @return the enabled - */ - public Boolean getEnabled() { - return enabled; - } + /** + * @return the enabled + */ + public Boolean getEnabled() { + return enabled; + } - /** - * @param enabled the enabled to set - */ - public void setEnabled(Boolean enabled) { - this.enabled = enabled; - } + /** + * @param enabled the enabled to set + */ + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Tenant [id=" + id + ", name=" + name + ", description=" - + description + ", enabled=" + enabled + "]"; - } - + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Tenant [id=" + id + ", name=" + name + ", description=" + + description + ", enabled=" + enabled + "]"; + } + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Tenants.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Tenants.java index b230498..c7958f3 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Tenants.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Tenants.java @@ -24,37 +24,37 @@ import org.codehaus.jackson.annotate.JsonProperty; public class Tenants implements Iterable<Tenant>, Serializable { - @JsonProperty("tenants") - private List<Tenant> list; - - @JsonProperty("tenants_links") - private List<Link> links; - - /** - * @return the list - */ - public List<Tenant> getList() { - return list; - } - - /** - * @return the links - */ - public List<Link> getLinks() { - return links; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Tenants [list=" + list + ", links=" + links + "]"; - } - - @Override - public Iterator<Tenant> iterator() { - return list.iterator(); - } - + @JsonProperty("tenants") + private List<Tenant> list; + + @JsonProperty("tenants_links") + private List<Link> links; + + /** + * @return the list + */ + public List<Tenant> getList() { + return list; + } + + /** + * @return the links + */ + public List<Link> getLinks() { + return links; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Tenants [list=" + list + ", links=" + links + "]"; + } + + @Override + public Iterator<Tenant> iterator() { + return list.iterator(); + } + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Token.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Token.java index 41c8247..73d92fa 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Token.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Token.java @@ -20,49 +20,49 @@ import java.util.Calendar; public final class Token { - private String id; + private String id; - private Calendar issued_at; + private Calendar issued_at; - private Calendar expires; + private Calendar expires; - private Tenant tenant; + private Tenant tenant; - /** - * @return the id - */ - public String getId() { - return id; - } + /** + * @return the id + */ + public String getId() { + return id; + } - /** - * @return the issued_at - */ - public Calendar getIssued_at() { - return issued_at; - } + /** + * @return the issued_at + */ + public Calendar getIssued_at() { + return issued_at; + } - /** - * @return the expires - */ - public Calendar getExpires() { - return expires; - } + /** + * @return the expires + */ + public Calendar getExpires() { + return expires; + } - /** - * @return the tenant - */ - public Tenant getTenant() { - return tenant; - } + /** + * @return the tenant + */ + public Tenant getTenant() { + return tenant; + } - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Token [id=" + id + ", Issued_at=" + issued_at + ", expires=" + expires + ", tenant=" + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Token [id=" + id + ", Issued_at=" + issued_at + ", expires=" + expires + ", tenant=" + tenant + "]"; - } + } }
\ No newline at end of file diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/User.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/User.java index 54b5f65..830d3fa 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/User.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/User.java @@ -28,128 +28,128 @@ import org.codehaus.jackson.map.annotate.JsonRootName; @JsonRootName("user") public class User implements Serializable { - private String id; - - private String username; - -// @JsonProperty("OS-KSADM:password") -// @JsonProperty("OS_KSADM_password") - private String password; - - private String tenantId; - - private String name; - - private String email; - - private Boolean enabled; - - /** - * @return the id - */ - public String getId() { - return id; - } - - /** - * @param id the id to set - */ - public void setId(String id) { - this.id = id; - } - - /** - * @return the username - */ - public String getUsername() { - return username; - } - - /** - * @param username the username to set - */ - public void setUsername(String username) { - this.username = username; - } - - /** - * @return the password - */ - public String getPassword() { - return password; - } - - /** - * @param password the password to set - */ - public void setPassword(String password) { - this.password = password; - } - - /** - * @return the tenantId - */ - public String getTenantId() { - return tenantId; - } - - /** - * @param tenantId the tenantId to set - */ - public void setTenantId(String tenantId) { - this.tenantId = tenantId; - } - - /** - * @return the name - */ - public String getName() { - return name; - } - - /** - * @param name the name to set - */ - public void setName(String name) { - this.name = name; - } - - /** - * @return the email - */ - public String getEmail() { - return email; - } - - /** - * @param email the email to set - */ - public void setEmail(String email) { - this.email = email; - } - - /** - * @return the enabled - */ - public Boolean getEnabled() { - return enabled; - } - - /** - * @param enabled the enabled to set - */ - public void setEnabled(Boolean enabled) { - this.enabled = enabled; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "User [id=" + id + ", username=" + username + ", password=" - + password + ", tenantId=" + tenantId + ", name=" + name - + ", email=" + email + ", enabled=" + enabled + "]"; - } - + private String id; + + private String username; + +// @JsonProperty("OS-KSADM:password") +// @JsonProperty("OS_KSADM_password") + private String password; + + private String tenantId; + + private String name; + + private String email; + + private Boolean enabled; + + /** + * @return the id + */ + public String getId() { + return id; + } + + /** + * @param id the id to set + */ + public void setId(String id) { + this.id = id; + } + + /** + * @return the username + */ + public String getUsername() { + return username; + } + + /** + * @param username the username to set + */ + public void setUsername(String username) { + this.username = username; + } + + /** + * @return the password + */ + public String getPassword() { + return password; + } + + /** + * @param password the password to set + */ + public void setPassword(String password) { + this.password = password; + } + + /** + * @return the tenantId + */ + public String getTenantId() { + return tenantId; + } + + /** + * @param tenantId the tenantId to set + */ + public void setTenantId(String tenantId) { + this.tenantId = tenantId; + } + + /** + * @return the name + */ + public String getName() { + return name; + } + + /** + * @param name the name to set + */ + public void setName(String name) { + this.name = name; + } + + /** + * @return the email + */ + public String getEmail() { + return email; + } + + /** + * @param email the email to set + */ + public void setEmail(String email) { + this.email = email; + } + + /** + * @return the enabled + */ + public Boolean getEnabled() { + return enabled; + } + + /** + * @param enabled the enabled to set + */ + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "User [id=" + id + ", username=" + username + ", password=" + + password + ", tenantId=" + tenantId + ", name=" + name + + ", email=" + email + ", enabled=" + enabled + "]"; + } + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Users.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Users.java index ff5ad15..b3013bf 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Users.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Users.java @@ -24,27 +24,27 @@ import org.codehaus.jackson.annotate.JsonProperty; public class Users implements Iterable<User>, Serializable { - @JsonProperty("users") - private List<User> list; + @JsonProperty("users") + private List<User> list; - /** - * @return the list - */ - public List<User> getList() { - return list; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Users [list=" + list + "]"; - } + /** + * @return the list + */ + public List<User> getList() { + return list; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Users [list=" + list + "]"; + } - @Override - public Iterator<User> iterator() { - return list.iterator(); - } - + @Override + public Iterator<User> iterator() { + return list.iterator(); + } + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/authentication/AccessKey.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/authentication/AccessKey.java index 08503b7..bb308f0 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/authentication/AccessKey.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/authentication/AccessKey.java @@ -22,67 +22,67 @@ import com.woorea.openstack.keystone.model.Authentication; @JsonRootName("auth") public class AccessKey extends Authentication { - - public static final class ApiAccessKeyCredentials { - - private String accessKey; - - private String secretKey; + + public static final class ApiAccessKeyCredentials { + + private String accessKey; + + private String secretKey; - /** - * @return the accessKey - */ - public String getAccessKey() { - return accessKey; - } + /** + * @return the accessKey + */ + public String getAccessKey() { + return accessKey; + } - /** - * @param accessKey the accessKey to set - */ - public void setAccessKey(String accessKey) { - this.accessKey = accessKey; - } + /** + * @param accessKey the accessKey to set + */ + public void setAccessKey(String accessKey) { + this.accessKey = accessKey; + } - /** - * @return the secretKey - */ - public String getSecretKey() { - return secretKey; - } + /** + * @return the secretKey + */ + public String getSecretKey() { + return secretKey; + } - /** - * @param secretKey the secretKey to set - */ - public void setSecretKey(String secretKey) { - this.secretKey = secretKey; - } - - } - - private ApiAccessKeyCredentials apiAccessKeyCredentials = new ApiAccessKeyCredentials(); - - public AccessKey() { - - } - - public AccessKey(String accessKey, String secretKey) { - apiAccessKeyCredentials.setAccessKey(accessKey); - apiAccessKeyCredentials.setSecretKey(secretKey); - } + /** + * @param secretKey the secretKey to set + */ + public void setSecretKey(String secretKey) { + this.secretKey = secretKey; + } + + } + + private ApiAccessKeyCredentials apiAccessKeyCredentials = new ApiAccessKeyCredentials(); + + public AccessKey() { + + } + + public AccessKey(String accessKey, String secretKey) { + apiAccessKeyCredentials.setAccessKey(accessKey); + apiAccessKeyCredentials.setSecretKey(secretKey); + } - /** - * @return the apiAccessKeyCredentials - */ - public ApiAccessKeyCredentials getApiAccessKeyCredentials() { - return apiAccessKeyCredentials; - } + /** + * @return the apiAccessKeyCredentials + */ + public ApiAccessKeyCredentials getApiAccessKeyCredentials() { + return apiAccessKeyCredentials; + } - /** - * @param apiAccessKeyCredentials the apiAccessKeyCredentials to set - */ - public void setApiAccessKeyCredentials( - ApiAccessKeyCredentials apiAccessKeyCredentials) { - this.apiAccessKeyCredentials = apiAccessKeyCredentials; - } - + /** + * @param apiAccessKeyCredentials the apiAccessKeyCredentials to set + */ + public void setApiAccessKeyCredentials( + ApiAccessKeyCredentials apiAccessKeyCredentials) { + this.apiAccessKeyCredentials = apiAccessKeyCredentials; + } + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/authentication/TokenAuthentication.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/authentication/TokenAuthentication.java index fec92e1..f47a94b 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/authentication/TokenAuthentication.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/authentication/TokenAuthentication.java @@ -22,45 +22,45 @@ import com.woorea.openstack.keystone.model.Authentication; @JsonRootName("auth") public class TokenAuthentication extends Authentication { - - public static final class Token { - - private String id; + + public static final class Token { + + private String id; - /** - * @return the id - */ - public String getId() { - return id; - } + /** + * @return the id + */ + public String getId() { + return id; + } - /** - * @param id the id to set - */ - public void setId(String id) { - this.id = id; - } - - } - - private Token token = new Token(); - - public TokenAuthentication(String token) { - this.token.id = token; - } + /** + * @param id the id to set + */ + public void setId(String id) { + this.id = id; + } + + } + + private Token token = new Token(); + + public TokenAuthentication(String token) { + this.token.id = token; + } - /** - * @return the token - */ - public Token getToken() { - return token; - } + /** + * @return the token + */ + public Token getToken() { + return token; + } - /** - * @param token the token to set - */ - public void setToken(Token token) { - this.token = token; - } - + /** + * @param token the token to set + */ + public void setToken(Token token) { + this.token = token; + } + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/authentication/UsernamePassword.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/authentication/UsernamePassword.java index 8a13b7f..5c94d31 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/authentication/UsernamePassword.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/authentication/UsernamePassword.java @@ -22,66 +22,66 @@ import com.woorea.openstack.keystone.model.Authentication; @JsonRootName("auth") public class UsernamePassword extends Authentication { - - public static final class PasswordCredentials { - - private String username; - - private String password; + + public static final class PasswordCredentials { + + private String username; + + private String password; - /** - * @return the username - */ - public String getUsername() { - return username; - } + /** + * @return the username + */ + public String getUsername() { + return username; + } - /** - * @param username the username to set - */ - public void setUsername(String username) { - this.username = username; - } + /** + * @param username the username to set + */ + public void setUsername(String username) { + this.username = username; + } - /** - * @return the password - */ - public String getPassword() { - return password; - } + /** + * @return the password + */ + public String getPassword() { + return password; + } - /** - * @param password the password to set - */ - public void setPassword(String password) { - this.password = password; - } - - } - - private PasswordCredentials passwordCredentials = new PasswordCredentials(); - - public UsernamePassword() { - - } - - public UsernamePassword(String username, String password) { - passwordCredentials.setUsername(username); - passwordCredentials.setPassword(password); - } + /** + * @param password the password to set + */ + public void setPassword(String password) { + this.password = password; + } + + } + + private PasswordCredentials passwordCredentials = new PasswordCredentials(); + + public UsernamePassword() { + + } + + public UsernamePassword(String username, String password) { + passwordCredentials.setUsername(username); + passwordCredentials.setPassword(password); + } - /** - * @return the passwordCredentials - */ - public PasswordCredentials getPasswordCredentials() { - return passwordCredentials; - } + /** + * @return the passwordCredentials + */ + public PasswordCredentials getPasswordCredentials() { + return passwordCredentials; + } - /** - * @param passwordCredentials the passwordCredentials to set - */ - public void setPasswordCredentials(PasswordCredentials passwordCredentials) { - this.passwordCredentials = passwordCredentials; - } - + /** + * @param passwordCredentials the passwordCredentials to set + */ + public void setPasswordCredentials(PasswordCredentials passwordCredentials) { + this.passwordCredentials = passwordCredentials; + } + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Authentication.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Authentication.java index 66d2854..2281d01 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Authentication.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Authentication.java @@ -24,277 +24,277 @@ import org.codehaus.jackson.map.annotate.JsonRootName; @JsonRootName("auth") public class Authentication implements Serializable { - - public static final class Identity { - - public static final Identity password(String userId, String password) { - Identity identity = new Identity(); - identity.getMethods().add("password"); - Password method = new Password(); - method.getUser().setId(userId); - method.getUser().setPassword(password); - identity.setPassword(method); - return identity; - } - - public static final Identity password(String domainName, String username, String password) { - Identity identity = new Identity(); - identity.getMethods().add("password"); - Password method = new Password(); - com.woorea.openstack.keystone.v3.model.Authentication.Identity.Password.User.Domain domain = new com.woorea.openstack.keystone.v3.model.Authentication.Identity.Password.User.Domain(); - domain.setName(domainName); - method.getUser().setDomain(domain); - method.getUser().setName(username); - method.getUser().setPassword(password); - identity.setPassword(method); - return identity; - } - - public static final Identity token(String token) { - Identity identity = new Identity(); - identity.getMethods().add("token"); - Token method = new Token(); - method.setId(token); - identity.setToken(method); - return identity; - } - - private List<String> methods = new ArrayList<>(); - - public static final class Password { - - public static final class User { - - public static final class Domain { - - private String id; - - private String name; - - 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; - } - } - - private Domain domain; - - private String id; - - private String name; - - private String password; - - public Domain getDomain() { - return domain; - } - - public void setDomain(Domain domain) { - this.domain = domain; - } - - 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; - } - - public String getPassword() { - return password; - } - - public void setPassword(String password) { - this.password = password; - } - - } - - private User user = new User(); - - public User getUser() { - return user; - } - - public void setUser(User user) { - this.user = user; - } - - } - - private Password password; - - public static final class Token { - - private String id; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - } - - private Token token; - - public List<String> getMethods() { - return methods; - } - - public void setMethods(List<String> methods) { - this.methods = methods; - } - - public Password getPassword() { - return password; - } - - public void setPassword(Password password) { - this.password = password; - } - - public Token getToken() { - return token; - } - - public void setToken(Token token) { - this.token = token; - } - - } - - private Identity identity; - - public static final class Scope { - - public static Scope project(String id) { - Scope scope = new Scope(); - Project project = new Project(); - project.setId(id); - scope.setProject(project); - return scope; - } - - public static Scope project(String domainName, String projectName) { - Scope scope = new Scope(); - com.woorea.openstack.keystone.v3.model.Authentication.Scope.Project.Domain domain = new com.woorea.openstack.keystone.v3.model.Authentication.Scope.Project.Domain(); - domain.setName(domainName); - Project project = new Project(); - project.setDomain(domain); - project.setName(projectName); - scope.setProject(project); - return scope; - } - - public static final class Project { - - public static final class Domain { - - private String id; - - private String name; - - 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; - } - } - - private String id; - - private Domain domain; - - private String name; - - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public Domain getDomain() { - return domain; - } - - public void setDomain(Domain domain) { - this.domain = domain; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - } - - private Project project; - - public Project getProject() { - return project; - } - - public void setProject(Project project) { - this.project = project; - } - - } - - private Scope scope; - - public Identity getIdentity() { - return identity; - } - - public void setIdentity(Identity identity) { - this.identity = identity; - } - - public Scope getScope() { - return scope; - } - - public void setScope(Scope scope) { - this.scope = scope; - } - + + public static final class Identity { + + public static final Identity password(String userId, String password) { + Identity identity = new Identity(); + identity.getMethods().add("password"); + Password method = new Password(); + method.getUser().setId(userId); + method.getUser().setPassword(password); + identity.setPassword(method); + return identity; + } + + public static final Identity password(String domainName, String username, String password) { + Identity identity = new Identity(); + identity.getMethods().add("password"); + Password method = new Password(); + com.woorea.openstack.keystone.v3.model.Authentication.Identity.Password.User.Domain domain = new com.woorea.openstack.keystone.v3.model.Authentication.Identity.Password.User.Domain(); + domain.setName(domainName); + method.getUser().setDomain(domain); + method.getUser().setName(username); + method.getUser().setPassword(password); + identity.setPassword(method); + return identity; + } + + public static final Identity token(String token) { + Identity identity = new Identity(); + identity.getMethods().add("token"); + Token method = new Token(); + method.setId(token); + identity.setToken(method); + return identity; + } + + private List<String> methods = new ArrayList<>(); + + public static final class Password { + + public static final class User { + + public static final class Domain { + + private String id; + + private String name; + + 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; + } + } + + private Domain domain; + + private String id; + + private String name; + + private String password; + + public Domain getDomain() { + return domain; + } + + public void setDomain(Domain domain) { + this.domain = domain; + } + + 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; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + } + + private User user = new User(); + + public User getUser() { + return user; + } + + public void setUser(User user) { + this.user = user; + } + + } + + private Password password; + + public static final class Token { + + private String id; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + } + + private Token token; + + public List<String> getMethods() { + return methods; + } + + public void setMethods(List<String> methods) { + this.methods = methods; + } + + public Password getPassword() { + return password; + } + + public void setPassword(Password password) { + this.password = password; + } + + public Token getToken() { + return token; + } + + public void setToken(Token token) { + this.token = token; + } + + } + + private Identity identity; + + public static final class Scope { + + public static Scope project(String id) { + Scope scope = new Scope(); + Project project = new Project(); + project.setId(id); + scope.setProject(project); + return scope; + } + + public static Scope project(String domainName, String projectName) { + Scope scope = new Scope(); + com.woorea.openstack.keystone.v3.model.Authentication.Scope.Project.Domain domain = new com.woorea.openstack.keystone.v3.model.Authentication.Scope.Project.Domain(); + domain.setName(domainName); + Project project = new Project(); + project.setDomain(domain); + project.setName(projectName); + scope.setProject(project); + return scope; + } + + public static final class Project { + + public static final class Domain { + + private String id; + + private String name; + + 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; + } + } + + private String id; + + private Domain domain; + + private String name; + + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public Domain getDomain() { + return domain; + } + + public void setDomain(Domain domain) { + this.domain = domain; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + } + + private Project project; + + public Project getProject() { + return project; + } + + public void setProject(Project project) { + this.project = project; + } + + } + + private Scope scope; + + public Identity getIdentity() { + return identity; + } + + public void setIdentity(Identity identity) { + this.identity = identity; + } + + public Scope getScope() { + return scope; + } + + public void setScope(Scope scope) { + this.scope = scope; + } + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Credential.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Credential.java index b3fc00f..7f36b15 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Credential.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Credential.java @@ -23,55 +23,55 @@ import org.codehaus.jackson.map.annotate.JsonRootName; @JsonRootName("credential") public class Credential { - - private String id; + + private String id; - private String projectId; - - private String type; - - private String userId; - - private Map<String, String> blob = new HashMap<>(); + private String projectId; + + private String type; + + private String userId; + + private Map<String, String> blob = new HashMap<>(); - public String getId() { - return id; - } + public String getId() { + return id; + } - public void setId(String id) { - this.id = id; - } + public void setId(String id) { + this.id = id; + } - public String getProjectId() { - return projectId; - } + public String getProjectId() { + return projectId; + } - public void setProjectId(String projectId) { - this.projectId = projectId; - } + public void setProjectId(String projectId) { + this.projectId = projectId; + } - public String getType() { - return type; - } + public String getType() { + return type; + } - public void setType(String type) { - this.type = type; - } + public void setType(String type) { + this.type = type; + } - public String getUserId() { - return userId; - } + public String getUserId() { + return userId; + } - public void setUserId(String userId) { - this.userId = userId; - } + public void setUserId(String userId) { + this.userId = userId; + } - public Map<String, String> getBlob() { - return blob; - } + public Map<String, String> getBlob() { + return blob; + } - public void setBlob(Map<String, String> blob) { - this.blob = blob; - } - + public void setBlob(Map<String, String> blob) { + this.blob = blob; + } + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Credentials.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Credentials.java index 891736a..4051fa0 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Credentials.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Credentials.java @@ -24,27 +24,27 @@ import org.codehaus.jackson.annotate.JsonProperty; public class Credentials implements Iterable<Credential>, Serializable { - @JsonProperty("credentials") - private List<Credential> list; + @JsonProperty("credentials") + private List<Credential> list; - /** - * @return the list - */ - public List<Credential> getList() { - return list; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Credentials [list=" + list + "]"; - } + /** + * @return the list + */ + public List<Credential> getList() { + return list; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Credentials [list=" + list + "]"; + } - @Override - public Iterator<Credential> iterator() { - return list.iterator(); - } - + @Override + public Iterator<Credential> iterator() { + return list.iterator(); + } + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Domain.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Domain.java index dead163..cfb5d07 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Domain.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Domain.java @@ -21,44 +21,44 @@ import org.codehaus.jackson.map.annotate.JsonRootName; @JsonRootName("domain") public class Domain { - private String id; - - private String name; - - private String description; - - private Boolean enabled; + private String id; + + private String name; + + private String description; + + private Boolean enabled; - public String getId() { - return id; - } + public String getId() { + return id; + } - public void setId(String id) { - this.id = id; - } + public void setId(String id) { + this.id = id; + } - public String getName() { - return name; - } + public String getName() { + return name; + } - public void setName(String name) { - this.name = name; - } + public void setName(String name) { + this.name = name; + } - public String getDescription() { - return description; - } + public String getDescription() { + return description; + } - public void setDescription(String description) { - this.description = description; - } - - public Boolean getEnabled() { - return enabled; - } + public void setDescription(String description) { + this.description = description; + } + + public Boolean getEnabled() { + return enabled; + } - public void setEnabled(Boolean enabled) { - this.enabled = enabled; - } - + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Domains.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Domains.java index c6c317b..27765ef 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Domains.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Domains.java @@ -24,27 +24,27 @@ import org.codehaus.jackson.annotate.JsonProperty; public class Domains implements Iterable<Domain>, Serializable { - @JsonProperty("domains") - private List<Domain> list; + @JsonProperty("domains") + private List<Domain> list; - /** - * @return the list - */ - public List<Domain> getList() { - return list; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Domains [list=" + list + "]"; - } + /** + * @return the list + */ + public List<Domain> getList() { + return list; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Domains [list=" + list + "]"; + } - @Override - public Iterator<Domain> iterator() { - return list.iterator(); - } - + @Override + public Iterator<Domain> iterator() { + return list.iterator(); + } + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Endpoint.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Endpoint.java index 9a66d08..5fa9afe 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Endpoint.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Endpoint.java @@ -22,46 +22,46 @@ import org.codehaus.jackson.map.annotate.JsonRootName; @JsonRootName("endpoint") public class Endpoint { - private String id; - - @JsonProperty("interface") - private String iface; - - private String name; - - @JsonProperty("service_id") - private String serviceId; + private String id; + + @JsonProperty("interface") + private String iface; + + private String name; + + @JsonProperty("service_id") + private String serviceId; - public String getId() { - return id; - } + public String getId() { + return id; + } - public void setId(String id) { - this.id = id; - } + public void setId(String id) { + this.id = id; + } - public String getInterface() { - return iface; - } + public String getInterface() { + return iface; + } - public void setInterface(String iface) { - this.iface = iface; - } + public void setInterface(String iface) { + this.iface = iface; + } - public String getName() { - return name; - } + public String getName() { + return name; + } - public void setName(String name) { - this.name = name; - } + public void setName(String name) { + this.name = name; + } - public String getServiceId() { - return serviceId; - } + public String getServiceId() { + return serviceId; + } - public void setServiceId(String serviceId) { - this.serviceId = serviceId; - } - + public void setServiceId(String serviceId) { + this.serviceId = serviceId; + } + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Endpoints.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Endpoints.java index 7094be7..ac5f9a5 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Endpoints.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Endpoints.java @@ -24,27 +24,27 @@ import org.codehaus.jackson.annotate.JsonProperty; public class Endpoints implements Iterable<Endpoint>, Serializable { - @JsonProperty("endpoints") - private List<Endpoint> list; + @JsonProperty("endpoints") + private List<Endpoint> list; - /** - * @return the list - */ - public List<Endpoint> getList() { - return list; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Endpoints [list=" + list + "]"; - } + /** + * @return the list + */ + public List<Endpoint> getList() { + return list; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Endpoints [list=" + list + "]"; + } - @Override - public Iterator<Endpoint> iterator() { - return list.iterator(); - } - + @Override + public Iterator<Endpoint> iterator() { + return list.iterator(); + } + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Group.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Group.java index 5d93186..ed7f3a0 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Group.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Group.java @@ -22,45 +22,45 @@ import org.codehaus.jackson.map.annotate.JsonRootName; @JsonRootName("group") public class Group { - private String id; - - @JsonProperty("domain_id") - private String domainId; - - private String name; - - private String description; + private String id; + + @JsonProperty("domain_id") + private String domainId; + + private String name; + + private String description; - public String getId() { - return id; - } + public String getId() { + return id; + } - public void setId(String id) { - this.id = id; - } + public void setId(String id) { + this.id = id; + } - public String getDomainId() { - return domainId; - } + public String getDomainId() { + return domainId; + } - public void setDomainId(String domainId) { - this.domainId = domainId; - } + public void setDomainId(String domainId) { + this.domainId = domainId; + } - public String getName() { - return name; - } + public String getName() { + return name; + } - public void setName(String name) { - this.name = name; - } + public void setName(String name) { + this.name = name; + } - public String getDescription() { - return description; - } + public String getDescription() { + return description; + } - public void setDescription(String description) { - this.description = description; - } - + public void setDescription(String description) { + this.description = description; + } + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Groups.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Groups.java index 2bcc531..ec9e558 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Groups.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Groups.java @@ -24,27 +24,27 @@ import org.codehaus.jackson.annotate.JsonProperty; public class Groups implements Iterable<Group>, Serializable { - @JsonProperty("groups") - private List<Group> list; + @JsonProperty("groups") + private List<Group> list; - /** - * @return the list - */ - public List<Group> getList() { - return list; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Groups [list=" + list + "]"; - } + /** + * @return the list + */ + public List<Group> getList() { + return list; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Groups [list=" + list + "]"; + } - @Override - public Iterator<Group> iterator() { - return list.iterator(); - } - + @Override + public Iterator<Group> iterator() { + return list.iterator(); + } + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Policies.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Policies.java index 34a3854..a82d1b6 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Policies.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Policies.java @@ -24,27 +24,27 @@ import org.codehaus.jackson.annotate.JsonProperty; public class Policies implements Iterable<Policy>, Serializable { - @JsonProperty("policies") - private List<Policy> list; + @JsonProperty("policies") + private List<Policy> list; - /** - * @return the list - */ - public List<Policy> getList() { - return list; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Policies [list=" + list + "]"; - } + /** + * @return the list + */ + public List<Policy> getList() { + return list; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Policies [list=" + list + "]"; + } - @Override - public Iterator<Policy> iterator() { - return list.iterator(); - } - + @Override + public Iterator<Policy> iterator() { + return list.iterator(); + } + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Policy.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Policy.java index f14a004..12c6f04 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Policy.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Policy.java @@ -23,55 +23,55 @@ import org.codehaus.jackson.map.annotate.JsonRootName; @JsonRootName("policy") public class Policy { - - private String id; + + private String id; - private String projectId; - - private String type; - - private String userId; - - private Map<String, String> blob = new HashMap<>(); + private String projectId; + + private String type; + + private String userId; + + private Map<String, String> blob = new HashMap<>(); - public String getId() { - return id; - } + public String getId() { + return id; + } - public void setId(String id) { - this.id = id; - } + public void setId(String id) { + this.id = id; + } - public String getProjectId() { - return projectId; - } + public String getProjectId() { + return projectId; + } - public void setProjectId(String projectId) { - this.projectId = projectId; - } + public void setProjectId(String projectId) { + this.projectId = projectId; + } - public String getType() { - return type; - } + public String getType() { + return type; + } - public void setType(String type) { - this.type = type; - } + public void setType(String type) { + this.type = type; + } - public String getUserId() { - return userId; - } + public String getUserId() { + return userId; + } - public void setUserId(String userId) { - this.userId = userId; - } + public void setUserId(String userId) { + this.userId = userId; + } - public Map<String, String> getBlob() { - return blob; - } + public Map<String, String> getBlob() { + return blob; + } - public void setBlob(Map<String, String> blob) { - this.blob = blob; - } - + public void setBlob(Map<String, String> blob) { + this.blob = blob; + } + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Project.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Project.java index 5edd7ae..b0f6288 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Project.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Project.java @@ -22,45 +22,45 @@ import org.codehaus.jackson.map.annotate.JsonRootName; @JsonRootName("project") public class Project { - private String id; - - @JsonProperty("domain_id") - private String domainId; - - private String name; - - private Boolean enabled; + private String id; + + @JsonProperty("domain_id") + private String domainId; + + private String name; + + private Boolean enabled; - public String getId() { - return id; - } + public String getId() { + return id; + } - public void setId(String id) { - this.id = id; - } + public void setId(String id) { + this.id = id; + } - public String getDomainId() { - return domainId; - } + public String getDomainId() { + return domainId; + } - public void setDomainId(String domainId) { - this.domainId = domainId; - } + public void setDomainId(String domainId) { + this.domainId = domainId; + } - public String getName() { - return name; - } + public String getName() { + return name; + } - public void setName(String name) { - this.name = name; - } - - public Boolean getEnabled() { - return enabled; - } + public void setName(String name) { + this.name = name; + } + + public Boolean getEnabled() { + return enabled; + } - public void setEnabled(Boolean enabled) { - this.enabled = enabled; - } - + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Projects.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Projects.java index e7799b0..984c4d2 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Projects.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Projects.java @@ -24,27 +24,27 @@ import org.codehaus.jackson.annotate.JsonProperty; public class Projects implements Iterable<Project>, Serializable { - @JsonProperty("projects") - private List<Project> list; + @JsonProperty("projects") + private List<Project> list; - /** - * @return the list - */ - public List<Project> getList() { - return list; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Projects [list=" + list + "]"; - } + /** + * @return the list + */ + public List<Project> getList() { + return list; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Projects [list=" + list + "]"; + } - @Override - public Iterator<Project> iterator() { - return list.iterator(); - } - + @Override + public Iterator<Project> iterator() { + return list.iterator(); + } + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Role.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Role.java index 325184c..317ea35 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Role.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Role.java @@ -23,61 +23,61 @@ import org.codehaus.jackson.map.annotate.JsonRootName; @JsonRootName("role") public class Role implements Serializable { - private String id; - - private String name; - - private String description; - - private String enabled; + private String id; + + private String name; + + private String description; + + private String enabled; - /** - * @return the id - */ - public String getId() { - return id; - } + /** + * @return the id + */ + public String getId() { + return id; + } - /** - * @return the name - */ - public String getName() { - return name; - } + /** + * @return the name + */ + public String getName() { + return name; + } - /** - * @param name the name to set - */ - public void setName(String name) { - this.name = name; - } + /** + * @param name the name to set + */ + public void setName(String name) { + this.name = name; + } - /** - * @return the description - */ - public String getDescription() { - return description; - } + /** + * @return the description + */ + public String getDescription() { + return description; + } - /** - * @param description the description to set - */ - public void setDescription(String description) { - this.description = description; - } + /** + * @param description the description to set + */ + public void setDescription(String description) { + this.description = description; + } - /** - * @return the enabled - */ - public String getEnabled() { - return enabled; - } + /** + * @return the enabled + */ + public String getEnabled() { + return enabled; + } - /** - * @param enabled the enabled to set - */ - public void setEnabled(String enabled) { - this.enabled = enabled; - } + /** + * @param enabled the enabled to set + */ + public void setEnabled(String enabled) { + this.enabled = enabled; + } } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Roles.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Roles.java index 9d33f57..bee8b66 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Roles.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Roles.java @@ -24,27 +24,27 @@ import org.codehaus.jackson.annotate.JsonProperty; public class Roles implements Iterable<Role>, Serializable { - @JsonProperty("roles") - private List<Role> list; + @JsonProperty("roles") + private List<Role> list; - /** - * @return the list - */ - public List<Role> getList() { - return list; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Roles [list=" + list + "]"; - } + /** + * @return the list + */ + public List<Role> getList() { + return list; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Roles [list=" + list + "]"; + } - @Override - public Iterator<Role> iterator() { - return list.iterator(); - } - + @Override + public Iterator<Role> iterator() { + return list.iterator(); + } + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Service.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Service.java index 31d37d1..ff01737 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Service.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Service.java @@ -21,44 +21,44 @@ import org.codehaus.jackson.map.annotate.JsonRootName; @JsonRootName("service") public class Service { - private String id; - - private String type; - - private String name; - - private String description; + private String id; + + private String type; + + private String name; + + private String description; - public String getId() { - return id; - } + public String getId() { + return id; + } - public void setId(String id) { - this.id = id; - } + public void setId(String id) { + this.id = id; + } - public String getType() { - return type; - } + public String getType() { + return type; + } - public void setType(String type) { - this.type = type; - } + public void setType(String type) { + this.type = type; + } - public String getName() { - return name; - } + public String getName() { + return name; + } - public void setName(String name) { - this.name = name; - } + public void setName(String name) { + this.name = name; + } - public String getDescription() { - return description; - } + public String getDescription() { + return description; + } - public void setDescription(String description) { - this.description = description; - } - + public void setDescription(String description) { + this.description = description; + } + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Services.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Services.java index 7b97e74..466817e 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Services.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Services.java @@ -26,27 +26,27 @@ import com.woorea.openstack.keystone.model.Service; public class Services implements Iterable<Service>, Serializable { - @JsonProperty("services") - private List<Service> list; - - /** - * @return the list - */ - public List<Service> getList() { - return list; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Services [list=" + list + "]"; - } - - @Override - public Iterator<Service> iterator() { - return list.iterator(); - } - + @JsonProperty("services") + private List<Service> list; + + /** + * @return the list + */ + public List<Service> getList() { + return list; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Services [list=" + list + "]"; + } + + @Override + public Iterator<Service> iterator() { + return list.iterator(); + } + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Token.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Token.java index 2b2a710..2078804 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Token.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Token.java @@ -27,360 +27,360 @@ import org.codehaus.jackson.map.annotate.JsonRootName; @JsonRootName("token") @JsonIgnoreProperties(ignoreUnknown=true) public class Token implements Serializable { - - private String id; - - @JsonProperty("expires_at") - private Calendar expiresAt; - - @JsonProperty("issued_at") - private Calendar issuedAt; - - private List<String> methods; - - @JsonIgnoreProperties(ignoreUnknown=true) - public static final class Domain { - - private String id; - - private String name; - - 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; - } - - } - - private Domain domain; - - @JsonIgnoreProperties(ignoreUnknown=true) - public static final class Project { - - private Domain domain; - - private String id; - - private String name; - - public Domain getDomain() { - return domain; - } - - public void setDomain(Domain domain) { - this.domain = domain; - } - - 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; - } - - } - - private Project project; - - @JsonIgnoreProperties(ignoreUnknown=true) - public static final class User { - - @JsonIgnoreProperties(ignoreUnknown=true) - private static final class Domain { - - private String id; - - private String name; - - 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; - } - - } - - private String id; - - private String name; - - 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; - } - - } - - private User user; - - @JsonIgnoreProperties(ignoreUnknown=true) - public static final class Role { - - private String id; - - private String name; - - } - - private List<Role> roles; - - public static final class Service { - - public static final class Endpoint { - - private String id; - - private String url; - - private String region; - - private Boolean enabled; - - @JsonProperty("legacy_endpoint_id") - private String legacyEndpointId; - - @JsonProperty("interface") - private String iface; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getUrl() { - return url; - } - - public void setUrl(String url) { - this.url = url; - } - - public String getRegion() { - return region; - } - - public void setRegion(String region) { - this.region = region; - } - - public Boolean getEnabled() { - return enabled; - } - - public void setEnabled(Boolean enabled) { - this.enabled = enabled; - } + + private String id; + + @JsonProperty("expires_at") + private Calendar expiresAt; + + @JsonProperty("issued_at") + private Calendar issuedAt; + + private List<String> methods; + + @JsonIgnoreProperties(ignoreUnknown=true) + public static final class Domain { + + private String id; + + private String name; + + 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; + } + + } + + private Domain domain; + + @JsonIgnoreProperties(ignoreUnknown=true) + public static final class Project { + + private Domain domain; + + private String id; + + private String name; + + public Domain getDomain() { + return domain; + } + + public void setDomain(Domain domain) { + this.domain = domain; + } + + 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; + } + + } + + private Project project; + + @JsonIgnoreProperties(ignoreUnknown=true) + public static final class User { + + @JsonIgnoreProperties(ignoreUnknown=true) + private static final class Domain { + + private String id; + + private String name; + + 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; + } + + } + + private String id; + + private String name; + + 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; + } + + } + + private User user; + + @JsonIgnoreProperties(ignoreUnknown=true) + public static final class Role { + + private String id; + + private String name; + + } + + private List<Role> roles; + + public static final class Service { + + public static final class Endpoint { + + private String id; + + private String url; + + private String region; + + private Boolean enabled; + + @JsonProperty("legacy_endpoint_id") + private String legacyEndpointId; + + @JsonProperty("interface") + private String iface; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + public String getRegion() { + return region; + } + + public void setRegion(String region) { + this.region = region; + } + + public Boolean getEnabled() { + return enabled; + } + + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } - public String getLegacyEndpointId() { - return legacyEndpointId; - } + public String getLegacyEndpointId() { + return legacyEndpointId; + } - public void setLegacyEndpointId(String legacyEndpointId) { - this.legacyEndpointId = legacyEndpointId; - } + public void setLegacyEndpointId(String legacyEndpointId) { + this.legacyEndpointId = legacyEndpointId; + } - public String getInterface() { - return iface; - } + public String getInterface() { + return iface; + } - public void setInterface(String iface) { - this.iface = iface; - } - - } - - private String id; - - private String type; - - private List<Endpoint> endpoints; + public void setInterface(String iface) { + this.iface = iface; + } + + } + + private String id; + + private String type; + + private List<Endpoint> endpoints; - public String getId() { - return id; - } + public String getId() { + return id; + } - public void setId(String id) { - this.id = id; - } + public void setId(String id) { + this.id = id; + } - public String getType() { - return type; - } + public String getType() { + return type; + } - public void setType(String type) { - this.type = type; - } + public void setType(String type) { + this.type = type; + } - public List<Endpoint> getEndpoints() { - return endpoints; - } + public List<Endpoint> getEndpoints() { + return endpoints; + } - public void setEndpoints(List<Endpoint> endpoints) { - this.endpoints = endpoints; - } - - } - - private List<Service> catalog; + public void setEndpoints(List<Endpoint> endpoints) { + this.endpoints = endpoints; + } + + } + + private List<Service> catalog; - public String getId() { - return id; - } + public String getId() { + return id; + } - public void setId(String id) { - this.id = id; - } + public void setId(String id) { + this.id = id; + } - public Calendar getExpiresAt() { - return expiresAt; - } + public Calendar getExpiresAt() { + return expiresAt; + } - public void setExpiresAt(Calendar expiresAt) { - this.expiresAt = expiresAt; - } + public void setExpiresAt(Calendar expiresAt) { + this.expiresAt = expiresAt; + } - public Calendar getIssuedAt() { - return issuedAt; - } + public Calendar getIssuedAt() { + return issuedAt; + } - public void setIssuedAt(Calendar issuedAt) { - this.issuedAt = issuedAt; - } + public void setIssuedAt(Calendar issuedAt) { + this.issuedAt = issuedAt; + } - public List<String> getMethods() { - return methods; - } + public List<String> getMethods() { + return methods; + } - public void setMethods(List<String> methods) { - this.methods = methods; - } + public void setMethods(List<String> methods) { + this.methods = methods; + } - public Domain getDomain() { - return domain; - } + public Domain getDomain() { + return domain; + } - public void setDomain(Domain domain) { - this.domain = domain; - } + public void setDomain(Domain domain) { + this.domain = domain; + } - public Project getProject() { - return project; - } + public Project getProject() { + return project; + } - public void setProject(Project project) { - this.project = project; - } + public void setProject(Project project) { + this.project = project; + } - public User getUser() { - return user; - } + public User getUser() { + return user; + } - public void setUser(User user) { - this.user = user; - } + public void setUser(User user) { + this.user = user; + } - public List<Role> getRoles() { - return roles; - } + public List<Role> getRoles() { + return roles; + } - public void setRoles(List<Role> roles) { - this.roles = roles; - } + public void setRoles(List<Role> roles) { + this.roles = roles; + } - public List<Service> getCatalog() { - return catalog; - } + public List<Service> getCatalog() { + return catalog; + } - public void setCatalog(List<Service> catalog) { - this.catalog = catalog; - } + public void setCatalog(List<Service> catalog) { + this.catalog = catalog; + } - - @Override - public String toString() { - return "Token [id=" + id + ", expiresAt=" + expiresAt + ", issuedAt=" - + issuedAt + ", methods=" + methods + ", domain=" + domain - + ", project=" + project + ", user=" + user + ", roles=" - + roles + ", catalog=" + catalog + "]"; - } + + @Override + public String toString() { + return "Token [id=" + id + ", expiresAt=" + expiresAt + ", issuedAt=" + + issuedAt + ", methods=" + methods + ", domain=" + domain + + ", project=" + project + ", user=" + user + ", roles=" + + roles + ", catalog=" + catalog + "]"; + } } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/User.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/User.java index 7ee8528..9675ce5 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/User.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/User.java @@ -22,86 +22,86 @@ import org.codehaus.jackson.map.annotate.JsonRootName; @JsonRootName("user") public class User { - private String id; - - @JsonProperty("domain_id") - private String domainId; - - @JsonProperty("default_project_id") - private String defaultProjectId; - - private String name; - - private String password; - - private String email; - - private String description; - - private Boolean enabled; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getDomainId() { - return domainId; - } - - public void setDomainId(String domainId) { - this.domainId = domainId; - } - - public String getDefaultProjectId() { - return defaultProjectId; - } - - public void setDefaultProjectId(String defaultProjectId) { - this.defaultProjectId = defaultProjectId; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getPassword() { - return password; - } - - public void setPassword(String password) { - this.password = password; - } - - public String getEmail() { - return email; - } - - public void setEmail(String email) { - this.email = email; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public Boolean getEnabled() { - return enabled; - } - - public void setEnabled(Boolean enabled) { - this.enabled = enabled; - } - + private String id; + + @JsonProperty("domain_id") + private String domainId; + + @JsonProperty("default_project_id") + private String defaultProjectId; + + private String name; + + private String password; + + private String email; + + private String description; + + private Boolean enabled; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getDomainId() { + return domainId; + } + + public void setDomainId(String domainId) { + this.domainId = domainId; + } + + public String getDefaultProjectId() { + return defaultProjectId; + } + + public void setDefaultProjectId(String defaultProjectId) { + this.defaultProjectId = defaultProjectId; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public Boolean getEnabled() { + return enabled; + } + + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Users.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Users.java index 0dd6165..208af1a 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Users.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Users.java @@ -26,27 +26,27 @@ import com.woorea.openstack.keystone.model.User; public class Users implements Iterable<User>, Serializable { - @JsonProperty("users") - private List<User> list; - - /** - * @return the list - */ - public List<User> getList() { - return list; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Users [list=" + list + "]"; - } - - @Override - public Iterator<User> iterator() { - return list.iterator(); - } - + @JsonProperty("users") + private List<User> list; + + /** + * @return the list + */ + public List<User> getList() { + return list; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Users [list=" + list + "]"; + } + + @Override + public Iterator<User> iterator() { + return list.iterator(); + } + } diff --git a/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/AggregatesExtension.java b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/AggregatesExtension.java index df3816e..b73ec97 100644 --- a/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/AggregatesExtension.java +++ b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/AggregatesExtension.java @@ -27,153 +27,153 @@ import com.woorea.openstack.nova.model.HostAggregate; import com.woorea.openstack.nova.model.HostAggregates; public class AggregatesExtension { - - private final OpenStackClient CLIENT; - - public AggregatesExtension(OpenStackClient client) { - CLIENT = client; - } - - public List list() { - return new List(); - } - - public ShowAggregate showAggregate(String id) { - return new ShowAggregate(id); - } - - public UpdateAggregateMetadata updateAggregateMetadata(String id, - String name, String availabilityZone) { - return new UpdateAggregateMetadata(id, name, availabilityZone); - } - - public CreateAggregate createAggregate(String aggregateName, - String availabilityZoneName) { - return new CreateAggregate(aggregateName, availabilityZoneName); - } - - public DeleteAggregate deleteAggregate(String id) { - return new DeleteAggregate(id); - } - - public AddHost addHost(String aggregateId, String hostId) { - return new AddHost(aggregateId, hostId); - } - - public RemoveHost removeHost(String aggregateId, String hostId) { - return new RemoveHost(hostId, aggregateId); - } - - public SetMetadata setMetadata(String aggregateId, - String key, String value) { - return new SetMetadata(aggregateId, key, value); - } - - public class List extends OpenStackRequest<HostAggregates> { - - public List() { - super(CLIENT, HttpMethod.GET, "/os-aggregates", - null, - HostAggregates.class); - } - - } - - public class ShowAggregate extends OpenStackRequest<HostAggregate> { - - public ShowAggregate(String id) { - super(CLIENT, HttpMethod.GET, - new StringBuffer("/os-aggregates/").append(id), - null, - HostAggregate.class); - } - - } - - public class UpdateAggregateMetadata extends OpenStackRequest<HostAggregate> { - public UpdateAggregateMetadata(String id, - String name, String availabilityZone) { - super(CLIENT, HttpMethod.PUT, - new StringBuffer("/os-aggregates/").append(id), - availabilityZone == null ? - Entity.json("{\"aggregate\": {\"name\": \"" + name + "\" }}") - : - Entity.json("{\"aggregate\": {\"name\": \"" + - name + - "\", \"availability_zone\": \"" + - availabilityZone + - "\" }}"), - HostAggregate.class); - } - - } - - public class CreateAggregate extends OpenStackRequest<HostAggregate> { - - public CreateAggregate(String name, String availabilityZone) { - super(CLIENT, HttpMethod.POST, - new StringBuffer("/os-aggregates"), - availabilityZone == null ? - Entity.json("{\"aggregate\": {\"name\": \"" + - name + - "\", \"availability_zone\": null }}") - : - Entity.json("{\"aggregate\": {\"name\": \"" + - name + - "\", \"availability_zone\": \"" + - availabilityZone + - "\" }}"), - HostAggregate.class); - } - - } - - public class DeleteAggregate extends OpenStackRequest<Void> { - - public DeleteAggregate(String id) { - super(CLIENT, HttpMethod.DELETE, - new StringBuffer("/os-aggregates/").append(id), - null, - null); - } - } - - public class AddHost extends OpenStackRequest<HostAggregate> { - - public AddHost(String aggregateId, String hostId) { - super(CLIENT, HttpMethod.POST, - new StringBuffer("/os-aggregates/") - .append(aggregateId).append("/action"), - Entity.json("{\"add_host\": {\"host\": \"" + - hostId + "\" }}"), - HostAggregate.class); - } - - } - - public class RemoveHost extends OpenStackRequest<HostAggregate> { - - public RemoveHost(String hostId, String aggregateId) { - super(CLIENT, HttpMethod.POST, - new StringBuffer("/os-aggregates/") - .append(aggregateId).append("/action"), - Entity.json("{\"remove_host\": {\"host\": \"" + - hostId + "\" }}"), - HostAggregate.class); - } - - } - - public class SetMetadata extends OpenStackRequest<HostAggregate> { - - public SetMetadata(String aggregateId, String key, String value) { - super(CLIENT, HttpMethod.POST, - new StringBuffer("/os-aggregates/") - .append(aggregateId).append("/action"), - Entity.json("{\"set_metadata\": {\"metadata\": { \"" + - key + "\": \"" + value + "\" }}}"), - HostAggregate.class); - } - } + + private final OpenStackClient CLIENT; + + public AggregatesExtension(OpenStackClient client) { + CLIENT = client; + } + + public List list() { + return new List(); + } + + public ShowAggregate showAggregate(String id) { + return new ShowAggregate(id); + } + + public UpdateAggregateMetadata updateAggregateMetadata(String id, + String name, String availabilityZone) { + return new UpdateAggregateMetadata(id, name, availabilityZone); + } + + public CreateAggregate createAggregate(String aggregateName, + String availabilityZoneName) { + return new CreateAggregate(aggregateName, availabilityZoneName); + } + + public DeleteAggregate deleteAggregate(String id) { + return new DeleteAggregate(id); + } + + public AddHost addHost(String aggregateId, String hostId) { + return new AddHost(aggregateId, hostId); + } + + public RemoveHost removeHost(String aggregateId, String hostId) { + return new RemoveHost(hostId, aggregateId); + } + + public SetMetadata setMetadata(String aggregateId, + String key, String value) { + return new SetMetadata(aggregateId, key, value); + } + + public class List extends OpenStackRequest<HostAggregates> { + + public List() { + super(CLIENT, HttpMethod.GET, "/os-aggregates", + null, + HostAggregates.class); + } + + } + + public class ShowAggregate extends OpenStackRequest<HostAggregate> { + + public ShowAggregate(String id) { + super(CLIENT, HttpMethod.GET, + new StringBuffer("/os-aggregates/").append(id), + null, + HostAggregate.class); + } + + } + + public class UpdateAggregateMetadata extends OpenStackRequest<HostAggregate> { + public UpdateAggregateMetadata(String id, + String name, String availabilityZone) { + super(CLIENT, HttpMethod.PUT, + new StringBuffer("/os-aggregates/").append(id), + availabilityZone == null ? + Entity.json("{\"aggregate\": {\"name\": \"" + name + "\" }}") + : + Entity.json("{\"aggregate\": {\"name\": \"" + + name + + "\", \"availability_zone\": \"" + + availabilityZone + + "\" }}"), + HostAggregate.class); + } + + } + + public class CreateAggregate extends OpenStackRequest<HostAggregate> { + + public CreateAggregate(String name, String availabilityZone) { + super(CLIENT, HttpMethod.POST, + new StringBuffer("/os-aggregates"), + availabilityZone == null ? + Entity.json("{\"aggregate\": {\"name\": \"" + + name + + "\", \"availability_zone\": null }}") + : + Entity.json("{\"aggregate\": {\"name\": \"" + + name + + "\", \"availability_zone\": \"" + + availabilityZone + + "\" }}"), + HostAggregate.class); + } + + } + + public class DeleteAggregate extends OpenStackRequest<Void> { + + public DeleteAggregate(String id) { + super(CLIENT, HttpMethod.DELETE, + new StringBuffer("/os-aggregates/").append(id), + null, + null); + } + } + + public class AddHost extends OpenStackRequest<HostAggregate> { + + public AddHost(String aggregateId, String hostId) { + super(CLIENT, HttpMethod.POST, + new StringBuffer("/os-aggregates/") + .append(aggregateId).append("/action"), + Entity.json("{\"add_host\": {\"host\": \"" + + hostId + "\" }}"), + HostAggregate.class); + } + + } + + public class RemoveHost extends OpenStackRequest<HostAggregate> { + + public RemoveHost(String hostId, String aggregateId) { + super(CLIENT, HttpMethod.POST, + new StringBuffer("/os-aggregates/") + .append(aggregateId).append("/action"), + Entity.json("{\"remove_host\": {\"host\": \"" + + hostId + "\" }}"), + HostAggregate.class); + } + + } + + public class SetMetadata extends OpenStackRequest<HostAggregate> { + + public SetMetadata(String aggregateId, String key, String value) { + super(CLIENT, HttpMethod.POST, + new StringBuffer("/os-aggregates/") + .append(aggregateId).append("/action"), + Entity.json("{\"set_metadata\": {\"metadata\": { \"" + + key + "\": \"" + value + "\" }}}"), + HostAggregate.class); + } + } } diff --git a/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/CloudpipesExtension.java b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/CloudpipesExtension.java index 9187507..d957382 100644 --- a/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/CloudpipesExtension.java +++ b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/CloudpipesExtension.java @@ -25,41 +25,41 @@ import com.woorea.openstack.nova.model.Cloudpipe; import com.woorea.openstack.nova.model.Cloudpipes; public class CloudpipesExtension { - - private final OpenStackClient CLIENT; - - public CloudpipesExtension(OpenStackClient client) { - CLIENT = client; - } - - public List list() { - return new List(); - } - - public Create create(Cloudpipe cloudpipe) { - return new Create(cloudpipe); - } - - public class List extends OpenStackRequest<Cloudpipes> { + + private final OpenStackClient CLIENT; + + public CloudpipesExtension(OpenStackClient client) { + CLIENT = client; + } + + public List list() { + return new List(); + } + + public Create create(Cloudpipe cloudpipe) { + return new Create(cloudpipe); + } + + public class List extends OpenStackRequest<Cloudpipes> { - - public List() { - super(CLIENT, HttpMethod.GET, "/os-cloudpipes", null, Cloudpipes.class); - } + + public List() { + super(CLIENT, HttpMethod.GET, "/os-cloudpipes", null, Cloudpipes.class); + } - } + } - public class Create extends OpenStackRequest<Cloudpipe> { + public class Create extends OpenStackRequest<Cloudpipe> { - private Cloudpipe cloudpipe; - - public Create(Cloudpipe cloudpipe) { - super(CLIENT, HttpMethod.POST, "/os-cloudpipes", Entity.json(cloudpipe), Cloudpipe.class); - this.cloudpipe = cloudpipe; - } + private Cloudpipe cloudpipe; + + public Create(Cloudpipe cloudpipe) { + super(CLIENT, HttpMethod.POST, "/os-cloudpipes", Entity.json(cloudpipe), Cloudpipe.class); + this.cloudpipe = cloudpipe; + } - } + } - - + + } diff --git a/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/CredentialsExtension.java b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/CredentialsExtension.java index 207028a..6950827 100644 --- a/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/CredentialsExtension.java +++ b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/CredentialsExtension.java @@ -23,37 +23,37 @@ import com.woorea.openstack.base.client.OpenStackRequest; import com.woorea.openstack.nova.model.Certificate; public class CredentialsExtension { - - private final OpenStackClient CLIENT; - - public CredentialsExtension(OpenStackClient client) { - CLIENT = client; - } - - public Create createCertificate(String id) { - return new Create(id); - } + + private final OpenStackClient CLIENT; + + public CredentialsExtension(OpenStackClient client) { + CLIENT = client; + } + + public Create createCertificate(String id) { + return new Create(id); + } - public Show showCertificate(String id) { - return new Show(); - } + public Show showCertificate(String id) { + return new Show(); + } - public class Create extends OpenStackRequest<Certificate> { + public class Create extends OpenStackRequest<Certificate> { - public Create(String id) { - super(CLIENT, HttpMethod.GET, new StringBuffer("/os-certificates").append(id).toString(), null, Certificate.class); - } + public Create(String id) { + super(CLIENT, HttpMethod.GET, new StringBuffer("/os-certificates").append(id).toString(), null, Certificate.class); + } - } + } - public class Show extends OpenStackRequest<Certificate> { + public class Show extends OpenStackRequest<Certificate> { - public Show() { - super(CLIENT, HttpMethod.GET, "/os-certificates", null, Certificate.class); - } + public Show() { + super(CLIENT, HttpMethod.GET, "/os-certificates", null, Certificate.class); + } - } + } - + } diff --git a/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/FloatingIpDnsExtension.java b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/FloatingIpDnsExtension.java index 05d9cbc..f2a6bd6 100644 --- a/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/FloatingIpDnsExtension.java +++ b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/FloatingIpDnsExtension.java @@ -25,81 +25,81 @@ import com.woorea.openstack.nova.model.FloatingIpDomain; import com.woorea.openstack.nova.model.FloatingIpDomains; public class FloatingIpDnsExtension { - - private final OpenStackClient CLIENT; - - public FloatingIpDnsExtension(OpenStackClient client) { - CLIENT = client; - } - - public ListDomains listFloatingIpDomains() { - return new ListDomains(); - } - - public CreateDomain create(FloatingIpDomain floatingIpDomain) { - return new CreateDomain(floatingIpDomain); - } - - public ShowDomain show(String id) { - return new ShowDomain(id); - } - - public UpdateDomain update(FloatingIpDomain floatingIpDomain) { - return new UpdateDomain(floatingIpDomain); - } - - public DeleteDomain delete(String id) { - return new DeleteDomain(id); - } - - public class ListDomains extends OpenStackRequest<FloatingIpDomains> { + + private final OpenStackClient CLIENT; + + public FloatingIpDnsExtension(OpenStackClient client) { + CLIENT = client; + } + + public ListDomains listFloatingIpDomains() { + return new ListDomains(); + } + + public CreateDomain create(FloatingIpDomain floatingIpDomain) { + return new CreateDomain(floatingIpDomain); + } + + public ShowDomain show(String id) { + return new ShowDomain(id); + } + + public UpdateDomain update(FloatingIpDomain floatingIpDomain) { + return new UpdateDomain(floatingIpDomain); + } + + public DeleteDomain delete(String id) { + return new DeleteDomain(id); + } + + public class ListDomains extends OpenStackRequest<FloatingIpDomains> { - public ListDomains() { - super(CLIENT, HttpMethod.GET, "/os-floating-ip-dns", null, FloatingIpDomains.class); - } + public ListDomains() { + super(CLIENT, HttpMethod.GET, "/os-floating-ip-dns", null, FloatingIpDomains.class); + } - } + } - public class CreateDomain extends OpenStackRequest<FloatingIpDomain> { + public class CreateDomain extends OpenStackRequest<FloatingIpDomain> { - private FloatingIpDomain floatingIpDomain; - - public CreateDomain(FloatingIpDomain floatingIpDomain) { - super(CLIENT, HttpMethod.POST, "/os-floating-ip-dns", Entity.json(floatingIpDomain), FloatingIpDomain.class); - this.floatingIpDomain = floatingIpDomain; - } - - } - - public class ShowDomain extends OpenStackRequest<FloatingIpDomain> { - - public ShowDomain(String id) { - super(CLIENT, HttpMethod.GET, new StringBuffer("/os-floating-ip-dns/").append(id).toString(), null, FloatingIpDomain.class); - } - - } + private FloatingIpDomain floatingIpDomain; + + public CreateDomain(FloatingIpDomain floatingIpDomain) { + super(CLIENT, HttpMethod.POST, "/os-floating-ip-dns", Entity.json(floatingIpDomain), FloatingIpDomain.class); + this.floatingIpDomain = floatingIpDomain; + } + + } + + public class ShowDomain extends OpenStackRequest<FloatingIpDomain> { + + public ShowDomain(String id) { + super(CLIENT, HttpMethod.GET, new StringBuffer("/os-floating-ip-dns/").append(id).toString(), null, FloatingIpDomain.class); + } + + } - - public static class UpdateDomain extends OpenStackRequest<FloatingIpDomain> { + + public static class UpdateDomain extends OpenStackRequest<FloatingIpDomain> { - private FloatingIpDomain floatingIpDomain; - - public UpdateDomain(FloatingIpDomain floatingIpDomain) { - //super(CLIENT, HttpMethod.PUT, new StringBuffer("/os-floating-ip-dns/").append(id).toString(), Entity.json(floatingIpDomain), FloatingIpDomain.class); - this.floatingIpDomain = floatingIpDomain; - } - - } + private FloatingIpDomain floatingIpDomain; + + public UpdateDomain(FloatingIpDomain floatingIpDomain) { + //super(CLIENT, HttpMethod.PUT, new StringBuffer("/os-floating-ip-dns/").append(id).toString(), Entity.json(floatingIpDomain), FloatingIpDomain.class); + this.floatingIpDomain = floatingIpDomain; + } + + } - - public class DeleteDomain extends OpenStackRequest<Void> { - - public DeleteDomain(String id) { - super(CLIENT, HttpMethod.DELETE, new StringBuffer("/os-floating-ip-dns/").append(id).toString(), null, Void.class); - } - - } - - - + + public class DeleteDomain extends OpenStackRequest<Void> { + + public DeleteDomain(String id) { + super(CLIENT, HttpMethod.DELETE, new StringBuffer("/os-floating-ip-dns/").append(id).toString(), null, Void.class); + } + + } + + + } diff --git a/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/FloatingIpPoolsExtension.java b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/FloatingIpPoolsExtension.java index 44a14a4..d574ef6 100644 --- a/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/FloatingIpPoolsExtension.java +++ b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/FloatingIpPoolsExtension.java @@ -23,25 +23,25 @@ import com.woorea.openstack.base.client.OpenStackRequest; import com.woorea.openstack.nova.model.FloatingIpPools; public class FloatingIpPoolsExtension { - - private final OpenStackClient CLIENT; - - public FloatingIpPoolsExtension(OpenStackClient client) { - CLIENT = client; - } - - public List list() { - return new List(); - } - - public class List extends OpenStackRequest<FloatingIpPools> { - - public List() { - super(CLIENT, HttpMethod.GET, "/os-floating-ip-pools", null, FloatingIpPools.class); - } - - } - - + + private final OpenStackClient CLIENT; + + public FloatingIpPoolsExtension(OpenStackClient client) { + CLIENT = client; + } + + public List list() { + return new List(); + } + + public class List extends OpenStackRequest<FloatingIpPools> { + + public List() { + super(CLIENT, HttpMethod.GET, "/os-floating-ip-pools", null, FloatingIpPools.class); + } + + } + + } diff --git a/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/FloatingIpsExtension.java b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/FloatingIpsExtension.java index be8aaac..4b39b2e 100644 --- a/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/FloatingIpsExtension.java +++ b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/FloatingIpsExtension.java @@ -28,56 +28,56 @@ import com.woorea.openstack.nova.model.FloatingIp; import com.woorea.openstack.nova.model.FloatingIps; public class FloatingIpsExtension { - - private final OpenStackClient CLIENT; - - public FloatingIpsExtension(OpenStackClient client) { - CLIENT = client; - } - - public class List extends OpenStackRequest<FloatingIps> { + + private final OpenStackClient CLIENT; + + public FloatingIpsExtension(OpenStackClient client) { + CLIENT = client; + } + + public class List extends OpenStackRequest<FloatingIps> { - public List() { - super(CLIENT, HttpMethod.GET, "/os-floating-ips", null, FloatingIps.class); - } + public List() { + super(CLIENT, HttpMethod.GET, "/os-floating-ips", null, FloatingIps.class); + } - } + } - public class Allocate extends OpenStackRequest<FloatingIp> { - - public Allocate(Entity<?> entity) { - super(CLIENT, HttpMethod.POST, "/os-floating-ips", entity, FloatingIp.class); - } + public class Allocate extends OpenStackRequest<FloatingIp> { + + public Allocate(Entity<?> entity) { + super(CLIENT, HttpMethod.POST, "/os-floating-ips", entity, FloatingIp.class); + } - } - - public class Deallocate extends OpenStackRequest<Void> { - - public Deallocate(String id) { - super(CLIENT, HttpMethod.DELETE, new StringBuffer("/os-floating-ips/").append(id).toString(), null, Void.class); - } - - } + } + + public class Deallocate extends OpenStackRequest<Void> { + + public Deallocate(String id) { + super(CLIENT, HttpMethod.DELETE, new StringBuffer("/os-floating-ips/").append(id).toString(), null, Void.class); + } + + } - public List list() { - return new List(); - } - - public Allocate allocate(String pool) { - Entity<?> entity=null; - if(pool!=null) { - Map<String, String> body = new HashMap<String, String>(); - body.put("pool", pool); - entity=Entity.json(body); - } - return new Allocate(entity); - } - - public Deallocate deallocate(String id) { - return new Deallocate(id); - } - - - + public List list() { + return new List(); + } + + public Allocate allocate(String pool) { + Entity<?> entity=null; + if(pool!=null) { + Map<String, String> body = new HashMap<String, String>(); + body.put("pool", pool); + entity=Entity.json(body); + } + return new Allocate(entity); + } + + public Deallocate deallocate(String id) { + return new Deallocate(id); + } + + + } diff --git a/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/HostsExtension.java b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/HostsExtension.java index 8c8908c..f5a0693 100644 --- a/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/HostsExtension.java +++ b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/HostsExtension.java @@ -24,37 +24,37 @@ import com.woorea.openstack.nova.model.Host; import com.woorea.openstack.nova.model.Hosts; public class HostsExtension { - - private final OpenStackClient CLIENT; - - public HostsExtension(OpenStackClient client) { - CLIENT = client; - } - - public List list() { - return new List(); - } - - public Show show(String id) { - return new Show(id); - } - - public class List extends OpenStackRequest<Hosts> { - - public List() { - super(CLIENT, HttpMethod.GET, "/os-hosts", null, Hosts.class); - } - - } - - public class Show extends OpenStackRequest<Host> { - - public Show(String id) { - super(CLIENT, HttpMethod.GET, new StringBuffer("/os-hosts/").append(id).toString(), null, Host.class); - } - - } - - - + + private final OpenStackClient CLIENT; + + public HostsExtension(OpenStackClient client) { + CLIENT = client; + } + + public List list() { + return new List(); + } + + public Show show(String id) { + return new Show(id); + } + + public class List extends OpenStackRequest<Hosts> { + + public List() { + super(CLIENT, HttpMethod.GET, "/os-hosts", null, Hosts.class); + } + + } + + public class Show extends OpenStackRequest<Host> { + + public Show(String id) { + super(CLIENT, HttpMethod.GET, new StringBuffer("/os-hosts/").append(id).toString(), null, Host.class); + } + + } + + + } diff --git a/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/KeyPairsExtension.java b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/KeyPairsExtension.java index bfd7a52..a8a39b6 100644 --- a/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/KeyPairsExtension.java +++ b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/KeyPairsExtension.java @@ -25,57 +25,57 @@ import com.woorea.openstack.nova.model.KeyPair; import com.woorea.openstack.nova.model.KeyPairs; public class KeyPairsExtension { - - private final OpenStackClient CLIENT; - - public KeyPairsExtension(OpenStackClient client) { - CLIENT = client; - } - - public List list() { - return new List(); - } + + private final OpenStackClient CLIENT; + + public KeyPairsExtension(OpenStackClient client) { + CLIENT = client; + } + + public List list() { + return new List(); + } - public Create create(String name, String publicKey) { - KeyPair keyPairForCreate = new KeyPair(name, publicKey); - return new Create(keyPairForCreate); - } + public Create create(String name, String publicKey) { + KeyPair keyPairForCreate = new KeyPair(name, publicKey); + return new Create(keyPairForCreate); + } - public Create create(String name) { - return create(name, null); - } + public Create create(String name) { + return create(name, null); + } - public Delete delete(String name) { - return new Delete(name); - } + public Delete delete(String name) { + return new Delete(name); + } - public class Create extends OpenStackRequest<KeyPair> { + public class Create extends OpenStackRequest<KeyPair> { - private KeyPair keyPairForCreate; + private KeyPair keyPairForCreate; - public Create(KeyPair keyPairForCreate) { - super(CLIENT, HttpMethod.POST, "/os-keypairs", Entity.json(keyPairForCreate), KeyPair.class); - this.keyPairForCreate = keyPairForCreate; - } + public Create(KeyPair keyPairForCreate) { + super(CLIENT, HttpMethod.POST, "/os-keypairs", Entity.json(keyPairForCreate), KeyPair.class); + this.keyPairForCreate = keyPairForCreate; + } - } + } - public class Delete extends OpenStackRequest<Void> { + public class Delete extends OpenStackRequest<Void> { - private String name; + private String name; - public Delete(String name) { - super(CLIENT, HttpMethod.DELETE, new StringBuilder("/os-keypairs/").append(name).toString(), null, Void.class); - } + public Delete(String name) { + super(CLIENT, HttpMethod.DELETE, new StringBuilder("/os-keypairs/").append(name).toString(), null, Void.class); + } - } + } - public class List extends OpenStackRequest<KeyPairs> { + public class List extends OpenStackRequest<KeyPairs> { - public List() { - super(CLIENT, HttpMethod.GET, "/os-keypairs", null, KeyPairs.class); - } + public List() { + super(CLIENT, HttpMethod.GET, "/os-keypairs", null, KeyPairs.class); + } - } - + } + } diff --git a/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/NetworksExtension.java b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/NetworksExtension.java index 1fc7c1d..7570254 100644 --- a/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/NetworksExtension.java +++ b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/NetworksExtension.java @@ -25,74 +25,74 @@ import com.woorea.openstack.nova.model.Network; import com.woorea.openstack.nova.model.Networks; public class NetworksExtension { - - private final OpenStackClient CLIENT; - - public NetworksExtension(OpenStackClient client) { - CLIENT = client; - } - - public List list() { - return new List(); - } + + private final OpenStackClient CLIENT; + + public NetworksExtension(OpenStackClient client) { + CLIENT = client; + } + + public List list() { + return new List(); + } - public Show show(String id) { - return new Show(id); - } + public Show show(String id) { + return new Show(id); + } - public Delete delete(String id) { - return new Delete(id); - } + public Delete delete(String id) { + return new Delete(id); + } - public Disassociate disassociate(String id) { - return new Disassociate(id); - } + public Disassociate disassociate(String id) { + return new Disassociate(id); + } - public class List extends OpenStackRequest<Networks> { + public class List extends OpenStackRequest<Networks> { - public List() { - super(CLIENT, HttpMethod.GET, "/os-networks", null, Networks.class); - } + public List() { + super(CLIENT, HttpMethod.GET, "/os-networks", null, Networks.class); + } - } + } - public class Create extends OpenStackRequest<Network> { + public class Create extends OpenStackRequest<Network> { - private Network network; + private Network network; - public Create(Network network) { - super(CLIENT, HttpMethod.POST, "/os-networks", Entity.json(network), Network.class); - this.network = network; - } + public Create(Network network) { + super(CLIENT, HttpMethod.POST, "/os-networks", Entity.json(network), Network.class); + this.network = network; + } - } + } - public class Show extends OpenStackRequest<Network> { + public class Show extends OpenStackRequest<Network> { - public Show(String id) { - super(CLIENT, HttpMethod.GET, new StringBuilder("/os-networks/").append(id).toString(), null, Network.class); - } + public Show(String id) { + super(CLIENT, HttpMethod.GET, new StringBuilder("/os-networks/").append(id).toString(), null, Network.class); + } - } + } - public class Disassociate extends OpenStackRequest<Void> { + public class Disassociate extends OpenStackRequest<Void> { - public Disassociate(String id) { - super(CLIENT, HttpMethod.POST, new StringBuilder("/os-networks/").append(id).toString(), Entity.json("{\"action\":\"disassociate\"}"), Void.class); - ; - } + public Disassociate(String id) { + super(CLIENT, HttpMethod.POST, new StringBuilder("/os-networks/").append(id).toString(), Entity.json("{\"action\":\"disassociate\"}"), Void.class); + ; + } - } + } - public class Delete extends OpenStackRequest<Void> { + public class Delete extends OpenStackRequest<Void> { - public Delete(String id) { - super(CLIENT, HttpMethod.DELETE, new StringBuilder("/os-networks/").append(id).toString(), null, Void.class); - } + public Delete(String id) { + super(CLIENT, HttpMethod.DELETE, new StringBuilder("/os-networks/").append(id).toString(), null, Void.class); + } - } + } - + } diff --git a/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/SecurityGroupsExtension.java b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/SecurityGroupsExtension.java index ebfea43..bcfc96c 100644 --- a/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/SecurityGroupsExtension.java +++ b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/SecurityGroupsExtension.java @@ -27,179 +27,179 @@ import com.woorea.openstack.nova.model.SecurityGroupRuleForCreate; import com.woorea.openstack.nova.model.SecurityGroups; public class SecurityGroupsExtension { - - private final OpenStackClient CLIENT; - - public SecurityGroupsExtension(OpenStackClient client) { - CLIENT = client; - } - - public class List extends OpenStackRequest<SecurityGroups> { - - public List() { - super(CLIENT, HttpMethod.GET, "/os-security-groups", null, SecurityGroups.class); - } - - } - - public class Create extends OpenStackRequest<SecurityGroup> { - - private SecurityGroupForCreate securityGroupForCreate; - - public Create(SecurityGroupForCreate securityGroupForCreate) { - super(CLIENT, HttpMethod.POST, "/os-security-groups", Entity.json(securityGroupForCreate), SecurityGroup.class); - this.securityGroupForCreate = securityGroupForCreate; - } - - } - - public class Show extends OpenStackRequest<SecurityGroup> { - - /** - * @deprecated - * @param id - */ - @Deprecated - public Show(Integer id) { - super(CLIENT, HttpMethod.GET, new StringBuilder("/os-security-groups/").append(id).toString(), null, SecurityGroup.class); - } - public Show(String id) { - super(CLIENT, HttpMethod.GET, new StringBuilder("/os-security-groups/").append(id).toString(), null, SecurityGroup.class); - } - - } - - public class Delete extends OpenStackRequest<Void> { - - /** - * - * @param id - * @deprecated - */ - @Deprecated - public Delete(Integer id) { - super(CLIENT, HttpMethod.DELETE, new StringBuilder("/os-security-groups/").append(String.valueOf(id)).toString(), null, Void.class); - } - public Delete(String id) { - super(CLIENT, HttpMethod.DELETE, new StringBuilder("/os-security-groups/").append(id).toString(), null, Void.class); - } - - } - - public class CreateRule extends OpenStackRequest<SecurityGroup.Rule> { - - private SecurityGroupRuleForCreate securityGroupRuleForCreate; - - public CreateRule(SecurityGroupRuleForCreate securityGroupRuleForCreate) { - super(CLIENT, HttpMethod.POST, "/os-security-group-rules", Entity.json(securityGroupRuleForCreate), SecurityGroup.Rule.class); - this.securityGroupRuleForCreate = securityGroupRuleForCreate; - } - } - - public class DeleteRule extends OpenStackRequest<Void> { - - /** - * - * @param id - * @deprecated - */ - @Deprecated - public DeleteRule(Integer id) { - super(CLIENT, HttpMethod.DELETE, new StringBuilder("/os-security-group-rules/").append(String.valueOf(id)).toString(), null, Void.class); - } - - public DeleteRule(String id) { - super(CLIENT, HttpMethod.DELETE, new StringBuilder("/os-security-group-rules/").append(String.valueOf(id)).toString(), null, Void.class); - } - } - - public List listSecurityGroups() { - return new List(); - } - - public Create createSecurityGroup(String name, - String description) { - return new Create(new SecurityGroupForCreate(name, description)); - } - - public Create createSecurityGroup(String name) { - return createSecurityGroup(name, null); - } - - public Show showSecurityGroup(Integer id) { - return new Show(String.valueOf(id)); - } - - public Show showSecurityGroup(String id) { - return new Show(id); - } - public Delete deleteSecurityGroup(Integer id) { - return new Delete(String.valueOf(id)); - } - - public Delete deleteSecurityGroup(String id) { - return new Delete(id); - } - - /** - * - * @param parentSecurityGroupId - * @param ipProtocol - * @param fromPort - * @param toPort - * @param cidr - * @return - * @deprecated Use {@link #createSecurityGroupRule(String, String, Integer, Integer, String)} - */ - @Deprecated - public CreateRule createSecurityGroupRule( - Integer parentSecurityGroupId, String ipProtocol, Integer fromPort, - Integer toPort, String cidr) { - SecurityGroupRuleForCreate securityGroupRuleForCreate = new SecurityGroupRuleForCreate( - parentSecurityGroupId, ipProtocol, fromPort, toPort, cidr); - return new CreateRule(securityGroupRuleForCreate); - } - /** - * - * @param parentSecurityGroupId - * @param ipProtocol - * @param fromPort - * @param toPort - * @param cidr - * @return - * @deprecated Use {@link #createSecurityGroupRule(String, String, String, Integer, Integer)} - */ - @Deprecated - public CreateRule createSecurityGroupRule( - Integer parentSecurityGroupId, String ipProtocol, Integer fromPort, - Integer toPort, Integer sourceGroupId) { - SecurityGroupRuleForCreate securityGroupRuleForCreate = new SecurityGroupRuleForCreate( - parentSecurityGroupId, ipProtocol, fromPort, toPort, - sourceGroupId); - return new CreateRule(securityGroupRuleForCreate); - } - - public CreateRule createSecurityGroupRule( - String parentSecurityGroupId, String ipProtocol, Integer fromPort, - Integer toPort, String cidr) { - SecurityGroupRuleForCreate securityGroupRuleForCreate = new SecurityGroupRuleForCreate( - parentSecurityGroupId, ipProtocol, fromPort, toPort, cidr); - return new CreateRule(securityGroupRuleForCreate); - } - - public CreateRule createSecurityGroupRule( - String parentSecurityGroupId,String sourceGroupId,String ipProtocol, Integer fromPort, - Integer toPort) { - SecurityGroupRuleForCreate securityGroupRuleForCreate = new SecurityGroupRuleForCreate( - parentSecurityGroupId, sourceGroupId,ipProtocol, fromPort, toPort - ); - return new CreateRule(securityGroupRuleForCreate); - } - public DeleteRule deleteSecurityGroupRule(String id) { - return new DeleteRule(id); - } - public DeleteRule deleteSecurityGroupRule(Integer id) { - return new DeleteRule(String.valueOf(id)); - } + + private final OpenStackClient CLIENT; + + public SecurityGroupsExtension(OpenStackClient client) { + CLIENT = client; + } + + public class List extends OpenStackRequest<SecurityGroups> { + + public List() { + super(CLIENT, HttpMethod.GET, "/os-security-groups", null, SecurityGroups.class); + } + + } + + public class Create extends OpenStackRequest<SecurityGroup> { + + private SecurityGroupForCreate securityGroupForCreate; + + public Create(SecurityGroupForCreate securityGroupForCreate) { + super(CLIENT, HttpMethod.POST, "/os-security-groups", Entity.json(securityGroupForCreate), SecurityGroup.class); + this.securityGroupForCreate = securityGroupForCreate; + } + + } + + public class Show extends OpenStackRequest<SecurityGroup> { + + /** + * @deprecated + * @param id + */ + @Deprecated + public Show(Integer id) { + super(CLIENT, HttpMethod.GET, new StringBuilder("/os-security-groups/").append(id).toString(), null, SecurityGroup.class); + } + public Show(String id) { + super(CLIENT, HttpMethod.GET, new StringBuilder("/os-security-groups/").append(id).toString(), null, SecurityGroup.class); + } + + } + + public class Delete extends OpenStackRequest<Void> { + + /** + * + * @param id + * @deprecated + */ + @Deprecated + public Delete(Integer id) { + super(CLIENT, HttpMethod.DELETE, new StringBuilder("/os-security-groups/").append(String.valueOf(id)).toString(), null, Void.class); + } + public Delete(String id) { + super(CLIENT, HttpMethod.DELETE, new StringBuilder("/os-security-groups/").append(id).toString(), null, Void.class); + } + + } + + public class CreateRule extends OpenStackRequest<SecurityGroup.Rule> { + + private SecurityGroupRuleForCreate securityGroupRuleForCreate; + + public CreateRule(SecurityGroupRuleForCreate securityGroupRuleForCreate) { + super(CLIENT, HttpMethod.POST, "/os-security-group-rules", Entity.json(securityGroupRuleForCreate), SecurityGroup.Rule.class); + this.securityGroupRuleForCreate = securityGroupRuleForCreate; + } + } + + public class DeleteRule extends OpenStackRequest<Void> { + + /** + * + * @param id + * @deprecated + */ + @Deprecated + public DeleteRule(Integer id) { + super(CLIENT, HttpMethod.DELETE, new StringBuilder("/os-security-group-rules/").append(String.valueOf(id)).toString(), null, Void.class); + } + + public DeleteRule(String id) { + super(CLIENT, HttpMethod.DELETE, new StringBuilder("/os-security-group-rules/").append(String.valueOf(id)).toString(), null, Void.class); + } + } + + public List listSecurityGroups() { + return new List(); + } + + public Create createSecurityGroup(String name, + String description) { + return new Create(new SecurityGroupForCreate(name, description)); + } + + public Create createSecurityGroup(String name) { + return createSecurityGroup(name, null); + } + + public Show showSecurityGroup(Integer id) { + return new Show(String.valueOf(id)); + } + + public Show showSecurityGroup(String id) { + return new Show(id); + } + public Delete deleteSecurityGroup(Integer id) { + return new Delete(String.valueOf(id)); + } + + public Delete deleteSecurityGroup(String id) { + return new Delete(id); + } + + /** + * + * @param parentSecurityGroupId + * @param ipProtocol + * @param fromPort + * @param toPort + * @param cidr + * @return + * @deprecated Use {@link #createSecurityGroupRule(String, String, Integer, Integer, String)} + */ + @Deprecated + public CreateRule createSecurityGroupRule( + Integer parentSecurityGroupId, String ipProtocol, Integer fromPort, + Integer toPort, String cidr) { + SecurityGroupRuleForCreate securityGroupRuleForCreate = new SecurityGroupRuleForCreate( + parentSecurityGroupId, ipProtocol, fromPort, toPort, cidr); + return new CreateRule(securityGroupRuleForCreate); + } + /** + * + * @param parentSecurityGroupId + * @param ipProtocol + * @param fromPort + * @param toPort + * @param cidr + * @return + * @deprecated Use {@link #createSecurityGroupRule(String, String, String, Integer, Integer)} + */ + @Deprecated + public CreateRule createSecurityGroupRule( + Integer parentSecurityGroupId, String ipProtocol, Integer fromPort, + Integer toPort, Integer sourceGroupId) { + SecurityGroupRuleForCreate securityGroupRuleForCreate = new SecurityGroupRuleForCreate( + parentSecurityGroupId, ipProtocol, fromPort, toPort, + sourceGroupId); + return new CreateRule(securityGroupRuleForCreate); + } + + public CreateRule createSecurityGroupRule( + String parentSecurityGroupId, String ipProtocol, Integer fromPort, + Integer toPort, String cidr) { + SecurityGroupRuleForCreate securityGroupRuleForCreate = new SecurityGroupRuleForCreate( + parentSecurityGroupId, ipProtocol, fromPort, toPort, cidr); + return new CreateRule(securityGroupRuleForCreate); + } + + public CreateRule createSecurityGroupRule( + String parentSecurityGroupId,String sourceGroupId,String ipProtocol, Integer fromPort, + Integer toPort) { + SecurityGroupRuleForCreate securityGroupRuleForCreate = new SecurityGroupRuleForCreate( + parentSecurityGroupId, sourceGroupId,ipProtocol, fromPort, toPort + ); + return new CreateRule(securityGroupRuleForCreate); + } + public DeleteRule deleteSecurityGroupRule(String id) { + return new DeleteRule(id); + } + public DeleteRule deleteSecurityGroupRule(Integer id) { + return new DeleteRule(String.valueOf(id)); + } } diff --git a/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/SnapshotsExtension.java b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/SnapshotsExtension.java index 765e4aa..1afba7e 100644 --- a/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/SnapshotsExtension.java +++ b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/SnapshotsExtension.java @@ -27,76 +27,76 @@ import com.woorea.openstack.nova.model.SnapshotForCreate; import com.woorea.openstack.nova.model.Snapshots; public class SnapshotsExtension { - - private final OpenStackClient CLIENT; - - public SnapshotsExtension(OpenStackClient client) { - CLIENT = client; - } - - public List list(boolean detail) { - return new List(detail); - } - - public Create create(SnapshotForCreate snapshotForCreate) { - return new Create(snapshotForCreate); - } - - public Show show(String id) { - return new Show(id); - } - - public ShowMetadata showMetadata(String id) { - return new ShowMetadata(id); - } + + private final OpenStackClient CLIENT; + + public SnapshotsExtension(OpenStackClient client) { + CLIENT = client; + } + + public List list(boolean detail) { + return new List(detail); + } + + public Create create(SnapshotForCreate snapshotForCreate) { + return new Create(snapshotForCreate); + } + + public Show show(String id) { + return new Show(id); + } + + public ShowMetadata showMetadata(String id) { + return new ShowMetadata(id); + } - - public Delete delete(String id) { - return new Delete(id); - } + + public Delete delete(String id) { + return new Delete(id); + } - public class List extends OpenStackRequest<Snapshots> { - - public List(boolean detail) { - super(CLIENT, HttpMethod.GET, detail ? "/os-snapshots/detail" : "/os-snapshots", null, Snapshots.class); - } + public class List extends OpenStackRequest<Snapshots> { + + public List(boolean detail) { + super(CLIENT, HttpMethod.GET, detail ? "/os-snapshots/detail" : "/os-snapshots", null, Snapshots.class); + } - } - - public class Create extends OpenStackRequest<SnapshotForCreate> { + } + + public class Create extends OpenStackRequest<SnapshotForCreate> { - private SnapshotForCreate snapshotForCreate; - - public Create(SnapshotForCreate snapshotForCreate) { - super(CLIENT, HttpMethod.POST, "/os-snapshots", Entity.json(snapshotForCreate), SnapshotForCreate.class); - this.snapshotForCreate = snapshotForCreate; - } - - } - - public class Show extends OpenStackRequest<Snapshot> { - - public Show(String id) { - super(CLIENT, HttpMethod.GET, new StringBuilder("/os-snapshots/").append(id).toString(), null, Snapshot.class); - } + private SnapshotForCreate snapshotForCreate; + + public Create(SnapshotForCreate snapshotForCreate) { + super(CLIENT, HttpMethod.POST, "/os-snapshots", Entity.json(snapshotForCreate), SnapshotForCreate.class); + this.snapshotForCreate = snapshotForCreate; + } + + } + + public class Show extends OpenStackRequest<Snapshot> { + + public Show(String id) { + super(CLIENT, HttpMethod.GET, new StringBuilder("/os-snapshots/").append(id).toString(), null, Snapshot.class); + } - } - - public class ShowMetadata extends OpenStackRequest<Metadata> { - - public ShowMetadata(String id) { - super(CLIENT, HttpMethod.GET, new StringBuilder("/os-snapshots/").append(id).append("/metadata").toString(), null, Metadata.class); - } + } + + public class ShowMetadata extends OpenStackRequest<Metadata> { + + public ShowMetadata(String id) { + super(CLIENT, HttpMethod.GET, new StringBuilder("/os-snapshots/").append(id).append("/metadata").toString(), null, Metadata.class); + } - } - - public class Delete extends OpenStackRequest<Void> { - - public Delete(String id) { - super(CLIENT, HttpMethod.DELETE, new StringBuilder("/os-snapshots/").append(id).toString(), null, Void.class); - } - - } - + } + + public class Delete extends OpenStackRequest<Void> { + + public Delete(String id) { + super(CLIENT, HttpMethod.DELETE, new StringBuilder("/os-snapshots/").append(id).toString(), null, Void.class); + } + + } + } diff --git a/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/VolumesExtension.java b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/VolumesExtension.java index b2a4303..b46983f 100644 --- a/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/VolumesExtension.java +++ b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/VolumesExtension.java @@ -28,95 +28,95 @@ import com.woorea.openstack.nova.model.Volumes; public class VolumesExtension { - private final OpenStackClient CLIENT; + private final OpenStackClient CLIENT; - public VolumesExtension(OpenStackClient client) { - CLIENT = client; - } + public VolumesExtension(OpenStackClient client) { + CLIENT = client; + } - public List list(boolean detail) { - return new List(detail); - } + public List list(boolean detail) { + return new List(detail); + } - public Create create(VolumeForCreate volume) { - return new Create(volume); - } + public Create create(VolumeForCreate volume) { + return new Create(volume); + } - public UploadToImage uploadToImage(VolumeForImageCreate volumeForImage) { - return new UploadToImage(volumeForImage); - } + public UploadToImage uploadToImage(VolumeForImageCreate volumeForImage) { + return new UploadToImage(volumeForImage); + } - public Show show(String id) { - return new Show(id); - } + public Show show(String id) { + return new Show(id); + } - public ShowMetadata showMetadata(String id) { - return new ShowMetadata(id); - } + public ShowMetadata showMetadata(String id) { + return new ShowMetadata(id); + } - public Delete delete(String id) { - return new Delete(id); - } + public Delete delete(String id) { + return new Delete(id); + } - public class List extends OpenStackRequest<Volumes> { + public class List extends OpenStackRequest<Volumes> { - public List(boolean detail) { - super(CLIENT, HttpMethod.GET, detail ? "/os-volumes/detail" - : "/os-volumes", null, Volumes.class); - } + public List(boolean detail) { + super(CLIENT, HttpMethod.GET, detail ? "/os-volumes/detail" + : "/os-volumes", null, Volumes.class); + } - } + } - public class Create extends OpenStackRequest<Volume> { + public class Create extends OpenStackRequest<Volume> { - // private Volume volume; + // private Volume volume; - public Create(VolumeForCreate volume) { - super(CLIENT, HttpMethod.POST, "/os-volumes", Entity.json(volume), - Volume.class); - // this.volume = volume; - } + public Create(VolumeForCreate volume) { + super(CLIENT, HttpMethod.POST, "/os-volumes", Entity.json(volume), + Volume.class); + // this.volume = volume; + } - } + } - // Upload volume to image service as image + // Upload volume to image service as image - public class UploadToImage extends OpenStackRequest<Void> { + public class UploadToImage extends OpenStackRequest<Void> { - public UploadToImage(VolumeForImageCreate volumeForImageCreate) { - super(CLIENT, HttpMethod.POST, new StringBuilder("/volumes/") - .append(volumeForImageCreate.getVolumeId() + "/action"), - Entity.json(volumeForImageCreate), Void.class); - } + public UploadToImage(VolumeForImageCreate volumeForImageCreate) { + super(CLIENT, HttpMethod.POST, new StringBuilder("/volumes/") + .append(volumeForImageCreate.getVolumeId() + "/action"), + Entity.json(volumeForImageCreate), Void.class); + } - } + } - public class Show extends OpenStackRequest<Volume> { + public class Show extends OpenStackRequest<Volume> { - public Show(String id) { - super(CLIENT, HttpMethod.GET, new StringBuilder("/os-volumes/") - .append(id).toString(), null, Volume.class); - } + public Show(String id) { + super(CLIENT, HttpMethod.GET, new StringBuilder("/os-volumes/") + .append(id).toString(), null, Volume.class); + } - } + } - public class ShowMetadata extends OpenStackRequest<Metadata> { + public class ShowMetadata extends OpenStackRequest<Metadata> { - public ShowMetadata(String id) { - super(CLIENT, HttpMethod.GET, new StringBuilder("/os-volumes/") - .append(id).append("/metadata").toString(), null, - Metadata.class); - } + public ShowMetadata(String id) { + super(CLIENT, HttpMethod.GET, new StringBuilder("/os-volumes/") + .append(id).append("/metadata").toString(), null, + Metadata.class); + } - } + } - public class Delete extends OpenStackRequest<Void> { + public class Delete extends OpenStackRequest<Void> { - public Delete(String id) { - super(CLIENT, HttpMethod.DELETE, new StringBuilder("/os-volumes/") - .append(id).toString(), null, Void.class); - } + public Delete(String id) { + super(CLIENT, HttpMethod.DELETE, new StringBuilder("/os-volumes/") + .append(id).toString(), null, Void.class); + } - } + } } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Certificate.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Certificate.java index 1e2558d..31811f5 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/Certificate.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Certificate.java @@ -22,31 +22,31 @@ import org.codehaus.jackson.map.annotate.JsonRootName; @JsonRootName("certificate") public class Certificate { - private String data; - - @JsonProperty("private_key") - private String privateKey; + private String data; + + @JsonProperty("private_key") + private String privateKey; - /** - * @return the data - */ - public String getData() { - return data; - } + /** + * @return the data + */ + public String getData() { + return data; + } - /** - * @return the privateKey - */ - public String getPrivateKey() { - return privateKey; - } + /** + * @return the privateKey + */ + public String getPrivateKey() { + return privateKey; + } - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Certificate [data=" + data + ", privateKey=" + privateKey + "]"; - } - + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Certificate [data=" + data + ", privateKey=" + privateKey + "]"; + } + } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Cloudpipe.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Cloudpipe.java index 8d77d39..dc0f21d 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/Cloudpipe.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Cloudpipe.java @@ -23,128 +23,128 @@ import org.codehaus.jackson.map.annotate.JsonRootName; @JsonRootName("cloudpipe") public class Cloudpipe implements Serializable { - - private String projectId; - - private String internalIp; - - private String publicIp; - - private String publicPort; - - private String state; - - private String instanceId; - - private Calendar createdAt; - - /** - * @return the projectId - */ - public String getProjectId() { - return projectId; - } - - /** - * @param projectId the projectId to set - */ - public void setProjectId(String projectId) { - this.projectId = projectId; - } - - /** - * @return the internalIp - */ - public String getInternalIp() { - return internalIp; - } - - /** - * @param internalIp the internalIp to set - */ - public void setInternalIp(String internalIp) { - this.internalIp = internalIp; - } - - /** - * @return the publicIp - */ - public String getPublicIp() { - return publicIp; - } - - /** - * @param publicIp the publicIp to set - */ - public void setPublicIp(String publicIp) { - this.publicIp = publicIp; - } - - /** - * @return the publicPort - */ - public String getPublicPort() { - return publicPort; - } - - /** - * @param publicPort the publicPort to set - */ - public void setPublicPort(String publicPort) { - this.publicPort = publicPort; - } - - /** - * @return the state - */ - public String getState() { - return state; - } - - /** - * @param state the state to set - */ - public void setState(String state) { - this.state = state; - } - - /** - * @return the instanceId - */ - public String getInstanceId() { - return instanceId; - } - - /** - * @param instanceId the instanceId to set - */ - public void setInstanceId(String instanceId) { - this.instanceId = instanceId; - } - - /** - * @return the createdAt - */ - public Calendar getCreatedAt() { - return createdAt; - } - - /** - * @param createdAt the createdAt to set - */ - public void setCreatedAt(Calendar createdAt) { - this.createdAt = createdAt; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "CloudPipe [projectId=" + projectId + ", internalIp=" - + internalIp + ", publicIp=" + publicIp + ", publicPort=" - + publicPort + ", state=" + state + ", instanceId=" - + instanceId + ", createdAt=" + createdAt + "]"; - } - + + private String projectId; + + private String internalIp; + + private String publicIp; + + private String publicPort; + + private String state; + + private String instanceId; + + private Calendar createdAt; + + /** + * @return the projectId + */ + public String getProjectId() { + return projectId; + } + + /** + * @param projectId the projectId to set + */ + public void setProjectId(String projectId) { + this.projectId = projectId; + } + + /** + * @return the internalIp + */ + public String getInternalIp() { + return internalIp; + } + + /** + * @param internalIp the internalIp to set + */ + public void setInternalIp(String internalIp) { + this.internalIp = internalIp; + } + + /** + * @return the publicIp + */ + public String getPublicIp() { + return publicIp; + } + + /** + * @param publicIp the publicIp to set + */ + public void setPublicIp(String publicIp) { + this.publicIp = publicIp; + } + + /** + * @return the publicPort + */ + public String getPublicPort() { + return publicPort; + } + + /** + * @param publicPort the publicPort to set + */ + public void setPublicPort(String publicPort) { + this.publicPort = publicPort; + } + + /** + * @return the state + */ + public String getState() { + return state; + } + + /** + * @param state the state to set + */ + public void setState(String state) { + this.state = state; + } + + /** + * @return the instanceId + */ + public String getInstanceId() { + return instanceId; + } + + /** + * @param instanceId the instanceId to set + */ + public void setInstanceId(String instanceId) { + this.instanceId = instanceId; + } + + /** + * @return the createdAt + */ + public Calendar getCreatedAt() { + return createdAt; + } + + /** + * @param createdAt the createdAt to set + */ + public void setCreatedAt(Calendar createdAt) { + this.createdAt = createdAt; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "CloudPipe [projectId=" + projectId + ", internalIp=" + + internalIp + ", publicIp=" + publicIp + ", publicPort=" + + publicPort + ", state=" + state + ", instanceId=" + + instanceId + ", createdAt=" + createdAt + "]"; + } + } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Cloudpipes.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Cloudpipes.java index 4436361..a9920d6 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/Cloudpipes.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Cloudpipes.java @@ -23,22 +23,22 @@ import org.codehaus.jackson.annotate.JsonProperty; public class Cloudpipes implements Serializable { - @JsonProperty("cloudpipes") - private List<Cloudpipe> list; + @JsonProperty("cloudpipes") + private List<Cloudpipe> list; - /** - * @return the list - */ - public List<Cloudpipe> getList() { - return list; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Flavors [list=" + list + "]"; - } - + /** + * @return the list + */ + public List<Cloudpipe> getList() { + return list; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Flavors [list=" + list + "]"; + } + } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Extension.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Extension.java index 320ad3e..bdf37c2 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/Extension.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Extension.java @@ -25,67 +25,67 @@ import org.codehaus.jackson.map.annotate.JsonRootName; @JsonRootName("extension") public class Extension implements Serializable { - private String alias; - - private String description; - - private String name; - - private String namespace; - - private Calendar updated; - - private List<Link> links; + private String alias; + + private String description; + + private String name; + + private String namespace; + + private Calendar updated; + + private List<Link> links; - /** - * @return the alias - */ - public String getAlias() { - return alias; - } + /** + * @return the alias + */ + public String getAlias() { + return alias; + } - /** - * @return the description - */ - public String getDescription() { - return description; - } + /** + * @return the description + */ + public String getDescription() { + return description; + } - /** - * @return the name - */ - public String getName() { - return name; - } + /** + * @return the name + */ + public String getName() { + return name; + } - /** - * @return the namespace - */ - public String getNamespace() { - return namespace; - } + /** + * @return the namespace + */ + public String getNamespace() { + return namespace; + } - /** - * @return the updated - */ - public Calendar getUpdated() { - return updated; - } + /** + * @return the updated + */ + public Calendar getUpdated() { + return updated; + } - /** - * @return the links - */ - public List<Link> getLinks() { - return links; - } + /** + * @return the links + */ + public List<Link> getLinks() { + return links; + } - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Extension [alias=" + alias + ", description=" + description - + ", name=" + name + ", namespace=" + namespace + "]"; - } - + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Extension [alias=" + alias + ", description=" + description + + ", name=" + name + ", namespace=" + namespace + "]"; + } + } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Extensions.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Extensions.java index 232b424..0ecb493 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/Extensions.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Extensions.java @@ -24,27 +24,27 @@ import org.codehaus.jackson.annotate.JsonProperty; public class Extensions implements Iterable<Extension>, Serializable { - @JsonProperty("extensions") - private List<Extension> list; + @JsonProperty("extensions") + private List<Extension> list; - /** - * @return the list - */ - public List<Extension> getList() { - return list; - } - - @Override - public Iterator<Extension> iterator() { - return list.iterator(); - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Extensions [list=" + list + "]"; - } + /** + * @return the list + */ + public List<Extension> getList() { + return list; + } + + @Override + public Iterator<Extension> iterator() { + return list.iterator(); + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Extensions [list=" + list + "]"; + } } 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 6db8da1..817c50f 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 @@ -25,231 +25,231 @@ 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<Link> 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<Link> getLinks() { - return links; - } - - /** - * @param links the links to set - */ - public void setLinks(List<Link> 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 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<Link> 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<Link> getLinks() { + return links; + } + + /** + * @param links the links to set + */ + public void setLinks(List<Link> 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 + "]"; + } + } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/FlavorForCreate.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/FlavorForCreate.java index 8d632a4..481e3bf 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/FlavorForCreate.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/FlavorForCreate.java @@ -24,135 +24,135 @@ import org.codehaus.jackson.map.annotate.JsonRootName; @JsonRootName("flavor") public class FlavorForCreate 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; - - /** - * @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; - } - + + 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; + + /** + * @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; + } + } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Flavors.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Flavors.java index 5720340..0bc4ae8 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/Flavors.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Flavors.java @@ -24,27 +24,27 @@ import org.codehaus.jackson.annotate.JsonProperty; public class Flavors implements Iterable<Flavor>, Serializable { - @JsonProperty("flavors") - private List<Flavor> list; + @JsonProperty("flavors") + private List<Flavor> list; - /** - * @return the list - */ - public List<Flavor> getList() { - return list; - } - - @Override - public Iterator<Flavor> iterator() { - return list.iterator(); - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Flavors [list=" + list + "]"; - } + /** + * @return the list + */ + public List<Flavor> getList() { + return list; + } + + @Override + public Iterator<Flavor> iterator() { + return list.iterator(); + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Flavors [list=" + list + "]"; + } } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/FloatingIp.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/FloatingIp.java index f92ec2a..b38e78e 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/FloatingIp.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/FloatingIp.java @@ -24,60 +24,60 @@ import org.codehaus.jackson.map.annotate.JsonRootName; @JsonRootName("floating_ip") public class FloatingIp implements Serializable { - private String id; - - private String pool; - - private String ip; - - @JsonProperty("fixed_ip") - private String fixedIp; - - @JsonProperty("instance_id") - private String instanceId; + private String id; + + private String pool; + + private String ip; + + @JsonProperty("fixed_ip") + private String fixedIp; + + @JsonProperty("instance_id") + private String instanceId; - /** - * @return the id - */ - public String getId() { - return id; - } + /** + * @return the id + */ + public String getId() { + return id; + } - /** - * @return the pool - */ - public String getPool() { - return pool; - } + /** + * @return the pool + */ + public String getPool() { + return pool; + } - /** - * @return the ip - */ - public String getIp() { - return ip; - } + /** + * @return the ip + */ + public String getIp() { + return ip; + } - /** - * @return the fixedIp - */ - public String getFixedIp() { - return fixedIp; - } + /** + * @return the fixedIp + */ + public String getFixedIp() { + return fixedIp; + } - /** - * @return the instanceId - */ - public String getInstanceId() { - return instanceId; - } + /** + * @return the instanceId + */ + public String getInstanceId() { + return instanceId; + } - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "FloatingIp [id=" + id + ", pool=" + pool + ", ip=" + ip - + ", fixedIp=" + fixedIp + ", instanceId=" + instanceId + "]"; - } - + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "FloatingIp [id=" + id + ", pool=" + pool + ", ip=" + ip + + ", fixedIp=" + fixedIp + ", instanceId=" + instanceId + "]"; + } + } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/FloatingIpDomain.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/FloatingIpDomain.java index 1aa0b79..2a5eb75 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/FloatingIpDomain.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/FloatingIpDomain.java @@ -24,51 +24,51 @@ import org.codehaus.jackson.map.annotate.JsonRootName; @JsonRootName("floating-ip-pool") public class FloatingIpDomain implements Serializable { - private String domain; - - private String scope; - - private String project; - - @JsonProperty("availabilityZone") - private String availabilityZone; + private String domain; + + private String scope; + + private String project; + + @JsonProperty("availabilityZone") + private String availabilityZone; - /** - * @return the domain - */ - public String getDomain() { - return domain; - } + /** + * @return the domain + */ + public String getDomain() { + return domain; + } - /** - * @return the scope - */ - public String getScope() { - return scope; - } + /** + * @return the scope + */ + public String getScope() { + return scope; + } - /** - * @return the project - */ - public String getProject() { - return project; - } + /** + * @return the project + */ + public String getProject() { + return project; + } - /** - * @return the availabilityZone - */ - public String getAvailabilityZone() { - return availabilityZone; - } + /** + * @return the availabilityZone + */ + public String getAvailabilityZone() { + return availabilityZone; + } - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "FloatingIpDomain [domain=" + domain + ", scope=" + scope - + ", project=" + project + ", availabilityZone=" - + availabilityZone + "]"; - } - + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "FloatingIpDomain [domain=" + domain + ", scope=" + scope + + ", project=" + project + ", availabilityZone=" + + availabilityZone + "]"; + } + } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/FloatingIpDomains.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/FloatingIpDomains.java index 3b452d6..bf849f3 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/FloatingIpDomains.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/FloatingIpDomains.java @@ -24,27 +24,27 @@ import org.codehaus.jackson.annotate.JsonProperty; public class FloatingIpDomains implements Iterable<FloatingIpDomain>, Serializable { - @JsonProperty("domain_entries") - private List<FloatingIpDomain> list; - - /** - * @return the list - */ - public List<FloatingIpDomain> getList() { - return list; - } - - @Override - public Iterator<FloatingIpDomain> iterator() { - return list.iterator(); - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "FloatingIpDomains [list=" + list + "]"; - } - + @JsonProperty("domain_entries") + private List<FloatingIpDomain> list; + + /** + * @return the list + */ + public List<FloatingIpDomain> getList() { + return list; + } + + @Override + public Iterator<FloatingIpDomain> iterator() { + return list.iterator(); + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "FloatingIpDomains [list=" + list + "]"; + } + } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/FloatingIpPools.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/FloatingIpPools.java index a6341ec..b3196b6 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/FloatingIpPools.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/FloatingIpPools.java @@ -25,49 +25,49 @@ import org.codehaus.jackson.annotate.JsonProperty; import com.woorea.openstack.nova.model.FloatingIpPools.FloatingIpPool; public class FloatingIpPools implements Iterable<FloatingIpPool>, Serializable { - - public static class FloatingIpPool implements Serializable { + + public static class FloatingIpPool implements Serializable { - private String name; + private String name; - /** - * @return the name - */ - public String getName() { - return name; - } + /** + * @return the name + */ + public String getName() { + return name; + } - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "FloatingIpPool [name=" + name + "]"; - } - - } + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "FloatingIpPool [name=" + name + "]"; + } + + } - @JsonProperty("floating_ip_pools") - private List<FloatingIpPool> list; + @JsonProperty("floating_ip_pools") + private List<FloatingIpPool> list; - /** - * @return the list - */ - public List<FloatingIpPool> getList() { - return list; - } - - @Override - public Iterator<FloatingIpPool> iterator() { - return list.iterator(); - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "FloatingIpPools [list=" + list + "]"; - } + /** + * @return the list + */ + public List<FloatingIpPool> getList() { + return list; + } + + @Override + public Iterator<FloatingIpPool> iterator() { + return list.iterator(); + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "FloatingIpPools [list=" + list + "]"; + } } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/FloatingIps.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/FloatingIps.java index 995f9d9..5c05794 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/FloatingIps.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/FloatingIps.java @@ -24,27 +24,27 @@ import org.codehaus.jackson.annotate.JsonProperty; public class FloatingIps implements Iterable<FloatingIp>, Serializable { - @JsonProperty("floating_ips") - private List<FloatingIp> list; + @JsonProperty("floating_ips") + private List<FloatingIp> list; - /** - * @return the list - */ - public List<FloatingIp> getList() { - return list; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "FloatingIps [list=" + list + "]"; - } + /** + * @return the list + */ + public List<FloatingIp> getList() { + return list; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "FloatingIps [list=" + list + "]"; + } - @Override - public Iterator<FloatingIp> iterator() { - return list.iterator(); - } - + @Override + public Iterator<FloatingIp> iterator() { + return list.iterator(); + } + } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Host.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Host.java index dd3c620..f193e2d 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/Host.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Host.java @@ -22,104 +22,104 @@ import java.util.List; import org.codehaus.jackson.annotate.JsonProperty; public class Host implements Serializable { - - public static final class ResourceWrapper implements Serializable { - - public static final class Resource implements Serializable { - - private String project; - - @JsonProperty("memory_mb") - private Integer memoryMb; - - private String host; - - private Integer cpu; - - @JsonProperty("disk_gb") - private Integer diskGb; + + public static final class ResourceWrapper implements Serializable { + + public static final class Resource implements Serializable { + + private String project; + + @JsonProperty("memory_mb") + private Integer memoryMb; + + private String host; + + private Integer cpu; + + @JsonProperty("disk_gb") + private Integer diskGb; - /** - * @return the project - */ - public String getProject() { - return project; - } + /** + * @return the project + */ + public String getProject() { + return project; + } - /** - * @return the memoryMb - */ - public Integer getMemoryMb() { - return memoryMb; - } + /** + * @return the memoryMb + */ + public Integer getMemoryMb() { + return memoryMb; + } - /** - * @return the host - */ - public String getHost() { - return host; - } + /** + * @return the host + */ + public String getHost() { + return host; + } - /** - * @return the cpu - */ - public Integer getCpu() { - return cpu; - } + /** + * @return the cpu + */ + public Integer getCpu() { + return cpu; + } - /** - * @return the diskGb - */ - public Integer getDiskGb() { - return diskGb; - } + /** + * @return the diskGb + */ + public Integer getDiskGb() { + return diskGb; + } - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Resource [project=" + project + ", memoryMb=" - + memoryMb + ", host=" + host + ", cpu=" + cpu - + ", diskGb=" + diskGb + "]"; - } - - } - - private Resource resource; + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Resource [project=" + project + ", memoryMb=" + + memoryMb + ", host=" + host + ", cpu=" + cpu + + ", diskGb=" + diskGb + "]"; + } + + } + + private Resource resource; - /** - * @return the resource - */ - public Resource getResource() { - return resource; - } + /** + * @return the resource + */ + public Resource getResource() { + return resource; + } - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "ResourceWrapper [resource=" + resource + "]"; - } - - } + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "ResourceWrapper [resource=" + resource + "]"; + } + + } - private List<ResourceWrapper> host; + private List<ResourceWrapper> host; - /** - * @return the host - */ - public List<ResourceWrapper> getHost() { - return host; - } + /** + * @return the host + */ + public List<ResourceWrapper> getHost() { + return host; + } - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Host [host=" + host + "]"; - } - + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Host [host=" + host + "]"; + } + } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/HostAggregate.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/HostAggregate.java index 8273688..4ba26e7 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/HostAggregate.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/HostAggregate.java @@ -25,102 +25,102 @@ import org.codehaus.jackson.map.annotate.JsonRootName; @JsonRootName("aggregate") public class HostAggregate implements Serializable { - - private String id; + + private String id; - private String name; - - @JsonProperty("availability_zone") - private String availabilityZone; - - @JsonProperty("created_at") - private String createdAt; - - @JsonProperty("updated_at") - private String updatedAt; - - @JsonProperty("deleted_at") - private String deletedAt; - - private Boolean deleted; - - private List<String> hosts; - - private Map<String, String> metadata; + private String name; + + @JsonProperty("availability_zone") + private String availabilityZone; + + @JsonProperty("created_at") + private String createdAt; + + @JsonProperty("updated_at") + private String updatedAt; + + @JsonProperty("deleted_at") + private String deletedAt; + + private Boolean deleted; + + private List<String> hosts; + + private Map<String, String> metadata; - /** - * @return the id - */ - public String getId() { - return id; - } + /** + * @return the id + */ + public String getId() { + return id; + } - /** - * @return the name - */ - public String getName() { - return name; - } + /** + * @return the name + */ + public String getName() { + return name; + } - /** - * @return the availabilityZone - */ - public String getAvailabilityZone() { - return availabilityZone; - } + /** + * @return the availabilityZone + */ + public String getAvailabilityZone() { + return availabilityZone; + } - /** - * @return the createdAt - */ - public String getCreatedAt() { - return createdAt; - } + /** + * @return the createdAt + */ + public String getCreatedAt() { + return createdAt; + } - /** - * @return the updatedAt - */ - public String getUpdatedAt() { - return updatedAt; - } + /** + * @return the updatedAt + */ + public String getUpdatedAt() { + return updatedAt; + } - /** - * @return the deletedAt - */ - public String getDeletedAt() { - return deletedAt; - } + /** + * @return the deletedAt + */ + public String getDeletedAt() { + return deletedAt; + } - /** - * @return the deleted - */ - public Boolean getDeleted() { - return deleted; - } + /** + * @return the deleted + */ + public Boolean getDeleted() { + return deleted; + } - /** - * @return the hosts - */ - public List<String> getHosts() { - return hosts; - } + /** + * @return the hosts + */ + public List<String> getHosts() { + return hosts; + } - /** - * @return the metadata - */ - public Map<String, String> getMetadata() { - return metadata; - } + /** + * @return the metadata + */ + public Map<String, String> getMetadata() { + return metadata; + } - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "HostAggregate [id=" + id + ", name=" + name - + ", availabilityZone=" + availabilityZone + ", createdAt=" - + createdAt + ", updatedAt=" + updatedAt + ", deletedAt=" - + deletedAt + ", deleted=" + deleted + ", hosts=" + hosts - + ", metadata=" + metadata + "]"; - } - + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "HostAggregate [id=" + id + ", name=" + name + + ", availabilityZone=" + availabilityZone + ", createdAt=" + + createdAt + ", updatedAt=" + updatedAt + ", deletedAt=" + + deletedAt + ", deleted=" + deleted + ", hosts=" + hosts + + ", metadata=" + metadata + "]"; + } + } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/HostAggregates.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/HostAggregates.java index 04355ff..56da094 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/HostAggregates.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/HostAggregates.java @@ -24,27 +24,27 @@ import org.codehaus.jackson.annotate.JsonProperty; public class HostAggregates implements Iterable<HostAggregate>, Serializable { - @JsonProperty("aggregates") - private List<HostAggregate> list; + @JsonProperty("aggregates") + private List<HostAggregate> list; - /** - * @return the list - */ - public List<HostAggregate> getList() { - return list; - } - - @Override - public Iterator<HostAggregate> iterator() { - return list.iterator(); - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "HostAggregates [list=" + list + "]"; - } + /** + * @return the list + */ + public List<HostAggregate> getList() { + return list; + } + + @Override + public Iterator<HostAggregate> iterator() { + return list.iterator(); + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "HostAggregates [list=" + list + "]"; + } } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Hosts.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Hosts.java index e119eae..b97a7ae 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/Hosts.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Hosts.java @@ -23,71 +23,71 @@ import java.util.List; import org.codehaus.jackson.annotate.JsonProperty; public class Hosts implements Iterable<Hosts.Host>, Serializable { - - public static final class Host { - - private String zone; - - @JsonProperty("host_name") - private String hostName; - - private String service; + + public static final class Host { + + private String zone; + + @JsonProperty("host_name") + private String hostName; + + private String service; - /** - * @return the hostName - */ - public String getHostName() { - return hostName; - } + /** + * @return the hostName + */ + public String getHostName() { + return hostName; + } - /** - * @return the service - */ - public String getService() { - return service; - } - - public String getZone() { - return zone; - } + /** + * @return the service + */ + public String getService() { + return service; + } + + public String getZone() { + return zone; + } - public void setZone(String zone) { - this.zone = zone; - } + public void setZone(String zone) { + this.zone = zone; + } - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Host [hostName=" + hostName + ", service=" + service + "]"; - } - - } + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Host [hostName=" + hostName + ", service=" + service + "]"; + } + + } - @JsonProperty("hosts") - private List<Host> list; + @JsonProperty("hosts") + private List<Host> list; - /** - * @return the list - */ - public List<Host> getList() { - return list; - } - - @Override - public Iterator<Hosts.Host> iterator() { - return list.iterator(); - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Hosts [list=" + list + "]"; - } + /** + * @return the list + */ + public List<Host> getList() { + return list; + } + + @Override + public Iterator<Hosts.Host> iterator() { + return list.iterator(); + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Hosts [list=" + list + "]"; + } - - + + } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Image.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Image.java index af62019..2a03f6f 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/Image.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Image.java @@ -26,223 +26,223 @@ import org.codehaus.jackson.map.annotate.JsonRootName; @JsonRootName("image") public class Image implements Serializable { - - public static final class Server implements Serializable { - - private String id; - - private List<Link> links; - - /** - * @return the id - */ - public String getId() { - return id; - } - - /** - * @return the links - */ - public List<Link> getLinks() { - return links; - } - - @Override - public String toString() { - return "Server [id=" + id + ", links=" + links + "]"; - } - - } - - private String id; - - private String status; - - private String name; - - private Integer progress; - - private Integer minRam; - - private Integer minDisk; - - private Calendar created; - - private Calendar updated; - - @JsonProperty("OS-EXT-IMG-SIZE:size") - private Long size; - - private Map<String, String> metadata; - - private Server server; - - private List<Link> links; - - /** - * @return the id - */ - public String getId() { - return id; - } - - /** - * @param id the id to set - */ - public void setId(String id) { - this.id = id; - } - - /** - * @return the status - */ - public String getStatus() { - return status; - } - - /** - * @param status the status to set - */ - public void setStatus(String status) { - this.status = status; - } - - /** - * @return the name - */ - public String getName() { - return name; - } - - /** - * @param name the name to set - */ - public void setName(String name) { - this.name = name; - } - - /** - * @return the progress - */ - public Integer getProgress() { - return progress; - } - - /** - * @param progress the progress to set - */ - public void setProgress(Integer progress) { - this.progress = progress; - } - - /** - * @return the minRam - */ - public Integer getMinRam() { - return minRam; - } - - /** - * @param minRam the minRam to set - */ - public void setMinRam(Integer minRam) { - this.minRam = minRam; - } - - /** - * @return the minDisk - */ - public Integer getMinDisk() { - return minDisk; - } - - /** - * @param minDisk the minDisk to set - */ - public void setMinDisk(Integer minDisk) { - this.minDisk = minDisk; - } - - /** - * @return the created - */ - public Calendar getCreated() { - return created; - } - - /** - * @param created the created to set - */ - public void setCreated(Calendar created) { - this.created = created; - } - - /** - * @return the updated - */ - public Calendar getUpdated() { - return updated; - } - - /** - * @param updated the updated to set - */ - public void setUpdated(Calendar updated) { - this.updated = updated; - } - - /** - * @return the metadata - */ - public Map<String, String> getMetadata() { - return metadata; - } - - /** - * @return the size - */ - public Long getSize() { - return size; - } - - /** - * @param metadata the metadata to set - */ - public void setMetadata(Map<String, String> metadata) { - this.metadata = metadata; - } - - /** - * @return the server - */ - public Server getServer() { - return server; - } - - /** - * @return the links - */ - public List<Link> getLinks() { - return links; - } - - /** - * @param links the links to set - */ - public void setLinks(List<Link> links) { - this.links = links; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Image [id=" + id + ", status=" + status + ", name=" + name - + ", progress=" + progress + ", minRam=" + minRam - + ", minDisk=" + minDisk + ", created=" + (created != null ? created.getTime() : null) - + ", updated=" + (updated != null ? updated.getTime() : null) + ", size=" + size + ", metadata=" - + metadata + ", server="+server+", links=" + links + "]"; - } - + + public static final class Server implements Serializable { + + private String id; + + private List<Link> links; + + /** + * @return the id + */ + public String getId() { + return id; + } + + /** + * @return the links + */ + public List<Link> getLinks() { + return links; + } + + @Override + public String toString() { + return "Server [id=" + id + ", links=" + links + "]"; + } + + } + + private String id; + + private String status; + + private String name; + + private Integer progress; + + private Integer minRam; + + private Integer minDisk; + + private Calendar created; + + private Calendar updated; + + @JsonProperty("OS-EXT-IMG-SIZE:size") + private Long size; + + private Map<String, String> metadata; + + private Server server; + + private List<Link> links; + + /** + * @return the id + */ + public String getId() { + return id; + } + + /** + * @param id the id to set + */ + public void setId(String id) { + this.id = id; + } + + /** + * @return the status + */ + public String getStatus() { + return status; + } + + /** + * @param status the status to set + */ + public void setStatus(String status) { + this.status = status; + } + + /** + * @return the name + */ + public String getName() { + return name; + } + + /** + * @param name the name to set + */ + public void setName(String name) { + this.name = name; + } + + /** + * @return the progress + */ + public Integer getProgress() { + return progress; + } + + /** + * @param progress the progress to set + */ + public void setProgress(Integer progress) { + this.progress = progress; + } + + /** + * @return the minRam + */ + public Integer getMinRam() { + return minRam; + } + + /** + * @param minRam the minRam to set + */ + public void setMinRam(Integer minRam) { + this.minRam = minRam; + } + + /** + * @return the minDisk + */ + public Integer getMinDisk() { + return minDisk; + } + + /** + * @param minDisk the minDisk to set + */ + public void setMinDisk(Integer minDisk) { + this.minDisk = minDisk; + } + + /** + * @return the created + */ + public Calendar getCreated() { + return created; + } + + /** + * @param created the created to set + */ + public void setCreated(Calendar created) { + this.created = created; + } + + /** + * @return the updated + */ + public Calendar getUpdated() { + return updated; + } + + /** + * @param updated the updated to set + */ + public void setUpdated(Calendar updated) { + this.updated = updated; + } + + /** + * @return the metadata + */ + public Map<String, String> getMetadata() { + return metadata; + } + + /** + * @return the size + */ + public Long getSize() { + return size; + } + + /** + * @param metadata the metadata to set + */ + public void setMetadata(Map<String, String> metadata) { + this.metadata = metadata; + } + + /** + * @return the server + */ + public Server getServer() { + return server; + } + + /** + * @return the links + */ + public List<Link> getLinks() { + return links; + } + + /** + * @param links the links to set + */ + public void setLinks(List<Link> links) { + this.links = links; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Image [id=" + id + ", status=" + status + ", name=" + name + + ", progress=" + progress + ", minRam=" + minRam + + ", minDisk=" + minDisk + ", created=" + (created != null ? created.getTime() : null) + + ", updated=" + (updated != null ? updated.getTime() : null) + ", size=" + size + ", metadata=" + + metadata + ", server="+server+", links=" + links + "]"; + } + } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/ImageFromVolume.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/ImageFromVolume.java index e8d634a..1e34a43 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/ImageFromVolume.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/ImageFromVolume.java @@ -24,105 +24,105 @@ import org.codehaus.jackson.map.annotate.JsonRootName; @JsonRootName("os-volume_upload_image") public class ImageFromVolume implements Serializable { - @JsonProperty("id") - String id; - @JsonProperty("updates_at") - String updates_at; - @JsonProperty("status") - String status; - @JsonProperty("display_description") - String display_description; - @JsonProperty("size") - String size; - @JsonProperty("volume_type") - String volume_type; - @JsonProperty("image_id") - String image_id; - @JsonProperty("container_format") - String container_format; - @JsonProperty("disk_format") - String disk_format; - @JsonProperty("image_name") - String image_name; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getUpdates_at() { - return updates_at; - } - - public void setUpdates_at(String updates_at) { - this.updates_at = updates_at; - } - - public String getStatus() { - return status; - } - - public void setStatus(String status) { - this.status = status; - } - - public String getDisplay_description() { - return display_description; - } - - public void setDisplay_description(String display_description) { - this.display_description = display_description; - } - - public String getSize() { - return size; - } - - public void setSize(String size) { - this.size = size; - } - - public String getVolume_type() { - return volume_type; - } - - public void setVolume_type(String volume_type) { - this.volume_type = volume_type; - } - - public String getImage_id() { - return image_id; - } - - public void setImage_id(String image_id) { - this.image_id = image_id; - } - - public String getContainer_format() { - return container_format; - } - - public void setContainer_format(String container_format) { - this.container_format = container_format; - } - - public String getDisk_format() { - return disk_format; - } - - public void setDisk_format(String disk_format) { - this.disk_format = disk_format; - } - - public String getImage_name() { - return image_name; - } - - public void setImage_name(String image_name) { - this.image_name = image_name; - } + @JsonProperty("id") + String id; + @JsonProperty("updates_at") + String updates_at; + @JsonProperty("status") + String status; + @JsonProperty("display_description") + String display_description; + @JsonProperty("size") + String size; + @JsonProperty("volume_type") + String volume_type; + @JsonProperty("image_id") + String image_id; + @JsonProperty("container_format") + String container_format; + @JsonProperty("disk_format") + String disk_format; + @JsonProperty("image_name") + String image_name; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getUpdates_at() { + return updates_at; + } + + public void setUpdates_at(String updates_at) { + this.updates_at = updates_at; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getDisplay_description() { + return display_description; + } + + public void setDisplay_description(String display_description) { + this.display_description = display_description; + } + + public String getSize() { + return size; + } + + public void setSize(String size) { + this.size = size; + } + + public String getVolume_type() { + return volume_type; + } + + public void setVolume_type(String volume_type) { + this.volume_type = volume_type; + } + + public String getImage_id() { + return image_id; + } + + public void setImage_id(String image_id) { + this.image_id = image_id; + } + + public String getContainer_format() { + return container_format; + } + + public void setContainer_format(String container_format) { + this.container_format = container_format; + } + + public String getDisk_format() { + return disk_format; + } + + public void setDisk_format(String disk_format) { + this.disk_format = disk_format; + } + + public String getImage_name() { + return image_name; + } + + public void setImage_name(String image_name) { + this.image_name = image_name; + } } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Images.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Images.java index c4baaba..e19892d 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/Images.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Images.java @@ -24,28 +24,28 @@ import org.codehaus.jackson.annotate.JsonProperty; public class Images implements Iterable<Image>, Serializable { - @JsonProperty("images") - private List<Image> list; + @JsonProperty("images") + private List<Image> list; - /** - * @return the list - */ - public List<Image> getList() { - return list; - } - - @Override - public Iterator<Image> iterator() { - return list.iterator(); - } - - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Images [list=" + list + "]"; - } + /** + * @return the list + */ + public List<Image> getList() { + return list; + } + + @Override + public Iterator<Image> iterator() { + return list.iterator(); + } + + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Images [list=" + list + "]"; + } } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/KeyPair.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/KeyPair.java index 1db2ee4..b7bd148 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/KeyPair.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/KeyPair.java @@ -24,91 +24,91 @@ import org.codehaus.jackson.map.annotate.JsonRootName; @JsonRootName("keypair") public class KeyPair implements Serializable { - private String name; - - @JsonProperty("user_id") - private String userId; - - @JsonProperty("public_key") - private String publicKey; - - @JsonProperty("private_key") - private String privateKey; - - private String fingerprint; + private String name; + + @JsonProperty("user_id") + private String userId; + + @JsonProperty("public_key") + private String publicKey; + + @JsonProperty("private_key") + private String privateKey; + + private String fingerprint; - public KeyPair() { - super(); - } - - public KeyPair(String name) { - this.name = name; - } - - public KeyPair(String name, String publicKey) { - this(name); - this.publicKey = publicKey; - } + public KeyPair() { + super(); + } + + public KeyPair(String name) { + this.name = name; + } + + public KeyPair(String name, String publicKey) { + this(name); + this.publicKey = publicKey; + } - /** - * @return the name - */ - public String getName() { - return name; - } + /** + * @return the name + */ + public String getName() { + return name; + } - /** - * @param name the name to set - */ - public void setName(String name) { - this.name = name; - } + /** + * @param name the name to set + */ + public void setName(String name) { + this.name = name; + } - /** - * @return the userId - */ - public String getUserId() { - return userId; - } + /** + * @return the userId + */ + public String getUserId() { + return userId; + } - /** - * @return the publicKey - */ - public String getPublicKey() { - return publicKey; - } + /** + * @return the publicKey + */ + public String getPublicKey() { + return publicKey; + } - /** - * @param publicKey the publicKey to set - */ - public void setPublicKey(String publicKey) { - this.publicKey = publicKey; - } + /** + * @param publicKey the publicKey to set + */ + public void setPublicKey(String publicKey) { + this.publicKey = publicKey; + } - /** - * @return the privateKey - */ - public String getPrivateKey() { - return privateKey; - } + /** + * @return the privateKey + */ + public String getPrivateKey() { + return privateKey; + } - /** - * @return the fingerprint - */ - public String getFingerprint() { - return fingerprint; - } + /** + * @return the fingerprint + */ + public String getFingerprint() { + return fingerprint; + } - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "KeyPair [name=" + name + ", userId=" + userId + ", publicKey=" - + publicKey + ", privateKey=" + privateKey + ", fingerprint=" - + fingerprint + "]"; - } + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "KeyPair [name=" + name + ", userId=" + userId + ", publicKey=" + + publicKey + ", privateKey=" + privateKey + ", fingerprint=" + + fingerprint + "]"; + } - - + + } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/KeyPairs.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/KeyPairs.java index db24f8d..b36a91e 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/KeyPairs.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/KeyPairs.java @@ -24,39 +24,39 @@ import java.util.List; import org.codehaus.jackson.annotate.JsonProperty; public class KeyPairs implements Iterable<KeyPair>, Serializable { - - public static final class KeyPairWrapper implements Serializable { - - @JsonProperty - private KeyPair keypair; - - } + + public static final class KeyPairWrapper implements Serializable { + + @JsonProperty + private KeyPair keypair; + + } - @JsonProperty("keypairs") - private List<KeyPairWrapper> list; + @JsonProperty("keypairs") + private List<KeyPairWrapper> list; - /** - * @return the list - */ - public List<KeyPair> getList() { - List<KeyPair> keyPairList = new ArrayList<>(); - for(KeyPairWrapper wrapper : this.list) { - keyPairList.add(wrapper.keypair); - } - return keyPairList; - } - - @Override - public Iterator<KeyPair> iterator() { - return getList().iterator(); - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "KeyPairs [list=" + getList() + "]"; - } + /** + * @return the list + */ + public List<KeyPair> getList() { + List<KeyPair> keyPairList = new ArrayList<>(); + for(KeyPairWrapper wrapper : this.list) { + keyPairList.add(wrapper.keypair); + } + return keyPairList; + } + + @Override + public Iterator<KeyPair> iterator() { + return getList().iterator(); + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "KeyPairs [list=" + getList() + "]"; + } } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Limits.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Limits.java index 7a80b1e..d9a949e 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/Limits.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Limits.java @@ -26,385 +26,385 @@ import org.codehaus.jackson.map.annotate.JsonRootName; @JsonRootName("limits") public class Limits implements Serializable { - public static final class RateLimit implements Serializable { - - public static final class LimitEntry implements Serializable { - - @JsonProperty("next-available") - private Calendar nextAvailable; - - private String unit; - - private String verb; - - private Integer remaining; - - private Integer available; - - private Integer value; - - /** - * @return the nextAvailable - */ - public Calendar getNextAvailable() { - return nextAvailable; - } - - /** - * @return the unit - */ - public String getUnit() { - return unit; - } - - /** - * @return the verb - */ - public String getVerb() { - return verb; - } - - /** - * @return the remaining - */ - public Integer getRemaining() { - return remaining; - } - - /** - * @return the available - */ - public Integer getAvailable() { - return available; - } - - /** - * @return the value - */ - public Integer getValue() { - return value; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "LimitEntry [nextAvailable=" + nextAvailable + ", unit=" - + unit + ", verb=" + verb + ", remaining=" + remaining - + ", available=" + available + ", value=" + value + "]"; - } - - } - - private String regex; - - private String uri; - - private List<LimitEntry> limit; - - /** - * @return the regex - */ - public String getRegex() { - return regex; - } - - /** - * @return the uri - */ - public String getUri() { - return uri; - } - - /** - * @return the limit - */ - public List<LimitEntry> getLimit() { - return limit; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "RateLimit [regex=" + regex + ", uri=" + uri + ", limit=" - + limit + "]"; - } - - } - - public static final class AbsoluteLimit { - - private Integer maxServerMeta; - private Integer serverMetaUsed; - - private Integer maxPersonality; - private Integer personalityUsed; - - private Integer maxImageMeta; - private Integer imageMetaUsed; - - private Integer maxPersonalitySize; - private Integer personalitySizeUsed; - - private Integer maxTotalCores; - private Integer totalCoresUsed; - - private Integer maxTotalInstances; - private Integer totalInstancesUsed; - - private Integer maxTotalRAMSize; - private Integer totalRAMUsed; - - private Integer maxSecurityGroupRules; - private Integer securityGroupRulesUsed; - - private Integer maxTotalKeypairs; - private Integer totalKeyPairsUsed; - - private Integer maxTotalVolumes; - private Integer totalVolumesUsed; - - private Integer maxSecurityGroups; - private Integer totalSecurityGroupsUsed; - - private Integer maxTotalFloatingIps; - private Integer totalFloatingIpsUsed; - - private Integer maxTotalVolumeGigabytes; - private Integer totalVolumeGigabytesUsed; - - /** - * @return the maxServerMeta - */ - public Integer getMaxServerMeta() { - return maxServerMeta; - } - - /** - * @return the maxPersonality - */ - public Integer getMaxPersonality() { - return maxPersonality; - } - - /** - * @return the maxImageMeta - */ - public Integer getMaxImageMeta() { - return maxImageMeta; - } - - /** - * @return the maxPersonalitySize - */ - public Integer getMaxPersonalitySize() { - return maxPersonalitySize; - } - - /** - * @return the maxTotalCores - */ - public Integer getMaxTotalCores() { - return maxTotalCores; - } - - /** - * @return the maxTotalInstances - */ - public Integer getMaxTotalInstances() { - return maxTotalInstances; - } - - /** - * @return the maxTotalRAMSize - */ - public Integer getMaxTotalRAMSize() { - return maxTotalRAMSize; - } - - /** - * @return the totalVolumesUsed - */ - public Integer getTotalVolumesUsed() { - return totalVolumesUsed; - } - - /** - * @return the maxSecurityGroupRules - */ - public Integer getMaxSecurityGroupRules() { - return maxSecurityGroupRules; - } - - /** - * @return the maxTotalKeypairs - */ - public Integer getMaxTotalKeypairs() { - return maxTotalKeypairs; - } - - /** - * @return the totalCoresUsed - */ - public Integer getTotalCoresUsed() { - return totalCoresUsed; - } - - /** - * @return the maxTotalVolumes - */ - public Integer getMaxTotalVolumes() { - return maxTotalVolumes; - } - - /** - * @return the totalRAMUsed - */ - public Integer getTotalRAMUsed() { - return totalRAMUsed; - } - - /** - * @return the totalInstancesUsed - */ - public Integer getTotalInstancesUsed() { - return totalInstancesUsed; - } - - /** - * @return the maxSecurityGroups - */ - public Integer getMaxSecurityGroups() { - return maxSecurityGroups; - } - - /** - * @return the totalVolumeGigabytesUsed - */ - public Integer getTotalVolumeGigabytesUsed() { - return totalVolumeGigabytesUsed; - } - - /** - * @return the totalSecurityGroupsUsed - */ - public Integer getTotalSecurityGroupsUsed() { - return totalSecurityGroupsUsed; - } - - /** - * @return the maxTotalFloatingIps - */ - public Integer getMaxTotalFloatingIps() { - return maxTotalFloatingIps; - } - - /** - * @return the totalKeyPairsUsed - */ - public Integer getTotalKeyPairsUsed() { - return totalKeyPairsUsed; - } - - /** - * @return the maxTotalVolumeGigabytes - */ - public Integer getMaxTotalVolumeGigabytes() { - return maxTotalVolumeGigabytes; - } - - /** - * @return the serverMetaUsed - */ - public Integer getServerMetaUsed() { - return serverMetaUsed; - } - - /** - * @return the personalityUsed - */ - public Integer getPersonalityUsed() { - return personalityUsed; - } - - /** - * @return the imageMetaUsed - */ - public Integer getImageMetaUsed() { - return imageMetaUsed; - } - - /** - * @return the personalitySizeUsed - */ - public Integer getPersonalitySizeUsed() { - return personalitySizeUsed; - } - - /** - * @return the securityGroupRulesUsed - */ - public Integer getSecurityGroupRulesUsed() { - return securityGroupRulesUsed; - } - - /** - * @return the totalFloatingIpsUsed - */ - public Integer getTotalFloatingIpsUsed() { - return totalFloatingIpsUsed; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "AbsoluteLimit [maxServerMeta=" + maxServerMeta - + ", maxPersonality=" + maxPersonality + ", maxImageMeta=" - + maxImageMeta + ", maxPersonalitySize=" - + maxPersonalitySize + ", maxTotalCores=" + maxTotalCores - + ", maxTotalInstances=" + maxTotalInstances - + ", maxTotalRAMSize=" + maxTotalRAMSize + "]"; - } - - } - - private List<RateLimit> rate; - - private AbsoluteLimit absolute; - - /** - * @return the rate - */ - public List<RateLimit> getRate() { - return rate; - } - - /** - * @return the absolute - */ - public AbsoluteLimit getAbsolute() { - return absolute; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Limits [rate=" + rate + ", absolute=" + absolute + "]"; - } + public static final class RateLimit implements Serializable { + + public static final class LimitEntry implements Serializable { + + @JsonProperty("next-available") + private Calendar nextAvailable; + + private String unit; + + private String verb; + + private Integer remaining; + + private Integer available; + + private Integer value; + + /** + * @return the nextAvailable + */ + public Calendar getNextAvailable() { + return nextAvailable; + } + + /** + * @return the unit + */ + public String getUnit() { + return unit; + } + + /** + * @return the verb + */ + public String getVerb() { + return verb; + } + + /** + * @return the remaining + */ + public Integer getRemaining() { + return remaining; + } + + /** + * @return the available + */ + public Integer getAvailable() { + return available; + } + + /** + * @return the value + */ + public Integer getValue() { + return value; + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "LimitEntry [nextAvailable=" + nextAvailable + ", unit=" + + unit + ", verb=" + verb + ", remaining=" + remaining + + ", available=" + available + ", value=" + value + "]"; + } + + } + + private String regex; + + private String uri; + + private List<LimitEntry> limit; + + /** + * @return the regex + */ + public String getRegex() { + return regex; + } + + /** + * @return the uri + */ + public String getUri() { + return uri; + } + + /** + * @return the limit + */ + public List<LimitEntry> getLimit() { + return limit; + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "RateLimit [regex=" + regex + ", uri=" + uri + ", limit=" + + limit + "]"; + } + + } + + public static final class AbsoluteLimit { + + private Integer maxServerMeta; + private Integer serverMetaUsed; + + private Integer maxPersonality; + private Integer personalityUsed; + + private Integer maxImageMeta; + private Integer imageMetaUsed; + + private Integer maxPersonalitySize; + private Integer personalitySizeUsed; + + private Integer maxTotalCores; + private Integer totalCoresUsed; + + private Integer maxTotalInstances; + private Integer totalInstancesUsed; + + private Integer maxTotalRAMSize; + private Integer totalRAMUsed; + + private Integer maxSecurityGroupRules; + private Integer securityGroupRulesUsed; + + private Integer maxTotalKeypairs; + private Integer totalKeyPairsUsed; + + private Integer maxTotalVolumes; + private Integer totalVolumesUsed; + + private Integer maxSecurityGroups; + private Integer totalSecurityGroupsUsed; + + private Integer maxTotalFloatingIps; + private Integer totalFloatingIpsUsed; + + private Integer maxTotalVolumeGigabytes; + private Integer totalVolumeGigabytesUsed; + + /** + * @return the maxServerMeta + */ + public Integer getMaxServerMeta() { + return maxServerMeta; + } + + /** + * @return the maxPersonality + */ + public Integer getMaxPersonality() { + return maxPersonality; + } + + /** + * @return the maxImageMeta + */ + public Integer getMaxImageMeta() { + return maxImageMeta; + } + + /** + * @return the maxPersonalitySize + */ + public Integer getMaxPersonalitySize() { + return maxPersonalitySize; + } + + /** + * @return the maxTotalCores + */ + public Integer getMaxTotalCores() { + return maxTotalCores; + } + + /** + * @return the maxTotalInstances + */ + public Integer getMaxTotalInstances() { + return maxTotalInstances; + } + + /** + * @return the maxTotalRAMSize + */ + public Integer getMaxTotalRAMSize() { + return maxTotalRAMSize; + } + + /** + * @return the totalVolumesUsed + */ + public Integer getTotalVolumesUsed() { + return totalVolumesUsed; + } + + /** + * @return the maxSecurityGroupRules + */ + public Integer getMaxSecurityGroupRules() { + return maxSecurityGroupRules; + } + + /** + * @return the maxTotalKeypairs + */ + public Integer getMaxTotalKeypairs() { + return maxTotalKeypairs; + } + + /** + * @return the totalCoresUsed + */ + public Integer getTotalCoresUsed() { + return totalCoresUsed; + } + + /** + * @return the maxTotalVolumes + */ + public Integer getMaxTotalVolumes() { + return maxTotalVolumes; + } + + /** + * @return the totalRAMUsed + */ + public Integer getTotalRAMUsed() { + return totalRAMUsed; + } + + /** + * @return the totalInstancesUsed + */ + public Integer getTotalInstancesUsed() { + return totalInstancesUsed; + } + + /** + * @return the maxSecurityGroups + */ + public Integer getMaxSecurityGroups() { + return maxSecurityGroups; + } + + /** + * @return the totalVolumeGigabytesUsed + */ + public Integer getTotalVolumeGigabytesUsed() { + return totalVolumeGigabytesUsed; + } + + /** + * @return the totalSecurityGroupsUsed + */ + public Integer getTotalSecurityGroupsUsed() { + return totalSecurityGroupsUsed; + } + + /** + * @return the maxTotalFloatingIps + */ + public Integer getMaxTotalFloatingIps() { + return maxTotalFloatingIps; + } + + /** + * @return the totalKeyPairsUsed + */ + public Integer getTotalKeyPairsUsed() { + return totalKeyPairsUsed; + } + + /** + * @return the maxTotalVolumeGigabytes + */ + public Integer getMaxTotalVolumeGigabytes() { + return maxTotalVolumeGigabytes; + } + + /** + * @return the serverMetaUsed + */ + public Integer getServerMetaUsed() { + return serverMetaUsed; + } + + /** + * @return the personalityUsed + */ + public Integer getPersonalityUsed() { + return personalityUsed; + } + + /** + * @return the imageMetaUsed + */ + public Integer getImageMetaUsed() { + return imageMetaUsed; + } + + /** + * @return the personalitySizeUsed + */ + public Integer getPersonalitySizeUsed() { + return personalitySizeUsed; + } + + /** + * @return the securityGroupRulesUsed + */ + public Integer getSecurityGroupRulesUsed() { + return securityGroupRulesUsed; + } + + /** + * @return the totalFloatingIpsUsed + */ + public Integer getTotalFloatingIpsUsed() { + return totalFloatingIpsUsed; + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "AbsoluteLimit [maxServerMeta=" + maxServerMeta + + ", maxPersonality=" + maxPersonality + ", maxImageMeta=" + + maxImageMeta + ", maxPersonalitySize=" + + maxPersonalitySize + ", maxTotalCores=" + maxTotalCores + + ", maxTotalInstances=" + maxTotalInstances + + ", maxTotalRAMSize=" + maxTotalRAMSize + "]"; + } + + } + + private List<RateLimit> rate; + + private AbsoluteLimit absolute; + + /** + * @return the rate + */ + public List<RateLimit> getRate() { + return rate; + } + + /** + * @return the absolute + */ + public AbsoluteLimit getAbsolute() { + return absolute; + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Limits [rate=" + rate + ", absolute=" + absolute + "]"; + } } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Link.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Link.java index 9591ab6..129896c 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/Link.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Link.java @@ -20,39 +20,39 @@ import java.io.Serializable; public class Link implements Serializable { - private String rel; - - private String href; - - private String type; - - /** - * @return the rel - */ - public String getRel() { - return rel; - } - - /** - * @return the href - */ - public String getHref() { - return href; - } - - /** - * @return the type - */ - public String getType() { - return type; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Link [rel=" + rel + ", href=" + href + ", type=" + type + "]"; - } - + private String rel; + + private String href; + + private String type; + + /** + * @return the rel + */ + public String getRel() { + return rel; + } + + /** + * @return the href + */ + public String getHref() { + return href; + } + + /** + * @return the type + */ + public String getType() { + return type; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Link [rel=" + rel + ", href=" + href + ", type=" + type + "]"; + } + } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Metadata.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Metadata.java index b2e5507..d254e18 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/Metadata.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Metadata.java @@ -20,23 +20,23 @@ import java.util.Map; public class Metadata { - private Map<String, String> metadata; + private Map<String, String> metadata; - /** - * @return the metadata - */ - public Map<String, String> getMetadata() { - return metadata; - } + /** + * @return the metadata + */ + public Map<String, String> getMetadata() { + return metadata; + } - /** - * Set the metadata - * @param metadata - */ - public void setMetadata(Map<String, String> metadata) { - this.metadata = metadata; - } - + /** + * Set the metadata + * @param metadata + */ + public void setMetadata(Map<String, String> metadata) { + this.metadata = metadata; + } + - + } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Network.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Network.java index 2dfb2c2..2b8ac85 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/Network.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Network.java @@ -24,283 +24,283 @@ import org.codehaus.jackson.map.annotate.JsonRootName; @JsonRootName("network") public class Network implements Serializable { - private String id; - - @JsonProperty("vpn_public_address") - private String vpnPublicAddress; - - @JsonProperty("vpn_private_address") - private String vpnPrivateAddress; - - @JsonProperty("vpn_public_port") - private String vpnPublicPort; - - @JsonProperty("dhcp_start") - private String dhcpStart; - - private String bridge; - - @JsonProperty("bridge_interface") - private String bridgeInterface; - - @JsonProperty("updated_at") - private String updatedAt; - - private Boolean deleted; - - private String vlan; - - private String broadcast; - - private String netmask; - - private Boolean injected; - - private String host; - - @JsonProperty("multi_host") - private Boolean multiHost; - - @JsonProperty("created_at") - private String createdAt; - - @JsonProperty("deleted_at") - private String deletedAt; - - private String cidr; - - @JsonProperty("cidr_v6") - private String cidrV6; - - private String gateway; - - @JsonProperty("gateway_v6") - private String gatewayV6; - - @JsonProperty("netmask_v6") - private String netmaskV6; - - @JsonProperty("project_id") - private String projectId; - - @JsonProperty("rxtx_base") - private String rxtxBase; - - private String dns1; - - private String dns2; - - private String label; - - private String priority; - - /** - * @return the id - */ - public String getId() { - return id; - } - - /** - * @return the vpnPublicAddress - */ - public String getVpnPublicAddress() { - return vpnPublicAddress; - } - - /** - * @return the vpnPublicPort - */ - public String getVpnPublicPort() { - return vpnPublicPort; - } - - /** - * @return the dhcpStart - */ - public String getDhcpStart() { - return dhcpStart; - } - - /** - * @return the bridge - */ - public String getBridge() { - return bridge; - } - - /** - * @return the bridgeInterface - */ - public String getBridgeInterface() { - return bridgeInterface; - } - - /** - * @return the updatedAt - */ - public String getUpdatedAt() { - return updatedAt; - } - - /** - * @return the deleted - */ - public Boolean getDeleted() { - return deleted; - } - - /** - * @return the vlan - */ - public String getVlan() { - return vlan; - } - - /** - * @return the broadcast - */ - public String getBroadcast() { - return broadcast; - } - - /** - * @return the netmask - */ - public String getNetmask() { - return netmask; - } - - /** - * @return the injected - */ - public Boolean getInjected() { - return injected; - } - - /** - * @return the host - */ - public String getHost() { - return host; - } - - /** - * @return the multiHost - */ - public Boolean getMultiHost() { - return multiHost; - } - - /** - * @return the createdAt - */ - public String getCreatedAt() { - return createdAt; - } - - /** - * @return the deletedAt - */ - public String getDeletedAt() { - return deletedAt; - } - - /** - * @return the cidr - */ - public String getCidr() { - return cidr; - } - - /** - * @return the cidrV6 - */ - public String getCidrV6() { - return cidrV6; - } - - /** - * @return the gateway - */ - public String getGateway() { - return gateway; - } - - /** - * @return the gatewayV6 - */ - public String getGatewayV6() { - return gatewayV6; - } - - /** - * @return the netmaskV6 - */ - public String getNetmaskV6() { - return netmaskV6; - } - - /** - * @return the projectId - */ - public String getProjectId() { - return projectId; - } - - /** - * @return the rxtxBase - */ - public String getRxtxBase() { - return rxtxBase; - } - - /** - * @return the dns1 - */ - public String getDns1() { - return dns1; - } - - /** - * @return the dns2 - */ - public String getDns2() { - return dns2; - } - - /** - * @return the label - */ - public String getLabel() { - return label; - } - - /** - * @return the priority - */ - public String getPriority() { - return priority; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Network [id=" + id + ", vpnPublicAddress=" + vpnPublicAddress - + ", vpnPublicPort=" + vpnPublicPort + ", dhcpStart=" - + dhcpStart + ", bridge=" + bridge + ", bridgeInterface=" - + bridgeInterface + ", updatedAt=" + updatedAt + ", deleted=" - + deleted + ", vlan=" + vlan + ", broadcast=" + broadcast - + ", netmask=" + netmask + ", injected=" + injected + ", host=" - + host + ", multiHost=" + multiHost + ", createdAt=" - + createdAt + ", deletedAt=" + deletedAt + ", cidr=" + cidr - + ", cidrV6=" + cidrV6 + ", gateway=" + gateway - + ", gatewayV6=" + gatewayV6 + ", netmaskV6=" + netmaskV6 - + ", projectId=" + projectId + ", rxtxBase=" + rxtxBase - + ", dns1=" + dns1 + ", dns2=" + dns2 + ", label=" + label - + ", priority=" + priority + "]"; - } - + private String id; + + @JsonProperty("vpn_public_address") + private String vpnPublicAddress; + + @JsonProperty("vpn_private_address") + private String vpnPrivateAddress; + + @JsonProperty("vpn_public_port") + private String vpnPublicPort; + + @JsonProperty("dhcp_start") + private String dhcpStart; + + private String bridge; + + @JsonProperty("bridge_interface") + private String bridgeInterface; + + @JsonProperty("updated_at") + private String updatedAt; + + private Boolean deleted; + + private String vlan; + + private String broadcast; + + private String netmask; + + private Boolean injected; + + private String host; + + @JsonProperty("multi_host") + private Boolean multiHost; + + @JsonProperty("created_at") + private String createdAt; + + @JsonProperty("deleted_at") + private String deletedAt; + + private String cidr; + + @JsonProperty("cidr_v6") + private String cidrV6; + + private String gateway; + + @JsonProperty("gateway_v6") + private String gatewayV6; + + @JsonProperty("netmask_v6") + private String netmaskV6; + + @JsonProperty("project_id") + private String projectId; + + @JsonProperty("rxtx_base") + private String rxtxBase; + + private String dns1; + + private String dns2; + + private String label; + + private String priority; + + /** + * @return the id + */ + public String getId() { + return id; + } + + /** + * @return the vpnPublicAddress + */ + public String getVpnPublicAddress() { + return vpnPublicAddress; + } + + /** + * @return the vpnPublicPort + */ + public String getVpnPublicPort() { + return vpnPublicPort; + } + + /** + * @return the dhcpStart + */ + public String getDhcpStart() { + return dhcpStart; + } + + /** + * @return the bridge + */ + public String getBridge() { + return bridge; + } + + /** + * @return the bridgeInterface + */ + public String getBridgeInterface() { + return bridgeInterface; + } + + /** + * @return the updatedAt + */ + public String getUpdatedAt() { + return updatedAt; + } + + /** + * @return the deleted + */ + public Boolean getDeleted() { + return deleted; + } + + /** + * @return the vlan + */ + public String getVlan() { + return vlan; + } + + /** + * @return the broadcast + */ + public String getBroadcast() { + return broadcast; + } + + /** + * @return the netmask + */ + public String getNetmask() { + return netmask; + } + + /** + * @return the injected + */ + public Boolean getInjected() { + return injected; + } + + /** + * @return the host + */ + public String getHost() { + return host; + } + + /** + * @return the multiHost + */ + public Boolean getMultiHost() { + return multiHost; + } + + /** + * @return the createdAt + */ + public String getCreatedAt() { + return createdAt; + } + + /** + * @return the deletedAt + */ + public String getDeletedAt() { + return deletedAt; + } + + /** + * @return the cidr + */ + public String getCidr() { + return cidr; + } + + /** + * @return the cidrV6 + */ + public String getCidrV6() { + return cidrV6; + } + + /** + * @return the gateway + */ + public String getGateway() { + return gateway; + } + + /** + * @return the gatewayV6 + */ + public String getGatewayV6() { + return gatewayV6; + } + + /** + * @return the netmaskV6 + */ + public String getNetmaskV6() { + return netmaskV6; + } + + /** + * @return the projectId + */ + public String getProjectId() { + return projectId; + } + + /** + * @return the rxtxBase + */ + public String getRxtxBase() { + return rxtxBase; + } + + /** + * @return the dns1 + */ + public String getDns1() { + return dns1; + } + + /** + * @return the dns2 + */ + public String getDns2() { + return dns2; + } + + /** + * @return the label + */ + public String getLabel() { + return label; + } + + /** + * @return the priority + */ + public String getPriority() { + return priority; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Network [id=" + id + ", vpnPublicAddress=" + vpnPublicAddress + + ", vpnPublicPort=" + vpnPublicPort + ", dhcpStart=" + + dhcpStart + ", bridge=" + bridge + ", bridgeInterface=" + + bridgeInterface + ", updatedAt=" + updatedAt + ", deleted=" + + deleted + ", vlan=" + vlan + ", broadcast=" + broadcast + + ", netmask=" + netmask + ", injected=" + injected + ", host=" + + host + ", multiHost=" + multiHost + ", createdAt=" + + createdAt + ", deletedAt=" + deletedAt + ", cidr=" + cidr + + ", cidrV6=" + cidrV6 + ", gateway=" + gateway + + ", gatewayV6=" + gatewayV6 + ", netmaskV6=" + netmaskV6 + + ", projectId=" + projectId + ", rxtxBase=" + rxtxBase + + ", dns1=" + dns1 + ", dns2=" + dns2 + ", label=" + label + + ", priority=" + priority + "]"; + } + } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/NetworkForCreate.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/NetworkForCreate.java index 3cc045b..ea9f23e 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/NetworkForCreate.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/NetworkForCreate.java @@ -21,25 +21,25 @@ import org.codehaus.jackson.map.annotate.JsonRootName; public class NetworkForCreate { - @JsonProperty("uuid") - private String id; - @JsonProperty("fixed_ip") - private String fixedIp; - - public String getId() { - return id; - } - - public String getFixedIp() { - return fixedIp; - } - - public void setId(String id) { - this.id = id; - } - - public void setFixedIp(String fixedIp) { - this.fixedIp = fixedIp; - } + @JsonProperty("uuid") + private String id; + @JsonProperty("fixed_ip") + private String fixedIp; + + public String getId() { + return id; + } + + public String getFixedIp() { + return fixedIp; + } + + public void setId(String id) { + this.id = id; + } + + public void setFixedIp(String fixedIp) { + this.fixedIp = fixedIp; + } } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Networks.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Networks.java index 2477e25..7dac2c6 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/Networks.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Networks.java @@ -24,27 +24,27 @@ import org.codehaus.jackson.annotate.JsonProperty; public class Networks implements Iterable<Network>, Serializable { - @JsonProperty("networks") - private List<Network> list; + @JsonProperty("networks") + private List<Network> list; - /** - * @return the list - */ - public List<Network> getList() { - return list; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Servers [list=" + list + "]"; - } + /** + * @return the list + */ + public List<Network> getList() { + return list; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Servers [list=" + list + "]"; + } - @Override - public Iterator<Network> iterator() { - return list.iterator(); - } - + @Override + public Iterator<Network> iterator() { + return list.iterator(); + } + } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/PersonalityFile.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/PersonalityFile.java index f5e58ec..0d619df 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/PersonalityFile.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/PersonalityFile.java @@ -19,37 +19,37 @@ package com.woorea.openstack.nova.model; import java.io.Serializable; public final class PersonalityFile implements Serializable { - - private String path; - - private String contents; + + private String path; + + private String contents; - /** - * @return the path - */ - public String getPath() { - return path; - } + /** + * @return the path + */ + public String getPath() { + return path; + } - /** - * @param path the path to set - */ - public void setPath(String path) { - this.path = path; - } + /** + * @param path the path to set + */ + public void setPath(String path) { + this.path = path; + } - /** - * @return the contents - */ - public String getContents() { - return contents; - } + /** + * @return the contents + */ + public String getContents() { + return contents; + } - /** - * @param contents the contents to set - */ - public void setContents(String contents) { - this.contents = contents; - } - + /** + * @param contents the contents to set + */ + public void setContents(String contents) { + this.contents = contents; + } + } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/QuotaSet.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/QuotaSet.java index 8643667..52bc930 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/QuotaSet.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/QuotaSet.java @@ -22,151 +22,151 @@ import org.codehaus.jackson.map.annotate.JsonRootName; @JsonRootName("quota_set") public class QuotaSet { - private String id; - - @JsonProperty("metadata_items") - private Integer metadataItems; - - @JsonProperty("injected_file_content_bytes") - private Integer injectedFileContentBytes; - - @JsonProperty("injected_files") - private Integer injectedFiles; - - private Integer gigabytes; - - private Integer ram; - - @JsonProperty("floating_ips") - private Integer floatingIps; - - private Integer instances; - - private Integer volumes; - - private Integer cores; - - @JsonProperty("security_groups") - private Integer securityGroups; - - @JsonProperty("security_group_rules") - private Integer securityGroupRules; - - @JsonProperty("injected_file_path_bytes") - private Integer injectedFilePathBytes; - - @JsonProperty("key_pairs") - private Integer keyPairs; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public Integer getMetadataItems() { - return metadataItems; - } - - public void setMetadataItems(Integer metadataItems) { - this.metadataItems = metadataItems; - } - - public Integer getInjectedFileContentBytes() { - return injectedFileContentBytes; - } - - public void setInjectedFileContentBytes(Integer injectedFileContentBytes) { - this.injectedFileContentBytes = injectedFileContentBytes; - } - - public Integer getInjectedFiles() { - return injectedFiles; - } - - public void setInjectedFiles(Integer injectedFiles) { - this.injectedFiles = injectedFiles; - } - - public Integer getGigabytes() { - return gigabytes; - } - - public void setGigabytes(Integer gigabytes) { - this.gigabytes = gigabytes; - } - - public Integer getRam() { - return ram; - } - - public void setRam(Integer ram) { - this.ram = ram; - } - - public Integer getFloatingIps() { - return floatingIps; - } - - public void setFloatingIps(Integer floatingIps) { - this.floatingIps = floatingIps; - } - - public Integer getInstances() { - return instances; - } - - public void setInstances(Integer instances) { - this.instances = instances; - } - - public Integer getVolumes() { - return volumes; - } - - public void setVolumes(Integer volumes) { - this.volumes = volumes; - } - - public Integer getCores() { - return cores; - } - - public void setCores(Integer cores) { - this.cores = cores; - } - - public Integer getSecurityGroups() { - return securityGroups; - } - - public void setSecurityGroups(Integer securityGroups) { - this.securityGroups = securityGroups; - } - - public Integer getSecurityGroupRules() { - return securityGroupRules; - } + private String id; + + @JsonProperty("metadata_items") + private Integer metadataItems; + + @JsonProperty("injected_file_content_bytes") + private Integer injectedFileContentBytes; + + @JsonProperty("injected_files") + private Integer injectedFiles; + + private Integer gigabytes; + + private Integer ram; + + @JsonProperty("floating_ips") + private Integer floatingIps; + + private Integer instances; + + private Integer volumes; + + private Integer cores; + + @JsonProperty("security_groups") + private Integer securityGroups; + + @JsonProperty("security_group_rules") + private Integer securityGroupRules; + + @JsonProperty("injected_file_path_bytes") + private Integer injectedFilePathBytes; + + @JsonProperty("key_pairs") + private Integer keyPairs; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public Integer getMetadataItems() { + return metadataItems; + } + + public void setMetadataItems(Integer metadataItems) { + this.metadataItems = metadataItems; + } + + public Integer getInjectedFileContentBytes() { + return injectedFileContentBytes; + } + + public void setInjectedFileContentBytes(Integer injectedFileContentBytes) { + this.injectedFileContentBytes = injectedFileContentBytes; + } + + public Integer getInjectedFiles() { + return injectedFiles; + } + + public void setInjectedFiles(Integer injectedFiles) { + this.injectedFiles = injectedFiles; + } + + public Integer getGigabytes() { + return gigabytes; + } + + public void setGigabytes(Integer gigabytes) { + this.gigabytes = gigabytes; + } + + public Integer getRam() { + return ram; + } + + public void setRam(Integer ram) { + this.ram = ram; + } + + public Integer getFloatingIps() { + return floatingIps; + } + + public void setFloatingIps(Integer floatingIps) { + this.floatingIps = floatingIps; + } + + public Integer getInstances() { + return instances; + } + + public void setInstances(Integer instances) { + this.instances = instances; + } + + public Integer getVolumes() { + return volumes; + } + + public void setVolumes(Integer volumes) { + this.volumes = volumes; + } + + public Integer getCores() { + return cores; + } + + public void setCores(Integer cores) { + this.cores = cores; + } + + public Integer getSecurityGroups() { + return securityGroups; + } + + public void setSecurityGroups(Integer securityGroups) { + this.securityGroups = securityGroups; + } + + public Integer getSecurityGroupRules() { + return securityGroupRules; + } - public void setSecurityGroupRules(Integer securityGroupRules) { - this.securityGroupRules = securityGroupRules; - } + public void setSecurityGroupRules(Integer securityGroupRules) { + this.securityGroupRules = securityGroupRules; + } - public Integer getKeyPairs() { - return keyPairs; - } + public Integer getKeyPairs() { + return keyPairs; + } - public void setKeyPairs(Integer keyPairs) { - this.keyPairs = keyPairs; - } + public void setKeyPairs(Integer keyPairs) { + this.keyPairs = keyPairs; + } - public Integer getInjectedFilePathBytes() { - return injectedFilePathBytes; - } + public Integer getInjectedFilePathBytes() { + return injectedFilePathBytes; + } - public void setInjectedFilePathBytes(Integer injectedFilePathBytes) { - this.injectedFilePathBytes = injectedFilePathBytes; - } + public void setInjectedFilePathBytes(Integer injectedFilePathBytes) { + this.injectedFilePathBytes = injectedFilePathBytes; + } }
\ No newline at end of file diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/SecurityGroup.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/SecurityGroup.java index b2ab4fa..a57fd69 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/SecurityGroup.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/SecurityGroup.java @@ -24,200 +24,200 @@ import org.codehaus.jackson.map.annotate.JsonRootName; @JsonRootName("security_group") public class SecurityGroup implements Serializable { - - @JsonRootName("security_group_rule") - public static final class Rule implements Serializable { - - public static final class Group implements Serializable { - - private String name; - - @JsonProperty("tenant_id") - private String tenantId; - - public String getName() { - return name; - } - - public String getTenantId() { - return tenantId; - } - - @Override - public String toString() { - return "Group [name=" + name + ", tenantId=" + tenantId + "]"; - } - - } - - public static final class IpRange implements Serializable { - - private String cidr; - - public String getCidr() { - return cidr; - } - - @Override - public String toString() { - return "IpRange [cidr=" + cidr + "]"; - } - - } - - private String id; - - private String name; - - @JsonProperty("parent_group_id") - private String parentGroupId; - - @JsonProperty("from_port") - private Integer fromPort; - - @JsonProperty("to_port") - private Integer toPort; - - @JsonProperty("ip_protocol") - private String ipProtocol; - - @JsonProperty("ip_range") - private IpRange ipRange = new IpRange(); - - private Group group; - - /** - * @return the id - */ - public String getId() { - return id; - } - - /** - * @return the name - */ - public String getName() { - return name; - } - - /** - * @return the parentGroupId - */ - public String getParentGroupId() { - return parentGroupId; - } - - /** - * @return the fromPort - */ - public Integer getFromPort() { - return fromPort; - } - - /** - * @return the toPort - */ - public Integer getToPort() { - return toPort; - } - - /** - * @return the ipProtocol - */ - public String getIpProtocol() { - return ipProtocol; - } - - /** - * @return the ipRange - */ - public IpRange getIpRange() { - return ipRange; - } - - /** - * @return the group - */ - public Group getGroup() { - return group; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Rule [id=" + id + ", name=" + name + ", parentGroupId=" - + parentGroupId + ", fromPort=" + fromPort + ", toPort=" - + toPort + ", ipProtocol=" + ipProtocol + ", ipRange=" - + ipRange + ", group=" + group + "]"; - } - - } - - private String id; - - private String name; - - private String description; - - @JsonProperty("tenant_id") - private String tenantId; - - private List<Rule> rules; - - private List<Link> links; - - /** - * @return the id - */ - public String getId() { - return id; - } - - /** - * @return the name - */ - public String getName() { - return name; - } - - /** - * @return the description - */ - public String getDescription() { - return description; - } - - /** - * @return the tenantId - */ - public String getTenantId() { - return tenantId; - } - - /** - * @return the rules - */ - public List<Rule> getRules() { - return rules; - } - - /** - * @return the links - */ - public List<Link> getLinks() { - return links; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "SecurityGroup [id=" + id + ", name=" + name + ", description=" - + description + ", tenantId=" + tenantId + ", rules=" + rules - + ", links=" + links + "]"; - } - + + @JsonRootName("security_group_rule") + public static final class Rule implements Serializable { + + public static final class Group implements Serializable { + + private String name; + + @JsonProperty("tenant_id") + private String tenantId; + + public String getName() { + return name; + } + + public String getTenantId() { + return tenantId; + } + + @Override + public String toString() { + return "Group [name=" + name + ", tenantId=" + tenantId + "]"; + } + + } + + public static final class IpRange implements Serializable { + + private String cidr; + + public String getCidr() { + return cidr; + } + + @Override + public String toString() { + return "IpRange [cidr=" + cidr + "]"; + } + + } + + private String id; + + private String name; + + @JsonProperty("parent_group_id") + private String parentGroupId; + + @JsonProperty("from_port") + private Integer fromPort; + + @JsonProperty("to_port") + private Integer toPort; + + @JsonProperty("ip_protocol") + private String ipProtocol; + + @JsonProperty("ip_range") + private IpRange ipRange = new IpRange(); + + private Group group; + + /** + * @return the id + */ + public String getId() { + return id; + } + + /** + * @return the name + */ + public String getName() { + return name; + } + + /** + * @return the parentGroupId + */ + public String getParentGroupId() { + return parentGroupId; + } + + /** + * @return the fromPort + */ + public Integer getFromPort() { + return fromPort; + } + + /** + * @return the toPort + */ + public Integer getToPort() { + return toPort; + } + + /** + * @return the ipProtocol + */ + public String getIpProtocol() { + return ipProtocol; + } + + /** + * @return the ipRange + */ + public IpRange getIpRange() { + return ipRange; + } + + /** + * @return the group + */ + public Group getGroup() { + return group; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Rule [id=" + id + ", name=" + name + ", parentGroupId=" + + parentGroupId + ", fromPort=" + fromPort + ", toPort=" + + toPort + ", ipProtocol=" + ipProtocol + ", ipRange=" + + ipRange + ", group=" + group + "]"; + } + + } + + private String id; + + private String name; + + private String description; + + @JsonProperty("tenant_id") + private String tenantId; + + private List<Rule> rules; + + private List<Link> links; + + /** + * @return the id + */ + public String getId() { + return id; + } + + /** + * @return the name + */ + public String getName() { + return name; + } + + /** + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * @return the tenantId + */ + public String getTenantId() { + return tenantId; + } + + /** + * @return the rules + */ + public List<Rule> getRules() { + return rules; + } + + /** + * @return the links + */ + public List<Link> getLinks() { + return links; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "SecurityGroup [id=" + id + ", name=" + name + ", description=" + + description + ", tenantId=" + tenantId + ", rules=" + rules + + ", links=" + links + "]"; + } + } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/SecurityGroupForCreate.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/SecurityGroupForCreate.java index 1c39432..2a40173 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/SecurityGroupForCreate.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/SecurityGroupForCreate.java @@ -22,59 +22,59 @@ import org.codehaus.jackson.map.annotate.JsonRootName; @JsonRootName("security_group") public class SecurityGroupForCreate implements Serializable { - - private String name; - - private String description; + + private String name; + + private String description; - public SecurityGroupForCreate() { - super(); - } - - public SecurityGroupForCreate(String name) { - this.name = name; - } + public SecurityGroupForCreate() { + super(); + } + + public SecurityGroupForCreate(String name) { + this.name = name; + } - public SecurityGroupForCreate(String name, String description) { - this(name); - this.description = description; - } + public SecurityGroupForCreate(String name, String description) { + this(name); + this.description = description; + } - /** - * @return the name - */ - public String getName() { - return name; - } + /** + * @return the name + */ + public String getName() { + return name; + } - /** - * @param name the name to set - */ - public void setName(String name) { - this.name = name; - } + /** + * @param name the name to set + */ + public void setName(String name) { + this.name = name; + } - /** - * @return the description - */ - public String getDescription() { - return description; - } + /** + * @return the description + */ + public String getDescription() { + return description; + } - /** - * @param description the description to set - */ - public void setDescription(String description) { - this.description = description; - } + /** + * @param description the description to set + */ + public void setDescription(String description) { + this.description = description; + } - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "SecurityGroupForCreate [name=" + name + ", description=" - + description + "]"; - } - + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "SecurityGroupForCreate [name=" + name + ", description=" + + description + "]"; + } + } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/SecurityGroupRuleForCreate.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/SecurityGroupRuleForCreate.java index d1a3ec0..fbb3f46 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/SecurityGroupRuleForCreate.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/SecurityGroupRuleForCreate.java @@ -26,191 +26,191 @@ import org.codehaus.jackson.map.annotate.JsonRootName; @JsonRootName("security_group_rule") public class SecurityGroupRuleForCreate implements Serializable { - @JsonProperty("parent_group_id") - private String parentGroupId; - - @JsonProperty("ip_protocol") - private String ipProtocol; - - @JsonProperty("from_port") - private Integer fromPort; - - @JsonProperty("to_port") - private Integer toPort; - - @XmlElement - private String cidr; - - @JsonProperty("group_id") - private String groupId; - - public SecurityGroupRuleForCreate() { - - } - - /** - * - * @param parentSecurityGroupId - * @param ipProtocol - * @param fromPort - * @param toPort - * @param cidr - * @deprecated Ids in some installs have shown to use strings .Use {@link #SecurityGroupRuleForCreate(String, String, Integer, Integer, String)} - */ - @Deprecated - public SecurityGroupRuleForCreate(Integer parentSecurityGroupId, String ipProtocol, Integer fromPort,Integer toPort, String cidr) { - this.parentGroupId = String.valueOf(parentSecurityGroupId); - this.ipProtocol = ipProtocol; - this.fromPort = fromPort; - this.toPort = toPort; - this.cidr = cidr; - } - /** - * - * @param parentSecurityGroupId - * @param ipProtocol - * @param fromPort - * @param toPort - * @param cidr - * @deprecated Ids in some installs have shown to use strings .Use {@link #SecurityGroupRuleForCreate(String, String, String, Integer, Integer)} - */ - @Deprecated - public SecurityGroupRuleForCreate(Integer parentGroupId, String ipProtocol, Integer fromPort,Integer toPort, Integer sourceGroupId) { - this.parentGroupId = String.valueOf(parentGroupId); - this.ipProtocol = ipProtocol; - this.fromPort = fromPort; - this.toPort = toPort; - this.groupId = String.valueOf(sourceGroupId); - } - - public SecurityGroupRuleForCreate(String parentSecurityGroupId, String ipProtocol, Integer fromPort,Integer toPort, String cidr) { - this.parentGroupId = parentSecurityGroupId; - this.ipProtocol = ipProtocol; - this.fromPort = fromPort; - this.toPort = toPort; - this.cidr = cidr; - } - - public SecurityGroupRuleForCreate(String parentGroupId, String sourceGroupId, String ipProtocol, Integer fromPort,Integer toPort) { - this.parentGroupId = parentGroupId; - this.ipProtocol = ipProtocol; - this.fromPort = fromPort; - this.toPort = toPort; - this.groupId = sourceGroupId; - } - - /** - * @return the parentGroupId - */ - public String getParentGroupId() { - return parentGroupId; - } - - - /** - * @param parentGroupId the parentGroupId to set - * @deprecated Use {@link #setParentGroupId(String)} - */ - @Deprecated - public void setParentGroupId(Integer parentGroupId) { - this.parentGroupId = String.valueOf(parentGroupId); - } - - /** - * @param parentGroupId the parentGroupId to set - */ - public void setParentGroupId(String parentGroupId) { - this.parentGroupId = parentGroupId; - } - - /** - * @return the fromPort - */ - public Integer getFromPort() { - return fromPort; - } - - /** - * @param fromPort the fromPort to set - */ - public void setFromPort(Integer fromPort) { - this.fromPort = fromPort; - } - - /** - * @return the toPort - */ - public Integer getToPort() { - return toPort; - } - - /** - * @param toPort the toPort to set - */ - public void setToPort(Integer toPort) { - this.toPort = toPort; - } - - /** - * @return the ipProtocol - */ - public String getIpProtocol() { - return ipProtocol; - } - - /** - * @param ipProtocol the ipProtocol to set - */ - public void setIpProtocol(String ipProtocol) { - this.ipProtocol = ipProtocol; - } - - /** - * @return the cidr - */ - public String getCidr() { - return cidr; - } - - /** - * @param cidr the cidr to set - */ - public void setCidr(String cidr) { - this.cidr = cidr; - } - - /** - * @return the groupId - */ - public String getGroupId() { - return groupId; - } - - /** - * @param groupId the groupId to set - * @deprecated Use {@link #setGroupId(String)} - */ - @Deprecated - public void setGroupId(Integer groupId) { - this.groupId = String.valueOf(groupId); - } - - /** - * @param groupId the groupId to set - */ - public void setGroupId(String groupId) { - this.groupId = groupId; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "SecurityGroupRuleForCreate [parentGroupId=" + parentGroupId - + ", fromPort=" + fromPort + ", toPort=" + toPort - + ", ipProtocol=" + ipProtocol + ", cidr=" + cidr - + ", groupId=" + groupId + "]"; - } + @JsonProperty("parent_group_id") + private String parentGroupId; + + @JsonProperty("ip_protocol") + private String ipProtocol; + + @JsonProperty("from_port") + private Integer fromPort; + + @JsonProperty("to_port") + private Integer toPort; + + @XmlElement + private String cidr; + + @JsonProperty("group_id") + private String groupId; + + public SecurityGroupRuleForCreate() { + + } + + /** + * + * @param parentSecurityGroupId + * @param ipProtocol + * @param fromPort + * @param toPort + * @param cidr + * @deprecated Ids in some installs have shown to use strings .Use {@link #SecurityGroupRuleForCreate(String, String, Integer, Integer, String)} + */ + @Deprecated + public SecurityGroupRuleForCreate(Integer parentSecurityGroupId, String ipProtocol, Integer fromPort,Integer toPort, String cidr) { + this.parentGroupId = String.valueOf(parentSecurityGroupId); + this.ipProtocol = ipProtocol; + this.fromPort = fromPort; + this.toPort = toPort; + this.cidr = cidr; + } + /** + * + * @param parentSecurityGroupId + * @param ipProtocol + * @param fromPort + * @param toPort + * @param cidr + * @deprecated Ids in some installs have shown to use strings .Use {@link #SecurityGroupRuleForCreate(String, String, String, Integer, Integer)} + */ + @Deprecated + public SecurityGroupRuleForCreate(Integer parentGroupId, String ipProtocol, Integer fromPort,Integer toPort, Integer sourceGroupId) { + this.parentGroupId = String.valueOf(parentGroupId); + this.ipProtocol = ipProtocol; + this.fromPort = fromPort; + this.toPort = toPort; + this.groupId = String.valueOf(sourceGroupId); + } + + public SecurityGroupRuleForCreate(String parentSecurityGroupId, String ipProtocol, Integer fromPort,Integer toPort, String cidr) { + this.parentGroupId = parentSecurityGroupId; + this.ipProtocol = ipProtocol; + this.fromPort = fromPort; + this.toPort = toPort; + this.cidr = cidr; + } + + public SecurityGroupRuleForCreate(String parentGroupId, String sourceGroupId, String ipProtocol, Integer fromPort,Integer toPort) { + this.parentGroupId = parentGroupId; + this.ipProtocol = ipProtocol; + this.fromPort = fromPort; + this.toPort = toPort; + this.groupId = sourceGroupId; + } + + /** + * @return the parentGroupId + */ + public String getParentGroupId() { + return parentGroupId; + } + + + /** + * @param parentGroupId the parentGroupId to set + * @deprecated Use {@link #setParentGroupId(String)} + */ + @Deprecated + public void setParentGroupId(Integer parentGroupId) { + this.parentGroupId = String.valueOf(parentGroupId); + } + + /** + * @param parentGroupId the parentGroupId to set + */ + public void setParentGroupId(String parentGroupId) { + this.parentGroupId = parentGroupId; + } + + /** + * @return the fromPort + */ + public Integer getFromPort() { + return fromPort; + } + + /** + * @param fromPort the fromPort to set + */ + public void setFromPort(Integer fromPort) { + this.fromPort = fromPort; + } + + /** + * @return the toPort + */ + public Integer getToPort() { + return toPort; + } + + /** + * @param toPort the toPort to set + */ + public void setToPort(Integer toPort) { + this.toPort = toPort; + } + + /** + * @return the ipProtocol + */ + public String getIpProtocol() { + return ipProtocol; + } + + /** + * @param ipProtocol the ipProtocol to set + */ + public void setIpProtocol(String ipProtocol) { + this.ipProtocol = ipProtocol; + } + + /** + * @return the cidr + */ + public String getCidr() { + return cidr; + } + + /** + * @param cidr the cidr to set + */ + public void setCidr(String cidr) { + this.cidr = cidr; + } + + /** + * @return the groupId + */ + public String getGroupId() { + return groupId; + } + + /** + * @param groupId the groupId to set + * @deprecated Use {@link #setGroupId(String)} + */ + @Deprecated + public void setGroupId(Integer groupId) { + this.groupId = String.valueOf(groupId); + } + + /** + * @param groupId the groupId to set + */ + public void setGroupId(String groupId) { + this.groupId = groupId; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "SecurityGroupRuleForCreate [parentGroupId=" + parentGroupId + + ", fromPort=" + fromPort + ", toPort=" + toPort + + ", ipProtocol=" + ipProtocol + ", cidr=" + cidr + + ", groupId=" + groupId + "]"; + } } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/SecurityGroups.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/SecurityGroups.java index a9f05e6..4d3ebbb 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/SecurityGroups.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/SecurityGroups.java @@ -24,27 +24,27 @@ import org.codehaus.jackson.annotate.JsonProperty; public class SecurityGroups implements Iterable<SecurityGroup>, Serializable { - @JsonProperty("security_groups") - private List<SecurityGroup> list; + @JsonProperty("security_groups") + private List<SecurityGroup> list; - /** - * @return the list - */ - public List<SecurityGroup> getList() { - return list; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "SecurityGroups [list=" + list + "]"; - } + /** + * @return the list + */ + public List<SecurityGroup> getList() { + return list; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "SecurityGroups [list=" + list + "]"; + } - @Override - public Iterator<SecurityGroup> iterator() { - return list.iterator(); - } - + @Override + public Iterator<SecurityGroup> iterator() { + return list.iterator(); + } + } 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 20ab039..63acbc2 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 @@ -29,221 +29,221 @@ 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; + + 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<String, List<Address>> addresses = new HashMap<>(); - - @JsonAnySetter - public void add(String key, List<Address> value) { - addresses.put(key, value); - } - /** - * @return the ip address List Map - */ - public Map<String, List<Address>> 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<Link> 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<String, String> metadata; - - @JsonProperty("security_groups") - private List<SecurityGroup> 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 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<String, List<Address>> addresses = new HashMap<>(); + + @JsonAnySetter + public void add(String key, List<Address> value) { + addresses.put(key, value); + } + /** + * @return the ip address List Map + */ + public Map<String, List<Address>> 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<Link> 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<String, String> metadata; + + @JsonProperty("security_groups") + private List<SecurityGroup> 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; @@ -253,220 +253,220 @@ public class Server implements Serializable { @JsonProperty("os-extended-volumes:volumes_attached") private List<String> 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<Link> 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<String, String> getMetadata() { - return metadata; - } - - /** - * @return the securityGroups - */ - public List<SecurityGroup> 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 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<Link> 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<String, String> getMetadata() { + return metadata; + } + + /** + * @return the securityGroups + */ + public List<SecurityGroup> 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 @@ -490,41 +490,41 @@ public class Server implements Serializable { } /** - * @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 + "]"; + } } 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 80793a7..c0289be 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 @@ -26,601 +26,601 @@ 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<String, String> metadata = new HashMap<>(); - - private List<PersonalityFile> 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<String, String> getMetadata() { - return metadata; - } - - /** - * @param metadata the metadata to set - */ - public void setMetadata(Map<String, String> metadata) { - this.metadata = metadata; - } - - /** - * @return the personality - */ - public List<PersonalityFile> getPersonality() { - return personality; - } - - /** - * @param personality the personality to set - */ - public void setPersonality(List<PersonalityFile> 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<String, String> 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<String, String> getMetadata() { - return metadata; - } - - /** - * @param metadata the metadata to set - */ - public void setMetadata(Map<String, String> 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<String, String> 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<String, String> getMetadata() { - return metadata; - } - - /** - * @param metadata the metadata to set - */ - public void setMetadata(Map<String, String> 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<String, String> metadata = new HashMap<>(); + + private List<PersonalityFile> 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<String, String> getMetadata() { + return metadata; + } + + /** + * @param metadata the metadata to set + */ + public void setMetadata(Map<String, String> metadata) { + this.metadata = metadata; + } + + /** + * @return the personality + */ + public List<PersonalityFile> getPersonality() { + return personality; + } + + /** + * @param personality the personality to set + */ + public void setPersonality(List<PersonalityFile> 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<String, String> 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<String, String> getMetadata() { + return metadata; + } + + /** + * @param metadata the metadata to set + */ + public void setMetadata(Map<String, String> 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<String, String> 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<String, String> getMetadata() { + return metadata; + } + + /** + * @param metadata the metadata to set + */ + public void setMetadata(Map<String, String> metadata) { + this.metadata = metadata; + } + + } + } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/ServerForCreate.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/ServerForCreate.java index ce981f7..4858e01 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/ServerForCreate.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/ServerForCreate.java @@ -28,315 +28,315 @@ import org.codehaus.jackson.map.annotate.JsonRootName; @JsonRootName("server") public class ServerForCreate implements Serializable { - public static final class SecurityGroup implements Serializable { + public static final class SecurityGroup implements Serializable { - private String name; + private String name; - public SecurityGroup() { - } + public SecurityGroup() { + } - public SecurityGroup(String name) { - this.name = name; - } + public SecurityGroup(String name) { + this.name = name; + } - /** - * @return the name - */ - public String getName() { - return name; - } + /** + * @return the name + */ + public String getName() { + return name; + } - /** - * @param name - * the name to set - */ - public void setName(String name) { - this.name = name; - } + /** + * @param name + * the name to set + */ + public void setName(String name) { + this.name = name; + } - } + } - private String name; + private String name; - private String adminPass; - - private String imageRef; - - private String flavorRef; - - private String accessIPv4; - - private String accessIPv6; - - private Integer min; - - private Integer max; - - private String diskConfig; - - @JsonProperty("key_name") - private String keyName; - - private List<PersonalityFile> personality = new ArrayList<PersonalityFile>(); - - private Map<String, String> metadata = new HashMap<String, String>(); - - @JsonProperty("security_groups") - private List<SecurityGroup> securityGroups; - - @JsonProperty("user_data") - private String userData; - - @JsonProperty("availability_zone") - private String availabilityZone; - - @JsonProperty("config_drive") - private boolean configDrive; - - @JsonProperty("networks") - private List<NetworkForCreate> networks = new ArrayList<NetworkForCreate>(); - - /** - * @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 imageRef - */ - public String getImageRef() { - return imageRef; - } - - /** - * @param imageRef - * the imageRef to set - */ - public void setImageRef(String imageRef) { - this.imageRef = imageRef; - } - - /** - * @return the flavorRef - */ - public String getFlavorRef() { - return flavorRef; - } - - /** - * @param flavorRef - * the flavorRef to set - */ - public void setFlavorRef(String flavorRef) { - this.flavorRef = flavorRef; - } - - /** - * @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 min - */ - public Integer getMin() { - return min; - } - - /** - * @param min - * the min to set - */ - public void setMin(Integer min) { - this.min = min; - } - - /** - * @return the max - */ - public Integer getMax() { - return max; - } - - /** - * @param max - * the max to set - */ - public void setMax(Integer max) { - this.max = max; - } - - /** - * @return the diskConfig - */ - public String getDiskConfig() { - return diskConfig; - } - - /** - * @param diskConfig - * the diskConfig to set - */ - public void setDiskConfig(String diskConfig) { - this.diskConfig = diskConfig; - } - - /** - * @return the keyName - */ - public String getKeyName() { - return keyName; - } - - /** - * @param keyName - * the keyName to set - */ - public void setKeyName(String keyName) { - this.keyName = keyName; - } - - /** - * @return the personality - */ - public List<PersonalityFile> getPersonality() { - return personality; - } - - /** - * @param personality - * the personality to set - */ - public void setPersonality(List<PersonalityFile> personality) { - this.personality = personality; - } - - /** - * @return the metadata - */ - public Map<String, String> getMetadata() { - return metadata; - } - - /** - * @param metadata - * the metadata to set - */ - public void setMetadata(Map<String, String> metadata) { - this.metadata = metadata; - } - - /** - * @return the securityGroups - */ - public List<SecurityGroup> getSecurityGroups() { - if (securityGroups == null) { - securityGroups = new ArrayList<SecurityGroup>(); - } - return securityGroups; - } - - /** - * @return the userData - */ - public String getUserData() { - return userData; - } - - /** - * @param userData - * the userData to set - */ - public void setUserData(String userData) { - this.userData = userData; - } - - /** - * @return the availabilityZone - */ - public String getAvailabilityZone() { - return availabilityZone; - } - - /** - * @param availabilityZone - * the availabilityZone to set - */ - public void setAvailabilityZone(String availabilityZone) { - this.availabilityZone = availabilityZone; - } - - public boolean isConfigDrive() { - return configDrive; - } - - public void setConfigDrive(boolean configDrive) { - this.configDrive = configDrive; - } - - public List<NetworkForCreate> getNetworks() { - return networks; - } - - public void setNetworks(List<NetworkForCreate> networks) { - this.networks = networks; - } - - public void addNetworks(String id, String fixedIp) { - NetworkForCreate net = new NetworkForCreate(); - net.setId(id); - net.setFixedIp(fixedIp); - this.networks.add(net); - } + private String adminPass; + + private String imageRef; + + private String flavorRef; + + private String accessIPv4; + + private String accessIPv6; + + private Integer min; + + private Integer max; + + private String diskConfig; + + @JsonProperty("key_name") + private String keyName; + + private List<PersonalityFile> personality = new ArrayList<PersonalityFile>(); + + private Map<String, String> metadata = new HashMap<String, String>(); + + @JsonProperty("security_groups") + private List<SecurityGroup> securityGroups; + + @JsonProperty("user_data") + private String userData; + + @JsonProperty("availability_zone") + private String availabilityZone; + + @JsonProperty("config_drive") + private boolean configDrive; + + @JsonProperty("networks") + private List<NetworkForCreate> networks = new ArrayList<NetworkForCreate>(); + + /** + * @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 imageRef + */ + public String getImageRef() { + return imageRef; + } + + /** + * @param imageRef + * the imageRef to set + */ + public void setImageRef(String imageRef) { + this.imageRef = imageRef; + } + + /** + * @return the flavorRef + */ + public String getFlavorRef() { + return flavorRef; + } + + /** + * @param flavorRef + * the flavorRef to set + */ + public void setFlavorRef(String flavorRef) { + this.flavorRef = flavorRef; + } + + /** + * @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 min + */ + public Integer getMin() { + return min; + } + + /** + * @param min + * the min to set + */ + public void setMin(Integer min) { + this.min = min; + } + + /** + * @return the max + */ + public Integer getMax() { + return max; + } + + /** + * @param max + * the max to set + */ + public void setMax(Integer max) { + this.max = max; + } + + /** + * @return the diskConfig + */ + public String getDiskConfig() { + return diskConfig; + } + + /** + * @param diskConfig + * the diskConfig to set + */ + public void setDiskConfig(String diskConfig) { + this.diskConfig = diskConfig; + } + + /** + * @return the keyName + */ + public String getKeyName() { + return keyName; + } + + /** + * @param keyName + * the keyName to set + */ + public void setKeyName(String keyName) { + this.keyName = keyName; + } + + /** + * @return the personality + */ + public List<PersonalityFile> getPersonality() { + return personality; + } + + /** + * @param personality + * the personality to set + */ + public void setPersonality(List<PersonalityFile> personality) { + this.personality = personality; + } + + /** + * @return the metadata + */ + public Map<String, String> getMetadata() { + return metadata; + } + + /** + * @param metadata + * the metadata to set + */ + public void setMetadata(Map<String, String> metadata) { + this.metadata = metadata; + } + + /** + * @return the securityGroups + */ + public List<SecurityGroup> getSecurityGroups() { + if (securityGroups == null) { + securityGroups = new ArrayList<SecurityGroup>(); + } + return securityGroups; + } + + /** + * @return the userData + */ + public String getUserData() { + return userData; + } + + /** + * @param userData + * the userData to set + */ + public void setUserData(String userData) { + this.userData = userData; + } + + /** + * @return the availabilityZone + */ + public String getAvailabilityZone() { + return availabilityZone; + } + + /** + * @param availabilityZone + * the availabilityZone to set + */ + public void setAvailabilityZone(String availabilityZone) { + this.availabilityZone = availabilityZone; + } + + public boolean isConfigDrive() { + return configDrive; + } + + public void setConfigDrive(boolean configDrive) { + this.configDrive = configDrive; + } + + public List<NetworkForCreate> getNetworks() { + return networks; + } + + public void setNetworks(List<NetworkForCreate> networks) { + this.networks = networks; + } + + public void addNetworks(String id, String fixedIp) { + NetworkForCreate net = new NetworkForCreate(); + net.setId(id); + net.setFixedIp(fixedIp); + this.networks.add(net); + } } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Servers.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Servers.java index 3cc908e..92643b9 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/Servers.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Servers.java @@ -24,27 +24,27 @@ import org.codehaus.jackson.annotate.JsonProperty; public class Servers implements Iterable<Server>, Serializable { - @JsonProperty("servers") - private List<Server> list; + @JsonProperty("servers") + private List<Server> list; - /** - * @return the list - */ - public List<Server> getList() { - return list; - } - - @Override - public Iterator<Server> iterator() { - return list.iterator(); - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Servers [list=" + list + "]"; - } + /** + * @return the list + */ + public List<Server> getList() { + return list; + } + + @Override + public Iterator<Server> iterator() { + return list.iterator(); + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Servers [list=" + list + "]"; + } } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/SimpleTenantUsage.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/SimpleTenantUsage.java index 463cc98..ea6f77e 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/SimpleTenantUsage.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/SimpleTenantUsage.java @@ -25,224 +25,224 @@ import org.codehaus.jackson.map.annotate.JsonRootName; @JsonRootName("tenant_usage") public class SimpleTenantUsage implements Serializable { - - @JsonProperty("total_memory_mb_usage") - private BigDecimal totalMemoryMbUsage; - - @JsonProperty("total_vcpus_usage") - private BigDecimal totalVcpusUsage; - - @JsonProperty("total_local_gb_usage") - private BigDecimal totalLocalGbUsage; - - private String start; - - private String stop; - - @JsonProperty("tenant_id") - private String tenantId; - - @JsonProperty("total_hours") - private String totalHours; - - @JsonProperty("server_usages") - private List<ServerUsage> serverUsages; - - /** - * @return the totalMemoryMbUsage - */ - public BigDecimal getTotalMemoryMbUsage() { - return totalMemoryMbUsage; - } - - /** - * @param totalMemoryMbUsage the totalMemoryMbUsage to set - */ - public void setTotalMemoryMbUsage(BigDecimal totalMemoryMbUsage) { - this.totalMemoryMbUsage = totalMemoryMbUsage; - } - - /** - * @return the totalVcpusUsage - */ - public BigDecimal getTotalVcpusUsage() { - return totalVcpusUsage; - } - - /** - * @param totalVcpusUsage the totalVcpusUsage to set - */ - public void setTotalVcpusUsage(BigDecimal totalVcpusUsage) { - this.totalVcpusUsage = totalVcpusUsage; - } - - /** - * @return the totalLocalGbUsage - */ - public BigDecimal getTotalLocalGbUsage() { - return totalLocalGbUsage; - } - - /** - * @param totalLocalGbUsage the totalLocalGbUsage to set - */ - public void setTotalLocalGbUsage(BigDecimal totalLocalGbUsage) { - this.totalLocalGbUsage = totalLocalGbUsage; - } - - /** - * @return the start - */ - public String getStart() { - return start; - } - - /** - * @param start the start to set - */ - public void setStart(String start) { - this.start = start; - } - - /** - * @return the stop - */ - public String getStop() { - return stop; - } - - /** - * @param stop the stop to set - */ - public void setStop(String stop) { - this.stop = stop; - } - - /** - * @return the tenantId - */ - public String getTenantId() { - return tenantId; - } - - /** - * @param tenantId the tenantId to set - */ - public void setTenantId(String tenantId) { - this.tenantId = tenantId; - } - - /** - * @return the totalHours - */ - public String getTotalHours() { - return totalHours; - } - - /** - * @param totalHours the totalHours to set - */ - public void setTotalHours(String totalHours) { - this.totalHours = totalHours; - } - - public List<ServerUsage> getServerUsages() { - return serverUsages; - } - - public void setServerUsages(List<ServerUsage> serverUsages) { - this.serverUsages = serverUsages; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "SimpleTenantUsage [totalMemoryMbUsage=" + totalMemoryMbUsage - + ", totalVcpusUsage=" + totalVcpusUsage - + ", totalLocalGbUsage=" + totalLocalGbUsage + ", start=" - + start + ", stop=" + stop + ", tenantId=" + tenantId - + ", totalHours=" + totalHours + "]"; - } - - public static final class ServerUsage implements Serializable { - @JsonProperty("instance_id") - private String instanceId; - - private Integer uptime; - - @JsonProperty("started_at") - private String startedAt; - - @JsonProperty("ended_at") - private String endedAt; - - @JsonProperty("memory_mb") - private Integer memoryMb; - - @JsonProperty("tenant_id") - private String tenantId; - - private String state; - - private Double hours; - - private Integer vcpus; - - private String flavor; - - @JsonProperty("local_gb") - private Integer localDiskSize; - - private String name; - - public String getInstanceId() { - return instanceId; - } - - public Integer getUptime() { - return uptime; - } - - public String getStartedAt() { - return startedAt; - } - - public String getEndedAt() { - return endedAt; - } - - public Integer getMemoryMb() { - return memoryMb; - } - - public String getTenantId() { - return tenantId; - } - - public String getState() { - return state; - } - - public Double getHours() { - return hours; - } - - public Integer getVcpus() { - return vcpus; - } - - public String getFlavor() { - return flavor; - } + + @JsonProperty("total_memory_mb_usage") + private BigDecimal totalMemoryMbUsage; + + @JsonProperty("total_vcpus_usage") + private BigDecimal totalVcpusUsage; + + @JsonProperty("total_local_gb_usage") + private BigDecimal totalLocalGbUsage; + + private String start; + + private String stop; + + @JsonProperty("tenant_id") + private String tenantId; + + @JsonProperty("total_hours") + private String totalHours; + + @JsonProperty("server_usages") + private List<ServerUsage> serverUsages; + + /** + * @return the totalMemoryMbUsage + */ + public BigDecimal getTotalMemoryMbUsage() { + return totalMemoryMbUsage; + } + + /** + * @param totalMemoryMbUsage the totalMemoryMbUsage to set + */ + public void setTotalMemoryMbUsage(BigDecimal totalMemoryMbUsage) { + this.totalMemoryMbUsage = totalMemoryMbUsage; + } + + /** + * @return the totalVcpusUsage + */ + public BigDecimal getTotalVcpusUsage() { + return totalVcpusUsage; + } + + /** + * @param totalVcpusUsage the totalVcpusUsage to set + */ + public void setTotalVcpusUsage(BigDecimal totalVcpusUsage) { + this.totalVcpusUsage = totalVcpusUsage; + } + + /** + * @return the totalLocalGbUsage + */ + public BigDecimal getTotalLocalGbUsage() { + return totalLocalGbUsage; + } + + /** + * @param totalLocalGbUsage the totalLocalGbUsage to set + */ + public void setTotalLocalGbUsage(BigDecimal totalLocalGbUsage) { + this.totalLocalGbUsage = totalLocalGbUsage; + } + + /** + * @return the start + */ + public String getStart() { + return start; + } + + /** + * @param start the start to set + */ + public void setStart(String start) { + this.start = start; + } + + /** + * @return the stop + */ + public String getStop() { + return stop; + } + + /** + * @param stop the stop to set + */ + public void setStop(String stop) { + this.stop = stop; + } + + /** + * @return the tenantId + */ + public String getTenantId() { + return tenantId; + } + + /** + * @param tenantId the tenantId to set + */ + public void setTenantId(String tenantId) { + this.tenantId = tenantId; + } + + /** + * @return the totalHours + */ + public String getTotalHours() { + return totalHours; + } + + /** + * @param totalHours the totalHours to set + */ + public void setTotalHours(String totalHours) { + this.totalHours = totalHours; + } + + public List<ServerUsage> getServerUsages() { + return serverUsages; + } + + public void setServerUsages(List<ServerUsage> serverUsages) { + this.serverUsages = serverUsages; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "SimpleTenantUsage [totalMemoryMbUsage=" + totalMemoryMbUsage + + ", totalVcpusUsage=" + totalVcpusUsage + + ", totalLocalGbUsage=" + totalLocalGbUsage + ", start=" + + start + ", stop=" + stop + ", tenantId=" + tenantId + + ", totalHours=" + totalHours + "]"; + } + + public static final class ServerUsage implements Serializable { + @JsonProperty("instance_id") + private String instanceId; + + private Integer uptime; + + @JsonProperty("started_at") + private String startedAt; + + @JsonProperty("ended_at") + private String endedAt; + + @JsonProperty("memory_mb") + private Integer memoryMb; + + @JsonProperty("tenant_id") + private String tenantId; + + private String state; + + private Double hours; + + private Integer vcpus; + + private String flavor; + + @JsonProperty("local_gb") + private Integer localDiskSize; + + private String name; + + public String getInstanceId() { + return instanceId; + } + + public Integer getUptime() { + return uptime; + } + + public String getStartedAt() { + return startedAt; + } + + public String getEndedAt() { + return endedAt; + } + + public Integer getMemoryMb() { + return memoryMb; + } + + public String getTenantId() { + return tenantId; + } + + public String getState() { + return state; + } + + public Double getHours() { + return hours; + } + + public Integer getVcpus() { + return vcpus; + } + + public String getFlavor() { + return flavor; + } - public Integer getLocalDiskSize() { - return localDiskSize; - } + public Integer getLocalDiskSize() { + return localDiskSize; + } - public String getName() { - return name; - } - } + public String getName() { + return name; + } + } } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/SimpleTenantUsages.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/SimpleTenantUsages.java index 087d616..313e5eb 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/SimpleTenantUsages.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/SimpleTenantUsages.java @@ -24,27 +24,27 @@ import org.codehaus.jackson.annotate.JsonProperty; public class SimpleTenantUsages implements Iterable<SimpleTenantUsage>, Serializable { - @JsonProperty("tenant_usages") - private List<SimpleTenantUsage> list; - - /** - * @return the list - */ - public List<SimpleTenantUsage> getList() { - return list; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "SimpleTenantUsage [list=" + list + "]"; - } - - @Override - public Iterator<SimpleTenantUsage> iterator() { - return list.iterator(); - } - + @JsonProperty("tenant_usages") + private List<SimpleTenantUsage> list; + + /** + * @return the list + */ + public List<SimpleTenantUsage> getList() { + return list; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "SimpleTenantUsage [list=" + list + "]"; + } + + @Override + public Iterator<SimpleTenantUsage> iterator() { + return list.iterator(); + } + } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Snapshot.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Snapshot.java index 2fb547b..c51ab62 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/Snapshot.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Snapshot.java @@ -24,80 +24,80 @@ import org.codehaus.jackson.map.annotate.JsonRootName; @JsonRootName("snapshot") public class Snapshot implements Serializable { - private String id; - - private String status; - - @JsonProperty("displayName") - private String name; - - @JsonProperty("displayDescription") - private String description; - - private String volumeId; - - private Integer size; - - private String createdAt; + private String id; + + private String status; + + @JsonProperty("displayName") + private String name; + + @JsonProperty("displayDescription") + private String description; + + private String volumeId; + + private Integer size; + + private String createdAt; - /** - * @return the id - */ - public String getId() { - return id; - } + /** + * @return the id + */ + public String getId() { + return id; + } - /** - * @return the status - */ - public String getStatus() { - return status; - } + /** + * @return the status + */ + public String getStatus() { + return status; + } - /** - * @return the name - */ - public String getName() { - return name; - } + /** + * @return the name + */ + public String getName() { + return name; + } - /** - * @return the description - */ - public String getDescription() { - return description; - } + /** + * @return the description + */ + public String getDescription() { + return description; + } - /** - * @return the volumeId - */ - public String getVolumeId() { - return volumeId; - } + /** + * @return the volumeId + */ + public String getVolumeId() { + return volumeId; + } - /** - * @return the size - */ - public Integer getSize() { - return size; - } + /** + * @return the size + */ + public Integer getSize() { + return size; + } - /** - * @return the createdAt - */ - public String getCreatedAt() { - return createdAt; - } + /** + * @return the createdAt + */ + public String getCreatedAt() { + return createdAt; + } - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Snapshot [id=" + id + ", status=" + status + ", displayName=" - + name + ", displayDescription=" + description - + ", volumeId=" + volumeId + ", size=" + size + ", createdAt=" - + createdAt + "]"; - } - + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Snapshot [id=" + id + ", status=" + status + ", displayName=" + + name + ", displayDescription=" + description + + ", volumeId=" + volumeId + ", size=" + size + ", createdAt=" + + createdAt + "]"; + } + } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/SnapshotForCreate.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/SnapshotForCreate.java index 4fa37c0..752eb59 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/SnapshotForCreate.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/SnapshotForCreate.java @@ -23,81 +23,81 @@ import org.codehaus.jackson.map.annotate.JsonRootName; @JsonRootName("snapshot") public class SnapshotForCreate implements Serializable { - - @JsonProperty("volume_id") - private String volumeId; - - private Boolean force; - - @JsonProperty("display_name") - private String name; + + @JsonProperty("volume_id") + private String volumeId; + + private Boolean force; + + @JsonProperty("display_name") + private String name; - @JsonProperty("display_description") - private String description; + @JsonProperty("display_description") + private String description; - /** - * @return the volumeId - */ - public String getVolumeId() { - return volumeId; - } + /** + * @return the volumeId + */ + public String getVolumeId() { + return volumeId; + } - /** - * @param volumeId the volumeId to set - */ - public void setVolumeId(String volumeId) { - this.volumeId = volumeId; - } + /** + * @param volumeId the volumeId to set + */ + public void setVolumeId(String volumeId) { + this.volumeId = volumeId; + } - /** - * @return the force - */ - public Boolean getForce() { - return force; - } + /** + * @return the force + */ + public Boolean getForce() { + return force; + } - /** - * @param force the force to set - */ - public void setForce(Boolean force) { - this.force = force; - } + /** + * @param force the force to set + */ + public void setForce(Boolean force) { + this.force = force; + } - /** - * @return the name - */ - public String getName() { - return name; - } + /** + * @return the name + */ + public String getName() { + return name; + } - /** - * @param name the name to set - */ - public void setName(String name) { - this.name = name; - } + /** + * @param name the name to set + */ + public void setName(String name) { + this.name = name; + } - /** - * @return the description - */ - public String getDescription() { - return description; - } + /** + * @return the description + */ + public String getDescription() { + return description; + } - /** - * @param description the description to set - */ - public void setDescription(String description) { - this.description = description; - } + /** + * @param description the description to set + */ + public void setDescription(String description) { + this.description = description; + } - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "SnapshotForCreate [volumeId=" + volumeId + ", force=" + force - + ", name=" + name + ", description=" + description + "]"; - } + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "SnapshotForCreate [volumeId=" + volumeId + ", force=" + force + + ", name=" + name + ", description=" + description + "]"; + } } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Snapshots.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Snapshots.java index c71c8cf..238a173 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/Snapshots.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Snapshots.java @@ -24,27 +24,27 @@ import org.codehaus.jackson.annotate.JsonProperty; public class Snapshots implements Iterable<Snapshot>, Serializable { - @JsonProperty("snapshots") - private List<Snapshot> list; + @JsonProperty("snapshots") + private List<Snapshot> list; - /** - * @return the list - */ - public List<Snapshot> getList() { - return list; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Snapshots [list=" + list + "]"; - } + /** + * @return the list + */ + public List<Snapshot> getList() { + return list; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Snapshots [list=" + list + "]"; + } - @Override - public Iterator<Snapshot> iterator() { - return list.iterator(); - } - + @Override + public Iterator<Snapshot> iterator() { + return list.iterator(); + } + } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Volume.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Volume.java index 50d1c91..453bf24 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/Volume.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Volume.java @@ -26,107 +26,107 @@ import org.codehaus.jackson.map.annotate.JsonRootName; @JsonRootName("volume") public class Volume implements Serializable { - private String id; - - private String status; - - @JsonProperty("displayName") - private String name; - - @JsonProperty("displayDescription") - private String description; - - private String availabilityZone; - - private String volumeType; - - private String snapshotId; - - private List<Map<String, Object>> attachments; - - private Map<String, String> metadata; - - private String createdAt; - - private Integer size; - - /** - * @return the id - */ - public String getId() { - return id; - } - - /** - * @return the status - */ - public String getStatus() { - return status; - } - - /** - * @return the name - */ - public String getName() { - return name; - } - - /** - * @return the description - */ - public String getDescription() { - return description; - } - - /** - * @return the availabilityZone - */ - public String getAvailabilityZone() { - return availabilityZone; - } - - /** - * @return the volumeType - */ - public String getVolumeType() { - return volumeType; - } - - /** - * @return the snapshotId - */ - public String getSnapshotId() { - return snapshotId; - } - - /** - * @return the attachments - */ - public List<Map<String, Object>> getAttachments() { - return attachments; - } - - /** - * @return the metadata - */ - public Map<String, String> getMetadata() { - return metadata; - } - - /** - * @return the createdAt - */ - public String getCreatedAt() { - return createdAt; - } - - /** - * @return the size - */ - public Integer getSize() { - return size; - } - - - + private String id; + + private String status; + + @JsonProperty("displayName") + private String name; + + @JsonProperty("displayDescription") + private String description; + + private String availabilityZone; + + private String volumeType; + + private String snapshotId; + + private List<Map<String, Object>> attachments; + + private Map<String, String> metadata; + + private String createdAt; + + private Integer size; + + /** + * @return the id + */ + public String getId() { + return id; + } + + /** + * @return the status + */ + public String getStatus() { + return status; + } + + /** + * @return the name + */ + public String getName() { + return name; + } + + /** + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * @return the availabilityZone + */ + public String getAvailabilityZone() { + return availabilityZone; + } + + /** + * @return the volumeType + */ + public String getVolumeType() { + return volumeType; + } + + /** + * @return the snapshotId + */ + public String getSnapshotId() { + return snapshotId; + } + + /** + * @return the attachments + */ + public List<Map<String, Object>> getAttachments() { + return attachments; + } + + /** + * @return the metadata + */ + public Map<String, String> getMetadata() { + return metadata; + } + + /** + * @return the createdAt + */ + public String getCreatedAt() { + return createdAt; + } + + /** + * @return the size + */ + public Integer getSize() { + return size; + } + + + } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/VolumeAttachment.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/VolumeAttachment.java index 1dd7c2a..3a62cca 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/VolumeAttachment.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/VolumeAttachment.java @@ -23,53 +23,53 @@ import org.codehaus.jackson.map.annotate.JsonRootName; @JsonRootName("volumeAttachment") public class VolumeAttachment implements Serializable { - private String id; + private String id; - private String volumeId; + private String volumeId; - private String serverId; + private String serverId; - private String device; + private String device; - public String getId() { - return id; - } + public String getId() { + return id; + } - public void setId(String id) { - this.id = id; - } + public void setId(String id) { + this.id = id; + } - public String getVolumeId() { - return volumeId; - } + public String getVolumeId() { + return volumeId; + } - public void setVolumeId(String volumeId) { - this.volumeId = volumeId; - } + public void setVolumeId(String volumeId) { + this.volumeId = volumeId; + } - public String getServerId() { - return serverId; - } + public String getServerId() { + return serverId; + } - public void setServerId(String serverId) { - this.serverId = serverId; - } + public void setServerId(String serverId) { + this.serverId = serverId; + } - public String getDevice() { - return device; - } + public String getDevice() { + return device; + } - public void setDevice(String device) { - this.device = device; - } + public void setDevice(String device) { + this.device = device; + } - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "VolumeAttachment [id=" + id + ", volumeId=" + volumeId - + ", serverId=" + serverId + ", device=" + device + "]"; - } + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "VolumeAttachment [id=" + id + ", volumeId=" + volumeId + + ", serverId=" + serverId + ", device=" + device + "]"; + } } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/VolumeAttachments.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/VolumeAttachments.java index 54e870c..2a5ecba 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/VolumeAttachments.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/VolumeAttachments.java @@ -24,27 +24,27 @@ import org.codehaus.jackson.annotate.JsonProperty; public class VolumeAttachments implements Iterable<VolumeAttachment>, Serializable { - @JsonProperty("volumeAttachments") - private List<VolumeAttachment> list; - - /** - * @return the list - */ - public List<VolumeAttachment> getList() { - return list; - } - - @Override - public Iterator<VolumeAttachment> iterator() { - return list.iterator(); - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "VolumeAttachments [list=" + list + "]"; - } + @JsonProperty("volumeAttachments") + private List<VolumeAttachment> list; + + /** + * @return the list + */ + public List<VolumeAttachment> getList() { + return list; + } + + @Override + public Iterator<VolumeAttachment> iterator() { + return list.iterator(); + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "VolumeAttachments [list=" + list + "]"; + } } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/VolumeForCreate.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/VolumeForCreate.java index 13e7932..c06d692 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/VolumeForCreate.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/VolumeForCreate.java @@ -25,115 +25,115 @@ import org.codehaus.jackson.map.annotate.JsonRootName; @JsonRootName("volume") public class VolumeForCreate implements Serializable { - private Integer size; - - @JsonProperty("availability_zone") - private String availabilityZone; - - @JsonProperty("display_name") - private String name; - - @JsonProperty("display_description") - private String description; - - @JsonProperty("snapshot_id") - private Integer snapshotId; - - private Map<String, String> metadata; - - /** - * @return the size - */ - public Integer getSize() { - return size; - } - - /** - * @param size the size to set - */ - public void setSize(Integer size) { - this.size = size; - } - - /** - * @return the availabilityZone - */ - public String getAvailabilityZone() { - return availabilityZone; - } - - /** - * @param availabilityZone the availabilityZone to set - */ - public void setAvailabilityZone(String availabilityZone) { - this.availabilityZone = availabilityZone; - } - - /** - * @return the name - */ - public String getName() { - return name; - } - - /** - * @param name the name to set - */ - public void setName(String name) { - this.name = name; - } - - /** - * @return the description - */ - public String getDescription() { - return description; - } - - /** - * @param description the description to set - */ - public void setDescription(String description) { - this.description = description; - } - - /** - * @return the snapshotId - */ - public Integer getSnapshotId() { - return snapshotId; - } - - /** - * @param snapshotId the snapshotId to set - */ - public void setSnapshotId(Integer snapshotId) { - this.snapshotId = snapshotId; - } - - /** - * @return the metadata - */ - public Map<String, String> getMetadata() { - return metadata; - } - - /** - * @param metadata the metadata to set - */ - public void setMetadata(Map<String, String> metadata) { - this.metadata = metadata; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "VolumeForCreate [size=" + size + ", availabilityZone=" - + availabilityZone + ", name=" + name + ", description=" - + description + ", snapshotId=" + snapshotId + ", metadata=" - + metadata + "]"; - } + private Integer size; + + @JsonProperty("availability_zone") + private String availabilityZone; + + @JsonProperty("display_name") + private String name; + + @JsonProperty("display_description") + private String description; + + @JsonProperty("snapshot_id") + private Integer snapshotId; + + private Map<String, String> metadata; + + /** + * @return the size + */ + public Integer getSize() { + return size; + } + + /** + * @param size the size to set + */ + public void setSize(Integer size) { + this.size = size; + } + + /** + * @return the availabilityZone + */ + public String getAvailabilityZone() { + return availabilityZone; + } + + /** + * @param availabilityZone the availabilityZone to set + */ + public void setAvailabilityZone(String availabilityZone) { + this.availabilityZone = availabilityZone; + } + + /** + * @return the name + */ + public String getName() { + return name; + } + + /** + * @param name the name to set + */ + public void setName(String name) { + this.name = name; + } + + /** + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * @param description the description to set + */ + public void setDescription(String description) { + this.description = description; + } + + /** + * @return the snapshotId + */ + public Integer getSnapshotId() { + return snapshotId; + } + + /** + * @param snapshotId the snapshotId to set + */ + public void setSnapshotId(Integer snapshotId) { + this.snapshotId = snapshotId; + } + + /** + * @return the metadata + */ + public Map<String, String> getMetadata() { + return metadata; + } + + /** + * @param metadata the metadata to set + */ + public void setMetadata(Map<String, String> metadata) { + this.metadata = metadata; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "VolumeForCreate [size=" + size + ", availabilityZone=" + + availabilityZone + ", name=" + name + ", description=" + + description + ", snapshotId=" + snapshotId + ", metadata=" + + metadata + "]"; + } } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/VolumeForImageCreate.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/VolumeForImageCreate.java index 3b5df21..f368f5c 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/VolumeForImageCreate.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/VolumeForImageCreate.java @@ -23,65 +23,65 @@ import org.codehaus.jackson.map.annotate.JsonRootName; @JsonRootName("os-volume_upload_image") public class VolumeForImageCreate implements Serializable { - String volumeId; - String tenantId; - - public String getTenantId() { - return tenantId; - } - - public void setTenantId(String tenantId) { - this.tenantId = tenantId; - } - - @JsonProperty("force") - private Boolean force; - - public Boolean getForce() { - return force; - } - - public void setForce(Boolean force) { - this.force = force; - } - - @JsonProperty("container_format") - String container_format; - @JsonProperty("disk_format") - String disk_format; - @JsonProperty("image_name") - String image_name; - - public String getVolumeId() { - return volumeId; - } - - public void setVolumeId(String volumeId) { - this.volumeId = volumeId; - } - - public String getContainer_format() { - return container_format; - } - - public void setContainer_format(String container_format) { - this.container_format = container_format; - } - - public String getDisk_format() { - return disk_format; - } - - public void setDisk_format(String disk_format) { - this.disk_format = disk_format; - } - - public String getImage_name() { - return image_name; - } - - public void setImage_name(String image_name) { - this.image_name = image_name; - } + String volumeId; + String tenantId; + + public String getTenantId() { + return tenantId; + } + + public void setTenantId(String tenantId) { + this.tenantId = tenantId; + } + + @JsonProperty("force") + private Boolean force; + + public Boolean getForce() { + return force; + } + + public void setForce(Boolean force) { + this.force = force; + } + + @JsonProperty("container_format") + String container_format; + @JsonProperty("disk_format") + String disk_format; + @JsonProperty("image_name") + String image_name; + + public String getVolumeId() { + return volumeId; + } + + public void setVolumeId(String volumeId) { + this.volumeId = volumeId; + } + + public String getContainer_format() { + return container_format; + } + + public void setContainer_format(String container_format) { + this.container_format = container_format; + } + + public String getDisk_format() { + return disk_format; + } + + public void setDisk_format(String disk_format) { + this.disk_format = disk_format; + } + + public String getImage_name() { + return image_name; + } + + public void setImage_name(String image_name) { + this.image_name = image_name; + } } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/VolumeTypes.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/VolumeTypes.java index fd7149c..96fc6c5 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/VolumeTypes.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/VolumeTypes.java @@ -24,27 +24,27 @@ import org.codehaus.jackson.annotate.JsonProperty; public class VolumeTypes implements Iterable<VolumeType>, Serializable { - @JsonProperty("volume-types") - private List<VolumeType> list; + @JsonProperty("volume-types") + private List<VolumeType> list; - /** - * @return the list - */ - public List<VolumeType> getList() { - return list; - } + /** + * @return the list + */ + public List<VolumeType> getList() { + return list; + } - @Override - public Iterator<VolumeType> iterator() { - return list.iterator(); - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "VolumeTypes [list=" + list + "]"; - } - + @Override + public Iterator<VolumeType> iterator() { + return list.iterator(); + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "VolumeTypes [list=" + list + "]"; + } + } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Volumes.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Volumes.java index d71dcd6..1dc5bde 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/Volumes.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Volumes.java @@ -24,27 +24,27 @@ import org.codehaus.jackson.annotate.JsonProperty; public class Volumes implements Iterable<Volume>, Serializable { - @JsonProperty("volumes") - private List<Volume> list; + @JsonProperty("volumes") + private List<Volume> list; - /** - * @return the list - */ - public List<Volume> getList() { - return list; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Volumes [list=" + list + "]"; - } + /** + * @return the list + */ + public List<Volume> getList() { + return list; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Volumes [list=" + list + "]"; + } - @Override - public Iterator<Volume> iterator() { - return list.iterator(); - } - + @Override + public Iterator<Volume> iterator() { + return list.iterator(); + } + } diff --git a/openstack-client-connectors/http-connector/src/main/java/com/woorea/openstack/connector/HttpClientConnector.java b/openstack-client-connectors/http-connector/src/main/java/com/woorea/openstack/connector/HttpClientConnector.java index b3511e8..02d851e 100644 --- a/openstack-client-connectors/http-connector/src/main/java/com/woorea/openstack/connector/HttpClientConnector.java +++ b/openstack-client-connectors/http-connector/src/main/java/com/woorea/openstack/connector/HttpClientConnector.java @@ -62,168 +62,168 @@ import com.woorea.openstack.base.client.OpenStackResponseException; public class HttpClientConnector implements OpenStackClientConnector { - public static ObjectMapper DEFAULT_MAPPER; - public static ObjectMapper WRAPPED_MAPPER; - - private static Logger LOGGER = Logger.getLogger(HttpClientConnector.class); - - static { - DEFAULT_MAPPER = new ObjectMapper(); - - DEFAULT_MAPPER.setSerializationInclusion(Inclusion.NON_NULL); - DEFAULT_MAPPER.disable(SerializationConfig.Feature.INDENT_OUTPUT); - DEFAULT_MAPPER.enable(DeserializationConfig.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY); - DEFAULT_MAPPER.disable(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES); - - WRAPPED_MAPPER = new ObjectMapper(); - - WRAPPED_MAPPER.setSerializationInclusion(Inclusion.NON_NULL); - WRAPPED_MAPPER.disable(SerializationConfig.Feature.INDENT_OUTPUT); - WRAPPED_MAPPER.enable(SerializationConfig.Feature.WRAP_ROOT_VALUE); - WRAPPED_MAPPER.enable(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE); - WRAPPED_MAPPER.enable(DeserializationConfig.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY); - WRAPPED_MAPPER.disable(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES); - } - - protected static <T> ObjectMapper getObjectMapper (Class<T> type) { - return type.getAnnotation(JsonRootName.class) == null ? DEFAULT_MAPPER : WRAPPED_MAPPER; - } - - @Override - public <T> OpenStackResponse request(OpenStackRequest<T> request) { - - CloseableHttpClient httpClient = null; //HttpClients.createDefault(); - httpClient = HttpClients.custom().setRedirectStrategy(new HttpClientRedirectStrategy()).build(); - - URI uri = null; - - // Build the URI with query params - try { - URIBuilder uriBuilder = new URIBuilder(request.endpoint() + request.path()); - - for(Map.Entry<String, List<Object> > entry : request.queryParams().entrySet()) { - for (Object o : entry.getValue()) { - uriBuilder.setParameter(entry.getKey(), String.valueOf(o)); - } - } - - uri = uriBuilder.build(); - } catch (URISyntaxException e) { - throw new HttpClientException (e); - } - - HttpEntity entity = null; - if (request.entity() != null) { - // Flatten the entity to a Json string - - try { - // Get appropriate mapper, based on existence of a root element in Entity class - ObjectMapper mapper = getObjectMapper (request.entity().getEntity().getClass()); - - String entityJson = mapper.writeValueAsString (request.entity().getEntity()); - entity = new StringEntity(entityJson, ContentType.create(request.entity().getContentType())); - - LOGGER.debug("Openstack query JSON:"+entityJson); - LOGGER.debug ("Request JSON Body: " + entityJson.replaceAll("\"password\":\"[^\"]*\"", "\"password\":\"***\"")); - - } catch (JsonProcessingException e) { - throw new HttpClientException ("Json processing error on request entity", e); - } catch (IOException e) { - throw new HttpClientException ("Json IO error on request entity", e); - } - } - - // Determine the HttpRequest class based on the method - HttpUriRequest httpRequest; - - switch (request.method()) { - case POST: - HttpPost post = new HttpPost(uri); - post.setEntity (entity); - httpRequest = post; - break; - - case GET: - httpRequest = new HttpGet(uri); - break; - - case PUT: - HttpPut put = new HttpPut(uri); - put.setEntity (entity); - httpRequest = put; - break; - - case DELETE: - httpRequest = new HttpDelete(uri); - break; - - default: - throw new HttpClientException ("Unrecognized HTTP Method: " + request.method()); - } - - for (Entry<String, List<Object>> h : request.headers().entrySet()) { - StringBuilder sb = new StringBuilder(); - for (Object v : h.getValue()) { - sb.append(String.valueOf(v)); - } - httpRequest.addHeader(h.getKey(), sb.toString()); - } - - LOGGER.debug ("Sending HTTP request: " + httpRequest.toString()); - - // Get the Response. But don't get the body entity yet, as this response - // will be wrapped in an HttpClientResponse. The HttpClientResponse - // buffers the body in constructor, so can close the response here. - HttpClientResponse httpClientResponse = null; - CloseableHttpResponse httpResponse = null; - - // Catch known HttpClient exceptions, and wrap them in OpenStack Client Exceptions - // so calling functions can distinguish. Only RuntimeExceptions are allowed. - try { - httpResponse = httpClient.execute(httpRequest); - - LOGGER.debug ("Response status: " + httpResponse.getStatusLine().getStatusCode()); - - httpClientResponse = new HttpClientResponse (httpResponse); - - int status = httpResponse.getStatusLine().getStatusCode(); - if (status == HttpStatus.SC_OK || status == HttpStatus.SC_CREATED || - status == HttpStatus.SC_NO_CONTENT || status == HttpStatus.SC_ACCEPTED) - { - return httpClientResponse; - } - } - catch (HttpResponseException e) { - // What exactly does this mean? It does not appear to get thrown for - // non-2XX responses as documented. - throw new OpenStackResponseException(e.getMessage(), e.getStatusCode()); - } - catch (UnknownHostException e) { - throw new OpenStackConnectException("Unknown Host: " + e.getMessage()); - } - catch (IOException e) { - // Catch all other IOExceptions and throw as OpenStackConnectException - throw new OpenStackConnectException(e.getMessage()); - } - catch (Exception e) { - // Catchall for anything else, must throw as a RuntimeException - e.printStackTrace(); - throw new RuntimeException("Unexpected client exception", e); - } - finally { - // Have the body. Close the stream - if (httpResponse != null) - try { - httpResponse.close(); - } catch (IOException e) { - LOGGER.warn("Unable to close HTTP Response: " + e); - } - } - - // Get here on an error response (4XX-5XX) - throw new OpenStackResponseException(httpResponse.getStatusLine().getReasonPhrase(), - httpResponse.getStatusLine().getStatusCode(), - httpClientResponse); - } + public static ObjectMapper DEFAULT_MAPPER; + public static ObjectMapper WRAPPED_MAPPER; + + private static Logger LOGGER = Logger.getLogger(HttpClientConnector.class); + + static { + DEFAULT_MAPPER = new ObjectMapper(); + + DEFAULT_MAPPER.setSerializationInclusion(Inclusion.NON_NULL); + DEFAULT_MAPPER.disable(SerializationConfig.Feature.INDENT_OUTPUT); + DEFAULT_MAPPER.enable(DeserializationConfig.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + DEFAULT_MAPPER.disable(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES); + + WRAPPED_MAPPER = new ObjectMapper(); + + WRAPPED_MAPPER.setSerializationInclusion(Inclusion.NON_NULL); + WRAPPED_MAPPER.disable(SerializationConfig.Feature.INDENT_OUTPUT); + WRAPPED_MAPPER.enable(SerializationConfig.Feature.WRAP_ROOT_VALUE); + WRAPPED_MAPPER.enable(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE); + WRAPPED_MAPPER.enable(DeserializationConfig.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + WRAPPED_MAPPER.disable(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES); + } + + protected static <T> ObjectMapper getObjectMapper (Class<T> type) { + return type.getAnnotation(JsonRootName.class) == null ? DEFAULT_MAPPER : WRAPPED_MAPPER; + } + + @Override + public <T> OpenStackResponse request(OpenStackRequest<T> request) { + + CloseableHttpClient httpClient = null; //HttpClients.createDefault(); + httpClient = HttpClients.custom().setRedirectStrategy(new HttpClientRedirectStrategy()).build(); + + URI uri = null; + + // Build the URI with query params + try { + URIBuilder uriBuilder = new URIBuilder(request.endpoint() + request.path()); + + for(Map.Entry<String, List<Object> > entry : request.queryParams().entrySet()) { + for (Object o : entry.getValue()) { + uriBuilder.setParameter(entry.getKey(), String.valueOf(o)); + } + } + + uri = uriBuilder.build(); + } catch (URISyntaxException e) { + throw new HttpClientException (e); + } + + HttpEntity entity = null; + if (request.entity() != null) { + // Flatten the entity to a Json string + + try { + // Get appropriate mapper, based on existence of a root element in Entity class + ObjectMapper mapper = getObjectMapper (request.entity().getEntity().getClass()); + + String entityJson = mapper.writeValueAsString (request.entity().getEntity()); + entity = new StringEntity(entityJson, ContentType.create(request.entity().getContentType())); + + LOGGER.debug("Openstack query JSON:"+entityJson); + LOGGER.debug ("Request JSON Body: " + entityJson.replaceAll("\"password\":\"[^\"]*\"", "\"password\":\"***\"")); + + } catch (JsonProcessingException e) { + throw new HttpClientException ("Json processing error on request entity", e); + } catch (IOException e) { + throw new HttpClientException ("Json IO error on request entity", e); + } + } + + // Determine the HttpRequest class based on the method + HttpUriRequest httpRequest; + + switch (request.method()) { + case POST: + HttpPost post = new HttpPost(uri); + post.setEntity (entity); + httpRequest = post; + break; + + case GET: + httpRequest = new HttpGet(uri); + break; + + case PUT: + HttpPut put = new HttpPut(uri); + put.setEntity (entity); + httpRequest = put; + break; + + case DELETE: + httpRequest = new HttpDelete(uri); + break; + + default: + throw new HttpClientException ("Unrecognized HTTP Method: " + request.method()); + } + + for (Entry<String, List<Object>> h : request.headers().entrySet()) { + StringBuilder sb = new StringBuilder(); + for (Object v : h.getValue()) { + sb.append(String.valueOf(v)); + } + httpRequest.addHeader(h.getKey(), sb.toString()); + } + + LOGGER.debug ("Sending HTTP request: " + httpRequest.toString()); + + // Get the Response. But don't get the body entity yet, as this response + // will be wrapped in an HttpClientResponse. The HttpClientResponse + // buffers the body in constructor, so can close the response here. + HttpClientResponse httpClientResponse = null; + CloseableHttpResponse httpResponse = null; + + // Catch known HttpClient exceptions, and wrap them in OpenStack Client Exceptions + // so calling functions can distinguish. Only RuntimeExceptions are allowed. + try { + httpResponse = httpClient.execute(httpRequest); + + LOGGER.debug ("Response status: " + httpResponse.getStatusLine().getStatusCode()); + + httpClientResponse = new HttpClientResponse (httpResponse); + + int status = httpResponse.getStatusLine().getStatusCode(); + if (status == HttpStatus.SC_OK || status == HttpStatus.SC_CREATED || + status == HttpStatus.SC_NO_CONTENT || status == HttpStatus.SC_ACCEPTED) + { + return httpClientResponse; + } + } + catch (HttpResponseException e) { + // What exactly does this mean? It does not appear to get thrown for + // non-2XX responses as documented. + throw new OpenStackResponseException(e.getMessage(), e.getStatusCode()); + } + catch (UnknownHostException e) { + throw new OpenStackConnectException("Unknown Host: " + e.getMessage()); + } + catch (IOException e) { + // Catch all other IOExceptions and throw as OpenStackConnectException + throw new OpenStackConnectException(e.getMessage()); + } + catch (Exception e) { + // Catchall for anything else, must throw as a RuntimeException + LOGGER.error ("Unexpected client exception: " +e.getMessage()); + throw new RuntimeException("Unexpected client exception", e); + } + finally { + // Have the body. Close the stream + if (httpResponse != null) + try { + httpResponse.close(); + } catch (IOException e) { + LOGGER.warn("Unable to close HTTP Response: " + e); + } + } + + // Get here on an error response (4XX-5XX) + throw new OpenStackResponseException(httpResponse.getStatusLine().getReasonPhrase(), + httpResponse.getStatusLine().getStatusCode(), + httpClientResponse); + } } diff --git a/openstack-client-connectors/http-connector/src/main/java/com/woorea/openstack/connector/HttpClientException.java b/openstack-client-connectors/http-connector/src/main/java/com/woorea/openstack/connector/HttpClientException.java index 4c51574..ffb7379 100644 --- a/openstack-client-connectors/http-connector/src/main/java/com/woorea/openstack/connector/HttpClientException.java +++ b/openstack-client-connectors/http-connector/src/main/java/com/woorea/openstack/connector/HttpClientException.java @@ -45,17 +45,17 @@ package com.woorea.openstack.connector; */
public class HttpClientException extends RuntimeException {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 1L;
- public HttpClientException (String s) {
- super (s);
- }
-
- public HttpClientException (Exception e) {
- super ("Caught nested exception in HttpClient", e);
- }
-
- public HttpClientException (String s, Exception e) {
- super (s, e);
- }
+ public HttpClientException (String s) {
+ super (s);
+ }
+
+ public HttpClientException (Exception e) {
+ super ("Caught nested exception in HttpClient", e);
+ }
+
+ public HttpClientException (String s, Exception e) {
+ super (s, e);
+ }
}
diff --git a/openstack-client-connectors/http-connector/src/main/java/com/woorea/openstack/connector/HttpClientRedirectStrategy.java b/openstack-client-connectors/http-connector/src/main/java/com/woorea/openstack/connector/HttpClientRedirectStrategy.java index 2ba17fb..f9aedf5 100644 --- a/openstack-client-connectors/http-connector/src/main/java/com/woorea/openstack/connector/HttpClientRedirectStrategy.java +++ b/openstack-client-connectors/http-connector/src/main/java/com/woorea/openstack/connector/HttpClientRedirectStrategy.java @@ -102,7 +102,7 @@ public class HttpClientRedirectStrategy extends DefaultRedirectStrategy { final HttpRequest request,
final HttpResponse response,
final HttpContext context) throws ProtocolException {
-
+
final URI uri = getLocationURI(request, response, context);
final String method = request.getRequestLine().getMethod();
if (method.equalsIgnoreCase(HttpHead.METHOD_NAME)) {
@@ -113,13 +113,13 @@ public class HttpClientRedirectStrategy extends DefaultRedirectStrategy { final int status = response.getStatusLine().getStatusCode();
- HttpUriRequest newRequest;
- if (status == HttpStatus.SC_TEMPORARY_REDIRECT || status == HttpStatus.SC_MOVED_TEMPORARILY) {
+ HttpUriRequest newRequest;
+ if (status == HttpStatus.SC_TEMPORARY_REDIRECT || status == HttpStatus.SC_MOVED_TEMPORARILY) {
newRequest = RequestBuilder.copy(request).setUri(uri).build();
} else {
newRequest = new HttpGet(uri);
}
- return newRequest;
+ return newRequest;
}
}
}
diff --git a/openstack-client-connectors/http-connector/src/main/java/com/woorea/openstack/connector/HttpClientResponse.java b/openstack-client-connectors/http-connector/src/main/java/com/woorea/openstack/connector/HttpClientResponse.java index 74df0e6..108861a 100644 --- a/openstack-client-connectors/http-connector/src/main/java/com/woorea/openstack/connector/HttpClientResponse.java +++ b/openstack-client-connectors/http-connector/src/main/java/com/woorea/openstack/connector/HttpClientResponse.java @@ -55,8 +55,8 @@ import java.util.Map; public class HttpClientResponse implements OpenStackResponse { - private static Logger LOGGER = Logger.getLogger(HttpClientConnector.class); - + private static Logger LOGGER = Logger.getLogger(HttpClientConnector.class); + private HttpResponse response = null; private String entityBody = null; @@ -66,34 +66,34 @@ public class HttpClientResponse implements OpenStackResponse { // Read the body so InputStream can be closed if (response.getEntity() == null) { - // No body - LOGGER.debug ("No Response Body"); - return; + // No body + LOGGER.debug ("No Response Body"); + return; } - ByteArrayOutputStream responseBody = new ByteArrayOutputStream(); - try { - response.getEntity().writeTo(responseBody); - } catch (IOException e) { - throw new HttpClientException ("Error Reading Response Body", e); - } - entityBody = responseBody.toString(); - LOGGER.debug (entityBody); + ByteArrayOutputStream responseBody = new ByteArrayOutputStream(); + try { + response.getEntity().writeTo(responseBody); + } catch (IOException e) { + throw new HttpClientException ("Error Reading Response Body", e); + } + entityBody = responseBody.toString(); + LOGGER.debug (entityBody); } @Override - public <T> T getEntity (Class<T> returnType) { - // Get appropriate mapper, based on existence of a root element - ObjectMapper mapper = HttpClientConnector.getObjectMapper (returnType); - - T resp = null; - try { - resp = mapper.readValue(entityBody, returnType); - } catch (Exception e) { - throw new HttpClientException ("Caught exception in getEntity", e); - } - return resp; + public <T> T getEntity (Class<T> returnType) { + // Get appropriate mapper, based on existence of a root element + ObjectMapper mapper = HttpClientConnector.getObjectMapper (returnType); + + T resp = null; + try { + resp = mapper.readValue(entityBody, returnType); + } catch (Exception e) { + throw new HttpClientException ("Caught exception in getEntity", e); + } + return resp; } @Override @@ -103,7 +103,7 @@ public class HttpClientResponse implements OpenStackResponse { @Override public InputStream getInputStream() { - return new ByteArrayInputStream (entityBody.getBytes()); + return new ByteArrayInputStream (entityBody.getBytes()); } @Override diff --git a/openstack-client-connectors/jersey-connector/src/main/java/com/woorea/openstack/connector/JerseyConnector.java b/openstack-client-connectors/jersey-connector/src/main/java/com/woorea/openstack/connector/JerseyConnector.java index eb1b3d5..ea22970 100644 --- a/openstack-client-connectors/jersey-connector/src/main/java/com/woorea/openstack/connector/JerseyConnector.java +++ b/openstack-client-connectors/jersey-connector/src/main/java/com/woorea/openstack/connector/JerseyConnector.java @@ -45,76 +45,76 @@ import com.woorea.openstack.base.client.OpenStackResponse; import com.woorea.openstack.base.client.OpenStackResponseException; public class JerseyConnector implements OpenStackClientConnector { - - protected Client client = null; + + protected Client client = null; protected boolean logPassword; private JerseyLoggingFilter logger = new JerseyLoggingFilter(Logger.getLogger("os")); - public JerseyConnector() { - ClientConfig clientConfig = new DefaultClientConfig(); - clientConfig.getClasses().add(JacksonJaxbJsonProvider.class); - clientConfig.getClasses().add(OpenStackObjectMapper.class); - client = Client.create(clientConfig); - } + public JerseyConnector() { + ClientConfig clientConfig = new DefaultClientConfig(); + clientConfig.getClasses().add(JacksonJaxbJsonProvider.class); + clientConfig.getClasses().add(OpenStackObjectMapper.class); + client = Client.create(clientConfig); + } - @Override - public <T> OpenStackResponse request(OpenStackRequest<T> request) { - WebResource target = client.resource(request.endpoint()).path(request.path()); - for(Map.Entry<String, List<Object> > entry : request.queryParams().entrySet()) { - for (Object o : entry.getValue()) { - target = target.queryParam(entry.getKey(), String.valueOf(o)); - } - } - target.addFilter(logger); - MultivaluedMap<String, Object> headers = new OutBoundHeaders(); - for(Map.Entry<String, List<Object>> h : request.headers().entrySet()) { - for(Object v : h.getValue()) { - headers.add(h.getKey(), v); - } - } - if(request.entity() != null && request.entity().getContentType() != null) { - headers.add("Content-Type", request.entity().getContentType()); - } else { - headers.add("Content-Type", "application/json"); - } - try { - ClientResponse response; - if (request.entity() != null && request.entity().getEntity() != null) { - response = target.getHeadHandler().handle(new ClientRequestImpl(target.getURI(), request.method().name(), request.entity().getEntity(), headers)); - } else { - response = target.getHeadHandler().handle(new ClientRequestImpl(target.getURI(), request.method().name(), null, headers)); - } - return new JerseyResponse(response); - } catch (UniformInterfaceException e) { - throw new OpenStackResponseException(e.getResponse().getClientResponseStatus().getReasonPhrase(), e.getResponse().getStatus()); - } - } + @Override + public <T> OpenStackResponse request(OpenStackRequest<T> request) { + WebResource target = client.resource(request.endpoint()).path(request.path()); + for(Map.Entry<String, List<Object> > entry : request.queryParams().entrySet()) { + for (Object o : entry.getValue()) { + target = target.queryParam(entry.getKey(), String.valueOf(o)); + } + } + target.addFilter(logger); + MultivaluedMap<String, Object> headers = new OutBoundHeaders(); + for(Map.Entry<String, List<Object>> h : request.headers().entrySet()) { + for(Object v : h.getValue()) { + headers.add(h.getKey(), v); + } + } + if(request.entity() != null && request.entity().getContentType() != null) { + headers.add("Content-Type", request.entity().getContentType()); + } else { + headers.add("Content-Type", "application/json"); + } + try { + ClientResponse response; + if (request.entity() != null && request.entity().getEntity() != null) { + response = target.getHeadHandler().handle(new ClientRequestImpl(target.getURI(), request.method().name(), request.entity().getEntity(), headers)); + } else { + response = target.getHeadHandler().handle(new ClientRequestImpl(target.getURI(), request.method().name(), null, headers)); + } + return new JerseyResponse(response); + } catch (UniformInterfaceException e) { + throw new OpenStackResponseException(e.getResponse().getClientResponseStatus().getReasonPhrase(), e.getResponse().getStatus()); + } + } - @Provider - public static class OpenStackObjectMapper implements ContextResolver<ObjectMapper> { - static ObjectMapper DEFAULT_MAPPER; - static ObjectMapper WRAPPED_MAPPER; - static { - DEFAULT_MAPPER = new ObjectMapper(); - DEFAULT_MAPPER.setSerializationInclusion(Inclusion.NON_NULL); - DEFAULT_MAPPER.enable(SerializationConfig.Feature.INDENT_OUTPUT); - DEFAULT_MAPPER.enable(DeserializationConfig.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY); - DEFAULT_MAPPER.disable(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES); - DEFAULT_MAPPER.enable(DeserializationConfig.Feature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT); + @Provider + public static class OpenStackObjectMapper implements ContextResolver<ObjectMapper> { + static ObjectMapper DEFAULT_MAPPER; + static ObjectMapper WRAPPED_MAPPER; + static { + DEFAULT_MAPPER = new ObjectMapper(); + DEFAULT_MAPPER.setSerializationInclusion(Inclusion.NON_NULL); + DEFAULT_MAPPER.enable(SerializationConfig.Feature.INDENT_OUTPUT); + DEFAULT_MAPPER.enable(DeserializationConfig.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + DEFAULT_MAPPER.disable(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES); + DEFAULT_MAPPER.enable(DeserializationConfig.Feature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT); - WRAPPED_MAPPER = new ObjectMapper(); - WRAPPED_MAPPER.setSerializationInclusion(Inclusion.NON_NULL); - WRAPPED_MAPPER.enable(SerializationConfig.Feature.INDENT_OUTPUT); - WRAPPED_MAPPER.enable(SerializationConfig.Feature.WRAP_ROOT_VALUE); - WRAPPED_MAPPER.enable(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE); - WRAPPED_MAPPER.enable(DeserializationConfig.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY); - WRAPPED_MAPPER.disable(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES); - WRAPPED_MAPPER.enable(DeserializationConfig.Feature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT); - } - - @Override - public ObjectMapper getContext(Class<?> type) { - return type.getAnnotation(JsonRootName.class) == null ? DEFAULT_MAPPER : WRAPPED_MAPPER; - } - } + WRAPPED_MAPPER = new ObjectMapper(); + WRAPPED_MAPPER.setSerializationInclusion(Inclusion.NON_NULL); + WRAPPED_MAPPER.enable(SerializationConfig.Feature.INDENT_OUTPUT); + WRAPPED_MAPPER.enable(SerializationConfig.Feature.WRAP_ROOT_VALUE); + WRAPPED_MAPPER.enable(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE); + WRAPPED_MAPPER.enable(DeserializationConfig.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + WRAPPED_MAPPER.disable(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES); + WRAPPED_MAPPER.enable(DeserializationConfig.Feature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT); + } + + @Override + public ObjectMapper getContext(Class<?> type) { + return type.getAnnotation(JsonRootName.class) == null ? DEFAULT_MAPPER : WRAPPED_MAPPER; + } + } } diff --git a/openstack-client-connectors/jersey-connector/src/main/java/com/woorea/openstack/connector/JerseyLoggingFilter.java b/openstack-client-connectors/jersey-connector/src/main/java/com/woorea/openstack/connector/JerseyLoggingFilter.java index 6d98005..ffdeb83 100644 --- a/openstack-client-connectors/jersey-connector/src/main/java/com/woorea/openstack/connector/JerseyLoggingFilter.java +++ b/openstack-client-connectors/jersey-connector/src/main/java/com/woorea/openstack/connector/JerseyLoggingFilter.java @@ -8,7 +8,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -42,184 +42,184 @@ import com.sun.jersey.core.util.ReaderWriter; */ public class JerseyLoggingFilter extends ClientFilter { - private final AtomicLong counter = new AtomicLong(0); - private final Logger logger; - - /** - * Constructor - * @param logger the logger to which the request and response are written. - */ - public JerseyLoggingFilter(Logger logger) { - this.logger = logger; - } - - @Override - public ClientResponse handle(ClientRequest request) throws ClientHandlerException { - long id = counter.incrementAndGet(); - logRequest(id, request); - ClientResponse response = getNext().handle(request); - logResponse(id, response); - return response; - } - - /** - * Logs a request. - * @param id the request id (counter) - * @param request the request - */ - private void logRequest(long id, ClientRequest request) { - StringBuilder builder = new StringBuilder(); - - builder.append(String.valueOf(id)); - builder.append(" * Client out-bound request\n"); - - builder.append(String.valueOf(id)); - builder.append(" > "); - builder.append(request.getMethod()); - builder.append(" "); - builder.append(request.getURI().toASCIIString()); - builder.append("\n"); - - // Request headers - - for (Map.Entry<String, List<Object>> entry : request.getHeaders().entrySet()) { - String header = entry.getKey(); - List<Object> values = entry.getValue(); - - if (values.size() == 1) { - builder.append(String.valueOf(id)); - builder.append(" > "); - builder.append(header); - builder.append(": "); - builder.append(ClientRequest.getHeaderValue(values.get(0))); - builder.append("\n"); - } else { - StringBuilder buf = new StringBuilder(); - boolean first = true; - - for(Object value : values) { - if (first) { - first = false; - } else { - buf.append(","); - } - - buf.append(ClientRequest.getHeaderValue(value)); - } - - builder.append(String.valueOf(id)); - builder.append(" > "); - builder.append(header); - builder.append(": "); - builder.append(buf.toString()); - builder.append("\n"); - } - } - - // Request body - - if (request.getEntity() != null) { - request.setAdapter(new JerseyLoggingAdapter(request.getAdapter(), builder)); - } else { - logger.info(builder.toString()); - } - } - - /** - * Logs a response. - * @param id the request id (counter) - * @param response the response - */ - private void logResponse(long id, ClientResponse response) { - StringBuilder builder = new StringBuilder(); - - builder.append(String.valueOf(id)); - builder.append(" * Client in-bound response\n"); - - builder.append(String.valueOf(id)); - builder.append(" < "); - builder.append(String.valueOf(response.getStatus())); - builder.append("\n"); - - // Response headers - - for (Map.Entry<String, List<String>> entry : response.getHeaders().entrySet()) { - String header = entry.getKey(); - for (String value : entry.getValue()) { - builder.append(String.valueOf(id)); - builder.append(" < "); - builder.append(header); - builder.append(": "); - builder.append(value).append("\n"); - } - } - - // Response body - - ByteArrayOutputStream out = new ByteArrayOutputStream(); - InputStream in = response.getEntityInputStream(); - try { - ReaderWriter.writeTo(in, out); - - byte[] requestEntity = out.toByteArray(); - appendToBuffer(builder, requestEntity); - response.setEntityInputStream(new ByteArrayInputStream(requestEntity)); - } catch (IOException ex) { - throw new ClientHandlerException(ex); - } - - logger.info(builder.toString()); - } - - /** - * Appends bytes to the builder. If the bytes contain the password pattern, - * the password is obliterated. - * @param builder the builder - * @param bytes the bytes to append - */ - private void appendToBuffer(StringBuilder builder, byte[] bytes) { - if (bytes.length != 0) { - String s = new String(bytes); - builder.append(s.replaceAll("\"password\".*:.*\"(.*)\"", "\"password\" : \"******\"")); - builder.append("\n"); - } - } - - private class JerseyLoggingAdapter extends AbstractClientRequestAdapter { - private final StringBuilder builder; - - JerseyLoggingAdapter(ClientRequestAdapter adapter, StringBuilder builder) { - super(adapter); - this.builder = builder; - } - - @Override - public OutputStream adapt(ClientRequest request, OutputStream out) throws IOException { - return new JerseyLoggingOutputStream(getAdapter().adapt(request, out), builder); - } - } - - private class JerseyLoggingOutputStream extends OutputStream { - private final OutputStream stream; - private final StringBuilder builder; - private final ByteArrayOutputStream logStream = new ByteArrayOutputStream(); - - JerseyLoggingOutputStream(OutputStream stream, StringBuilder builder) { - this.stream = stream; - this.builder = builder; - } - - @Override - public void write(int value) throws IOException { - logStream.write(value); - stream.write(value); - } - - @Override - public void close() throws IOException { - appendToBuffer(builder, logStream.toByteArray()); - logger.info(builder.toString()); - stream.close(); - } - } + private final AtomicLong counter = new AtomicLong(0); + private final Logger logger; + + /** + * Constructor + * @param logger the logger to which the request and response are written. + */ + public JerseyLoggingFilter(Logger logger) { + this.logger = logger; + } + + @Override + public ClientResponse handle(ClientRequest request) throws ClientHandlerException { + long id = counter.incrementAndGet(); + logRequest(id, request); + ClientResponse response = getNext().handle(request); + logResponse(id, response); + return response; + } + + /** + * Logs a request. + * @param id the request id (counter) + * @param request the request + */ + private void logRequest(long id, ClientRequest request) { + StringBuilder builder = new StringBuilder(); + + builder.append(String.valueOf(id)); + builder.append(" * Client out-bound request\n"); + + builder.append(String.valueOf(id)); + builder.append(" > "); + builder.append(request.getMethod()); + builder.append(" "); + builder.append(request.getURI().toASCIIString()); + builder.append("\n"); + + // Request headers + + for (Map.Entry<String, List<Object>> entry : request.getHeaders().entrySet()) { + String header = entry.getKey(); + List<Object> values = entry.getValue(); + + if (values.size() == 1) { + builder.append(String.valueOf(id)); + builder.append(" > "); + builder.append(header); + builder.append(": "); + builder.append(ClientRequest.getHeaderValue(values.get(0))); + builder.append("\n"); + } else { + StringBuilder buf = new StringBuilder(); + boolean first = true; + + for(Object value : values) { + if (first) { + first = false; + } else { + buf.append(","); + } + + buf.append(ClientRequest.getHeaderValue(value)); + } + + builder.append(String.valueOf(id)); + builder.append(" > "); + builder.append(header); + builder.append(": "); + builder.append(buf.toString()); + builder.append("\n"); + } + } + + // Request body + + if (request.getEntity() != null) { + request.setAdapter(new JerseyLoggingAdapter(request.getAdapter(), builder)); + } else { + logger.info(builder.toString()); + } + } + + /** + * Logs a response. + * @param id the request id (counter) + * @param response the response + */ + private void logResponse(long id, ClientResponse response) { + StringBuilder builder = new StringBuilder(); + + builder.append(String.valueOf(id)); + builder.append(" * Client in-bound response\n"); + + builder.append(String.valueOf(id)); + builder.append(" < "); + builder.append(String.valueOf(response.getStatus())); + builder.append("\n"); + + // Response headers + + for (Map.Entry<String, List<String>> entry : response.getHeaders().entrySet()) { + String header = entry.getKey(); + for (String value : entry.getValue()) { + builder.append(String.valueOf(id)); + builder.append(" < "); + builder.append(header); + builder.append(": "); + builder.append(value).append("\n"); + } + } + + // Response body + + ByteArrayOutputStream out = new ByteArrayOutputStream(); + InputStream in = response.getEntityInputStream(); + try { + ReaderWriter.writeTo(in, out); + + byte[] requestEntity = out.toByteArray(); + appendToBuffer(builder, requestEntity); + response.setEntityInputStream(new ByteArrayInputStream(requestEntity)); + } catch (IOException ex) { + throw new ClientHandlerException(ex); + } + + logger.info(builder.toString()); + } + + /** + * Appends bytes to the builder. If the bytes contain the password pattern, + * the password is obliterated. + * @param builder the builder + * @param bytes the bytes to append + */ + private void appendToBuffer(StringBuilder builder, byte[] bytes) { + if (bytes.length != 0) { + String s = new String(bytes); + builder.append(s.replaceAll("\"password\".*:.*\"(.*)\"", "\"password\" : \"******\"")); + builder.append("\n"); + } + } + + private class JerseyLoggingAdapter extends AbstractClientRequestAdapter { + private final StringBuilder builder; + + JerseyLoggingAdapter(ClientRequestAdapter adapter, StringBuilder builder) { + super(adapter); + this.builder = builder; + } + + @Override + public OutputStream adapt(ClientRequest request, OutputStream out) throws IOException { + return new JerseyLoggingOutputStream(getAdapter().adapt(request, out), builder); + } + } + + private class JerseyLoggingOutputStream extends OutputStream { + private final OutputStream stream; + private final StringBuilder builder; + private final ByteArrayOutputStream logStream = new ByteArrayOutputStream(); + + JerseyLoggingOutputStream(OutputStream stream, StringBuilder builder) { + this.stream = stream; + this.builder = builder; + } + + @Override + public void write(int value) throws IOException { + logStream.write(value); + stream.write(value); + } + + @Override + public void close() throws IOException { + appendToBuffer(builder, logStream.toByteArray()); + logger.info(builder.toString()); + stream.close(); + } + } }
\ No newline at end of file diff --git a/openstack-client-connectors/jersey-connector/src/main/java/com/woorea/openstack/connector/JerseyResponse.java b/openstack-client-connectors/jersey-connector/src/main/java/com/woorea/openstack/connector/JerseyResponse.java index b6ccd04..5b01660 100644 --- a/openstack-client-connectors/jersey-connector/src/main/java/com/woorea/openstack/connector/JerseyResponse.java +++ b/openstack-client-connectors/jersey-connector/src/main/java/com/woorea/openstack/connector/JerseyResponse.java @@ -30,53 +30,53 @@ import com.woorea.openstack.base.client.OpenStackResponseException; public class JerseyResponse implements OpenStackResponse {
- private ClientResponse response;
+ private ClientResponse response;
- public JerseyResponse(ClientResponse response) {
- this.response = response;
- }
+ public JerseyResponse(ClientResponse response) {
+ this.response = response;
+ }
- @Override
- public <T> T getEntity(Class<T> returnType) {
- if(response.getStatus() >= 400) {
- throw new OpenStackResponseException(response.getClientResponseStatus().getReasonPhrase(),
- response.getStatus(), this);
- }
- if(response.hasEntity() && returnType != null && Void.class != returnType) {
- return response.getEntity(returnType);
- } else {
- return null;
- }
- }
+ @Override
+ public <T> T getEntity(Class<T> returnType) {
+ if(response.getStatus() >= 400) {
+ throw new OpenStackResponseException(response.getClientResponseStatus().getReasonPhrase(),
+ response.getStatus(), this);
+ }
+ if(response.hasEntity() && returnType != null && Void.class != returnType) {
+ return response.getEntity(returnType);
+ } else {
+ return null;
+ }
+ }
- @Override
- public <T> T getErrorEntity(Class<T> returnType) {
- if(response.getStatus() >= 400 && response.hasEntity()) {
- return response.getEntity(returnType);
- }
- return null;
- }
+ @Override
+ public <T> T getErrorEntity(Class<T> returnType) {
+ if(response.getStatus() >= 400 && response.hasEntity()) {
+ return response.getEntity(returnType);
+ }
+ return null;
+ }
- @Override
- public InputStream getInputStream() {
- if(response.hasEntity()) {
- return response.getEntityInputStream();
- } else {
- return null;
- }
- }
+ @Override
+ public InputStream getInputStream() {
+ if(response.hasEntity()) {
+ return response.getEntityInputStream();
+ } else {
+ return null;
+ }
+ }
- @Override
- public String header(String name) {
- return response.getHeaders().getFirst(name);
- }
+ @Override
+ public String header(String name) {
+ return response.getHeaders().getFirst(name);
+ }
- @Override
- public Map<String, String> headers() {
- Map<String, String> headers = new HashMap<>();
- for(String k : response.getHeaders().keySet()) {
- headers.put(k, response.getHeaders().getFirst(k));
- }
- return headers;
- }
+ @Override
+ public Map<String, String> headers() {
+ Map<String, String> headers = new HashMap<>();
+ for(String k : response.getHeaders().keySet()) {
+ headers.put(k, response.getHeaders().getFirst(k));
+ }
+ return headers;
+ }
}
diff --git a/openstack-client-connectors/jersey-connector/src/test/java/com/woorea/openstack/connector/JerseyLoggingFilterTest.java b/openstack-client-connectors/jersey-connector/src/test/java/com/woorea/openstack/connector/JerseyLoggingFilterTest.java index 3bd0717..3ebad7c 100644 --- a/openstack-client-connectors/jersey-connector/src/test/java/com/woorea/openstack/connector/JerseyLoggingFilterTest.java +++ b/openstack-client-connectors/jersey-connector/src/test/java/com/woorea/openstack/connector/JerseyLoggingFilterTest.java @@ -56,212 +56,212 @@ import com.sun.jersey.api.client.filter.ClientFilter; public class JerseyLoggingFilterTest { - private static Logger logger; - private static LogFormatter logFormatter; - - @BeforeClass - public static void setUpClass() throws Exception { - logger = Logger.getLogger(JerseyLoggingFilterTest.class.getSimpleName()); - logger.setLevel(Level.ALL); - logger.setUseParentHandlers(false); - - ConsoleHandler handler = new ConsoleHandler(); - logFormatter = new LogFormatter(); - handler.setFormatter(logFormatter); - handler.setLevel(Level.ALL); - logger.addHandler(handler); - } - - @Before - public void setUpTest() { - logFormatter.clearLog(); - } - - /** - * Tests a scenario with no request content (GET). - * @throws Exception for unexpected errors - */ - @Test - public void testGET() throws Exception { - String responseContent = "<response>Hello, I am Eliza.</response>"; - execute("GET", "http://www.onap.org/eliza", null, responseContent); - } - - /** - * Tests a scenario with request content (POST). - * @throws Exception for unexpected errors - */ - @Test - public void testPOST() throws Exception { - String requestContent = "<request>I feel sad.</request>"; - String responseContent = "<response>Do you often feel sad?</response>"; - execute("POST", "http://www.onap.org/eliza", requestContent, responseContent); - } - - /** - * Runs a single test. - * @param httpMethod any HTTP method (POST, GET, ...) - * @param url any URL - * @param requestContent mock request content, possibly null - * @param responseContent mock response content, never null - * @throws Exception for unexpected errors - */ - private void execute(String httpMethod, String url, String requestContent, String responseContent) - throws Exception { - JerseyLoggingFilter loggingFilter = new JerseyLoggingFilter(logger); - - // Mock multi-valued and single valued request headers - - HashMap<String, List<Object>> requestHeaderMap = new HashMap<>(); - requestHeaderMap.put("Accept", Arrays.asList(new Object[]{"application/xml","application/json"})); - - if (requestContent != null) { - requestHeaderMap.put("Content-Type", Arrays.asList(new Object[]{"application/xml"})); - requestHeaderMap.put("Content-Length", Arrays.asList(new Object[]{String.valueOf(requestContent.length())})); - } - - @SuppressWarnings("unchecked") - MultivaluedMap<String, Object> requestHeaders = mock(MultivaluedMap.class); - when(requestHeaders.entrySet()).thenReturn(requestHeaderMap.entrySet()); - - // Mock the request object - - ClientRequest request = mock(TestClientRequest.class); - when(request.getURI()).thenReturn(new URI(url)); - when(request.getMethod()).thenReturn(httpMethod); - when(request.getHeaders()).thenReturn(requestHeaders); - - if (requestContent != null) { - when(request.getEntity()).thenReturn(requestContent.getBytes("UTF-8")); - } - - doCallRealMethod().when(request).setAdapter(any(ClientRequestAdapter.class)); - when(request.getAdapter()).thenCallRealMethod(); - request.setAdapter(new DefaultClientRequestAdapter()); - - // Mock multi-valued and single valued response headers - - HashMap<String, List<String>> responseHeaderMap = new HashMap<>(); - responseHeaderMap.put("Cache-Control", Arrays.asList(new String[]{"no-cache","no-store"})); - responseHeaderMap.put("Content-Type", Arrays.asList(new String[]{"application/xml"})); - responseHeaderMap.put("Content-Length", Arrays.asList(new String[]{String.valueOf(responseContent.length())})); - @SuppressWarnings("unchecked") - MultivaluedMap<String, String> responseHeaders = mock(MultivaluedMap.class); - when(responseHeaders.entrySet()).thenReturn(responseHeaderMap.entrySet()); - - // Mock the response object - - ClientResponse response = mock(ClientResponse.class); - when(response.getStatus()).thenReturn(200); - when(response.getHeaders()).thenReturn(responseHeaders); - when(response.getEntityInputStream()).thenReturn( - new ByteArrayInputStream(responseContent.getBytes("UTF-8"))); - - // Mock a handler that returns the response object and set - // it to be the next filter after the logging filter. - - ClientFilter handler = mock(ClientFilter.class); - when(handler.handle(request)).then(produceResponse(response)); - Method setNext = ClientFilter.class.getDeclaredMethod("setNext", new Class<?>[]{ClientHandler.class}); - setNext.setAccessible(true); - setNext.invoke(loggingFilter, new Object[]{handler}); - - // Run the request into the logging filter - - loggingFilter.handle(request); - - // Validate resulting the log content - - String log = logFormatter.getLog(); - - assertContains(log, "* Client out-bound request"); - assertContains(log, "> " + httpMethod + " " + url); - - for (String header : requestHeaderMap.keySet()) { - assertContains(log, "> " + header + ": "); - } - - if (requestContent != null) { - assertContains(log, requestContent); - } - - assertContains(log, "* Client in-bound response"); - assertContains(log, "< 200"); - - for (String header : responseHeaderMap.keySet()) { - assertContains(log, "< " + header + ": "); - } - - assertContains(log, responseContent); - } - - private void assertContains(String log, String expect) { - assertTrue("Log does not contain '" + expect + "'", log.contains(expect)); - } - - private class DefaultClientRequestAdapter implements ClientRequestAdapter { - @Override - public OutputStream adapt(ClientRequest request, OutputStream out) throws IOException { - return out; - } - } - - private abstract class TestClientRequest extends ClientRequest { - private ClientRequestAdapter adapter; - - @Override - public ClientRequestAdapter getAdapter() { - return adapter; - } - - @Override - public void setAdapter(ClientRequestAdapter adapter) { - this.adapter = adapter; - } - } - - private Answer<ClientResponse> produceResponse(final ClientResponse response) { - return new Answer<ClientResponse>() { - public ClientResponse answer(InvocationOnMock invocation) throws IOException { - ClientRequest request = (ClientRequest) invocation.getArguments()[0]; - byte[] entity = (byte[]) request.getEntity(); - - if (entity != null) { - ClientRequestAdapter adapter = request.getAdapter(); - - OutputStream nullOutputStream = new OutputStream() { - @Override - public void write(int b) { - // Discard - } - }; - - OutputStream outputStream = adapter.adapt(request, nullOutputStream); - outputStream.write(entity); - outputStream.close(); - } - - return response; - } - }; - } - - private static class LogFormatter extends SimpleFormatter { - StringBuilder buffer = new StringBuilder(); - - public synchronized String getLog() { - return buffer.toString(); - } - - public synchronized void clearLog() { - buffer.setLength(0); - } - - @Override - public synchronized String format(LogRecord record) { - String logData = super.format(record); - buffer.append(logData); - return logData; - } - } + private static Logger logger; + private static LogFormatter logFormatter; + + @BeforeClass + public static void setUpClass() throws Exception { + logger = Logger.getLogger(JerseyLoggingFilterTest.class.getSimpleName()); + logger.setLevel(Level.ALL); + logger.setUseParentHandlers(false); + + ConsoleHandler handler = new ConsoleHandler(); + logFormatter = new LogFormatter(); + handler.setFormatter(logFormatter); + handler.setLevel(Level.ALL); + logger.addHandler(handler); + } + + @Before + public void setUpTest() { + logFormatter.clearLog(); + } + + /** + * Tests a scenario with no request content (GET). + * @throws Exception for unexpected errors + */ + @Test + public void testGET() throws Exception { + String responseContent = "<response>Hello, I am Eliza.</response>"; + execute("GET", "http://www.onap.org/eliza", null, responseContent); + } + + /** + * Tests a scenario with request content (POST). + * @throws Exception for unexpected errors + */ + @Test + public void testPOST() throws Exception { + String requestContent = "<request>I feel sad.</request>"; + String responseContent = "<response>Do you often feel sad?</response>"; + execute("POST", "http://www.onap.org/eliza", requestContent, responseContent); + } + + /** + * Runs a single test. + * @param httpMethod any HTTP method (POST, GET, ...) + * @param url any URL + * @param requestContent mock request content, possibly null + * @param responseContent mock response content, never null + * @throws Exception for unexpected errors + */ + private void execute(String httpMethod, String url, String requestContent, String responseContent) + throws Exception { + JerseyLoggingFilter loggingFilter = new JerseyLoggingFilter(logger); + + // Mock multi-valued and single valued request headers + + HashMap<String, List<Object>> requestHeaderMap = new HashMap<>(); + requestHeaderMap.put("Accept", Arrays.asList(new Object[]{"application/xml","application/json"})); + + if (requestContent != null) { + requestHeaderMap.put("Content-Type", Arrays.asList(new Object[]{"application/xml"})); + requestHeaderMap.put("Content-Length", Arrays.asList(new Object[]{String.valueOf(requestContent.length())})); + } + + @SuppressWarnings("unchecked") + MultivaluedMap<String, Object> requestHeaders = mock(MultivaluedMap.class); + when(requestHeaders.entrySet()).thenReturn(requestHeaderMap.entrySet()); + + // Mock the request object + + ClientRequest request = mock(TestClientRequest.class); + when(request.getURI()).thenReturn(new URI(url)); + when(request.getMethod()).thenReturn(httpMethod); + when(request.getHeaders()).thenReturn(requestHeaders); + + if (requestContent != null) { + when(request.getEntity()).thenReturn(requestContent.getBytes("UTF-8")); + } + + doCallRealMethod().when(request).setAdapter(any(ClientRequestAdapter.class)); + when(request.getAdapter()).thenCallRealMethod(); + request.setAdapter(new DefaultClientRequestAdapter()); + + // Mock multi-valued and single valued response headers + + HashMap<String, List<String>> responseHeaderMap = new HashMap<>(); + responseHeaderMap.put("Cache-Control", Arrays.asList(new String[]{"no-cache","no-store"})); + responseHeaderMap.put("Content-Type", Arrays.asList(new String[]{"application/xml"})); + responseHeaderMap.put("Content-Length", Arrays.asList(new String[]{String.valueOf(responseContent.length())})); + @SuppressWarnings("unchecked") + MultivaluedMap<String, String> responseHeaders = mock(MultivaluedMap.class); + when(responseHeaders.entrySet()).thenReturn(responseHeaderMap.entrySet()); + + // Mock the response object + + ClientResponse response = mock(ClientResponse.class); + when(response.getStatus()).thenReturn(200); + when(response.getHeaders()).thenReturn(responseHeaders); + when(response.getEntityInputStream()).thenReturn( + new ByteArrayInputStream(responseContent.getBytes("UTF-8"))); + + // Mock a handler that returns the response object and set + // it to be the next filter after the logging filter. + + ClientFilter handler = mock(ClientFilter.class); + when(handler.handle(request)).then(produceResponse(response)); + Method setNext = ClientFilter.class.getDeclaredMethod("setNext", new Class<?>[]{ClientHandler.class}); + setNext.setAccessible(true); + setNext.invoke(loggingFilter, new Object[]{handler}); + + // Run the request into the logging filter + + loggingFilter.handle(request); + + // Validate resulting the log content + + String log = logFormatter.getLog(); + + assertContains(log, "* Client out-bound request"); + assertContains(log, "> " + httpMethod + " " + url); + + for (String header : requestHeaderMap.keySet()) { + assertContains(log, "> " + header + ": "); + } + + if (requestContent != null) { + assertContains(log, requestContent); + } + + assertContains(log, "* Client in-bound response"); + assertContains(log, "< 200"); + + for (String header : responseHeaderMap.keySet()) { + assertContains(log, "< " + header + ": "); + } + + assertContains(log, responseContent); + } + + private void assertContains(String log, String expect) { + assertTrue("Log does not contain '" + expect + "'", log.contains(expect)); + } + + private class DefaultClientRequestAdapter implements ClientRequestAdapter { + @Override + public OutputStream adapt(ClientRequest request, OutputStream out) throws IOException { + return out; + } + } + + private abstract class TestClientRequest extends ClientRequest { + private ClientRequestAdapter adapter; + + @Override + public ClientRequestAdapter getAdapter() { + return adapter; + } + + @Override + public void setAdapter(ClientRequestAdapter adapter) { + this.adapter = adapter; + } + } + + private Answer<ClientResponse> produceResponse(final ClientResponse response) { + return new Answer<ClientResponse>() { + public ClientResponse answer(InvocationOnMock invocation) throws IOException { + ClientRequest request = (ClientRequest) invocation.getArguments()[0]; + byte[] entity = (byte[]) request.getEntity(); + + if (entity != null) { + ClientRequestAdapter adapter = request.getAdapter(); + + OutputStream nullOutputStream = new OutputStream() { + @Override + public void write(int b) { + // Discard + } + }; + + OutputStream outputStream = adapter.adapt(request, nullOutputStream); + outputStream.write(entity); + outputStream.close(); + } + + return response; + } + }; + } + + private static class LogFormatter extends SimpleFormatter { + StringBuilder buffer = new StringBuilder(); + + public synchronized String getLog() { + return buffer.toString(); + } + + public synchronized void clearLog() { + buffer.setLength(0); + } + + @Override + public synchronized String format(LogRecord record) { + String logData = super.format(record); + buffer.append(logData); + return logData; + } + } }
\ No newline at end of file diff --git a/openstack-client-connectors/jersey2-connector/src/main/java/com/woorea/openstack/connector/JaxRs20Connector.java b/openstack-client-connectors/jersey2-connector/src/main/java/com/woorea/openstack/connector/JaxRs20Connector.java index d18a64f..b1b528f 100644 --- a/openstack-client-connectors/jersey2-connector/src/main/java/com/woorea/openstack/connector/JaxRs20Connector.java +++ b/openstack-client-connectors/jersey2-connector/src/main/java/com/woorea/openstack/connector/JaxRs20Connector.java @@ -37,45 +37,45 @@ import com.woorea.openstack.base.client.OpenStackResponseException; public class JaxRs20Connector implements OpenStackClientConnector { - protected Client client = OpenStack.CLIENT; + protected Client client = OpenStack.CLIENT; private LoggingFilter logger = new LoggingFilter(Logger.getLogger("os"), 10000); - @Override - public <T> OpenStackResponse request(OpenStackRequest<T> request) { - WebTarget target = client.target(request.endpoint()).path(request.path()); + @Override + public <T> OpenStackResponse request(OpenStackRequest<T> request) { + WebTarget target = client.target(request.endpoint()).path(request.path()); - for(Map.Entry<String, List<Object> > entry : request.queryParams().entrySet()) { - for (Object o : entry.getValue()) { - target = target.queryParam(entry.getKey(), o); - } - } + for(Map.Entry<String, List<Object> > entry : request.queryParams().entrySet()) { + for (Object o : entry.getValue()) { + target = target.queryParam(entry.getKey(), o); + } + } target.register(logger); - Invocation.Builder invocation = target.request(); + Invocation.Builder invocation = target.request(); - for(Map.Entry<String, List<Object>> h : request.headers().entrySet()) { - StringBuilder sb = new StringBuilder(); - for(Object v : h.getValue()) { - sb.append(String.valueOf(v)); - } - invocation.header(h.getKey(), sb); - } + for(Map.Entry<String, List<Object>> h : request.headers().entrySet()) { + StringBuilder sb = new StringBuilder(); + for(Object v : h.getValue()) { + sb.append(String.valueOf(v)); + } + invocation.header(h.getKey(), sb); + } - Entity<?> entity = (request.entity() == null) ? null : - Entity.entity(request.entity().getEntity(), request.entity().getContentType()); + Entity<?> entity = (request.entity() == null) ? null : + Entity.entity(request.entity().getEntity(), request.entity().getContentType()); - try { - if (entity != null) { - return new JaxRs20Response(invocation.method(request.method().name(), entity)); - } else { - if(HttpMethod.PUT == request.method()) { - return new JaxRs20Response(invocation.method(request.method().name(), Entity.entity("", MediaType.APPLICATION_JSON))); - } else { - return new JaxRs20Response(invocation.method(request.method().name())); - } - } - } catch (ClientErrorException e) { - throw new OpenStackResponseException(e.getResponse() - .getStatusInfo().toString(), e.getResponse().getStatus()); - } - } + try { + if (entity != null) { + return new JaxRs20Response(invocation.method(request.method().name(), entity)); + } else { + if(HttpMethod.PUT == request.method()) { + return new JaxRs20Response(invocation.method(request.method().name(), Entity.entity("", MediaType.APPLICATION_JSON))); + } else { + return new JaxRs20Response(invocation.method(request.method().name())); + } + } + } catch (ClientErrorException e) { + throw new OpenStackResponseException(e.getResponse() + .getStatusInfo().toString(), e.getResponse().getStatus()); + } + } } diff --git a/openstack-client-connectors/jersey2-connector/src/main/java/com/woorea/openstack/connector/JaxRs20Response.java b/openstack-client-connectors/jersey2-connector/src/main/java/com/woorea/openstack/connector/JaxRs20Response.java index b51c833..2b1820e 100644 --- a/openstack-client-connectors/jersey2-connector/src/main/java/com/woorea/openstack/connector/JaxRs20Response.java +++ b/openstack-client-connectors/jersey2-connector/src/main/java/com/woorea/openstack/connector/JaxRs20Response.java @@ -30,48 +30,48 @@ import com.woorea.openstack.base.client.OpenStackResponse; import com.woorea.openstack.base.client.OpenStackResponseException; public class JaxRs20Response implements OpenStackResponse { - - private Response response; - - public JaxRs20Response(Response response) { - this.response = response; - } + + private Response response; + + public JaxRs20Response(Response response) { + this.response = response; + } - @Override - public <T> T getEntity(Class<T> returnType) { - if(response.getStatus() >= 400) { - throw new OpenStackResponseException(response.getStatusInfo().getReasonPhrase(), - response.getStatusInfo().getStatusCode(), this); - } - return response.readEntity(returnType); - } + @Override + public <T> T getEntity(Class<T> returnType) { + if(response.getStatus() >= 400) { + throw new OpenStackResponseException(response.getStatusInfo().getReasonPhrase(), + response.getStatusInfo().getStatusCode(), this); + } + return response.readEntity(returnType); + } - @Override - public <T> T getErrorEntity(Class<T> returnType) { - if(response.getStatus() >= 400 && response.hasEntity()) { - return response.readEntity(returnType); - } - return null; - } - + @Override + public <T> T getErrorEntity(Class<T> returnType) { + if(response.getStatus() >= 400 && response.hasEntity()) { + return response.readEntity(returnType); + } + return null; + } + - @Override - public InputStream getInputStream() { - return (InputStream) response.getEntity(); - } + @Override + public InputStream getInputStream() { + return (InputStream) response.getEntity(); + } - @Override - public String header(String name) { - return response.getHeaderString(name); - } + @Override + public String header(String name) { + return response.getHeaderString(name); + } - @Override - public Map<String, String> headers() { - Map<String, String> headers = new HashMap<>(); - for(String k : response.getHeaders().keySet()) { - headers.put(k, response.getHeaderString(k)); - } - return headers; - } + @Override + public Map<String, String> headers() { + Map<String, String> headers = new HashMap<>(); + for(String k : response.getHeaders().keySet()) { + headers.put(k, response.getHeaderString(k)); + } + return headers; + } } diff --git a/openstack-client-connectors/jersey2-connector/src/main/java/com/woorea/openstack/connector/OpenStack.java b/openstack-client-connectors/jersey2-connector/src/main/java/com/woorea/openstack/connector/OpenStack.java index 2ec564c..22ba5e4 100644 --- a/openstack-client-connectors/jersey2-connector/src/main/java/com/woorea/openstack/connector/OpenStack.java +++ b/openstack-client-connectors/jersey2-connector/src/main/java/com/woorea/openstack/connector/OpenStack.java @@ -35,21 +35,21 @@ import org.glassfish.jersey.jackson.JacksonFeature; public class OpenStack { - public static Client CLIENT; - - public static ObjectMapper DEFAULT_MAPPER; - - public static ObjectMapper WRAPPED_MAPPER; - - static { - initialize(); - } - - private static void initialize() { - - /* - //class MyX509TrustManager implements X509TrustManager - TrustManager mytm[] = null; + public static Client CLIENT; + + public static ObjectMapper DEFAULT_MAPPER; + + public static ObjectMapper WRAPPED_MAPPER; + + static { + initialize(); + } + + private static void initialize() { + + /* + //class MyX509TrustManager implements X509TrustManager + TrustManager mytm[] = null; KeyManager mykm[] = null; try { @@ -58,71 +58,71 @@ public class OpenStack { } catch (Exception ex) { } - - SSLContext context = null; + + SSLContext context = null; context = SSLContext.getInstance("SSL"); context.init(mykm, mytm, null); - - */ - - try { - - SSLContext context; + + */ + + try { + + SSLContext context; context = SSLContext.getInstance("SSL"); context.init(null, null, null); SslConfigurator sslConfig = SslConfigurator.newInstance(); - /* + /* .trustStoreFile("./truststore_client") .trustStorePassword("asdfgh") .keyStoreFile("./keystore_client") .keyPassword("asdfgh"); */ - //old: CLIENT.property(ClientProperties.SSL_CONFIG, new SslConfig(context)); + //old: CLIENT.property(ClientProperties.SSL_CONFIG, new SslConfig(context)); CLIENT = ClientBuilder.newBuilder().sslContext(sslConfig.createSSLContext()).build(); - - DEFAULT_MAPPER = new ObjectMapper(); - - DEFAULT_MAPPER.setSerializationInclusion(Inclusion.NON_NULL); - DEFAULT_MAPPER.enable(SerializationConfig.Feature.INDENT_OUTPUT); - DEFAULT_MAPPER.enable(DeserializationConfig.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY); - DEFAULT_MAPPER.disable(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES); - DEFAULT_MAPPER.enable(DeserializationConfig.Feature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT); - - WRAPPED_MAPPER = new ObjectMapper(); - - WRAPPED_MAPPER.setSerializationInclusion(Inclusion.NON_NULL); - WRAPPED_MAPPER.enable(SerializationConfig.Feature.INDENT_OUTPUT); - WRAPPED_MAPPER.enable(SerializationConfig.Feature.WRAP_ROOT_VALUE); - WRAPPED_MAPPER.enable(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE); - WRAPPED_MAPPER.enable(DeserializationConfig.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY); - WRAPPED_MAPPER.disable(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES); - WRAPPED_MAPPER.enable(DeserializationConfig.Feature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT); - - CLIENT.register(new JacksonFeature()).register(new ContextResolver<ObjectMapper>() { + + DEFAULT_MAPPER = new ObjectMapper(); + + DEFAULT_MAPPER.setSerializationInclusion(Inclusion.NON_NULL); + DEFAULT_MAPPER.enable(SerializationConfig.Feature.INDENT_OUTPUT); + DEFAULT_MAPPER.enable(DeserializationConfig.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + DEFAULT_MAPPER.disable(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES); + DEFAULT_MAPPER.enable(DeserializationConfig.Feature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT); + + WRAPPED_MAPPER = new ObjectMapper(); + + WRAPPED_MAPPER.setSerializationInclusion(Inclusion.NON_NULL); + WRAPPED_MAPPER.enable(SerializationConfig.Feature.INDENT_OUTPUT); + WRAPPED_MAPPER.enable(SerializationConfig.Feature.WRAP_ROOT_VALUE); + WRAPPED_MAPPER.enable(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE); + WRAPPED_MAPPER.enable(DeserializationConfig.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + WRAPPED_MAPPER.disable(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES); + WRAPPED_MAPPER.enable(DeserializationConfig.Feature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT); + + CLIENT.register(new JacksonFeature()).register(new ContextResolver<ObjectMapper>() { - @Override - public ObjectMapper getContext(Class<?> type) { - return type.getAnnotation(JsonRootName.class) == null ? DEFAULT_MAPPER : WRAPPED_MAPPER; - } - - }); - - CLIENT.register(new ClientRequestFilter() { - - @Override - public void filter(ClientRequestContext requestContext) throws IOException { - requestContext.getHeaders().remove("Content-Language"); - requestContext.getHeaders().remove("Content-Encoding"); - } - }); - - } catch(Exception e) { - throw new RuntimeException(e.getMessage(), e); - } - - } + @Override + public ObjectMapper getContext(Class<?> type) { + return type.getAnnotation(JsonRootName.class) == null ? DEFAULT_MAPPER : WRAPPED_MAPPER; + } + + }); + + CLIENT.register(new ClientRequestFilter() { + + @Override + public void filter(ClientRequestContext requestContext) throws IOException { + requestContext.getHeaders().remove("Content-Language"); + requestContext.getHeaders().remove("Content-Encoding"); + } + }); + + } catch(Exception e) { + throw new RuntimeException(e.getMessage(), e); + } + + } } diff --git a/openstack-client-connectors/resteasy-connector/src/main/java/com/woorea/openstack/connector/RESTEasyConnector.java b/openstack-client-connectors/resteasy-connector/src/main/java/com/woorea/openstack/connector/RESTEasyConnector.java index e613ad2..1f9c0de 100644 --- a/openstack-client-connectors/resteasy-connector/src/main/java/com/woorea/openstack/connector/RESTEasyConnector.java +++ b/openstack-client-connectors/resteasy-connector/src/main/java/com/woorea/openstack/connector/RESTEasyConnector.java @@ -44,102 +44,102 @@ import com.woorea.openstack.base.client.OpenStackResponseException; public class RESTEasyConnector implements OpenStackClientConnector { - public static ObjectMapper DEFAULT_MAPPER; - - public static ObjectMapper WRAPPED_MAPPER; - - static class OpenStackProviderFactory extends ResteasyProviderFactory { - - private JacksonJsonProvider jsonProvider; - private InputStreamProvider streamProvider; - - public OpenStackProviderFactory() { - super(); - - addContextResolver(new ContextResolver<ObjectMapper>() { - @Override - public ObjectMapper getContext(Class<?> type) { - return type.getAnnotation(JsonRootName.class) == null ? DEFAULT_MAPPER : WRAPPED_MAPPER; - } - }); - - jsonProvider = new JacksonJsonProvider(); - addMessageBodyReader(jsonProvider); - addMessageBodyWriter(jsonProvider); - - streamProvider = new InputStreamProvider(); - addMessageBodyReader(streamProvider); - addMessageBodyWriter(streamProvider); - } - - } - - private static OpenStackProviderFactory providerFactory; - - static { - DEFAULT_MAPPER = new ObjectMapper(); - - DEFAULT_MAPPER.setSerializationInclusion(Inclusion.NON_NULL); - DEFAULT_MAPPER.enable(SerializationConfig.Feature.INDENT_OUTPUT); - DEFAULT_MAPPER.enable(DeserializationConfig.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY); - DEFAULT_MAPPER.disable(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES); - DEFAULT_MAPPER.enable(DeserializationConfig.Feature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT); - - WRAPPED_MAPPER = new ObjectMapper(); - - WRAPPED_MAPPER.setSerializationInclusion(Inclusion.NON_NULL); - WRAPPED_MAPPER.enable(SerializationConfig.Feature.INDENT_OUTPUT); - WRAPPED_MAPPER.enable(SerializationConfig.Feature.WRAP_ROOT_VALUE); - WRAPPED_MAPPER.enable(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE); - WRAPPED_MAPPER.enable(DeserializationConfig.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY); - WRAPPED_MAPPER.disable(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES); - WRAPPED_MAPPER.enable(DeserializationConfig.Feature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT); - - providerFactory = new OpenStackProviderFactory(); - } - - @Override - public <T> OpenStackResponse request(OpenStackRequest<T> request) { - ClientRequest client = new ClientRequest(UriBuilder.fromUri(request.endpoint() + "/" + request.path()), - ClientRequest.getDefaultExecutor(), providerFactory); - - for(Map.Entry<String, List<Object> > entry : request.queryParams().entrySet()) { - for (Object o : entry.getValue()) { - client = client.queryParameter(entry.getKey(), String.valueOf(o)); - } - } - - for (Entry<String, List<Object>> h : request.headers().entrySet()) { - StringBuilder sb = new StringBuilder(); - for (Object v : h.getValue()) { - sb.append(String.valueOf(v)); - } - client.header(h.getKey(), sb); - } - - if (request.entity() != null) { - client.body(request.entity().getContentType(), request.entity().getEntity()); - } - - ClientResponse<T> response; - - try { - response = client.httpMethod(request.method().name(), request.returnType()); - } catch (Exception e) { - throw new RuntimeException("Unexpected client exception", e); - } - - if (response.getStatus() == HttpStatus.SC_OK - || response.getStatus() == HttpStatus.SC_CREATED - || response.getStatus() == HttpStatus.SC_NO_CONTENT - || response.getStatus() == HttpStatus.SC_ACCEPTED) { - return new RESTEasyResponse(client, response); - } - - response.releaseConnection(); - - throw new OpenStackResponseException(response.getResponseStatus() - .getReasonPhrase(), response.getStatus()); - } + public static ObjectMapper DEFAULT_MAPPER; + + public static ObjectMapper WRAPPED_MAPPER; + + static class OpenStackProviderFactory extends ResteasyProviderFactory { + + private JacksonJsonProvider jsonProvider; + private InputStreamProvider streamProvider; + + public OpenStackProviderFactory() { + super(); + + addContextResolver(new ContextResolver<ObjectMapper>() { + @Override + public ObjectMapper getContext(Class<?> type) { + return type.getAnnotation(JsonRootName.class) == null ? DEFAULT_MAPPER : WRAPPED_MAPPER; + } + }); + + jsonProvider = new JacksonJsonProvider(); + addMessageBodyReader(jsonProvider); + addMessageBodyWriter(jsonProvider); + + streamProvider = new InputStreamProvider(); + addMessageBodyReader(streamProvider); + addMessageBodyWriter(streamProvider); + } + + } + + private static OpenStackProviderFactory providerFactory; + + static { + DEFAULT_MAPPER = new ObjectMapper(); + + DEFAULT_MAPPER.setSerializationInclusion(Inclusion.NON_NULL); + DEFAULT_MAPPER.enable(SerializationConfig.Feature.INDENT_OUTPUT); + DEFAULT_MAPPER.enable(DeserializationConfig.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + DEFAULT_MAPPER.disable(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES); + DEFAULT_MAPPER.enable(DeserializationConfig.Feature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT); + + WRAPPED_MAPPER = new ObjectMapper(); + + WRAPPED_MAPPER.setSerializationInclusion(Inclusion.NON_NULL); + WRAPPED_MAPPER.enable(SerializationConfig.Feature.INDENT_OUTPUT); + WRAPPED_MAPPER.enable(SerializationConfig.Feature.WRAP_ROOT_VALUE); + WRAPPED_MAPPER.enable(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE); + WRAPPED_MAPPER.enable(DeserializationConfig.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + WRAPPED_MAPPER.disable(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES); + WRAPPED_MAPPER.enable(DeserializationConfig.Feature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT); + + providerFactory = new OpenStackProviderFactory(); + } + + @Override + public <T> OpenStackResponse request(OpenStackRequest<T> request) { + ClientRequest client = new ClientRequest(UriBuilder.fromUri(request.endpoint() + "/" + request.path()), + ClientRequest.getDefaultExecutor(), providerFactory); + + for(Map.Entry<String, List<Object> > entry : request.queryParams().entrySet()) { + for (Object o : entry.getValue()) { + client = client.queryParameter(entry.getKey(), String.valueOf(o)); + } + } + + for (Entry<String, List<Object>> h : request.headers().entrySet()) { + StringBuilder sb = new StringBuilder(); + for (Object v : h.getValue()) { + sb.append(String.valueOf(v)); + } + client.header(h.getKey(), sb); + } + + if (request.entity() != null) { + client.body(request.entity().getContentType(), request.entity().getEntity()); + } + + ClientResponse<T> response; + + try { + response = client.httpMethod(request.method().name(), request.returnType()); + } catch (Exception e) { + throw new RuntimeException("Unexpected client exception", e); + } + + if (response.getStatus() == HttpStatus.SC_OK + || response.getStatus() == HttpStatus.SC_CREATED + || response.getStatus() == HttpStatus.SC_NO_CONTENT + || response.getStatus() == HttpStatus.SC_ACCEPTED) { + return new RESTEasyResponse(client, response); + } + + response.releaseConnection(); + + throw new OpenStackResponseException(response.getResponseStatus() + .getReasonPhrase(), response.getStatus()); + } } diff --git a/openstack-client-connectors/resteasy-connector/src/main/java/com/woorea/openstack/connector/RESTEasyInputStream.java b/openstack-client-connectors/resteasy-connector/src/main/java/com/woorea/openstack/connector/RESTEasyInputStream.java index 0976ef6..0e1e9e9 100644 --- a/openstack-client-connectors/resteasy-connector/src/main/java/com/woorea/openstack/connector/RESTEasyInputStream.java +++ b/openstack-client-connectors/resteasy-connector/src/main/java/com/woorea/openstack/connector/RESTEasyInputStream.java @@ -26,28 +26,28 @@ import org.jboss.resteasy.client.ClientExecutor; public class RESTEasyInputStream extends FilterInputStream { - protected ClientExecutor clientExecutor; - - public RESTEasyInputStream(InputStream inputStream, ClientExecutor clientExecutor) { - super(inputStream); - this.clientExecutor = clientExecutor; - } - - @Override - public void close() throws IOException { - try { - clientExecutor.close(); - } catch (Exception e) { - // Silently skip errors in the socket close errors - } - - try { - super.close(); - } catch (SocketException e) { - // We expect this exception because the socket is closed - } catch (IllegalStateException e) { - // We expect this exception because the socket is closed (httpclient 4.2) - } - } + protected ClientExecutor clientExecutor; + + public RESTEasyInputStream(InputStream inputStream, ClientExecutor clientExecutor) { + super(inputStream); + this.clientExecutor = clientExecutor; + } + + @Override + public void close() throws IOException { + try { + clientExecutor.close(); + } catch (Exception e) { + // Silently skip errors in the socket close errors + } + + try { + super.close(); + } catch (SocketException e) { + // We expect this exception because the socket is closed + } catch (IllegalStateException e) { + // We expect this exception because the socket is closed (httpclient 4.2) + } + } } diff --git a/openstack-client-connectors/resteasy-connector/src/main/java/com/woorea/openstack/connector/RESTEasyResponse.java b/openstack-client-connectors/resteasy-connector/src/main/java/com/woorea/openstack/connector/RESTEasyResponse.java index 344317f..ced748e 100644 --- a/openstack-client-connectors/resteasy-connector/src/main/java/com/woorea/openstack/connector/RESTEasyResponse.java +++ b/openstack-client-connectors/resteasy-connector/src/main/java/com/woorea/openstack/connector/RESTEasyResponse.java @@ -52,7 +52,7 @@ public class RESTEasyResponse implements OpenStackResponse { @Override public InputStream getInputStream() { - return new RESTEasyInputStream((InputStream) response.getEntity(InputStream.class), client.getExecutor()); + return new RESTEasyInputStream((InputStream) response.getEntity(InputStream.class), client.getExecutor()); } @Override diff --git a/openstack-client/src/main/java/com/woorea/openstack/base/client/Entity.java b/openstack-client/src/main/java/com/woorea/openstack/base/client/Entity.java index 66130df..58ba733 100644 --- a/openstack-client/src/main/java/com/woorea/openstack/base/client/Entity.java +++ b/openstack-client/src/main/java/com/woorea/openstack/base/client/Entity.java @@ -20,51 +20,51 @@ import java.io.InputStream; public class Entity<T> { - - private T entity; - - private String contentType; - - public static <T> Entity<T> json(T entity) { - return new Entity<T>(entity, "application/json"); - } - - public static <T> Entity<T> stream(T entity) { - return new Entity<T>(entity, "application/octet-stream"); - } + + private T entity; + + private String contentType; + + public static <T> Entity<T> json(T entity) { + return new Entity<T>(entity, "application/json"); + } + + public static <T> Entity<T> stream(T entity) { + return new Entity<T>(entity, "application/octet-stream"); + } - public Entity(T entity, String contentType) { - super(); - this.entity = entity; - this.contentType = contentType; - } + public Entity(T entity, String contentType) { + super(); + this.entity = entity; + this.contentType = contentType; + } - /** - * @return the entity - */ - public T getEntity() { - return entity; - } + /** + * @return the entity + */ + public T getEntity() { + return entity; + } - /** - * @param entity the entity to set - */ - public void setEntity(T entity) { - this.entity = entity; - } + /** + * @param entity the entity to set + */ + public void setEntity(T entity) { + this.entity = entity; + } - /** - * @return the contentType - */ - public String getContentType() { - return contentType; - } + /** + * @return the contentType + */ + public String getContentType() { + return contentType; + } - /** - * @param contentType the contentType to set - */ - public void setContentType(String contentType) { - this.contentType = contentType; - } - + /** + * @param contentType the contentType to set + */ + public void setContentType(String contentType) { + this.contentType = contentType; + } + } diff --git a/openstack-client/src/main/java/com/woorea/openstack/base/client/HttpMethod.java b/openstack-client/src/main/java/com/woorea/openstack/base/client/HttpMethod.java index 200aaa9..dec8c3f 100644 --- a/openstack-client/src/main/java/com/woorea/openstack/base/client/HttpMethod.java +++ b/openstack-client/src/main/java/com/woorea/openstack/base/client/HttpMethod.java @@ -17,5 +17,5 @@ package com.woorea.openstack.base.client; public enum HttpMethod { - HEAD, GET, POST, PUT, PATCH, DELETE, OPTIONS, TRACE + HEAD, GET, POST, PUT, PATCH, DELETE, OPTIONS, TRACE } diff --git a/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackBaseException.java b/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackBaseException.java index 656c50b..c852ecf 100644 --- a/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackBaseException.java +++ b/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackBaseException.java @@ -45,18 +45,18 @@ package com.woorea.openstack.base.client; */
public abstract class OpenStackBaseException extends RuntimeException
{
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 1L;
- /*
- * Implement only the basic constructors
- */
- public OpenStackBaseException () {}
-
- public OpenStackBaseException(String message) {
- super(message);
- }
+ /*
+ * Implement only the basic constructors
+ */
+ public OpenStackBaseException () {}
+
+ public OpenStackBaseException(String message) {
+ super(message);
+ }
- public OpenStackBaseException(String message, Throwable cause) {
- super(message, cause);
- }
+ public OpenStackBaseException(String message, Throwable cause) {
+ super(message, cause);
+ }
}
diff --git a/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackClient.java b/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackClient.java index 7d5f14f..89c7840 100644 --- a/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackClient.java +++ b/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackClient.java @@ -24,83 +24,85 @@ import java.util.Properties; import java.util.ServiceLoader; public class OpenStackClient { - - protected String endpoint; - - protected OpenStackTokenProvider tokenProvider; - - protected static int AUTHENTICATION_RETRIES = 1; - - protected OpenStackClientConnector connector; - - protected Properties properties = new Properties(); - - protected static OpenStackClientConnector DEFAULT_CONNECTOR; - - static { - ServiceLoader<OpenStackClientConnector> connectorLoader; - connectorLoader = ServiceLoader.load(OpenStackClientConnector.class); - - for (OpenStackClientConnector clientConnector : connectorLoader) { - DEFAULT_CONNECTOR = clientConnector; - break; - } - } - - public OpenStackClient(String endpoint) { - this.endpoint = endpoint; - this.connector = DEFAULT_CONNECTOR; - } - - public OpenStackClient(String endpoint, OpenStackClientConnector connector) { - this.endpoint = endpoint; - this.connector = (connector == null) ? DEFAULT_CONNECTOR : connector; - } - - public <T> OpenStackResponse request(OpenStackRequest<T> request) { - OpenStackResponseException authException = null; - System.out.println("Openstack query:"+request.toString()); - for (int i = 0; i <= AUTHENTICATION_RETRIES; i++) { - request.endpoint(endpoint); - - if (tokenProvider != null) { - request.header("X-Auth-Token", tokenProvider.getToken()); - } - - try { - return connector.request(request); - } catch (OpenStackResponseException e) { - if (e.getStatus() != OpenStackResponseStatus.NOT_AUTHORIZED - || tokenProvider == null) { - throw e; - } - authException = e; - tokenProvider.expireToken(); - } - } - - throw authException; - } - - public <T> T execute(OpenStackRequest<T> request) { - OpenStackResponse response = request(request); - return (request.returnType() != null && request.returnType() != Void.class) ? response.getEntity(request.returnType()) : null; - } - - public void property(String property, String value) { - properties.put(property, value); - } - - public void setTokenProvider(OpenStackTokenProvider tokenProvider) { - this.tokenProvider = tokenProvider; - } - - public void token(String token) { - setTokenProvider(new OpenStackSimpleTokenProvider(token)); - } - - public <R> OpenStackRequest<R> get(String path, Class<R> returnType) { - return new OpenStackRequest<>(this, HttpMethod.GET, path, null, returnType); - } - + + protected String endpoint; + + protected OpenStackTokenProvider tokenProvider; + + protected static int AUTHENTICATION_RETRIES = 1; + + protected OpenStackClientConnector connector; + + protected Properties properties = new Properties(); + + protected static OpenStackClientConnector DEFAULT_CONNECTOR; + + static { + ServiceLoader<OpenStackClientConnector> connectorLoader; + connectorLoader = ServiceLoader.load(OpenStackClientConnector.class); + + for (OpenStackClientConnector clientConnector : connectorLoader) { + DEFAULT_CONNECTOR = clientConnector; + break; + } + } + + public OpenStackClient(String endpoint) { + this.endpoint = endpoint; + this.connector = DEFAULT_CONNECTOR; + } + + public OpenStackClient(String endpoint, OpenStackClientConnector connector) { + this.endpoint = endpoint; + this.connector = (connector == null) ? DEFAULT_CONNECTOR : connector; + } + + public <T> OpenStackResponse request(OpenStackRequest<T> request) { + OpenStackResponseException authException = null; + System.out.println("Openstack query:"+request.toString()); + for (int i = 0; i <= AUTHENTICATION_RETRIES; i++) { + request.endpoint(endpoint); + + if (tokenProvider != null) { + request.header("X-Auth-Token", tokenProvider.getToken()); + } + + try { + return connector.request(request); + } catch (OpenStackResponseException e) { + if (e.getStatus() != OpenStackResponseStatus.NOT_AUTHORIZED + || tokenProvider == null) { + throw e; + } + authException = e; + tokenProvider.expireToken(); + } + } + if(null == authException){ + authException = new OpenStackResponseException("Unknown issue",500); + } + throw authException; + } + + public <T> T execute(OpenStackRequest<T> request) { + OpenStackResponse response = request(request); + return (request.returnType() != null && request.returnType() != Void.class) ? response.getEntity(request.returnType()) : null; + } + + public void property(String property, String value) { + properties.put(property, value); + } + + public void setTokenProvider(OpenStackTokenProvider tokenProvider) { + this.tokenProvider = tokenProvider; + } + + public void token(String token) { + setTokenProvider(new OpenStackSimpleTokenProvider(token)); + } + + public <R> OpenStackRequest<R> get(String path, Class<R> returnType) { + return new OpenStackRequest<>(this, HttpMethod.GET, path, null, returnType); + } + } diff --git a/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackClientConnector.java b/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackClientConnector.java index 5b98440..0e4ae55 100644 --- a/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackClientConnector.java +++ b/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackClientConnector.java @@ -19,6 +19,6 @@ package com.woorea.openstack.base.client; public interface OpenStackClientConnector { - public <T> OpenStackResponse request(OpenStackRequest<T> request); + public <T> OpenStackResponse request(OpenStackRequest<T> request); } diff --git a/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackCommand.java b/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackCommand.java index 24f34ea..c66b548 100644 --- a/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackCommand.java +++ b/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackCommand.java @@ -19,6 +19,6 @@ package com.woorea.openstack.base.client; // //public interface OpenStackCommand<R> { // -// OpenStackRequest createRequest(OpenStackClient connector); +// OpenStackRequest createRequest(OpenStackClient connector); // //} diff --git a/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackConnectException.java b/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackConnectException.java index aaf47cc..21c58f8 100644 --- a/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackConnectException.java +++ b/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackConnectException.java @@ -46,13 +46,13 @@ package com.woorea.openstack.base.client; */ public class OpenStackConnectException extends OpenStackBaseException { - private static final long serialVersionUID = 7294957362769575271L; + private static final long serialVersionUID = 7294957362769575271L; - public OpenStackConnectException(String message) { - super(message); - } + public OpenStackConnectException(String message) { + super(message); + } - public OpenStackConnectException(String message, Throwable cause) { - super(message, cause); - } + public OpenStackConnectException(String message, Throwable cause) { + super(message, cause); + } } diff --git a/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackRequest.java b/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackRequest.java index fabd9db..3a082a2 100644 --- a/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackRequest.java +++ b/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackRequest.java @@ -24,135 +24,135 @@ import java.util.ArrayList; import java.util.Map; public class OpenStackRequest<R> { - - private OpenStackClient client; - - public OpenStackRequest() { - - } - - public OpenStackRequest(OpenStackClient client, HttpMethod method, CharSequence path, Entity<?> entity, Class<R> returnType) { - this.client = client; - this.method = method; - this.path = new StringBuilder(path); - this.entity = entity; - this.returnType = returnType; - header("Accept", "application/json"); - } - - private String endpoint; - - private HttpMethod method; - - private StringBuilder path = new StringBuilder(); - - private Map<String, List<Object>> headers = new HashMap<>(); - - private Entity<?> entity; - - private Class<R> returnType; - - public OpenStackRequest<R> endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - public String endpoint() { - return endpoint; - } + + private OpenStackClient client; + + public OpenStackRequest() { + + } + + public OpenStackRequest(OpenStackClient client, HttpMethod method, CharSequence path, Entity<?> entity, Class<R> returnType) { + this.client = client; + this.method = method; + this.path = new StringBuilder(path); + this.entity = entity; + this.returnType = returnType; + header("Accept", "application/json"); + } + + private String endpoint; + + private HttpMethod method; + + private StringBuilder path = new StringBuilder(); + + private Map<String, List<Object>> headers = new HashMap<>(); + + private Entity<?> entity; + + private Class<R> returnType; + + public OpenStackRequest<R> endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + public String endpoint() { + return endpoint; + } - public OpenStackRequest<R> method(HttpMethod method) { - this.method = method; - return this; - } - - public HttpMethod method() { - return method; - } - - public OpenStackRequest<R> path(String path) { - this.path.append(path); - return this; - } - - public String path() { - return path.toString(); - } + public OpenStackRequest<R> method(HttpMethod method) { + this.method = method; + return this; + } + + public HttpMethod method() { + return method; + } + + public OpenStackRequest<R> path(String path) { + this.path.append(path); + return this; + } + + public String path() { + return path.toString(); + } - public OpenStackRequest<R> header(String name, Object value) { - if(value != null) { - headers.put(name, Arrays.asList(value)); - } - return this; - } - - public Map<String, List<Object>> headers() { - return headers; - } - - public <T> Entity<T> entity(T entity, String contentType) { - return new Entity<>(entity, contentType); - } - - public Entity<?> entity() { - return entity; - } - - public <T> Entity<T> json(T entity) { - return entity(entity, "application/json"); - } - - public void returnType(Class<R> returnType) { - this.returnType = returnType; - } - - public Class<R> returnType() { - return returnType; - } - - public R execute() { - return client.execute(this); - } - - public OpenStackResponse request() { - return client.request(this); - } + public OpenStackRequest<R> header(String name, Object value) { + if(value != null) { + headers.put(name, Arrays.asList(value)); + } + return this; + } + + public Map<String, List<Object>> headers() { + return headers; + } + + public <T> Entity<T> entity(T entity, String contentType) { + return new Entity<>(entity, contentType); + } + + public Entity<?> entity() { + return entity; + } + + public <T> Entity<T> json(T entity) { + return entity(entity, "application/json"); + } + + public void returnType(Class<R> returnType) { + this.returnType = returnType; + } + + public Class<R> returnType() { + return returnType; + } + + public R execute() { + return client.execute(this); + } + + public OpenStackResponse request() { + return client.request(this); + } - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "OpenStackRequest [endpoint=" + endpoint + ", method=" + method - + ", path=" + path + ", headers=" + headers + ", entity=" - + entity + ", returnType=" + returnType + "]"; - } + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "OpenStackRequest [endpoint=" + endpoint + ", method=" + method + + ", path=" + path + ", headers=" + headers + ", entity=" + + entity + ", returnType=" + returnType + "]"; + } - private Map<String, List<Object> > queryParams = new LinkedHashMap<>(); + private Map<String, List<Object> > queryParams = new LinkedHashMap<>(); - public Map<String, List<Object> > queryParams() { - return queryParams; - } + public Map<String, List<Object> > queryParams() { + return queryParams; + } - public OpenStackRequest<R> queryParam(String key, Object value) { - if (queryParams.containsKey(key)) { - List<Object> values = queryParams.get(key); - values.add(value); - } else { - List<Object> values = new ArrayList<>(); - values.add(value); - queryParams.put(key, values); - } + public OpenStackRequest<R> queryParam(String key, Object value) { + if (queryParams.containsKey(key)) { + List<Object> values = queryParams.get(key); + values.add(value); + } else { + List<Object> values = new ArrayList<>(); + values.add(value); + queryParams.put(key, values); + } - return this; + return this; } - - protected static String buildPath(String ... elements) { - StringBuilder stringBuilder = new StringBuilder(); - for (String element : elements) { + + protected static String buildPath(String ... elements) { + StringBuilder stringBuilder = new StringBuilder(); + for (String element : elements) { stringBuilder.append(element); } - return stringBuilder.toString(); - } + return stringBuilder.toString(); + } } diff --git a/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackResponse.java b/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackResponse.java index 1a2f4cb..0add524 100644 --- a/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackResponse.java +++ b/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackResponse.java @@ -25,14 +25,14 @@ import java.util.Map; public interface OpenStackResponse { - public <T> T getEntity(Class<T> returnType); + public <T> T getEntity(Class<T> returnType); - public <T> T getErrorEntity(Class<T> returnType); + public <T> T getErrorEntity(Class<T> returnType); - public InputStream getInputStream(); + public InputStream getInputStream(); - public String header(String name); - - public Map<String, String> headers(); - + public String header(String name); + + public Map<String, String> headers(); + } diff --git a/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackResponseException.java b/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackResponseException.java index edc7ec0..bbe0c6f 100644 --- a/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackResponseException.java +++ b/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackResponseException.java @@ -22,38 +22,38 @@ package com.woorea.openstack.base.client; public class OpenStackResponseException extends OpenStackBaseException { - private static final long serialVersionUID = 7294957362769575271L; - - protected String message; - - protected int status; - - // Make the response available for exception handling (includes body) - protected OpenStackResponse response; - - public OpenStackResponseException(String message, int status) { - this.message = message; - this.status = status; - this.response = null; - } - - public OpenStackResponseException(String message, int status, OpenStackResponse response) { - this.message = message; - this.status = status; - this.response = response; - } - - @Override - public String getMessage() { - return message; - } - - public int getStatus() { - return status; - } - - public OpenStackResponse getResponse() { - return response; - } + private static final long serialVersionUID = 7294957362769575271L; + + protected String message; + + protected int status; + + // Make the response available for exception handling (includes body) + protected OpenStackResponse response; + + public OpenStackResponseException(String message, int status) { + this.message = message; + this.status = status; + this.response = null; + } + + public OpenStackResponseException(String message, int status, OpenStackResponse response) { + this.message = message; + this.status = status; + this.response = response; + } + + @Override + public String getMessage() { + return message; + } + + public int getStatus() { + return status; + } + + public OpenStackResponse getResponse() { + return response; + } } diff --git a/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackResponseStatus.java b/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackResponseStatus.java index 30838eb..b69e0e1 100644 --- a/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackResponseStatus.java +++ b/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackResponseStatus.java @@ -18,10 +18,10 @@ package com.woorea.openstack.base.client; public class OpenStackResponseStatus { - public static final int OK = 200; + public static final int OK = 200; - public static final int NOT_AUTHORIZED = 401; + public static final int NOT_AUTHORIZED = 401; - public static final int CONFLICT = 409; + public static final int CONFLICT = 409; } diff --git a/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackSimpleTokenProvider.java b/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackSimpleTokenProvider.java index bc92595..a7dd2e5 100644 --- a/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackSimpleTokenProvider.java +++ b/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackSimpleTokenProvider.java @@ -18,19 +18,19 @@ package com.woorea.openstack.base.client; public class OpenStackSimpleTokenProvider implements OpenStackTokenProvider { - String token; + String token; - public OpenStackSimpleTokenProvider(String token) { - this.token = token; - } + public OpenStackSimpleTokenProvider(String token) { + this.token = token; + } - @Override - public String getToken() { - return this.token; - } + @Override + public String getToken() { + return this.token; + } - @Override - public void expireToken() { - } + @Override + public void expireToken() { + } } diff --git a/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackTokenProvider.java b/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackTokenProvider.java index 6fcb20c..f7f2629 100644 --- a/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackTokenProvider.java +++ b/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackTokenProvider.java @@ -18,8 +18,8 @@ package com.woorea.openstack.base.client; public interface OpenStackTokenProvider { - String getToken(); + String getToken(); - void expireToken(); + void expireToken(); } diff --git a/openstack-client/src/main/java/com/woorea/openstack/common/client/AbstractOpenStackClient.java b/openstack-client/src/main/java/com/woorea/openstack/common/client/AbstractOpenStackClient.java index 0c717c7..4319304 100644 --- a/openstack-client/src/main/java/com/woorea/openstack/common/client/AbstractOpenStackClient.java +++ b/openstack-client/src/main/java/com/woorea/openstack/common/client/AbstractOpenStackClient.java @@ -32,110 +32,110 @@ package com.woorea.openstack.common.client; // //public class AbstractOpenStackClient { // -// protected String endpointURL; -// -// protected String token; -// -// protected LoggingFilter loggingFilter; -// -// protected ClientRequestFilter tokenFilter = new ClientRequestFilter() { -// -// @Override -// public void filter(ClientRequestContext requestContext) throws IOException { -// requestContext.getHeaders().putSingle("X-Auth-Token", token); -// } -// }; +// protected String endpointURL; +// +// protected String token; +// +// protected LoggingFilter loggingFilter; +// +// protected ClientRequestFilter tokenFilter = new ClientRequestFilter() { +// +// @Override +// public void filter(ClientRequestContext requestContext) throws IOException { +// requestContext.getHeaders().putSingle("X-Auth-Token", token); +// } +// }; // -// public AbstractOpenStackClient(String endpointURL, String token) { -// this.endpointURL = endpointURL; -// this.token = token; -// } -// -// public AbstractOpenStackClient(String endpointURL) { -// this(endpointURL, null); -// } +// public AbstractOpenStackClient(String endpointURL, String token) { +// this.endpointURL = endpointURL; +// this.token = token; +// } +// +// public AbstractOpenStackClient(String endpointURL) { +// this(endpointURL, null); +// } // -// /** -// * @param token the token to set -// */ -// public void setToken(String token) { -// this.token = token; -// } -// -// public OpenStackRequest request(String uri, String... mediaTypes) { -// WebTarget endpoint = OpenStack.CLIENT.target(endpointURL); -// if(token != null) { -// endpoint.register(tokenFilter); -// } -// return new OpenStackRequest(endpoint.path(uri).request(mediaTypes)); -// } -// -// public OpenStackRequest request(String uri) { -// return request(uri, MediaType.APPLICATION_JSON); -// } -// -// protected WebTarget create(String endpoint) { -// WebTarget target = OpenStack.CLIENT.target(endpoint); -// if(loggingFilter != null) { -// target.register(loggingFilter); -// } -// if(token != null) { -// target.register(tokenFilter); -// } -// return target; -// } -// -// public void enableLogging(Logger logger, int entitySize) { -// loggingFilter = new LoggingFilter(logger, entitySize); -// } -// -// public void disableLogging() { -// loggingFilter = null; -// } -// -// public static class OpenStackRequest { -// -// private Builder builder; -// -// private OpenStackRequest(Builder builder) { -// this.builder = builder; -// } -// -// public <ResponseType> ResponseType execute(String method, Class<ResponseType> type) { -// return builder.method(method, type); -// } -// -// public <RequestType, ResponseType> ResponseType execute(String method, Entity<RequestType> data, Class<ResponseType> type) { -// return builder.method(method, data, type); -// } -// -// public void execute(String method) { -// builder.method(method); -// } -// -// public <RequestType> void execute(String method, Entity<RequestType> data) { -// builder.method(method, data, Void.class); -// } -// -// public <ResponseType> ResponseType get(Class<ResponseType> type) { -// return execute("GET", type); -// } -// -// public <ResponseType> ResponseType postJson(Object data, Class<ResponseType> type) { -// return execute("POST", Entity.json(data), type); -// } -// -// public <ResponseType> ResponseType putJson(Object data, Class<ResponseType> type) { -// return execute("PUT", Entity.json(data), type); -// } -// -// public <ResponseType> ResponseType patchJson(Object data, Class<ResponseType> type) { -// return execute("PATCH", Entity.json(data), type); -// } -// -// public void delete() { -// execute("DELETE", Void.class); -// } -// } +// /** +// * @param token the token to set +// */ +// public void setToken(String token) { +// this.token = token; +// } +// +// public OpenStackRequest request(String uri, String... mediaTypes) { +// WebTarget endpoint = OpenStack.CLIENT.target(endpointURL); +// if(token != null) { +// endpoint.register(tokenFilter); +// } +// return new OpenStackRequest(endpoint.path(uri).request(mediaTypes)); +// } +// +// public OpenStackRequest request(String uri) { +// return request(uri, MediaType.APPLICATION_JSON); +// } +// +// protected WebTarget create(String endpoint) { +// WebTarget target = OpenStack.CLIENT.target(endpoint); +// if(loggingFilter != null) { +// target.register(loggingFilter); +// } +// if(token != null) { +// target.register(tokenFilter); +// } +// return target; +// } +// +// public void enableLogging(Logger logger, int entitySize) { +// loggingFilter = new LoggingFilter(logger, entitySize); +// } +// +// public void disableLogging() { +// loggingFilter = null; +// } +// +// public static class OpenStackRequest { +// +// private Builder builder; +// +// private OpenStackRequest(Builder builder) { +// this.builder = builder; +// } +// +// public <ResponseType> ResponseType execute(String method, Class<ResponseType> type) { +// return builder.method(method, type); +// } +// +// public <RequestType, ResponseType> ResponseType execute(String method, Entity<RequestType> data, Class<ResponseType> type) { +// return builder.method(method, data, type); +// } +// +// public void execute(String method) { +// builder.method(method); +// } +// +// public <RequestType> void execute(String method, Entity<RequestType> data) { +// builder.method(method, data, Void.class); +// } +// +// public <ResponseType> ResponseType get(Class<ResponseType> type) { +// return execute("GET", type); +// } +// +// public <ResponseType> ResponseType postJson(Object data, Class<ResponseType> type) { +// return execute("POST", Entity.json(data), type); +// } +// +// public <ResponseType> ResponseType putJson(Object data, Class<ResponseType> type) { +// return execute("PUT", Entity.json(data), type); +// } +// +// public <ResponseType> ResponseType patchJson(Object data, Class<ResponseType> type) { +// return execute("PATCH", Entity.json(data), type); +// } +// +// public void delete() { +// execute("DELETE", Void.class); +// } +// } // //} diff --git a/openstack-client/src/main/java/com/woorea/openstack/common/session/OpenStackSession.java b/openstack-client/src/main/java/com/woorea/openstack/common/session/OpenStackSession.java index c466e9e..e149b95 100644 --- a/openstack-client/src/main/java/com/woorea/openstack/common/session/OpenStackSession.java +++ b/openstack-client/src/main/java/com/woorea/openstack/common/session/OpenStackSession.java @@ -23,101 +23,101 @@ package com.woorea.openstack.common.session; //import org.openstack.keystone.model.Authentication; // //public class OpenStackSession implements Serializable { -// -// private String authenticationURL; -// -// private Authentication authentication; -// -// private String identityAdministrationURL; -// -// private String identityAdministrationToken; -// -// private Access access; -// -// private boolean admin; -// -// /** -// * @return the authenticationURL -// */ -// public String getAuthenticationURL() { -// return authenticationURL; -// } -// -// /** -// * @param authenticationURL the authenticationURL to set -// */ -// public void setAuthenticationURL(String authenticationURL) { -// this.authenticationURL = authenticationURL; -// } -// -// /** -// * @return the authentication -// */ -// public Authentication getAuthentication() { -// return authentication; -// } -// -// /** -// * @param authentication the authentication to set -// */ -// public void setAuthentication(Authentication authentication) { -// this.authentication = authentication; -// } -// -// /** -// * @return the identityAdministrationURL -// */ -// public String getIdentityAdministrationURL() { -// return identityAdministrationURL; -// } -// -// /** -// * @param identityAdministrationURL the identityAdministrationURL to set -// */ -// public void setIdentityAdministrationURL(String identityAdministrationURL) { -// this.identityAdministrationURL = identityAdministrationURL; -// } -// -// /** -// * @return the identityAdministrationToken -// */ -// public String getIdentityAdministrationToken() { -// return identityAdministrationToken; -// } -// -// /** -// * @param identityAdministrationToken the identityAdministrationToken to set -// */ -// public void setIdentityAdministrationToken(String identityAdministrationToken) { -// this.identityAdministrationToken = identityAdministrationToken; -// } -// -// /** -// * @return the access -// */ -// public Access getAccess() { -// return access; -// } -// -// /** -// * @param access the access to set -// */ -// public void setAccess(Access access) { -// this.access = access; -// } -// -// /** -// * @return the admin -// */ -// public boolean isAdmin() { -// return admin; -// } -// -// /** -// * @param admin the admin to set -// */ -// public void setAdmin(boolean admin) { -// this.admin = admin; -// } +// +// private String authenticationURL; +// +// private Authentication authentication; +// +// private String identityAdministrationURL; +// +// private String identityAdministrationToken; +// +// private Access access; +// +// private boolean admin; +// +// /** +// * @return the authenticationURL +// */ +// public String getAuthenticationURL() { +// return authenticationURL; +// } +// +// /** +// * @param authenticationURL the authenticationURL to set +// */ +// public void setAuthenticationURL(String authenticationURL) { +// this.authenticationURL = authenticationURL; +// } +// +// /** +// * @return the authentication +// */ +// public Authentication getAuthentication() { +// return authentication; +// } +// +// /** +// * @param authentication the authentication to set +// */ +// public void setAuthentication(Authentication authentication) { +// this.authentication = authentication; +// } +// +// /** +// * @return the identityAdministrationURL +// */ +// public String getIdentityAdministrationURL() { +// return identityAdministrationURL; +// } +// +// /** +// * @param identityAdministrationURL the identityAdministrationURL to set +// */ +// public void setIdentityAdministrationURL(String identityAdministrationURL) { +// this.identityAdministrationURL = identityAdministrationURL; +// } +// +// /** +// * @return the identityAdministrationToken +// */ +// public String getIdentityAdministrationToken() { +// return identityAdministrationToken; +// } +// +// /** +// * @param identityAdministrationToken the identityAdministrationToken to set +// */ +// public void setIdentityAdministrationToken(String identityAdministrationToken) { +// this.identityAdministrationToken = identityAdministrationToken; +// } +// +// /** +// * @return the access +// */ +// public Access getAccess() { +// return access; +// } +// +// /** +// * @param access the access to set +// */ +// public void setAccess(Access access) { +// this.access = access; +// } +// +// /** +// * @return the admin +// */ +// public boolean isAdmin() { +// return admin; +// } +// +// /** +// * @param admin the admin to set +// */ +// public void setAdmin(boolean admin) { +// this.admin = admin; +// } // //} diff --git a/openstack-client/src/main/java/com/woorea/openstack/common/session/OpenStackSessionHolder.java b/openstack-client/src/main/java/com/woorea/openstack/common/session/OpenStackSessionHolder.java index ddacf17..ec199e9 100644 --- a/openstack-client/src/main/java/com/woorea/openstack/common/session/OpenStackSessionHolder.java +++ b/openstack-client/src/main/java/com/woorea/openstack/common/session/OpenStackSessionHolder.java @@ -19,14 +19,14 @@ package com.woorea.openstack.common.session; // //public class OpenStackSessionHolder { // -// private static final ThreadLocal<OpenStackSession> HOLDER = new ThreadLocal<OpenStackSession>(); -// -// public static OpenStackSession getSession() { -// return HOLDER.get(); -// } -// -// public static void setSession(OpenStackSession session) { -// HOLDER.set(session); -// } +// private static final ThreadLocal<OpenStackSession> HOLDER = new ThreadLocal<OpenStackSession>(); +// +// public static OpenStackSession getSession() { +// return HOLDER.get(); +// } +// +// public static void setSession(OpenStackSession session) { +// HOLDER.set(session); +// } // //} diff --git a/openstack-console/src/main/java/com/woorea/openstack/console/Command.java b/openstack-console/src/main/java/com/woorea/openstack/console/Command.java index 13ed98b..8aa56c0 100644 --- a/openstack-console/src/main/java/com/woorea/openstack/console/Command.java +++ b/openstack-console/src/main/java/com/woorea/openstack/console/Command.java @@ -21,17 +21,17 @@ import org.apache.commons.cli.Options; public abstract class Command { - - protected String name; - - public Command(String name) { - this.name = name; - } + + protected String name; + + public Command(String name) { + this.name = name; + } - public abstract void execute(Console console, CommandLine args); - - public Options getOptions() { - return new Options(); - } + public abstract void execute(Console console, CommandLine args); + + public Options getOptions() { + return new Options(); + } } diff --git a/openstack-console/src/main/java/com/woorea/openstack/console/CommandLineHelper.java b/openstack-console/src/main/java/com/woorea/openstack/console/CommandLineHelper.java index eb44b34..c11c403 100644 --- a/openstack-console/src/main/java/com/woorea/openstack/console/CommandLineHelper.java +++ b/openstack-console/src/main/java/com/woorea/openstack/console/CommandLineHelper.java @@ -21,7 +21,7 @@ import java.util.Vector; public class CommandLineHelper { - public static String[] parse(String input) { + public static String[] parse(String input) { if (input == null || input.length() == 0) { //no command? no string return new String[0]; diff --git a/openstack-console/src/main/java/com/woorea/openstack/console/Commands.java b/openstack-console/src/main/java/com/woorea/openstack/console/Commands.java index 0c13192..d9a395b 100644 --- a/openstack-console/src/main/java/com/woorea/openstack/console/Commands.java +++ b/openstack-console/src/main/java/com/woorea/openstack/console/Commands.java @@ -22,26 +22,26 @@ import org.apache.commons.cli.CommandLine; public class Commands { - public static final Command EXIT = new Command("exit") { - - @Override - public void execute(Console console, CommandLine args) { - console.exit(); - } - - }; - - public static final Command SET = new Command("set") { - - @Override - public void execute(Console console, CommandLine args) { - if(args.getArgs().length == 2) { - console.setProperty(args.getArgs()[0], args.getArgs()[1]); - } else { - console.properties(); - } - } - - }; + public static final Command EXIT = new Command("exit") { + + @Override + public void execute(Console console, CommandLine args) { + console.exit(); + } + + }; + + public static final Command SET = new Command("set") { + + @Override + public void execute(Console console, CommandLine args) { + if(args.getArgs().length == 2) { + console.setProperty(args.getArgs()[0], args.getArgs()[1]); + } else { + console.properties(); + } + } + + }; } diff --git a/openstack-console/src/main/java/com/woorea/openstack/console/Console.java b/openstack-console/src/main/java/com/woorea/openstack/console/Console.java index 70f2990..51a316e 100644 --- a/openstack-console/src/main/java/com/woorea/openstack/console/Console.java +++ b/openstack-console/src/main/java/com/woorea/openstack/console/Console.java @@ -34,94 +34,94 @@ import org.apache.commons.cli.GnuParser; import org.apache.commons.cli.HelpFormatter; public class Console { - - private Properties properties; - - private ConsoleReader reader; + + private Properties properties; + + private ConsoleReader reader; - private Environment environment; - - private HelpFormatter helpFormatter = new HelpFormatter(); - - private static final CommandLineParser PARSER = new GnuParser(); - - public Console(Environment environment, Properties properties) { - this.properties = properties; - this.environment = environment; - } - - public void start() throws IOException { - if(System.console() == null) { - reader = new ConsoleReader(System.in, System.out, new UnsupportedTerminal()); - } else { - reader = new ConsoleReader(); - } - do { - String line = reader.readLine(environment.getPrompt()); - execute(line); - } while(true); - } - - public void execute(String line) { - String[] tokens = CommandLineHelper.parse(line); - if(tokens.length > 0) { - Command command = environment.commands.get(tokens[0]); - if(command != null) { - try { - CommandLine args = Console.PARSER.parse(command.getOptions(), Arrays.copyOfRange(tokens, 1, tokens.length)); - command.execute(this, args); - } catch (Exception e) { - e.printStackTrace(); - helpFormatter.printHelp(command.name, command.getOptions()); - } - } - } - } + private Environment environment; + + private HelpFormatter helpFormatter = new HelpFormatter(); + + private static final CommandLineParser PARSER = new GnuParser(); + + public Console(Environment environment, Properties properties) { + this.properties = properties; + this.environment = environment; + } + + public void start() throws IOException { + if(System.console() == null) { + reader = new ConsoleReader(System.in, System.out, new UnsupportedTerminal()); + } else { + reader = new ConsoleReader(); + } + do { + String line = reader.readLine(environment.getPrompt()); + execute(line); + } while(true); + } + + public void execute(String line) { + String[] tokens = CommandLineHelper.parse(line); + if(tokens.length > 0) { + Command command = environment.commands.get(tokens[0]); + if(command != null) { + try { + CommandLine args = Console.PARSER.parse(command.getOptions(), Arrays.copyOfRange(tokens, 1, tokens.length)); + command.execute(this, args); + } catch (Exception e) { + e.printStackTrace(); + helpFormatter.printHelp(command.name, command.getOptions()); + } + } + } + } - public void setEnvironment(Environment environment) { - Set<Completer> completers = new HashSet<Completer>(reader.getCompleters()); - for(Completer c : completers) { - reader.removeCompleter(c); - } - Set<String> commands = new HashSet<String>(); - for(Map.Entry<String,Command> c : environment.commands.entrySet()) { - commands.add(c.getKey()); - } - reader.addCompleter(new StringsCompleter(commands)); - this.environment = environment; - } - - public Environment getEnvironment() { - return this.environment; - } - - /** - * @return the properties - */ - public String getProperty(String name) { - return properties.getProperty(name); - } - - /** - * @return the properties - */ - public void setProperty(String name, Object value) { - properties.put(name, value); - } - - public void properties() { - for(Map.Entry<Object, Object> entry : properties.entrySet()) { - System.out.printf("%25s = %55s",entry.getKey(), entry.getValue()); - } - } + public void setEnvironment(Environment environment) { + Set<Completer> completers = new HashSet<Completer>(reader.getCompleters()); + for(Completer c : completers) { + reader.removeCompleter(c); + } + Set<String> commands = new HashSet<String>(); + for(Map.Entry<String,Command> c : environment.commands.entrySet()) { + commands.add(c.getKey()); + } + reader.addCompleter(new StringsCompleter(commands)); + this.environment = environment; + } + + public Environment getEnvironment() { + return this.environment; + } + + /** + * @return the properties + */ + public String getProperty(String name) { + return properties.getProperty(name); + } + + /** + * @return the properties + */ + public void setProperty(String name, Object value) { + properties.put(name, value); + } + + public void properties() { + for(Map.Entry<Object, Object> entry : properties.entrySet()) { + System.out.printf("%25s = %55s",entry.getKey(), entry.getValue()); + } + } - public void exit() { - if(environment.parent == null) { - System.out.println("Goodbye"); - System.exit(1); - } else { - environment = environment.parent; - } - } + public void exit() { + if(environment.parent == null) { + System.out.println("Goodbye"); + System.exit(1); + } else { + environment = environment.parent; + } + } } diff --git a/openstack-console/src/main/java/com/woorea/openstack/console/Environment.java b/openstack-console/src/main/java/com/woorea/openstack/console/Environment.java index 30ea7b1..9342349 100644 --- a/openstack-console/src/main/java/com/woorea/openstack/console/Environment.java +++ b/openstack-console/src/main/java/com/woorea/openstack/console/Environment.java @@ -21,26 +21,26 @@ import java.util.TreeMap; public class Environment { - protected final Environment parent; - - protected Map<String, Command> commands = new TreeMap<String, Command>(); - - public Environment(Environment parent) { - register(Commands.EXIT); - register(Commands.SET); - this.parent = parent; - } - - public Environment() { - this(null); - } + protected final Environment parent; + + protected Map<String, Command> commands = new TreeMap<String, Command>(); + + public Environment(Environment parent) { + register(Commands.EXIT); + register(Commands.SET); + this.parent = parent; + } + + public Environment() { + this(null); + } - public void register(Command command) { - commands.put(command.name, command); - } + public void register(Command command) { + commands.put(command.name, command); + } - public String getPrompt() { - return "> "; - } + public String getPrompt() { + return "> "; + } } diff --git a/openstack-console/src/main/java/com/woorea/openstack/console/Main.java b/openstack-console/src/main/java/com/woorea/openstack/console/Main.java index 3aa4229..730ba68 100644 --- a/openstack-console/src/main/java/com/woorea/openstack/console/Main.java +++ b/openstack-console/src/main/java/com/woorea/openstack/console/Main.java @@ -25,19 +25,19 @@ import com.woorea.openstack.console.nova.NovaEnvironment; public class Main { - /** - * @param args - */ - public static void main(String[] args) throws IOException { - Environment environment = new Environment(); - environment.register(KeystoneEnvironment.KEYSTONE); - environment.register(NovaEnvironment.NOVA); - - Properties properties = new Properties(); - properties.load(new FileInputStream("src/main/resources/console.properties")); - - Console console = new Console(environment, properties); - console.start(); - } + /** + * @param args + */ + public static void main(String[] args) throws IOException { + Environment environment = new Environment(); + environment.register(KeystoneEnvironment.KEYSTONE); + environment.register(NovaEnvironment.NOVA); + + Properties properties = new Properties(); + properties.load(new FileInputStream("src/main/resources/console.properties")); + + Console console = new Console(environment, properties); + console.start(); + } } diff --git a/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneCommand.java b/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneCommand.java index 8eb230a..48cfc9b 100644 --- a/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneCommand.java +++ b/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneCommand.java @@ -23,18 +23,18 @@ import com.woorea.openstack.console.Console; import com.woorea.openstack.keystone.Keystone; public abstract class KeystoneCommand extends Command { - - public KeystoneCommand(String name) { - super(name); - } + + public KeystoneCommand(String name) { + super(name); + } - @Override - public void execute(Console console, CommandLine args) { - KeystoneEnvironment environment = (KeystoneEnvironment) console.getEnvironment(); - execute(environment.CLIENT, args); - - } + @Override + public void execute(Console console, CommandLine args) { + KeystoneEnvironment environment = (KeystoneEnvironment) console.getEnvironment(); + execute(environment.CLIENT, args); + + } - protected abstract void execute(Keystone keystone, CommandLine args); + protected abstract void execute(Keystone keystone, CommandLine args); } diff --git a/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneEnvironment.java b/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneEnvironment.java index 06ca23b..b9c4c3c 100644 --- a/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneEnvironment.java +++ b/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneEnvironment.java @@ -27,53 +27,53 @@ import com.woorea.openstack.keystone.model.Access; import com.woorea.openstack.keystone.model.authentication.UsernamePassword; public class KeystoneEnvironment extends Environment { - - public final Keystone CLIENT; - - public static final Command KEYSTONE = new Command("keystone") { - - @Override - public void execute(Console console, CommandLine args) { - - Keystone client = new Keystone(console.getProperty("keystone.endpoint")); - - Access access = client.tokens() - .authenticate(new UsernamePassword( - console.getProperty("keystone.username"), - console.getProperty("keystone.password") - )) - .withTenantName(console.getProperty("keystone.tenant_name")) - .execute(); - - client.setTokenProvider(new OpenStackSimpleTokenProvider(access.getToken().getId())); - - KeystoneEnvironment environment = new KeystoneEnvironment(console.getEnvironment(), client); - - environment.register(new KeystoneTenantList()); - environment.register(new KeystoneTenantCreate()); - environment.register(new KeystoneTenantDelete()); - environment.register(new KeystoneUserList()); - environment.register(new KeystoneUserCreate()); - environment.register(new KeystoneUserDelete()); - environment.register(new KeystoneRoleList()); - environment.register(new KeystoneRoleDelete()); - environment.register(new KeystoneServiceList()); - console.setEnvironment(environment); - } - - }; - - public KeystoneEnvironment(Environment parent, Keystone client) { - super(parent); - CLIENT = client; - } + + public final Keystone CLIENT; + + public static final Command KEYSTONE = new Command("keystone") { + + @Override + public void execute(Console console, CommandLine args) { + + Keystone client = new Keystone(console.getProperty("keystone.endpoint")); + + Access access = client.tokens() + .authenticate(new UsernamePassword( + console.getProperty("keystone.username"), + console.getProperty("keystone.password") + )) + .withTenantName(console.getProperty("keystone.tenant_name")) + .execute(); + + client.setTokenProvider(new OpenStackSimpleTokenProvider(access.getToken().getId())); + + KeystoneEnvironment environment = new KeystoneEnvironment(console.getEnvironment(), client); + + environment.register(new KeystoneTenantList()); + environment.register(new KeystoneTenantCreate()); + environment.register(new KeystoneTenantDelete()); + environment.register(new KeystoneUserList()); + environment.register(new KeystoneUserCreate()); + environment.register(new KeystoneUserDelete()); + environment.register(new KeystoneRoleList()); + environment.register(new KeystoneRoleDelete()); + environment.register(new KeystoneServiceList()); + console.setEnvironment(environment); + } + + }; + + public KeystoneEnvironment(Environment parent, Keystone client) { + super(parent); + CLIENT = client; + } - /* (non-Javadoc) - * @see org.woorea.wsh.Environment#getPrompt() - */ - @Override - public String getPrompt() { - return "keystone> "; - } - + /* (non-Javadoc) + * @see org.woorea.wsh.Environment#getPrompt() + */ + @Override + public String getPrompt() { + return "keystone> "; + } + } diff --git a/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneRoleCreate.java b/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneRoleCreate.java index 9214149..7dbba41 100644 --- a/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneRoleCreate.java +++ b/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneRoleCreate.java @@ -28,58 +28,58 @@ import com.woorea.openstack.keystone.Keystone; import com.woorea.openstack.keystone.model.Role; public class KeystoneRoleCreate extends KeystoneCommand { - - public KeystoneRoleCreate() { - super( "role-create"); - } + + public KeystoneRoleCreate() { + super( "role-create"); + } - @Override - public void execute(Keystone keystone, CommandLine cmd) { - - Role role = new Role(); - role.setName(cmd.getOptionValue("name")); - role.setDescription(cmd.getOptionValue("description")); - if(cmd.getOptionValue("enabled") != null) { - role.setEnabled("True"); - } - - role = keystone.roles().create(role).execute(); - - Table t = new Table(new TableModel<Role>(Arrays.asList(role)) { + @Override + public void execute(Keystone keystone, CommandLine cmd) { + + Role role = new Role(); + role.setName(cmd.getOptionValue("name")); + role.setDescription(cmd.getOptionValue("description")); + if(cmd.getOptionValue("enabled") != null) { + role.setEnabled("True"); + } + + role = keystone.roles().create(role).execute(); + + Table t = new Table(new TableModel<Role>(Arrays.asList(role)) { - @Override - public Column[] getHeaders() { - return new Column[]{ - new Column("id", 32, Column.ALIGN_LEFT), - new Column("name", 10, Column.ALIGN_LEFT), - new Column("description", 32, Column.ALIGN_LEFT), - new Column("enabled", 7, Column.ALIGN_LEFT) - }; - } + @Override + public Column[] getHeaders() { + return new Column[]{ + new Column("id", 32, Column.ALIGN_LEFT), + new Column("name", 10, Column.ALIGN_LEFT), + new Column("description", 32, Column.ALIGN_LEFT), + new Column("enabled", 7, Column.ALIGN_LEFT) + }; + } - @Override - public String[] getRow(Role tenant) { - return new String[]{ - tenant.getId(), - tenant.getName(), - tenant.getDescription(), - tenant.getEnabled().toString() - }; - } - }); - System.out.println(t.render()); - } + @Override + public String[] getRow(Role tenant) { + return new String[]{ + tenant.getId(), + tenant.getName(), + tenant.getDescription(), + tenant.getEnabled().toString() + }; + } + }); + System.out.println(t.render()); + } - /* (non-Javadoc) - * @see com.billingstack.commands.Command#getOptions() - */ - @Override - public Options getOptions() { - Options opts = super.getOptions(); - opts.addOption(null, "name", true, "tenant name"); - opts.addOption(null, "description", true, "tenant description"); - opts.addOption(null, "enabled", false, "enabled"); - return opts; - } - + /* (non-Javadoc) + * @see com.billingstack.commands.Command#getOptions() + */ + @Override + public Options getOptions() { + Options opts = super.getOptions(); + opts.addOption(null, "name", true, "tenant name"); + opts.addOption(null, "description", true, "tenant description"); + opts.addOption(null, "enabled", false, "enabled"); + return opts; + } + } diff --git a/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneRoleDelete.java b/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneRoleDelete.java index 5dde646..9adf5c8 100644 --- a/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneRoleDelete.java +++ b/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneRoleDelete.java @@ -22,20 +22,20 @@ import com.woorea.openstack.console.utils.ConsoleUtils; import com.woorea.openstack.keystone.Keystone; public class KeystoneRoleDelete extends KeystoneCommand { - - public KeystoneRoleDelete() { - super("role-delete"); - } + + public KeystoneRoleDelete() { + super("role-delete"); + } - @Override - public void execute(Keystone keystone, CommandLine cmd) { - - String[] args = cmd.getArgs(); - if(args.length == 1) { - keystone.roles().delete(args[0]).execute(); - System.out.println(new ConsoleUtils().green("OK")); - } - - } - + @Override + public void execute(Keystone keystone, CommandLine cmd) { + + String[] args = cmd.getArgs(); + if(args.length == 1) { + keystone.roles().delete(args[0]).execute(); + System.out.println(new ConsoleUtils().green("OK")); + } + + } + } diff --git a/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneRoleList.java b/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneRoleList.java index bc59140..a6c7f2a 100644 --- a/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneRoleList.java +++ b/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneRoleList.java @@ -26,39 +26,39 @@ import com.woorea.openstack.keystone.model.Role; import com.woorea.openstack.keystone.model.Roles; public class KeystoneRoleList extends KeystoneCommand { - - public KeystoneRoleList() { - super("role-list"); - } + + public KeystoneRoleList() { + super("role-list"); + } - @Override - public void execute(Keystone keystone, CommandLine cmd) { - - final Roles roles = keystone.roles().list().execute(); - - Table t = new Table(new TableModel<Role>(roles.getList()) { + @Override + public void execute(Keystone keystone, CommandLine cmd) { + + final Roles roles = keystone.roles().list().execute(); + + Table t = new Table(new TableModel<Role>(roles.getList()) { - @Override - public Column[] getHeaders() { - return new Column[]{ - new Column("id", 32, Column.ALIGN_LEFT), - new Column("name", 10, Column.ALIGN_LEFT), - new Column("description", 32, Column.ALIGN_LEFT), - new Column("enabled", 7, Column.ALIGN_LEFT), - }; - } + @Override + public Column[] getHeaders() { + return new Column[]{ + new Column("id", 32, Column.ALIGN_LEFT), + new Column("name", 10, Column.ALIGN_LEFT), + new Column("description", 32, Column.ALIGN_LEFT), + new Column("enabled", 7, Column.ALIGN_LEFT), + }; + } - @Override - public String[] getRow(Role role) { - return new String[]{ - role.getId(), - role.getName(), - role.getDescription(), - role.getEnabled() - }; - } - }); - System.out.println(t.render()); - } + @Override + public String[] getRow(Role role) { + return new String[]{ + role.getId(), + role.getName(), + role.getDescription(), + role.getEnabled() + }; + } + }); + System.out.println(t.render()); + } } diff --git a/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneServiceList.java b/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneServiceList.java index 931d1ab..9070bd9 100644 --- a/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneServiceList.java +++ b/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneServiceList.java @@ -26,39 +26,39 @@ import com.woorea.openstack.keystone.model.Service; import com.woorea.openstack.keystone.model.Services; public class KeystoneServiceList extends KeystoneCommand { - - public KeystoneServiceList() { - super("service-list"); - } + + public KeystoneServiceList() { + super("service-list"); + } - @Override - public void execute(Keystone keystone, CommandLine cmd) { - - final Services services = keystone.services().list().execute(); - - Table t = new Table(new TableModel<Service>(services.getList()) { + @Override + public void execute(Keystone keystone, CommandLine cmd) { + + final Services services = keystone.services().list().execute(); + + Table t = new Table(new TableModel<Service>(services.getList()) { - @Override - public Column[] getHeaders() { - return new Column[]{ - new Column("id", 32, Column.ALIGN_LEFT), - new Column("type", 10, Column.ALIGN_LEFT), - new Column("name", 10, Column.ALIGN_LEFT), - new Column("description", 32, Column.ALIGN_LEFT) - }; - } + @Override + public Column[] getHeaders() { + return new Column[]{ + new Column("id", 32, Column.ALIGN_LEFT), + new Column("type", 10, Column.ALIGN_LEFT), + new Column("name", 10, Column.ALIGN_LEFT), + new Column("description", 32, Column.ALIGN_LEFT) + }; + } - @Override - public String[] getRow(Service service) { - return new String[]{ - service.getId(), - service.getType(), - service.getName(), - service.getDescription() - }; - } - }); - System.out.println(t.render()); - } + @Override + public String[] getRow(Service service) { + return new String[]{ + service.getId(), + service.getType(), + service.getName(), + service.getDescription() + }; + } + }); + System.out.println(t.render()); + } } diff --git a/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneTenantCreate.java b/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneTenantCreate.java index 04177a6..c77c5b1 100644 --- a/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneTenantCreate.java +++ b/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneTenantCreate.java @@ -28,58 +28,58 @@ import com.woorea.openstack.keystone.Keystone; import com.woorea.openstack.keystone.model.Tenant; public class KeystoneTenantCreate extends KeystoneCommand { - - public KeystoneTenantCreate() { - super("tenant-create"); - } + + public KeystoneTenantCreate() { + super("tenant-create"); + } - @Override - public void execute(Keystone keystone, CommandLine cmd) { - - Tenant tenant = new Tenant(); - tenant.setName(cmd.getOptionValue("name")); - tenant.setDescription(cmd.getOptionValue("description")); - if(cmd.getOptionValue("enabled") != null) { - tenant.setEnabled(Boolean.TRUE); - } - - tenant = keystone.tenants().create(tenant).execute(); - - Table t = new Table(new TableModel<Tenant>(Arrays.asList(tenant)) { + @Override + public void execute(Keystone keystone, CommandLine cmd) { + + Tenant tenant = new Tenant(); + tenant.setName(cmd.getOptionValue("name")); + tenant.setDescription(cmd.getOptionValue("description")); + if(cmd.getOptionValue("enabled") != null) { + tenant.setEnabled(Boolean.TRUE); + } + + tenant = keystone.tenants().create(tenant).execute(); + + Table t = new Table(new TableModel<Tenant>(Arrays.asList(tenant)) { - @Override - public Column[] getHeaders() { - return new Column[]{ - new Column("id", 32, Column.ALIGN_LEFT), - new Column("name", 10, Column.ALIGN_LEFT), - new Column("description", 32, Column.ALIGN_LEFT), - new Column("enabled", 7, Column.ALIGN_LEFT) - }; - } + @Override + public Column[] getHeaders() { + return new Column[]{ + new Column("id", 32, Column.ALIGN_LEFT), + new Column("name", 10, Column.ALIGN_LEFT), + new Column("description", 32, Column.ALIGN_LEFT), + new Column("enabled", 7, Column.ALIGN_LEFT) + }; + } - @Override - public String[] getRow(Tenant tenant) { - return new String[]{ - tenant.getId(), - tenant.getName(), - tenant.getDescription(), - tenant.getEnabled().toString() - }; - } - }); - System.out.println(t.render()); - } + @Override + public String[] getRow(Tenant tenant) { + return new String[]{ + tenant.getId(), + tenant.getName(), + tenant.getDescription(), + tenant.getEnabled().toString() + }; + } + }); + System.out.println(t.render()); + } - /* (non-Javadoc) - * @see com.billingstack.commands.Command#getOptions() - */ - @Override - public Options getOptions() { - Options opts = super.getOptions(); - opts.addOption(null, "name", true, "tenant name"); - opts.addOption(null, "description", true, "tenant description"); - opts.addOption(null, "enabled", false, "enabled"); - return opts; - } - + /* (non-Javadoc) + * @see com.billingstack.commands.Command#getOptions() + */ + @Override + public Options getOptions() { + Options opts = super.getOptions(); + opts.addOption(null, "name", true, "tenant name"); + opts.addOption(null, "description", true, "tenant description"); + opts.addOption(null, "enabled", false, "enabled"); + return opts; + } + } diff --git a/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneTenantDelete.java b/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneTenantDelete.java index bd34ca9..1e9a649 100644 --- a/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneTenantDelete.java +++ b/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneTenantDelete.java @@ -22,20 +22,20 @@ import com.woorea.openstack.console.utils.ConsoleUtils; import com.woorea.openstack.keystone.Keystone; public class KeystoneTenantDelete extends KeystoneCommand { - - public KeystoneTenantDelete() { - super("tenant-delete"); - } + + public KeystoneTenantDelete() { + super("tenant-delete"); + } - @Override - public void execute(Keystone keystone, CommandLine cmd) { - - String[] args = cmd.getArgs(); - if(args.length == 1) { - keystone.tenants().delete(args[0]).execute(); - System.out.println(new ConsoleUtils().green("OK")); - } - - } - + @Override + public void execute(Keystone keystone, CommandLine cmd) { + + String[] args = cmd.getArgs(); + if(args.length == 1) { + keystone.tenants().delete(args[0]).execute(); + System.out.println(new ConsoleUtils().green("OK")); + } + + } + } diff --git a/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneTenantList.java b/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneTenantList.java index 31d0899..ac8994b 100644 --- a/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneTenantList.java +++ b/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneTenantList.java @@ -26,39 +26,39 @@ import com.woorea.openstack.keystone.model.Tenant; import com.woorea.openstack.keystone.model.Tenants; public class KeystoneTenantList extends KeystoneCommand { - - public KeystoneTenantList() { - super("tenant-list"); - } + + public KeystoneTenantList() { + super("tenant-list"); + } - @Override - public void execute(Keystone keystone, CommandLine args) { - - final Tenants tenants = keystone.tenants().list().execute(); - - Table t = new Table(new TableModel<Tenant>(tenants.getList()) { + @Override + public void execute(Keystone keystone, CommandLine args) { + + final Tenants tenants = keystone.tenants().list().execute(); + + Table t = new Table(new TableModel<Tenant>(tenants.getList()) { - @Override - public Column[] getHeaders() { - return new Column[]{ - new Column("id", 32, Column.ALIGN_LEFT), - new Column("name", 32, Column.ALIGN_LEFT), - new Column("description", 32, Column.ALIGN_LEFT), - new Column("enabled", 7, Column.ALIGN_LEFT) - }; - } + @Override + public Column[] getHeaders() { + return new Column[]{ + new Column("id", 32, Column.ALIGN_LEFT), + new Column("name", 32, Column.ALIGN_LEFT), + new Column("description", 32, Column.ALIGN_LEFT), + new Column("enabled", 7, Column.ALIGN_LEFT) + }; + } - @Override - public String[] getRow(Tenant tenant) { - return new String[]{ - tenant.getId(), - tenant.getName(), - tenant.getDescription(), - tenant.getEnabled().toString() - }; - } - }); - System.out.println(t.render()); - } + @Override + public String[] getRow(Tenant tenant) { + return new String[]{ + tenant.getId(), + tenant.getName(), + tenant.getDescription(), + tenant.getEnabled().toString() + }; + } + }); + System.out.println(t.render()); + } } diff --git a/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneUserCreate.java b/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneUserCreate.java index baa799b..2da50fc 100644 --- a/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneUserCreate.java +++ b/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneUserCreate.java @@ -28,64 +28,64 @@ import com.woorea.openstack.keystone.Keystone; import com.woorea.openstack.keystone.model.User; public class KeystoneUserCreate extends KeystoneCommand { - - public KeystoneUserCreate() { - super("user-create"); - } + + public KeystoneUserCreate() { + super("user-create"); + } - @Override - public void execute(Keystone keystone, CommandLine cmd) { - - User user = new User(); - user.setName(cmd.getOptionValue("name")); - user.setPassword(cmd.getOptionValue("password")); - user.setEmail(cmd.getOptionValue("email")); - user.setTenantId(cmd.getOptionValue("tenant")); - if(cmd.getOptionValue("enabled") != null) { - user.setEnabled(Boolean.TRUE); - } - - user = keystone.users().create(user).execute(); - - Table t = new Table(new TableModel<User>(Arrays.asList(user)) { + @Override + public void execute(Keystone keystone, CommandLine cmd) { + + User user = new User(); + user.setName(cmd.getOptionValue("name")); + user.setPassword(cmd.getOptionValue("password")); + user.setEmail(cmd.getOptionValue("email")); + user.setTenantId(cmd.getOptionValue("tenant")); + if(cmd.getOptionValue("enabled") != null) { + user.setEnabled(Boolean.TRUE); + } + + user = keystone.users().create(user).execute(); + + Table t = new Table(new TableModel<User>(Arrays.asList(user)) { - @Override - public Column[] getHeaders() { - return new Column[]{ - new Column("id", 32, Column.ALIGN_LEFT), - new Column("name", 10, Column.ALIGN_LEFT), - new Column("email", 22, Column.ALIGN_LEFT), - new Column("tenant", 32, Column.ALIGN_LEFT), - new Column("enabled", 7, Column.ALIGN_LEFT) - }; - } + @Override + public Column[] getHeaders() { + return new Column[]{ + new Column("id", 32, Column.ALIGN_LEFT), + new Column("name", 10, Column.ALIGN_LEFT), + new Column("email", 22, Column.ALIGN_LEFT), + new Column("tenant", 32, Column.ALIGN_LEFT), + new Column("enabled", 7, Column.ALIGN_LEFT) + }; + } - @Override - public String[] getRow(User user) { - return new String[]{ - user.getId(), - user.getName(), - user.getEmail(), - user.getTenantId(), - user.getEnabled().toString() - }; - } - }); - System.out.println(t.render()); - } + @Override + public String[] getRow(User user) { + return new String[]{ + user.getId(), + user.getName(), + user.getEmail(), + user.getTenantId(), + user.getEnabled().toString() + }; + } + }); + System.out.println(t.render()); + } - /* (non-Javadoc) - * @see com.billingstack.commands.Command#getOptions() - */ - @Override - public Options getOptions() { - Options opts = super.getOptions(); - opts.addOption(null, "name", true, "user name"); - opts.addOption(null, "password", true, "user password"); - opts.addOption(null, "email", true, "user email"); - opts.addOption(null, "tenant", true, "tenant id"); - opts.addOption(null, "enabled", false, "enabled"); - return opts; - } - + /* (non-Javadoc) + * @see com.billingstack.commands.Command#getOptions() + */ + @Override + public Options getOptions() { + Options opts = super.getOptions(); + opts.addOption(null, "name", true, "user name"); + opts.addOption(null, "password", true, "user password"); + opts.addOption(null, "email", true, "user email"); + opts.addOption(null, "tenant", true, "tenant id"); + opts.addOption(null, "enabled", false, "enabled"); + return opts; + } + } diff --git a/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneUserDelete.java b/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneUserDelete.java index 59626c6..0c02887 100644 --- a/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneUserDelete.java +++ b/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneUserDelete.java @@ -22,20 +22,20 @@ import com.woorea.openstack.console.utils.ConsoleUtils; import com.woorea.openstack.keystone.Keystone; public class KeystoneUserDelete extends KeystoneCommand { - - public KeystoneUserDelete() { - super("user-delete"); - } + + public KeystoneUserDelete() { + super("user-delete"); + } - @Override - public void execute(Keystone keystone, CommandLine cmd) { - - String[] args = cmd.getArgs(); - if(args.length == 1) { - keystone.users().delete(args[0]).execute(); - System.out.println(new ConsoleUtils().green("OK")); - } - - } - + @Override + public void execute(Keystone keystone, CommandLine cmd) { + + String[] args = cmd.getArgs(); + if(args.length == 1) { + keystone.users().delete(args[0]).execute(); + System.out.println(new ConsoleUtils().green("OK")); + } + + } + } diff --git a/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneUserList.java b/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneUserList.java index 919c765..06362f9 100644 --- a/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneUserList.java +++ b/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneUserList.java @@ -26,41 +26,41 @@ import com.woorea.openstack.keystone.model.User; import com.woorea.openstack.keystone.model.Users; public class KeystoneUserList extends KeystoneCommand { - - public KeystoneUserList() { - super("user-list"); - } + + public KeystoneUserList() { + super("user-list"); + } - @Override - public void execute(Keystone keystone, CommandLine cmd) { - - final Users users = keystone.users().list().execute(); - - Table t = new Table(new TableModel<User>(users.getList()) { + @Override + public void execute(Keystone keystone, CommandLine cmd) { + + final Users users = keystone.users().list().execute(); + + Table t = new Table(new TableModel<User>(users.getList()) { - @Override - public Column[] getHeaders() { - return new Column[]{ - new Column("id", 32, Column.ALIGN_LEFT), - new Column("name", 10, Column.ALIGN_LEFT), - new Column("email", 22, Column.ALIGN_LEFT), - new Column("tenant", 32, Column.ALIGN_LEFT), - new Column("enabled", 7, Column.ALIGN_LEFT) - }; - } + @Override + public Column[] getHeaders() { + return new Column[]{ + new Column("id", 32, Column.ALIGN_LEFT), + new Column("name", 10, Column.ALIGN_LEFT), + new Column("email", 22, Column.ALIGN_LEFT), + new Column("tenant", 32, Column.ALIGN_LEFT), + new Column("enabled", 7, Column.ALIGN_LEFT) + }; + } - @Override - public String[] getRow(User user) { - return new String[]{ - user.getId(), - user.getName(), - user.getEmail(), - user.getTenantId(), - user.getEnabled().toString() - }; - } - }); - System.out.println(t.render()); - } + @Override + public String[] getRow(User user) { + return new String[]{ + user.getId(), + user.getName(), + user.getEmail(), + user.getTenantId(), + user.getEnabled().toString() + }; + } + }); + System.out.println(t.render()); + } } diff --git a/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneUserShow.java b/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneUserShow.java index 95b93fc..c7a8a6e 100644 --- a/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneUserShow.java +++ b/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneUserShow.java @@ -27,43 +27,43 @@ import com.woorea.openstack.keystone.Keystone; import com.woorea.openstack.keystone.model.User; public class KeystoneUserShow extends KeystoneCommand { - - public KeystoneUserShow() { - super("user-show"); - } + + public KeystoneUserShow() { + super("user-show"); + } - @Override - public void execute(Keystone keystone, CommandLine cmd) { - - String[] args = cmd.getArgs(); - if(args.length == 1) { - User user = keystone.users().show(args[0]).execute(); - Table t = new Table(new TableModel<User>(Arrays.asList(user)) { + @Override + public void execute(Keystone keystone, CommandLine cmd) { + + String[] args = cmd.getArgs(); + if(args.length == 1) { + User user = keystone.users().show(args[0]).execute(); + Table t = new Table(new TableModel<User>(Arrays.asList(user)) { - @Override - public Column[] getHeaders() { - return new Column[]{ - new Column("id", 32, Column.ALIGN_LEFT), - new Column("name", 10, Column.ALIGN_LEFT), - new Column("email", 22, Column.ALIGN_LEFT), - new Column("tenant", 32, Column.ALIGN_LEFT), - new Column("enabled", 7, Column.ALIGN_LEFT) - }; - } + @Override + public Column[] getHeaders() { + return new Column[]{ + new Column("id", 32, Column.ALIGN_LEFT), + new Column("name", 10, Column.ALIGN_LEFT), + new Column("email", 22, Column.ALIGN_LEFT), + new Column("tenant", 32, Column.ALIGN_LEFT), + new Column("enabled", 7, Column.ALIGN_LEFT) + }; + } - @Override - public String[] getRow(User user) { - return new String[]{ - user.getId(), - user.getName(), - user.getEmail(), - user.getTenantId(), - user.getEnabled().toString() - }; - } - }); - System.out.println(t.render()); - } - } + @Override + public String[] getRow(User user) { + return new String[]{ + user.getId(), + user.getName(), + user.getEmail(), + user.getTenantId(), + user.getEnabled().toString() + }; + } + }); + System.out.println(t.render()); + } + } } diff --git a/openstack-console/src/main/java/com/woorea/openstack/console/nova/NovaCommand.java b/openstack-console/src/main/java/com/woorea/openstack/console/nova/NovaCommand.java index 11366fd..a45c51d 100644 --- a/openstack-console/src/main/java/com/woorea/openstack/console/nova/NovaCommand.java +++ b/openstack-console/src/main/java/com/woorea/openstack/console/nova/NovaCommand.java @@ -24,18 +24,18 @@ import com.woorea.openstack.nova.Nova; public abstract class NovaCommand extends Command { - - public NovaCommand(String name) { - super(name); - } - - @Override - public void execute(Console console, CommandLine args) { - NovaEnvironment environment = (NovaEnvironment) console.getEnvironment(); - execute(environment.CLIENT, args); - - } - - protected abstract void execute(Nova nova, CommandLine args); + + public NovaCommand(String name) { + super(name); + } + + @Override + public void execute(Console console, CommandLine args) { + NovaEnvironment environment = (NovaEnvironment) console.getEnvironment(); + execute(environment.CLIENT, args); + + } + + protected abstract void execute(Nova nova, CommandLine args); } diff --git a/openstack-console/src/main/java/com/woorea/openstack/console/nova/NovaEnvironment.java b/openstack-console/src/main/java/com/woorea/openstack/console/nova/NovaEnvironment.java index 2bf4a43..0f8f07c 100644 --- a/openstack-console/src/main/java/com/woorea/openstack/console/nova/NovaEnvironment.java +++ b/openstack-console/src/main/java/com/woorea/openstack/console/nova/NovaEnvironment.java @@ -28,54 +28,54 @@ import com.woorea.openstack.keystone.model.authentication.UsernamePassword; import com.woorea.openstack.nova.Nova; public class NovaEnvironment extends Environment { - - public final Nova CLIENT; - - public static final Command NOVA = new Command("nova") { - - @Override - public void execute(Console console, CommandLine args) { - - if(args.getArgs().length == 1) { - Keystone keystone = new Keystone((String) console.getProperty("keystone.endpoint")); - - Access access = keystone.tokens().authenticate( - new UsernamePassword( - console.getProperty("keystone.username"), - console.getProperty("keystone.password") - ) - ) - .withTenantName(console.getProperty("keystone.tenant_name")) - .execute(); - - System.out.println(console.getProperty("nova.endpoint")); - - Nova client = new Nova(console.getProperty("nova.endpoint")+args.getArgs()[0]); - client.setTokenProvider(new OpenStackSimpleTokenProvider(access.getToken().getId())); - - NovaEnvironment environment = new NovaEnvironment(console.getEnvironment(), client); - - environment.register(new NovaServerList()); - - console.setEnvironment(environment); - - } - - } - - }; - - public NovaEnvironment(Environment parent, Nova client) { - super(parent); - CLIENT = client; - } + + public final Nova CLIENT; + + public static final Command NOVA = new Command("nova") { + + @Override + public void execute(Console console, CommandLine args) { + + if(args.getArgs().length == 1) { + Keystone keystone = new Keystone((String) console.getProperty("keystone.endpoint")); + + Access access = keystone.tokens().authenticate( + new UsernamePassword( + console.getProperty("keystone.username"), + console.getProperty("keystone.password") + ) + ) + .withTenantName(console.getProperty("keystone.tenant_name")) + .execute(); + + System.out.println(console.getProperty("nova.endpoint")); + + Nova client = new Nova(console.getProperty("nova.endpoint")+args.getArgs()[0]); + client.setTokenProvider(new OpenStackSimpleTokenProvider(access.getToken().getId())); + + NovaEnvironment environment = new NovaEnvironment(console.getEnvironment(), client); + + environment.register(new NovaServerList()); + + console.setEnvironment(environment); + + } + + } + + }; + + public NovaEnvironment(Environment parent, Nova client) { + super(parent); + CLIENT = client; + } - /* (non-Javadoc) - * @see org.woorea.wsh.Environment#getPrompt() - */ - @Override - public String getPrompt() { - return "nova> "; - } - + /* (non-Javadoc) + * @see org.woorea.wsh.Environment#getPrompt() + */ + @Override + public String getPrompt() { + return "nova> "; + } + } diff --git a/openstack-console/src/main/java/com/woorea/openstack/console/nova/NovaServerList.java b/openstack-console/src/main/java/com/woorea/openstack/console/nova/NovaServerList.java index 4e210c8..8f8f20c 100644 --- a/openstack-console/src/main/java/com/woorea/openstack/console/nova/NovaServerList.java +++ b/openstack-console/src/main/java/com/woorea/openstack/console/nova/NovaServerList.java @@ -26,35 +26,35 @@ import com.woorea.openstack.nova.model.Server; import com.woorea.openstack.nova.model.Servers; public class NovaServerList extends NovaCommand { - - public NovaServerList() { - super("list"); - } - - @Override - public void execute(Nova nova, CommandLine cmd) { - - final Servers servers = nova.servers().list(true).execute(); - - Table t = new Table(new TableModel<Server>(servers.getList()) { - - @Override - public Column[] getHeaders() { - return new Column[]{ - new Column("id", 32, Column.ALIGN_LEFT), - new Column("name", 10, Column.ALIGN_LEFT) - }; - } - - @Override - public String[] getRow(Server server) { - return new String[]{ - server.getId(), - server.getName() - }; - } - }); - System.out.println(t.render()); - } + + public NovaServerList() { + super("list"); + } + + @Override + public void execute(Nova nova, CommandLine cmd) { + + final Servers servers = nova.servers().list(true).execute(); + + Table t = new Table(new TableModel<Server>(servers.getList()) { + + @Override + public Column[] getHeaders() { + return new Column[]{ + new Column("id", 32, Column.ALIGN_LEFT), + new Column("name", 10, Column.ALIGN_LEFT) + }; + } + + @Override + public String[] getRow(Server server) { + return new String[]{ + server.getId(), + server.getName() + }; + } + }); + System.out.println(t.render()); + } } diff --git a/openstack-console/src/main/java/com/woorea/openstack/console/utils/Column.java b/openstack-console/src/main/java/com/woorea/openstack/console/utils/Column.java index 588b252..755ac17 100644 --- a/openstack-console/src/main/java/com/woorea/openstack/console/utils/Column.java +++ b/openstack-console/src/main/java/com/woorea/openstack/console/utils/Column.java @@ -18,64 +18,64 @@ package com.woorea.openstack.console.utils; public class Column { - public static final int ALIGN_LEFT = -1; - public static final int ALIGN_RIGHT = 1; + public static final int ALIGN_LEFT = -1; + public static final int ALIGN_RIGHT = 1; - private String name; - - private int size; - - private int align; + private String name; + + private int size; + + private int align; - public Column(String name, int size, int align) { - super(); - this.name = name; - this.size = size; - this.align = align; - } + public Column(String name, int size, int align) { + super(); + this.name = name; + this.size = size; + this.align = align; + } - /** - * @return the name - */ - public String getName() { - return name; - } + /** + * @return the name + */ + public String getName() { + return name; + } - /** - * @param name the name to set - */ - public void setName(String name) { - this.name = name; - } + /** + * @param name the name to set + */ + public void setName(String name) { + this.name = name; + } - /** - * @return the size - */ - public int getSize() { - return size; - } + /** + * @return the size + */ + public int getSize() { + return size; + } - /** - * @param size the size to set - */ - public void setSize(int size) { - this.size = size; - } + /** + * @param size the size to set + */ + public void setSize(int size) { + this.size = size; + } - /** - * @return the align - */ - public int getAlign() { - return align; - } + /** + * @return the align + */ + public int getAlign() { + return align; + } - /** - * @param align the align to set - */ - public void setAlign(int align) { - this.align = align; - } + /** + * @param align the align to set + */ + public void setAlign(int align) { + this.align = align; + } - + } diff --git a/openstack-console/src/main/java/com/woorea/openstack/console/utils/ConsoleUtils.java b/openstack-console/src/main/java/com/woorea/openstack/console/utils/ConsoleUtils.java index e38f66c..8166217 100644 --- a/openstack-console/src/main/java/com/woorea/openstack/console/utils/ConsoleUtils.java +++ b/openstack-console/src/main/java/com/woorea/openstack/console/utils/ConsoleUtils.java @@ -17,47 +17,47 @@ package com.woorea.openstack.console.utils; public class ConsoleUtils { - - public static final String RED = "\u001B[31m"; - - public static final String GREEN = "\u001B[32m"; - - public static final String YELLOW = "\u001B[33m"; - - public static final String END = "\u001B[0m"; - - private StringBuilder sb = new StringBuilder(); - - public ConsoleUtils append(String text) { - sb.append(text); - return this; - } - - public ConsoleUtils red(String text) { - sb.append(ConsoleUtils.RED).append(text).append(END); - return this; - } - - public ConsoleUtils green(String text) { - sb.append(ConsoleUtils.GREEN).append(text).append(END); - return this; - } - - public ConsoleUtils yellow(String text) { - sb.append(ConsoleUtils.YELLOW).append(text).append(END); - return this; - } - - public static void log(String text) { - System.out.println(new ConsoleUtils().yellow("| ").append(text)); - } + + public static final String RED = "\u001B[31m"; + + public static final String GREEN = "\u001B[32m"; + + public static final String YELLOW = "\u001B[33m"; + + public static final String END = "\u001B[0m"; + + private StringBuilder sb = new StringBuilder(); + + public ConsoleUtils append(String text) { + sb.append(text); + return this; + } + + public ConsoleUtils red(String text) { + sb.append(ConsoleUtils.RED).append(text).append(END); + return this; + } + + public ConsoleUtils green(String text) { + sb.append(ConsoleUtils.GREEN).append(text).append(END); + return this; + } + + public ConsoleUtils yellow(String text) { + sb.append(ConsoleUtils.YELLOW).append(text).append(END); + return this; + } + + public static void log(String text) { + System.out.println(new ConsoleUtils().yellow("| ").append(text)); + } - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return sb.toString(); - } - + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return sb.toString(); + } + } diff --git a/openstack-console/src/main/java/com/woorea/openstack/console/utils/Table.java b/openstack-console/src/main/java/com/woorea/openstack/console/utils/Table.java index 84b168d..d25d16d 100644 --- a/openstack-console/src/main/java/com/woorea/openstack/console/utils/Table.java +++ b/openstack-console/src/main/java/com/woorea/openstack/console/utils/Table.java @@ -18,80 +18,80 @@ package com.woorea.openstack.console.utils; public class Table { - - private StringBuilder sb = new StringBuilder(); - - private TableModel<?> model; - - public Table(TableModel<?> model) { - this.model = model; - } - - public StringBuilder render() { - header(); - for(String[] row : model.getRows()) { - int i = 0; - for(String column : row) { - Column columnModel = model.getHeaders()[i]; - sb.append("| "); - if(column != null) { - if(Column.ALIGN_RIGHT == columnModel.getAlign()) { - for(int j = 0; j < columnModel.getSize() - column.length(); j++) { - sb.append(" "); - } - } - sb.append(column.length() <= columnModel.getSize() ? column : column.substring(0, columnModel.getSize())); - if(Column.ALIGN_LEFT == columnModel.getAlign()) { - for(int j = 0; j < columnModel.getSize() - column.length(); j++) { - sb.append(" "); - } - } - } else { - for(int k = 0; k < columnModel.getSize(); k++) { - sb.append(" "); - } - } - sb.append(" "); - i++; - } - sb.append("|\n"); - } - for(Column c : model.getHeaders()) { - sb.append("+"); - for(int i = 0; i < c.getSize() + 2; i++) { - sb.append("-"); - } - } - sb.append("+\n"); - return sb; - } - - public void header() { - for(Column c : model.getHeaders()) { - sb.append("+"); - for(int i = 0; i < c.getSize() + 2; i++) { - sb.append("-"); - } - } - sb.append("+\n"); - - for(Column c : model.getHeaders()) { - sb.append("| "); - sb.append(c.getName()); - for(int i = 0; i < c.getSize() - c.getName().length(); i++) { - sb.append(" "); - } - sb.append(" "); - } - sb.append("|\n"); - - for(Column c : model.getHeaders()) { - sb.append("+"); - for(int i = 0; i < c.getSize() + 2; i++) { - sb.append("-"); - } - } - sb.append("+\n"); - } + + private StringBuilder sb = new StringBuilder(); + + private TableModel<?> model; + + public Table(TableModel<?> model) { + this.model = model; + } + + public StringBuilder render() { + header(); + for(String[] row : model.getRows()) { + int i = 0; + for(String column : row) { + Column columnModel = model.getHeaders()[i]; + sb.append("| "); + if(column != null) { + if(Column.ALIGN_RIGHT == columnModel.getAlign()) { + for(int j = 0; j < columnModel.getSize() - column.length(); j++) { + sb.append(" "); + } + } + sb.append(column.length() <= columnModel.getSize() ? column : column.substring(0, columnModel.getSize())); + if(Column.ALIGN_LEFT == columnModel.getAlign()) { + for(int j = 0; j < columnModel.getSize() - column.length(); j++) { + sb.append(" "); + } + } + } else { + for(int k = 0; k < columnModel.getSize(); k++) { + sb.append(" "); + } + } + sb.append(" "); + i++; + } + sb.append("|\n"); + } + for(Column c : model.getHeaders()) { + sb.append("+"); + for(int i = 0; i < c.getSize() + 2; i++) { + sb.append("-"); + } + } + sb.append("+\n"); + return sb; + } + + public void header() { + for(Column c : model.getHeaders()) { + sb.append("+"); + for(int i = 0; i < c.getSize() + 2; i++) { + sb.append("-"); + } + } + sb.append("+\n"); + + for(Column c : model.getHeaders()) { + sb.append("| "); + sb.append(c.getName()); + for(int i = 0; i < c.getSize() - c.getName().length(); i++) { + sb.append(" "); + } + sb.append(" "); + } + sb.append("|\n"); + + for(Column c : model.getHeaders()) { + sb.append("+"); + for(int i = 0; i < c.getSize() + 2; i++) { + sb.append("-"); + } + } + sb.append("+\n"); + } } diff --git a/openstack-console/src/main/java/com/woorea/openstack/console/utils/TableModel.java b/openstack-console/src/main/java/com/woorea/openstack/console/utils/TableModel.java index 527f26d..3715c85 100644 --- a/openstack-console/src/main/java/com/woorea/openstack/console/utils/TableModel.java +++ b/openstack-console/src/main/java/com/woorea/openstack/console/utils/TableModel.java @@ -19,23 +19,23 @@ package com.woorea.openstack.console.utils; import java.util.List; public abstract class TableModel<T> { - - protected List<T> data; - - public TableModel(List<T> data) { - this.data = data; - } - - public abstract Column[] getHeaders(); + + protected List<T> data; + + public TableModel(List<T> data) { + this.data = data; + } + + public abstract Column[] getHeaders(); - public final String[][] getRows() { - String[][] rows = new String[data.size()][]; - for(int i = 0; i < data.size(); i++) { - rows[i] = getRow(data.get(i)); - } - return rows; - } - - public abstract String[] getRow(T data); - + public final String[][] getRows() { + String[][] rows = new String[data.size()][]; + for(int i = 0; i < data.size(); i++) { + rows[i] = getRow(data.get(i)); + } + return rows; + } + + public abstract String[] getRow(T data); + } diff --git a/openstack-examples/src/main/java/com/woorea/openstack/examples/ExamplesConfiguration.java b/openstack-examples/src/main/java/com/woorea/openstack/examples/ExamplesConfiguration.java index 0d034e8..2fa2f5f 100644 --- a/openstack-examples/src/main/java/com/woorea/openstack/examples/ExamplesConfiguration.java +++ b/openstack-examples/src/main/java/com/woorea/openstack/examples/ExamplesConfiguration.java @@ -23,28 +23,28 @@ import com.woorea.openstack.keystone.model.Tenant; public class ExamplesConfiguration { - public static final String KEYSTONE_AUTH_URL = "https://region-a.geo-1.identity.hpcloudsvc.com:35357/v3"; - - public static final String KEYSTONE_USERNAME = ""; - - public static final String KEYSTONE_PASSWORD = ""; - - public static final String KEYSTONE_ENDPOINT = "https://region-a.geo-1.identity.hpcloudsvc.com:35357/v3"; - - public static final String TENANT_NAME = "admin"; + public static final String KEYSTONE_AUTH_URL = "https://region-a.geo-1.identity.hpcloudsvc.com:35357/v3"; + + public static final String KEYSTONE_USERNAME = ""; + + public static final String KEYSTONE_PASSWORD = ""; + + public static final String KEYSTONE_ENDPOINT = "https://region-a.geo-1.identity.hpcloudsvc.com:35357/v3"; + + public static final String TENANT_NAME = "admin"; - public static final String NOVA_ENDPOINT = "http://compute/v2"; - - public static final String CEILOMETER_ENDPOINT = ""; - - public static void main(String[] args) { - Keystone client = new Keystone(KEYSTONE_ENDPOINT); - client.setTokenProvider(new OpenStackSimpleTokenProvider("secret0")); - client.tenants().delete("36c481aec1d54fc49190c92c3ef6840a").execute(); - Tenant tenant = client.tenants().create(new Tenant("new_api")).execute(); - System.out.println(tenant); - System.out.println(client.tenants().list().execute()); - client.tenants().delete(tenant.getId()).execute(); - } - + public static final String NOVA_ENDPOINT = "http://compute/v2"; + + public static final String CEILOMETER_ENDPOINT = ""; + + public static void main(String[] args) { + Keystone client = new Keystone(KEYSTONE_ENDPOINT); + client.setTokenProvider(new OpenStackSimpleTokenProvider("secret0")); + client.tenants().delete("36c481aec1d54fc49190c92c3ef6840a").execute(); + Tenant tenant = client.tenants().create(new Tenant("new_api")).execute(); + System.out.println(tenant); + System.out.println(client.tenants().list().execute()); + client.tenants().delete(tenant.getId()).execute(); + } + } diff --git a/openstack-examples/src/main/java/com/woorea/openstack/examples/compute/NovaListFlavors.java b/openstack-examples/src/main/java/com/woorea/openstack/examples/compute/NovaListFlavors.java index 8b449e9..25b196c 100644 --- a/openstack-examples/src/main/java/com/woorea/openstack/examples/compute/NovaListFlavors.java +++ b/openstack-examples/src/main/java/com/woorea/openstack/examples/compute/NovaListFlavors.java @@ -29,39 +29,39 @@ import com.woorea.openstack.nova.model.Flavors; public class NovaListFlavors { - /** - * @param args - */ - public static void main(String[] args) { - Keystone keystone = new Keystone(ExamplesConfiguration.KEYSTONE_AUTH_URL); - Access access = keystone.tokens().authenticate( - new UsernamePassword(ExamplesConfiguration.KEYSTONE_USERNAME, ExamplesConfiguration.KEYSTONE_PASSWORD)) - .execute(); - - //use the token in the following requests - keystone.token(access.getToken().getId()); - - Tenants tenants = keystone.tenants().list().execute(); - - //try to exchange token using the first tenant - if(tenants.getList().size() > 0) { - - access = keystone.tokens().authenticate(new TokenAuthentication(access.getToken().getId())).withTenantId(tenants.getList().get(0).getId()).execute(); - - //NovaClient novaClient = new NovaClient(KeystoneUtils.findEndpointURL(access.getServiceCatalog(), "compute", null, "public"), access.getToken().getId()); - Nova novaClient = new Nova(ExamplesConfiguration.NOVA_ENDPOINT.concat("/").concat(tenants.getList().get(0).getId())); - novaClient.token(access.getToken().getId()); - //novaClient.enableLogging(Logger.getLogger("nova"), 100 * 1024); - - Flavors flavors = novaClient.flavors().list(true).execute(); - for(Flavor flavor : flavors) { - System.out.println(flavor); - } - - } else { - System.out.println("No tenants found!"); - } - - } + /** + * @param args + */ + public static void main(String[] args) { + Keystone keystone = new Keystone(ExamplesConfiguration.KEYSTONE_AUTH_URL); + Access access = keystone.tokens().authenticate( + new UsernamePassword(ExamplesConfiguration.KEYSTONE_USERNAME, ExamplesConfiguration.KEYSTONE_PASSWORD)) + .execute(); + + //use the token in the following requests + keystone.token(access.getToken().getId()); + + Tenants tenants = keystone.tenants().list().execute(); + + //try to exchange token using the first tenant + if(tenants.getList().size() > 0) { + + access = keystone.tokens().authenticate(new TokenAuthentication(access.getToken().getId())).withTenantId(tenants.getList().get(0).getId()).execute(); + + //NovaClient novaClient = new NovaClient(KeystoneUtils.findEndpointURL(access.getServiceCatalog(), "compute", null, "public"), access.getToken().getId()); + Nova novaClient = new Nova(ExamplesConfiguration.NOVA_ENDPOINT.concat("/").concat(tenants.getList().get(0).getId())); + novaClient.token(access.getToken().getId()); + //novaClient.enableLogging(Logger.getLogger("nova"), 100 * 1024); + + Flavors flavors = novaClient.flavors().list(true).execute(); + for(Flavor flavor : flavors) { + System.out.println(flavor); + } + + } else { + System.out.println("No tenants found!"); + } + + } } diff --git a/openstack-examples/src/main/java/com/woorea/openstack/examples/compute/NovaListImages.java b/openstack-examples/src/main/java/com/woorea/openstack/examples/compute/NovaListImages.java index 37cd70f..1f7a431 100644 --- a/openstack-examples/src/main/java/com/woorea/openstack/examples/compute/NovaListImages.java +++ b/openstack-examples/src/main/java/com/woorea/openstack/examples/compute/NovaListImages.java @@ -28,41 +28,41 @@ import com.woorea.openstack.nova.model.Image; import com.woorea.openstack.nova.model.Images; public class NovaListImages { - - /** - * @param args - */ - public static void main(String[] args) { - - Keystone keystone = new Keystone(ExamplesConfiguration.KEYSTONE_AUTH_URL); - Access access = keystone.tokens().authenticate(new UsernamePassword(ExamplesConfiguration.KEYSTONE_USERNAME, ExamplesConfiguration.KEYSTONE_PASSWORD)).execute(); - - //use the token in the following requests - keystone.token(access.getToken().getId()); - - Tenants tenants = keystone.tenants().list().execute(); - - //try to exchange token using the first tenant - if(tenants.getList().size() > 0) { - - access = keystone.tokens().authenticate(new TokenAuthentication(access.getToken().getId())) - .withTenantId(tenants.getList().get(0).getId()) - .execute(); - - //NovaClient novaClient = new NovaClient(KeystoneUtils.findEndpointURL(access.getServiceCatalog(), "compute", null, "public"), access.getToken().getId()); - Nova novaClient = new Nova(ExamplesConfiguration.NOVA_ENDPOINT.concat("/").concat(tenants.getList().get(0).getId())); - novaClient.token(access.getToken().getId()); - //novaClient.enableLogging(Logger.getLogger("nova"), 100 * 1024); - - Images images = novaClient.images().list(true).execute(); - for(Image image : images) { - System.out.println(image); - } - - } else { - System.out.println("No tenants found!"); - } - - } + + /** + * @param args + */ + public static void main(String[] args) { + + Keystone keystone = new Keystone(ExamplesConfiguration.KEYSTONE_AUTH_URL); + Access access = keystone.tokens().authenticate(new UsernamePassword(ExamplesConfiguration.KEYSTONE_USERNAME, ExamplesConfiguration.KEYSTONE_PASSWORD)).execute(); + + //use the token in the following requests + keystone.token(access.getToken().getId()); + + Tenants tenants = keystone.tenants().list().execute(); + + //try to exchange token using the first tenant + if(tenants.getList().size() > 0) { + + access = keystone.tokens().authenticate(new TokenAuthentication(access.getToken().getId())) + .withTenantId(tenants.getList().get(0).getId()) + .execute(); + + //NovaClient novaClient = new NovaClient(KeystoneUtils.findEndpointURL(access.getServiceCatalog(), "compute", null, "public"), access.getToken().getId()); + Nova novaClient = new Nova(ExamplesConfiguration.NOVA_ENDPOINT.concat("/").concat(tenants.getList().get(0).getId())); + novaClient.token(access.getToken().getId()); + //novaClient.enableLogging(Logger.getLogger("nova"), 100 * 1024); + + Images images = novaClient.images().list(true).execute(); + for(Image image : images) { + System.out.println(image); + } + + } else { + System.out.println("No tenants found!"); + } + + } } diff --git a/openstack-examples/src/main/java/com/woorea/openstack/examples/compute/NovaListServers.java b/openstack-examples/src/main/java/com/woorea/openstack/examples/compute/NovaListServers.java index 58faf69..0331a62 100644 --- a/openstack-examples/src/main/java/com/woorea/openstack/examples/compute/NovaListServers.java +++ b/openstack-examples/src/main/java/com/woorea/openstack/examples/compute/NovaListServers.java @@ -26,29 +26,29 @@ import com.woorea.openstack.nova.model.Server; import com.woorea.openstack.nova.model.Servers; public class NovaListServers { - - /** - * @param args - */ - public static void main(String[] args) { - Keystone keystone = new Keystone(ExamplesConfiguration.KEYSTONE_AUTH_URL); - Access access = keystone.tokens().authenticate(new UsernamePassword(ExamplesConfiguration.KEYSTONE_USERNAME, ExamplesConfiguration.KEYSTONE_PASSWORD)) - .withTenantName("demo") - .execute(); - - //use the token in the following requests - keystone.token(access.getToken().getId()); - - //NovaClient novaClient = new NovaClient(KeystoneUtils.findEndpointURL(access.getServiceCatalog(), "compute", null, "public"), access.getToken().getId()); - Nova novaClient = new Nova(ExamplesConfiguration.NOVA_ENDPOINT.concat("/").concat(access.getToken().getTenant().getId())); - novaClient.token(access.getToken().getId()); - //novaClient.enableLogging(Logger.getLogger("nova"), 100 * 1024); - - Servers servers = novaClient.servers().list(true).execute(); - for(Server server : servers) { - System.out.println(server); - } - - } + + /** + * @param args + */ + public static void main(String[] args) { + Keystone keystone = new Keystone(ExamplesConfiguration.KEYSTONE_AUTH_URL); + Access access = keystone.tokens().authenticate(new UsernamePassword(ExamplesConfiguration.KEYSTONE_USERNAME, ExamplesConfiguration.KEYSTONE_PASSWORD)) + .withTenantName("demo") + .execute(); + + //use the token in the following requests + keystone.token(access.getToken().getId()); + + //NovaClient novaClient = new NovaClient(KeystoneUtils.findEndpointURL(access.getServiceCatalog(), "compute", null, "public"), access.getToken().getId()); + Nova novaClient = new Nova(ExamplesConfiguration.NOVA_ENDPOINT.concat("/").concat(access.getToken().getTenant().getId())); + novaClient.token(access.getToken().getId()); + //novaClient.enableLogging(Logger.getLogger("nova"), 100 * 1024); + + Servers servers = novaClient.servers().list(true).execute(); + for(Server server : servers) { + System.out.println(server); + } + + } } diff --git a/openstack-examples/src/main/java/com/woorea/openstack/examples/compute/NovaStopStartServer.java b/openstack-examples/src/main/java/com/woorea/openstack/examples/compute/NovaStopStartServer.java index d113d21..dfc5f06 100644 --- a/openstack-examples/src/main/java/com/woorea/openstack/examples/compute/NovaStopStartServer.java +++ b/openstack-examples/src/main/java/com/woorea/openstack/examples/compute/NovaStopStartServer.java @@ -25,32 +25,32 @@ import com.woorea.openstack.nova.api.ServersResource; import com.woorea.openstack.nova.model.Servers; public class NovaStopStartServer { - public static void main(String[] args) throws InterruptedException { - Keystone keystone = new Keystone(ExamplesConfiguration.KEYSTONE_AUTH_URL); - Access access = keystone.tokens().authenticate(new UsernamePassword(ExamplesConfiguration.KEYSTONE_USERNAME, ExamplesConfiguration.KEYSTONE_PASSWORD)) - .withTenantName(ExamplesConfiguration.TENANT_NAME) - .execute(); - - //use the token in the following requests - keystone.token(access.getToken().getId()); - - Nova novaClient = new Nova(ExamplesConfiguration.NOVA_ENDPOINT.concat("/").concat(access.getToken().getTenant().getId())); - novaClient.token(access.getToken().getId()); - - Servers servers = novaClient.servers().list(true).execute(); - if(servers.getList().size() > 0) { - - // Server has to be in activated state. - ServersResource.StopServer stopServer = novaClient.servers().stop(servers.getList().get(0).getId()); - stopServer.endpoint(ExamplesConfiguration.NOVA_ENDPOINT); - stopServer.execute(); - - // Wait until server shutdown. Or 400 error occurs. - Thread.sleep(5000); - - ServersResource.StartServer startServer = novaClient.servers().start(servers.getList().get(0).getId()); - startServer.endpoint(ExamplesConfiguration.NOVA_ENDPOINT); - startServer.execute(); - } - } + public static void main(String[] args) throws InterruptedException { + Keystone keystone = new Keystone(ExamplesConfiguration.KEYSTONE_AUTH_URL); + Access access = keystone.tokens().authenticate(new UsernamePassword(ExamplesConfiguration.KEYSTONE_USERNAME, ExamplesConfiguration.KEYSTONE_PASSWORD)) + .withTenantName(ExamplesConfiguration.TENANT_NAME) + .execute(); + + //use the token in the following requests + keystone.token(access.getToken().getId()); + + Nova novaClient = new Nova(ExamplesConfiguration.NOVA_ENDPOINT.concat("/").concat(access.getToken().getTenant().getId())); + novaClient.token(access.getToken().getId()); + + Servers servers = novaClient.servers().list(true).execute(); + if(servers.getList().size() > 0) { + + // Server has to be in activated state. + ServersResource.StopServer stopServer = novaClient.servers().stop(servers.getList().get(0).getId()); + stopServer.endpoint(ExamplesConfiguration.NOVA_ENDPOINT); + stopServer.execute(); + + // Wait until server shutdown. Or 400 error occurs. + Thread.sleep(5000); + + ServersResource.StartServer startServer = novaClient.servers().start(servers.getList().get(0).getId()); + startServer.endpoint(ExamplesConfiguration.NOVA_ENDPOINT); + startServer.execute(); + } + } } diff --git a/openstack-examples/src/main/java/com/woorea/openstack/examples/glance/GlanceListImages.java b/openstack-examples/src/main/java/com/woorea/openstack/examples/glance/GlanceListImages.java index 1e9802a..f0eef65 100644 --- a/openstack-examples/src/main/java/com/woorea/openstack/examples/glance/GlanceListImages.java +++ b/openstack-examples/src/main/java/com/woorea/openstack/examples/glance/GlanceListImages.java @@ -33,67 +33,67 @@ import java.io.IOException; public class GlanceListImages { - protected static String IMAGE_CONTENT = "Hello World!"; - - /** - * @param args - */ - public static void main(String[] args) { - KeystoneTokenProvider keystone = new KeystoneTokenProvider( - ExamplesConfiguration.KEYSTONE_AUTH_URL, - ExamplesConfiguration.KEYSTONE_USERNAME, - ExamplesConfiguration.KEYSTONE_PASSWORD); - - Access access = keystone.getAccessByTenant(ExamplesConfiguration.TENANT_NAME); - - Service glanceService = null; - - for (Service service : access.getServiceCatalog()) { - if (service.getType().equals("image")) { - glanceService = service; - break; - } - } - - if (glanceService == null) { - throw new RuntimeException("Glance service not found"); - } - - for (Endpoint endpoint : glanceService.getEndpoints()) { - Glance glance = new Glance(endpoint.getPublicURL() + "/v1"); - glance.setTokenProvider(keystone - .getProviderByTenant(ExamplesConfiguration.TENANT_NAME)); - - // Creating a new image - Image newImage = new Image(); - newImage.setDiskFormat("raw"); - newImage.setContainerFormat("bare"); - newImage.setName("os-java-glance-test"); - newImage = glance.images().create(newImage).execute(); - - // Uploading image - ImageUpload uploadImage = new ImageUpload(newImage); - uploadImage.setInputStream(new ByteArrayInputStream(IMAGE_CONTENT.getBytes())); - glance.images().upload(newImage.getId(), uploadImage).execute(); - - // Downloading the image and displaying the image content - try { - byte[] imgContent = new byte[IMAGE_CONTENT.length()]; - ImageDownload downloadImage = glance.images().download(newImage.getId()).execute(); - downloadImage.getInputStream().read(imgContent, 0, imgContent.length); - System.out.println(new String(imgContent)); - } catch (IOException e) { - e.printStackTrace(); - } - - Images images = glance.images().list(false).execute(); - - for (Image image : images) { - System.out.println(glance.images().show(image.getId()).execute()); - } - - glance.images().delete(newImage.getId()).execute(); - } - } + protected static String IMAGE_CONTENT = "Hello World!"; + + /** + * @param args + */ + public static void main(String[] args) { + KeystoneTokenProvider keystone = new KeystoneTokenProvider( + ExamplesConfiguration.KEYSTONE_AUTH_URL, + ExamplesConfiguration.KEYSTONE_USERNAME, + ExamplesConfiguration.KEYSTONE_PASSWORD); + + Access access = keystone.getAccessByTenant(ExamplesConfiguration.TENANT_NAME); + + Service glanceService = null; + + for (Service service : access.getServiceCatalog()) { + if (service.getType().equals("image")) { + glanceService = service; + break; + } + } + + if (glanceService == null) { + throw new RuntimeException("Glance service not found"); + } + + for (Endpoint endpoint : glanceService.getEndpoints()) { + Glance glance = new Glance(endpoint.getPublicURL() + "/v1"); + glance.setTokenProvider(keystone + .getProviderByTenant(ExamplesConfiguration.TENANT_NAME)); + + // Creating a new image + Image newImage = new Image(); + newImage.setDiskFormat("raw"); + newImage.setContainerFormat("bare"); + newImage.setName("os-java-glance-test"); + newImage = glance.images().create(newImage).execute(); + + // Uploading image + ImageUpload uploadImage = new ImageUpload(newImage); + uploadImage.setInputStream(new ByteArrayInputStream(IMAGE_CONTENT.getBytes())); + glance.images().upload(newImage.getId(), uploadImage).execute(); + + // Downloading the image and displaying the image content + try { + byte[] imgContent = new byte[IMAGE_CONTENT.length()]; + ImageDownload downloadImage = glance.images().download(newImage.getId()).execute(); + downloadImage.getInputStream().read(imgContent, 0, imgContent.length); + System.out.println(new String(imgContent)); + } catch (IOException e) { + e.printStackTrace(); + } + + Images images = glance.images().list(false).execute(); + + for (Image image : images) { + System.out.println(glance.images().show(image.getId()).execute()); + } + + glance.images().delete(newImage.getId()).execute(); + } + } } diff --git a/openstack-examples/src/main/java/com/woorea/openstack/examples/keystone/KeystoneCreateTenant.java b/openstack-examples/src/main/java/com/woorea/openstack/examples/keystone/KeystoneCreateTenant.java index 34bd13d..5ef94cb 100644 --- a/openstack-examples/src/main/java/com/woorea/openstack/examples/keystone/KeystoneCreateTenant.java +++ b/openstack-examples/src/main/java/com/woorea/openstack/examples/keystone/KeystoneCreateTenant.java @@ -26,27 +26,27 @@ import com.woorea.openstack.keystone.model.authentication.UsernamePassword; public class KeystoneCreateTenant { - /** - * @param args - */ - public static void main(String[] args) { - Keystone keystone = new Keystone(ExamplesConfiguration.KEYSTONE_AUTH_URL); - //access with unscoped token - Access access = keystone.tokens().authenticate( - new UsernamePassword(ExamplesConfiguration.KEYSTONE_USERNAME, ExamplesConfiguration.KEYSTONE_PASSWORD)) - .execute(); + /** + * @param args + */ + public static void main(String[] args) { + Keystone keystone = new Keystone(ExamplesConfiguration.KEYSTONE_AUTH_URL); + //access with unscoped token + Access access = keystone.tokens().authenticate( + new UsernamePassword(ExamplesConfiguration.KEYSTONE_USERNAME, ExamplesConfiguration.KEYSTONE_PASSWORD)) + .execute(); - access = keystone.tokens().authenticate(new TokenAuthentication(access.getToken().getId())).withTenantName("admin").execute(); + access = keystone.tokens().authenticate(new TokenAuthentication(access.getToken().getId())).withTenantName("admin").execute(); - Tenant tenant = new Tenant(); - tenant.setName("benn.cs"); - tenant.setDescription("benn.cs"); - tenant.setEnabled(true); - //Get the adminURL client and use the token got above - keystone = new Keystone("http://keystone.x.org/v2.0"); - keystone.token(access.getToken().getId()); - tenant = keystone.tenants().create(tenant).execute(); - System.out.println(tenant); - keystone.tenants().delete(tenant.getId()); - } + Tenant tenant = new Tenant(); + tenant.setName("benn.cs"); + tenant.setDescription("benn.cs"); + tenant.setEnabled(true); + //Get the adminURL client and use the token got above + keystone = new Keystone("http://keystone.x.org/v2.0"); + keystone.token(access.getToken().getId()); + tenant = keystone.tenants().create(tenant).execute(); + System.out.println(tenant); + keystone.tenants().delete(tenant.getId()); + } } diff --git a/openstack-examples/src/main/java/com/woorea/openstack/examples/keystone/KeystoneCreateUser.java b/openstack-examples/src/main/java/com/woorea/openstack/examples/keystone/KeystoneCreateUser.java index 0b9392c..e99d1ce 100644 --- a/openstack-examples/src/main/java/com/woorea/openstack/examples/keystone/KeystoneCreateUser.java +++ b/openstack-examples/src/main/java/com/woorea/openstack/examples/keystone/KeystoneCreateUser.java @@ -26,29 +26,29 @@ import com.woorea.openstack.keystone.model.authentication.UsernamePassword; public class KeystoneCreateUser { - /** - * @param args - */ - public static void main(String[] args) { - Keystone keystone = new Keystone(ExamplesConfiguration.KEYSTONE_AUTH_URL); - //access with unscoped token - Access access = keystone.tokens() - .authenticate(new UsernamePassword(ExamplesConfiguration.KEYSTONE_USERNAME, ExamplesConfiguration.KEYSTONE_PASSWORD)) - .withTenantName("admin") - .execute(); + /** + * @param args + */ + public static void main(String[] args) { + Keystone keystone = new Keystone(ExamplesConfiguration.KEYSTONE_AUTH_URL); + //access with unscoped token + Access access = keystone.tokens() + .authenticate(new UsernamePassword(ExamplesConfiguration.KEYSTONE_USERNAME, ExamplesConfiguration.KEYSTONE_PASSWORD)) + .withTenantName("admin") + .execute(); - User user = new User(); - user.setEmail("luis@woorea.es"); - user.setUsername("luis.gervaso"); - user.setPassword("password.0"); - user.setName("Luis"); - user.setEnabled(Boolean.TRUE); + User user = new User(); + user.setEmail("luis@woorea.es"); + user.setUsername("luis.gervaso"); + user.setPassword("password.0"); + user.setName("Luis"); + user.setEnabled(Boolean.TRUE); - keystone = new Keystone("http://keystone.x.org/v2.0"); - keystone.setTokenProvider(new OpenStackSimpleTokenProvider(access.getToken().getId())); - //keystone.enableLogging(Logger.getLogger("keystone"), 10000); - user = keystone.users().create(user).execute(); - System.out.println(user); - keystone.users().delete(user.getId()).execute(); - } + keystone = new Keystone("http://keystone.x.org/v2.0"); + keystone.setTokenProvider(new OpenStackSimpleTokenProvider(access.getToken().getId())); + //keystone.enableLogging(Logger.getLogger("keystone"), 10000); + user = keystone.users().create(user).execute(); + System.out.println(user); + keystone.users().delete(user.getId()).execute(); + } } diff --git a/openstack-examples/src/main/java/com/woorea/openstack/examples/metering/v2/TestAll.java b/openstack-examples/src/main/java/com/woorea/openstack/examples/metering/v2/TestAll.java index 279775a..bdb20c0 100644 --- a/openstack-examples/src/main/java/com/woorea/openstack/examples/metering/v2/TestAll.java +++ b/openstack-examples/src/main/java/com/woorea/openstack/examples/metering/v2/TestAll.java @@ -30,49 +30,49 @@ import com.woorea.openstack.keystone.model.authentication.UsernamePassword; public class TestAll { - /** - * @param args - */ - public static void main(String[] args) { - Keystone keystone = new Keystone(ExamplesConfiguration.KEYSTONE_AUTH_URL); - Access access = keystone.tokens() - .authenticate(new UsernamePassword(ExamplesConfiguration.KEYSTONE_USERNAME, ExamplesConfiguration.KEYSTONE_PASSWORD)) - .withTenantName("admin") - .execute(); - - Ceilometer ceilometer = new Ceilometer(ExamplesConfiguration.CEILOMETER_ENDPOINT); - ceilometer.setTokenProvider(new OpenStackSimpleTokenProvider(access.getToken().getId())); + /** + * @param args + */ + public static void main(String[] args) { + Keystone keystone = new Keystone(ExamplesConfiguration.KEYSTONE_AUTH_URL); + Access access = keystone.tokens() + .authenticate(new UsernamePassword(ExamplesConfiguration.KEYSTONE_USERNAME, ExamplesConfiguration.KEYSTONE_PASSWORD)) + .withTenantName("admin") + .execute(); + + Ceilometer ceilometer = new Ceilometer(ExamplesConfiguration.CEILOMETER_ENDPOINT); + ceilometer.setTokenProvider(new OpenStackSimpleTokenProvider(access.getToken().getId())); - /* - List<Resource> resources = ceilometer.execute(new ResourceList().eq("resource_id", "23b55841eedd41e99d5f3f32149ca086")); - - - for(Resource r : resources) { - Resource resource = ceilometer.execute(new ResourceShow().id(r.getResource())); - } - */ - - /* - //List<Meter> meters = ceilometer.meters().list().execute(); //execute(new MeterList().eq("project_id", "948eeb593acd4223ad572c49e1ef5709")); - - - for(Meter m : meters) { - System.out.println(m); - -// List<Sample> samples = ceilometer.execute(new MeterShow().name(m.getName())); -// for(Sample s : samples) { -// System.out.println("\t" + s); -// } - - List<Statistics> stats = ceilometer.meters().statistics().execute(); // (new MeterStatistics().name(m.getName())); - for(Statistics s : stats) { - System.out.println("\t\t" + s); - } - - - } - */ - - } + /* + List<Resource> resources = ceilometer.execute(new ResourceList().eq("resource_id", "23b55841eedd41e99d5f3f32149ca086")); + + + for(Resource r : resources) { + Resource resource = ceilometer.execute(new ResourceShow().id(r.getResource())); + } + */ + + /* + //List<Meter> meters = ceilometer.meters().list().execute(); //execute(new MeterList().eq("project_id", "948eeb593acd4223ad572c49e1ef5709")); + + + for(Meter m : meters) { + System.out.println(m); + +// List<Sample> samples = ceilometer.execute(new MeterShow().name(m.getName())); +// for(Sample s : samples) { +// System.out.println("\t" + s); +// } + + List<Statistics> stats = ceilometer.meters().statistics().execute(); // (new MeterStatistics().name(m.getName())); + for(Statistics s : stats) { + System.out.println("\t\t" + s); + } + + + } + */ + + } } diff --git a/openstack-examples/src/main/java/com/woorea/openstack/examples/network/QuantumListNetworks.java b/openstack-examples/src/main/java/com/woorea/openstack/examples/network/QuantumListNetworks.java index a700e1c..3fdaa9d 100644 --- a/openstack-examples/src/main/java/com/woorea/openstack/examples/network/QuantumListNetworks.java +++ b/openstack-examples/src/main/java/com/woorea/openstack/examples/network/QuantumListNetworks.java @@ -31,33 +31,33 @@ import com.woorea.openstack.quantum.model.Networks; public class QuantumListNetworks { - /** - * @param args - */ - public static void main(String[] args) { - Keystone keystone = new Keystone(ExamplesConfiguration.KEYSTONE_AUTH_URL); - // access with unscoped token - Access access = keystone.tokens().authenticate( - new UsernamePassword(ExamplesConfiguration.KEYSTONE_USERNAME, ExamplesConfiguration.KEYSTONE_PASSWORD)) - .execute(); - // use the token in the following requests - keystone.setTokenProvider(new OpenStackSimpleTokenProvider(access.getToken().getId())); - - Tenants tenants = keystone.tenants().list().execute(); - // try to exchange token using the first tenant - if (tenants.getList().size() > 0) { - // access with tenant - access = keystone.tokens().authenticate(new TokenAuthentication(access.getToken().getId())).withTenantId(tenants.getList().get(0).getId()).execute(); - - Quantum quantum = new Quantum(KeystoneUtils.findEndpointURL(access.getServiceCatalog(), "network", null, "public")); - quantum.setTokenProvider(new OpenStackSimpleTokenProvider(access.getToken().getId())); - - Networks networks = quantum.networks().list().execute(); - for (Network network : networks) { - System.out.println(network); - } - } else { - System.out.println("No tenants found!"); - } - } + /** + * @param args + */ + public static void main(String[] args) { + Keystone keystone = new Keystone(ExamplesConfiguration.KEYSTONE_AUTH_URL); + // access with unscoped token + Access access = keystone.tokens().authenticate( + new UsernamePassword(ExamplesConfiguration.KEYSTONE_USERNAME, ExamplesConfiguration.KEYSTONE_PASSWORD)) + .execute(); + // use the token in the following requests + keystone.setTokenProvider(new OpenStackSimpleTokenProvider(access.getToken().getId())); + + Tenants tenants = keystone.tenants().list().execute(); + // try to exchange token using the first tenant + if (tenants.getList().size() > 0) { + // access with tenant + access = keystone.tokens().authenticate(new TokenAuthentication(access.getToken().getId())).withTenantId(tenants.getList().get(0).getId()).execute(); + + Quantum quantum = new Quantum(KeystoneUtils.findEndpointURL(access.getServiceCatalog(), "network", null, "public")); + quantum.setTokenProvider(new OpenStackSimpleTokenProvider(access.getToken().getId())); + + Networks networks = quantum.networks().list().execute(); + for (Network network : networks) { + System.out.println(network); + } + } else { + System.out.println("No tenants found!"); + } + } } diff --git a/openstack-examples/src/main/java/com/woorea/openstack/examples/network/QuantumNetworkCreate.java b/openstack-examples/src/main/java/com/woorea/openstack/examples/network/QuantumNetworkCreate.java index 1dab981..39f9eea 100644 --- a/openstack-examples/src/main/java/com/woorea/openstack/examples/network/QuantumNetworkCreate.java +++ b/openstack-examples/src/main/java/com/woorea/openstack/examples/network/QuantumNetworkCreate.java @@ -47,78 +47,78 @@ import com.woorea.openstack.quantum.model.Subnets; public class QuantumNetworkCreate { - /** - * @param args - */ - public static void main(String[] args) { - Keystone keystone = new Keystone( - ExamplesConfiguration.KEYSTONE_AUTH_URL); - // access with unscoped token - Access access = keystone - .tokens() - .authenticate( - new UsernamePassword( - ExamplesConfiguration.KEYSTONE_USERNAME, - ExamplesConfiguration.KEYSTONE_PASSWORD)) - .execute(); - // use the token in the following requests - keystone.setTokenProvider(new OpenStackSimpleTokenProvider(access - .getToken().getId())); - keystone.token(access.getToken().getId()); - Tenants tenants = keystone.tenants().list().execute(); - // try to exchange token using the first tenant + /** + * @param args + */ + public static void main(String[] args) { + Keystone keystone = new Keystone( + ExamplesConfiguration.KEYSTONE_AUTH_URL); + // access with unscoped token + Access access = keystone + .tokens() + .authenticate( + new UsernamePassword( + ExamplesConfiguration.KEYSTONE_USERNAME, + ExamplesConfiguration.KEYSTONE_PASSWORD)) + .execute(); + // use the token in the following requests + keystone.setTokenProvider(new OpenStackSimpleTokenProvider(access + .getToken().getId())); + keystone.token(access.getToken().getId()); + Tenants tenants = keystone.tenants().list().execute(); + // try to exchange token using the first tenant - if (tenants.getList().size() > 0) { - // access with tenant - Network network = new Network(); - access = keystone - .tokens() - .authenticate( - new TokenAuthentication(access.getToken().getId())) - .withTenantId("tenantId").execute(); - Quantum quantum = new Quantum(KeystoneUtils.findEndpointURL( - access.getServiceCatalog(), "network", null, "public")); - quantum.setTokenProvider(new OpenStackSimpleTokenProvider(access - .getToken().getId())); - NetworkForCreate netcreate = new NetworkForCreate(); - netcreate.setTenantId("tenantId"); - netcreate.setName("net2"); - netcreate.setAdminStateUp(true); + if (tenants.getList().size() > 0) { + // access with tenant + Network network = new Network(); + access = keystone + .tokens() + .authenticate( + new TokenAuthentication(access.getToken().getId())) + .withTenantId("tenantId").execute(); + Quantum quantum = new Quantum(KeystoneUtils.findEndpointURL( + access.getServiceCatalog(), "network", null, "public")); + quantum.setTokenProvider(new OpenStackSimpleTokenProvider(access + .getToken().getId())); + NetworkForCreate netcreate = new NetworkForCreate(); + netcreate.setTenantId("tenantId"); + netcreate.setName("net2"); + netcreate.setAdminStateUp(true); - network = quantum.networks().create(netcreate).execute(); + network = quantum.networks().create(netcreate).execute(); - // Creating Subnet - try { - Subnet sub = new Subnet(); - SubnetForCreate subnet = new SubnetForCreate(); - subnet.setCidr(""); - subnet.setName(""); - subnet.setNetworkId(network.getId()); - subnet.setIpVersion(4); - sub = quantum.subnets().create(subnet).execute(); - RouterForCreate routerForCreate = new RouterForCreate(); - routerForCreate.setName("routerName"); - routerForCreate.setTenantId("tenantId"); - Router router = quantum.routers().create(routerForCreate) - .execute(); - RouterForAddInterface routerForAdd = new RouterForAddInterface(); - routerForAdd.setSubnetId(sub.getId()); - routerForAdd.setRouterId(router.getId()); - quantum.routers().addInterface(routerForAdd).execute(); + // Creating Subnet + try { + Subnet sub = new Subnet(); + SubnetForCreate subnet = new SubnetForCreate(); + subnet.setCidr(""); + subnet.setName(""); + subnet.setNetworkId(network.getId()); + subnet.setIpVersion(4); + sub = quantum.subnets().create(subnet).execute(); + RouterForCreate routerForCreate = new RouterForCreate(); + routerForCreate.setName("routerName"); + routerForCreate.setTenantId("tenantId"); + Router router = quantum.routers().create(routerForCreate) + .execute(); + RouterForAddInterface routerForAdd = new RouterForAddInterface(); + routerForAdd.setSubnetId(sub.getId()); + routerForAdd.setRouterId(router.getId()); + quantum.routers().addInterface(routerForAdd).execute(); - // System.out.println(sub); - } catch (Exception e) { - System.out.println(e.getMessage()); - } + // System.out.println(sub); + } catch (Exception e) { + System.out.println(e.getMessage()); + } - Networks networks = quantum.networks().list().execute(); + Networks networks = quantum.networks().list().execute(); - for (Network network1 : networks) { - System.out.println(network1); - } - } else { - System.out.println("No tenants found!"); - } + for (Network network1 : networks) { + System.out.println(network1); + } + } else { + System.out.println("No tenants found!"); + } - } + } } diff --git a/openstack-examples/src/main/java/com/woorea/openstack/examples/network/QuantumQueryNetworks.java b/openstack-examples/src/main/java/com/woorea/openstack/examples/network/QuantumQueryNetworks.java index 447af4e..e442c73 100644 --- a/openstack-examples/src/main/java/com/woorea/openstack/examples/network/QuantumQueryNetworks.java +++ b/openstack-examples/src/main/java/com/woorea/openstack/examples/network/QuantumQueryNetworks.java @@ -30,46 +30,46 @@ import com.woorea.openstack.quantum.model.Network; public class QuantumQueryNetworks { - /** - * @param args - */ - public static void main(String[] args) { - Keystone keystone = new Keystone(ExamplesConfiguration.KEYSTONE_AUTH_URL); - // access with unscoped token - Access access = keystone.tokens().authenticate( - new UsernamePassword(ExamplesConfiguration.KEYSTONE_USERNAME, ExamplesConfiguration.KEYSTONE_PASSWORD)) - .execute(); - // use the token in the following requests - keystone.setTokenProvider(new OpenStackSimpleTokenProvider(access.getToken().getId())); + /** + * @param args + */ + public static void main(String[] args) { + Keystone keystone = new Keystone(ExamplesConfiguration.KEYSTONE_AUTH_URL); + // access with unscoped token + Access access = keystone.tokens().authenticate( + new UsernamePassword(ExamplesConfiguration.KEYSTONE_USERNAME, ExamplesConfiguration.KEYSTONE_PASSWORD)) + .execute(); + // use the token in the following requests + keystone.setTokenProvider(new OpenStackSimpleTokenProvider(access.getToken().getId())); - Tenants tenants = keystone.tenants().list().execute(); - // try to exchange token using the first tenant - if (tenants.getList().size() > 0) { - // access with tenant - access = keystone.tokens().authenticate(new TokenAuthentication(access.getToken().getId())).withTenantId(tenants.getList().get(0).getId()).execute(); + Tenants tenants = keystone.tenants().list().execute(); + // try to exchange token using the first tenant + if (tenants.getList().size() > 0) { + // access with tenant + access = keystone.tokens().authenticate(new TokenAuthentication(access.getToken().getId())).withTenantId(tenants.getList().get(0).getId()).execute(); - Quantum quantumClient = new Quantum(KeystoneUtils.findEndpointURL(access.getServiceCatalog(), "network", null, "public")); - quantumClient.setTokenProvider(new OpenStackSimpleTokenProvider(access.getToken().getId())); + Quantum quantumClient = new Quantum(KeystoneUtils.findEndpointURL(access.getServiceCatalog(), "network", null, "public")); + quantumClient.setTokenProvider(new OpenStackSimpleTokenProvider(access.getToken().getId())); - Network networkQuery = new Network(); - networkQuery.setName("benn.cs"); - networkQuery.setAdminStateUp(true); - /* - Networks networks = quantumClient.execute(NetworkQuery.queryNetworks(networkQuery)); + Network networkQuery = new Network(); + networkQuery.setName("benn.cs"); + networkQuery.setAdminStateUp(true); + /* + Networks networks = quantumClient.execute(NetworkQuery.queryNetworks(networkQuery)); - for (Network network : networks) { - System.out.println(network); - } + for (Network network : networks) { + System.out.println(network); + } - Subnet subnetQuery = new Subnet(); - subnetQuery.setIpversion(Subnet.IpVersion.IPV4); - Subnets Subnets = quantumClient.execute(NetworkQuery.querySubnets(subnetQuery)); - for (Subnet subnet : Subnets) { - System.out.println(subnet); - } - */ - } else { - System.out.println("No tenants found!"); - } - } + Subnet subnetQuery = new Subnet(); + subnetQuery.setIpversion(Subnet.IpVersion.IPV4); + Subnets Subnets = quantumClient.execute(NetworkQuery.querySubnets(subnetQuery)); + for (Subnet subnet : Subnets) { + System.out.println(subnet); + } + */ + } else { + System.out.println("No tenants found!"); + } + } } diff --git a/openstack-examples/src/main/java/com/woorea/openstack/examples/objectstore/SwiftExample.java b/openstack-examples/src/main/java/com/woorea/openstack/examples/objectstore/SwiftExample.java index bf741b1..36d0e08 100644 --- a/openstack-examples/src/main/java/com/woorea/openstack/examples/objectstore/SwiftExample.java +++ b/openstack-examples/src/main/java/com/woorea/openstack/examples/objectstore/SwiftExample.java @@ -38,69 +38,69 @@ import com.woorea.openstack.swift.model.ObjectDownload; import com.woorea.openstack.swift.model.ObjectForUpload; public class SwiftExample { - - private static final File TEST_FILE = new File("pom.xml"); - - /** - * @param args - */ - public static void main(String[] args) throws Exception { - Keystone keystone = new Keystone(ExamplesConfiguration.KEYSTONE_AUTH_URL); - //access with unscoped token - Access access = keystone.tokens().authenticate( - new UsernamePassword(ExamplesConfiguration.KEYSTONE_USERNAME, ExamplesConfiguration.KEYSTONE_PASSWORD)) - .execute(); - - //use the token in the following requests - keystone.setTokenProvider(new OpenStackSimpleTokenProvider(access.getToken().getId())); - - Tenants tenants = keystone.tenants().list().execute(); - - //try to exchange token using the first tenant - if(tenants.getList().size() > 0) { - - access = keystone.tokens().authenticate(new TokenAuthentication(access.getToken().getId())).withTenantId(tenants.getList().get(0).getId()).execute(); - - Swift swift = new Swift(KeystoneUtils.findEndpointURL(access.getServiceCatalog(), "object-store", null, "public")); - swift.setTokenProvider(new OpenStackSimpleTokenProvider(access.getToken().getId())); - - //swiftClient.execute(new DeleteContainer("navidad2")); - - swift.containers().create("navidad2").execute(); - - System.out.println(swift.containers().list()); - - ObjectForUpload upload = new ObjectForUpload(); - upload.setContainer("navidad2"); - upload.setName("example2"); - upload.setInputStream(new FileInputStream(TEST_FILE)); - swift.containers().container("navidad2").upload(upload).execute(); - -// System.out.println(swiftClient.execute(new ListObjects("navidad2", new HashMap<String, String>() {{ -// put("path", ""); -// }})).get(0).getContentType()); - - - ObjectDownload download = swift.containers().container("navidad").download("example2").execute(); - write(download.getInputStream(), "example2"); - } + + private static final File TEST_FILE = new File("pom.xml"); + + /** + * @param args + */ + public static void main(String[] args) throws Exception { + Keystone keystone = new Keystone(ExamplesConfiguration.KEYSTONE_AUTH_URL); + //access with unscoped token + Access access = keystone.tokens().authenticate( + new UsernamePassword(ExamplesConfiguration.KEYSTONE_USERNAME, ExamplesConfiguration.KEYSTONE_PASSWORD)) + .execute(); + + //use the token in the following requests + keystone.setTokenProvider(new OpenStackSimpleTokenProvider(access.getToken().getId())); + + Tenants tenants = keystone.tenants().list().execute(); + + //try to exchange token using the first tenant + if(tenants.getList().size() > 0) { + + access = keystone.tokens().authenticate(new TokenAuthentication(access.getToken().getId())).withTenantId(tenants.getList().get(0).getId()).execute(); + + Swift swift = new Swift(KeystoneUtils.findEndpointURL(access.getServiceCatalog(), "object-store", null, "public")); + swift.setTokenProvider(new OpenStackSimpleTokenProvider(access.getToken().getId())); + + //swiftClient.execute(new DeleteContainer("navidad2")); + + swift.containers().create("navidad2").execute(); + + System.out.println(swift.containers().list()); + + ObjectForUpload upload = new ObjectForUpload(); + upload.setContainer("navidad2"); + upload.setName("example2"); + upload.setInputStream(new FileInputStream(TEST_FILE)); + swift.containers().container("navidad2").upload(upload).execute(); + +// System.out.println(swiftClient.execute(new ListObjects("navidad2", new HashMap<String, String>() {{ +// put("path", ""); +// }})).get(0).getContentType()); + + + ObjectDownload download = swift.containers().container("navidad").download("example2").execute(); + write(download.getInputStream(), "example2"); + } - } - - private static void write(InputStream is, String path) { - try { - OutputStream stream = new BufferedOutputStream(new FileOutputStream(path)); - int bufferSize = 1024; - byte[] buffer = new byte[bufferSize]; - int len = 0; - while ((len = is.read(buffer)) != -1) { - stream.write(buffer, 0, len); - } - stream.close(); - } catch(IOException e) { - throw new RuntimeException(e.getMessage(), e); - } - - } + } + + private static void write(InputStream is, String path) { + try { + OutputStream stream = new BufferedOutputStream(new FileOutputStream(path)); + int bufferSize = 1024; + byte[] buffer = new byte[bufferSize]; + int len = 0; + while ((len = is.read(buffer)) != -1) { + stream.write(buffer, 0, len); + } + stream.close(); + } catch(IOException e) { + throw new RuntimeException(e.getMessage(), e); + } + + } } diff --git a/openstack-examples/src/main/java/com/woorea/openstack/examples/simple/OpenStackSimpleClient.java b/openstack-examples/src/main/java/com/woorea/openstack/examples/simple/OpenStackSimpleClient.java index cf998fb..a2f9eb5 100644 --- a/openstack-examples/src/main/java/com/woorea/openstack/examples/simple/OpenStackSimpleClient.java +++ b/openstack-examples/src/main/java/com/woorea/openstack/examples/simple/OpenStackSimpleClient.java @@ -19,13 +19,13 @@ package com.woorea.openstack.examples.simple; public class OpenStackSimpleClient { - /** - * @param args - */ - public static void main(String[] args) { -// OpenStackClient client = new OpenStackClient(ExamplesConfiguration.KEYSTONE_AUTH_URL); -// Access access = client.request("/tokens").execute("POST", Entity.json("{\"auth\":{\"passwordCredentials\":{\"username\":\"\",\"password\":\"\"}}}"), Access.class); -// System.out.println(access); - } + /** + * @param args + */ + public static void main(String[] args) { +// OpenStackClient client = new OpenStackClient(ExamplesConfiguration.KEYSTONE_AUTH_URL); +// Access access = client.request("/tokens").execute("POST", Entity.json("{\"auth\":{\"passwordCredentials\":{\"username\":\"\",\"password\":\"\"}}}"), Access.class); +// System.out.println(access); + } } diff --git a/quantum-client/src/main/java/com/woorea/openstack/quantum/Quantum.java b/quantum-client/src/main/java/com/woorea/openstack/quantum/Quantum.java index fae9d53..ab64531 100644 --- a/quantum-client/src/main/java/com/woorea/openstack/quantum/Quantum.java +++ b/quantum-client/src/main/java/com/woorea/openstack/quantum/Quantum.java @@ -26,42 +26,42 @@ import com.woorea.openstack.quantum.api.SubnetsResource; public class Quantum extends OpenStackClient { - - private final NetworksResource NETWORKS; - - private final PortsResource PORTS; - - private final SubnetsResource SUBNETS; - private final RoutersResource ROUTERS; - - public Quantum(String endpoint, OpenStackClientConnector connector) { - super(endpoint, connector); - NETWORKS = new NetworksResource(this); - PORTS = new PortsResource(this); - SUBNETS = new SubnetsResource(this); - ROUTERS=new RoutersResource(this); - - } - - public Quantum(String endpoint) { - this(endpoint, null); - } - - public NetworksResource networks() { - return NETWORKS; - } - - public PortsResource ports() { - return PORTS; - } - - public SubnetsResource subnets() { - return SUBNETS; - } - public RoutersResource routers() - { - return ROUTERS; - } - + + private final NetworksResource NETWORKS; + + private final PortsResource PORTS; + + private final SubnetsResource SUBNETS; + private final RoutersResource ROUTERS; + + public Quantum(String endpoint, OpenStackClientConnector connector) { + super(endpoint, connector); + NETWORKS = new NetworksResource(this); + PORTS = new PortsResource(this); + SUBNETS = new SubnetsResource(this); + ROUTERS=new RoutersResource(this); + + } + + public Quantum(String endpoint) { + this(endpoint, null); + } + + public NetworksResource networks() { + return NETWORKS; + } + + public PortsResource ports() { + return PORTS; + } + + public SubnetsResource subnets() { + return SUBNETS; + } + public RoutersResource routers() + { + return ROUTERS; + } + } diff --git a/quantum-client/src/main/java/com/woorea/openstack/quantum/api/NetworksResource.java b/quantum-client/src/main/java/com/woorea/openstack/quantum/api/NetworksResource.java index abaf44c..e22487a 100644 --- a/quantum-client/src/main/java/com/woorea/openstack/quantum/api/NetworksResource.java +++ b/quantum-client/src/main/java/com/woorea/openstack/quantum/api/NetworksResource.java @@ -26,56 +26,56 @@ import com.woorea.openstack.quantum.model.Networks; public class NetworksResource { - private final OpenStackClient CLIENT; + private final OpenStackClient CLIENT; - public NetworksResource(OpenStackClient client) { - CLIENT = client; - } + public NetworksResource(OpenStackClient client) { + CLIENT = client; + } - public List list() { - return new List(); - } + public List list() { + return new List(); + } public Create create(Network net) { - return new Create(net); - } + return new Create(net); + } public Update update(Network net) { return new Update(net); } - public Delete delete(String netId){ - return new Delete(netId); - } + public Delete delete(String netId){ + return new Delete(netId); + } - public Show show(String netId){ - return new Show(netId); - } + public Show show(String netId){ + return new Show(netId); + } - public class List extends OpenStackRequest<Networks> { + public class List extends OpenStackRequest<Networks> { - public List() { - super(CLIENT, HttpMethod.GET, "networks", null, Networks.class); - } - } + public List() { + super(CLIENT, HttpMethod.GET, "networks", null, Networks.class); + } + } - public class Query extends OpenStackRequest<Networks> { + public class Query extends OpenStackRequest<Networks> { - public Query(Network network) { - //super(network); -// target = target.path("v2.0").path("networks"); -// target = queryParam(target); -// return target.request(MediaType.APPLICATION_JSON).get(Networks.class); - } - } + public Query(Network network) { + //super(network); +// target = target.path("v2.0").path("networks"); +// target = queryParam(target); +// return target.request(MediaType.APPLICATION_JSON).get(Networks.class); + } + } - public class Create extends OpenStackRequest<Network> { + public class Create extends OpenStackRequest<Network> { public Create(Network net) { - super(CLIENT, HttpMethod.POST, "networks", Entity.json(net), Network.class); - } - } + super(CLIENT, HttpMethod.POST, "networks", Entity.json(net), Network.class); + } + } public class Update extends OpenStackRequest<Network> { @@ -84,17 +84,17 @@ public class NetworksResource { } } - public class Show extends OpenStackRequest<Network> { + public class Show extends OpenStackRequest<Network> { - public Show(String id) { - super(CLIENT, HttpMethod.GET, buildPath("networks/", id), null, Network.class); - } - } + public Show(String id) { + super(CLIENT, HttpMethod.GET, buildPath("networks/", id), null, Network.class); + } + } - public class Delete extends OpenStackRequest<Void> { + public class Delete extends OpenStackRequest<Void> { - public Delete(String id){ - super(CLIENT, HttpMethod.DELETE, buildPath("networks/", id), null, Void.class); - } - } + public Delete(String id){ + super(CLIENT, HttpMethod.DELETE, buildPath("networks/", id), null, Void.class); + } + } } diff --git a/quantum-client/src/main/java/com/woorea/openstack/quantum/api/PortsResource.java b/quantum-client/src/main/java/com/woorea/openstack/quantum/api/PortsResource.java index ec34b53..2e1e840 100644 --- a/quantum-client/src/main/java/com/woorea/openstack/quantum/api/PortsResource.java +++ b/quantum-client/src/main/java/com/woorea/openstack/quantum/api/PortsResource.java @@ -26,76 +26,76 @@ import com.woorea.openstack.quantum.model.Ports; public class PortsResource { - private final OpenStackClient CLIENT; + private final OpenStackClient CLIENT; - public PortsResource(OpenStackClient client) { - CLIENT = client; - } + public PortsResource(OpenStackClient client) { + CLIENT = client; + } - public List list() { - return new List(); - } + public List list() { + return new List(); + } - public Create create(Port port){ - return new Create(port); - } + public Create create(Port port){ + return new Create(port); + } - public Update update(Port port){ - return new Update(port); - } + public Update update(Port port){ + return new Update(port); + } - public Delete delete(String portId){ - return new Delete(portId); - } + public Delete delete(String portId){ + return new Delete(portId); + } - public Show show(String portId){ - return new Show(portId); - } + public Show show(String portId){ + return new Show(portId); + } - public class List extends OpenStackRequest<Ports> { + public class List extends OpenStackRequest<Ports> { - public List() { - super(CLIENT, HttpMethod.GET, "ports", null, Ports.class); - } - } + public List() { + super(CLIENT, HttpMethod.GET, "ports", null, Ports.class); + } + } - public class Query extends OpenStackRequest<Ports> { + public class Query extends OpenStackRequest<Ports> { - public Query(Port port) { - //super(port); -// target = target.path("v2.0").path("ports"); -// target = queryParam(target); -// return target.request(MediaType.APPLICATION_JSON).get(Ports.class); - } + public Query(Port port) { + //super(port); +// target = target.path("v2.0").path("ports"); +// target = queryParam(target); +// return target.request(MediaType.APPLICATION_JSON).get(Ports.class); + } - } + } - public class Create extends OpenStackRequest<Port> { + public class Create extends OpenStackRequest<Port> { - public Create(Port port){ - super(CLIENT, HttpMethod.POST, "ports", Entity.json(port), Port.class); - } - } + public Create(Port port){ + super(CLIENT, HttpMethod.POST, "ports", Entity.json(port), Port.class); + } + } - public class Update extends OpenStackRequest<Port> { + public class Update extends OpenStackRequest<Port> { - public Update(Port port){ - super(CLIENT, HttpMethod.PUT, buildPath("ports/", port.getId()), Entity.json(port), Port.class); - } - } + public Update(Port port){ + super(CLIENT, HttpMethod.PUT, buildPath("ports/", port.getId()), Entity.json(port), Port.class); + } + } - public class Show extends OpenStackRequest<Port> { + public class Show extends OpenStackRequest<Port> { - public Show(String id) { - super(CLIENT, HttpMethod.GET, buildPath("ports/", id), null, Port.class); - } - } + public Show(String id) { + super(CLIENT, HttpMethod.GET, buildPath("ports/", id), null, Port.class); + } + } - public class Delete extends OpenStackRequest<Void> { + public class Delete extends OpenStackRequest<Void> { - public Delete(String id){ + public Delete(String id){ super(CLIENT, HttpMethod.DELETE, buildPath("ports/", id), null, Void.class); - } - } + } + } } diff --git a/quantum-client/src/main/java/com/woorea/openstack/quantum/api/RoutersResource.java b/quantum-client/src/main/java/com/woorea/openstack/quantum/api/RoutersResource.java index f0f8e20..e158e5f 100644 --- a/quantum-client/src/main/java/com/woorea/openstack/quantum/api/RoutersResource.java +++ b/quantum-client/src/main/java/com/woorea/openstack/quantum/api/RoutersResource.java @@ -28,91 +28,91 @@ import com.woorea.openstack.quantum.model.Routers; public class RoutersResource { - private final OpenStackClient CLIENT; - - public RoutersResource(OpenStackClient client) { - CLIENT = client; - } - - public List list() { - return new List(); - } - - public Create create(RouterForCreate router){ - return new Create(router); - } - - public Delete delete(String netId){ - return new Delete(netId); - } - - public Show show(String netId){ - return new Show(netId); - } - - public class List extends OpenStackRequest<Routers> { - - public List() { - super(CLIENT, HttpMethod.GET, "routers", null, Routers.class); - } - } - - public class Query extends OpenStackRequest<Routers> { - - public Query(Router router) { - //super(network); -// target = target.path("v2.0").path("networks"); -// target = queryParam(target); -// return target.request(MediaType.APPLICATION_JSON).get(Networks.class); - } - } - public class Create extends OpenStackRequest<Router> { - - public Create(RouterForCreate router){ - super(CLIENT, HttpMethod.POST, "routers", Entity.json(router), Router.class); - } - } - - - - public class Show extends OpenStackRequest<Router> { - - public Show(String id) { - super(CLIENT, HttpMethod.GET, buildPath("routers/", id), null, Router.class); - } - } - - public class Delete extends OpenStackRequest<Void> { - - public Delete(String id){ - super(CLIENT, HttpMethod.DELETE, buildPath("routers/", id), null, Void.class); - } - } - public Attach addInterface(RouterForAddInterface interfaceToAdd){ - return new Attach(interfaceToAdd); - } - public class Attach extends OpenStackRequest<RouterInterface> { - - public Attach(RouterForAddInterface interfaceToAdd){ - super(CLIENT, HttpMethod.PUT, buildPath("routers/",interfaceToAdd.getRouterId(),"/add_router_interface"), Entity.json(interfaceToAdd),RouterInterface.class); - } - - } - public Detach deleteInterface(RouterForAddInterface interfaceRouter) { - return new Detach(interfaceRouter); - } - - public class Detach extends OpenStackRequest<RouterInterface> { - - public Detach(RouterForAddInterface interfaceToAdd) { - super(CLIENT, HttpMethod.PUT, buildPath("routers/", - interfaceToAdd.getRouterId(), "/remove_router_interface"), - Entity.json(interfaceToAdd), RouterInterface.class); - } - - } - - - + private final OpenStackClient CLIENT; + + public RoutersResource(OpenStackClient client) { + CLIENT = client; + } + + public List list() { + return new List(); + } + + public Create create(RouterForCreate router){ + return new Create(router); + } + + public Delete delete(String netId){ + return new Delete(netId); + } + + public Show show(String netId){ + return new Show(netId); + } + + public class List extends OpenStackRequest<Routers> { + + public List() { + super(CLIENT, HttpMethod.GET, "routers", null, Routers.class); + } + } + + public class Query extends OpenStackRequest<Routers> { + + public Query(Router router) { + //super(network); +// target = target.path("v2.0").path("networks"); +// target = queryParam(target); +// return target.request(MediaType.APPLICATION_JSON).get(Networks.class); + } + } + public class Create extends OpenStackRequest<Router> { + + public Create(RouterForCreate router){ + super(CLIENT, HttpMethod.POST, "routers", Entity.json(router), Router.class); + } + } + + + + public class Show extends OpenStackRequest<Router> { + + public Show(String id) { + super(CLIENT, HttpMethod.GET, buildPath("routers/", id), null, Router.class); + } + } + + public class Delete extends OpenStackRequest<Void> { + + public Delete(String id){ + super(CLIENT, HttpMethod.DELETE, buildPath("routers/", id), null, Void.class); + } + } + public Attach addInterface(RouterForAddInterface interfaceToAdd){ + return new Attach(interfaceToAdd); + } + public class Attach extends OpenStackRequest<RouterInterface> { + + public Attach(RouterForAddInterface interfaceToAdd){ + super(CLIENT, HttpMethod.PUT, buildPath("routers/",interfaceToAdd.getRouterId(),"/add_router_interface"), Entity.json(interfaceToAdd),RouterInterface.class); + } + + } + public Detach deleteInterface(RouterForAddInterface interfaceRouter) { + return new Detach(interfaceRouter); + } + + public class Detach extends OpenStackRequest<RouterInterface> { + + public Detach(RouterForAddInterface interfaceToAdd) { + super(CLIENT, HttpMethod.PUT, buildPath("routers/", + interfaceToAdd.getRouterId(), "/remove_router_interface"), + Entity.json(interfaceToAdd), RouterInterface.class); + } + + } + + + } diff --git a/quantum-client/src/main/java/com/woorea/openstack/quantum/api/SubnetsResource.java b/quantum-client/src/main/java/com/woorea/openstack/quantum/api/SubnetsResource.java index 56f1593..81f3750 100644 --- a/quantum-client/src/main/java/com/woorea/openstack/quantum/api/SubnetsResource.java +++ b/quantum-client/src/main/java/com/woorea/openstack/quantum/api/SubnetsResource.java @@ -26,56 +26,56 @@ import com.woorea.openstack.quantum.model.Subnets; public class SubnetsResource { - private final OpenStackClient CLIENT; + private final OpenStackClient CLIENT; - public SubnetsResource(OpenStackClient client) { - CLIENT = client; - } + public SubnetsResource(OpenStackClient client) { + CLIENT = client; + } - public List list() { - return new List(); - } + public List list() { + return new List(); + } public Create create(Subnet net) { - return new Create(net); - } + return new Create(net); + } public Update update(Subnet net) { return new Update(net); } - public Delete delete(String netId){ - return new Delete(netId); - } + public Delete delete(String netId){ + return new Delete(netId); + } - public Show show(String netId){ - return new Show(netId); - } + public Show show(String netId){ + return new Show(netId); + } - public class List extends OpenStackRequest<Subnets> { + public class List extends OpenStackRequest<Subnets> { - public List() { - super(CLIENT, HttpMethod.GET, "subnets", null, Subnets.class); - } - } + public List() { + super(CLIENT, HttpMethod.GET, "subnets", null, Subnets.class); + } + } - public class Query extends OpenStackRequest<Subnets> { + public class Query extends OpenStackRequest<Subnets> { - public Query(Subnet subnet) { - //super(subnet); -// target = target.path("v2.0").path("subnets"); -// target = queryParam(target); -// return target.request(MediaType.APPLICATION_JSON).get(Subnets.class); - } - } + public Query(Subnet subnet) { + //super(subnet); +// target = target.path("v2.0").path("subnets"); +// target = queryParam(target); +// return target.request(MediaType.APPLICATION_JSON).get(Subnets.class); + } + } - public class Create extends OpenStackRequest<Subnet> { + public class Create extends OpenStackRequest<Subnet> { public Create(Subnet subnet) { - super(CLIENT, HttpMethod.POST, "subnets", Entity.json(subnet), Subnet.class); - } - } + super(CLIENT, HttpMethod.POST, "subnets", Entity.json(subnet), Subnet.class); + } + } public class Update extends OpenStackRequest<Subnet> { @@ -84,17 +84,17 @@ public class SubnetsResource { } } - public class Show extends OpenStackRequest<Subnet> { + public class Show extends OpenStackRequest<Subnet> { - public Show(String id) { + public Show(String id) { super(CLIENT, HttpMethod.GET, buildPath("subnets/", id), null, Subnet.class); - } - } + } + } - public class Delete extends OpenStackRequest<Void> { + public class Delete extends OpenStackRequest<Void> { - public Delete(String id){ + public Delete(String id){ super(CLIENT, HttpMethod.DELETE, buildPath("subnets/", id), null, Void.class); - } - } + } + } } diff --git a/quantum-client/src/main/java/com/woorea/openstack/quantum/api/query/AbsOpenStackCmd.java b/quantum-client/src/main/java/com/woorea/openstack/quantum/api/query/AbsOpenStackCmd.java index 2511b0c..1ba1bb6 100644 --- a/quantum-client/src/main/java/com/woorea/openstack/quantum/api/query/AbsOpenStackCmd.java +++ b/quantum-client/src/main/java/com/woorea/openstack/quantum/api/query/AbsOpenStackCmd.java @@ -26,71 +26,71 @@ import com.woorea.openstack.base.client.OpenStackRequest; public class AbsOpenStackCmd<T> extends OpenStackRequest<T> { - private T query; + private T query; - protected AbsOpenStackCmd(T query) - { - this.setQuery(query); - } + protected AbsOpenStackCmd(T query) + { + this.setQuery(query); + } - /** - * @param query the query to set - */ - public void setQuery(T query) { - this.query = query; - } + /** + * @param query the query to set + */ + public void setQuery(T query) { + this.query = query; + } - /** - * @return the query - */ - public T getQuery() { - return query; - } + /** + * @return the query + */ + public T getQuery() { + return query; + } - private String getFieldValue(Field field, T target) - { - try { - field.setAccessible(true); - Object obj = field.get(target); - if (obj == null) - return null; - return obj.toString(); - } catch (Exception e) { - throw new RuntimeException(e); - } - } + private String getFieldValue(Field field, T target) + { + try { + field.setAccessible(true); + Object obj = field.get(target); + if (obj == null) + return null; + return obj.toString(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } - private Map<String, String> getObjectParamMap(T target) - { - Map<String, String> resultMap = new HashMap<>(); - if (target == null) - return resultMap; + private Map<String, String> getObjectParamMap(T target) + { + Map<String, String> resultMap = new HashMap<>(); + if (target == null) + return resultMap; - Field[] paramMap = target.getClass().getDeclaredFields(); - for (Field field : paramMap) { - String resultName = field.getName(); - String value = getFieldValue(field, target); - if (value != null) { - JsonProperty prop = field.getAnnotation(JsonProperty.class); - if (prop != null) { - resultMap.put(prop.value(), getFieldValue(field, target)); - } else { - resultMap.put(resultName, getFieldValue(field, target)); - } - } - } + Field[] paramMap = target.getClass().getDeclaredFields(); + for (Field field : paramMap) { + String resultName = field.getName(); + String value = getFieldValue(field, target); + if (value != null) { + JsonProperty prop = field.getAnnotation(JsonProperty.class); + if (prop != null) { + resultMap.put(prop.value(), getFieldValue(field, target)); + } else { + resultMap.put(resultName, getFieldValue(field, target)); + } + } + } - return resultMap; - } + return resultMap; + } - /* - public WebTarget queryParam(WebTarget target) { - Map<String, String> map = getObjectParamMap(this.query); - for (String fieldName : map.keySet()) { - target = target.queryParam(fieldName, map.get(fieldName)); - } - return target; - } - */ + /* + public WebTarget queryParam(WebTarget target) { + Map<String, String> map = getObjectParamMap(this.query); + for (String fieldName : map.keySet()) { + target = target.queryParam(fieldName, map.get(fieldName)); + } + return target; + } + */ } diff --git a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/GatewayInfo.java b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/GatewayInfo.java index 6287a7c..852e1c3 100644 --- a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/GatewayInfo.java +++ b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/GatewayInfo.java @@ -23,18 +23,18 @@ import org.codehaus.jackson.annotate.JsonProperty; public class GatewayInfo implements Serializable { - @JsonProperty("network_id") - private String networkId; + @JsonProperty("network_id") + private String networkId; - public String getNetworkId() { - return networkId; - } + public String getNetworkId() { + return networkId; + } - public void setNetworkId(String id) { - this.networkId = id; - } + public void setNetworkId(String id) { + this.networkId = id; + } - @Override public String toString() { - return "[networkId=" + networkId + "]"; - } + @Override public String toString() { + return "[networkId=" + networkId + "]"; + } } diff --git a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/HostRoute.java b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/HostRoute.java index 5482666..958a21d 100644 --- a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/HostRoute.java +++ b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/HostRoute.java @@ -20,24 +20,24 @@ import java.io.Serializable; public class HostRoute implements Serializable { - private String destination; - private String nexthop; + private String destination; + private String nexthop; - public String getDestination() { - return destination; - } - public void setDestination(String destination) { - this.destination = destination; - } + public String getDestination() { + return destination; + } + public void setDestination(String destination) { + this.destination = destination; + } - public String getNexthop() { - return nexthop; - } - public void setNexthop(String nexthop) { - this.nexthop = nexthop; - } + public String getNexthop() { + return nexthop; + } + public void setNexthop(String nexthop) { + this.nexthop = nexthop; + } - @Override public String toString() { - return "[destination=" + destination + ", nexthop=" + nexthop + "]"; - } + @Override public String toString() { + return "[destination=" + destination + ", nexthop=" + nexthop + "]"; + } } diff --git a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Network.java b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Network.java index 6c21b00..f9e9c07 100644 --- a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Network.java +++ b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Network.java @@ -304,12 +304,12 @@ public class Network implements Serializable { @JsonIgnore public NetworkType getNetworkType () { - if (segments != null) - return NetworkType.MULTI_PROVIDER; - else if (providerNetworkType != null) - return NetworkType.PROVIDER; - else - return NetworkType.BASIC; + if (segments != null) + return NetworkType.MULTI_PROVIDER; + else if (providerNetworkType != null) + return NetworkType.PROVIDER; + else + return NetworkType.BASIC; } /* @@ -319,19 +319,19 @@ public class Network implements Serializable { */ @Override public String toString() { - StringBuilder buf = new StringBuilder("Network [id=" + id + ", name=" + name + ", subnets=" + StringBuilder buf = new StringBuilder("Network [id=" + id + ", name=" + name + ", subnets=" + subnets + ", status=" + status + ", admin_state_up=" + adminStateUp + ", tenant_id=" + tenantId + ", shared=" + shared + ", router:external=" + routerExternal); - if (getNetworkType() == NetworkType.PROVIDER) - buf.append (", provider:physical_network=" + providerPhysicalNetwork + + if (getNetworkType() == NetworkType.PROVIDER) + buf.append (", provider:physical_network=" + providerPhysicalNetwork + ", provider:network_type=" + providerNetworkType + ", provider:segmentation_id=" + providerSegmentationId); - if (getNetworkType() == NetworkType.MULTI_PROVIDER) { - buf.append (", segments: "); - for (Segment s : segments) - buf.append (s.toString()).append(" "); - } - buf.append ("]"); - return buf.toString(); + if (getNetworkType() == NetworkType.MULTI_PROVIDER) { + buf.append (", segments: "); + for (Segment s : segments) + buf.append (s.toString()).append(" "); + } + buf.append ("]"); + return buf.toString(); } } diff --git a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Networks.java b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Networks.java index 84e45ca..9bf53f2 100644 --- a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Networks.java +++ b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Networks.java @@ -22,33 +22,33 @@ import java.util.List; import org.codehaus.jackson.annotate.JsonProperty; public class Networks implements Iterable<Network>, Serializable{ - - @JsonProperty("networks") - private List<Network> list; - - /** - * @return the list - */ - public List<Network> getList() { - return list; - } - - - /** - * @param list the list to set - */ - public void setList(List<Network> list) { - this.list = list; - } - - @Override - public String toString() { - return "Networks [list=" + list + "]"; - } - - @Override - public Iterator<Network> iterator() { - return list.iterator(); - } - + + @JsonProperty("networks") + private List<Network> list; + + /** + * @return the list + */ + public List<Network> getList() { + return list; + } + + + /** + * @param list the list to set + */ + public void setList(List<Network> list) { + this.list = list; + } + + @Override + public String toString() { + return "Networks [list=" + list + "]"; + } + + @Override + public Iterator<Network> iterator() { + return list.iterator(); + } + } diff --git a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/NeutronError.java b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/NeutronError.java index 4dac0ea..91e998e 100644 --- a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/NeutronError.java +++ b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/NeutronError.java @@ -46,40 +46,40 @@ import org.codehaus.jackson.map.annotate.JsonRootName; @JsonRootName("NeutronError") public class NeutronError implements Serializable { - private String type; - - private String message; + private String type; + + private String message; - private String detail; - - /** - * @return the code - */ - public String getType() { - return type; - } + private String detail; + + /** + * @return the code + */ + public String getType() { + return type; + } - /** - * @return the message - */ - public String getMessage() { - return message; - } + /** + * @return the message + */ + public String getMessage() { + return message; + } - /** - * @return the title - */ - public String getDetail() { - return detail; - } + /** + * @return the title + */ + public String getDetail() { + return detail; + } - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "NeutronError [type=" + type + ", title=" + detail + ", message=" - + message + "]"; - } - + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "NeutronError [type=" + type + ", title=" + detail + ", message=" + + message + "]"; + } + } diff --git a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Pool.java b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Pool.java index 70f80ad..a7ce888 100644 --- a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Pool.java +++ b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Pool.java @@ -19,38 +19,38 @@ package com.woorea.openstack.quantum.model; import java.io.Serializable; public class Pool implements Serializable{ - - private String start; - private String end; - - /** - * @return the start - */ - public String getStart() { - return start; - } - /** - * @param start the start to set - */ - public void setStart(String start) { - this.start = start; - } - /** - * @return the end - */ - public String getEnd() { - return end; - } - /** - * @param end the end to set - */ - public void setEnd(String end) { - this.end = end; - } - - @Override - public String toString() { - return "Allocation_pool [start=" + start + ", end=" + end + "]"; - } - + + private String start; + private String end; + + /** + * @return the start + */ + public String getStart() { + return start; + } + /** + * @param start the start to set + */ + public void setStart(String start) { + this.start = start; + } + /** + * @return the end + */ + public String getEnd() { + return end; + } + /** + * @param end the end to set + */ + public void setEnd(String end) { + this.end = end; + } + + @Override + public String toString() { + return "Allocation_pool [start=" + start + ", end=" + end + "]"; + } + } diff --git a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Router.java b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Router.java index 3bbecaa..cea0891 100644 --- a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Router.java +++ b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Router.java @@ -25,69 +25,69 @@ import org.codehaus.jackson.map.annotate.JsonRootName; @JsonRootName("router") public class Router implements Serializable { - @JsonProperty("status") - private String status; + @JsonProperty("status") + private String status; - @JsonProperty("external_gateway_info") - private GatewayInfo externalGatewayInfo; + @JsonProperty("external_gateway_info") + private GatewayInfo externalGatewayInfo; - @JsonProperty("name") - private String name; + @JsonProperty("name") + private String name; - @JsonProperty("admin_state_up") - private String admin_state_up; + @JsonProperty("admin_state_up") + private String admin_state_up; - @JsonProperty("tenant_id") - private String tenantId; + @JsonProperty("tenant_id") + private String tenantId; - @JsonProperty("id") - private String id; + @JsonProperty("id") + private String id; - @JsonProperty("routes") - private List<HostRoute> routes; + @JsonProperty("routes") + private List<HostRoute> routes; - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } - public List<HostRoute> getRoutes() { - return routes; - } - public void setRoutes(List<HostRoute> routes) { - this.routes = routes; - } - public String getAdmin_state_up() { - return admin_state_up; - } - public void setAdmin_state_up(String admin_state_up) { - this.admin_state_up = admin_state_up; - } - public String getStatus() { - return status; - } - public void setStatus(String status) { - this.status = status; - } - public GatewayInfo getExternalGatewayInfo() { - return externalGatewayInfo; - } - public void setExternalGatewayInfo(GatewayInfo externalGatewayInfo) { - this.externalGatewayInfo = externalGatewayInfo; - } - public String getTenantId() { - return tenantId; - } - public void setTenantId(String tenantId) { - this.tenantId = tenantId; - } - 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; + } + public List<HostRoute> getRoutes() { + return routes; + } + public void setRoutes(List<HostRoute> routes) { + this.routes = routes; + } + public String getAdmin_state_up() { + return admin_state_up; + } + public void setAdmin_state_up(String admin_state_up) { + this.admin_state_up = admin_state_up; + } + public String getStatus() { + return status; + } + public void setStatus(String status) { + this.status = status; + } + public GatewayInfo getExternalGatewayInfo() { + return externalGatewayInfo; + } + public void setExternalGatewayInfo(GatewayInfo externalGatewayInfo) { + this.externalGatewayInfo = externalGatewayInfo; + } + public String getTenantId() { + return tenantId; + } + public void setTenantId(String tenantId) { + this.tenantId = tenantId; + } + public String getId() { + return id; + } + public void setId(String id) { + this.id = id; + } + } diff --git a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/RouterForAddInterface.java b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/RouterForAddInterface.java index 4cca4c0..a8b65b5 100644 --- a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/RouterForAddInterface.java +++ b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/RouterForAddInterface.java @@ -22,23 +22,23 @@ import org.codehaus.jackson.annotate.JsonProperty; public class RouterForAddInterface implements Serializable { - @JsonProperty("subnet_id") - String subnetId; - String routerId; - - public String getSubnetId() { - return subnetId; - } - - public void setSubnetId(String subnetId) { - this.subnetId = subnetId; - } - - public String getRouterId() { - return routerId; - } - - public void setRouterId(String routerId) { - this.routerId = routerId; - } - } + @JsonProperty("subnet_id") + String subnetId; + String routerId; + + public String getSubnetId() { + return subnetId; + } + + public void setSubnetId(String subnetId) { + this.subnetId = subnetId; + } + + public String getRouterId() { + return routerId; + } + + public void setRouterId(String routerId) { + this.routerId = routerId; + } + } diff --git a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/RouterForCreate.java b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/RouterForCreate.java index df6cbc7..d717658 100644 --- a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/RouterForCreate.java +++ b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/RouterForCreate.java @@ -25,67 +25,67 @@ import org.codehaus.jackson.map.annotate.JsonRootName; @JsonRootName("router") public class RouterForCreate implements Serializable { - @JsonProperty("name") - private String name; + @JsonProperty("name") + private String name; - private List<HostRoute> routes; + private List<HostRoute> routes; - @JsonProperty("admin_state_up") - private String admin_state_up; + @JsonProperty("admin_state_up") + private String admin_state_up; - @JsonProperty("status") - private String status; + @JsonProperty("status") + private String status; - @JsonProperty("external_gateway_info") - private GatewayInfo externalGatewayInfo; + @JsonProperty("external_gateway_info") + private GatewayInfo externalGatewayInfo; - @JsonProperty("tenant_id") - private String tenantId; + @JsonProperty("tenant_id") + private String tenantId; - @JsonProperty("id") - private String id; + @JsonProperty("id") + private String id; - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } - public List<HostRoute> getRoutes() { - return routes; - } - public void setRoutes(List<HostRoute> routes) { - this.routes = routes; - } - public String getAdmin_state_up() { - return admin_state_up; - } - public void setAdmin_state_up(String admin_state_up) { - this.admin_state_up = admin_state_up; - } - public String getStatus() { - return status; - } - public void setStatus(String status) { - this.status = status; - } - public GatewayInfo getExternalGatewayInfo() { - return externalGatewayInfo; - } - public void setExternalGatewayInfo(GatewayInfo externalGatewayInfo) { - this.externalGatewayInfo = externalGatewayInfo; - } - public String getTenantId() { - return tenantId; - } - public void setTenantId(String tenantId) { - this.tenantId = tenantId; - } - 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; + } + public List<HostRoute> getRoutes() { + return routes; + } + public void setRoutes(List<HostRoute> routes) { + this.routes = routes; + } + public String getAdmin_state_up() { + return admin_state_up; + } + public void setAdmin_state_up(String admin_state_up) { + this.admin_state_up = admin_state_up; + } + public String getStatus() { + return status; + } + public void setStatus(String status) { + this.status = status; + } + public GatewayInfo getExternalGatewayInfo() { + return externalGatewayInfo; + } + public void setExternalGatewayInfo(GatewayInfo externalGatewayInfo) { + this.externalGatewayInfo = externalGatewayInfo; + } + public String getTenantId() { + return tenantId; + } + public void setTenantId(String tenantId) { + this.tenantId = tenantId; + } + public String getId() { + return id; + } + public void setId(String id) { + this.id = id; + } + } diff --git a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/RouterInterface.java b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/RouterInterface.java index ac4aab5..e668cf9 100644 --- a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/RouterInterface.java +++ b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/RouterInterface.java @@ -23,13 +23,13 @@ import org.codehaus.jackson.map.annotate.JsonRootName; public class RouterInterface implements Serializable { - @JsonProperty("subnet_id") - String subnetId; - @JsonProperty("port_id") - String portId; - @JsonProperty("tenant_id") - String tenantId; - @JsonProperty("id") - String id; + @JsonProperty("subnet_id") + String subnetId; + @JsonProperty("port_id") + String portId; + @JsonProperty("tenant_id") + String tenantId; + @JsonProperty("id") + String id; } diff --git a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Routers.java b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Routers.java index 038bdb4..aefd735 100644 --- a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Routers.java +++ b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Routers.java @@ -22,33 +22,33 @@ import java.util.List; import org.codehaus.jackson.annotate.JsonProperty; public class Routers implements Iterable<Router>, Serializable{ - - @JsonProperty("routers") - private List<Router> list; - - /** - * @return the list - */ - public List<Router> getList() { - return list; - } - - - /** - * @param list the list to set - */ - public void setList(List<Router> list) { - this.list = list; - } - - @Override - public String toString() { - return "Routers [list=" + list + "]"; - } - - @Override - public Iterator<Router> iterator() { - return list.iterator(); - } - + + @JsonProperty("routers") + private List<Router> list; + + /** + * @return the list + */ + public List<Router> getList() { + return list; + } + + + /** + * @param list the list to set + */ + public void setList(List<Router> list) { + this.list = list; + } + + @Override + public String toString() { + return "Routers [list=" + list + "]"; + } + + @Override + public Iterator<Router> iterator() { + return list.iterator(); + } + } diff --git a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Subnets.java b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Subnets.java index 0796d99..8e9778f 100644 --- a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Subnets.java +++ b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Subnets.java @@ -23,32 +23,32 @@ import java.util.List; import org.codehaus.jackson.annotate.JsonProperty; public class Subnets implements Serializable, Iterable<Subnet> { - - @JsonProperty("subnets") - private List<Subnet> list; - - /** - * @return the list - */ - public List<Subnet> getList() { - return list; - } + + @JsonProperty("subnets") + private List<Subnet> list; + + /** + * @return the list + */ + public List<Subnet> getList() { + return list; + } - /** - * @param list the list to set - */ - public void setList(List<Subnet> list) { - this.list = list; - } + /** + * @param list the list to set + */ + public void setList(List<Subnet> list) { + this.list = list; + } - @Override - public String toString() { - return "Subnets [list=" + list + "]"; - } - - @Override - public Iterator<Subnet> iterator() { - return list.iterator(); - } + @Override + public String toString() { + return "Subnets [list=" + list + "]"; + } + + @Override + public Iterator<Subnet> iterator() { + return list.iterator(); + } } diff --git a/swift-client/src/main/java/com/woorea/openstack/swift/Swift.java b/swift-client/src/main/java/com/woorea/openstack/swift/Swift.java index 959695b..8ae3200 100644 --- a/swift-client/src/main/java/com/woorea/openstack/swift/Swift.java +++ b/swift-client/src/main/java/com/woorea/openstack/swift/Swift.java @@ -23,27 +23,27 @@ import com.woorea.openstack.swift.api.AccountResource; import com.woorea.openstack.swift.api.ContainersResource; public class Swift extends OpenStackClient { - - private final AccountResource ACCOUNT; - - private final ContainersResource CONTAINERS; - - public Swift(String endpoint, OpenStackClientConnector connector) { - super(endpoint, connector); - CONTAINERS = new ContainersResource(this); - ACCOUNT = new AccountResource(this); - } - - public Swift(String endpoint) { - this(endpoint, null); - } - - public ContainersResource containers() { - return CONTAINERS; - } - - public AccountResource account() { - return ACCOUNT; - } + + private final AccountResource ACCOUNT; + + private final ContainersResource CONTAINERS; + + public Swift(String endpoint, OpenStackClientConnector connector) { + super(endpoint, connector); + CONTAINERS = new ContainersResource(this); + ACCOUNT = new AccountResource(this); + } + + public Swift(String endpoint) { + this(endpoint, null); + } + + public ContainersResource containers() { + return CONTAINERS; + } + + public AccountResource account() { + return ACCOUNT; + } } diff --git a/swift-client/src/main/java/com/woorea/openstack/swift/api/AccountResource.java b/swift-client/src/main/java/com/woorea/openstack/swift/api/AccountResource.java index e09e467..7efd22a 100644 --- a/swift-client/src/main/java/com/woorea/openstack/swift/api/AccountResource.java +++ b/swift-client/src/main/java/com/woorea/openstack/swift/api/AccountResource.java @@ -20,19 +20,19 @@ import com.woorea.openstack.base.client.OpenStackClient; import com.woorea.openstack.base.client.OpenStackRequest; public class AccountResource { - - private final OpenStackClient CLIENT; - - public AccountResource(OpenStackClient client) { - CLIENT = client; - } + + private final OpenStackClient CLIENT; + + public AccountResource(OpenStackClient client) { + CLIENT = client; + } - public class ShowAccount extends OpenStackRequest<Void> { + public class ShowAccount extends OpenStackRequest<Void> { - public ShowAccount() { -// return target.request(MediaType.APPLICATION_JSON).head(); - } + public ShowAccount() { +// return target.request(MediaType.APPLICATION_JSON).head(); + } - } + } } diff --git a/swift-client/src/main/java/com/woorea/openstack/swift/api/ContainerResource.java b/swift-client/src/main/java/com/woorea/openstack/swift/api/ContainerResource.java index 5abb086..23a2d0d 100644 --- a/swift-client/src/main/java/com/woorea/openstack/swift/api/ContainerResource.java +++ b/swift-client/src/main/java/com/woorea/openstack/swift/api/ContainerResource.java @@ -26,134 +26,134 @@ import com.woorea.openstack.swift.model.ObjectDownload; import com.woorea.openstack.swift.model.ObjectForUpload; public class ContainerResource { - - private final OpenStackClient CLIENT; - - private String container; - - public ContainerResource(OpenStackClient client, String container) { - CLIENT = client; - this.container = container; - } - - public List list() { - return new List(container, null); - } - - public CreateDirectory createDirectory(String path) { - return new CreateDirectory(container, path); - } - - public Show show(String path) { - return new Show(container, path); - } - - public Upload upload(ObjectForUpload objectForUpload) { - return new Upload(objectForUpload); - } - - public Download download(String path) { - return new Download(container, path); - } - - public Delete delete(String path) { - return new Delete(container, path); - } - - public class List extends OpenStackRequest<java.util.List<Object>> { - - private String containerName; - - private Map<String, String> filters; - - public List(String containerName, Map<String, String> filters) { - this.containerName = containerName; - this.filters = filters; - //returnType(new TypeToken<List<Object>>(){}); -// target = target.path(containerName); -// for(String filter : new String[]{"prefix","delimiter","path","marker"}) { -// if(filters.get(filter) != null) { -// target = target.queryParam(filter, filters.get(filter)); -// } -// } -// return target.request(MediaType.APPLICATION_JSON).get(new GenericType<List<Object>>(){}); - } - - } - - public class CreateDirectory extends OpenStackRequest<Void> { - - private String container; - - private String path; - - public CreateDirectory(String container, String path) { - this.container = container; - this.path = path; -// endpoint.path(container).path(path).request().put(Entity.entity(new byte[1],"application/directory")); - } - - } - - public class Show extends OpenStackRequest<Object> { - - private String containerName; - - private String objectName; - - public Show(String containerName, String objectName) { - this.containerName = containerName; - this.objectName = objectName; -// return target.path(containerName).path(objectName).request(MediaType.APPLICATION_JSON).head(); - } - - } - - public class Upload extends OpenStackRequest<OpenStackResponse> { - - private ObjectForUpload objectForUpload; - - public Upload(ObjectForUpload objectForUpload) { - this.objectForUpload = objectForUpload; -// Invocation.Builder invocationBuilder = target.path(objectForUpload.getContainer()).path(objectForUpload.getName()).request(MediaType.APPLICATION_JSON); -// for(String key : objectForUpload.getProperties().keySet()) { -// invocationBuilder.header("x-object-meta-" + key, objectForUpload.getProperties().get(key)); -// } -// return invocationBuilder.put(Entity.entity(objectForUpload.getInputStream(), MediaType.APPLICATION_OCTET_STREAM), Response.class); - } - - } - - public class Download extends OpenStackRequest<ObjectDownload> { - - private String containerName; - - private String objectName; - - public Download(String containerName, String objectName) { - this.containerName = containerName; - this.objectName = objectName; -// Response response = target.path(containerName).path(objectName).request(MediaType.APPLICATION_JSON).get(); -// ObjectDownload objectDownload = new ObjectDownload(); -// objectDownload.setInputStream((InputStream) response.getEntity()); -// return objectDownload; - } - - } - - - public class Delete extends OpenStackRequest<Void> { - - private String containerName; - - private String objectName; - - public Delete(String containerName, String objectName) { - this.containerName = containerName; - this.objectName = objectName; - //return target.path(containerName).path(objectName).request(MediaType.APPLICATION_JSON).delete(); - } - - } + + private final OpenStackClient CLIENT; + + private String container; + + public ContainerResource(OpenStackClient client, String container) { + CLIENT = client; + this.container = container; + } + + public List list() { + return new List(container, null); + } + + public CreateDirectory createDirectory(String path) { + return new CreateDirectory(container, path); + } + + public Show show(String path) { + return new Show(container, path); + } + + public Upload upload(ObjectForUpload objectForUpload) { + return new Upload(objectForUpload); + } + + public Download download(String path) { + return new Download(container, path); + } + + public Delete delete(String path) { + return new Delete(container, path); + } + + public class List extends OpenStackRequest<java.util.List<Object>> { + + private String containerName; + + private Map<String, String> filters; + + public List(String containerName, Map<String, String> filters) { + this.containerName = containerName; + this.filters = filters; + //returnType(new TypeToken<List<Object>>(){}); +// target = target.path(containerName); +// for(String filter : new String[]{"prefix","delimiter","path","marker"}) { +// if(filters.get(filter) != null) { +// target = target.queryParam(filter, filters.get(filter)); +// } +// } +// return target.request(MediaType.APPLICATION_JSON).get(new GenericType<List<Object>>(){}); + } + + } + + public class CreateDirectory extends OpenStackRequest<Void> { + + private String container; + + private String path; + + public CreateDirectory(String container, String path) { + this.container = container; + this.path = path; +// endpoint.path(container).path(path).request().put(Entity.entity(new byte[1],"application/directory")); + } + + } + + public class Show extends OpenStackRequest<Object> { + + private String containerName; + + private String objectName; + + public Show(String containerName, String objectName) { + this.containerName = containerName; + this.objectName = objectName; +// return target.path(containerName).path(objectName).request(MediaType.APPLICATION_JSON).head(); + } + + } + + public class Upload extends OpenStackRequest<OpenStackResponse> { + + private ObjectForUpload objectForUpload; + + public Upload(ObjectForUpload objectForUpload) { + this.objectForUpload = objectForUpload; +// Invocation.Builder invocationBuilder = target.path(objectForUpload.getContainer()).path(objectForUpload.getName()).request(MediaType.APPLICATION_JSON); +// for(String key : objectForUpload.getProperties().keySet()) { +// invocationBuilder.header("x-object-meta-" + key, objectForUpload.getProperties().get(key)); +// } +// return invocationBuilder.put(Entity.entity(objectForUpload.getInputStream(), MediaType.APPLICATION_OCTET_STREAM), Response.class); + } + + } + + public class Download extends OpenStackRequest<ObjectDownload> { + + private String containerName; + + private String objectName; + + public Download(String containerName, String objectName) { + this.containerName = containerName; + this.objectName = objectName; +// Response response = target.path(containerName).path(objectName).request(MediaType.APPLICATION_JSON).get(); +// ObjectDownload objectDownload = new ObjectDownload(); +// objectDownload.setInputStream((InputStream) response.getEntity()); +// return objectDownload; + } + + } + + + public class Delete extends OpenStackRequest<Void> { + + private String containerName; + + private String objectName; + + public Delete(String containerName, String objectName) { + this.containerName = containerName; + this.objectName = objectName; + //return target.path(containerName).path(objectName).request(MediaType.APPLICATION_JSON).delete(); + } + + } } diff --git a/swift-client/src/main/java/com/woorea/openstack/swift/api/ContainersResource.java b/swift-client/src/main/java/com/woorea/openstack/swift/api/ContainersResource.java index 77dbc8a..663152c 100644 --- a/swift-client/src/main/java/com/woorea/openstack/swift/api/ContainersResource.java +++ b/swift-client/src/main/java/com/woorea/openstack/swift/api/ContainersResource.java @@ -22,69 +22,69 @@ import com.woorea.openstack.base.client.OpenStackRequest; import com.woorea.openstack.swift.model.Container; public class ContainersResource { - - private final OpenStackClient CLIENT; - - public ContainersResource(OpenStackClient client) { - CLIENT = client; - } - - public List list() { - return new List(); - } - - public Create create(String name) { - return new Create(name); - } - - public Show show(String name) { - return new Show(name); - } - - public Delete delete(String name) { - return new Delete(name); - } - - public ContainerResource container(String name) { - return new ContainerResource(CLIENT, name); - } - - public class List extends OpenStackRequest<java.util.List<Container>> { + + private final OpenStackClient CLIENT; + + public ContainersResource(OpenStackClient client) { + CLIENT = client; + } + + public List list() { + return new List(); + } + + public Create create(String name) { + return new Create(name); + } + + public Show show(String name) { + return new Show(name); + } + + public Delete delete(String name) { + return new Delete(name); + } + + public ContainerResource container(String name) { + return new ContainerResource(CLIENT, name); + } + + public class List extends OpenStackRequest<java.util.List<Container>> { - public List() { - //return target.request(MediaType.APPLICATION_JSON).get(new GenericType<List<Container>>(){}); - } + public List() { + //return target.request(MediaType.APPLICATION_JSON).get(new GenericType<List<Container>>(){}); + } - } + } - public class Create extends OpenStackRequest<Container> { - - public Create(String containerName) { - //return target.path(containerName).request().method("PUT",Entity.text("*")); - } + public class Create extends OpenStackRequest<Container> { + + public Create(String containerName) { + //return target.path(containerName).request().method("PUT",Entity.text("*")); + } - } - - public class Show extends OpenStackRequest<Container> { + } + + public class Show extends OpenStackRequest<Container> { - private String containerName; - - public Show(String containerName) { -// return target.path(containerName).request(MediaType.APPLICATION_JSON).head(); - } + private String containerName; + + public Show(String containerName) { +// return target.path(containerName).request(MediaType.APPLICATION_JSON).head(); + } - } - - public class Delete extends OpenStackRequest<Void> { + } + + public class Delete extends OpenStackRequest<Void> { - private String containerName; - - public Delete(String containerName) { - this.containerName = containerName; - //return target.path(containerName).request(MediaType.APPLICATION_JSON).delete(); - } + private String containerName; + + public Delete(String containerName) { + this.containerName = containerName; + //return target.path(containerName).request(MediaType.APPLICATION_JSON).delete(); + } - } - + } + } diff --git a/swift-model/src/main/java/com/woorea/openstack/swift/model/Account.java b/swift-model/src/main/java/com/woorea/openstack/swift/model/Account.java index 697b3c1..008574e 100644 --- a/swift-model/src/main/java/com/woorea/openstack/swift/model/Account.java +++ b/swift-model/src/main/java/com/woorea/openstack/swift/model/Account.java @@ -20,61 +20,61 @@ import java.io.Serializable; public class Account implements Serializable { - private Integer containerCount; - - private Integer objectCount; - - private Integer bytesUsed; + private Integer containerCount; + + private Integer objectCount; + + private Integer bytesUsed; - /** - * @return the containerCount - */ - public Integer getContainerCount() { - return containerCount; - } + /** + * @return the containerCount + */ + public Integer getContainerCount() { + return containerCount; + } - /** - * @param containerCount the containerCount to set - */ - public void setContainerCount(Integer containerCount) { - this.containerCount = containerCount; - } + /** + * @param containerCount the containerCount to set + */ + public void setContainerCount(Integer containerCount) { + this.containerCount = containerCount; + } - /** - * @return the objectCount - */ - public Integer getObjectCount() { - return objectCount; - } + /** + * @return the objectCount + */ + public Integer getObjectCount() { + return objectCount; + } - /** - * @param objectCount the objectCount to set - */ - public void setObjectCount(Integer objectCount) { - this.objectCount = objectCount; - } + /** + * @param objectCount the objectCount to set + */ + public void setObjectCount(Integer objectCount) { + this.objectCount = objectCount; + } - /** - * @return the bytesUsed - */ - public Integer getBytesUsed() { - return bytesUsed; - } + /** + * @return the bytesUsed + */ + public Integer getBytesUsed() { + return bytesUsed; + } - /** - * @param bytesUsed the bytesUsed to set - */ - public void setBytesUsed(Integer bytesUsed) { - this.bytesUsed = bytesUsed; - } + /** + * @param bytesUsed the bytesUsed to set + */ + public void setBytesUsed(Integer bytesUsed) { + this.bytesUsed = bytesUsed; + } - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Account [containerCount=" + containerCount + ", objectCount=" - + objectCount + ", bytesUsed=" + bytesUsed + "]"; - } - + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Account [containerCount=" + containerCount + ", objectCount=" + + objectCount + ", bytesUsed=" + bytesUsed + "]"; + } + } diff --git a/swift-model/src/main/java/com/woorea/openstack/swift/model/Container.java b/swift-model/src/main/java/com/woorea/openstack/swift/model/Container.java index 42488f3..eb359f3 100644 --- a/swift-model/src/main/java/com/woorea/openstack/swift/model/Container.java +++ b/swift-model/src/main/java/com/woorea/openstack/swift/model/Container.java @@ -21,66 +21,66 @@ import java.io.Serializable; import org.codehaus.jackson.annotate.JsonProperty; public class Container implements Serializable { - - private String name; - - @JsonProperty("count") - private Integer objectCount; - - @JsonProperty("bytes") - private Long bytesUsed; + + private String name; + + @JsonProperty("count") + private Integer objectCount; + + @JsonProperty("bytes") + private Long bytesUsed; - /** - * @return the name - */ - public String getName() { - return name; - } + /** + * @return the name + */ + public String getName() { + return name; + } - /** - * @param name the name to set - */ - public void setName(String name) { - this.name = name; - } + /** + * @param name the name to set + */ + public void setName(String name) { + this.name = name; + } - /** - * @return the objectCount - */ - public Integer getObjectCount() { - return objectCount; - } + /** + * @return the objectCount + */ + public Integer getObjectCount() { + return objectCount; + } - /** - * @param objectCount the objectCount to set - */ - public void setObjectCount(Integer objectCount) { - this.objectCount = objectCount; - } + /** + * @param objectCount the objectCount to set + */ + public void setObjectCount(Integer objectCount) { + this.objectCount = objectCount; + } - /** - * @return the bytesUsed - */ - public Long getBytesUsed() { - return bytesUsed; - } + /** + * @return the bytesUsed + */ + public Long getBytesUsed() { + return bytesUsed; + } - /** - * @param bytesUsed the bytesUsed to set - */ - public void setBytesUsed(Long bytesUsed) { - this.bytesUsed = bytesUsed; - } + /** + * @param bytesUsed the bytesUsed to set + */ + public void setBytesUsed(Long bytesUsed) { + this.bytesUsed = bytesUsed; + } - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Container [name=" + name + ", objectCount=" + objectCount - + ", bytesUsed=" + bytesUsed + "]"; - } + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Container [name=" + name + ", objectCount=" + objectCount + + ", bytesUsed=" + bytesUsed + "]"; + } - - + + } diff --git a/swift-model/src/main/java/com/woorea/openstack/swift/model/Object.java b/swift-model/src/main/java/com/woorea/openstack/swift/model/Object.java index eb36bfe..1c7d1e5 100644 --- a/swift-model/src/main/java/com/woorea/openstack/swift/model/Object.java +++ b/swift-model/src/main/java/com/woorea/openstack/swift/model/Object.java @@ -23,103 +23,103 @@ import org.codehaus.jackson.annotate.JsonProperty; public class Object implements Serializable { - - private String subdir; - - private String name; - - private String hash; - - private int bytes; - - @JsonProperty("content_type") - private String contentType; - - @JsonProperty("last_modified") - private Calendar lastModified; - - /** - * @return the subdir - */ - public String getSubdir() { - return subdir; - } - - /** - * @param subdir the subdir to set - */ - public void setSubdir(String subdir) { - this.subdir = subdir; - } - - /** - * @return the name - */ - public String getName() { - return name; - } - - /** - * @param name the name to set - */ - public void setName(String name) { - this.name = name; - } - - /** - * @return the hash - */ - public String getHash() { - return hash; - } - - /** - * @param hash the hash to set - */ - public void setHash(String hash) { - this.hash = hash; - } - - /** - * @return the bytes - */ - public int getBytes() { - return bytes; - } - - /** - * @param bytes the bytes to set - */ - public void setBytes(int bytes) { - this.bytes = bytes; - } - - /** - * @return the contentType - */ - public String getContentType() { - return contentType; - } - - /** - * @param contentType the contentType to set - */ - public void setContentType(String contentType) { - this.contentType = contentType; - } - - /** - * @return the lastModified - */ - public Calendar getLastModified() { - return lastModified; - } - - /** - * @param lastModified the lastModified to set - */ - public void setLastModified(Calendar lastModified) { - this.lastModified = lastModified; - } - + + private String subdir; + + private String name; + + private String hash; + + private int bytes; + + @JsonProperty("content_type") + private String contentType; + + @JsonProperty("last_modified") + private Calendar lastModified; + + /** + * @return the subdir + */ + public String getSubdir() { + return subdir; + } + + /** + * @param subdir the subdir to set + */ + public void setSubdir(String subdir) { + this.subdir = subdir; + } + + /** + * @return the name + */ + public String getName() { + return name; + } + + /** + * @param name the name to set + */ + public void setName(String name) { + this.name = name; + } + + /** + * @return the hash + */ + public String getHash() { + return hash; + } + + /** + * @param hash the hash to set + */ + public void setHash(String hash) { + this.hash = hash; + } + + /** + * @return the bytes + */ + public int getBytes() { + return bytes; + } + + /** + * @param bytes the bytes to set + */ + public void setBytes(int bytes) { + this.bytes = bytes; + } + + /** + * @return the contentType + */ + public String getContentType() { + return contentType; + } + + /** + * @param contentType the contentType to set + */ + public void setContentType(String contentType) { + this.contentType = contentType; + } + + /** + * @return the lastModified + */ + public Calendar getLastModified() { + return lastModified; + } + + /** + * @param lastModified the lastModified to set + */ + public void setLastModified(Calendar lastModified) { + this.lastModified = lastModified; + } + } diff --git a/swift-model/src/main/java/com/woorea/openstack/swift/model/ObjectDownload.java b/swift-model/src/main/java/com/woorea/openstack/swift/model/ObjectDownload.java index a8fd9ef..269532e 100644 --- a/swift-model/src/main/java/com/woorea/openstack/swift/model/ObjectDownload.java +++ b/swift-model/src/main/java/com/woorea/openstack/swift/model/ObjectDownload.java @@ -22,36 +22,36 @@ import java.io.InputStream; public class ObjectDownload { - private Object object; - - private InputStream inputStream; - - /** - * @return the object - */ - public Object getObject() { - return object; - } - - /** - * @param object the object to set - */ - public void setObject(Object object) { - this.object = object; - } - - /** - * @return the inputStream - */ - public InputStream getInputStream() { - return inputStream; - } - - /** - * @param inputStream the inputStream to set - */ - public void setInputStream(InputStream inputStream) { - this.inputStream = inputStream; - } + private Object object; + + private InputStream inputStream; + + /** + * @return the object + */ + public Object getObject() { + return object; + } + + /** + * @param object the object to set + */ + public void setObject(Object object) { + this.object = object; + } + + /** + * @return the inputStream + */ + public InputStream getInputStream() { + return inputStream; + } + + /** + * @param inputStream the inputStream to set + */ + public void setInputStream(InputStream inputStream) { + this.inputStream = inputStream; + } } diff --git a/swift-model/src/main/java/com/woorea/openstack/swift/model/ObjectForUpload.java b/swift-model/src/main/java/com/woorea/openstack/swift/model/ObjectForUpload.java index 5775f4b..93c8c72 100644 --- a/swift-model/src/main/java/com/woorea/openstack/swift/model/ObjectForUpload.java +++ b/swift-model/src/main/java/com/woorea/openstack/swift/model/ObjectForUpload.java @@ -22,67 +22,67 @@ import java.util.Map; public class ObjectForUpload { - - private String container; - - private String name; - - private Map<String, java.lang.Object> properties; + + private String container; + + private String name; + + private Map<String, java.lang.Object> properties; - private InputStream inputStream; + private InputStream inputStream; - /** - * @return the container - */ - public String getContainer() { - return container; - } + /** + * @return the container + */ + public String getContainer() { + return container; + } - /** - * @param container the container to set - */ - public void setContainer(String container) { - this.container = container; - } + /** + * @param container the container to set + */ + public void setContainer(String container) { + this.container = container; + } - /** - * @return the name - */ - public String getName() { - return name; - } + /** + * @return the name + */ + public String getName() { + return name; + } - /** - * @param name the name to set - */ - public void setName(String name) { - this.name = name; - } + /** + * @param name the name to set + */ + public void setName(String name) { + this.name = name; + } - /** - * @return the properties - */ - public Map<String, java.lang.Object> getProperties() { - if(properties == null) { - properties = new HashMap<>(); - } - return properties; - } + /** + * @return the properties + */ + public Map<String, java.lang.Object> getProperties() { + if(properties == null) { + properties = new HashMap<>(); + } + return properties; + } - /** - * @return the inputStream - */ - public InputStream getInputStream() { - return inputStream; - } + /** + * @return the inputStream + */ + public InputStream getInputStream() { + return inputStream; + } - /** - * @param inputStream the inputStream to set - */ - public void setInputStream(InputStream inputStream) { - this.inputStream = inputStream; - } + /** + * @param inputStream the inputStream to set + */ + public void setInputStream(InputStream inputStream) { + this.inputStream = inputStream; + } - + } |