feat: workers filtered by sbc state
This commit is contained in:
1 parent
130010a2ca
commit
00e4c5448b
11 files changed
+71
-43
No files matched your search
@@ -12,7 +12,6 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/hashicorp/boundary/globals"
|
||||
wl "github.com/hashicorp/boundary/internal/daemon/common"
|
||||
"github.com/hashicorp/boundary/internal/daemon/controller/auth"
|
||||
"github.com/hashicorp/boundary/internal/daemon/controller/common"
|
||||
"github.com/hashicorp/boundary/internal/daemon/controller/common/scopeids"
|
||||
@@ -331,7 +330,7 @@ func (s Service) DeleteWorker(ctx context.Context, req *pbs.DeleteWorkerRequest)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if wl.IsManagedWorker(w) {
|
||||
if server.IsManagedWorker(w) {
|
||||
return nil, handlers.InvalidArgumentErrorf("Error in provided request.", map[string]string{"id": "Managed workers cannot be deleted."})
|
||||
}
|
||||
|
||||
@@ -368,7 +367,7 @@ func (s Service) UpdateWorker(ctx context.Context, req *pbs.UpdateWorkerRequest)
|
||||
// generated from the scope and name, it's functionally equivalent to
|
||||
// checking the type, but works for both KMS-PKI and old-style KMS workers.
|
||||
switch {
|
||||
case wl.IsManagedWorker(w):
|
||||
case server.IsManagedWorker(w):
|
||||
return nil, handlers.InvalidArgumentErrorf(
|
||||
"Error in provided request.",
|
||||
map[string]string{"id": "Managed workers cannot be updated."},
|
||||
@@ -879,7 +878,7 @@ func (s Service) toProto(ctx context.Context, in *server.Worker, opt ...handlers
|
||||
}
|
||||
}
|
||||
// Managed workers cannot be deleted
|
||||
if wl.IsManagedWorker(in) {
|
||||
if server.IsManagedWorker(in) {
|
||||
allActions := out.AuthorizedActions
|
||||
out.AuthorizedActions = make([]string, 0, len(allActions))
|
||||
for _, act := range allActions {
|
||||
@@ -1069,7 +1068,7 @@ func validateStringForDb(str string) string {
|
||||
return "must be non-empty."
|
||||
case len(str) > 512:
|
||||
return "must be within 512 characters."
|
||||
case str == wl.ManagedWorkerTag:
|
||||
case str == server.ManagedWorkerTag:
|
||||
return "cannot be the managed worker tag."
|
||||
default:
|
||||
return ""
|
||||
|
||||
@@ -13,7 +13,6 @@ import (
|
||||
"github.com/google/go-cmp/cmp"
|
||||
"github.com/google/go-cmp/cmp/cmpopts"
|
||||
"github.com/hashicorp/boundary/globals"
|
||||
wl "github.com/hashicorp/boundary/internal/daemon/common"
|
||||
"github.com/hashicorp/boundary/internal/daemon/controller/auth"
|
||||
"github.com/hashicorp/boundary/internal/daemon/controller/common"
|
||||
"github.com/hashicorp/boundary/internal/daemon/controller/handlers"
|
||||
@@ -205,7 +204,7 @@ func TestGet(t *testing.T) {
|
||||
server.WithAddress("test managed pki worker address"),
|
||||
server.WithLocalStorageState(server.AvailableLocalStorageState.String()),
|
||||
server.WithWorkerTags(&server.Tag{
|
||||
Key: wl.ManagedWorkerTag,
|
||||
Key: server.ManagedWorkerTag,
|
||||
Value: "true",
|
||||
})),
|
||||
server.WithUpdateTags(true),
|
||||
@@ -233,10 +232,10 @@ func TestGet(t *testing.T) {
|
||||
LastStatusTime: managedPkiWorker.GetLastStatusTime().GetTimestamp(),
|
||||
ReleaseVersion: managedPkiWorker.ReleaseVersion,
|
||||
CanonicalTags: map[string]*structpb.ListValue{
|
||||
wl.ManagedWorkerTag: structListValue(t, "true"),
|
||||
server.ManagedWorkerTag: structListValue(t, "true"),
|
||||
},
|
||||
ConfigTags: map[string]*structpb.ListValue{
|
||||
wl.ManagedWorkerTag: structListValue(t, "true"),
|
||||
server.ManagedWorkerTag: structListValue(t, "true"),
|
||||
},
|
||||
Type: PkiWorkerType,
|
||||
DirectlyConnectedDownstreamWorkers: connectedDownstreams,
|
||||
@@ -499,7 +498,7 @@ func TestDelete(t *testing.T) {
|
||||
Value: "bar",
|
||||
}))
|
||||
wManaged := server.TestKmsWorker(t, conn, wrap, server.WithWorkerTags(&server.Tag{
|
||||
Key: wl.ManagedWorkerTag,
|
||||
Key: server.ManagedWorkerTag,
|
||||
Value: "bar",
|
||||
}))
|
||||
|
||||
@@ -2059,7 +2058,7 @@ func TestService_AddWorkerTags(t *testing.T) {
|
||||
return &pbs.AddWorkerTagsRequest{
|
||||
Id: worker.PublicId,
|
||||
Version: worker.Version,
|
||||
ApiTags: map[string]*structpb.ListValue{wl.ManagedWorkerTag: {Values: []*structpb.Value{structpb.NewStringValue("value2")}}},
|
||||
ApiTags: map[string]*structpb.ListValue{server.ManagedWorkerTag: {Values: []*structpb.Value{structpb.NewStringValue("value2")}}},
|
||||
}
|
||||
}(),
|
||||
wantErrContains: "Tag keys cannot be the managed worker tag.",
|
||||
@@ -2222,7 +2221,7 @@ func TestService_SetWorkerTags(t *testing.T) {
|
||||
return &pbs.SetWorkerTagsRequest{
|
||||
Id: worker.PublicId,
|
||||
Version: worker.Version,
|
||||
ApiTags: map[string]*structpb.ListValue{wl.ManagedWorkerTag: {Values: []*structpb.Value{structpb.NewStringValue("value2")}}},
|
||||
ApiTags: map[string]*structpb.ListValue{server.ManagedWorkerTag: {Values: []*structpb.Value{structpb.NewStringValue("value2")}}},
|
||||
}
|
||||
}(),
|
||||
wantErrContains: "Tag keys cannot be the managed worker tag.",
|
||||
|
||||
Reference in new issue
Block a user