diff options
author | Smokowski, Steve (ss835w) <ss835w@us.att.com> | 2019-05-02 09:42:55 -0400 |
---|---|---|
committer | Smokowski, Steve (ss835w) <ss835w@us.att.com> | 2019-05-07 10:02:17 -0400 |
commit | 3f9a0c3183480d150089c0d5a6e507c877f7d121 (patch) | |
tree | b3db04cbe2cef23f81503177a50edc5360ffa486 /quantum-client/src | |
parent | e153f0adfbed711ce1e215748594a4d04fd1edaf (diff) |
Enhance Openstack Client
Update Openstack Client to support additional fields
Updat all formatting issues
Issue-ID: SO-1844
Change-Id: I1369e0c18cc25274db8df7e12855a020b8da38da
Signed-off-by: Smokowski, Steve (ss835w) <ss835w@us.att.com>
Diffstat (limited to 'quantum-client/src')
6 files changed, 87 insertions, 91 deletions
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 ab64531..c4f5e9f 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); - + 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() - { + + 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 8b5ee25..6530237 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 @@ -44,11 +44,11 @@ public class NetworksResource { return new Update(net); } - public Delete delete(String netId){ + public Delete delete(String netId) { return new Delete(netId); } - public Show show(String netId){ + public Show show(String netId) { return new Show(netId); } @@ -62,7 +62,7 @@ public class NetworksResource { public class Query extends OpenStackRequest<Networks> { public Query(Network network) { - + } } @@ -90,7 +90,7 @@ public class NetworksResource { public class Delete extends OpenStackRequest<Void> { - public Delete(String id){ + 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 a82c111..7ac0c8c 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 @@ -36,19 +36,19 @@ public class PortsResource { return new List(); } - public Create create(Port port){ + public Create create(Port port) { return new Create(port); } - public Update update(Port port){ + public Update update(Port port) { return new Update(port); } - public Delete delete(String portId){ + public Delete delete(String portId) { return new Delete(portId); } - public Show show(String portId){ + public Show show(String portId) { return new Show(portId); } @@ -61,22 +61,21 @@ public class PortsResource { public class Query extends OpenStackRequest<Ports> { - public Query(Port port) { - } + public Query(Port port) {} } public class Create extends OpenStackRequest<Port> { - public Create(Port port){ + public Create(Port port) { super(CLIENT, HttpMethod.POST, "ports", Entity.json(port), Port.class); } } public class Update extends OpenStackRequest<Port> { - public Update(Port port){ + public Update(Port port) { super(CLIENT, HttpMethod.PUT, buildPath("ports/", port.getId()), Entity.json(port), Port.class); } } @@ -90,7 +89,7 @@ public class PortsResource { 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 774e44a..ed2f22d 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,87 +28,89 @@ import com.woorea.openstack.quantum.model.Routers; public class RoutersResource { - private final OpenStackClient CLIENT; + private final OpenStackClient CLIENT; - public RoutersResource(OpenStackClient client) { - CLIENT = client; - } + public RoutersResource(OpenStackClient client) { + CLIENT = client; + } - public List list() { - return new List(); - } + public List list() { + return new List(); + } - public Create create(RouterForCreate router){ - return new Create(router); - } + public Create create(RouterForCreate router) { + return new Create(router); + } - 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<Routers> { + public class List extends OpenStackRequest<Routers> { - public List() { - super(CLIENT, HttpMethod.GET, "routers", null, Routers.class); - } + public List() { + super(CLIENT, HttpMethod.GET, "routers", null, Routers.class); } + } - public class Query extends OpenStackRequest<Routers> { + public class Query extends OpenStackRequest<Routers> { - public Query(Router router) { - } - } - public class Create extends OpenStackRequest<Router> { + public Query(Router router) {} + } + public class Create extends OpenStackRequest<Router> { - public Create(RouterForCreate router){ - super(CLIENT, HttpMethod.POST, "routers", Entity.json(router), Router.class); - } + 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 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 class Delete extends OpenStackRequest<Void> { - public Delete(String id){ - super(CLIENT, HttpMethod.DELETE, buildPath("routers/", id), null, Void.class); - } + 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 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 class Detach extends OpenStackRequest<RouterInterface> { + } + + 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"), + 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 bee3743..91553b3 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 @@ -44,11 +44,11 @@ public class SubnetsResource { return new Update(net); } - public Delete delete(String netId){ + public Delete delete(String netId) { return new Delete(netId); } - public Show show(String netId){ + public Show show(String netId) { return new Show(netId); } @@ -61,8 +61,7 @@ public class SubnetsResource { public class Query extends OpenStackRequest<Subnets> { - public Query(Subnet subnet) { - } + public Query(Subnet subnet) {} } @@ -89,7 +88,7 @@ public class SubnetsResource { 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 8914ab0..2b5c977 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 @@ -19,7 +19,6 @@ package com.woorea.openstack.quantum.api.query; import java.lang.reflect.Field; import java.util.HashMap; import java.util.Map; - import com.fasterxml.jackson.annotation.JsonProperty; import com.woorea.openstack.base.client.OpenStackRequest; @@ -27,8 +26,7 @@ public class AbsOpenStackCmd<T> extends OpenStackRequest<T> { private T query; - protected AbsOpenStackCmd(T query) - { + protected AbsOpenStackCmd(T query) { this.setQuery(query); } @@ -46,8 +44,7 @@ public class AbsOpenStackCmd<T> extends OpenStackRequest<T> { return query; } - private String getFieldValue(Field field, T target) - { + private String getFieldValue(Field field, T target) { try { field.setAccessible(true); Object obj = field.get(target); @@ -59,8 +56,7 @@ public class AbsOpenStackCmd<T> extends OpenStackRequest<T> { } } - private Map<String, String> getObjectParamMap(T target) - { + private Map<String, String> getObjectParamMap(T target) { Map<String, String> resultMap = new HashMap<>(); if (target == null) return resultMap; |