Rename root, api and sdk module paths (imports, go.mod, go_package, ldflags, build scripts, buf configs) and regenerate protobuf/gateway code with the project's pinned toolchain. Wire identifiers unchanged. api gets a local replace for sdk; root/api/sdk require v0.1.0. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
37 lines
1.0 KiB
Go
37 lines
1.0 KiB
Go
// Copyright IBM Corp. 2020, 2026
|
|
// SPDX-License-Identifier: BUSL-1.1
|
|
|
|
package boundary
|
|
|
|
import (
|
|
"context"
|
|
"encoding/json"
|
|
"fmt"
|
|
"testing"
|
|
|
|
"repo.anhonesthost.net/CyberCoveLLC/threshold/api/authtokens"
|
|
"repo.anhonesthost.net/CyberCoveLLC/threshold/testing/internal/e2e"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
// GetAuthenticationTokenIdByTokenNameCli uses the CLI to get an auth-token ID by its name
|
|
// The operation is performed by the user associated with the auth-token
|
|
func GetAuthenticationTokenIdByTokenNameCli(t testing.TB, ctx context.Context, tokenName string) string {
|
|
output := e2e.RunCommand(ctx, "boundary",
|
|
e2e.WithArgs(
|
|
"auth-tokens", "list",
|
|
"-token-name", tokenName,
|
|
"-format", "json",
|
|
),
|
|
)
|
|
require.NoError(t, output.Err, string(output.Stderr))
|
|
|
|
var authTokenListResult authtokens.AuthTokenListResult
|
|
err := json.Unmarshal(output.Stdout, &authTokenListResult)
|
|
require.NoError(t, err)
|
|
userAuthTokenID := fmt.Sprint(authTokenListResult.Items[0].Id)
|
|
t.Logf("Retrieved Auth-Token: %s", userAuthTokenID)
|
|
|
|
return userAuthTokenID
|
|
}
|