knox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lmc...@apache.org
Subject [2/2] knox git commit: KNOX-1204 - Continued client classes work
Date Thu, 21 Jun 2018 05:44:08 GMT
KNOX-1204 - Continued client classes work

Project: http://git-wip-us.apache.org/repos/asf/knox/repo
Commit: http://git-wip-us.apache.org/repos/asf/knox/commit/f315b665
Tree: http://git-wip-us.apache.org/repos/asf/knox/tree/f315b665
Diff: http://git-wip-us.apache.org/repos/asf/knox/diff/f315b665

Branch: refs/heads/KNOX-1204
Commit: f315b6652b938970e20e7b7988f01a22c62f5017
Parents: 66736e1
Author: Larry McCay <lmccay@HW14155.local>
Authored: Wed Jun 20 22:43:57 2018 -0700
Committer: Larry McCay <lmccay@HW14155.local>
Committed: Wed Jun 20 22:43:57 2018 -0700

----------------------------------------------------------------------
 .../service/knoxs3/KnoxS3ServiceMessages.java   |  2 +-
 .../gateway/shell/idbroker/Credentials.java     | 29 ++++++++++
 .../apache/knox/gateway/shell/idbroker/Get.java | 57 ++++++++++++++++++++
 .../knox/gateway/shell/knoxs3/Buckets.java      | 29 ++++++++++
 .../apache/knox/gateway/shell/knoxs3/Get.java   | 57 ++++++++++++++++++++
 5 files changed, 173 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/knox/blob/f315b665/gateway-service-knoxs3/src/main/java/org/apache/knox/gateway/service/knoxs3/KnoxS3ServiceMessages.java
----------------------------------------------------------------------
diff --git a/gateway-service-knoxs3/src/main/java/org/apache/knox/gateway/service/knoxs3/KnoxS3ServiceMessages.java
b/gateway-service-knoxs3/src/main/java/org/apache/knox/gateway/service/knoxs3/KnoxS3ServiceMessages.java
index 36e1f21..956db8b 100644
--- a/gateway-service-knoxs3/src/main/java/org/apache/knox/gateway/service/knoxs3/KnoxS3ServiceMessages.java
+++ b/gateway-service-knoxs3/src/main/java/org/apache/knox/gateway/service/knoxs3/KnoxS3ServiceMessages.java
@@ -27,6 +27,6 @@ public interface KnoxS3ServiceMessages {
   @Message(level = MessageLevel.INFO, text = "{0}")
   void basicInfo(String original);
 
-  @Message(level = MessageLevel.ERROR, text = "Unable to get health stats for {0}, due to
{1}")
+  @Message(level = MessageLevel.ERROR, text = "Unable to acquire credentials for S3 access
using {0} , due to {1}")
   void logException(String name, @StackTrace(level = MessageLevel.DEBUG) Exception e);
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/knox/blob/f315b665/gateway-shell/src/main/java/org/apache/knox/gateway/shell/idbroker/Credentials.java
----------------------------------------------------------------------
diff --git a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/idbroker/Credentials.java
b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/idbroker/Credentials.java
new file mode 100644
index 0000000..c2d951c
--- /dev/null
+++ b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/idbroker/Credentials.java
@@ -0,0 +1,29 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); 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
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.knox.gateway.shell.idbroker;
+
+import org.apache.knox.gateway.shell.Hadoop;
+
+public class Credentials {
+
+  static String SERVICE_PATH = "/idbroker/api/v1/credentials";
+
+  public static Get.Request get( Hadoop session ) {
+    return new Get.Request( session );
+  }
+}

http://git-wip-us.apache.org/repos/asf/knox/blob/f315b665/gateway-shell/src/main/java/org/apache/knox/gateway/shell/idbroker/Get.java
----------------------------------------------------------------------
diff --git a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/idbroker/Get.java b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/idbroker/Get.java
new file mode 100644
index 0000000..41db983
--- /dev/null
+++ b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/idbroker/Get.java
@@ -0,0 +1,57 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); 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
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.knox.gateway.shell.idbroker;
+
+import java.io.IOException;
+import java.util.concurrent.Callable;
+
+import org.apache.knox.gateway.shell.AbstractRequest;
+import org.apache.knox.gateway.shell.BasicResponse;
+import org.apache.knox.gateway.shell.Hadoop;
+import org.apache.http.HttpResponse;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.utils.URIBuilder;
+
+/**
+ * Acquire a cloud vendor credentials for authentication
+ * to access vendor REST APIs
+ */
+public class Get {
+  public static class Request extends AbstractRequest<Response> {
+    Request(Hadoop session) {
+      super(session);
+    }
+
+    protected Callable<Response> callable() {
+      return new Callable<Response>() {
+        @Override
+        public Response call() throws Exception {
+          URIBuilder uri = uri(Credentials.SERVICE_PATH);
+          HttpGet request = new HttpGet(uri.build());
+          return new Response(execute(request));
+        }
+      };
+    }
+  }
+
+  public static class Response extends BasicResponse {
+    Response(HttpResponse response) throws IOException {
+      super(response);
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/knox/blob/f315b665/gateway-shell/src/main/java/org/apache/knox/gateway/shell/knoxs3/Buckets.java
----------------------------------------------------------------------
diff --git a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/knoxs3/Buckets.java
b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/knoxs3/Buckets.java
new file mode 100644
index 0000000..c2d6d0d
--- /dev/null
+++ b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/knoxs3/Buckets.java
@@ -0,0 +1,29 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); 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
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.knox.gateway.shell.knoxs3;
+
+import org.apache.knox.gateway.shell.Hadoop;
+
+public class Buckets {
+
+  static String SERVICE_PATH = "/knoxs3/v1/buckets";
+
+  public static Get.Request get( Hadoop session ) {
+    return new Get.Request( session );
+  }
+}

http://git-wip-us.apache.org/repos/asf/knox/blob/f315b665/gateway-shell/src/main/java/org/apache/knox/gateway/shell/knoxs3/Get.java
----------------------------------------------------------------------
diff --git a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/knoxs3/Get.java b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/knoxs3/Get.java
new file mode 100644
index 0000000..9131071
--- /dev/null
+++ b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/knoxs3/Get.java
@@ -0,0 +1,57 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); 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
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.knox.gateway.shell.knoxs3;
+
+import java.io.IOException;
+import java.util.concurrent.Callable;
+
+import org.apache.knox.gateway.shell.AbstractRequest;
+import org.apache.knox.gateway.shell.BasicResponse;
+import org.apache.knox.gateway.shell.Hadoop;
+import org.apache.http.HttpResponse;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.utils.URIBuilder;
+
+/**
+ * Acquire a cloud vendor credentials for authentication
+ * to access vendor REST APIs
+ */
+public class Get {
+  public static class Request extends AbstractRequest<Response> {
+    Request(Hadoop session) {
+      super(session);
+    }
+
+    protected Callable<Response> callable() {
+      return new Callable<Response>() {
+        @Override
+        public Response call() throws Exception {
+          URIBuilder uri = uri(Buckets.SERVICE_PATH);
+          HttpGet request = new HttpGet(uri.build());
+          return new Response(execute(request));
+        }
+      };
+    }
+  }
+
+  public static class Response extends BasicResponse {
+    Response(HttpResponse response) throws IOException {
+      super(response);
+    }
+  }
+}


Mime
View raw message