merged commit for plugin rework, storage bucket sql and proto, storage bucket secret rewrapping, storage bucket repository

This commit is contained in:
Danielle Miu authored and Timothy Messier committed 2023-05-31 12:18:13 +00:00
1 parent 38723f8112
commit a4a14fc7fc
66 files changed
+2332 -980

No files matched your search

@@ -14,13 +14,13 @@ import (
"github.com/hashicorp/boundary/internal/errors"
pbs "github.com/hashicorp/boundary/internal/gen/controller/api/services"
"github.com/hashicorp/boundary/internal/host"
"github.com/hashicorp/boundary/internal/host/plugin"
hostplugin "github.com/hashicorp/boundary/internal/host/plugin"
plugstore "github.com/hashicorp/boundary/internal/host/plugin/store"
"github.com/hashicorp/boundary/internal/host/static"
staticstore "github.com/hashicorp/boundary/internal/host/static/store"
"github.com/hashicorp/boundary/internal/libs/endpoint"
"github.com/hashicorp/boundary/internal/perms"
hostplugin "github.com/hashicorp/boundary/internal/plugin/host"
"github.com/hashicorp/boundary/internal/plugin"
"github.com/hashicorp/boundary/internal/requests"
"github.com/hashicorp/boundary/internal/types/action"
"github.com/hashicorp/boundary/internal/types/resource"
@@ -49,7 +49,7 @@ var (
action.SetHosts,
action.RemoveHosts,
},
plugin.Subtype: {
hostplugin.Subtype: {
action.NoOp,
action.Read,
action.Update,
@@ -72,7 +72,7 @@ func init() {
if maskManager[static.Subtype], err = handlers.NewMaskManager(handlers.MaskDestination{&staticstore.HostSet{}, &staticstore.UnimplementedSetFields{}}, handlers.MaskSource{&pb.HostSet{}}); err != nil {
panic(err)
}
if maskManager[plugin.Subtype], err = handlers.NewMaskManager(handlers.MaskDestination{&plugstore.HostSet{}}, handlers.MaskSource{&pb.HostSet{}}); err != nil {
if maskManager[hostplugin.Subtype], err = handlers.NewMaskManager(handlers.MaskDestination{&plugstore.HostSet{}}, handlers.MaskSource{&pb.HostSet{}}); err != nil {
panic(err)
}
}
@@ -94,7 +94,7 @@ func NewService(staticRepoFn common.StaticRepoFactory, pluginRepoFn common.Plugi
return Service{}, errors.NewDeprecated(errors.InvalidParameter, op, "missing static repository")
}
if pluginRepoFn == nil {
return Service{}, errors.NewDeprecated(errors.InvalidParameter, op, "missing plugin repository")
return Service{}, errors.NewDeprecated(errors.InvalidParameter, op, "missing hostplugin repository")
}
return Service{staticRepoFn: staticRepoFn, pluginRepoFn: pluginRepoFn}, nil
}
@@ -451,7 +451,7 @@ func (s Service) getFromRepo(ctx context.Context, id string) (host.Set, []host.H
hl = append(hl, h)
}
hs = hset
case plugin.Subtype:
case hostplugin.Subtype:
repo, err := s.pluginRepoFn()
if err != nil {
return nil, nil, nil, err
@@ -466,7 +466,7 @@ func (s Service) getFromRepo(ctx context.Context, id string) (host.Set, []host.H
hs = hset
plg = toPluginInfo(hsplg)
for _, h := range hset.HostIds {
hl = append(hl, &plugin.Host{
hl = append(hl, &hostplugin.Host{
Host: &plugstore.Host{
PublicId: h,
CatalogId: hset.CatalogId,
@@ -502,7 +502,7 @@ func (s Service) createInRepo(ctx context.Context, projectId, catalogId string,
return nil, nil, handlers.ApiErrorWithCodeAndMessage(codes.Internal, "Unable to create host set but no error returned from repository.")
}
hSet = out
case plugin.Subtype:
case hostplugin.Subtype:
h, err := toStoragePluginSet(ctx, catalogId, item)
if err != nil {
return nil, nil, err
@@ -564,7 +564,7 @@ func (s Service) updatePluginInRepo(ctx context.Context, projectId string, req *
return nil, nil, nil, errors.Wrap(ctx, err, op, errors.WithMsg("Unable to build host set for update"))
}
h.PublicId = req.GetId()
dbMask := maskManager[plugin.Subtype].Translate(req.GetUpdateMask().GetPaths(), "attributes")
dbMask := maskManager[hostplugin.Subtype].Translate(req.GetUpdateMask().GetPaths(), "attributes")
if len(dbMask) == 0 {
return nil, nil, nil, handlers.InvalidArgumentErrorf("No valid fields included in the update mask.", map[string]string{"update_mask": "No valid fields provided in the update mask."})
}
@@ -591,7 +591,7 @@ func (s Service) updateInRepo(ctx context.Context, projectId, catalogId string,
switch subtypes.SubtypeFromId(domain, req.GetId()) {
case static.Subtype:
hs, hosts, err = s.updateStaticInRepo(ctx, projectId, catalogId, req)
case plugin.Subtype:
case hostplugin.Subtype:
hs, hosts, plg, err = s.updatePluginInRepo(ctx, projectId, req)
}
return
@@ -610,7 +610,7 @@ func (s Service) deleteFromRepo(ctx context.Context, projectId, id string) (bool
if err != nil {
return false, errors.Wrap(ctx, err, op, errors.WithMsg("unable to delete host"))
}
case plugin.Subtype:
case hostplugin.Subtype:
repo, err := s.pluginRepoFn()
if err != nil {
return false, err
@@ -640,7 +640,7 @@ func (s Service) listFromRepo(ctx context.Context, catalogId string, opt ...host
for _, a := range sl {
sets = append(sets, a)
}
case plugin.Subtype:
case hostplugin.Subtype:
repo, err := s.pluginRepoFn()
if err != nil {
return nil, nil, err
@@ -763,7 +763,7 @@ func (s Service) parentAndAuthResult(ctx context.Context, id string, a action.Ty
return nil, res
}
set = ss
case plugin.Subtype:
case hostplugin.Subtype:
ps, _, err := pluginRepo.LookupSet(ctx, id)
if err != nil {
res.Error = err
@@ -792,7 +792,7 @@ func (s Service) parentAndAuthResult(ctx context.Context, id string, a action.Ty
return nil, res
}
cat = cs
case plugin.Subtype:
case hostplugin.Subtype:
pc, _, err := pluginRepo.LookupCatalog(ctx, parentId)
if err != nil {
res.Error = err
@@ -808,7 +808,7 @@ func (s Service) parentAndAuthResult(ctx context.Context, id string, a action.Ty
return cat, auth.Verify(ctx, opts...)
}
func toPluginInfo(plg *hostplugin.Plugin) *plugins.PluginInfo {
func toPluginInfo(plg *plugin.Plugin) *plugins.PluginInfo {
if plg == nil {
return nil
}
@@ -838,8 +838,8 @@ func toProto(ctx context.Context, in host.Set, hosts []host.Host, opt ...handler
switch in.(type) {
case *static.HostSet:
out.Type = static.Subtype.String()
case *plugin.HostSet:
out.Type = plugin.Subtype.String()
case *hostplugin.HostSet:
out.Type = hostplugin.Subtype.String()
}
}
if outputFields.Has(globals.DescriptionField) && in.GetDescription() != "" {
@@ -873,7 +873,7 @@ func toProto(ctx context.Context, in host.Set, hosts []host.Host, opt ...handler
}
switch h := in.(type) {
case *plugin.HostSet:
case *hostplugin.HostSet:
if outputFields.Has(globals.PreferredEndpointsField) {
out.PreferredEndpoints = h.PreferredEndpoints
}
@@ -913,25 +913,25 @@ func toStorageStaticSet(ctx context.Context, catalogId string, item *pb.HostSet)
return hs, nil
}
func toStoragePluginSet(ctx context.Context, catalogId string, item *pb.HostSet) (*plugin.HostSet, error) {
func toStoragePluginSet(ctx context.Context, catalogId string, item *pb.HostSet) (*hostplugin.HostSet, error) {
const op = "host_set_service.toStoragePluginSet"
var opts []plugin.Option
var opts []hostplugin.Option
if item.GetName() != nil {
opts = append(opts, plugin.WithName(item.GetName().GetValue()))
opts = append(opts, hostplugin.WithName(item.GetName().GetValue()))
}
if item.GetDescription() != nil {
opts = append(opts, plugin.WithDescription(item.GetDescription().GetValue()))
opts = append(opts, hostplugin.WithDescription(item.GetDescription().GetValue()))
}
if item.GetAttributes() != nil {
opts = append(opts, plugin.WithAttributes(item.GetAttributes()))
opts = append(opts, hostplugin.WithAttributes(item.GetAttributes()))
}
if item.GetPreferredEndpoints() != nil {
opts = append(opts, plugin.WithPreferredEndpoints(item.GetPreferredEndpoints()))
opts = append(opts, hostplugin.WithPreferredEndpoints(item.GetPreferredEndpoints()))
}
if item.GetSyncIntervalSeconds() != nil {
opts = append(opts, plugin.WithSyncIntervalSeconds(item.GetSyncIntervalSeconds().GetValue()))
opts = append(opts, hostplugin.WithSyncIntervalSeconds(item.GetSyncIntervalSeconds().GetValue()))
}
hs, err := plugin.NewHostSet(ctx, catalogId, opts...)
hs, err := hostplugin.NewHostSet(ctx, catalogId, opts...)
if err != nil {
return nil, errors.Wrap(ctx, err, op, errors.WithMsg("Unable to build host set for creation"))
}
@@ -969,8 +969,8 @@ func validateCreateRequest(ctx context.Context, req *pbs.CreateHostSetRequest) e
if len(req.GetItem().PreferredEndpoints) > 0 {
badFields[globals.PreferredEndpointsField] = "This field is not yet supported for static host sets."
}
case plugin.Subtype:
if req.GetItem().GetType() != "" && req.GetItem().GetType() != plugin.Subtype.String() {
case hostplugin.Subtype:
if req.GetItem().GetType() != "" && req.GetItem().GetType() != hostplugin.Subtype.String() {
badFields[globals.TypeField] = "Doesn't match the parent resource's type."
}
if val := req.GetItem().GetSyncIntervalSeconds(); val != nil {
@@ -997,7 +997,7 @@ func validateUpdateRequest(ctx context.Context, req *pbs.UpdateHostSetRequest) e
if req.GetItem().GetType() != "" && req.GetItem().GetType() != static.Subtype.String() {
badFields[globals.TypeField] = "Cannot modify the resource type."
}
case plugin.Subtype:
case hostplugin.Subtype:
if val := req.GetItem().GetSyncIntervalSeconds(); val != nil {
if val.GetValue() == 0 || val.GetValue() < -1 {
badFields[globals.SyncIntervalSecondsField] = "Must be -1 or a positive integer."
@@ -20,11 +20,11 @@ import (
"github.com/hashicorp/boundary/internal/db"
pbs "github.com/hashicorp/boundary/internal/gen/controller/api/services"
"github.com/hashicorp/boundary/internal/host"
"github.com/hashicorp/boundary/internal/host/plugin"
hostplugin "github.com/hashicorp/boundary/internal/host/plugin"
"github.com/hashicorp/boundary/internal/host/static"
"github.com/hashicorp/boundary/internal/iam"
"github.com/hashicorp/boundary/internal/kms"
hostplugin "github.com/hashicorp/boundary/internal/plugin/host"
"github.com/hashicorp/boundary/internal/plugin"
"github.com/hashicorp/boundary/internal/plugin/loopback"
"github.com/hashicorp/boundary/internal/scheduler"
"github.com/hashicorp/boundary/internal/types/scope"
@@ -46,8 +46,8 @@ import (
)
var testAuthorizedActions = map[subtypes.Subtype][]string{
static.Subtype: {"no-op", "read", "update", "delete", "add-hosts", "set-hosts", "remove-hosts"},
plugin.Subtype: {"no-op", "read", "update", "delete"},
static.Subtype: {"no-op", "read", "update", "delete", "add-hosts", "set-hosts", "remove-hosts"},
hostplugin.Subtype: {"no-op", "read", "update", "delete"},
}
func TestGet_Static(t *testing.T) {
@@ -68,8 +68,8 @@ func TestGet_Static(t *testing.T) {
repoFn := func() (*static.Repository, error) {
return static.NewRepository(rw, rw, kms)
}
pluginRepoFn := func() (*plugin.Repository, error) {
return plugin.NewRepository(rw, rw, kms, sche, map[string]plgpb.HostPluginServiceClient{})
pluginRepoFn := func() (*hostplugin.Repository, error) {
return hostplugin.NewRepository(rw, rw, kms, sche, map[string]plgpb.HostPluginServiceClient{})
}
hc := static.TestCatalogs(t, conn, proj.GetPublicId(), 1)[0]
hs := static.TestSets(t, conn, hc.GetPublicId(), 1)[0]
@@ -165,17 +165,17 @@ func TestGet_Plugin(t *testing.T) {
name := "test"
prefEndpoints := []string{"cidr:1.2.3.4", "cidr:2.3.4.5/24"}
plg := hostplugin.TestPlugin(t, conn, name)
plg := plugin.TestPlugin(t, conn, name)
plgm := map[string]plgpb.HostPluginServiceClient{
plg.GetPublicId(): loopback.NewWrappingPluginHostClient(&loopback.TestPluginServer{}),
}
pluginRepoFn := func() (*plugin.Repository, error) {
return plugin.NewRepository(rw, rw, kms, sche, plgm)
pluginRepoFn := func() (*hostplugin.Repository, error) {
return hostplugin.NewRepository(rw, rw, kms, sche, plgm)
}
hc := plugin.TestCatalog(t, conn, proj.GetPublicId(), plg.GetPublicId())
hs := plugin.TestSet(t, conn, kms, sche, hc, plgm, plugin.WithPreferredEndpoints(prefEndpoints), plugin.WithSyncIntervalSeconds(-1))
hsPrev := plugin.TestSet(t, conn, kms, sche, hc, plgm, plugin.WithPreferredEndpoints(prefEndpoints), plugin.WithSyncIntervalSeconds(-1), plugin.WithPublicId(fmt.Sprintf("%s_1234567890", globals.PluginHostSetPreviousPrefix)))
hc := hostplugin.TestCatalog(t, conn, proj.GetPublicId(), plg.GetPublicId())
hs := hostplugin.TestSet(t, conn, kms, sche, hc, plgm, hostplugin.WithPreferredEndpoints(prefEndpoints), hostplugin.WithSyncIntervalSeconds(-1))
hsPrev := hostplugin.TestSet(t, conn, kms, sche, hc, plgm, hostplugin.WithPreferredEndpoints(prefEndpoints), hostplugin.WithSyncIntervalSeconds(-1), hostplugin.WithPublicId(fmt.Sprintf("%s_1234567890", globals.PluginHostSetPreviousPrefix)))
toMerge := &pbs.GetHostSetRequest{}
@@ -184,7 +184,7 @@ func TestGet_Plugin(t *testing.T) {
Id: hs.GetPublicId(),
CreatedTime: hs.CreateTime.GetTimestamp(),
UpdatedTime: hs.UpdateTime.GetTimestamp(),
Type: plugin.Subtype.String(),
Type: hostplugin.Subtype.String(),
Scope: &scopes.ScopeInfo{Id: proj.GetPublicId(), Type: scope.Project.String(), ParentScopeId: org.GetPublicId()},
Plugin: &plugins.PluginInfo{
Id: plg.GetPublicId(),
@@ -193,7 +193,7 @@ func TestGet_Plugin(t *testing.T) {
},
PreferredEndpoints: prefEndpoints,
SyncIntervalSeconds: &wrappers.Int32Value{Value: -1},
AuthorizedActions: testAuthorizedActions[plugin.Subtype],
AuthorizedActions: testAuthorizedActions[hostplugin.Subtype],
}
cases := []struct {
@@ -279,8 +279,8 @@ func TestList_Static(t *testing.T) {
repoFn := func() (*static.Repository, error) {
return static.NewRepository(rw, rw, kms)
}
pluginRepoFn := func() (*plugin.Repository, error) {
return plugin.NewRepository(rw, rw, kms, sche, map[string]plgpb.HostPluginServiceClient{})
pluginRepoFn := func() (*hostplugin.Repository, error) {
return hostplugin.NewRepository(rw, rw, kms, sche, map[string]plgpb.HostPluginServiceClient{})
}
hcs := static.TestCatalogs(t, conn, proj.GetPublicId(), 2)
hc, hcNoHosts := hcs[0], hcs[1]
@@ -379,20 +379,20 @@ func TestList_Plugin(t *testing.T) {
return static.NewRepository(rw, rw, kms)
}
name := "test"
plg := hostplugin.TestPlugin(t, conn, name)
plg := plugin.TestPlugin(t, conn, name)
plgm := map[string]plgpb.HostPluginServiceClient{
plg.GetPublicId(): loopback.NewWrappingPluginHostClient(&loopback.TestPluginServer{}),
}
pluginRepoFn := func() (*plugin.Repository, error) {
return plugin.NewRepository(rw, rw, kms, sche, plgm)
pluginRepoFn := func() (*hostplugin.Repository, error) {
return hostplugin.NewRepository(rw, rw, kms, sche, plgm)
}
hc := plugin.TestCatalog(t, conn, proj.GetPublicId(), plg.GetPublicId())
hcNoHosts := plugin.TestCatalog(t, conn, proj.GetPublicId(), plg.GetPublicId())
hc := hostplugin.TestCatalog(t, conn, proj.GetPublicId(), plg.GetPublicId())
hcNoHosts := hostplugin.TestCatalog(t, conn, proj.GetPublicId(), plg.GetPublicId())
preferredEndpoints := []string{"cidr:1.2.3.4", "dns:*.foobar.com"}
var wantHs []*pb.HostSet
for i := 0; i < 10; i++ {
h := plugin.TestSet(t, conn, kms, sche, hc, plgm, plugin.WithPreferredEndpoints(preferredEndpoints), plugin.WithSyncIntervalSeconds(5))
h := hostplugin.TestSet(t, conn, kms, sche, hc, plgm, hostplugin.WithPreferredEndpoints(preferredEndpoints), hostplugin.WithSyncIntervalSeconds(5))
wantHs = append(wantHs, &pb.HostSet{
Id: h.GetPublicId(),
HostCatalogId: h.GetCatalogId(),
@@ -405,8 +405,8 @@ func TestList_Plugin(t *testing.T) {
CreatedTime: h.GetCreateTime().GetTimestamp(),
UpdatedTime: h.GetUpdateTime().GetTimestamp(),
Version: h.GetVersion(),
Type: plugin.Subtype.String(),
AuthorizedActions: testAuthorizedActions[plugin.Subtype],
Type: hostplugin.Subtype.String(),
AuthorizedActions: testAuthorizedActions[hostplugin.Subtype],
PreferredEndpoints: preferredEndpoints,
SyncIntervalSeconds: &wrappers.Int32Value{Value: 5},
})
@@ -492,8 +492,8 @@ func TestDelete_Static(t *testing.T) {
repoFn := func() (*static.Repository, error) {
return static.NewRepository(rw, rw, kms)
}
pluginRepoFn := func() (*plugin.Repository, error) {
return plugin.NewRepository(rw, rw, kms, sche, map[string]plgpb.HostPluginServiceClient{})
pluginRepoFn := func() (*hostplugin.Repository, error) {
return hostplugin.NewRepository(rw, rw, kms, sche, map[string]plgpb.HostPluginServiceClient{})
}
hc := static.TestCatalogs(t, conn, proj.GetPublicId(), 1)[0]
h := static.TestSets(t, conn, hc.GetPublicId(), 1)[0]
@@ -563,17 +563,17 @@ func TestDelete_Plugin(t *testing.T) {
repoFn := func() (*static.Repository, error) {
return static.NewRepository(rw, rw, kms)
}
pluginRepoFn := func() (*plugin.Repository, error) {
return plugin.NewRepository(rw, rw, kms, sche, map[string]plgpb.HostPluginServiceClient{})
pluginRepoFn := func() (*hostplugin.Repository, error) {
return hostplugin.NewRepository(rw, rw, kms, sche, map[string]plgpb.HostPluginServiceClient{})
}
name := "test"
plg := hostplugin.TestPlugin(t, conn, name)
plg := plugin.TestPlugin(t, conn, name)
plgm := map[string]plgpb.HostPluginServiceClient{
plg.GetPublicId(): loopback.NewWrappingPluginHostClient(&loopback.TestPluginServer{}),
}
hc := plugin.TestCatalog(t, conn, proj.GetPublicId(), plg.GetPublicId())
h := plugin.TestSet(t, conn, kms, sche, hc, plgm)
hc := hostplugin.TestCatalog(t, conn, proj.GetPublicId(), plg.GetPublicId())
h := hostplugin.TestSet(t, conn, kms, sche, hc, plgm)
s, err := host_sets.NewService(repoFn, pluginRepoFn)
require.NoError(t, err, "Couldn't create a new host set service.")
@@ -641,8 +641,8 @@ func TestDelete_twice(t *testing.T) {
repoFn := func() (*static.Repository, error) {
return static.NewRepository(rw, rw, kms)
}
plgRepoFn := func() (*plugin.Repository, error) {
return plugin.NewRepository(rw, rw, kms, sche, map[string]plgpb.HostPluginServiceClient{})
plgRepoFn := func() (*hostplugin.Repository, error) {
return hostplugin.NewRepository(rw, rw, kms, sche, map[string]plgpb.HostPluginServiceClient{})
}
hc := static.TestCatalogs(t, conn, proj.GetPublicId(), 1)[0]
h := static.TestSets(t, conn, hc.GetPublicId(), 1)[0]
@@ -678,8 +678,8 @@ func TestCreate_Static(t *testing.T) {
repoFn := func() (*static.Repository, error) {
return static.NewRepository(rw, rw, kms)
}
plgRepoFn := func() (*plugin.Repository, error) {
return plugin.NewRepository(rw, rw, kms, sche, map[string]plgpb.HostPluginServiceClient{})
plgRepoFn := func() (*hostplugin.Repository, error) {
return hostplugin.NewRepository(rw, rw, kms, sche, map[string]plgpb.HostPluginServiceClient{})
}
hc := static.TestCatalogs(t, conn, proj.GetPublicId(), 1)[0]
prefEndpoints := []string{"cidr:1.2.3.4", "cidr:2.3.4.5/24"}
@@ -835,9 +835,9 @@ func TestCreate_Plugin(t *testing.T) {
return static.NewRepository(rw, rw, kms)
}
name := "test"
plg := hostplugin.TestPlugin(t, conn, name)
plgRepoFn := func() (*plugin.Repository, error) {
return plugin.NewRepository(rw, rw, kms, sche, map[string]plgpb.HostPluginServiceClient{
plg := plugin.TestPlugin(t, conn, name)
plgRepoFn := func() (*hostplugin.Repository, error) {
return hostplugin.NewRepository(rw, rw, kms, sche, map[string]plgpb.HostPluginServiceClient{
plg.GetPublicId(): loopback.NewWrappingPluginHostClient(&loopback.TestPluginHostServer{
OnCreateSetFn: func(ctx context.Context, req *plgpb.OnCreateSetRequest) (*plgpb.OnCreateSetResponse, error) {
return nil, nil
@@ -845,7 +845,7 @@ func TestCreate_Plugin(t *testing.T) {
}),
})
}
hc := plugin.TestCatalog(t, conn, proj.GetPublicId(), plg.GetPublicId())
hc := hostplugin.TestCatalog(t, conn, proj.GetPublicId(), plg.GetPublicId())
attrs := map[string]any{
"int": 1,
@@ -891,7 +891,7 @@ func TestCreate_Plugin(t *testing.T) {
HostCatalogId: hc.GetPublicId(),
Name: &wrappers.StringValue{Value: "No Attributes"},
Description: &wrappers.StringValue{Value: "desc"},
Type: plugin.Subtype.String(),
Type: hostplugin.Subtype.String(),
SyncIntervalSeconds: &wrapperspb.Int32Value{Value: -1},
}},
res: &pbs.CreateHostSetResponse{
@@ -906,8 +906,8 @@ func TestCreate_Plugin(t *testing.T) {
},
Name: &wrappers.StringValue{Value: "No Attributes"},
Description: &wrappers.StringValue{Value: "desc"},
Type: plugin.Subtype.String(),
AuthorizedActions: testAuthorizedActions[plugin.Subtype],
Type: hostplugin.Subtype.String(),
AuthorizedActions: testAuthorizedActions[hostplugin.Subtype],
SyncIntervalSeconds: &wrapperspb.Int32Value{Value: -1},
},
},
@@ -918,7 +918,7 @@ func TestCreate_Plugin(t *testing.T) {
HostCatalogId: hc.GetPublicId(),
Name: &wrappers.StringValue{Value: "With Attributes"},
Description: &wrappers.StringValue{Value: "desc"},
Type: plugin.Subtype.String(),
Type: hostplugin.Subtype.String(),
SyncIntervalSeconds: &wrapperspb.Int32Value{Value: 90},
Attrs: &pb.HostSet_Attributes{
Attributes: testInputAttrs,
@@ -936,9 +936,9 @@ func TestCreate_Plugin(t *testing.T) {
},
Name: &wrappers.StringValue{Value: "With Attributes"},
Description: &wrappers.StringValue{Value: "desc"},
Type: plugin.Subtype.String(),
Type: hostplugin.Subtype.String(),
SyncIntervalSeconds: &wrapperspb.Int32Value{Value: 90},
AuthorizedActions: testAuthorizedActions[plugin.Subtype],
AuthorizedActions: testAuthorizedActions[hostplugin.Subtype],
Attrs: &pb.HostSet_Attributes{
Attributes: testOutputAttrs,
},
@@ -951,7 +951,7 @@ func TestCreate_Plugin(t *testing.T) {
HostCatalogId: hc.GetPublicId(),
Name: &wrappers.StringValue{Value: "name"},
Description: &wrappers.StringValue{Value: "desc"},
Type: plugin.Subtype.String(),
Type: hostplugin.Subtype.String(),
PreferredEndpoints: prefEndpoints,
}},
res: &pbs.CreateHostSetResponse{
@@ -966,9 +966,9 @@ func TestCreate_Plugin(t *testing.T) {
},
Name: &wrappers.StringValue{Value: "name"},
Description: &wrappers.StringValue{Value: "desc"},
Type: plugin.Subtype.String(),
Type: hostplugin.Subtype.String(),
PreferredEndpoints: prefEndpoints,
AuthorizedActions: testAuthorizedActions[plugin.Subtype],
AuthorizedActions: testAuthorizedActions[hostplugin.Subtype],
},
},
},
@@ -978,7 +978,7 @@ func TestCreate_Plugin(t *testing.T) {
HostCatalogId: hc.GetPublicId(),
Name: &wrappers.StringValue{Value: "name"},
Description: &wrappers.StringValue{Value: "desc"},
Type: plugin.Subtype.String(),
Type: hostplugin.Subtype.String(),
PreferredEndpoints: append(prefEndpoints, "foobar:1.2.3.4"),
}},
err: handlers.ApiErrorWithCode(codes.InvalidArgument),
@@ -1012,8 +1012,8 @@ func TestCreate_Plugin(t *testing.T) {
},
Name: &wrappers.StringValue{Value: "no type name"},
Description: &wrappers.StringValue{Value: "no type desc"},
Type: plugin.Subtype.String(),
AuthorizedActions: testAuthorizedActions[plugin.Subtype],
Type: hostplugin.Subtype.String(),
AuthorizedActions: testAuthorizedActions[hostplugin.Subtype],
},
},
},
@@ -1130,8 +1130,8 @@ func TestUpdate_Static(t *testing.T) {
Id: hs.GetPublicId(),
}
plgRepoFn := func() (*plugin.Repository, error) {
return plugin.NewRepository(rw, rw, kms, sche, map[string]plgpb.HostPluginServiceClient{})
plgRepoFn := func() (*hostplugin.Repository, error) {
return hostplugin.NewRepository(rw, rw, kms, sche, map[string]plgpb.HostPluginServiceClient{})
}
tested, err := host_sets.NewService(repoFn, plgRepoFn)
require.NoError(t, err, "Failed to create a new host set service.")
@@ -1475,7 +1475,7 @@ func TestUpdate_Plugin(t *testing.T) {
rw := db.New(conn)
name := "test"
plg := hostplugin.TestPlugin(t, conn, name)
plg := plugin.TestPlugin(t, conn, name)
plgm := map[string]plgpb.HostPluginServiceClient{
plg.GetPublicId(): loopback.NewWrappingPluginHostClient(&loopback.TestPluginServer{}),
}
@@ -1483,8 +1483,8 @@ func TestUpdate_Plugin(t *testing.T) {
repoFn := func() (*static.Repository, error) {
return static.NewRepository(rw, rw, kms)
}
pluginHostRepo := func() (*plugin.Repository, error) {
return plugin.NewRepository(rw, rw, kms, sche, plgm)
pluginHostRepo := func() (*hostplugin.Repository, error) {
return hostplugin.NewRepository(rw, rw, kms, sche, plgm)
}
iamRepoFn := func() (*iam.Repository, error) {
return iamRepo, nil
@@ -1492,7 +1492,7 @@ func TestUpdate_Plugin(t *testing.T) {
tested, err := host_sets.NewService(repoFn, pluginHostRepo)
require.NoError(t, err, "Failed to create a new host catalog service.")
hc := plugin.TestCatalog(t, conn, proj.GetPublicId(), plg.GetPublicId())
hc := hostplugin.TestCatalog(t, conn, proj.GetPublicId(), plg.GetPublicId())
ctx := auth.DisabledAuthTestContext(iamRepoFn, proj.GetPublicId())
freshSet := func(t *testing.T) *pb.HostSet {
@@ -1504,7 +1504,7 @@ func TestUpdate_Plugin(t *testing.T) {
HostCatalogId: hc.GetPublicId(),
Name: wrapperspb.String("default"),
Description: wrapperspb.String("default"),
Type: plugin.Subtype.String(),
Type: hostplugin.Subtype.String(),
Attrs: &pb.HostSet_Attributes{
Attributes: attr,
},
@@ -1820,8 +1820,8 @@ func TestAddHostSetHosts(t *testing.T) {
repoFn := func() (*static.Repository, error) {
return static.NewRepository(rw, rw, kms)
}
plgRepoFn := func() (*plugin.Repository, error) {
return plugin.NewRepository(rw, rw, kms, sche, map[string]plgpb.HostPluginServiceClient{})
plgRepoFn := func() (*hostplugin.Repository, error) {
return hostplugin.NewRepository(rw, rw, kms, sche, map[string]plgpb.HostPluginServiceClient{})
}
s, err := host_sets.NewService(repoFn, plgRepoFn)
require.NoError(t, err, "Error when getting new host set service.")
@@ -1941,8 +1941,8 @@ func TestSetHostSetHosts(t *testing.T) {
repoFn := func() (*static.Repository, error) {
return static.NewRepository(rw, rw, kms)
}
plgRepoFn := func() (*plugin.Repository, error) {
return plugin.NewRepository(rw, rw, kms, sche, map[string]plgpb.HostPluginServiceClient{})
plgRepoFn := func() (*hostplugin.Repository, error) {
return hostplugin.NewRepository(rw, rw, kms, sche, map[string]plgpb.HostPluginServiceClient{})
}
s, err := host_sets.NewService(repoFn, plgRepoFn)
require.NoError(t, err, "Error when getting new host set service.")
@@ -2058,8 +2058,8 @@ func TestRemoveHostSetHosts(t *testing.T) {
repoFn := func() (*static.Repository, error) {
return static.NewRepository(rw, rw, kms)
}
plgRepoFn := func() (*plugin.Repository, error) {
return plugin.NewRepository(rw, rw, kms, sche, map[string]plgpb.HostPluginServiceClient{})
plgRepoFn := func() (*hostplugin.Repository, error) {
return hostplugin.NewRepository(rw, rw, kms, sche, map[string]plgpb.HostPluginServiceClient{})
}
s, err := host_sets.NewService(repoFn, plgRepoFn)
require.NoError(t, err, "Error when getting new host set service.")