You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by ta...@apache.org on 2019/11/14 22:52:03 UTC

[openwhisk-composer] branch apiversion created (now e211cac)

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

tardieu pushed a change to branch apiversion
in repository https://gitbox.apache.org/repos/asf/openwhisk-composer.git.


      at e211cac  Add support for setting the apiversion in the deploy command

This branch includes the following new commits:

     new e211cac  Add support for setting the apiversion in the deploy command

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[openwhisk-composer] 01/01: Add support for setting the apiversion in the deploy command

Posted by ta...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

tardieu pushed a commit to branch apiversion
in repository https://gitbox.apache.org/repos/asf/openwhisk-composer.git

commit e211cacf5b11136489619625fca544e0c5406b66
Author: Olivier Tardieu <ta...@users.noreply.github.com>
AuthorDate: Thu Nov 14 17:47:20 2019 -0500

    Add support for setting the apiversion in the deploy command
---
 bin/deploy.js    | 4 +++-
 client.js        | 5 ++++-
 docs/COMMANDS.md | 5 +++++
 3 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/bin/deploy.js b/bin/deploy.js
index 5fffccd..5a54691 100755
--- a/bin/deploy.js
+++ b/bin/deploy.js
@@ -28,7 +28,7 @@ const minimist = require('minimist')
 const path = require('path')
 
 const argv = minimist(process.argv.slice(2), {
-  string: ['apihost', 'auth', 'source', 'annotation', 'annotation-file', 'debug', 'kind'],
+  string: ['apihost', 'apiversion', 'auth', 'source', 'annotation', 'annotation-file', 'debug', 'kind'],
   boolean: ['insecure', 'version', 'overwrite', 'basic', 'bearer'],
   alias: { auth: 'u', insecure: 'i', version: 'v', annotation: 'a', 'annotation-file': 'A', overwrite: 'w', timeout: 't', memory: 'm', logsize: 'l' }
 })
@@ -45,6 +45,7 @@ if (argv._.length !== 2 || path.extname(argv._[1]) !== '.json') {
   console.error('  -a, --annotation KEY=VALUE        add KEY annotation with VALUE')
   console.error('  -A, --annotation-file KEY=FILE    add KEY annotation with FILE content')
   console.error('  --apihost HOST                    API HOST')
+  console.error('  --apiversion VERSION              API VERSION')
   console.error('  --basic                           force basic authentication')
   console.error('  --bearer                          force bearer token authentication')
   console.error('  -i, --insecure                    bypass certificate checking')
@@ -88,6 +89,7 @@ try {
 const options = { ignore_certs: argv.insecure }
 if (argv.apihost) options.apihost = argv.apihost
 if (argv.auth) options.api_key = argv.auth
+if (argv.apiversion) options.apiversion = argv.apiversion
 try {
   composition.name = fqn(argv._[0])
 } catch (error) {
diff --git a/client.js b/client.js
index 233b4a2..e1863a0 100644
--- a/client.js
+++ b/client.js
@@ -29,6 +29,7 @@ const path = require('path')
 module.exports = function (options, basic, bearer) {
   // try to extract apihost and key first from whisk property file file and then from process.env
   let apihost
+  let apiversion
   let apikey
   let ignorecerts
   let namespace = '_'
@@ -44,6 +45,8 @@ module.exports = function (options, basic, bearer) {
       if (parts.length === 2) {
         if (parts[0] === 'APIHOST') {
           apihost = parts[1]
+        } else if (parts[0] === 'APIVERSION') {
+          apiversion = parts[1]
         } else if (parts[0] === 'AUTH') {
           apikey = parts[1]
         } else if (parts[0] === 'NAMESPACE') {
@@ -70,7 +73,7 @@ module.exports = function (options, basic, bearer) {
     }
   }
 
-  const wsk = openwhisk(Object.assign({ apihost, api_key: apikey, auth_handler: authHandler, namespace, ignore_certs: ignorecerts }, options))
+  const wsk = openwhisk(Object.assign({ apihost, apiversion, api_key: apikey, auth_handler: authHandler, namespace, ignore_certs: ignorecerts }, options))
   wsk.compositions = new Compositions(wsk)
   return wsk
 }
diff --git a/docs/COMMANDS.md b/docs/COMMANDS.md
index 2850e2a..6e37924 100644
--- a/docs/COMMANDS.md
+++ b/docs/COMMANDS.md
@@ -75,6 +75,7 @@ Flags:
   -a, --annotation KEY=VALUE        add KEY annotation with VALUE
   -A, --annotation-file KEY=FILE    add KEY annotation with FILE content
   --apihost HOST                    API HOST
+  --apiversion VERSION              API VERSION
   --basic                           force basic authentication
   --bearer                          force bearer token authentication
   -i, --insecure                    bypass certificate checking
@@ -144,6 +145,10 @@ If the `--apihost` flag is absent, the environment variable `__OW_API_HOST` is
 used in its place. If neither is available, the `deploy` command extracts the
 `APIHOST` key from the whisk property file.
 
+The `apiversion` may be specified using the `--apiversion` flag, or, if absent,
+the `APIVERSION` property of the whisk property file. If both are absent, the
+default is assumed.
+
 If the `--insecure` flag is set or the environment variable `__OW_IGNORE_CERTS`
 is set to `true`, the `deploy` command ignores SSL certificates validation
 failures.