blob: 505c735914d4c8a535041f5bcd183920274c30fe [file]
# 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.
version: 3
vars:
OS: "{{or .__OS OS}}"
ARCH: "{{or .__ARCH ARCH}}"
DRY: ""
APIHOST:
sh: |
if test -z "$APIHOST"
then
wsk property get --apihost | awk '/whisk API host/{print $4}'
else
echo $APIHOST
fi
AUTH:
sh: |
if test -z "$AUTH"
then
wsk property get --apihost | awk '/whisk API auth/{print $4}'
else
echo $AUTH
fi
USERNAME:
sh: |
wsk property get --namespace | awk '{ print $3 }'
tasks:
prereq:
silent: true
cmds:
- test -e ~/.wskprops || die "please run 'ops -login' first"
-
add:
silent: true
desc: add a secret to user metadata
cmds:
- task: prereq
- |
# no quote here - syntax array generated by docpts
args={{._args_}}
# expanded and assigned to positional parameter
set -- ${args[@]}
# removing the '--' at the beginning required to pass extra flags
test "$1" = "--" && shift
export AUTH={{.AUTH}}
# execute the command line as passed and expanded
bun secrets.js add {{.USERNAME}} {{.APIHOST}} $(printf "%q " "$@")
remove:
silent: true
desc: remove a secret to user metadata
cmds:
- task: prereq
- |
# no quote here - syntax array generated by docpts
args={{._args_}}
# expanded and assigned to positional parameter
set -- ${args[@]}
# removing the '--' at the beginning required to pass extra flags
test "$1" = "--" && shift
export AUTH={{.AUTH}}
# execute the command line as passed and expanded
bun secrets.js remove {{.USERNAME}} {{.APIHOST}} "$@"
list:
silent: true
desc: add a secret to user metadata
cmds:
- task: prereq
- |
export AUTH={{.AUTH}}
# execute the command line as passed and expanded
bun secrets.js list {{.USERNAME}} {{.APIHOST}} {{.__format}}