Files
threshold/internal/tests/cli/boundary/_host_catalogs.bash
T

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

44 lines
1002 B
Bash
Raw Normal View History

2023-02-02 17:15:17 -08:00
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: BUSL-1.1
load _authorized_actions
2020-10-12 14:56:23 -07:00
function create_host_catalog() {
2020-10-12 16:44:45 -07:00
local name=$1
local sid=$2
echo "sid $sid"
boundary host-catalogs create static \
-scope-id $sid \
-name $name \
-description 'test host catalog'
2020-10-12 14:56:23 -07:00
}
function read_host_catalog() {
boundary host-catalogs read -id $1 -format json
2020-10-12 14:56:23 -07:00
}
function delete_host_catalog() {
2023-02-01 20:54:08 +00:00
boundary host-catalogs delete -id $1 -format json
2020-10-12 14:56:23 -07:00
}
function list_host_catalogs() {
boundary host-catalogs list -scope-id $1 -format json
}
function host_catalog_id() {
local id=$1
local sid=$2
2021-02-25 12:43:17 -05:00
strip $(list_host_catalogs $sid | jq -c ".items[] | select(.name | contains(\"$id\")) | .[\"id\"]")
2020-10-12 14:56:23 -07:00
}
function has_default_host_catalog_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
}