Initial Interface for remote Configuration
[aaf/authz.git] / auth / auth-locate / src / main / java / org / onap / aaf / auth / locate / api / API_AAFAccess.java
index 9de92d1..af7611a 100644 (file)
@@ -21,6 +21,8 @@
 
 package org.onap.aaf.auth.locate.api;
 
+import static org.onap.aaf.auth.layer.Result.OK;
+
 import java.io.IOException;
 import java.net.ConnectException;
 import java.net.URI;
@@ -222,6 +224,28 @@ public class API_AAFAccess {
                                }
                        }
                });
+               
+               /**
+                * Configuration 
+                */
+               gwAPI.route(HttpMethods.GET,"/configure/:id/:type",API.CONFIG,new LocateCode(facade,"Deliver Configuration Properties to AAF", true) {
+                       @Override
+                       public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception {
+                               try {
+                                       Result<Void> r = facade.getConfig(trans, req, resp, pathParam(req, ":id"),pathParam(req,":type"));
+                                       switch(r.status) {
+                                               case OK:
+                                                       resp.setStatus(HttpStatus.OK_200);
+                                                       break;
+                                               default:
+                                                       context.error(trans,resp,r);
+                                       }
+
+                               } catch (Exception e) {
+                                       context.error(trans, resp, Result.ERR_General, e.getMessage());
+                               }
+                       }
+               });
        }
 
        private static void redirect(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp, LocateFacade context, Locator<URI> loc, String path) throws IOException {