2026-04-06 15:48:37 +05:30
|
|
|
# Copyright IBM Corp. 2020, 2026
|
2022-05-18 20:20:45 -07:00
|
|
|
# SPDX-License-Identifier: BUSL-1.1
|
2023-02-02 17:15:17 -08:00
|
|
|
|
2022-05-18 20:20:45 -07:00
|
|
|
load _authorized_actions
|
|
|
|
|
|
|
|
|
|
function create_username_password_credential() {
|
|
|
|
|
local name=$1
|
|
|
|
|
local sid=$2
|
|
|
|
|
local user=$3
|
|
|
|
|
local pass=$4
|
2023-02-01 20:54:08 +00:00
|
|
|
|
2022-08-05 19:52:04 -04:00
|
|
|
export BP="${pass}"
|
2022-05-18 20:20:45 -07:00
|
|
|
boundary credentials create username-password \
|
|
|
|
|
-name $name \
|
|
|
|
|
-description 'test username password credential' \
|
|
|
|
|
-credential-store-id $sid \
|
|
|
|
|
-username $user \
|
2022-08-05 19:52:04 -04:00
|
|
|
-password env://BP
|
2022-05-18 20:20:45 -07:00
|
|
|
}
|
|
|
|
|
|
2025-05-22 20:26:38 +01:00
|
|
|
|
|
|
|
|
function create_username_password_domain_credential_with_domain() {
|
|
|
|
|
local name=$1
|
|
|
|
|
local sid=$2
|
|
|
|
|
local user=$3
|
|
|
|
|
local pass=$4
|
|
|
|
|
local domain=$5
|
|
|
|
|
|
|
|
|
|
export BP="${pass}"
|
|
|
|
|
boundary credentials create username-password-domain \
|
|
|
|
|
-name $name \
|
|
|
|
|
-description 'test username password domain credential with domain' \
|
|
|
|
|
-credential-store-id $sid \
|
|
|
|
|
-username $user \
|
|
|
|
|
-password env://BP \
|
|
|
|
|
-domain $domain
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function create_username_password_domain_credential() {
|
|
|
|
|
local name=$1
|
|
|
|
|
local sid=$2
|
|
|
|
|
local user=$3
|
|
|
|
|
local pass=$4
|
|
|
|
|
|
|
|
|
|
export BP="${pass}"
|
|
|
|
|
boundary credentials create username-password-domain \
|
|
|
|
|
-name $name \
|
|
|
|
|
-description 'test username password domain credential with domain parsed from username' \
|
|
|
|
|
-credential-store-id $sid \
|
|
|
|
|
-username $user \
|
|
|
|
|
-password env://BP
|
|
|
|
|
}
|
|
|
|
|
|
2022-09-16 15:00:04 -07:00
|
|
|
function create_json_credential() {
|
|
|
|
|
local name=$1
|
|
|
|
|
local sid=$2
|
|
|
|
|
local args=$3
|
|
|
|
|
|
|
|
|
|
boundary credentials create json \
|
|
|
|
|
-name $name \
|
|
|
|
|
-description 'test json credential' \
|
|
|
|
|
-credential-store-id $sid \
|
|
|
|
|
$args
|
|
|
|
|
}
|
|
|
|
|
|
2025-10-29 11:00:09 -05:00
|
|
|
function create_password_credential() {
|
|
|
|
|
local name=$1
|
|
|
|
|
local sid=$2
|
|
|
|
|
local pass=$3
|
|
|
|
|
|
|
|
|
|
export BP="${pass}"
|
|
|
|
|
boundary credentials create password \
|
|
|
|
|
-name $name \
|
|
|
|
|
-description 'test password credential' \
|
|
|
|
|
-credential-store-id $sid \
|
|
|
|
|
-password env://BP
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-18 20:20:45 -07:00
|
|
|
function read_credential() {
|
|
|
|
|
boundary credentials read -id $1 -format json
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function delete_credential() {
|
2023-02-01 20:54:08 +00:00
|
|
|
boundary credentials delete -id $1 -format json
|
2022-05-18 20:20:45 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function list_credentials() {
|
|
|
|
|
boundary credentials list -credential-store-id $1 -format json
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function credential_id() {
|
|
|
|
|
local name=$1
|
|
|
|
|
local sid=$2
|
2023-02-01 20:54:08 +00:00
|
|
|
|
2022-05-18 20:20:45 -07:00
|
|
|
strip $(list_credentials $sid | jq -c ".items[] | select(.name | contains(\"$name\")) | .[\"id\"]")
|
|
|
|
|
}
|