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
990 B
Go
37 lines
990 B
Go
// Copyright IBM Corp. 2020, 2026
|
|
// SPDX-License-Identifier: BUSL-1.1
|
|
|
|
package boundary
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
"testing"
|
|
|
|
"repo.anhonesthost.net/CyberCoveLLC/threshold/api"
|
|
"repo.anhonesthost.net/CyberCoveLLC/threshold/api/managedgroups"
|
|
"github.com/hashicorp/go-secure-stdlib/base62"
|
|
)
|
|
|
|
// CreateManagedGroupApi creates a new managed group using the Go api.
|
|
// Returns the id of the new managed group.
|
|
func CreateManagedGroupApi(t testing.TB, ctx context.Context, client *api.Client, amId string) (string, error) {
|
|
name, err := base62.Random(16)
|
|
if err != nil {
|
|
return "", err
|
|
}
|
|
|
|
mgClient := managedgroups.NewClient(client)
|
|
newMGResult, err := mgClient.Create(ctx, amId,
|
|
managedgroups.WithOidcManagedGroupFilter(`"/token/zip" == "zap"`),
|
|
managedgroups.WithName(fmt.Sprintf("e2e Managed Group %s", name)),
|
|
)
|
|
if err != nil {
|
|
return "", err
|
|
}
|
|
|
|
managedGroupId := newMGResult.Item.Id
|
|
t.Logf("Created Managed Group: %s", managedGroupId)
|
|
return managedGroupId, nil
|
|
}
|