You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by cs...@apache.org on 2017/08/24 00:35:28 UTC

[incubator-openwhisk-client-js] branch master updated: Remove "experimental" API Gateway support. (#67)

This is an automated email from the ASF dual-hosted git repository.

csantanapr pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk-client-js.git


The following commit(s) were added to refs/heads/master by this push:
     new c1f3a23  Remove "experimental" API Gateway support. (#67)
c1f3a23 is described below

commit c1f3a23391d7df56e85cf3ad86571fde73d5b585
Author: James Thomas <jt...@gmail.com>
AuthorDate: Thu Aug 24 01:35:26 2017 +0100

    Remove "experimental" API Gateway support. (#67)
    
    Fixes #52
---
 lib/routes.js            | 14 ++------------
 test/unit/routes.test.js | 38 ++++++++++++--------------------------
 2 files changed, 14 insertions(+), 38 deletions(-)

diff --git a/lib/routes.js b/lib/routes.js
index 2e5c214..2de8ab4 100644
--- a/lib/routes.js
+++ b/lib/routes.js
@@ -10,9 +10,7 @@ const CREATE_PARAMS = ['relpath', 'operation', 'action']
 
 class Routes extends BaseOperation {
   routeMgmtApiPath (path) {
-    return this.has_access_token() ?
-      `web/whisk.system/apimgmt/${path}.http` :
-      `experimental/web/whisk.system/routemgmt/${path}.json`
+    return `web/whisk.system/apimgmt/${path}.http`
   }
 
   list (options) {
@@ -76,7 +74,7 @@ class Routes extends BaseOperation {
     return {
       name: id,
       namespace: namespace,
-      backendMethod: this.action_url_method(),
+      backendMethod: `GET`,
       backendUrl: this.action_url_path(id, namespace),
       authkey: this.client.options.api_key
     }
@@ -86,15 +84,7 @@ class Routes extends BaseOperation {
     return params.basepath || '/'
   }
 
-  action_url_method () {
-    return this.has_access_token() ? 'GET' : 'POST'
-  }
-
   action_url_path (id, namespace) {
-    if (!this.has_access_token()) {
-      return this.client.path_url(`namespaces/${namespace}/actions/${id}`)
-    }
-
     // web action path must contain package identifier. uses default for
     // non-explicit package.
     if (!id.includes('/')) {
diff --git a/test/unit/routes.test.js b/test/unit/routes.test.js
index b300f27..5e3767c 100644
--- a/test/unit/routes.test.js
+++ b/test/unit/routes.test.js
@@ -6,20 +6,6 @@
 const test = require('ava')
 const Routes = require('../../lib/routes')
 
-test('should return experimental api path without api token', t => {
-  const client = { options: {} }
-  const routes = new Routes(client)
-  t.is(routes.routeMgmtApiPath('a'), 'experimental/web/whisk.system/routemgmt/a.json')
-})
-
-test('should return experimental api path with api token', t => {
-  const client = { options: {
-    apigw_token: true
-  }}
-  const routes = new Routes(client)
-  t.is(routes.routeMgmtApiPath('a'), 'web/whisk.system/apimgmt/a.http')
-})
-
 test('should list all routes', t => {
   t.plan(2)
   const client = { options: {} }
@@ -134,8 +120,8 @@ test('should create a route', t => {
       action: {
         name: 'helloAction',
         namespace: '_',
-        backendMethod: 'POST',
-        backendUrl: 'https://openwhisk.ng.bluemix.net/api/v1/namespaces/_/actions/helloAction',
+        backendMethod: 'GET',
+        backendUrl: 'https://openwhisk.ng.bluemix.net/api/v1/web/_/default/helloAction.http',
         authkey: api_key }
     }
   }
@@ -273,8 +259,8 @@ test('should create a route using global ns', t => {
       action: {
         name: 'helloAction',
         namespace: 'global_ns',
-        backendMethod: 'POST',
-        backendUrl: 'https://openwhisk.ng.bluemix.net/api/v1/namespaces/global_ns/actions/helloAction',
+        backendMethod: 'GET',
+        backendUrl: 'https://openwhisk.ng.bluemix.net/api/v1/web/global_ns/default/helloAction.http',
         authkey: api_key }
     }
   }
@@ -307,8 +293,8 @@ test('should create a route using basepath', t => {
       action: {
         name: 'helloAction',
         namespace: '_',
-        backendMethod: 'POST',
-        backendUrl: 'https://openwhisk.ng.bluemix.net/api/v1/namespaces/_/actions/helloAction',
+        backendMethod: 'GET',
+        backendUrl: 'https://openwhisk.ng.bluemix.net/api/v1/web/_/default/helloAction.http',
         authkey: api_key }
     }
   }
@@ -341,8 +327,8 @@ test('should create a route using fully-qualified action name', t => {
       action: {
         name: 'foo/helloAction',
         namespace: 'test',
-        backendMethod: 'POST',
-        backendUrl: 'https://openwhisk.ng.bluemix.net/api/v1/namespaces/test/actions/foo/helloAction',
+        backendMethod: 'GET',
+        backendUrl: 'https://openwhisk.ng.bluemix.net/api/v1/web/test/foo/helloAction.http',
         authkey: api_key }
     }
   }
@@ -375,8 +361,8 @@ test('should create a route using action name with ns', t => {
       action: {
         name: 'helloAction',
         namespace: 'test',
-        backendMethod: 'POST',
-        backendUrl: 'https://openwhisk.ng.bluemix.net/api/v1/namespaces/test/actions/helloAction',
+        backendMethod: 'GET',
+        backendUrl: 'https://openwhisk.ng.bluemix.net/api/v1/web/test/default/helloAction.http',
         authkey: api_key }
     }
   }
@@ -409,8 +395,8 @@ test('should create a route using action name with ns overriding defaults', t =>
       action: {
         name: 'helloAction',
         namespace: 'test',
-        backendMethod: 'POST',
-        backendUrl: 'https://openwhisk.ng.bluemix.net/api/v1/namespaces/test/actions/helloAction',
+        backendMethod: 'GET',
+        backendUrl: 'https://openwhisk.ng.bluemix.net/api/v1/web/test/default/helloAction.http',
         authkey: api_key }
     }
   }

-- 
To stop receiving notification emails like this one, please contact
['"commits@openwhisk.apache.org" <co...@openwhisk.apache.org>'].