Files

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

46 lines
931 B
Bash
Raw Permalink Normal View History

# Copyright IBM Corp. 2020, 2026
2023-02-02 17:15:17 -08:00
# SPDX-License-Identifier: BUSL-1.1
load _authorized_actions
2020-10-12 21:15:49 -07:00
function create_scope() {
local parent=$1
local name=$2
echo "name $name scope $parent"
boundary scopes create -name $name -scope-id $parent
}
function read_scope() {
local sid=$1
boundary scopes read -id $sid -format json
}
function delete_scope() {
local sid=$1
2023-02-01 20:54:08 +00:00
boundary scopes delete -id $sid -format json
2020-10-12 21:15:49 -07:00
}
function list_scopes() {
boundary scopes list -scope-id $1 -format json
}
function scope_id() {
local name=$1
local sid=$2
2023-02-01 20:54:08 +00:00
2021-02-25 12:43:17 -05:00
strip $(list_scopes $sid | jq -c ".items[] | select(.name | contains(\"$name\")) | .[\"id\"]")
2020-10-12 21:15:49 -07:00
}
function has_default_scope_actions() {
local out=$1
local actions=('read' 'update' 'delete')
for action in ${actions[@]}; do
$(has_authorized_action "$out" "$action") || {
echo "failed to find $action action in output: $out"
2023-02-01 20:54:08 +00:00
return 1
}
done
}