1 parent
b967ff7f05
commit
72aa110f72
50 files changed
+489
-540
No files matched your search
@@ -183,7 +183,7 @@ func TestErrors(t *testing.T) {
|
||||
require.Error(err)
|
||||
apiErr := api.AsServerError(err)
|
||||
require.NotNil(apiErr)
|
||||
assert.EqualValues(http.StatusNotFound, apiErr.ResponseStatus())
|
||||
assert.EqualValues(http.StatusNotFound, apiErr.Response().StatusCode())
|
||||
|
||||
// Create another resource with the same name.
|
||||
_, err = accountClient.Create(tc.Context(), amId, accounts.WithPasswordAccountLoginName("first"))
|
||||
@@ -195,17 +195,17 @@ func TestErrors(t *testing.T) {
|
||||
require.Error(err)
|
||||
apiErr = api.AsServerError(err)
|
||||
require.NotNil(apiErr)
|
||||
assert.EqualValues(http.StatusNotFound, apiErr.ResponseStatus())
|
||||
assert.EqualValues(http.StatusNotFound, apiErr.Response().StatusCode())
|
||||
|
||||
_, err = accountClient.Read(tc.Context(), "invalid id")
|
||||
require.Error(err)
|
||||
apiErr = api.AsServerError(err)
|
||||
require.NotNil(apiErr)
|
||||
assert.EqualValues(http.StatusBadRequest, apiErr.ResponseStatus())
|
||||
assert.EqualValues(http.StatusBadRequest, apiErr.Response().StatusCode())
|
||||
|
||||
_, err = accountClient.Update(tc.Context(), u.Item.Id, u.Item.Version)
|
||||
require.Error(err)
|
||||
apiErr = api.AsServerError(err)
|
||||
require.NotNil(apiErr)
|
||||
assert.EqualValues(http.StatusBadRequest, apiErr.ResponseStatus())
|
||||
assert.EqualValues(http.StatusBadRequest, apiErr.Response().StatusCode())
|
||||
}
|
||||
@@ -27,5 +27,5 @@ func TestAuthenticate(t *testing.T) {
|
||||
require.Error(err)
|
||||
apiErr := api.AsServerError(err)
|
||||
require.NotNil(apiErr)
|
||||
assert.EqualValuesf(http.StatusUnauthorized, apiErr.ResponseStatus(), "Expected unauthorized, got %q", apiErr.Message)
|
||||
assert.EqualValuesf(http.StatusUnauthorized, apiErr.Response().StatusCode(), "Expected unauthorized, got %q", apiErr.Message)
|
||||
}
|
||||
@@ -143,11 +143,11 @@ func TestErrors(t *testing.T) {
|
||||
require.Error(err)
|
||||
apiErr := api.AsServerError(err)
|
||||
require.NotNil(apiErr)
|
||||
assert.EqualValues(http.StatusNotFound, apiErr.ResponseStatus())
|
||||
assert.EqualValues(http.StatusNotFound, apiErr.Response().StatusCode())
|
||||
|
||||
_, err = tokens.Read(tc.Context(), "invalid id")
|
||||
require.Error(err)
|
||||
apiErr = api.AsServerError(err)
|
||||
require.NotNil(apiErr)
|
||||
assert.EqualValues(http.StatusBadRequest, apiErr.ResponseStatus())
|
||||
assert.EqualValues(http.StatusBadRequest, apiErr.Response().StatusCode())
|
||||
}
|
||||
@@ -158,7 +158,7 @@ func TestCrud(t *testing.T) {
|
||||
require.Error(err)
|
||||
apiErr := api.AsServerError(err)
|
||||
require.NotNil(apiErr)
|
||||
assert.EqualValues(http.StatusNotFound, apiErr.ResponseStatus())
|
||||
assert.EqualValues(http.StatusNotFound, apiErr.Response().StatusCode())
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -200,7 +200,7 @@ func TestErrors(t *testing.T) {
|
||||
require.Error(err)
|
||||
apiErr := api.AsServerError(err)
|
||||
require.NotNil(apiErr)
|
||||
assert.EqualValues(http.StatusNotFound, apiErr.ResponseStatus())
|
||||
assert.EqualValues(http.StatusNotFound, apiErr.Response().StatusCode())
|
||||
|
||||
// Create another resource with the same name.
|
||||
_, err = groupClient.Create(tc.Context(), tt.scopeId, groups.WithName("first"))
|
||||
@@ -210,19 +210,19 @@ func TestErrors(t *testing.T) {
|
||||
require.Error(err)
|
||||
apiErr = api.AsServerError(err)
|
||||
require.NotNil(apiErr)
|
||||
assert.EqualValues(http.StatusNotFound, apiErr.ResponseStatus())
|
||||
assert.EqualValues(http.StatusNotFound, apiErr.Response().StatusCode())
|
||||
|
||||
_, err = groupClient.Read(tc.Context(), "invalid id")
|
||||
require.Error(err)
|
||||
apiErr = api.AsServerError(err)
|
||||
require.NotNil(apiErr)
|
||||
assert.EqualValues(http.StatusBadRequest, apiErr.ResponseStatus())
|
||||
assert.EqualValues(http.StatusBadRequest, apiErr.Response().StatusCode())
|
||||
|
||||
_, err = groupClient.Update(tc.Context(), g.Item.Id, g.Item.Version)
|
||||
require.Error(err)
|
||||
apiErr = api.AsServerError(err)
|
||||
require.NotNil(apiErr)
|
||||
assert.EqualValues(http.StatusBadRequest, apiErr.ResponseStatus())
|
||||
assert.EqualValues(http.StatusBadRequest, apiErr.Response().StatusCode())
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -116,7 +116,7 @@ func TestCrud(t *testing.T) {
|
||||
require.Error(err)
|
||||
apiErr := api.AsServerError(err)
|
||||
assert.NotNil(apiErr)
|
||||
assert.EqualValues(http.StatusNotFound, apiErr.ResponseStatus())
|
||||
assert.EqualValues(http.StatusNotFound, apiErr.Response().StatusCode())
|
||||
}
|
||||
|
||||
func TestErrors(t *testing.T) {
|
||||
@@ -141,7 +141,7 @@ func TestErrors(t *testing.T) {
|
||||
require.Error(err)
|
||||
apiErr = api.AsServerError(err)
|
||||
assert.NotNil(apiErr)
|
||||
assert.EqualValues(http.StatusNotFound, apiErr.ResponseStatus())
|
||||
assert.EqualValues(http.StatusNotFound, apiErr.Response().StatusCode())
|
||||
|
||||
_, err = pc.Create(tc.Context(), "static", proj.GetPublicId(), hostcatalogs.WithName("foo"))
|
||||
require.Error(err)
|
||||
@@ -152,11 +152,11 @@ func TestErrors(t *testing.T) {
|
||||
require.Error(err)
|
||||
apiErr = api.AsServerError(err)
|
||||
assert.NotNil(apiErr)
|
||||
assert.EqualValues(http.StatusNotFound, apiErr.ResponseStatus())
|
||||
assert.EqualValues(http.StatusNotFound, apiErr.Response().StatusCode())
|
||||
|
||||
_, err = pc.Read(tc.Context(), "invalid id")
|
||||
require.Error(err)
|
||||
apiErr = api.AsServerError(err)
|
||||
assert.NotNil(apiErr)
|
||||
assert.EqualValues(http.StatusBadRequest, apiErr.ResponseStatus())
|
||||
assert.EqualValues(http.StatusBadRequest, apiErr.Response().StatusCode())
|
||||
}
|
||||
@@ -126,7 +126,7 @@ func TestCrud(t *testing.T) {
|
||||
require.Error(err)
|
||||
apiErr := api.AsServerError(err)
|
||||
assert.NotNil(apiErr)
|
||||
assert.EqualValues(http.StatusNotFound, apiErr.ResponseStatus())
|
||||
assert.EqualValues(http.StatusNotFound, apiErr.Response().StatusCode())
|
||||
}
|
||||
|
||||
func TestErrors(t *testing.T) {
|
||||
@@ -154,7 +154,7 @@ func TestErrors(t *testing.T) {
|
||||
require.Error(err)
|
||||
apiErr := api.AsServerError(err)
|
||||
assert.NotNil(apiErr)
|
||||
assert.EqualValues(http.StatusNotFound, apiErr.ResponseStatus())
|
||||
assert.EqualValues(http.StatusNotFound, apiErr.Response().StatusCode())
|
||||
|
||||
_, err = hClient.Create(tc.Context(), hc.Item.Id, hosts.WithName("foo"), hosts.WithStaticHostAddress("someaddress"))
|
||||
require.Error(err)
|
||||
@@ -165,11 +165,11 @@ func TestErrors(t *testing.T) {
|
||||
require.Error(err)
|
||||
apiErr = api.AsServerError(err)
|
||||
assert.NotNil(apiErr)
|
||||
assert.EqualValues(http.StatusNotFound, apiErr.ResponseStatus())
|
||||
assert.EqualValues(http.StatusNotFound, apiErr.Response().StatusCode())
|
||||
|
||||
_, err = hClient.Read(tc.Context(), "invalid id")
|
||||
require.Error(err)
|
||||
apiErr = api.AsServerError(err)
|
||||
assert.NotNil(apiErr)
|
||||
assert.EqualValues(http.StatusBadRequest, apiErr.ResponseStatus())
|
||||
assert.EqualValues(http.StatusBadRequest, apiErr.Response().StatusCode())
|
||||
}
|
||||
@@ -163,7 +163,7 @@ func TestCrud(t *testing.T) {
|
||||
require.Error(err)
|
||||
apiErr := api.AsServerError(err)
|
||||
require.NotNil(apiErr)
|
||||
assert.EqualValues(http.StatusNotFound, apiErr.ResponseStatus())
|
||||
assert.EqualValues(http.StatusNotFound, apiErr.Response().StatusCode())
|
||||
}
|
||||
|
||||
// TODO: Get better coverage for expected errors and error formats.
|
||||
@@ -192,7 +192,7 @@ func TestErrors(t *testing.T) {
|
||||
require.Error(err)
|
||||
apiErr := api.AsServerError(err)
|
||||
assert.NotNil(apiErr)
|
||||
assert.EqualValues(http.StatusNotFound, apiErr.ResponseStatus())
|
||||
assert.EqualValues(http.StatusNotFound, apiErr.Response().StatusCode())
|
||||
|
||||
h, err = hClient.Create(tc.Context(), hc.Item.Id, hostsets.WithName("foo"))
|
||||
require.Error(err)
|
||||
@@ -204,11 +204,11 @@ func TestErrors(t *testing.T) {
|
||||
require.Error(err)
|
||||
apiErr = api.AsServerError(err)
|
||||
assert.NotNil(apiErr)
|
||||
assert.EqualValues(http.StatusNotFound, apiErr.ResponseStatus())
|
||||
assert.EqualValues(http.StatusNotFound, apiErr.Response().StatusCode())
|
||||
|
||||
_, err = hClient.Read(tc.Context(), "invalid id")
|
||||
require.Error(err)
|
||||
apiErr = api.AsServerError(err)
|
||||
assert.NotNil(apiErr)
|
||||
assert.EqualValues(http.StatusBadRequest, apiErr.ResponseStatus())
|
||||
assert.EqualValues(http.StatusBadRequest, apiErr.Response().StatusCode())
|
||||
}
|
||||
@@ -290,7 +290,7 @@ func TestErrors(t *testing.T) {
|
||||
require.Error(err)
|
||||
apiErr := api.AsServerError(err)
|
||||
assert.NotNil(apiErr)
|
||||
assert.EqualValues(http.StatusNotFound, apiErr.ResponseStatus())
|
||||
assert.EqualValues(http.StatusNotFound, apiErr.Response().StatusCode())
|
||||
|
||||
// Create another resource with the same name.
|
||||
_, err = roleClient.Create(tc.Context(), tt.scopeId, roles.WithName("first"))
|
||||
@@ -302,19 +302,19 @@ func TestErrors(t *testing.T) {
|
||||
require.Error(err)
|
||||
apiErr = api.AsServerError(err)
|
||||
assert.NotNil(apiErr)
|
||||
assert.EqualValues(http.StatusNotFound, apiErr.ResponseStatus())
|
||||
assert.EqualValues(http.StatusNotFound, apiErr.Response().StatusCode())
|
||||
|
||||
_, err = roleClient.Read(tc.Context(), "invalid id")
|
||||
require.Error(err)
|
||||
apiErr = api.AsServerError(err)
|
||||
assert.NotNil(apiErr)
|
||||
assert.EqualValues(http.StatusBadRequest, apiErr.ResponseStatus())
|
||||
assert.EqualValues(http.StatusBadRequest, apiErr.Response().StatusCode())
|
||||
|
||||
_, err = roleClient.Update(tc.Context(), u.Item.Id, u.Item.Version)
|
||||
require.Error(err)
|
||||
apiErr = api.AsServerError(err)
|
||||
assert.NotNil(apiErr)
|
||||
assert.EqualValues(http.StatusBadRequest, apiErr.ResponseStatus())
|
||||
assert.EqualValues(http.StatusBadRequest, apiErr.Response().StatusCode())
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -105,7 +105,7 @@ func TestCrud(t *testing.T) {
|
||||
require.Error(err)
|
||||
apiErr := api.AsServerError(err)
|
||||
assert.NotNil(apiErr)
|
||||
assert.EqualValues(http.StatusNotFound, apiErr.ResponseStatus())
|
||||
assert.EqualValues(http.StatusNotFound, apiErr.Response().StatusCode())
|
||||
}
|
||||
|
||||
func TestErrors(t *testing.T) {
|
||||
@@ -129,17 +129,17 @@ func TestErrors(t *testing.T) {
|
||||
require.Error(err)
|
||||
apiErr := api.AsServerError(err)
|
||||
assert.NotNil(apiErr)
|
||||
assert.EqualValues(http.StatusNotFound, apiErr.ResponseStatus())
|
||||
assert.EqualValues(http.StatusNotFound, apiErr.Response().StatusCode())
|
||||
|
||||
_, err = scps.Read(tc.Context(), "p_doesntexis")
|
||||
require.Error(err)
|
||||
apiErr = api.AsServerError(err)
|
||||
assert.NotNil(apiErr)
|
||||
assert.EqualValues(http.StatusNotFound, apiErr.ResponseStatus())
|
||||
assert.EqualValues(http.StatusNotFound, apiErr.Response().StatusCode())
|
||||
|
||||
_, err = scps.Read(tc.Context(), "invalid id")
|
||||
assert.Error(err)
|
||||
apiErr = api.AsServerError(err)
|
||||
assert.NotNil(apiErr)
|
||||
assert.EqualValues(http.StatusBadRequest, apiErr.ResponseStatus())
|
||||
assert.EqualValues(http.StatusBadRequest, apiErr.Response().StatusCode())
|
||||
}
|
||||
@@ -159,7 +159,7 @@ func TestCrud(t *testing.T) {
|
||||
assert.Error(err)
|
||||
apiErr := api.AsServerError(err)
|
||||
assert.NotNil(apiErr)
|
||||
assert.EqualValues(http.StatusNotFound, apiErr.ResponseStatus())
|
||||
assert.EqualValues(http.StatusNotFound, apiErr.Response().StatusCode())
|
||||
}
|
||||
|
||||
func TestSet_Errors(t *testing.T) {
|
||||
@@ -183,7 +183,7 @@ func TestSet_Errors(t *testing.T) {
|
||||
require.Error(err)
|
||||
apiErr := api.AsServerError(err)
|
||||
assert.NotNil(apiErr)
|
||||
assert.EqualValues(http.StatusNotFound, apiErr.ResponseStatus())
|
||||
assert.EqualValues(http.StatusNotFound, apiErr.Response().StatusCode())
|
||||
|
||||
tar, err = tarClient.Create(tc.Context(), "tcp", proj.GetPublicId(), targets.WithName("foo"))
|
||||
require.Error(err)
|
||||
@@ -195,11 +195,11 @@ func TestSet_Errors(t *testing.T) {
|
||||
require.Error(err)
|
||||
apiErr = api.AsServerError(err)
|
||||
assert.NotNil(apiErr)
|
||||
assert.EqualValues(http.StatusNotFound, apiErr.ResponseStatus())
|
||||
assert.EqualValues(http.StatusNotFound, apiErr.Response().StatusCode())
|
||||
|
||||
_, err = tarClient.Read(tc.Context(), "invalid id")
|
||||
require.Error(err)
|
||||
apiErr = api.AsServerError(err)
|
||||
assert.NotNil(apiErr)
|
||||
assert.EqualValues(http.StatusBadRequest, apiErr.ResponseStatus())
|
||||
assert.EqualValues(http.StatusBadRequest, apiErr.Response().StatusCode())
|
||||
}
|
||||
@@ -155,7 +155,7 @@ func TestCrud(t *testing.T) {
|
||||
require.Error(err)
|
||||
apiErr := api.AsServerError(err)
|
||||
assert.NotNil(apiErr)
|
||||
assert.EqualValues(http.StatusNotFound, apiErr.ResponseStatus())
|
||||
assert.EqualValues(http.StatusNotFound, apiErr.Response().StatusCode())
|
||||
}
|
||||
|
||||
func TestErrors(t *testing.T) {
|
||||
@@ -178,7 +178,7 @@ func TestErrors(t *testing.T) {
|
||||
require.Error(err)
|
||||
apiErr := api.AsServerError(err)
|
||||
assert.NotNil(apiErr)
|
||||
assert.EqualValues(http.StatusNotFound, apiErr.ResponseStatus())
|
||||
assert.EqualValues(http.StatusNotFound, apiErr.Response().StatusCode())
|
||||
|
||||
// Create another resource with the same name.
|
||||
_, err = userClient.Create(tc.Context(), org.GetPublicId(), users.WithName("first"))
|
||||
@@ -190,17 +190,17 @@ func TestErrors(t *testing.T) {
|
||||
require.Error(err)
|
||||
apiErr = api.AsServerError(err)
|
||||
assert.NotNil(apiErr)
|
||||
assert.EqualValues(http.StatusNotFound, apiErr.ResponseStatus())
|
||||
assert.EqualValues(http.StatusNotFound, apiErr.Response().StatusCode())
|
||||
|
||||
_, err = userClient.Read(tc.Context(), "invalid id")
|
||||
require.Error(err)
|
||||
apiErr = api.AsServerError(err)
|
||||
assert.NotNil(apiErr)
|
||||
assert.EqualValues(http.StatusBadRequest, apiErr.ResponseStatus())
|
||||
assert.EqualValues(http.StatusBadRequest, apiErr.Response().StatusCode())
|
||||
|
||||
_, err = userClient.Update(tc.Context(), u.Item.Id, u.Item.Version)
|
||||
require.Error(err)
|
||||
apiErr = api.AsServerError(err)
|
||||
assert.NotNil(apiErr)
|
||||
assert.EqualValues(http.StatusBadRequest, apiErr.ResponseStatus())
|
||||
assert.EqualValues(http.StatusBadRequest, apiErr.Response().StatusCode())
|
||||
}
|
||||
@@ -16,5 +16,5 @@ function list_accounts() {
|
||||
|
||||
function account_id() {
|
||||
local acct=$1
|
||||
strip $(list_accounts | jq -c ".[] | select(.attributes.login_name | contains(\"$acct\")) | .[\"id\"]")
|
||||
strip $(list_accounts | jq -c ".items[] | select(.attributes.login_name | contains(\"$acct\")) | .[\"id\"]")
|
||||
}
|
||||
@@ -4,5 +4,5 @@ function has_authorized_action() {
|
||||
# has_authorized_action $out authorize-session
|
||||
local out=$1
|
||||
local action=$2
|
||||
echo $out | jq -c ".authorized_actions | contains([\"$action\"])"
|
||||
echo $out | jq -c ".item.authorized_actions | contains([\"$action\"])"
|
||||
}
|
||||
@@ -22,12 +22,12 @@ function assoc_group_acct() {
|
||||
|
||||
function group_id() {
|
||||
local group=$1
|
||||
strip $(list_groups | jq -c ".[] | select(.name | contains(\"$group\")) | .[\"id\"]")
|
||||
strip $(list_groups | jq -c ".items[] | select(.name | contains(\"$group\")) | .[\"id\"]")
|
||||
}
|
||||
|
||||
function group_member_ids() {
|
||||
local gid=$1
|
||||
boundary groups read -id $gid -format json | jq '.["members"][]["id"]'
|
||||
boundary groups read -id $gid -format json | jq '.item["members"][]["id"]'
|
||||
}
|
||||
|
||||
function group_has_member_id() {
|
||||
|
||||
@@ -25,7 +25,7 @@ function list_host_catalogs() {
|
||||
function host_catalog_id() {
|
||||
local id=$1
|
||||
local sid=$2
|
||||
strip $(list_host_catalogs $sid | jq -c ".[] | select(.name | contains(\"$id\")) | .[\"id\"]")
|
||||
strip $(list_host_catalogs $sid | jq -c ".items[] | select(.name | contains(\"$id\")) | .[\"id\"]")
|
||||
}
|
||||
|
||||
function has_default_host_catalog_actions() {
|
||||
|
||||
@@ -28,12 +28,12 @@ function assoc_host_set_host() {
|
||||
function host_set_id() {
|
||||
local name=$1
|
||||
local hcid=$2
|
||||
strip $(list_host_sets $hcid | jq -c ".[] | select(.name | contains(\"$name\")) | .[\"id\"]")
|
||||
strip $(list_host_sets $hcid | jq -c ".items[] | select(.name | contains(\"$name\")) | .[\"id\"]")
|
||||
}
|
||||
|
||||
function host_set_host_ids() {
|
||||
local id=$1
|
||||
ids=$(read_host_set $id | jq '.["host_ids"]')
|
||||
ids=$(read_host_set $id | jq '.item["host_ids"]')
|
||||
echo "ids $ids"
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ function host_id() {
|
||||
local name=$1
|
||||
local hcid=$2
|
||||
|
||||
strip $(list_hosts $hcid | jq -c ".[] | select(.name | contains(\"$name\")) | .[\"id\"]")
|
||||
strip $(list_hosts $hcid | jq -c ".items[] | select(.name | contains(\"$name\")) | .[\"id\"]")
|
||||
}
|
||||
|
||||
function has_default_host_actions() {
|
||||
|
||||
@@ -55,12 +55,12 @@ function remove_role_principal() {
|
||||
function role_id() {
|
||||
local name=$1
|
||||
local sid=$2
|
||||
strip $(list_roles $sid | jq -c ".[] | select(.name | contains(\"$name\")) | .[\"id\"]")
|
||||
strip $(list_roles $sid | jq -c ".items[] | select(.name | contains(\"$name\")) | .[\"id\"]")
|
||||
}
|
||||
|
||||
function role_principal_ids() {
|
||||
local rid=$1
|
||||
strip $(read_role $rid | jq '.["principals"][]["id"]')
|
||||
strip $(read_role $rid | jq '.item["principals"][]["id"]')
|
||||
}
|
||||
|
||||
function role_has_principal_id() {
|
||||
@@ -77,7 +77,7 @@ function role_has_principal_id() {
|
||||
|
||||
function role_grants() {
|
||||
local rid=$1
|
||||
read_role $rid | jq -rc '.grant_strings | @sh'
|
||||
read_role $rid | jq -rc '.item.grant_strings | @sh'
|
||||
}
|
||||
|
||||
function role_has_grant() {
|
||||
|
||||
@@ -27,7 +27,7 @@ function scope_id() {
|
||||
local name=$1
|
||||
local sid=$2
|
||||
|
||||
strip $(list_scopes $sid | jq -c ".[] | select(.name | contains(\"$name\")) | .[\"id\"]")
|
||||
strip $(list_scopes $sid | jq -c ".items[] | select(.name | contains(\"$name\")) | .[\"id\"]")
|
||||
}
|
||||
|
||||
function has_default_scope_actions() {
|
||||
|
||||
@@ -5,7 +5,7 @@ function list_sessions() {
|
||||
}
|
||||
|
||||
function count_sessions() {
|
||||
list_sessions $1 | jq '. | length'
|
||||
list_sessions $1 | jq '.items | length'
|
||||
}
|
||||
|
||||
function cancel_session() {
|
||||
@@ -14,4 +14,4 @@ function cancel_session() {
|
||||
|
||||
function read_session() {
|
||||
boundary sessions read -id $1
|
||||
}
|
||||
}
|
||||
@@ -34,12 +34,12 @@ function assoc_host_sets() {
|
||||
function target_id_from_name() {
|
||||
local sid=$1
|
||||
local name=$2
|
||||
strip $(list_targets $sid | jq -c ".[] | select(.name | contains(\"$name\")) | .[\"id\"]")
|
||||
strip $(list_targets $sid | jq -c ".items[] | select(.name | contains(\"$name\")) | .[\"id\"]")
|
||||
}
|
||||
|
||||
function target_host_set_ids() {
|
||||
local tid=$1
|
||||
boundary targets read -id $tid -format json | jq '.host_sets[].id'
|
||||
boundary targets read -id $tid -format json | jq '.item.host_sets[].id'
|
||||
}
|
||||
|
||||
function target_has_host_set_id() {
|
||||
|
||||
@@ -35,5 +35,5 @@ function has_default_user_actions() {
|
||||
|
||||
function user_id() {
|
||||
local user=$1
|
||||
strip $(list_users | jq -c ".[] | select(.name | contains(\"$user\")) | .[\"id\"]")
|
||||
strip $(list_users | jq -c ".items[] | select(.name | contains(\"$user\")) | .[\"id\"]")
|
||||
}
|
||||
@@ -59,7 +59,7 @@ load _helpers
|
||||
[ "$status" -eq 0 ]
|
||||
run list_sessions $DEFAULT_P_ID
|
||||
[ "$status" -eq 0 ]
|
||||
id=$(echo "$output" | jq -r '[.[]|select(.user_id == "u_1234567890")][0].id')
|
||||
id=$(echo "$output" | jq -r '[.items[]|select(.user_id == "u_1234567890")][0].id')
|
||||
|
||||
# Check unpriv cannot read or cancel an admin's session
|
||||
run login $DEFAULT_UNPRIVILEGED_LOGIN
|
||||
@@ -86,7 +86,7 @@ load _helpers
|
||||
[ "$status" -eq 0 ]
|
||||
run list_sessions $DEFAULT_P_ID
|
||||
[ "$status" -eq 0 ]
|
||||
id=$(echo "$output" | jq -r '[.[]|select(.user_id == "u_0987654321")][0].id')
|
||||
id=$(echo "$output" | jq -r '[.items[]|select(.user_id == "u_0987654321")][0].id')
|
||||
|
||||
# Check unpriv can read and cancel their own session
|
||||
run login $DEFAULT_UNPRIVILEGED_LOGIN
|
||||
|
||||
Reference in new issue
Block a user