summaryrefslogtreecommitdiffstats
path: root/ceilometer-client/src/main
diff options
context:
space:
mode:
authorChrisC <cc697w@intl.att.com>2017-01-31 13:57:24 +0100
committerChrisC <cc697w@intl.att.com>2017-01-31 14:55:11 +0100
commit2e984294ac28c6f2ede290c38164c5d536ccaf4a (patch)
tree5eba5a929b7a961c98749fa69e03cfea58e1a724 /ceilometer-client/src/main
parent86c0f28c8ed469486b64d6422dc53e3a7bcc8adb (diff)
Initial OpenECOMP MSO OpenStack SDK lib commit
Change-Id: Ieaacb2b2c0dcc469669880e73f0cda9fa59a6c5a Signed-off-by: ChrisC <cc697w@intl.att.com>
Diffstat (limited to 'ceilometer-client/src/main')
-rw-r--r--ceilometer-client/src/main/java/com/woorea/openstack/ceilometer/Ceilometer.java34
-rw-r--r--ceilometer-client/src/main/java/com/woorea/openstack/ceilometer/QueriableCeilometerCommand.java58
-rw-r--r--ceilometer-client/src/main/java/com/woorea/openstack/ceilometer/v2/api/MetersResource.java71
-rw-r--r--ceilometer-client/src/main/java/com/woorea/openstack/ceilometer/v2/api/ResourcesResource.java45
4 files changed, 208 insertions, 0 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
new file mode 100644
index 0000000..05cda35
--- /dev/null
+++ b/ceilometer-client/src/main/java/com/woorea/openstack/ceilometer/Ceilometer.java
@@ -0,0 +1,34 @@
+package com.woorea.openstack.ceilometer;
+
+
+import com.woorea.openstack.base.client.OpenStackClient;
+import com.woorea.openstack.base.client.OpenStackClientConnector;
+import com.woorea.openstack.ceilometer.v2.api.MetersResource;
+import com.woorea.openstack.ceilometer.v2.api.ResourcesResource;
+
+public class Ceilometer extends OpenStackClient {
+
+ private final MetersResource METERS;
+
+ private final ResourcesResource RESOURCES;
+
+ public Ceilometer(String endpoint, OpenStackClientConnector connector) {
+ super(endpoint, connector);
+ METERS = new MetersResource(this);
+ RESOURCES = new ResourcesResource(this);
+ }
+
+ public Ceilometer(String endpoint) {
+ this(endpoint, null);
+
+ }
+
+ public ResourcesResource resources() {
+ return RESOURCES;
+ }
+
+ public MetersResource meters() {
+ return METERS;
+ }
+
+}
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
new file mode 100644
index 0000000..444c052
--- /dev/null
+++ b/ceilometer-client/src/main/java/com/woorea/openstack/ceilometer/QueriableCeilometerCommand.java
@@ -0,0 +1,58 @@
+package com.woorea.openstack.ceilometer;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+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<String>();
+
+ protected List<String> ops = new ArrayList<String>();
+
+ protected List<Serializable> values = new ArrayList<Serializable>();
+
+ 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;
+ }
+ */
+}
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
new file mode 100644
index 0000000..e44dbe6
--- /dev/null
+++ b/ceilometer-client/src/main/java/com/woorea/openstack/ceilometer/v2/api/MetersResource.java
@@ -0,0 +1,71 @@
+package com.woorea.openstack.ceilometer.v2.api;
+
+
+import com.woorea.openstack.base.client.OpenStackClient;
+import com.woorea.openstack.base.client.OpenStackRequest;
+import com.woorea.openstack.ceilometer.QueriableCeilometerCommand;
+import com.woorea.openstack.ceilometer.v2.model.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 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>> {
+
+ 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
new file mode 100644
index 0000000..9001687
--- /dev/null
+++ b/ceilometer-client/src/main/java/com/woorea/openstack/ceilometer/v2/api/ResourcesResource.java
@@ -0,0 +1,45 @@
+package com.woorea.openstack.ceilometer.v2.api;
+
+import java.util.List;
+
+import com.woorea.openstack.base.client.OpenStackClient;
+import com.woorea.openstack.base.client.OpenStackRequest;
+import com.woorea.openstack.ceilometer.QueriableCeilometerCommand;
+import com.woorea.openstack.ceilometer.v2.model.Resource;
+
+public class ResourcesResource {
+
+ private final OpenStackClient CLIENT;
+
+ public ResourcesResource(OpenStackClient client) {
+ CLIENT = client;
+ }
+
+ public class ResourceList extends QueriableCeilometerCommand<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);
+ }
+
+ }
+
+}